Questions

How can I publish an npm package with distribution files?

I would like to publish a npm package that contains my source as well as distribution files. My GitHub repository contains `src` folder which contains JavaScript source files. The build process genera...

7 Aug at 22:28

Does Java SE 8 have Pairs or Tuples?

I am playing around with lazy functional operations in Java SE 8, and I want to `map` an index `i` to a pair / tuple `(i, value[i])`, then `filter` based on the second `value[i]` element, and finally ...

Return multiple columns from pandas apply()

I have a pandas DataFrame, `df_test`. It contains a column 'size' which represents size in bytes. I've calculated KB, MB, and GB using the following code: ``` df_test = pd.DataFrame([ {'dir': '...

19 Apr at 11:40

Java 8 stream's .min() and .max(): why does this compile?

Note: this question originates from a dead link which was a previous SO question, but here goes... See this code (`Integer::compare`): ``` final ArrayList <Integer> list = IntStream.rangeClosed...

28 Aug at 13:50

Measuring execution time of a function in C++

I want to find out how much time a certain function takes in my C++ program to execute on . Afterwards, I want to make a speed comparison . I saw several time function but ended up with this from boos...

17 Dec at 12:12

Android Gallery on Android 4.4 (KitKat) returns different URI for Intent.ACTION_GET_CONTENT

Before KitKat (or before the new Gallery) the `Intent.ACTION_GET_CONTENT` returned a URI like this > content://media/external/images/media/3951. Using the `ContentResolver` and quering for `MediaSto...

Importing variables from another file?

How can I import variables from one file to another? example: `file1` has the variables `x1` and `x2` how to pass them to `file2`? How can I import of the variables from one to another?

11 Jan at 17:37

Remove a prefix from a string

I am trying to do the following, in a clear pythonic way: ``` def remove_prefix(str, prefix): return str.lstrip(prefix) print remove_prefix('template.extensions', 'template.') ``` This gives: ...

3 Jun at 06:47

How to suppress warnings globally in an R Script

I have a long R script that throws some warnings, which I can ignore. I could use ``` suppressWarnings(expr) ``` for single statements. But how can I suppress warnings in R globally? Is there an o...

7 Apr at 12:55

Combine :after with :hover

I want to combine `:after` with `:hover` in CSS (or any other pseudo selector). I basically have a list and the item with the `selected` class has an arrow shape applied using `:after`. I want the s...

9 Jun at 08:34

Delete all the queues from RabbitMQ?

I installed `rabbitmqadmin` and was able to list all the exchanges and queues. How can I use `rabbitmqadmin` or `rabbitmqctl` to delete all the queues.

8 Mar at 10:20

How to compare Lists in Unit Testing

How can this test fail? ``` [TestMethod] public void Get_Code() { var expected = new List<int>(); expected.AddRange(new [] { 100, 400, 200, 900, 2300, 1900 }); var actual = new List<int>...

Double exclamation points?

> [What is the !! (not not) operator in JavaScript?](https://stackoverflow.com/questions/784929/what-is-the-not-not-operator-in-javascript) [What does the !! operator (double exclamation point) m...

4 Jun at 07:42

jQuery `.is(":visible")` not working in Chrome

``` if ($("#makespan").is(":visible") == true) { var make = $("#make").val(); } else { var make = $("#othermake").val(); } Make:<span id=makespan><select id=make></select><span id=othermak...

18 Mar at 20:14

log4j logging hierarchy order

What is the hierarchy of log4j logging? ``` DEBUG INFO WARN ERROR FATAL ``` Which one provides the highest logging which would be helpful to troubleshoot issues? Can any one provide the order or hi...

12 Oct at 20:6

Eclipse - "Workspace in use or cannot be created, chose a different one."

I'm trying to create a workspace in the `/Users/Shared/` directory with the thought that I can share that workspace between users. The problem is that after I create the workspace and change the permi...

19 Sep at 01:57

Replace multiple characters in a C# string

Is there a better way to replace strings? I am surprised that Replace does not take in a character array or string array. I guess that I could write my own extension but I was curious if there is a ...

12 Jun at 09:8

Max return value if empty query

I have this query: ``` int maxShoeSize = Workers .Where(x => x.CompanyId == 8) .Max(x => x.ShoeSize); ``` What will be in `maxShoeSize` if company 8 has no workers at all? How can I chang...

Override body style for content in an iframe

How can I control the background image and colour of a body element within an `iframe`? Note, the embedded body element has a class, and the `iframe` is of a page that is part of my site. The reason...

3 Jun at 21:40

Generate UML Class Diagram from Java Project

Is there a good tool that can help to reverse engineer Java classes to UML that will show an overview of how my classes are related to each other? It doesn't need to decompile from JAR file because I ...

Find location of a removable SD card

Is there a universal way to find the location of an external SD card? Please, do not be confused with [External Storage](http://developer.android.com/guide/topics/data/data-storage.html#filesExternal)...

1 Aug at 08:35

How to see log files in MySQL?

I've read that Mysql server creates a log file where it keeps a record of all activities - like when and what queries execute. Can anybody tell me where it exists in my system? How can I read it? ...

6 Jul at 12:4

How to run the sftp command with a password from Bash script?

I need to transfer a log file to a remote host using [sftp](http://en.wikipedia.org/wiki/Secure_file_transfer_program) from a Linux host. I have been provided credentials for the same from my operatio...

23 May at 11:47

Set timeout for ajax (jQuery)

``` $.ajax({ url: "test.html", error: function(){ //do something }, success: function(){ //do something } }); ``` Sometimes `success` function works good, sometim...

16 Sep at 10:53

How to get the seconds since epoch from the time + date output of gmtime()?

How do you do reverse `gmtime()`, where you put the time + date and get the number of seconds? I have strings like `'Jul 9, 2009 @ 20:02:58 UTC'`, and I want to get back the number of seconds between...

14 Jan at 03:41