array – How to remove duplicate code when performing actions on a Python list filtered by an if statement

I wrote the following function for a CLI tool, it works as expected, but it also contains duplicate code.

def populate_teams_tab (self):
teams = self.get_data (self.TEAMS_URL)
return_list = []
    for teams in teams:
if self.IS_ROGUE:
if team['id'].upper () == "ROGUE":
# Here, I have some lines of manipulation that add all
# the ROGUE teams to a list that will be sent back
# I'm going to simplify these steps for clarity by using the following line
return_list.append (team)
other:
# Here, I have the same lines of manipulation that add all
# the teams to a list that will be returned
# I'm going to simplify these steps for clarity by using the following line
return_list.append (team)

Is adding an extra support function the best idea or maybe there is a more elegant way to remove the duplicate part?

How to concatenate a SQL Server statement?

I have a table in SQL Server Management Studio in which I have the fields
test | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08
Create a for loop in Visual Studio C # in another table that counted the number of times that a Y note remained after the X note. This calculation took more than 18 minutes. I then created an entire SQL statement and the calculation was reduced to 50 seconds. I have tried to migrate the instruction format in this table above, but as the columns have two decimal places (01, 02, 03 .. 08), I can not implement the instruction SQL for this table in question.
The instruction in question would be:

DECLARE @ note1 INT
DECLARE @ nota2 INT
DECLARE @ posicao1 INT
DECLARE @ posicao2 INT

SET @ nota1 = 1
SET @ nota2 = 2
SET @ posicao1 = 1
SET @ posicao2 = 2

