Questions

How to run multiple Python versions on Windows

I had two versions of Python installed on my machine (versions 2.6 and 2.5). I want to run 2.6 for one project and 2.5 for another. How can I specify which I want to use? I am working on Windows XP...

29 Aug at 13:11

gradlew: Permission Denied

I am attempting to run gradlew from my command line, but am constantly facing the following error. ``` Brendas-MacBook-Pro:appx_android brendalogy$ ./gradlew compileDebug --stacktrace -bash: ./gradle...

23 May at 11:55

Store boolean value in SQLite

What is the type for a BOOL value in SQLite? I want to store in my table TRUE/FALSE values. I could create a column of INTEGER and store in it values 0 or 1, but it won't be the best way to implement ...

22 Jan at 07:10

How to join two sets in one line without using "|"

Assume that `S` and `T` are assigned sets. Without using the join operator `|`, how can I find the union of the two sets? This, for example, finds the intersection: ``` S = {1, 2, 3, 4} T = {3, 4, 5...

2 Jul at 15:16

Accurate way to measure execution times of php scripts

I want to know how many milliseconds a PHP for-loop takes to execute. I know the structure of a generic algorithm, but no idea how to implement it in PHP: ``` Begin init1 = timer(); // where timer(...

8 Jan at 18:22

Iif equivalent in C#

Is there an `IIf` equivalent in C#? Or similar shortcut?

TypeError: 'float' object is not subscriptable

``` PizzaChange=float(input("What would you like the new price for all standard pizzas to be? ")) PriceList[0][1][2][3][4][5][6]=[PizzaChange] PriceList[7][8][9][10][11]=[PizzaChange+3] ``` B...

6 Feb at 10:45

Handling JSON Post Request in Go

So I have the following, which seems incredibly hacky, and I've been thinking to myself that Go has better designed libraries than this, but I can't find an example of Go handling a POST request of JS...

28 Mar at 01:16

How to display image with JavaScript?

I am trying to display image, through JavaScript, but i can't figure out how to do that. I have following ``` function image(a,b,c) { this.link=a; this.alt=b; this.thumb=c; } function show_ima...

23 Jul at 15:31

Entity Framework - Include Multiple Levels of Properties

The Include() method works quite well for Lists on objects. But what if I need to go two levels deep? For example, the method below will return ApplicationServers with the included properties shown he...

2 Mar at 13:45

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

C/C++ check if one bit is set in, i.e. int variable

``` int temp = 0x5E; // in binary 0b1011110. ``` Is there such a way to check if bit 3 in temp is 1 or 0 without bit shifting and masking. Just want to know if there is some built in function for t...

7 Feb at 13:19

Maven: best way of linking custom external JAR to my project?

It's my first couple of days learning Maven and I'm still struggling with the basics. I have an external .jar file (not available in the public repos) that I need to reference in my project and I'm tr...

17 Apr at 07:39

Getting content/message from HttpResponseMessage

I'm trying to get content of HttpResponseMessage. It should be: `{"message":"Action '' does not exist!","success":false}`, but I don't know, how to get it out of HttpResponseMessage. ``` HttpClient h...

26 Aug at 23:10

Code-first vs Model/Database-first

I'm trying to fully understand all the approaches to building data access layer using EF 4.1. I'm using Repository pattern and `IoC`. I know I can use code-first approach: define my entities and co...

Insert line after match using sed

For some reason I can't seem to find a straightforward answer to this and I'm on a bit of a time crunch at the moment. How would I go about inserting a choice line of text after the first line matchi...

14 Sep at 22:16

Recommended website resolution (width and height)?

Is there any standard on common website resolution? We are targeting newer monitors, perhaps at least 1280px wide, but the height may varies, and each browser may have different toolbar heights too. ...

18 Dec at 03:26

How to check if character is a letter in Javascript?

I am extracting a character in a Javascript string with: ``` var first = str.charAt(0); ``` and I would like to check whether it is a letter. Strangely, it does not seem like such functionality exi...

15 Sep at 16:38

Open S3 object as a string with Boto3

I'm aware that with Boto 2 it's possible to open an S3 object as a string with: [get_contents_as_string()](http://boto.readthedocs.org/en/latest/ref/file.html?highlight=contents%20string#boto.file.key...

Assign output to variable in Bash

I'm trying to assign the output of cURL into a variable like so: ``` #!/bin/sh $IP=`curl automation.whatismyip.com/n09230945.asp` echo $IP sed s/IP/$IP/ nsupdate.txt | nsupdate ``` However, when I ...

26 Jan at 19:29

How to convert .pem into .key?

I already have purchased SSL certificate and i have received certificate and a .pem file as a private key? from the supplier; now i need to convert this .pem key into .key for bitnami Redmine Apache w...

14 Nov at 19:37

How do I determine what type of exception occurred?

`some_function()` raises an exception while executing, so the program jumps to the `except`: ``` try: some_function() except: print("exception happened!") ``` How do I see what caused the exc...

3 Jul at 18:7

Nodejs cannot find installed module on Windows

I am learning nodejs at the moment on Windows. Several modules are installed globally with npm.cmd, and nodejs failed to find the installed modules. Take jade for example, ``` npm install jade -g ```...

25 Apr at 15:23

Django MEDIA_URL and MEDIA_ROOT

I'm trying to upload an image via the Django admin and then view that image either in a page on the frontend or just via a URL. Note this is all on my local machine. My settings are as follows: ```...

Which is best data type for phone number in MySQL and what should Java type mapping for it be?

I am using MySQL with the Spring JDBC template for my web application. I need to store phone numbers with only digits (10). I am a little bit confused about data type using data type. 1. What is the ...

6 Feb at 14:22