Questions

Adding header for HttpURLConnection

I'm trying to add header for my request using `HttpUrlConnection` but the method `setRequestProperty()` doesn't seem working. The server side doesn't receive any request with my header. ``` HttpURLCo...

19 Oct at 18:1

rejected master -> master (non-fast-forward)

I'm trying to push my project (all files in a new repository). I follow the steps but when I push with `git push -u origin master` I get this error: ``` ! [rejected] master -> master (non-fast...

18 Jun at 10:15

Where is PHP.ini in Mac OS X Lion?

I wanted to run some PHP right on my Mac, uncommented httpd.conf, activated web sharing, installed MySQL etc. I can't seem to find my PHP files, most importantly, PHP.ini. On my old machine it was lo...

21 Mar at 01:38

ArrayBuffer to base64 encoded string

I need an efficient (read native) way to convert an `ArrayBuffer` to a base64 string which needs to be used on a multipart post.

How to set auto increment primary key in PostgreSQL?

I have a table in PostgreSQL with many columns, and I want to add an auto increment primary key. I tried to create a column called `id` of type `BIGSERIAL` but pgadmin responded with an error: > ``` E...

23 Oct at 12:2

Foreach loop, determine which is the last iteration of the loop

I have a `foreach` loop and need to execute some logic when the last item is chosen from the `List`, e.g.: ``` foreach (Item result in Model.Results) { //if current result is the last item in ...

19 Sep at 19:34

Check if a string is a date value

What is an easy way to check if a value is a valid date, any known date format allowed. For example I have the values `10-11-2009`, `10/11/2009`, `2009-11-10T07:00:00+0000` which should all be recog...

1 Aug at 08:44

How to wait for the 'end' of 'resize' event and only then perform an action?

So I currently use something like: ``` $(window).resize(function(){resizedw();}); ``` But this gets called many times while resizing process goes on. Is it possible to catch an event when it ends? ...

Shortest way to print current year in a website

I need to update a few hundred static HTML pages that have the copyright date hard coded in the footer. I want to replace it with some JavaScript that will automatically update each year. Currently I...

7 Sep at 12:51

What does `unsigned` in MySQL mean and when to use it?

What does "unsigned" mean in MySQL and when should I use it?

18 Jan at 13:48

How do I disable text selection with CSS or JavaScript?

I am making a HTML/CSS/jQuery gallery, with several pages. I indeed have a "next" button, which is a simple link with a jQuery click listener. The problem is that if the user click the button severa...

30 May at 20:25

URL encode sees “&” (ampersand) as “&” HTML entity

I am encoding a string that will be passed in a URL (via GET). But if I use `escape`, `encodeURI` or `encodeURIComponent`, `&` will be replaced with `%26amp%3B`, but I want it to be replaced with `%26...

30 Jan at 18:40

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

I'm working on getting my database to talk to my Java programs. Can someone give me a quick and dirty sample program using the JDBC? I'm getting a rather stupendous error: ``` Exception in thread "...

23 Oct at 13:32

View list of all JavaScript variables in Google Chrome Console

In Firebug, the DOM tab shows a list of all your public variables and objects. In Chrome's console you have to type the name of the public variable or object you want to explore. Is there a way - or ...

UIWebView open links in Safari

I have a very simple UIWebView with content from my application bundle. I would like any links in the web view to open in Safari instead of in the web view. Is this possible?

28 Apr at 08:24

Open existing file, append a single line

I want to open a text file, append a single line to it, then close it.

14 May at 19:30

Difference in System. exit(0) , System.exit(-1), System.exit(1 ) in Java

I'd like to know the difference between the following in Java ``` System.exit(0); System.exit(-1); System.exit(1); ``` When do I have to use the above code appropriately?

24 May at 17:59

How can I debug javascript on Android?

I'm working on a project that involves Raphaeljs. Turns out, it doesn't work on Android. It on the iPhone. How the heck to I go about debugging something on the Android browser? It's WebKit, so if I...

22 Feb at 22:50

How can I make the cursor turn to the wait cursor?

How can I display the Wait/Busy Cursor (usually the hourglass) to the user to let them know the program is doing something?

AWS ssh access 'Permission denied (publickey)' issue

How to connect to a AWS instance through ssh? I have: 1. Signed up at AWS; 2. Created a public key and a certificate at AWS website and saved them to disk; 3. Went to my console and created environ...

11 Jul at 17:8

How to search through all Git and Mercurial commits in the repository for a certain string?

I have a Git repository with few branches and dangling commits. I would like to search all such commits in repository for a specific string. I know how to get a log of all commits in history, but the...

24 Jan at 14:38

How to convert string into float in JavaScript?

I am trying to parse two values from a datagrid. The fields are numeric, and when they have a comma (ex. 554,20), I can't get the numbers after the comma. I've tried `parseInt` and `parseFloat`. How c...

23 Apr at 09:32

Adding images or videos to iPhone Simulator

I am trying to use `UIImagePickerController` with `UIImagePickerControllerSourceTypePhotoLibrary`, but it says, "No photos". Where does the simulator get the images from? Where should I copy the image...

Extracting text from HTML file using Python

I'd like to extract the text from an HTML file using Python. I want essentially the same output I would get if I copied the text from a browser and pasted it into notepad. I'd like something more ...

How can I inject a property value into a Spring Bean which was configured using annotations?

I have a bunch of Spring beans which are picked up from the classpath via annotations, e.g. ``` @Repository("personDao") public class PersonDaoImpl extends AbstractDaoImpl implements PersonDao { ...

25 Jan at 15:5