Questions

How do I initialize weights in PyTorch?

How do I initialize weights and biases of a network (via e.g. He or Xavier initialization)?

npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY

I am trying all possible ways to create a React application. I have tried Maven, and now I am trying `create-react-app` from Facebook Incubators. When I tried to run the command `create-react-app my-a...

What's the difference between 'extends' and 'implements' in TypeScript

I would like to know what and have in common and how they differ. ``` class Person { name: string; age: number; } class Child extends Person {} class Man implements Person {} ```

24 Nov at 18:43

How to set back button text in Swift

How do you remove the back button text. Current back button: > < Back Desired back button: > < AnythingElse None of these have worked: ``` self.navigationItem.backBarButtonItem?.title = "Back" s...

6 Nov at 20:6

What is the equivalent of the join operator over a vector of Strings?

I wasn't able to find the Rust equivalent for the "join" operator over a vector of `String`s. I have a `Vec<String>` and I'd like to join them as a single `String`: ``` let string_list = vec!["Foo".t...

29 May at 11:55

Parsing RFC-3339 / ISO-8601 date-time string in Go

I tried parsing the date string `"2014-09-12T11:45:26.371Z"` in Go. This time format is defined as: - [RFC-3339 date-time](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6)- [ISO-8601 date-ti...

23 Feb at 10:2

Drop all duplicate rows across multiple columns in Python Pandas

The pandas `drop_duplicates` function is great for "uniquifying" a dataframe. I would like to drop all rows which are duplicates across a subset of columns. Is this possible? ``` A B C 0 foo 0 ...

What is the difference/usage of homebrew, macports or other package installation tools?

I've just recently switched to a Mac from Ubuntu. I was disappointed that mac doesn't have the convenient `sudo apt-get` in Ubuntu. I've heard that I should use homebrew but I'm not exactly sure what ...

12 Mar at 14:27

What is the use for Task.FromResult<TResult> in C#

In C# and TPL ([Task Parallel Library](http://msdn.microsoft.com/en-us/library/dd460717.aspx)), the `Task` class represents an ongoing work that produces a value of type T. I'd like to know what is t...

Origin <origin> is not allowed by Access-Control-Allow-Origin

``` XMLHttpRequest cannot load http://localhost:8080/api/test. Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin. ``` I read about cross domain ajax requests, and understand...

How can I use a conditional expression (expression with if and else) in a list comprehension?

I have a list comprehension that produces list of odd numbers of a given range: ``` [x for x in range(1, 10) if x % 2] ``` That makes a filter that removes the even numbers. Instead, I'd like to use ...

How do you get the Git repository's name in some Git repository?

When you are working in some Git directory, how can you get the Git repository name in some Git repository? Are there any Git commands? ``` # I did check out bar repository and working in somewhere ...

17 Jul at 12:28

Format date in a specific timezone

I'm using [Moment.js](http://momentjs.com/) to parse and format dates in my web app. As part of a JSON object, my backend server sends dates as a number of milliseconds from the UTC epoch (Unix offset...

7 Dec at 01:0

Difference between virtual and abstract methods

Here is some code from [MSDN](http://msdn.microsoft.com/en-us/library/ms173150.aspx): ``` // compile with: /target:library public class D { public virtual void DoWork(int i) { // Ori...

How to restart a rails server on Heroku?

Locally I just interrupt (ctrl-c) and then start it again. How do I do the same thing with an app on heroku?

14 Aug at 10:56

Set margin size when converting from Markdown to PDF with pandoc

I have created an RMarkdown file in RStudio and managed to knit it with knitr into an HTML and .md file. Next, I used pandoc to convert the .md file into a PDF file (I get an error if I try and conve...

26 Feb at 21:34

Command line to remove an environment variable from the OS level configuration

Windows has the [setx](https://ss64.com/nt/setx.html) command: ``` Description: Creates or modifies environment variables in the user or system environment. ``` So you can set a variable li...

How to fix HTTP 404 on Github Pages?

[Here](https://github.com/roine/p1/tree/gh-pages) is my GitHub repository on the `gh-pages` branch. Everything looks good, I have my `index.html`, my CSS, JS and pictures folders. But when I access [...

23 Mar at 15:26

Fatal error: Class 'SoapClient' not found

I'm trying a simple web service example and I get this error even though I uncommented `extension=php_soap.dll` in the `php.ini` file: > Class 'SoapClient' not found in C:\Program Files (x86)\EasyPH...

17 Aug at 08:7

How to view the contents of a .pem certificate?

I am using Java `keytool`. I have exported a self-signed `.pem` certificate from my keystore. Is there a command to view the certificate details directly from the `.pem` file (not of the certificate i...

25 Apr at 06:30

Rails: How does the respond_to block work?

I'm going through the [Getting Started with Rails](http://guides.rubyonrails.org/getting_started.html) guide and got confused with section 6.7. After generating a scaffold I find the following auto-ge...

27 May at 14:12

Right align text in android TextView

I have a `TextView` in my application. I want to align the text in it to the right. I tried adding: ``` android:gravity="right" ``` But this doesn't work for me. What might I be doing wrong?

23 Feb at 14:14

import module from string variable

I'm working on a documentation (personal) for nested matplotlib (MPL) library, which differs from MPL own provided, by interested submodule packages. I'm writing Python script which I hope will automa...

3 Jan at 21:29

Configure Node.js to log to a file instead of the console

Can I configure `console.log` so that the logs are written on a file instead of being printed in the console?

23 Nov at 15:48

How do I use spaces in the Command Prompt?

How can I use spaces in the Windows Command Line? ``` cmd /C C:\Program Files (x86)\WinRar\Rar.exe a D:\Hello 2\File.rar D:\Hello 2\*.* ```

27 Oct at 15:46