Questions

Create patch or diff file from git repository and apply it to another different git repository

I work on WordPress based project and I want to patch my project at each new release version of WP. For this, I want generate a patch between two commits or tags. For example, in my repo `/www/WP` I d...

8 Feb at 00:29

ERROR 1452: Cannot add or update a child row: a foreign key constraint fails

I have created tables in MySQL Workbench as shown below : ``` CREATE TABLE Ordre ( OrdreID INT NOT NULL, OrdreDato DATE DEFAULT NULL, KundeID INT DEFAULT NULL, CONSTRAINT Ordre_pk PRIM...

2 Oct at 18:23

How to change Vagrant 'default' machine name?

Where does the name 'default' come from when launching a vagrant box? ``` $ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ``` Is there a way to set this?

Random row selection in Pandas dataframe

Is there a way to select random rows from a DataFrame in Pandas. In R, using the car package, there is a useful function `some(x, n)` which is similar to head but selects, in this example, 10 rows at ...

17 Mar at 09:45

How to grep a string in a directory and all its subdirectories?

How to grep a string or a text in a directory and all its subdirectories'files in LINUX ??

15 Sep at 02:4

await vs Task.Wait - Deadlock?

I don't quite understand the difference between `Task.Wait` and `await`. I have something similar to the following functions in a ASP.NET WebAPI service: ``` public class TestController : ApiControl...

Getting visitors country from their IP

I want to get visitors country via their IP... Right now I'm using this ([http://api.hostip.info/country.php?ip=](http://api.hostip.info/country.php?ip=)...... ) Here is my code: ``` <?php if (isse...

15 Oct at 09:41

Entity Framework: One Database, Multiple DbContexts. Is this a bad idea?

My impression to date has been that a `DbContext` is meant to represent your database, and thus, if your application uses one database, you'd want only one `DbContext`. However, some colleagues want ...

UIView Infinite 360 degree rotation animation?

I'm trying to rotate a `UIImageView` 360 degrees, and have looked at several tutorials online. I could get none of them working, without the `UIView` either stopping, or jumping to a new position. - ...

How to calculate the angle between a line and the horizontal axis?

In a programming language (Python, C#, etc) I need to determine how to calculate the angle between a line and the horizontal axis? I think an image describes best what I want: ![no words can describ...

28 Aug at 21:7

Unable to copy file - access to the path is denied

I am using Visual Studio 2005. After taking code from version control first, the c#.net application runs correctly. But, after doing some modifications, when I build I am getting the following error...

20 Feb at 18:59

How to redirect 404 errors to a page in ExpressJS?

I don't know a function for doing this, does anyone know of one?

29 May at 03:14

Jquery Ajax Posting JSON to webservice

I am trying to post a JSON object to a asp.net webservice. My json looks like this: ``` var markers = { "markers": [ { "position": "128.3657142857143", "markerPosition": "7" }, { "position": "235....

1 Apr at 16:20

What is the difference between bottom-up and top-down?

The approach (to dynamic programming) consists in first looking at the "smaller" subproblems, and then solve the larger subproblems using the solution to the smaller problems. The consists in solvi...

Why is the Date constructor deprecated, and what do I use instead?

I come from the C# world, so not too experienced with Java yet. I was just told by Eclipse that `Date` was deprecated: ``` Person p = new Person(); p.setDateOfBirth(new Date(1985, 1, 1)); ``` Why? ...

6 Feb at 10:18

How do I add a Fragment to an Activity with a programmatically created content view

I want to add a Fragment to an Activity that implements its layout programmatically. I looked over the Fragment documentation but there aren't many examples describing what I need. Here is the type of...

Should I initialize variable within constructor or outside constructor

When I use Java based on my C++ knowledge, I love to initialize variable using the following way. ``` public class ME { private int i; public ME() { this.i = 100; } } ``` Afte...

15 Feb at 05:26

How to create a backup of a single table in a postgres database?

Is there a way to create a backup of a single table within a database using postgres? And how? Does this also work with the `pg_dump` command?

15 Mar at 13:20

How to parse a JSON string into JsonNode in Jackson?

It should be so simple, but I just cannot find it after being trying for an hour. I need to get a JSON string, for example, `{"k1":v1,"k2":v2}`, parsed as a `JsonNode`. ``` JsonFactory factory = new J...

2 Jan at 04:3

Auto-expanding layout with Qt-Designer

I'm using the Qt Designer. I want to create a `QVBoxLayout` which will automatically expand to fill the whole window. The layout of the `QVBoxLayout` remains fixed. How can I cause the `QVBoxLayout...

16 Aug at 11:41

How to "perfectly" override a dict?

How can I make as "perfect" a subclass of as possible? The end goal is to have a simple in which the keys are lowercase. It would seem that there should be some tiny set of primitives I can overrid...

28 Jan at 14:23

Convert integer to binary in C#

How to convert an integer number into its binary representation? I'm using this code: ``` String input = "8"; String output = Convert.ToInt32(input, 2).ToString(); ``` But it throws an exception: ...

17 Jan at 10:48

Java: how to initialize String[]?

``` % javac StringTest.java StringTest.java:4: variable errorSoon might not have been initialized errorSoon[0] = "Error, why?"; ``` ``` public class StringTest { public static ...

1 Apr at 23:39

Load and execution sequence of a web page?

I have done some web based projects, but I don't think too much about the load and execution sequence of an ordinary web page. But now I need to know detail. It's hard to find answers from Google or S...

27 Jun at 14:37

How to tell PowerShell to wait for each command to end before starting the next?

I have a PowerShell 1.0 script to just open a bunch of applications. The first is a virtual machine and the others are development applications. I want the virtual machine to finish booting before th...

8 May at 19:31