Questions

How to fix "ReferenceError: primordials is not defined" in Node.js

I have installed Node.js modules by 'npm install', and then I tried to do `gulp sass-watch` in a command prompt. After that, I got the below response. ``` [18:18:32] Requiring external module babel-re...

14 May at 12:6

typedef struct vs struct definitions

I'm a beginner in C programming, but I was wondering what's the difference between using `typedef` when defining a structure versus not using `typedef`. It seems to me like there's really no differenc...

4 Dec at 16:22

Best approach to remove time part of datetime in SQL Server

Which method provides the best performance when removing the time portion from a datetime field in SQL Server? ``` a) select DATEADD(dd, DATEDIFF(dd, 0, getdate()), 0) ``` or ``` b) select cast(co...

12 Jul at 06:51

Object reference not set to an instance of an object.

I keep getting this error when I run the program. > Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web reque...

20 Sep at 18:44

How to redirect and append both standard output and standard error to a file with Bash

To redirect [standard output](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_.28stdout.29) to a truncated file in Bash, I know to use: ``` cmd > file.txt ``` To redirect standard outp...

How to calculate age (in years) based on Date of Birth and getDate()

I have a table listing people along with their date of birth (currently a nvarchar(25)) How can I convert that to a date, and then calculate their age in years? My data looks as follows ``` ID N...

19 Dec at 08:36

How can I grep recursively, but only in files with certain extensions?

I'm working on a script to [grep](https://en.wikipedia.org/wiki/Grep) certain directories: ``` { grep -r -i CP_Image ~/path1/; grep -r -i CP_Image ~/path2/; grep -r -i CP_Image ~/path3/; grep -r -i CP...

20 Jun at 09:29

How to declare variable and use it in the same Oracle SQL script?

I want to write reusable code and need to declare some variables at the beginning and reuse them in the script, such as: ``` DEFINE stupidvar = 'stupidvarcontent'; SELECT stupiddata FROM stupidtable...

19 Feb at 13:36

TypeError: list indices must be integers or slices, not str

I've got two lists that I want to merge into a single array and finally put it in a csv file. How I can avoid this error : ``` def fill_csv(self, array_urls, array_dates, csv_file_path): result_ar...

17 Jul at 15:12

Server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

I can push by clone project using ssh, but it doesn't work when I clone project with https. The error message that it shows me is: ``` server certificate verification failed. CAfile: /etc/ssl/certs/ca...

16 Oct at 10:56

Pass a JavaScript function as parameter

How do I pass a function as a parameter without the function executing in the "parent" function or using `eval()`? (Since I've read that it's insecure.) I have this: ``` addContact(entityId, refresh...

1 Jun at 23:38

Remove CSS class from element with JavaScript (no jQuery)

Could anyone let me know how to remove a class on an element using JavaScript only? Please do not give me an answer with jQuery as I can't use it, and I don't know anything about it.

4 Oct at 08:59

How to set focus on an input field after rendering?

What's the react way of setting focus on a particular text field after the component is rendered? Documentation seems to suggest using refs, e.g: Set `ref="nameInput"` on my input field in the rende...

21 Apr at 15:11

How to crop an image in OpenCV using Python

How can I crop images, like I've done before in PIL, using OpenCV. Working example on PIL ``` im = Image.open('0.png').convert('L') im = im.crop((1, 1, 98, 33)) im.save('_0.png') ``` But how I ca...

16 Feb at 05:13

Format date as dd/MM/yyyy using pipes

I'm using the `date` pipe to format my date, but I just can't get the exact format I want without a workaround. Am I understanding pipes wrongly or is just not possible? ``` //our root app component ...

2 Nov at 22:40

Convert floats to ints in Pandas?

I've been working with data imported from a CSV. Pandas changed some columns to float, so now the numbers in these columns get displayed as floating points! However, I need them to be displayed as int...

How to show loading spinner in jQuery?

In I can show a "loading..." image with this code: ``` var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse} ); function showLoad () ...

Import a module from a relative path

How do I import a Python module given its relative path? For example, if `dirFoo` contains `Foo.py` and `dirBar`, and `dirBar` contains `Bar.py`, how do I import `Bar.py` into `Foo.py`? Here's a vis...

28 Aug at 13:52

How to add a new row to datagridview programmatically

if add row to `DataTable` ``` DataRow row = datatable1.NewRow(); row["column2"]="column2"; row["column6"]="column6"; datatable1.Rows.Add(row); ``` How about `DataGridView`??

20 Apr at 14:11

Move existing, uncommitted work to a new branch in Git

I started some work on a new feature and after coding for a bit, I decided this feature should be on its own branch. How do I move the existing uncommitted changes to a new branch and reset my curre...

9 Oct at 05:1

How to call a REST web service API from JavaScript?

I have an HTML page with a button on it. When I click on that button, I need to call a REST Web Service API. I tried searching online everywhere. No clue whatsoever. Can someone give me a lead/Headsta...

6 Oct at 21:8

Git replacing LF with CRLF

On a Windows machine, I added some files using `git add`. I got warnings saying: > LF will be replaced by CRLF What are the ramifications of this conversion?

Check synchronously if file/directory exists in Node.js

How can I synchronously check, using , if a file or directory exists?

20 Jan at 14:4

How do I find out my PYTHONPATH using Python?

How do I find out which directories are listed in my system’s `PYTHONPATH` variable, from within a Python script (or the interactive shell)?

23 Apr at 00:35

CSS Display an Image Resized and Cropped

I want to show an image from an URL with a certain width and height even if it has a different size ratio. So I want to resize (maintaining the ratio) and then cut the image to the size I want. I ca...

7 Jun at 15:3