Why do people write the #!/usr/bin/env python shebang on the first line of a Python script?

Why do people write the #!/usr/bin/env python shebang on the first line of a Python script?

It seems to me like the files run the same without that line. 1:If you have several versions of Python installed, /usr/bin/env will ensure the interpreter used is the first one on your environment's $PATH. The alternative would be to har

Disable/enable an input with jQuery?

Disable/enable an input with jQuery?

$input.disabled = true;or $input.disabled = "disabled";Which is the standard way? And, conversely, how do you enable a disabled input? 1:jQuery 1.6+To change the disabled property you should use the .prop() function.$("input").prop('disa

What is the difference between call and apply?

What is the difference between call and apply?

What is the difference between using call and apply to invoke a function?var func = function(){ alert('hello!');};func.apply();vsfunc.call();Are there performance differences between the two methods? When is it best to use call over apply

How can I develop for iPhone using a Windows development machine?

How can I develop for iPhone using a Windows development machine?

Is there any way to tinker with the iPhone SDK on a Windows machine? Are there plans for an iPhone SDK version for Windows?The only other way I can think of doing this is to run a Mac VM image on a VMWare server running on Windows, although

How to merge two arrays in JavaScript and de-duplicate items

How to merge two arrays in JavaScript and de-duplicate items

I have two JavaScript arrays:var array1 = ["Vijendra","Singh"];var array2 = ["Singh", "Shakya"];I want the output to be:var array3 = ["Vijendra","Singh","Shakya"];The output array should have repeated words removed.How do I merge two arrays

What happens to a declared, uninitialized variable in C? Does it have a value?

What happens to a declared, uninitialized variable in C? Does it have a value?

If in C I write:int num;Before I assign anything to num, is the value of num indeterminate? 1:Static variables (file scope and function static) are initialized to zero:int x; // zeroint y = 0; // also zerovoid foo() { static int x; //

Saving Android Activity state using Save Instance State

Saving Android Activity state using Save Instance State

I've been working on Android SDK platform, and it is a little unclear how to save an application's state. So given this minor re-tooling of the 'Hello, Android' example:package com.android.hello;import android.app.Activity;import android.os

Check whether one number equals another number in bash

Check whether one number equals another number in bash

I've been trying to compare whether two numbers in Bash are equal (and print a message if they are equal), but I'm getting some strange error messages for this simple program:#!/bin/bashfun2 (){ $x = 3 //#prog.sh: line 4: =: command n

Any workaround for ignoring unexpected elements in Apache Axis 1.4?

Any workaround for ignoring unexpected elements in Apache Axis 1.4?

The problem was asked before "Apache AXIS Ignore/Skip additional element while parsing" in 2012 for Apache Axis 2. Is there no workaround yet for Axis 1.4?Problem DefinitionFor instance;1- We have a soap response definition('ResponseGetCust

Where do you store your secret key in a Java Web Application? [closed]

Where do you store your secret key in a Java Web Application? [closed]

Cryptography is a widely adopted techonlogy to ensure confidentiality. Not considering implementation flaws, it has a single critical point: the secret key storage. If the secret key is stolen, the whole system will be compromised.EDIT :let

qplot and anti-aliasing in R

qplot and anti-aliasing in R

I am using ggplot2 library and am working with the qplot commandI know I can save my output as an anti-aliased image file by using the following command after my qplot ggsave(file="filename.png")But how about my LCD display? is there any wa

Rule Engine in JavaScript [closed]

Rule Engine in JavaScript [closed]

Is there any Rule engine in JavaScript? The question is in this context:Consider a web application having a form that users fill up.As a user fills up each field and proceeds to the next, business logic written in JavaScript controls the vi

Put a button over an ImageView

Put a button over an ImageView

I'm newbie in Android.I would like to know if it's possible to put a button or another component over an ImageView. I've tried setting the image as a background image of a LinearLayout, but when I change between landscape and portrait mode,

pandas: how to run a pivot with a multi-index?

pandas: how to run a pivot with a multi-index?

I would like to run a pivot on a pandas DataFrame, with the index being two columns, not one. For example, one field for the year, one for the month, an 'item' field which shows 'item 1' and 'item 2' and a 'value' field with numerical value

Strings sent through Web API's gets wrapped in quotes

Strings sent through Web API's gets wrapped in quotes

I've run into a small problem with my Web API's in ASP.NET 4, using C#. I'm trying to create a front-end GUI which sends and receives data through multiple Web API's. The reason for having more than one API has to do with our network, which

.htaccess: Redirect without changing url

.htaccess: Redirect without changing url

I would like to have a URL be redirected to a different page on the same domain but without the browser changing the URL. So the page www.mydomain.co.uk/tour/ should point towards www.mydomain.co.uk/ but without changing.I have looked at a

Protractor “by.css()” vs “$()” Dollar Sign vs “$$()” 'Bling Bling'

Protractor “by.css()” vs “$()” Dollar Sign vs “$$()” 'Bling Bling'

I don't really understand what the $ and $$ commands are for. I thought they are just a replacement for 'by.css' but why the $$? I thought, that given the above, these would be equivalent:element(by.css('#eId'));andelement($('#eId'));Howeve

android how to change  width and height

android how to change width and height

I'm making a layer-list for drawable.I have my background image, and I want the second layer to be smaller,but it seems that not matter what I'm writing inside my android:layer_width\heightThe second layer size remain the same..this is my x

dyld: Library not loaded, Reason: image not found

dyld: Library not loaded, Reason: image not found

I used gdb normally until this week. Now running gdb I see:(gdb) rStarting program: /Volumes/MyProg dyld: Library not loaded: @rpath/libCore.so Referenced from: /Volumes/MyProg Reason: image not found(gdb) How to fix it?I have:OSX 10.9 GN

How to implement real time updates in ASP.NET

How to implement real time updates in ASP.NET

I have seen several websites that show you a real time update of what's going on in the database. An example could beA stock ticker website that shows stock prices in real timeShowing data like "What other users are searching for currently.

Adding a vline in ggplot2 using time

Adding a vline in ggplot2 using time

I am having some problems adding a vertical line to a gplot2 graph.My example dataframe is listed below.set.seed(1234)df There seems to be quite a lot of discussion on stack overflow and the web generally about using vlines on timeseries.

DataGrid in Dojo , with json data from a servlet

DataGrid in Dojo , with json data from a servlet

I am using JSON for first time...and want to fill my datagrid with my JSON data,this is my JSON data :{ "head": { "vars": [ "s" , "fname" , "lname" ] } , "results": { "bindings": [ { "s": { "type": "uri" , "value

Generic version control strategy for select table data within a heavily normalized database

Generic version control strategy for select table data within a heavily normalized database

Sorry for the long winded title, but the requirement/problem is rather specific.With reference to the following sample (but very simplified) structure (in psuedo SQL), I hope to explain it a bit better.TABLE StructureName { Id GUID PK, Na

JavaScript to listen for URL changes in YouTube HTML5 Player

JavaScript to listen for URL changes in YouTube HTML5 Player

I'm writing a Chrome extension so I need to be able to listen for changes in the YouTube URL (i.e., see that you switched videos). YouTube makes this hard because with its HTML5 video player there is no full page reload, there is no URL fra

How do I speed up text searches in R?

How do I speed up text searches in R?

I have a large text vector I would like to search for a particular character or phrase. Regular expressions are taking forever. How do I search it quickly?Sample data:R 1:If you do need regular expressions, you can generally get a per