Questions

linux: kill background task

How do I kill the last spawned background task in linux? Example: ``` doSomething doAnotherThing doB & doC doD #kill doB ???? ```

5 May at 17:43

RegEx to make sure that the string contains at least one lower case char, upper case char, digit and symbol

What is the regex to make sure that a given string contains at least one character from each of the following categories. - - - - I know the patterns for individual sets namely `[a-z]`, `[A-Z]`, `...

13 Oct at 11:55

How to configure postgresql for the first time?

I have just installed postgresql and I specified password x during installation. When I try to do `createdb` and specify any password I get the message: > createdb: could not connect to database pos...

Write string to text file and ensure it always overwrites the existing content.

I have a string with a C# program that I want to write to a file and always overwrite the existing content. If the file isn't there, the program should create a new file instead of throwing an except...

16 Aug at 17:1

Retrieve CPU usage and memory usage of a single process on Linux?

I want to get the CPU and memory usage of a single process on Linux - I know the PID. Hopefully, I can get it every second and write it to a CSV using the 'watch' command. What command can I use to ...

How do I find which rpm package supplies a file I'm looking for?

As an example, I am looking for a `mod_files.sh` file which presumably would come with the `php-devel` package. I guessed that `yum` would install the `mod_files.sh` file with the `php-devel x86_64 5....

12 Jan at 19:23

Effects of the extern keyword on C functions

In C, I did not notice any effect of the `extern` keyword used before function declaration. At first, I thought that when defining `extern int f();` in a single file you to implement it outside of th...

14 Jul at 08:9

How do I find out if the GPS of an Android device is enabled

On an Android Cupcake (1.5) enabled device, how do I check and activate the GPS?

Using varchar(MAX) vs TEXT on SQL Server

I just read that the `VARCHAR(MAX)` datatype (which can store close to 2GB of char data) is the recommended replacement for the `TEXT` datatype in SQL Server 2005 and Next SQL SERVER versions. If I ...

Visual Studio: ContextSwitchDeadlock

I have been getting an error message that I can't resolve. It originates from Visual Studio or the debugger. I'm not sure whether the ultimate error condition is in VS, the debugger, my program, or th...

23 Feb at 16:47

How do I prevent a Gateway Timeout with FastCGI on Nginx

I am running Django, FastCGI, and Nginx. I am creating an api of sorts that where someone can send some data via XML which I will process and then return some status codes for each node that was sent...

6 Nov at 19:13

Serializing an object to JSON

How can I serialize an object to JSON in JavaScript?

7 Apr at 13:28

What is the function __construct used for?

I have been noticing `__construct` a lot with classes. I did a little reading and surfing the web, but I couldn't find an explanation I could understand. I am just beginning with OOP. I was wondering...

19 Aug at 09:10

Gray out image with CSS?

What's the best way (if any) to make an image appear "grayed out" with CSS (i.e., without loading a separate, grayed out version of the image)? My context is that I have rows in a table that all have...

13 Nov at 04:42

Asynchronous shell exec in PHP

I've got a PHP script that needs to invoke a shell script but doesn't care at all about the output. The shell script makes a number of SOAP calls and is slow to complete, so I don't want to slow down ...

25 Mar at 10:21

How to loop through files matching wildcard in batch file

I have a set of base filenames, for each name 'f' there are exactly two files, 'f.in' and 'f.out'. I want to write a batch file (in Windows XP) which goes through all the filenames, for each one it s...

29 Nov at 15:5

Visual Studio Code: How debug Python script with arguments

I'm using Visual Studio Code in order to debug a Python script. Following [this guide](https://code.visualstudio.com/docs/python/debugging), I set up the argument in the `launch.json` file: [](https:/...

20 Nov at 06:13

Angular 2 'component' is not a known element

I'm trying to use a component I created inside the AppModule in other modules. I get the following error though: > "Uncaught (in promise): Error: Template parse errors:'contacts-box' is not a known e...

Visual Studio Code Search and Replace with Regular Expressions

I want to use "Search And Replace" in Visual Studio Code to change every instance of `<h1>content</h1>` to `#### content` within a document using a Regular Expression. How can I accomplish that?

8 Aug at 11:17

Return file in ASP.Net Core Web API

## Problem I want to return a file in my ASP.Net Web API Controller, but all my approaches return the `HttpResponseMessage` as JSON. ## Code so far ``` public async Task<HttpResponseMessage> ...

How do I set environment variables during the build in docker

I'm trying to set environment variables in docker container during the build but without success. Setting them when using run command works but I need to set them during the build. #### Dockerfile ...

27 Jan at 03:0

React Native fetch() Network Request Failed

When I create a brand new project using `react-native init` (RN version 0.29.1) and put a fetch in the render method to the public facebook demo movie API, it throws a `Network Request Failed`. There ...

20 Aug at 23:39

Correct path for img on React.js

I have some problem with my images on my react project. Indeed I always thought that relative path into src attribute was built on the files architecture Here my files architecture: ``` components ...

23 Jul at 11:46

Custom header to HttpClient request

How do I add a custom header to a `HttpClient` request? I am using `PostAsJsonAsync` method to post the JSON. The custom header that I would need to be added is ``` "X-Version: 1" ``` This is wha...

Failed to open/create the internal network Vagrant on Windows10

I upgraded my Windows 10 to the last update yesterday and now, when I launch `vagrant up` command, I get this error : ``` ==> default: Booting VM... ==> default: Waiting for machine to boot. This ma...

16 Feb at 03:7