Questions

How can I move HEAD back to a previous location? (Detached head) & Undo commits

In Git, I was trying to do a `squash commit` by merging in another branch and then resetting `HEAD` to the previous place via: ``` git reset origin/master ``` But I need to step out of this. How ca...

How to read data from excel file using c#

My application needs to read data from an excel file. I am using .Net and c# for development. I cannot install MS office in the system. Because of that the my application fails to read excel file and...

7 Oct at 17:21

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

HTML5 phone number validation with pattern

I'm using HTML5 form validation to validate phone numbers from India. Phone numbers from India are 10 digits long, and start with 7, 8, or 9. For example: 1. 7878787878 2. 9898989898 3. 8678678878...

1 Aug at 12:5

SQL Server: SELECT only the rows with MAX(DATE)

I have a table of data (the db is MSSQL): ``` ID OrderNO PartCode Quantity DateEntered 417 2144 44917 100 18-08-11 418 7235 11762 5 18-08-11 419 9999 60657 100 ...

8 Dec at 12:52

Variable might not have been initialized error

When I try to compile this: ``` public static Rand searchCount (int[] x) { int a ; int b ; ... for (int l= 0; l<x.length; l++) { if (x[l] == 0) a++ ; else...

7 Jan at 18:8

How to delete shared preferences data from App in Android

How do I delete SharedPreferences data for my application? I'm creating an application that uses a lot of web services to sync data. For testing purposes, I need to wipe out some SharedPreferences va...

14 Nov at 07:13

How do I set vertical space between list items?

Within a `<ul>` element, clearly the vertical spacing between lines can be formatted with the line-height attribute. My question is, within a `<ul>` element, how do I set the vertical spacing between...

20 Jun at 16:53

Can you call Directory.GetFiles() with multiple filters?

I am trying to use the `Directory.GetFiles()` method to retrieve a list of files of multiple types, such as `mp3`'s and `jpg`'s. I have tried both of the following with no luck: ``` Directory.GetFil...

15 Jan at 02:45

How to return multiple values?

Is it possible to return two or more values from a method to main in Java? If so, how it is possible and if not how can we do?

19 Jun at 08:27

php is null when empty?

I have a question regarding `NULL` in PHP: ``` $a = ''; if($a == NULL) { echo 'is null'; } ``` Why do I see when `$a` is an empty string? Is that a bug?

20 Jul at 12:29

Why does fatal error "LNK1104: cannot open file 'C:\Program.obj'" occur when I compile a C++ project in Visual Studio?

I've created a new C++ project in Visual Studio 2008. No code has been written yet; Only project settings have been changed. When I compile the project, I receive the following fatal error: > fata...

25 Sep at 14:35

How do I concatenate multiple C++ strings on one line?

C# has a syntax feature where you can concatenate many data types together on 1 line. ``` string s = new String(); s += "Hello world, " + myInt + niceToSeeYouString; s += someChar1 + interestingDecim...

Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. Manifest definition does not match the assembly reference

Things I've tried after searching: 1. in Web.Config put a binding on the old version: <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neut...

12 Mar at 09:59

Test if number is odd or even

What is the simplest most basic way to find out if a number/variable is odd or even in PHP? Is it something to do with mod? I've tried a few scripts but.. google isn't delivering at the moment.

27 Mar at 15:24

Add a horizontal scrollbar to an HTML table

Is there a way to add a horizontal scrollbar to an HTML table? I actually need it to be scrollable both vertically and horizontally depending on how the table grows but I cannot get either scrollbar t...

6 Sep at 12:20

Is "else if" faster than "switch() case"?

I'm an ex Pascal guy, currently learning C#. My question is the following: Is the code below faster than making a switch? ``` int a = 5; if (a == 1) { .... } else if(a == 2) { .... } else i...

How to check if a variable is equal to one string or another string?

``` if var is 'stringone' or 'stringtwo': dosomething() ``` This does not work! I have a variable and I need it to do something when it is either of the values, but it will not enter the if stat...

25 Jul at 06:57

ActiveMQ or RabbitMQ or ZeroMQ or

We'd be interested to hear any experiences with the pros and cons of ActiveMQ vs RabbitMQ vs ZeroMQ. Information about any other interesting message queues is also welcome.

How to split a string in shell and get the last field

Suppose I have the string `1:2:3:4:5` and I want to get its last field (`5` in this case). How do I do that using Bash? I tried `cut`, but I don't know how to specify the last field with `-f`.

2 Nov at 14:17

How to check if a Constraint exists in Sql server?

I have this sql: ``` ALTER TABLE dbo.ChannelPlayerSkins DROP CONSTRAINT FK_ChannelPlayerSkins_Channels ``` but apparently, on some other databases we use, the constraint has a different name. H...

Find the number of downloads for a particular app in apple appstore

I need to do a market research on specific type of apps. so is there a way for me to know the download count of the app / any app. Is there a way to find the number of downloads for a particular app ...

6 Apr at 15:59

Placing an image to the top right corner - CSS

I need to display an image on the top-right corner of a div (the image is a "diagonal" ribbon) but keeping the current text contained in an internal div, like stuck to the top of it. I tried differen...

9 Jun at 17:27

php_network_getaddresses: getaddrinfo failed: Name or service not known

Here is a snippet of my code ``` $fp = fsockopen($s['url'], 80, $errno, $errstr, 5); if($fp){ fwrite($fp, $out); fclose($fp); ``` When I run it, it outputs: > unable to connect to ...

8 Jan at 14:42

Define an <img>'s src attribute in CSS

I need to define an <img>'s src attribute in CSS. Is there a way to specify this attribute?

20 Apr at 15:55