Questions

How to set multiple commands in one yaml file with Kubernetes?

In this official document, it can run command in a yaml config file: > [https://kubernetes.io/docs/tasks/configure-pod-container/](https://kubernetes.io/docs/tasks/configure-pod-container/) ``` apiV...

11 Sep at 03:14

How to ensure order of processing in java8 streams?

I want to process lists inside an `XML` java object. I have to ensure processing all elements in order I received them. Should I therefore call `sequential` on each `stream` I use? `list.stream().seq...

25 Mar at 07:10

How to enable CORS in flask

I am trying to make a cross origin request using jquery but it keeps being reject with the message > XMLHttpRequest cannot load http://... No 'Access-Control-Allow-Origin' header is present on the...

31 Oct at 07:28

Why am I getting an Exception with the message "Invalid setup on a non-virtual (overridable in VB) member..."?

I have a unit test where I have to mock a non-virtual method that returns a bool type ``` public class XmlCupboardAccess { public bool IsDataEntityInXmlCupboard(string dataId, ...

28 Dec at 20:24

Bash script processing limited number of commands in parallel

I have a bash script that looks like this: ``` #!/bin/bash wget LINK1 >/dev/null 2>&1 wget LINK2 >/dev/null 2>&1 wget LINK3 >/dev/null 2>&1 wget LINK4 >/dev/null 2>&1 # .. # .. wget LINK4000 >/dev/nu...

8 Jun at 04:7

JavaScript loop through JSON array?

I am trying to loop through the following json array: ``` { "id": "1", "msg": "hi", "tid": "2013-05-05 23:35", "fromWho": "hello1@email.se" }, { "id": "2", "msg": "there", "tid": "2013-0...

1 Apr at 16:18

Understanding garbage collection in .NET

Consider the below code: ``` public class Class1 { public static int c; ~Class1() { c++; } } public class Class2 { public static void Main() { { va...

15 Oct at 06:11

Checking if output of a command contains a certain string in a shell script

I'm writing a shell script, and I'm trying to check if the output of a command contains a certain string. I'm thinking I probably have to use grep, but I'm not sure how. Does anyone know?

30 Nov at 10:49

git discard all changes and pull from upstream

How do I fetch upstream repo and make it replace master? I only have one branch on my repo, which is master, and I completely messed it up, so I basically need to start over from the upstream. I think...

17 Aug at 05:59

Counting the number of True Booleans in a Python List

I have a list of Booleans: ``` [True, True, False, False, False, True] ``` and I am looking for a way to count the number of `True` in the list (so in the example above, I want the return to be `3`...

1 Jun at 11:23

iOS: Modal ViewController with transparent background

I'm trying to present a view controller modally, with a transparent background. My goal is to let both the presenting and presented view controllers's view to be displayed at the same time. The proble...

How to remove unused imports in Intellij IDEA on commit?

Is there a way to remove unused imports in Intellij IDEA on commit? It is not very optimal to do it manually, + + helps but it's still manual.

Refresh a page using PHP

How can I refresh a page using PHP periodically? If I can not do it by PHP, what is the best recommended scenario?

16 Jul at 04:36

What does void* mean and how to use it?

Today when I was reading others' code, I saw something like `void *func(void* i);`, what does this `void*` mean here for the function name and for the variable type, respectively? In addition, when ...

12 Jul at 03:9

TCP: can two different sockets share a port?

This might be a very basic question but it confuses me. Can two different connected sockets share a port? I'm writing an application server that should be able to handle more than 100k concurrent conn...

2 Sep at 09:36

Determine if 2 lists have the same elements, regardless of order?

Sorry for the simple question, but I'm having a hard time finding the answer. When I compare 2 lists, I want to know if they are "equal" in that they have the same contents, but in different order. ...

15 Jan at 04:30

What is Sliding Window Algorithm? Examples?

While solving a geometry problem, I came across an approach called Sliding Window Algorithm. Couldn't really find any study material/details on it. What is the algorithm about?

20 Oct at 14:42

Why is semicolon allowed in this Python snippet?

Python does not warrant the use of semicolons to end statements. So why is this (below) allowed? ``` import pdb; pdb.set_trace() ```

10 Apr at 15:37

How can I create a self-signed cert for localhost?

I've gone through the steps detailed in [How do you use https / SSL on localhost?](https://stackoverflow.com/questions/5874390/how-do-you-use-https-ssl-on-localhost) but this sets up a self-signed cer...

23 May at 10:31

Get element inside element by class and ID - JavaScript

Alright, I've dabbled in JavaScript before, but the most useful thing I've written is a CSS style-switcher. So I'm somewhat new to this. Let's say I have HTML code like this: ``` <div id="foo"> <d...

How do you log content of a JSON object in Node.js?

Is it possible to print an objects contents e.g. methods and attributes in Node.js? At the moment I'm trying to print the session object and get the following: ``` console.log("Session:" + session);...

16 Jul at 10:24

How do you rebase the current branch's changes on top of changes being merged in?

Okay. If I'm on a branch (say `working`), and I want to merge in the changes from another branch (say `master`), then I run the command `git-merge master` while on the `working` branch, and the change...

4 Sep at 04:14

Setting up a git remote origin

I have the following repos. 1. DEV REPO: in a directory on my development machine where i make changes 2. MAIN REPO: bare repository on my development machine to which i push changes from dev repo 3...

25 Apr at 08:16

How can I tell where mongoDB is storing data? (its not in the default /data/db!)

My host came with a mongodb instance and there is no /db directory so now I am wondering what I can do to find out where the data is actually being stored.

22 Sep at 17:57

get client time zone from browser

Is there a reliable way to get a timezone from client browser? I saw the following links but I want a more robust solution. [Auto detect a time zone with JavaScript](http://www.onlineaspect.com/2007...

1 Mar at 21:27