Questions

Is there a way that I can check if a data attribute exists?

Is there some way that I can run the following: ``` var data = $("#dataTable").data('timer'); var diffs = []; for(var i = 0; i + 1 < data.length; i++) { diffs[i] = data[i + 1] - data[i]; } aler...

6 Oct at 15:27

Change "on" color of a Switch

I'm using a standard Switch control with the holo.light theme in a ICS app. I want to change the highlighted or on state color of the Toggle Button from the standard light blue to green. This should...

28 Jun at 23:34

What's the difference between RANK() and DENSE_RANK() functions in oracle?

What's the difference between `RANK()` and `DENSE_RANK()` functions? How to find out nth salary in the following `emptbl` table? ``` DEPTNO EMPNAME SAL ------------------------------ 10 rrr...

11 Sep at 08:2

How do I get a UTC Timestamp in JavaScript?

While writing a web application, it makes sense to store (server side) datetimes in the DB as UTC timestamps. I was astonished when I noticed that you couldn't natively do much in terms of Timezone ...

30 Aug at 18:59

diff current working copy of a file with another branch's committed copy

I have a repo with file `foo` in the master branch. I switched to bar branch and made some changes to `foo`. How can I now run a `git diff` between this copy (which isn't committed yet) and the copy o...

1 Sep at 00:35

PHP 5.4 Call-time pass-by-reference - Easy fix available?

Is there any way to easily fix this issue or do I really need to rewrite all the legacy code? > PHP Fatal error: Call-time pass-by-reference has been removed in ... on line 30 This happens everywhe...

26 Apr at 21:55

GROUP_CONCAT ORDER BY

I've [a table](http://googledrive.com/host/0B53jM4a9X2fqfkhfeV83Tm05VnU4cV9ZSWZlMUNTQzRZUUJQTFdQZUptOEJkdXkyVXFIYmM) like: ``` +-----------+-------+------------+ | client_id | views | percentage | +-...

30 Apr at 20:41

How do I calculate the date in JavaScript three months prior to today?

I Am trying to form a date which is 3 months before the current date. I get the current month by the below code ``` var currentDate = new Date(); var currentMonth = currentDate.getMonth()+1; ``` Ca...

29 Oct at 05:55

java.lang.NoClassDefFoundError: Could not initialize class XXX

``` public class PropHolder { public static Properties prop; static { //code for loading properties from file } } // Referencing the class somewhere else: Properties prop = PropHolder.prop...

How to use mod operator in bash?

I'm trying a line like this: ``` for i in {1..600}; do wget http://example.com/search/link $i % 5; done; ``` What I'm trying to get as output is: ``` wget http://example.com/search/link0 wget http...

5 Apr at 17:23

Make Hibernate ignore instance variables that are not mapped

I thought hibernate takes into consideration only instance variables that are annotated with `@Column`. But strangely today when I added a variable (that is not mapped to any column, just a variable ...

5 Aug at 10:16

Missing include "bits/c++config.h" when cross compiling 64 bit program on 32 bit in Ubuntu

I am running the 32bit version of Ubuntu 10.10 and trying to cross compile to a 64 bit target. Based on my research, I have installed the g++-multilib package. The program is a very simple hello worl...

HttpListener Access Denied

I am writing an HTTP server in C#. When I try to execute the function `HttpListener.Start()` I get an `HttpListenerException` saying > "Access Denied". When I run the app in admin mode in windows ...

Modify table: How to change 'Allow Nulls' attribute from not null to allow null

How to change one attribute in a table using T-SQL to allow nulls (not null --> null)? Alter table maybe?

13 Feb at 15:20

What method in the String class returns only the first N characters?

I'd like to write an extension method to the `String` class so that if the input string to is longer than the provided length `N`, only the first `N` characters are to be displayed. Here's how it loo...

30 Apr at 03:35

Resize a large bitmap file to scaled output file on Android

I have a large bitmap (say 3888x2592) in a file. Now, I want to resize that bitmap to 800x533 and save it to another file. I normally would scale the bitmap by calling `Bitmap.createBitmap` method but...

2 Sep at 15:44

Generic TryParse

I am trying to create a generic extension that uses 'TryParse' to check if a string is a given type: ``` public static bool Is<T>(this string input) { T notUsed; return T.TryParse(input, out ...

3 Jun at 00:5

Histogram using gnuplot?

I know how to create a histogram (just use "with boxes") in gnuplot if my .dat file already has properly binned data. Is there a way to take a list of numbers and have gnuplot provide a histogram base...

18 Mar at 17:10

Google Maps API v3: Can I setZoom after fitBounds?

I have a set of points I want to plot on an embedded Google Map (API v3). I'd like the bounds to accommodate all points unless the zoom level is too low (i.e., zoomed out too much). My approach has ...

Check if Internet Connection Exists with jQuery?

How do you check if there is an internet connection using jQuery? That way I could have some conditionals saying "use the google cached version of JQuery during production, use either that or a local...

How might I find the largest number contained in a JavaScript array?

I have a simple JavaScript Array object containing a few numbers. ``` [267, 306, 108] ``` Is there a function that would find the largest number in this array?

4 Sep at 14:20

Referring to a table in LaTeX

How can you refer to a table number such that you get `Table 7` for instance? Sample data ``` Table \ref{table:questions} lorem lorem ipsun. \begin{table} \label{table:questions} \begin{tabular}{| ...

24 Oct at 15:33

SQL WHERE.. IN clause multiple columns

I need to implement the following query in SQL Server: ``` select * from table1 WHERE (CM_PLAN_ID,Individual_ID) IN ( Select CM_PLAN_ID, Individual_ID From CRM_VCM_CURRENT_LEAD_STATUS Where Lead_...

21 Feb at 16:54

Better way to cast object to int

This is probably trivial, but I can't think of a better way to do it. I have a COM object that returns a variant which becomes an object in C#. The only way I can get this into an int is ``` int tes...

13 Apr at 20:2

What is the best way to do a substring in a batch file?

I want to get the name of the currently running batch file the file extension. Thanks to [this link](https://stackoverflow.com/questions/343518/finding-out-the-file-name-of-the-running-batch-file)...

22 Jan at 16:57