Questions

How to set JAVA_HOME in Linux for all users

I am new to Linux system and there seem to be too many Java folders. java -version gives me: - - - When I am trying to build a Maven project , I am getting error: ``` Error: JAVA_HOME is not def...

How to rename a single column in a data.frame?

I know if I have a data frame with more than 1 column, then I can use ``` colnames(x) <- c("col1","col2") ``` to rename the columns. How to do this if it's just one column? Meaning a vector or data f...

5 Jan at 21:31

How can I echo or print an array in PHP?

I have this array ``` Array ( [data] => Array ( [0] => Array ( [page_id] => 204725966262837 [type] => WEBSITE ) [1] => Array ( ...

18 Jun at 20:5

How to read a file into a variable in shell?

I want to read a file and save it in variable, but I need to keep the variable and not just print out the file. How can I do this? I have written this script but it isn't quite what I needed: ``` #!/...

10 Sep at 23:37

Pass a string parameter in an onclick function

I would like to pass a parameter (i.e. a string) to an Onclick function. For the moment, I do this: ``` '<input type="button" onClick="gotoNode(' + result.name + ')" />' ``` with result.name for exam...

8 Oct at 22:28

Error "Uncaught SyntaxError: Unexpected token with JSON.parse"

What causes this error on the third line? ``` var products = [{ "name": "Pizza", "price": "10", "quantity": "7" }, { "name": "Cerveja", "price": "12", "quantity": "5" }, { "name": "Hambu...

8 Aug at 18:20

Match the path of a URL, minus the filename extension

What would be the best regular expression for this scenario? Given this URL: ``` http://php.net/manual/en/function.preg-match.php ``` How should I go about selecting everything between (but not in...

30 Jun at 17:46

How to create id with AUTO_INCREMENT on Oracle?

It appears that there is no concept of AUTO_INCREMENT in Oracle, up until and including version 11g. How can I create a column that behaves like auto increment in Oracle 11g?

8 May at 07:41

How do I get the day of week given a date?

I want to find out the following: given a date (`datetime` object), what is the corresponding day of the week? For instance, Sunday is the first day, Monday: second day.. and so on And then if the i...

23 May at 07:14

Redirect all output to file in Bash

I know that in Linux, to redirect output from the screen to a file, I can either use the `>` or `tee`. However, I'm not sure why part of the output is still output to the screen and not written to the...

14 Jan at 12:33

How do you set the Content-Type header for an HttpClient request?

I'm trying to set the `Content-Type` header of an `HttpClient` object as required by an API I am calling. I tried setting the `Content-Type` like below: ``` using (var httpClient = new HttpClient())...

JavaScript hide/show element

How could I hide the 'Edit'-link after I press it? and also can I hide the "lorem ipsum" text when I press edit? ``` <script type="text/javascript"> function showStuff(id) { document.getElementById...

8 Oct at 12:44

Error message "error:0308010C:digital envelope routines::unsupported"

I created the default IntelliJ IDEA React project and got this: ``` Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createH...

20 Nov at 19:58

The located assembly's manifest definition does not match the assembly reference

I am trying to run some unit tests in a C# Windows Forms application (Visual Studio 2005), and I get the following error: > System.IO.FileLoadException: Could not load file or assembly 'Utility, Versi...

What are the possible values of the Hibernate hbm2ddl.auto configuration and what do they do

I really want to know more about the update, export and the values that could be given to `hibernate.hbm2ddl.auto` I need to know when to use the update and when not? And what is the alternative? The...

15 Apr at 15:24

Change navbar color in Twitter Bootstrap

How would I go about modifying the CSS to change the color of the navbar in Twitter Bootstrap?

Restore a postgres backup file using the command line?

Locally, I use pgadmin3. On the remote server, however, I have no such luxury. I've already created the backup of the database and copied it over, but is there a way to restore a backup from the comm...

What's a quick way to comment/uncomment lines in Vim?

I have a Ruby code file open in vi, there are lines commented out with `#`: ``` class Search < ActiveRecord::Migration def self.up # create_table :searches do |t| # t.integer :user_id ...

25 Dec at 02:0

jQuery: Return data after ajax call success

I have something like this, where it is a simple call to a script that gives me back a value, a string.. ``` function testAjax() { $.ajax({ url: "getvalue.php", success: function(da...

18 Feb at 08:58

Start script missing error when running npm start

I'm receiving this error when trying to debug my node application using the `npm start` command. Error: ``` npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Prog...

Matching a space in regex

How can I match a space character in a PHP regular expression? I mean like "gavin schulz", the space in between the two words. I am using a regular expression to make sure that I only allow letters, n...

13 Nov at 03:43

Automatically create requirements.txt

Sometimes I download the python source code from `github` and don't know how to install all the dependencies. If there is no `requirements.txt` file I have to create it by hands. The question is: Give...

Remove an entire column from a data.frame in R

Does anyone know how to remove an entire column from a data.frame in R? For example if I am given this data.frame: ``` > head(data) chr genome region 1 chr1 hg19_refGene CDS 2 chr1 hg19_r...

7 Nov at 09:14

Getting Git to work with a proxy server - fails with "Request timed out"

How do I get Git to use a proxy server? I need to check out code from a Git server, but it shows "Request timed out" every time. How do I get around this? Alternatively, how can I set a proxy serve...

23 Oct at 23:9

How to print instances of a class using print()?

When I try to `print` an instance of a class, I get an output like this: ``` >>> class Test(): ... def __init__(self): ... self.a = 'foo' ... >>> print(Test()) <__main__.Test object at 0x7...

1 Feb at 20:13