Questions

Passing headers with axios POST request

I have written an Axios POST request as recommended from the npm package documentation like: ``` var data = { 'key1': 'val1', 'key2': 'val2' } axios.post(Helper.getUserAPI(), data) .the...

11 Aug at 11:14

Define global constants

In Angular 1.x you can define constants like this: ``` angular.module('mainApp.config', []) .constant('API_ENDPOINT', 'http://127.0.0.1:6666/api/') ``` What would be the equivalent in Angular (...

28 Dec at 22:26

elasticsearch bool query combine must with OR

I am currently trying to migrate a solr-based application to elasticsearch. I have this lucene query: ``` (( name:(+foo +bar) OR info:(+foo +bar) )) AND state:(1) AND (has_image:(0) OR has_...

1 Oct at 23:6

Django rest framework, use different serializers in the same ModelViewSet

I would like to provide two different serializers and yet be able to benefit from all the facilities of `ModelViewSet`: - `__unicode __` example: ``` { "url": "http://127.0.0.1:8000/database/grup...

How to determine whether a Pandas Column contains a particular value

I am trying to determine whether there is an entry in a Pandas column that has a particular value. I tried to do this with `if x in df['id']`. I thought this was working, except when I fed it a value ...

23 May at 12:34

What is the $$hashKey added to my JSON.stringify result

I have tried looking on the [Mozilla JSON stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) page of their docs as well as here on SO and Googl...

22 Dec at 21:53

how to permit an array with strong parameters

I have a functioning Rails 3 app that uses has_many :through associations which is not, as I remake it as a Rails 4 app, letting me save ids from the associated model in the Rails 4 version. These a...

How to display an unordered list in two columns?

With the following HTML, what is the easiest method to display the list as two columns? ``` <ul> <li>A</li> <li>B</li> <li>C</li> <li>D</li> <li>E</li> </ul> ``` Desired display: ...

How to save the output of a console.log(object) to a file?

I tried using `JSON.stringify(object)`, but it doesn't go down on the whole structure and hierarchy. On the other hand `console.log(object)` does that but I cannot save it. In the `console.log` out...

12 Oct at 07:33

Removing white space around a saved image

I need to take an image and save it after some process. The figure looks fine when I display it, but after saving the figure, I got some white space around the saved image. I have tried the `'tight'` ...

9 Aug at 17:46

Serialize form data to JSON

I want to do some pre-server-validation of a form in a [Backbone.js](https://en.wikipedia.org/wiki/Backbone.js) model. To do this I need to get the user input from a form into usable data. I found thr...

24 Apr at 19:20

How to insert a text at the beginning of a file?

So far I've been able to find out how to add a line at the beginning of a file but that's not exactly what I want. I'll show it with an example: ``` some text at the beginning ``` ``` <added text> ...

1 Jun at 14:14

Test if number is odd or even

What is the simplest most basic way to find out if a number/variable is odd or even in PHP? Is it something to do with mod? I've tried a few scripts but.. google isn't delivering at the moment.

27 Mar at 15:24

How do I terminate a window in tmux?

How do I terminate a window in tmux? Like the shortcut in [screen](https://en.wikipedia.org/wiki/GNU_Screen), where is the prefix.

17 Aug at 08:39

How to trigger a click on a link using jQuery

I have a link: ``` <ul id="titleee" class="gallery"> <li> <a href="#inline" rel="prettyPhoto">Talent</a> </li> </ul> ``` and I am trying to trigger it by using: ``` $(document).ready(funct...

7 Apr at 12:9

How to set a bitmap from resource

This seems simple, I am trying to set a bitmap image but from the resources, I have within the application in the drawable folder. ``` bm = BitmapFactory.decodeResource(null, R.id.image); ``` Is th...

3 Feb at 08:53

Skip download if files already exist in wget?

This is simplest example running wget: ``` wget http://www.example.com/images/misc/pic.png ``` but how to make wget skip download if `pic.png`is already available?

Read file from line 2 or skip header row

How can I skip the header row and start reading a file from line2?

25 Jan at 17:28

How are cookies passed in the HTTP protocol?

How are cookies passed in the HTTP protocol?

12 Aug at 11:27

How to disable GCC warnings for a few lines of code

In Visual C++, it's possible to use [#pragma warning (disable: ...)](https://msdn.microsoft.com/en-us/library/2c8f766e.aspx). Also I found that in GCC you can [override per file compiler flags](http:/...

15 Nov at 22:41

INNER JOIN vs LEFT JOIN performance in SQL Server

I've created SQL command that uses INNER JOIN on 9 tables, anyway this command takes a very long time (more than five minutes). So my folk suggested me to change INNER JOIN to LEFT JOIN because the pe...

14 Jul at 08:27

How to select label for="XYZ" in CSS?

``` label { display: block; width: 156px; cursor: pointer; padding-right: 6px; padding-bottom: 1px; } ``` ``` <label for="email">{t _your_email}:</label> ``` I wish to select the label bas...

21 Apr at 11:0

Ruby - test for array

What is the right way to: ``` is_array("something") # => false (or 1) is_array(["something", "else"]) # => true (or > 1) ``` or to get the count of items in it?

6 Oct at 20:21

How to prevent scrollbar from repositioning web page?

I have a website with center-aligned DIV. Now, some pages need scrolling, some don't. When I move from one type to another, the appearance of a scrollbar moves the page a few pixels to the side. Is th...

30 Jul at 14:28

How to execute a stored procedure within C# program

I want to execute this stored procedure from a C# program. I have written the following stored procedure in a SqlServer query window and saved it as stored1: ``` use master go create procedure dbo...

25 Jul at 22:57