Questions

How to build minified and uncompressed bundle with webpack?

Here's my `webpack.config.js` ``` var webpack = require("webpack"); module.exports = { entry: "./entry.js", devtool: "source-map", output: { path: "./dist", filename: "bundle.min.js" ...

21 Sep at 17:43

How do you sign a Certificate Signing Request with your Certification Authority?

During my search, I found several ways of signing a SSL Certificate Signing Request: 1. Using the x509 module: openssl x509 -req -days 360 -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -ou...

29 Dec at 16:2

input() error - NameError: name '...' is not defined

I am getting an error when I try to run this simple script: ``` input_variable = input("Enter your name: ") print("your name is" + input_variable) ``` Let's say I type in "dude", the error I am getti...

23 Nov at 05:44

live output from subprocess command

I'm using a python script as a driver for a hydrodynamics code. When it comes time to run the simulation, I use `subprocess.Popen` to run the code, collect the output from `stdout` and `stderr` into ...

What command means "do nothing" in a conditional in Bash?

Sometimes when making conditionals, I need the code to do nothing, e.g., here, I want Bash to do nothing when `$a` is greater than "10", print "1" if `$a` is less than "5", otherwise, print "2": ``` ...

11 May at 01:12

JSON.stringify output to div in pretty print way

I `JSON.stringify` a json object by ``` result = JSON.stringify(message, my_json, 2) ``` The `2` in the argument above is supposed to pretty print the result. It does this if I do something like `al...

How do I delete an item or object from an array using ng-click?

I am trying to write a function that enables me to remove an item when the button is clicked but I think I am getting confused with the function - do I use `$digest`? HTML & app.js: ``` <ul ng-repea...

16 Mar at 21:6

Does static constexpr variable inside a function make sense?

If I have a variable inside a function (say, a large array), does it make sense to declare it both `static` and `constexpr`? `constexpr` guarantees that the array is created at compile time, so would ...

8 Aug at 10:13

Angular JS break ForEach

I have an angular foreach loop and i want to break from loop if i match a value. The following code does not work. ``` angular.forEach([0,1,2], function(count){ if(count == 1){ break; } }); `...

12 Dec at 16:16

How to create a drop-down list?

How can I create a drop-down list? I've tried a ScrollView but it's not exactly what I need.

How to terminate script execution when debugging in Google Chrome?

When stepping through JavaScript code in Google Chrome debugger, how do I terminate script execution if I do not want to continue? The only way I found is closing the browser window. Pressing "Reload...

How to format a number 0..9 to display with 2 digits (it's NOT a date)

I'd like to always show a number under 100 with 2 digits (example: 03, 05, 15...) How can I append the 0 without using a conditional to check if it's under 10? I need to append the result to another...

24 Nov at 23:10

How to convert date to timestamp?

I want to convert date to timestamp, my input is `26-02-2012`. I used ``` new Date(myDate).getTime(); ``` It says NaN.. Can any one tell how to convert this?

24 Sep at 21:35

Find the day of a week

Let's say that I have a date in R and it's formatted as follows. ``` date 2012-02-01 2012-02-01 2012-02-02 ``` Is there any way in R to add another column with the day of the week associated...

8 Jul at 12:38

How to know/change current directory in Python shell?

I am using Python 3.2 on Windows 7. When I open the Python shell, how can I know what the current directory is and how can I change it to another directory where my modules are?

4 Sep at 00:16

How to read an entire file to a string using C#?

What is the quickest way to read a text file into a string variable? I understand it can be done in several ways, such as read individual bytes and then convert those to string. I was looking for a m...

25 Jan at 11:6

Why is Python running my module when I import it, and how do I stop it?

I have a Python program I'm building that can be run in either of 2 ways: the first is to call `python main.py` which prompts the user for input in a friendly manner and then runs the user input throu...

21 Oct at 02:19

How to scale down a range of numbers with a known min and max value

So I am trying to figure out how to take a range of numbers and scale the values down to fit a range. The reason for wanting to do this is that I am trying to draw ellipses in a java swing jpanel. I...

14 Mar at 06:6

Core dump file analysis

What are all the things I will need to check while analyzing a core dump file? Please tell me from scratch.

2 Dec at 11:5

Remove the first character of a string

I would like to remove the first character of a string. For example, my string starts with a `:` and I want to remove that only. There are several occurrences of `:` in the string that shouldn't be r...

23 Jan at 20:42

Android customized button; changing text color

I made a button that changes the background drawable on different states, this way: ``` <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" an...

Check if a number is int or float

Here's how I did it: ``` inNumber = somenumber inNumberint = int(inNumber) if inNumber == inNumberint: print "this number is an int" else: print "this number is a float" ``` Something like ...

27 Dec at 19:14

Google Chrome display JSON AJAX response as tree and not as a plain text

I cannot find an answer to this one: My AJAX calls return JSON data. In Google Chrome Developer Tools > Resources > XHR when I click on the resource on the left and then on the Content tab I see the J...

26 May at 15:17

Common elements comparison between 2 lists

Given two input lists, how can I create a list of the elements that are common to both inputs? For example: for inputs `[1,2,3,4,5,6]` and `[3,5,7,9]`, the result should be `[3, 5]`; for inputs `['thi...

6 Jan at 00:57

How to convert a PNG image to a SVG?

How to convert a PNG image to a SVG?

6 Mar at 10:16