Questions

Proper way to initialize C++ structs

Our code involves a POD (Plain Old Datastructure) struct (it is a basic c++ struct that has other structs and POD variables in it that needs to get initialized in the beginning.) Based one what I've...

What does {0} mean when found in a string in C#?

In a dictionary like this: ``` Dictionary<string, string> openWith = new Dictionary<string, string>(); openWith.Add("txt", "notepad.exe"); openWith.Add("bmp", "paint.exe"); openWith.Add("dib", "pain...

15 Jan at 12:17

How to reset radiobuttons in jQuery so that none is checked

I have radio buttons in HTML like this: ``` <td> <input id="radio1" type="radio" name="correctAnswer" value="1">1</input> <input id="radio2" type="radio" name="correctAnswer" value="2">2</inp...

12 May at 13:37

Checking length of dictionary object

I'm trying to check the length here. Tried count. Is there something I'm missing? ``` var dNames = {}; dNames = GetAllNames(); for (var i = 0, l = dName.length; i < l; i++) { alert("Name...

26 Jul at 17:35

SSH Private Key Permissions using Git GUI or ssh-keygen are too open

Recently I've been unable to clone or push to github, and I'm trying to find the root cause. I have cygwin + git as well as msysgit. Msysgit was installed with the following options: - - That g...

13 Oct at 15:58

Int or Number DataType for DataAnnotation validation attribute

On my MVC3 project, I store score prediction for football/soccer/hockey/... sport game. So one of properties of my prediction class looks like this: ``` [Range(0, 15, ErrorMessage = "Can only be betw...

Bootstrap date and time picker

Suggest me any JavaScript to pick the date and time . NOTE: I want to use only one file for date and time picking. I already see this: [http://www.eyecon.ro/bootstrap-datepicker/](http://www.eye...

Removing duplicate elements from an array in Swift

I might have an array that looks like the following: ``` [1, 4, 2, 2, 6, 24, 15, 2, 60, 15, 6] ``` Or, really, any sequence of like-typed portions of data. What I want to do is ensure that there is o...

24 Sep at 17:8

Is there a stopwatch in Java?

Is there a stopwatch in Java? On Google I only found code of stopwatches that don't work - they always return 0 milliseconds. This code I found doesn't work and I don't see why. ``` public class StopW...

3 Jan at 19:45

Export Postgresql table data using pgAdmin

I am using pgAdmin version 1.14.3. PostgreSQL database version is 9.1. I got all Db script for table creation but unable to export all data inside tables. Could not find any option to export data in ...

29 Jun at 13:36

C# List of objects, how do I get the sum of a property

I have a list of objects. One property of the individual object entry is amount. How do I get the sum of amount? If my list was of type double I may be able to do something like this: ``` double tot...

4 Dec at 04:24

How to get the first item from an associative PHP array?

If I had an array like: ``` $array['foo'] = 400; $array['bar'] = 'xyz'; ``` And I wanted to get the first item out of that array without knowing the key for it, how would I do that? Is there a func...

24 Oct at 06:21

AngularJS toggle class using ng-class

I am trying to toggle the class of an element using `ng-class` ``` <button class="btn"> <i ng-class="{(isAutoScroll()) ? 'icon-autoscroll' : 'icon-autoscroll-disabled'}"></i> </button> ``` isAuto...

3 Oct at 16:37

How to update json file with python

I'm trying to update existing Json file, but from some reason, the requested value is not being changed but the entire set of values (with the new value) is being appended to the original file ``` j...

24 Nov at 09:22

How to set an environment variable in a running docker container

If I have a docker container that I started a while back, what is the best way to set an environment variable in that running container? I set an environment variable initially when I ran the run comm...

22 Jun at 01:54

Where do you include the jQuery library from? Google JSAPI? CDN?

There are a few ways to include jQuery and jQuery UI and I'm wondering what people are using? - - - - I have recently been using Google JSAPI, but have found that it takes a long time to setup an S...

How to clear Laravel route caching on server

This is regarding route cache on localhost # About Localhost I have 2 routes in my route.php file. Both are working fine. No problem in that. I was learning route:clear and route:cache and found ...

16 Aug at 15:57

#pragma pack effect

I was wondering if someone could explain to me what the `#pragma pack` preprocessor statement does, and more importantly, why one would want to use it. I checked out the [MSDN page](https://learn.mic...

22 Aug at 10:5

Use JAXB to create Object from XML String

How can I use the below code to unmarshal a XML string an map it to the JAXB object below? ``` JAXBContext jaxbContext = JAXBContext.newInstance(Person.class); Unmarshaller unmarshaller = jaxbContext...

28 Mar at 12:16

How to get values from IGrouping

I have a question about `IGrouping` and the `Select()` method. Let's say I've got an `IEnumerable<IGrouping<int, smth>>` in this way: ``` var groups = list.GroupBy(x => x.ID); ``` where `list` is ...

18 Dec at 19:53

In GitHub, is there a way to see all (recent) commits on all branches?

In GitHub, is there a way to see all recent commits on all branches. It would be best in reverse chronological order. Maybe I'm snoopy, but I'd like to be able to see what my developers have been up...

25 Nov at 21:40

Reimport a module while interactive

How do I reimport a module? I want to reimport a module after making changes to its .py file.

15 Jul at 07:46

Count with IF condition in MySQL query

I have two tables, one is for news and the other one is for comments and I want to get the count of the comments whose status has been set as approved. ``` SELECT ccc_news . *, count(if(ccc_...

31 Mar at 12:43

Chrome - ERR_CACHE_MISS

Does anybody know what the following Chrome error is? ``` Failed to load resource: net::ERR_CACHE_MISS ``` I have had a look online, but have not found a good answer yet. Somebody said it might be ...

22 Oct at 19:55

Python Unicode Encode Error

I'm reading and parsing an Amazon XML file and while the XML file shows a ' , when I try to print it I get the following error: ``` 'ascii' codec can't encode character u'\u2019' in position 16: ordi...

27 Apr at 04:17