Questions

400 vs 422 response to POST of data

I'm trying to figure out what the correct status code to return on different scenarios with a "REST-like" API that I'm working on. Let's say I have an end point that allows POST'ing purchases in JSON ...

16 Dec at 00:12

Convert UTC date time to local date time

From the server I get a datetime variable in this format: `6/29/2011 4:52:48 PM` and it is in UTC time. I want to convert it to the current user’s browser time zone using JavaScript. How this can be d...

How do you change text to bold in Android?

How do you change settings in an Android `TextView`? For example, how do you make the text ?

3 Jun at 08:56

How to clone git repository with specific revision/changeset?

How can I clone git repository with specific revision, something like I usually do in Mercurial: ``` hg clone -r 3 /path/to/repository ```

31 May at 09:59

What is Node.js?

I don't fully get what [Node.js](http://en.wikipedia.org/wiki/Node.js) is all about. Maybe it's because I am mainly a web based business application developer. What is it and what is the use of it? M...

22 Jun at 09:11

What uses are there for "placement new"?

Has anyone here ever used C++'s "placement new"? If so, what for? It looks to me like it would only be useful on memory-mapped hardware.

Git fatal: protocol 'https' is not supported

I am going through Github's forking guide: [https://guides.github.com/activities/forking/](https://guides.github.com/activities/forking/) and I am trying to clone the repository onto my computer. Howe...

29 Apr at 12:39

How to create id with AUTO_INCREMENT on Oracle?

It appears that there is no concept of AUTO_INCREMENT in Oracle, up until and including version 11g. How can I create a column that behaves like auto increment in Oracle 11g?

8 May at 07:41

Is there a format code shortcut for Visual Studio?

In [Eclipse](http://en.wikipedia.org/wiki/Eclipse_%28software%29) there is a shortcut, ++, that re-indents code and fixes comments and blank lines. Is there an equivalent for Visual Studio 2010?

How to extract the substring between two markers?

Let's say I have a string `'gfgfdAAA1234ZZZuijjk'` and I want to extract just the `'1234'` part. I only know what will be the few characters directly before `AAA`, and after `ZZZ` the part I am inter...

10 Oct at 22:41

When to use "ON UPDATE CASCADE"

I use `ON DELETE CASCADE` regularly but I never use `ON UPDATE CASCADE` as I am not so sure in what situation it will be useful. For the sake of discussion let see some code. ``` CREATE TABLE parent (...

28 Dec at 16:52

Undo scaffolding in Rails

Is there any way to 'undo' the effects of a scaffold command in Rails?

5 Apr at 21:10

What is Express.js?

I am a learner in [Node.js](http://en.wikipedia.org/wiki/Node.js). 1. What's Express.js? 2. What's the purpose of it with Node.js? 3. Why do we actually need Express.js? How is it useful for us to us...

24 Aug at 15:30

Change Name of Import in Java, or import two classes with the same name

In Python you can do a: ``` from a import b as c ``` How would you do this in Java, as I have two imports that are clashing.

15 Mar at 14:41

Margin on child element moves parent element

I have a `div` () that contains another `div` (). Parent is the first element in `body` with no particular CSS style. When I set ``` .child { margin-top: 10px; } ``` The end result is that top ...

19 Nov at 11:23

How to get first N elements of a list in C#?

I would like to use Linq to query a bus schedule in my project, so that at any time I can get the next 5 bus arrival times. How can I limit my query to the first 5 results? More generally, how can I ...

25 Jul at 10:15

Using Caps Lock as Esc in Mac OS X

How do I make work like in Mac OS X?

4 Sep at 12:14

Android Studio error "Installed Build Tools revision 31.0.0 is corrupted"

I'm on Android Studio 4.2.2. I created a new project and haven't added anything to the starter code and whenever I click , I get this error: > Installed Build Tools revision 31.0.0 is corrupted. Remov...

Error after upgrading pip: cannot import name 'main'

Whenever I am trying to install any package using pip, I am getting this import error: ``` guru@guru-notebook:~$ pip3 install numpy Traceback (most recent call last): File "/usr/bin/pip3", line 9, ...

11 Jul at 18:40

ReferenceError: fetch is not defined

I have this error when I compile my code in node.js, how can I fix it? RefernceError: fetch is not defined [](https://i.stack.imgur.com/3Syvz.png) This is the function I am doing, it is responsible...

7 Jul at 15:43

Error when trying to inject a service into an angular component "EXCEPTION: Can't resolve all parameters for component", why?

I've built a basic app in Angular, but I have encountered a strange issue where I cannot inject a service into one of my components. It injects fine into any of the three other components I have creat...

How can I split a shell command over multiple lines when using an IF statement?

How can I split a command over multiple lines in the shell, when the command is part of an `if` statement? This works: ``` if ! fab --fabfile=.deploy/fabfile.py --forward-agent --disable-known-host...

21 Aug at 19:37

List tables in a PostgreSQL schema

When I do a `\dt` in psql I only get a listing of tables in the current schema (`public` by default). How can I get a list of all tables in all schemas or a particular schema?

18 Dec at 13:48

Is there any advantage of using map over unordered_map in case of trivial keys?

A recent talk about `unordered_map` in C++ made me realize that I should use `unordered_map` for most cases where I used `map` before, because of the efficiency of lookup ( vs. ). Most times I use a...

Pipe output and capture exit status in Bash

I want to execute a long running command in Bash, and both capture its exit status, and [tee](http://en.wikipedia.org/wiki/Tee_(command)) its output. So I do this: ``` command | tee out.txt ST=$? ``...

27 Aug at 04:9