Questions

Splitting string with pipe character ("|")

I'm not able to split values from this string: `"Food 1 | Service 3 | Atmosphere 3 | Value for money 1 "` Here's my current code: ``` String rat_values = "Food 1 | Service 3 | Atmosphere 3 | Value...

3 Feb at 10:22

YouTube API to fetch all videos on a channel

We need a video list by channel name of YouTube (using the API). We can get a channel list (only channel name) by using the below API: ``` https://gdata.youtube.com/feeds/api/channels?v=2&q=tendulka...

22 Feb at 13:0

WebRTC vs Websockets: If WebRTC can do Video, Audio, and Data, why do I need Websockets?

So I'm looking to build a chat app that will allow video, audio, and text. I spent some time researching into Websockets and WebRTC to decide which to use. Since there are plenty of video and audio ap...

13 Feb at 10:9

Moving uncommitted changes to a new branch

> [Move existing, uncommited work to a new branch in Git](https://stackoverflow.com/questions/1394797/move-existing-uncommited-work-to-a-new-branch-in-git) I have some code in branch ABC. Af...

23 May at 11:33

Accessing Session Using ASP.NET Web API

I realize session and REST don't exactly go hand in hand but is it not possible to access session state using the new Web API? `HttpContext.Current.Session` is always null.

7 Mar at 00:49

tight_layout() doesn't take into account figure suptitle

If I add a subtitle to my matplotlib figure it gets overlaid by the subplot's titles. Does anybody know how to easily take care of that? I tried the `tight_layout()` function, but it only makes things...

18 Sep at 02:3

In Python, how do you convert a `datetime` object to seconds?

I have a bunch of datetime objects and I want to calculate the number of seconds since a fixed time in the past for each one (for example since January 1, 1970). ``` import datetime t = datetime.datet...

29 Dec at 00:54

How do I read image data from a URL?

What I'm trying to do is fairly simple when we're dealing with a local file, but the problem comes when I try to do this with a remote URL. Basically, I'm trying to create a PIL image object from a f...

10 Dec at 16:26

How to print (using cout) a number in binary form?

I'm following a college course about operating systems and we're learning how to convert from binary to hexadecimal, decimal to hexadecimal, etc. and today we just learned how signed/unsigned numbers ...

Sorting data based on second column of a file

I have a file of 2 columns and `n` number of rows. column1 contains `names` and column2 `age`. I want to sort the content of this file in ascending order based on the `age` (in second column). The res...

17 Jun at 08:27

How can I split a string into segments of n characters?

As the title says, I've got a string and I want to split into segments of characters. For example: ``` var str = 'abcdefghijkl'; ``` after some magic with `n=3`, it will become ``` var arr = ['a...

19 Sep at 21:30

Listing all extras of an Intent

For debugging reasons I want to list all extras (and their values) of an Intent. Now, getting the keys isn't a problem ``` Set<String> keys = intent.getExtras().keySet(); ``` but getting the values...

11 May at 18:31

Wait for page load in Selenium

How do you make [Selenium](http://en.wikipedia.org/wiki/Selenium_%28software%29) 2.0 wait for the page to load?

Java List.add() UnsupportedOperationException

I try to add objects to a `List<String>` instance but it throws an `UnsupportedOperationException`. Does anyone know why? My Java code: ``` String[] membersArray = request.getParameterValues('member...

error, string or binary data would be truncated when trying to insert

I am running data.bat file with the following lines: ``` Rem Tis batch file will populate tables cd\program files\Microsoft SQL Server\MSSQL osql -U sa -P Password -d MyBusiness -i c:\data.sql ``` ...

27 Nov at 22:30

How can one see the structure of a table in SQLite?

How can I see the structure of table in [SQLite](http://en.wikipedia.org/wiki/SQLite) as `desc` was in Oracle?

26 May at 20:30

Why check both isset() and !empty()

Is there a difference between `isset` and `!empty`. If I do this double boolean check, is it correct this way or redundant? and is there a shorter way to do the same thing? ``` isset($vars[1]) AND !e...

22 May at 18:28

Why doesn't Mockito mock static methods?

I read a few threads here about static methods, and I think I understand the problems misuse/excessive use of static methods can cause. But I didn't really get to the bottom of why it is hard to mock ...

13 Sep at 22:59

Method to Add new or update existing item in Dictionary

In some legacy code i have see the following extension method to facilitate adding a new key-value item or updating the value, if the key already exists. Method-1 (legacy code). ``` public static vo...

16 Nov at 15:24

Performance differences between debug and release builds

I must admit, that usually I haven't bothered switching between the and configurations in my program, and I have usually opted to go for the configuration, even when the programs are actually deplo...

When to use setAttribute vs .attribute= in JavaScript?

Has a best-practice around using `setAttribute` instead of the dot (`.`) attribute notation been developed? E.g.: ``` myObj.setAttribute("className", "nameOfClass"); myObj.setAttribute("id", "someID...

3 Feb at 04:14

How to check for changes on remote (origin) Git repository

What are the Git commands to do the following workflow? I cloned from a repository and did some commits of my own to my local repository. In the meantime, my colleagues made commits to the remote rep...

25 Oct at 04:22

What is the correct syntax for 'else if'?

I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1. Everything has gone fine until I tried to use the 'else if' statement. The interpreter gives me a syntax error after the 'if' in...

5 Mar at 15:3

How do I interpret precision and scale of a number in a database?

I have the following column specified in a database: decimal(5,2) How does one interpret this? According to the properties on the column as viewed in SQL Server Management studio I can see that it m...

27 Dec at 20:55

What's the yield keyword in JavaScript?

I heard about a "yield" keyword in JavaScript, but I found very poor documentation about it. Can someone explain me (or recommend a site that explains) its usage and what it is used for?

29 Jul at 19:2