Questions

jQuery on window resize

I have the following JQuery code: ``` $(document).ready(function () { var $containerHeight = $(window).height(); if ($containerHeight <= 818) { $('.footer').css({ position...

15 Dec at 12:19

Suppress Scientific Notation in Numpy When Creating Array From Nested List

I have a nested Python list that looks like the following: ``` my_list = [[3.74, 5162, 13683628846.64, 12783387559.86, 1.81], [9.55, 116, 189688622.37, 260332262.0, 1.97], [2.2, 768, 6004865.13, 57...

How do you get the magnitude of a vector in Numpy?

In keeping with the "There's only one obvious way to do it", how do you get the magnitude of a vector (1D array) in Numpy? ``` def mag(x): return math.sqrt(sum(i**2 for i in x)) ``` The above ...

10 Oct at 20:26

Cross-Origin Request Headers(CORS) with PHP headers

I have a simple PHP script that I am attempting a cross-domain CORS request: ``` <?php header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Headers: *"); ... ``` Yet I still get t...

16 Dec at 13:24

Find all unchecked checkboxes in jQuery

I have a list of checkboxes: ``` <input type="checkbox" name="answer" id="id_1' value="1" /> <input type="checkbox" name="answer" id="id_2' value="2" /> ... <input type="checkbox" name="answer" id="id...

18 May at 08:23

How to programmatically send a 404 response with Express/Node?

I want to simulate a 404 error on my Express/Node server. How can I do that?

Convert float to String and String to float in Java

How could I convert from float to string or string to float? In my case I need to make the assertion between 2 values string (value that I have got from table) and float value that I have calculated. ...

How to retrieve inserted id after inserting row in SQLite using Python?

How to retrieve inserted id after inserting row in SQLite using Python? I have table like this: ``` id INT AUTOINCREMENT PRIMARY KEY, username VARCHAR(50), password VARCHAR(50) ``` I insert a new r...

21 Dec at 17:31

How to merge a transparent png image with another image using PIL

I have a transparent png image `foo.png` and I've opened another image with: ``` im = Image.open("foo2.png") ``` Now what I need is to merge `foo.png` with `foo2.png`. (`foo.png` contains some text a...

Assign null to a SqlParameter

The following code gives an error - "No implicit conversion from DBnull to int." ``` SqlParameter[] parameters = new SqlParameter[1]; SqlParameter planIndexParameter = new SqlParameter("@AgeIndex...

16 May at 09:41

Simple and fast method to compare images for similarity

I need a simple and fast way to compare two images for similarity. I.e. I want to get a high value if they contain exactly the same thing but may have some slightly different background and may be mov...

How to retrieve absolute path given relative

Is there a command to retrieve the absolute path given a relative path? For example I want $line to contain the absolute path of each file in dir `./etc/` ``` find ./ -type f | while read line; do ...

24 May at 13:13

How can I remove all text after a character in bash?

How can I remove all text after a character, in this case a colon (":"), in bash? Can I remove the colon, too? I have no idea how to.

12 Nov at 19:34

Fatal error: Class 'ZipArchive' not found in

I have a problem that I install 'Archive_Zip 0.1.1' on Linux server, but when I try to run the script to create the zip file it gives the fatal error > Fatal error: Class `ZipArchive` not found in .....

20 Feb at 15:33

Cancellation token in Task constructor: why?

Certain `System.Threading.Tasks.Task` constructors take a `CancellationToken` as a parameter: ``` CancellationTokenSource source = new CancellationTokenSource(); Task t = new Task (/* method */, sour...

How to update only one field using Entity Framework?

Here's the table ``` UserId UserName Password EmailAddress ``` and the code.. ``` public void ChangePassword(int userId, string password){ //code to update the password.. } ```

How to append text to a text file in C++?

How to append text to a text file in C++? And create a new text file if it does not already exist and append text to it if it does exist.

30 Dec at 23:8

Generate a heatmap using a scatter data set

I have a set of X,Y data points (about 10k) that are easy to plot as a scatter plot but that I would like to represent as a heatmap. I looked through the examples in Matplotlib and they all seem to al...

30 Aug at 16:17

Why does ReSharper want to use 'var' for everything?

I've just started using ReSharper with Visual Studio (after the many recommendations on SO). To try it out I opened up a recent ASP.NET MVC project. One of the first and most frequent things I've noti...

29 Jan at 19:46

What are the specific differences between .msi and setup.exe file?

I searched a lot, but all are guessed answers. Help me to find the exact answer.

What does the restrict keyword mean in C++?

I was always unsure, what does the restrict keyword mean in C++? Does it mean the two or more pointer given to the function does not overlap? What else does it mean?

2 Aug at 18:18

How to get the python.exe location programmatically?

Basically I want to get a handle of the python interpreter so I can pass a script file to execute (from an external application).

14 Apr at 23:29

How to check if an object is nullable?

How do I check if a given object is nullable in other words how to implement the following method... ``` bool IsNullableValueType(object o) { ... } ``` I am looking for nullable I didn't have re...

9 Apr at 20:50

How are echo and print different in PHP?

> [Reference: Comparing PHP's print and echo](https://stackoverflow.com/questions/7094118/reference-comparing-phps-print-and-echo) Is there any major and fundamental difference between these t...

23 May at 12:2

RegEx for matching UK Postcodes

I'm after a regex that will validate a full complex UK postcode only within an input string. All of the uncommon postcode forms must be covered as well as the usual. For instance: - - - - - - -...