Questions

How to use ESLint with Jest

I'm attempting to use the ESLint linter with the Jest testing framework. Jest tests run with some globals like `jest`, which I'll need to tell the linter about; but the tricky thing is the director...

25 Jul at 17:47

I want to remove double quotes from a String

I want to remove the `""` around a String. e.g. if the String is: `"I am here"` then I want to output only `I am here`.

30 Dec at 14:21

How to check String in response body with mockMvc

I have simple integration test ``` @Test public void shouldReturnErrorMessageToAdminWhenCreatingUserWithUsedUserName() throws Exception { mockMvc.perform(post("/api/users").header("Authorization...

20 Dec at 13:38

Format date with Moment.js

I have a string in this format: ``` var testDate = "Fri Apr 12 2013 19:08:55 GMT-0500 (CDT)" ``` I would like to use [Moment.js](https://momentjs.com/timezone/docs/) get it in this format `mm/dd/yyyy...

28 Sep at 13:30

.NET NewtonSoft JSON deserialize map to a different property name

I have following JSON string which is received from an external party. ``` { "team":[ { "v1":"", "attributes":{ "eighty_min_score":"", "home_or_away...

Test if a command outputs an empty string

How can I test if a command outputs an empty string?

10 Sep at 18:1

How to hide output of subprocess

I'm using eSpeak on Ubuntu and have a Python 2.7 script that prints and speaks a message: ``` import subprocess text = 'Hello World.' print text subprocess.call(['espeak', text]) ``` eSpeak produce...

25 Sep at 18:20

Can't ignore UserInterfaceState.xcuserstate

I'm using Git for Xcode 4 project version control. I've explicitly added `ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState.xcuserstate` to `.gitignore`...

3 Jul at 17:5

NumPy array initialization (fill with identical values)

I need to create a NumPy array of length `n`, each element of which is `v`. Is there anything better than: ``` a = empty(n) for i in range(n): a[i] = v ``` I know `zeros` and `ones` would work...

19 May at 20:18

Comprehensive beginner's virtualenv tutorial?

I've been hearing the buzz about virtualenv lately, and I'm interested. But all I've heard is a smattering of praise, and don't have a clear understanding of what it is or how to use it. I'm looking ...

27 Aug at 15:56

How to get the user input in Java?

I attempted to create a calculator, but I can not get it to work because I don't know . How can I get the user input in Java?

19 May at 21:56

How to get a Color from hexadecimal Color String

I'd like to use a color from an hexa string such as `"#FFFF0000"` to (say) change the background color of a Layout. `Color.HSVToColor` looks like a winner but it takes a `float[]` as a parameter. Am ...

17 Jul at 10:35

How to generate .NET 4.0 classes from xsd?

What are the options to generate .NET 4.0 c# classes (entities) from an xsd file, using Visual Studio 2010?

16 Mar at 16:12

How to view AndroidManifest.xml from APK file?

Is it possible to view `Androidmanifest.xml` file? I just changed the extension of the `apk` file to `zip`. This `zip` file contains the `Androidmanifest.xml` file. But I am unable view the contents ...

19 Aug at 09:17

How do I remove javascript validation from my eclipse project?

I am using eclipse on my project and while messing around with my eclipse settings, I turned on Javascript support. Now eclipse complains that JQuery library has errors in it and is not letting me com...

Non-static variable cannot be referenced from a static context

I've written this test code: ``` class MyProgram { int count = 0; public static void main(String[] args) { System.out.println(count); } } ``` But it gives the following erro...

Does it make sense to use "as" instead of a cast even if there is no null check?

In development blogs, online code examples and (recently) even a book, I keep stumbling about code like this: ``` var y = x as T; y.SomeMethod(); ``` or, even worse: ``` (x as T).SomeMethod(); ```...

31 Mar at 07:28

How do I change screen orientation in the Android emulator?

How do we change emulator screen orientation to landscape or portrait?

How to decode HTML entities using jQuery?

How do I use jQuery to decode HTML entities in a string?

10 Jul at 19:56

Auto Generate Database Diagram MySQL

I'm tired of opening Dia and creating a database diagram at the beginning of every project. Is there a tool out there that will let me select specific tables and then create a database diagram for me ...

How do I update Anaconda?

I have Anaconda installed on my computer and I'd like to update it. In Navigator I can see that there are several individual packages that can be updated, but also an `anaconda` package that sometime...

19 Jul at 17:55

Eslint: How to disable "unexpected console statement" in Node.js?

I'm using eslint with Sublime Text 3 and I am writing `gulpfile.js`. ``` /*eslint-env node*/ var gulp = require('gulp'); gulp.task('default', function(){ console.log('default task'); }); ``` B...

How to list active connections on PostgreSQL?

Is there a command in PostgreSQL to select active connections to a given database? `psql` states that I can't drop one of my databases because there are , so I would like to see what the connections ...

How can I replace every occurrence of a String in a file with PowerShell?

Using PowerShell, I want to replace all exact occurrences of `[MYID]` in a given file with `MyValue`. What is the easiest way to do so?

25 Apr at 16:59

Rails 4: before_filter vs. before_action

In rails >4.0.0 generators creates CRUD operations with `before_action` not `before_filter`. It seems to do the same thing. So what's the difference between these two?