Questions

No Multiline Lambda in Python: Why not?

I've heard it said that multiline lambdas can't be added in Python because they would clash syntactically with the other syntax constructs in Python. I was thinking about this on the bus today and re...

5 Aug at 14:0

How to bind RadioButtons to an enum?

I've got an enum like this: ``` public enum MyLovelyEnum { FirstSelection, TheOtherSelection, YetAnotherOne }; ``` I got a property in my DataContext: ``` public MyLovelyEnum VeryLovel...

21 Oct at 14:37

Why is there no ForEach extension method on IEnumerable?

Inspired by another question asking about the missing `Zip` function: Why is there no `ForEach` extension method on the `IEnumerable` interface? Or anywhere? The only class that gets a `ForEach` metho...

27 Jan at 03:44

Push multiple elements to array

I'm trying to push multiple elements as one array, but getting an error: ``` > a = [] [] > a.push.apply(null, [1,2]) TypeError: Array.prototype.push called on null or undefined ``` I'm trying to do s...

23 Mar at 07:33

HTTP Error 503, the service is unavailable

I'm really new to setting up web servers in general. I've got IIS 8 on Windows 8, and I'm trying to set up a little site locally, while doing some development. In IIS I choose Add Site, give a name, p...

27 Nov at 21:2

SQL query return data from multiple tables

I would like to know the following: - - - - I am planning to use this in my (for example - PHP) application, but don't want to run multiple queries against the database, what options do I have to g...

12 Apr at 20:51

Mockito : how to verify method was called on an object created within a method?

I am new to Mockito. Given the class below, how can I use Mockito to verify that `someMethod` was invoked exactly once after `foo` was invoked? ``` public class Foo { public void foo(){ ...

23 Mar at 15:9

How can I change the version of npm using nvm?

I've been using NVM to install the latest versions of Node.js for my Node.js work. It works totally fine for installing separate versions and switching between them. It also installs the latest versio...

9 Aug at 19:32

Replace a character at a specific index in a string?

I'm trying to replace a character at a specific index in a string. What I'm doing is: ``` String myName = "domanokz"; myName.charAt(4) = 'x'; ``` This gives an error. Is there any method to do t...

How to add leading zeros?

I have a set of data which looks something like this: ``` anim <- c(25499,25500,25501,25502,25503,25504) sex <- c(1,2,2,1,2,1) wt <- c(0.8,1.2,1.0,2.0,1.8,1.4) data <- data.frame(anim,sex,wt) dat...

17 Oct at 06:8

How to print color in console using System.out.println?

How can I print color in console? I want to show data in colors when the processor sends data and in different colors when it receives data.

24 Jul at 04:6

Check orientation on Android phone

How can I check if the Android phone is in Landscape or Portrait?

8 May at 22:10

How to check if an NSDictionary or NSMutableDictionary contains a key?

I need to check if an dict has a key or not. How?

30 Aug at 20:17

git: Your branch is ahead by X commits

How does this actually come about? I am working in one repo by myself at the moment, so this is my workflow: 1. Change files 2. Commit 3. Repeat 1-2 until satisfied 4. Push to master Then when I...

29 Sep at 13:30

What is the use of GO in SQL Server Management Studio & Transact SQL?

SQL Server Management Studio always inserts a GO command when I create a query using the right click "Script As" menu. Why? What does GO actually do?

4 Apr at 15:13

join list of lists in python

Is the a short syntax for joining a list of lists into a single list( or iterator) in python? For example I have a list as follows and I want to iterate over a,b and c. ``` x = [["a","b"], ["c"]] ...

4 Apr at 04:0

How to re import an updated package while in Python Interpreter?

I often test my module in the Python Interpreter, and when I see an error, I quickly update the .py file. But how do I make it reflect on the Interpreter ? So, far I have been exiting and reentering t...

26 Mar at 01:19

Android 8.0: java.lang.IllegalStateException: Not allowed to start service Intent

On application launch, app starts the service that should to do some network task. After targeting API level 26, my application fails to start service on Android 8.0 on background. > Caused by: java...

Determining type of an object in ruby

I'll use python as an example of what I'm looking for (you can think of it as pseudocode if you don't know Python): ``` >>> a = 1 >>> type(a) <type 'int'> ``` I know in ruby I can do : ``` 1.9.3p1...

25 Oct at 21:10

What does !important mean in CSS?

What does `!important` mean in CSS? Is it available in CSS 2? CSS 3? Where is it supported? All modern browsers?

25 Sep at 00:44

Remove last commit from remote Git repository

How can I remove the last commit from a remote GIT repository such as I don't see it any more in the log? If for example `git log` gives me the following commit history ``` A->B->C->D[HEAD, ORIGIN] ``...

27 Sep at 11:53

MySQL: Select DISTINCT / UNIQUE, but return all columns?

``` SELECT DISTINCT field1, field2, field3, ...... FROM table; ``` I am trying to accomplish the following SQL statement, but I want it to return . Is this possible? Something like this: ``` SELECT D...

6 Sep at 04:55

Is there a Python equivalent of the C# null-coalescing operator?

In C# there's a [null-coalescing operator](http://msdn.microsoft.com/en-us/library/ms173224.aspx) (written as `??`) that allows for easy (short) null checking during assignment: ``` string s = null; ...

12 Feb at 15:4

How to run test methods in specific order in JUnit4?

I want to execute test methods which are annotated by `@Test` in specific order. For example: ``` public class MyTest { @Test public void test1(){} @Test public void test2(){} } ``` I want...

28 Oct at 10:59

onKeyPress Vs. onKeyUp and onKeyDown

What is the difference between these three events? Upon googling I found that: > - `onKeyDown`- `onKeyUp`- `onKeyPress``onKeyDown``onKeyUp` I understand the first two, but isn't `onKeyPress` the sam...

14 Mar at 10:55