Array of arrays (Python/NumPy)

I am using Python/NumPy, and I have two arrays like the following: And I would like to create a new array: and append items to it. So for example if the new items to append are: Then now array3 would be an array with two rows and two columns like the one shown below: I … Read more

JavaScript TypeError: Cannot read property ‘style’ of null

In your script, this part: must be returning null and you are also attempting to set the display property to an invalid value. There are a couple of possible reasons for this first part to be null. You are running the script too early before the document has been loaded and thus the Noite item can’t be found. There is no Noite item in … Read more

How to drop all tables from a database with one SQL query?

Use the INFORMATION_SCHEMA.TABLES view to get the list of tables. Generate Drop scripts in the select statement and drop it using Dynamic SQL: Sys.Tables Version Note: If you have any foreign Keys defined between tables then first run the below query to disable all foreign keys present in your database. For more information, check here.

mysql Foreign key constraint is incorrectly formed error

I ran into this same problem with HeidiSQL. The error you receive is very cryptic. My problem ended up being that the foreign key column and the referencing column were not of the same type or length. The foreign key column was SMALLINT(5) UNSIGNED and the referenced column was INT(10) UNSIGNED. Once I made them both the same … Read more

Best way to replace multiple characters in a string?

Replacing two characters I timed all the methods in the current answers along with one extra. With an input string of abc&def#ghi and replacing & -> \& and # -> \#, the fastest way was to chain together the replacements like this: text.replace(‘&’, ‘\&’).replace(‘#’, ‘\#’). Timings for each function: a) 1000000 loops, best of 3: 1.47 μs per … Read more

pg_config executable not found

I am having trouble installing psycopg2. I get the following error when I try to pip install psycopg2: But the problem is pg_config is actually in my PATH; it runs without any problem: I tried adding the pg_config path to the setup.cfg file and building it using the source files I downloaded from their website (http://initd.org/psycopg/) and I get the following … Read more