Questions

UPDATE multiple rows with different values in one query in MySQL

I am trying to understand how to UPDATE multiple rows with different values and I just don't get it. The solution is everywhere but to me it looks difficult to understand. For instance, three updates ...

14 May at 18:32

How to access component methods from “outside” in ReactJS?

Why can’t I access the component methods from “outside” in ReactJS? Why is it not possible and is there any way to solve it? Consider the code: ``` var Parent = React.createClass({ render: funct...

12 Aug at 00:51

Spring Boot not serving static content

I can't get my Spring-boot project to serve static content. I've placed a folder named `static` under `src/main/resources`. Inside it I have a folder named `images`. When I package the app and run it...

20 Feb at 15:31

How to deploy correctly when using Composer's develop / production switch?

Composer has the option to load several dependencies only while being in development, so the tools will not be installed in production (on the live server). This is (in theory) very handy for scripts ...

12 Feb at 07:35

Find and remove objects in an array based on a key value in JavaScript

I have been trying several approaches on how to find an object in an array, where ID = var, and if found, remove the object from the array and return the new array of objects. ``` [ {"id":"88","n...

13 Jan at 00:34

What is "Service Include" in a csproj file for?

In a C# solution, I added a existing project. After that, Visual Studio has added the following entry in other .csproj files: ``` <ItemGroup> <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87...

Prevent scroll-bar from adding-up to the Width of page on Chrome

I have a small issue trying to keep my .html pages at a consistent width on Chrome. For example, I have a page (1) with lots of contents that overflows the viewport's (right word?) height, so there's ...

28 Dec at 03:21

Bigger Glyphicons

How do I make bigger Glyphicons in twitter bootstrap 3.0 (not 2.3.x). This code will make my glyphicons big: ``` <button type="button" class="btn btn-default btn-lg"> <span class="glyphicon glyp...

Django REST Framework: adding additional field to ModelSerializer

I want to serialize a model, but want to include an additional field that requires doing some database lookups on the model instance to be serialized: ``` class FooSerializer(serializers.ModelSerializ...

18 May at 11:59

How to force LINQ Sum() to return 0 while source collection is empty

Basically when I do the following query, if no leads were matched the following query throws an exception. In that case I'd prefer to have the sum equalize 0 rather than an exception being thrown. Wou...

11 Jul at 13:40

Numpy first occurrence of value greater than existing value

I have a 1D array in numpy and I want to find the position of the index where a value exceeds the value in numpy array. E.g. ``` aa = range(-10,10) ``` Find position in `aa` where, the value `5` g...

25 Apr at 17:3

Mongoimport of JSON file

I have a JSON file consisting of about 2000 records. Each record which will correspond to a document in the mongo database is formatted as follows: ``` {jobID:"2597401", account:"XXXXX", user:"YYYYY"...

1 Apr at 16:27

Cache an HTTP 'Get' service response in AngularJS?

I want to be able to create a custom AngularJS service that makes an HTTP 'Get' request when its data object is empty and populates the data object on success. The next time a call is made to this se...

14 Dec at 12:43

Maven project.build.directory

In Maven, what does the `project.build.directory` refer to? I am a bit confused, does it reference the source code directory or the target directory in the Maven project?

3 Feb at 09:13

Command not found when using sudo

I have a script called `foo.sh` in my home folder. When I navigate to this folder, and enter `./foo.sh`, I get `-bash: ./foo.sh: Permission denied`. When I use `sudo ./foo.sh`, I get `sudo: fo...

9 Jan at 21:51

How do I count occurrence of unique values inside a list

So I'm trying to make this program that will ask the user for input and store the values in an array / list. Then when a blank line is entered it will tell the user how many of those values are unique...

16 Feb at 20:52

How to check whether dynamically attached event listener exists or not?

Here is my problem: is it somehow possible to check for the existence of a dynamically attached event listener? Or how can I check the status of the "onclick" (?) property in the DOM? I have searched ...

Is the size of C "int" 2 bytes or 4 bytes?

Does an Integer variable in C occupy 2 bytes or 4 bytes? What are the factors that it depends on? Most of the textbooks say integer variables occupy 2 bytes. But when I run a program printing the suc...

13 Feb at 16:9

How to add new item to hash

I don't know how to add new item to already existing hash. For example, first I construct hash: ``` hash = {item1: 1} ``` After that, I want to add item2, so after this I have hash like this: ``` {it...

29 Dec at 01:23

How to make a copy of a file in android?

In my app I want to save a copy of a certain file with a different name (which I get from user) Do I really need to open the contents of the file and write it to another file? What is the best way t...

31 Dec at 15:29

How to parse JSON data with jQuery / JavaScript?

I have a AJAX call that returns some JSON like this: ``` $(document).ready(function () { $.ajax({ type: 'GET', url: 'http://example/functions.php', data: { get_param: '...

23 Jul at 11:40

Selenium C# WebDriver: Wait until element is present

I want to make sure that an element is present before the webdriver starts doing stuff. I'm trying to get something like this to work: ``` WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0...

Call PowerShell script PS1 from another PS1 script inside Powershell ISE

I want call execution for a myScript1.ps1 script inside a second myScript2.ps1 script inside Powershell ISE. The following code inside MyScript2.ps1, works fine from Powershell Administration, but do...

28 Mar at 19:39

Insert a line at specific line number with sed or awk

I have a script file which I need to modify with another script to insert a text at the 8th line. String to insert: `Project_Name=sowstest`, into a file called `start`. I tried to use awk and sed, b...

20 Mar at 06:32

Rebase array keys after unsetting elements

I have an array: ``` $array = array(1,2,3,4,5); ``` If I were to dump the contents of the array they would look like this: ``` array(5) { [0] => int(1) [1] => int(2) [2] => int(3) [3] => i...

21 Feb at 14:21