Questions

Getting a list of values from a list of dicts

I have a list of dicts like this: ``` [{'value': 'apple', 'blah': 2}, {'value': 'banana', 'blah': 3} , {'value': 'cars', 'blah': 4}] ``` I want `['apple', 'banana', 'cars']` Whats the best way...

5 Apr at 08:4

Generate class from database table

How can I generate a class from a SQL Server table object? I'm not talking about using some ORM. I just need to create the entities (simple class). Something like: ``` public class Person { ...

11 Jul at 16:51

How to exit if a command failed?

I am a noob in shell-scripting. I want to print a message and exit my script if a command fails. I've tried: ``` my_command && (echo 'my_command failed; exit) ``` but it does not work. It keeps exe...

21 Mar at 04:35

How to Convert JSON object to Custom C# object?

Is there an easy way to populate my C# Object with the JSON object passed via AJAX? This is the JSON Object passed to C# WEBMETHOD from the page using JSON.stringify ``` { "user": { "name"...

10 May at 22:33

How to use localization in C#

I just can't seem to get localization to work. I have a class library. Now I want to create files in there, and return some values based on the thread culture. How can I do that?

4 Dec at 17:28

How to use Class<T> in Java?

There's a good discussion of Generics and what they really do behind the scenes over at [this question](https://stackoverflow.com/questions/31693/differences-in-generics), so we all know that `Vector<...

23 May at 12:18

Inner join vs Where

Is there a difference in performance (in oracle) between ``` Select * from Table1 T1 Inner Join Table2 T2 On T1.ID = T2.ID ``` And ``` Select * from Table1 T1, Table2 T2 Where T1.ID = T2.ID ``` ...

3 Jun at 22:0

Is there any way to configure multiple registries in a single npmrc file

Here is my problem. We have a private NPM registry which only works in VPN. I would like to have a fallback registry [https://registry.npmjs.org](https://registry.npmjs.org) so that when I am out of V...

5 Jul at 08:30

Setting a max character length in CSS

I am making responsive website for school and my question is: How do I set a max character length of the sentences (with CSS) on my website (like 75 characters) that when I have a very large screen, ...

21 Feb at 09:44

How to trap on UIViewAlertForUnsatisfiableConstraints?

I'm seeing an error appear in my debugger log: ``` Will attempt to recover by breaking constraint <NSLayoutConstraint:0x191f0920 H:[MPKnockoutButton:0x17a876b0]-(34)-[MPDetailSlider:0x17a8bc50](LTR)...

How can I add the new "Floating Action Button" between two widgets/layouts

I guess you have seen the new Android design guidelines, with the new "Floating Action Button" a.k.a "FAB" For instance this pink button: ![enter image description here](https://i.stack.imgur.com/xC...

Remove last character from string. Swift language

How can I remove last character from String variable using Swift? Can't find it in documentation. Here is full example: ``` var expression = "45+22" expression = expression.substringToIndex(countEle...

9 Jun at 14:34

Android list view inside a scroll view

I have an android layout which has a `scrollView` with a number of elements with in it. At the bottom of the `scrollView` I have a `listView` which is then populated by an adapter. The problem that I...

Trying to git pull with error: cannot open .git/FETCH_HEAD: Permission denied

Help me please, I am trying to run this in my terminal: ``` asgard@asgard-A7N8X2-0:~/CollegePortal$ git pull error: cannot open .git/FETCH_HEAD: Permission denied ``` Then I try this one ``` asgar...

4 Oct at 12:34

One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?

I am trying to compile this code in Microsoft Visual C# 2010 ``` using System; using System.Globalization; class main { static void Main() { dynamic d; d = "dyna"; ...

23 May at 11:47

Is there a way to add/remove several classes in one single instruction with classList?

So far I have to do this: ``` elem.classList.add("first"); elem.classList.add("second"); elem.classList.add("third"); ``` While this is doable in jQuery, like this ``` $(elem).addClass("first seco...

3 Sep at 23:32

Difference between primary key and unique key

I'm using a MySQL database. In which situations should I create a unique key or a primary key?

Dictionaries and default values

Assuming `connectionDetails` is a Python dictionary, what's the best, most elegant, most "pythonic" way of refactoring code like this? ``` if "host" in connectionDetails: host = connectionDetails...

6 Jan at 03:35

Form inside a table

I'm including some forms inside a HTML table to add new rows and update current rows. The problem that I'm getting is that when I inspect the forms in my dev tools, I see that the form elements are cl...

23 Nov at 11:37

How to get Activity's content view?

What method should I call to know if an Activity has its contentView (once the method has been called)?

28 Apr at 10:0

Is there a math nCr function in python?

I'm looking to see if built in with the math library in python is the nCr (n Choose r) function: ![enter image description here](https://i.stack.imgur.com/OZj2Y.png) I understand that this can be prog...

25 Jun at 03:10

Git diff says subproject is dirty

I have just run a git diff, and I am getting the following output for all of my approx 10 submodules ``` diff --git a/.vim/bundle/bufexplorer b/.vim/bundle/bufexplorer --- a/.vim/bundle/bufexplorer ...

16 Jun at 11:59

How to use UTF-8 in resource properties with ResourceBundle

I need to use UTF-8 in my resource properties using Java's `ResourceBundle`. When I enter the text directly into the properties file, it displays as mojibake. My app runs on Google App Engine. Can a...

How to deal with INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES without uninstall?

I tried to reinstall an apk ``` $adb install -r new.apk ``` And it shows the error: ``` Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES] ``` One solution is to uninstall and install the ...

8 Jun at 16:0