Go Back to Previous Page

You can use a link to invoke history.go(-1) in Javascript, which is essentially equivalent to clicking the Back button. Ideally, however, it’d be better to just create a link back to the URL from whence the user was posted to the form – that way the proper “flow” of history is preserved and the user … Read more

Read a file line by line assigning the value to a variable

The following reads a file passed as an argument line by line: This is the standard form for reading lines from a file in a loop. Explanation: IFS= (or IFS=”) prevents leading/trailing whitespace from being trimmed. -r prevents backslash escapes from being interpreted. Or you can put it in a bash file helper script, example … Read more

github changes not staged for commit

Is week1 a submodule? Note the relevant part from the output of the git status command: (commit or discard the untracked or modified content in submodules) Try cd week1 and issuing another git status to see what changes you have made to the week1 submodule. See http://git-scm.com/book/en/Git-Tools-Submodules for more information about how submodules work in … Read more

How to convert a string to integer in C?

There is strtol which is better IMO. Also I have taken a liking in strtonum, so use it if you have it (but remember it’s not portable): You might also be interested in strtoumax and strtoimax which are standard functions in C99. For example you could say: Anyway, stay away from atoi: The call atoi(str) … Read more

Changing column names of a data frame

I have a data frame called “newprice” (see below) and I want to change the column names in my program in R. In fact this is what am doing: I have not put this in a loop because I want each column name to be different as you see. When I paste my program into … Read more

Categories R