Questions

Randomize a List<T>

What is the best way to randomize the order of a generic list in C#? I've got a finite set of 75 numbers in a list I would like to assign a random order to, in order to draw them for a lottery type ap...

3 May at 13:1

How do I use valgrind to find memory leaks?

How do I use valgrind to find the memory leaks in a program? Please someone help me and describe the steps to carryout the procedure? I am using Ubuntu 10.04 and I have a program `a.c`, please help ...

15 Mar at 12:53

JavaScript string encryption and decryption?

I'm interested in building a small app for personal use that will encrypt and decrypt information on the client side using JavaScript. The encrypted information will be stored in a database on a serv...

5 Sep at 17:23

How to set xlim and ylim for a subplot

I would like to limit the X and Y axis in matplotlib for a specific subplot. The subplot figure itself doesn't have any axis property. I want for example to change only the limits for the second plot:...

15 Sep at 04:43

What is the difference between ( for... in ) and ( for... of ) statements?

I know what is a `for... in` loop (it iterates over the keys), but I have heard about `for... of` for the first time (it iterates over values). I am confused about `for... of` loop. ``` var arr = [3, ...

26 Jan at 15:14

How to do case insensitive search in Vim

I'd like to search for an upper case word, for example COPYRIGHT in a file. I tried performing a search like: ``` /copyright/i # Doesn't work ``` but it doesn't work. I know that in Perl, if I ...

2 Apr at 12:50

Replace all spaces in a string with '+'

I have a string that contains multiple spaces. I want to replace these with a plus symbol. I thought I could use ``` var str = 'a b c'; var replaced = str.replace(' ', '+'); ``` but it only replac...

9 Aug at 03:46

How to send a PUT/DELETE request in jQuery?

`GET`:`$.get(..)` `POST`:`$.post()..` What about `PUT/DELETE`?

13 May at 08:53

How to copy a row and insert in same table with a autoincrement field in MySQL?

In MySQL I am trying to copy a row with an `column ID=1` and the data into same table as a new row with `column ID=2`. How can I do this in a single query?

5 May at 13:6

Jquery change background color

I was trying out jquery with this example: ``` $(document).ready(function(){ $("button").mouseover(function(){ $("p#44.test").css("background-color","yellow"); $("p#44.test").h...

6 Jan at 20:2

Side-by-side plots with ggplot2

I would like to place two plots side by side using the [ggplot2 package](http://crantastic.org/packages/ggplot2), i.e. do the equivalent of `par(mfrow=c(1,2))`. For example, I would like to have the ...

20 Dec at 16:48

R memory management / cannot allocate vector of size n Mb

I am running into issues trying to use large objects in R. For example: ``` > memory.limit(4000) > a = matrix(NA, 1500000, 60) > a = matrix(NA, 2500000, 60) > a = matrix(NA, 3500000, 60) Error: canno...

Insert text with single quotes in PostgreSQL

I have a table `test(id,name)`. I need to insert values like: `user's log`, `'my user'`, `customer's`. ``` insert into test values (1,'user's log'); insert into test values (2,''my users''); inse...

How to run a cron job inside a docker container?

I am trying to run a cronjob inside a docker container that invokes a shell script. Yesterday I have been searching all over the web and stack overflow, but I could not really find a solution that wor...

9 Mar at 17:25

Why is there no SortedList in Java?

In Java there are the [SortedSet](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/SortedSet.html) and [SortedMap](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/ja...

18 Apr at 20:39

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

I am using Python 3.6. When I try to install "modules" using `pip3`, I face this issue: ``` pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available ```...

21 Dec at 15:48

Call one constructor from another

I have two constructors which feed values to readonly fields. ``` public class Sample { public Sample(string theIntAsString) { int i = int.Parse(theIntAsString); _intField = i...

20 Aug at 18:13

Local dependency in package.json

I want to do something like this, so `npm install` also installs the `package.json` of `../somelocallib` or more importantly its dependencies. ``` "dependencies": { "express": "*", "../somelo...

17 Jan at 15:2

How do I get the file name from a String containing the Absolute file path?

`String` variable contains a file name, `C:\Hello\AnotherFolder\The File Name.PDF`. How do I only get the file name `The File Name.PDF` as a String? I planned to split the string, but that is not the...

25 Jan at 17:26

MySQL: How to reset or change the MySQL root password?

How do I change the MySQL root password and username in ubuntu server? Do I need to stop the mysql service before setting any changes? I have a phpmyadmin setup as well, will phpmyadmin get updated...

5 Oct at 08:53

IEnumerable vs List - What to Use? How do they work?

I have some doubts over how Enumerators work, and LINQ. Consider these two simple selects: ``` List<Animal> sel = (from animal in Animals join race in Species ...

12 Sep at 13:53

java.lang.OutOfMemoryError: GC overhead limit exceeded

I am getting this error in a program that creates several (hundreds of thousands) HashMap objects with a few (15-20) text entries each. These Strings have all to be collected (without breaking up into...

10 Aug at 14:17

Is there a command to undo git init?

I just Git init'ed a repos with a wrong user, and want to undo it. Is there any command for this? Do I actually have to go in and edit the .git directory?

13 Sep at 22:43

How do I find the length (or dimensions, size) of a numpy matrix in python?

For a numpy matrix in python ``` from numpy import matrix A = matrix([[1,2],[3,4]]) ``` How can I find the length of a row (or column) of this matrix? Equivalently, how can I know the number of row...

4 Feb at 01:45

DateTime2 vs DateTime in SQL Server

Which one: - [datetime](https://msdn.microsoft.com/en-us/library/ms187819.aspx)- [datetime2](https://msdn.microsoft.com/en-us/library/bb677335.aspx) is recommended way to store date and time in SQ...

20 Mar at 19:25