Sunday, February 16, 2014

Top Sci-fi

1 - Ender's Game - Orson Scott Card - 1985
2 - Dune - Frank Herbert - 1965
3- Foundation - Isaac Asimov - 1951
4 - Hitchhiker's Guide to the Galaxy - Douglas Adams - 1979
5 - 1984 - George Orwell - 1949
6 - Stranger in a Strange Land - Robert A Heinlein - 1961
7 - Fahrenheit 451 - Ray Bradbury - 1954
8 - 2001: A Space Odyssey - Arthur C Clarke - 1968
9 - Starship Troopers - Robert A Heinlein - 1959
10 - I, Robot - Isaac Asimov - 1950
11 - Neuromancer - William Gibson - 1984
12 - Do Androids Dream of Electric Sheep - Philip K Dick - 1968
13 - Ringworld - Larry Niven - 1970
14 - Rendezvous With Rama - Arthur C Clarke - 1973
15 - Hyperion - Dan Simmons - 1989
16 - Brave New World - Aldous Huxley - 1932
17 - The Time Machine - H G Wells - 1895
18 - Childhood's End - Arthur C Clarke - 1954
19 - The Moon is a Harsh Mistress - Robert A Heinlein - 1966
20 - The War of the Worlds - H G Wells - 1898
21 - The Forever War - Joe Haldeman - 1974
22 - The Martian Chronicles - Ray Bradbury - 1950
23 - Slaughterhouse Five - Kurt Vonnegut - 1969
24 - Snow Crash - Neal Stephenson - 1992
25 - The Mote in God's Eye - Niven & Pournelle - 1975

Wednesday, February 12, 2014

Code coverage

http://www.ibm.com/developerworks/java/library/j-cq01316/index.html?ca=drs

There are different types of coverage measurements, but most tools focus on line coverage, also known as statement coverage. In addition, some tools report branch coverage. A test coverage measurement is obtained by exercising a code base with a test harness and capturing data that corresponds to code having been "touched" throughout the lifetime of the test process. The data is then synthesized to produce a coverage report. In Java shops, the test harness is commonly JUnit and the coverage tool is usually something like Cobertura, Emma, or Clover, to name a few. 

....

Tuesday, February 11, 2014

save screen buffer to file

screen -r myscreen

Go to copy mode
Ctrl + a [

Go to the beginning of the line that you want to copy (use arrow keys or Pg Up)

then press Spacebar to initiate copying of current line

Go to the end of the line that you want to copy

press Spacebar again to stop copying of the current line

go to command mode
Ctrl + a :

then Save the selected text to the file by:
writebuf /home/bla/screen.log

Ubuntu can't get on the internet

http://answers.yahoo.com/question/index?qid=20090501233741AAN97hi 

Okay connects to lan. check. 
has local IP address... check. 
can't connect to internet... 


ping google.com
PING google.com (173.194.33.130) 56(84) bytes of data.
64 bytes from sea09s17-in-f2.1e100.net (173.194.33.130): icmp_req=1 ttl=54 time=12.0 ms

try this in a browser: 

http://173.194.33.130

Got Google? 
The problem is in your DNS settings. 
try this: open a terminal and type: 
sudo cp /etc/resolv.conf /etc/resolv.conf.bak 
(password) 
sudo echo "nameserver 208.67.222.222" > /etc/resolv.conf 
sudo echo "nameserver 127.0.0.1" >> /etc/resolv.conf 
sudo /etc/init.d/networking restart

Thursday, February 6, 2014

Embed image to HTML by encoding it in base64

http://www.base64-image.de

<img src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4Q1hRXhpZgAATU0AKgAAAAgACgEOAAIAAAALAAAAhgEP">

Wednesday, January 29, 2014

time - record time elapsed, memory

Some useful tools for figuring out how much memory an application is using.

ps aux

top

cat /proc/<PID>/status

alias time='/usr/bin/time -v'

/usr/bin/time -v ls

        Command being timed: "ls"
        User time (seconds): 0.00
        System time (seconds): 0.00
        Percent of CPU this job got: 0%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 3728
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 277
        Voluntary context switches: 15
        Involuntary context switches: 1
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

Thursday, January 23, 2014

Software carpentry

http://software-carpentry.org/v4/index.html

Who We Are

Our volunteers teach basic software skills to researchers in science, engineering, and medicine. Founded in 1998, we are now part of the Mozilla Science Lab.

What We Do

We run bootcamps all over the world, and provide open access material for self-paced instruction. We also run a training program for people who'd like to help us teach.

How To Help

Like all volunteer organizations, we depend on you to help us help others. You can host a bootcamp, help create new teaching materials, or improve the tools we use.

The gut–microbiome–brain connection

http://www.nature.com/nrn/journal/v15/n2/full/nrn3669.html?WT.ec_id=NRN-201402

Nature Reviews Neuroscience
 
15,
 
65
 
 
doi:10.1038/nrn3669
Published online
 
  1. Hsiao, E. Y. et al. Microbiota modulate behavioral and physiological abnormalities associated with neurodevelopmental disorders. Cellhttp://dx.doi.org/10.1016/j.cell.2013.11.024 (2013)

Tuesday, January 21, 2014

Taking R to the Limit (High Performance Computing in R)

http://www.slideshare.net/bytemining/r-hpc

bigmemory - it is ideal for problems involving the analysis in R for manageable subsets of the data, or when an analysis is conducted mostly in C++

the "big" family

biganalytics, synchronicity, bigtabulate, big.matrix, bigalgebra, bigvideo, shared.big.matrix, filebacked.big.matrix, bigsplit

linear models: biglm.big.matrix

mwhich

ff - "fast access files" - file-based access to datasets that cannot fit in memory

data.table

mapReduce - apply(map(data), reduce)

HadoopStreaming

Thursday, January 16, 2014

SQL EXPLAIN to analyse and improve SQL queries

Database SQL query is slow?

You can use MySQL's EXPLAIN to analyse the query, maybe the column of the WHERE clause needs to be indexed?

EXPLAIN SELECT tt.TicketNumber, tt.TimeIn,
               tt.ProjectReference, tt.EstimatedShipDate,
               tt.ActualShipDate, tt.ClientID,
               tt.ServiceCodes, tt.RepetitiveID,
               tt.CurrentProcess, tt.CurrentDPPerson,
               tt.RecordVolume, tt.DPPrinted, et.COUNTRY,
               et_1.COUNTRY, do.CUSTNAME
        FROM tt, et, et AS et_1, do
        WHERE tt.SubmitTime IS NULL
          AND tt.ActualPC = et.EMPLOYID
          AND tt.AssignedPC = et_1.EMPLOYID
          AND tt.ClientID = do.CUSTNMBR;

http://dev.mysql.com/doc/refman/5.0/en/explain-output.html


mysql> alter table MY_TABLE add INDEX IDX_F1_F2 (F1,F2);
mysql> SHOW INDEX FROM MY_TABLE;

http://devzone.advantagedatabase.com/dz/webhelp/advantage9.1/how_indexes_are_used_by_the_where_clause.htm

http://www.experts-exchange.com/Database/MySQL/A_1250-3-Ways-to-Speed-Up-MySQL.html