DURING @ nota2 <= 20
To start
PENDANT @ note1 <= 20
To start
WHILE @ position <= 7
To start
PENDANT @ position2 <= 8
To start
INSERT INTO table2 ([nota1], [posicao1], [nota2], [posicao2], [qtde]) VALUES
(
@ nota1,
@ posicao1,
@ nota2,
@ posicao2,
(SELECT COUNT (1) AS & # 39; Value & # 39;
Of the table
Where & # 39;[0' + @posicao1 + ']& # 39; = @ nota1 AND & # 39;[' + @posicao2 + ']& # 39; = @ note2))
SET @ posicao2 + = 1
END
SET @ position1 + = 1
END
SET @ nota1 + = 1
END
Together
@ nota2 + = 1
END

The SELECT statement to use must be the same as the example:

SELECT COUNT (1) AS & # 39; Value & # 39; FROM the WHERE table [01] = @ nota1 AND [02] = @ nota2

How to create the while statement when adding two decimal places? Or how to concatenate?

MySQL: Can not Add a Foreign Key in the Create Table Statement

The following queries (assigned to php variables) seem to be a problem in the second query, where I set the foreign key to the "couponId" column of the first table. My IDE says "couponId" (inside the foreign key declaration) to indicate that there is a problem.

Does anyone see what is the problem? Below, the error and function / creation query

// codeception is a tester, so I think it's injecting "temporary" into the create statements

WordPress database error Can not add a foreign key constraint for CREATE TEMPORARY TABLE query IF NOT EXISTS wp_frequentVisitorCoupons_targets (
targetId mediumint non null auto_increment unique,
primary key (targetId),
isSitewide tinyint (1) is not null,
targetUrl varchar (500),
displayThreshold tinyint (5) not null by default 20,
offerCutoff tinyint (5),
fk_coupons_targets mediumint non-unique,
the foreign key (fk_coupons_targets) refers to wp_frequentVisitorCoupons_coupons (couponId) when removing the cascade
) manufactured by Codeception  Application-> run,  



// the function create a table
Public static function createTablesIfNotExists () {
global $ wpdb;

$ createCouponTableQuery = "CREATE TABLE IF NOT EXISTED {$ wpdb-> prefix} fvc_coupons (
couponId mediumint non null auto_increment unique,
primary key (couponId),
totalHits mediumint non null,
isText boolean not null,
filename varchar (200),
folderDateString varchar (7)
) ";

$ createTargetTableQuery = "CREATE TABLE IF NOT EXISTED {$ wpdb-> prefix} fvc_targets ($
targetId mediumint non null auto_increment unique,
primary key (targetId),
isSitewide tinyint (1) is not null,
targetUrl varchar (500),
displayThreshold tinyint (5) not null by default 20,
offerCutoff tinyint (5),
fk_coupons_targets mediumint non-unique,
foreign key (fk_coupons_targets) references {$ wpdb-> prefix} fvc_coupons (couponId) when deleting the cascade
) ";

require_once (ABSPATH. & # 39; wp-admin / includes / upgrade.php & # 39;);
dbDelta ($ createCouponTableQuery);
dbDelta ($ createTargetTableQuery);

}

oracle sqldeveloper – Error in the SQL statement

Okay, I have an exercise that uses sqldevelop and I see my sentence equal to that of the teacher but I give myself an error and no
the exercises is this program odificar PL / SQL which makes it possible to increase by 10% the salary of an employee whose number is entered on the keyboard.

DECLARED
cursor curs (number of argument) IS
SELECT * FROM temple where numen = argument for salar update;
save curs% rowtype;
to start
OPEN curs (& Number_employee);
FETCH curs INTO register;
UPDATE temple SET salar = salar * 1.1 PLACE OF THE CURRENT
CLOSE curs;
END;

This is the link of the script in case you would like to try https://www.dropbox.com/s/2v4jgswdp4ux8bd/CreaTrasCor.SQL?dl=0

Error Report -
ORA-06550: line 3, column 32:
PL / SQL: ORA-00904: "NUMEN": Invalid identifier
ORA-06550: line 3, column 5:
PL / SQL: SQL statement ignored
ORA-06550: line 2, column 12:
PLS-00341: The cursor declaration & # 39; CURS & # 39; is incomplete or poorly formed
ORA-06550: line 4, column 14:
PL / SQL: ignored element
ORA-06550: line 7, column 18:
PLS-00320: the type declaration of this expression is incomplete or poorly formed
ORA-06550: line 7, column 2:
PL / SQL: SQL statement ignored
06550. 00000 - "line% s, column% s:  n% s"
* Cause: Usually a PL / SQL compilation error.

How to use the prepared statement for Microsoft SQL Xpath queries in Java

I have trouble using Prepared Statement for sql xml xpath query below in java.

SELECT * FROM dbo.EMPLOYEE_DTLS WHERE EMPLOYEE_DTLS.EMP_XML.exist (// emp / empId[text()[1]=]& # 39;) = 1 AND (EMPLOYEE_DTLS.EMP_XML.exist (& # 39; // emp / designationList / designation[contains(.,?)]& # 39;) = 1 OR EMPLOYEE_DTLS.EMP_XML.exist (& # 39; // emp / designationList / designation[contains(.,?)]& # 39;) = 1 OR 1! = 1)

I would like to set values ​​to all places with? symbol. Since? is within single quotes in xpath, it is not considered a placeholder and I can not define the values. Someone can help me with this. Any help is greatly appreciated.

How to prove this statement of the geometric series

If we have $ sum_ {n = 0} ^ { infty} r ^ {i} $, that converges towards $ S = frac {1} {1-r} $, shows CA $ S – s_n = frac {r ^ {n + 1}} {1-r} $, or $ s_n $ is the sum of the first n terms.

My approach,

$ S – s_n = frac {1} {1-r} – frac {1-r ^ n} {1-r} = frac {r ^ n} {1-r} $

So, there is no $ r ^ {n + 1} $ in my answer as in the question. If we have $ s_n $, that means the sum of the first $ n $ terms, so there should not be any $ n + 1 $.

Where am I wrong?

primary key – The ALTER TABLE statement conflicts with the FOREIGN KEY constraint

I had a specific relational database with different tables. what I wanted to do is actually copy two tables from different databases located on a different server into my database with the help of the Microsoft SQL Server Management Studio 2017 export function. new tables have been imported into my current database. However, the problem is that the tables that were exported from the other database in mine do not have primary and foreign keys. So, what I did, I deleted the old tables from my current database and I am now working on adding primary and foreign keys to freshly copied ones.

The problem is that I was able to create the primary keys without any problem, however, when I tried to create the foreign key to the second table to bind it to the first table, I had this mistake:

The ALTER TABLE statement conflicts with the FOREIGN KEY constraint

I know the reason for the mistake because of the unparalleled number of items in my first and second tables. I ran this query:

select UUT_RESULT in STEP_RESULT
WHERE UUT_RESULT NOT IN
(SELECT UUT_RESULT ID)

I could see that there are 883 entries in my second table does not fit in the first table.

How can I solve this problem? I can not clean the tables because they contain 15 million entries. Is there any way to remove these 883 from the second table and match the two?

Write a powerful mission and vision statement for $ 17

Write a powerful mission and vision statement

I will write a powerful mission and vision statement, a slogan and 3 values ​​- 350 words.

The mission statement and vision is essential for any serious organization. You will be able to inform stakeholders, employees and customers about your goals, direction and intentions.

With over 10 years of experience, I know how to write a powerful mission statement and vision that gives your organization the clear voice it needs. Thanks to my statements, you will be able to establish the identity of your brand with the public and internally provide a compass for decision-making.

My services will be authentic, professional and accurate, writing your:

  • Mission – What are you dedicated to doing.
  • Vision – The ultimate goal you work for.
  • Values – The essential that is part of every step you make.
  • Slogan – A catchy line that gives more character to your profile!


A professional page about us can also be written to provide even more depth on your story and your activities.

The content can be customized for any platform, including your:

  • About us page
  • the biography
  • Organic
  • summary
  • Social media pages (Facebook, Twitter, etc.)
  • Website

.

Syntax Error in the Java Update Statement

I'm trying to update the bbdd but i have a syntax error in the line of the sql statement:

String sql = "update vehicle defined Model =" + leer.nextLine () + "where model =" + model "& # 39;"

Error message: "; expected".
Thank you in advance.

Scanner read = new Scanner (System.in);
System.out.println ("We will modify the model of a vehicle.");
System.out.println ("Which template do you want to change?");
String template = leer.nextLine ();
String sql = "update vehicle defined Model =" + leer.nextLine () + "where model =" + model "& # 39;"
Stat statement = con.prepareStatement (sql);
stat.executeUpdate (sql);

sharepoint online – Function not called in a conditional statement

I have a function that generates a table of contents. It works perfectly. However, this also works when the page is in edit mode and causes a lot of damage.

For that, I found the solution in the second part of the code below. The code seems to work well as evidenced by the outputs in the console log, corresponding to the current site ("true") or not ("false") in edit mode. However, when the site is NOT in edit mode, I think it's calling the GenerateTOC function, but this is not the case.

I have a very limited understanding of javascript, so I am a little lost here, especially if I think I can call other functions. Normally I called him by

_spBodyOnLoadFunctionNames.push (GenerateTOC & nbsp;)

but I guess it does not apply anymore …