Questions

Git command to display HEAD commit id?

What command can I use to print out the commit id of HEAD? This is what I'm doing by hand: ``` $ cat .git/HEAD ref: refs/heads/v3.3 $ cat .git/refs/heads/v3.3 6050732e725c68b83c35c873ff8808dff1c406e...

1 Apr at 02:46

Should I use window.navigate or document.location in JavaScript?

What's the preferred method to use to change the location of the current web page using JavaScript? I've seen both window.navigate and document.location used. Are there any differences in behavior? Ar...

4 Jun at 01:47

Pandas: ValueError: cannot convert float NaN to integer

I get for following: ``` df = pandas.read_csv('zoom11.csv') df[['x']] = df[['x']].astype(int) ``` - - - - - - Update: Using the hints in comments/answers I got my data clean with this: ``` # x cont...

29 Apr at 06:44

python pandas: apply a function with arguments to a series

I want to apply a function with arguments to a series in python pandas: ``` x = my_series.apply(my_function, more_arguments_1) y = my_series.apply(my_function, more_arguments_2) ... ``` The [docume...

15 Oct at 15:5

Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays

I looked at similar questions, but none of them helped me. I am going to receive an object like the following: ``` [ { "id": 1, "name": "Safa", "email": "neerupeeru@mail.ee", "purpo...

23 Apr at 12:10

How to flush route table in windows?

I am trying to write a program that changes the default gateway of network time by time. But it seems that there are caches on the route table in every process so that I cannot control the network beh...

16 Mar at 14:31

Why does SSL handshake give 'Could not generate DH keypair' exception?

When I make an SSL connection with some IRC servers (but not others - presumably due to the server's preferred encryption method) I get the following exception: ``` Caused by: java.lang.RuntimeExcept...

14 Aug at 00:44

What do >> and << mean in Python?

I notice that I can do things like `2 << 5` to get 64 and `1000 >> 2` to get 250. Also I can use `>>` in `print`: ``` print >>obj, "Hello world" ``` What is happening here?

5 Dec at 23:29

Left-pad printf with spaces

How can I pad a string with spaces on the left when using printf? For example, I want to print "Hello" with 40 spaces preceding it. Also, the string I want to print consists of multiple lines. Do I...

16 Nov at 04:40

Shell script to send email

I am on linux machine and I monitor a process usage. Most of the time I will be away from my system and I have access to internet on my device. So I planned to write a shell-script that can mail me th...

11 Jan at 13:49

Does VBA have Dictionary Structure?

Does VBA have dictionary structure? Like key<>value array?

18 Jun at 12:32

How can I make a link from a <td> table cell

I have the following: ``` <td> some text <div>a div</div> </td> ``` I'd like to make the entire `<td>...</td>` a hyperlink. I'd prefer without the use of JavaScript. Is this possible?

23 Dec at 19:25

Syntax behind sorted(key=lambda: ...)

I don't quite understand the syntax behind the `sorted()` argument: ``` key=lambda variable: variable[0] ``` Isn't `lambda` arbitrary? Why is `variable` stated twice in what looks like a `dict`?

24 Apr at 21:58

How to get first two characters of a string in oracle query?

Suppose I have a column name `OrderNo` with value `AO025631` in a table `shipment`. I am trying to query the table so that I can get only first two character of column value i.e. `AO`. Can I do this...

19 Jun at 08:15

'ModuleNotFoundError' when trying to import module from imported package

This is my directory structure: ``` man/ Mans/ man1.py MansTest/ SoftLib/ Soft/ SoftWork/ ...

7 May at 16:25

How do I use the includes method in lodash to check if an object is in the collection?

lodash lets me check for membership of basic data types with `includes`: ``` _.includes([1, 2, 3], 2) > true ``` But the following doesn't work: ``` _.includes([{"a": 1}, {"b": 2}], {"b": 2}) > fa...

Generate random numbers with a given (numerical) distribution

I have a file with some probabilities for different values e.g.: ``` 1 0.1 2 0.05 3 0.05 4 0.2 5 0.4 6 0.2 ``` I would like to generate random numbers using this distribution. Does an existing modu...

24 Nov at 10:56

Apache is downloading php files instead of displaying them

OS and server information: - - - I previously had php 5.3.x installed but decided to upgrade. I first uninstalled the php 5.3.x and then installed php 5.5.1 but after the installation completed apa...

26 Aug at 08:23

How to use `setState` callback on react hooks

React hooks introduces `useState` for setting component state. But how can I use hooks to replace the callback like below code: ``` setState( { name: "Michael" }, () => console.log(this.state) );...

4 Jan at 21:15

How many characters can a Java String have?

I'm trying [The Next Palindrome](http://www.spoj.com/problems/PALIN/) problem from Sphere Online Judge (SPOJ) where I need to find a palindrome for a integer of up to a million digits. I thought about...

16 Jan at 19:45

How can I get the count of line in a file in an efficient way?

I have a big file. It includes approximately 3.000-20.000 lines. How can I get the total count of lines in the file using Java?

14 Aug at 14:0

Android Fragment onClick button Method

I'm trying to invoke the method in my onClick (View v) XML, but does not work with Fragment. This is the error. ``` 01-17 12:38:36.840: E/AndroidRuntime(4171): java.lang.IllegalStateException: Could...

24 Jul at 21:38

Origin null is not allowed by Access-Control-Allow-Origin

I have made a small xslt file to create an html output called weather.xsl with code as follows: ``` <!-- DWXMLSource="http://weather.yahooapis.com/forecastrss?w=38325&u=c" --> <xsl:stylesheet version...

Array or List in Java. Which is faster?

I have to keep thousands of strings in memory to be accessed serially in Java. Should I store them in an array or should I use some kind of List ? Since arrays keep all the data in a contiguous chunk...

13 Nov at 19:37

How to use requirements.txt to install all dependencies in a python project

I am new to python. Recently I got a project written by python and it requires some installation. I run below command to install but got an error. ``` # pip install requirements.txt Collecting requi...

4 Jan at 08:40