Thursday, November 8, 2012

R: The utter n00b's guide to R

Here's the utter n00b's guide to R.

Somewhat improved. Fixed the spelling, and, hopefully the thing with the write.table(...) which I missed.


Check it out here:
utter n00b's guide to R

Tuesday, October 30, 2012

Conky!

Here's my .conkryc

Mine:
# note that the $xmms2_* and $mpd_* stuff will only work if you have support for them built into conky

alignment top_right
double_buffer yes
update_interval 5.0
Maximum_width 200
own_window yes
own_window_type desktop # Try also 'normal' or 'override'

TEXT
$nodename - $sysname $kernel on $machine
$hr
${color grey}Uptime:$color $uptime
${color grey}Frequency (in MHz):$color $freq
${color grey}Frequency (in GHz):$color $freq_g
${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
${color grey}CPU Usage:$color $cpu% ${cpubar 4}
${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes
$hr
${color grey}File systems:
 / $color${fs_free /}/${fs_size /} ${fs_bar 6 /}
${color grey}Networking:
 Up:$color ${upspeed eth0} k/s${color grey} - Down:$color ${downspeed eth0} k/s
$hr
#${color grey}MPD: $mpd_status $mpd_artist - $mpd_title from $mpd_album at $mpd_vol
#Bitrate: $mpd_bitrate\n" "Progress: $mpd_bar
#${color grey}XMMS2: $xmms2_status $xmms2_artist - $xmms2_title from $xmms2_album
Progress: $xmms2_bar
${color grey}Name  PID CPU% MEM%
 ${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
 ${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
 ${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
 ${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${tail /var/log/Xorg.0.log 3}";
$hr
${execpi 60 DJS=`date +%_d`; cal | sed s/"\(^\|[^0-9]\)$DJS"'\b'/'\1${color orange}'"$DJS"'$color'/}
# if using the latest conky, replace the last line with:
# ${execpi 60 DJS=`date +%-d`; cal -h | sed s/"\(^\|[^0-9]\)$DJS"'\b'/'\1${color orange}'"$DJS"'$color'/}

Other stuff you could add: 

background yes
use_xft yes
xftfont Sans:size=8
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 200
maximum_width 200
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
default_color white
default_shade_color black
default_outline_color white
alignment top_right
gap_x 12
gap_y 12
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
TEXT
${font sans-serif:bold:size=8}${color yellow}SYSTEM ${hr 2}$color
$sysname $kernel $alignr $machine
Host:$alignr$nodename
AMD Athlon 64 X2 $alignr${freq_g cpu0}Ghz
Uptime:$alignr$uptime
File System: $alignr${fs_type}
Battery:$alignr${battery}${battery_percent}%
${font sans-serif:bold:size=8}${color yellow}DATE ${hr 2}$color
${alignc 59}${font sans-serif:bold:size=26}${time %H:%M:%S}${font}
${alignc}${font sans-serif:bold:size=8}${Time %A %m %d %Y}
${font sans-serif:bold:size=8}${color yellow}PROCESSORS ${hr 2}$color
CPU1: ${cpu cpu1}% ${cpubar cpu1}
RAM:      ${alignc} $mem / $memmax $alignr $memperc%
SYSTEM: $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_used_perc /}%
SWAP:    $alignc ${swap} / ${swapmax} $alignr ${swapperc}%
${font sans-serif:bold:size=8}${color yellow}TEMPERATURE ${hr 2}$color
PCI adapter Temperature:$alignr${hwmon 1 temp 1} ${iconv_start UTF-8 ISO_8859-1}° ${iconv_stop}C
V. device Temperature:$alignr${acpitemp} ${iconv_start UTF-8 ISO_8859-1}° ${iconv_stop}C
HDA Temperature:$alignr${hddtemp} ${iconv_start UTF-8 ISO_8859-1}° ${iconv_stop}C
${font sans-serif:bold:size=8}${color yellow}TOP PROCESSES ${hr 2}$color
${top_mem name 1}${alignr}${top mem 1} %
${top_mem name 2}${alignr}${top mem 2} %
${top_mem name 3}${alignr}${top mem 3} %
${top_mem name 4}${alignr}${top mem 4} %
${top_mem name 5}${alignr}${top mem 5} %
${font sans-serif:bold:size=8}${color yellow}WEATHER ${hr 2}$color
Update: ${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ WMKK last_update - }
Weather: ${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ WMKK weather - }
Temperature: ${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ WMKK temperature}${iconv_start UTF-8 ISO_8859-1}° ${iconv_stop}C
Cloud: ${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ WMKK cloud_cover -}
Humidity: ${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ WMKK humidity}%
Preasure: ${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ WMKK pressure -}hPa
Wind: ${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ WMKK wind_speed}km/h
Wind Direction: ${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ WMKK wind_dir}
Wind Direction: ${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ WMKK wind_dir_DEG}${iconv_start UTF-8 ISO_8859-1}° ${iconv_stop}
${font sans-serif:bold:size=8}${color yellow}NETWORK ${hr 2}$color${if_existing /proc/net/route wlan0}$
$alignc ....Wireless....
WAN IP:$alignr${execi 3600 wget -O- http://whatismyip.org/ | tail}
IP address: $alignr ${addr wlan0}
ESSID: $alignr ${wireless_essid wlan0}
Connection quality: $alignr ${wireless_link_qual_perc wlan0}%
Downloads:$alignr${downspeed wlan0}/s
${downspeedgraph wlan0 8,200 F57900 FCAF3E}
Total Downloads:$alignr${totaldown wlan0}
Uploads:$alignr${upspeed wlan0}/s
${upspeedgraph wlan0 8,200 F57900 FCAF3E}
Total Uploads:$alignr${totalup wlan0}
${else}${if_existing /proc/net/route eth1}
$alignc ....Wireless....
WAN IP:$alignr${execi 3600 wget -O- http://whatismyip.org/ | tail}
IP address: $alignr ${addr eth1}
ESSID: $alignr ${wireless_essid eth1}
Connection quality: $alignr ${wireless_link_qual_perc eth1}%
Downloads:$alignr${downspeed eth1}/s
${downspeedgraph eth1 8,200 F57900 FCAF3E}
Total Downloads:$alignr$${totaldown eth1}
Uploads:$alignr${upspeed eth1}/s
${upspeedgraph eth1 8,200 F57900 FCAF3E}
Total Uploads:$alignr${totalup eth1}
${else}${if_existing /proc/net/route eth0}
$alignc ....Cable....
WAN IP:$alignr${execi 3600 wget -O- http://whatismyip.org/ | tail}
IP address: $alignr ${addr eth0}
ESSID: $alignr ${wireless_essid eth0}
Connection quality: $alignr ${wireless_link_qual_perc eth0}%
Downloads:$alignr${downspeed eth0}/s
${downspeedgraph eth1 8,200 F57900 FCAF3E}
Total Downloads:$alignr$${totaldown eth0}
Uploads:$alignr${upspeed eth0}/s
${upspeedgraph eth0 8,200 F57900 FCAF3E}
Total Uploads:$alignr${totalup eth0}
${else}${font sans-serif:bold:size=8}${font}Network Unavailable${endif}

Monday, October 15, 2012

xtide: Harmonics and shitz.


Done on a Debian 6 system.

Ok, so you've set up xTide, but you don't live in the US of A and you need to compile your own harmonics data. So you need tideEditor:

tideEditor (finally got this to work, with plenty of help from Dave - the guy who wrote tide editor. Thanks, Dave.)

The download site will mention you will need the following software: libtcd and Qt 4.x.
You can do this through Synaptic, if it's easier for you.

For libtcd, you will also need:
libtcd-dev

For Qt4, you will need:
libqt4-dev
... and all its associated dependencies (probably).

= Install both libtcd and Qt4.x before trying to install tideEditor. =

Compiling tideEditor:

The command to link up the CPP libraries will differ for Debian (on the date this post was made). So if you went through the readme and the command there didn't work, try this (it should all be on a single line):

CPPFLAGS="-I/usr/include/qt4 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/Qt3Support"

The other flags remain the same. Edit the path to the QT4 directory as necessary.

Here's how it went for mine:

user@domin$ ./configure \
CPPFLAGS="-I/usr/include/qt4 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/Qt3Support" \
LDFLAGS="-L$QT4DIR/lib"
user@domin$  make
user@domin$ su
Password:
user@domin$  make install

Proceed as instructed in the read me. If I get it to work successfully, I will include more detailed instructions here. If you got it working and want to help out on this, feel free to post the associated instructions in the comments section.

If you suddenly realize (to great sadness) you don't have a .tcd file to feed into tide editor, read on.

This is intended to be a more detailed version of the "Expert" section at the xTide website, which, for all intents and purposes, should be considered before whatever I write here.

I will also assume that you already have xTide (and the minimal dependencies) installed. Do it from  or with aptitude/apt-get/Synaptic. No problem there.

Stuff you'll need:

1) Congen 1.6

2) Harmgen3
   which needs to be backed up with:
   2.1) Octave 3.4.3
        - I tried installing one with Octave 3.2x and it worked.
   2.2) Congen 1.6

3) Harmbase2
   which needs to be backed up with:
   3.1) Postgres 9.2.2        Source code here: http://www.postgresql.org/ftp/source/v9.1.2/
   3.2) libtcd (you probably already have this)
         - libtcd0 from the debian repository didn't work for me. Either try libtcd-dev, or compile from source yourself.
   3.3) libdstr
   3.3.1) libecpg-dev (I needed this, but it wasn't listed on xTides)
          - under the impression I installed this through Synaptic

Get it all here:
http://www.flaterco.com/xtide/files.html

Download everything and dump it all somewhere you can easily find it.

1) Compile the source codes and/or install the necessary software as summarized in the table below. Dependencies have to be installed before actual_software, dependencies_2 before dependencies.
So install from up to down and right to left.

==============================================================
Actual_Software |DEPENDENCIES                |DEPENDENCIES_2
================|============================|================
tideEditor      |-libtcd                     |NIL
                |-libtcd-dev                 |NIL
                |-Qt4.x                      |NIL
----------------|----------------------------|----------------
congen-1.6.2    |-libcongen header file      |NIL
----------------|----------------------------|----------------
harmgen-3.1     |-Congen1.6                  |NIL
                |-Octave3.3.4                |-textlive
                |                            |-gpref
                |                            |-glpk
----------------|----------------------------|----------------
harmbase2       |-Postgres9.2.2              |NIL
                |-Congen1.6                  |see above
                |-libtcd(alreadyinstalled)   |NIL
                |-libdstr                    |NIL
===============================================================

Note:

Configure Postgres 9.2.2 with the following command:
./configure --prefix=/usr

as opposed to the usual ./configure.

If all goes well and Postgres installs right, Harmbase2 should configure and install with no issue.

If Harmbase2 complains it can’t find whatever header files, the line below should do it.

./configure CPPFLAGS="-I/usr/local/pgsql/include" LDFLAGS="-L/usr/local/pgsql/lib"

Adjust the path to the header file and its associated library accordingly.

This worked for me. If manage to get a tide file in, i’ll update.

Thursday, August 23, 2012

OPeNDAP: The utter n00b's guide to data extraction from an OPeNDAP server.

'cause everyone is a n00b at some point.

PDF guide here: utter n00b's guide to OPeNDAP

Note: this guide makes the (potentially) egregious assumption that you know nothing of OPeNDAP, you need to get data out, and all you got is your browser, MS Excel, some kind of text editor (Notepad will do), and an internet connection. No specialized software, no programming background, nothing. Just desperation.

It's slightly longer than the OPeNDAP quick start guide, but with less text and more graphics. Hopefully it will explain things better, especially if you're new to this.

The last part might work with Open Office as well, but I haven't tried.

Wednesday, May 2, 2012

gnuplot / Notepad++ syntax highlighting

Taken from here: http://groups.google.com/group/comp.graphics.apps.gnuplot/browse_thread/thread/52e7cb2703a7b421?fwc=1 ... with the suggested edits included.

Set 1:
angles arrow autoscale bars bmargin border boxwidth clabel clip cntrparam colorbox contour datafile decimalsign dgrid3d dummy encoding fit fontpath format functions function grid hidden3d historysize isosamples key label lmargin loadpath locale logscale mapping margin mouse multiplot mx2tics mxtics my2tics mytics mztics notitle offsets origin output parametric plot pm3d palette pointsize polar print rmargin rrange samples size style surface terminal tics ticslevel ticscale timestamp timefmt title tmargin trange urange variables version view vrange x2data x2dtics x2label x2mtics x2range x2tics x2zeroaxis xdata xdtics xlabel xmtics xrange xtics xzeroaxis y2data y2dtics y2label y2mtics y2range y2tics y2zeroaxis ydata ydtics ylabel ymtics yrange ytics yzeroaxis zdata zdtics cbdata cbdtics zero zeroaxis zlabel zmtics zrange ztics cblabel cbmtics cbrange cbtics else lower raise refresh screendump smooth via

Set 2:
cd call clear exit help history if load pause using u with w index every smooth thru print pwd quit replot reread reset save set show unset shell splot system test unset update acsplines bezier binary csplines frequency macros matrix object sbeszier table termoption unique xyplane zzeroaxis

Set 3:
abs acos acosh arg asin asinh atan atan2 atanh besj0 besj1 besy0 besy1 ceil cos cosh erf erfc exp floor gamma ibeta inverf igamma imag invnorm int lambertw lgamma log log10 norm rand real sgn sin sinh sqrt tan tanh column defined m_hour tm_mday tm_min tm_mon tm_sec tm_wday tm_yday tm_year valid exists gprintf sprintf stringcolumn strlen strstrt substr system word words pi

Set 4:
FIT_CONVERGED FIT_LAMBDA_FACTOR FIT_LIMIT FIT_LOG FIT_MAXITER FIT_NDF FIT_SCRIPT FIT_START_LAMBDA FIT_STDFIT FIT_WSSR GNUTERM MOUSE_ALT MOUSE_BUTTON MOUSE_CHAR MOUSE_CTRL MOUSE_KEY MOUSE_SHIFT MOUSE_X MOUSE_X2 MOUSE_Y MOUSE_Y2 GPVAL_CB_LOG GPVAL_CB_MAX GPVAL_CB_MIN GPVAL_CB_REVERSE GPVAL_COMPILE_OPTIONS GPVAL_LAST_PLOT GPVAL_MULTIPLOT GPVAL_OUTPUT GPVAL_PATCHLEVEL GPVAL_PLOT GPVAL_SPLOT GPVAL_TERM GPVAL_TERMOPTIONS GPVAL_T_LOG GPVAL_T_MAX GPVAL_T_MIN GPVAL_T_REVERSE GPVAL_U_LOG GPVAL_U_MAX GPVAL_U_MIN GPVAL_U_REVERSE GPVAL_VERSION GPVAL_VIEW_MAP GPVAL_VIEW_ROT_X GPVAL_VIEW_ROT_Z GPVAL_VIEW_SCALE GPVAL_VIEW_ZSCALE GPVAL_V_LOG GPVAL_V_MAX GPVAL_V_MIN GPVAL_V_REVERSE GPVAL_X2_LOG GPVAL_X2_MAX GPVAL_X2_MIN GPVAL_X2_REVERSE GPVAL_X_LOG GPVAL_X_MAX GPVAL_X_MIN GPVAL_X_REVERSE GPVAL_Y2_LOG GPVAL_Y2_MAX GPVAL_Y2_MIN GPVAL_Y2_REVERSE GPVAL_Y_LOG GPVAL_Y_MAX GPVAL_Y_MIN GPVAL_Y_REVERSE GPVAL_Z_LOG GPVAL_Z_MAX GPVAL_Z_MIN GPVAL_Z_REVERSE GPVAL_TERMINALS

Tuesday, March 20, 2012

Cool Script(s)

Don't know how many people who read this (people actually read this?!?) use Notepad++ extensively, but here is a really neat way to link NPP with whatever compiler or software you're using:


If you're using NPP to code for gnuplot as well, add the following lines to the appropriate sections of the specified files (mentioned in the readme(s) you get with the Autoit scripts from the link above).

In case anybody gets confused:
= !!! = You edit the .ini file, but link the Notepad++ shortcut to the .exe file = !!! =

Here's the send key list, if you need it:
http://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm

For RunScript.ini (this goes under the Extensions block):
plt = gnuplot

 

; this goes right at the bottom, just above the ; End of INI file line
[gnuplot]
path = "C:\Program Files\gnuplot\binary\wgnuplot.exe"
wintitle = "gnuplot"
command = "load '%%scriptname%%' {Enter}"


















Also remember to edit the paths to all of the other software you intend to use.The easiest way to find the path is to look at it from the shortcuts you already have. For instance:

Right click on the shortcut and select Properties:


It's here: 

 


That goes under the path = "C:\.....\whatever.exe" line.
And here's where you find wintitle - Open the programme:

 


However, "RGui" seems to work best - whether you're on 64 or 32 bit. So leave the original as it is.
When you're done editing the .ini file, hit F5.

Also note: because AutoIt uses the window name to figure out where to send your scripts, it might make mistakes if different similar window names are available. I have had this send scripts to FireFox because I was looking at a gnuplot website (the window name was "gnuplot ...") while trying to send the script to the gnuplot interface. 

You should get this: 




As mentioned above, we edit the .ini file, but link the shortcut to the .exe file, followed by "$(FULL_CURRENT_PATH)“

The .exe file is in the same directory as the .ini, and has the same name. Since we can see the path to the .ini file here, we will enter

D:\RunAnything\RunScript\RunScript.exe "$(FULL_CURRENT_PATH)"
into the box.

Click Save.

Give the command a name, and map it to the keyboard shortcut of your heart's desire (drop menu). In this case, I'm calling it RunScript, and it will be called by pressing F10.




Click OK. It will take you back to this:


Close everything. You're done.

One more time, people?

For RunLines.ini (same as above):

plt = gnuplot


[gnuplot]
path = "C:\Program Files\gnuplot\binary\wgnuplot.exe"
wintitle = "gnuplot"
run_script_command = "load '%%scriptname%%' {Enter}"
single_line_command = "^a ^c +{INS} {Enter}"


“^a ^c +{INS} {Enter}” sends the following key strokes:

Ctrl+A
Ctrl+C
Shift+Insert
Enter

Given the location of my .exe file:

in Notepad++, press F5:

Enter the path to the .exe file followed by a space, then "$(EXT_PART)". 



Hit Save.

You should get a box that looks like this:


Give the command a name, and map it to the keyboard shortcut of your heart's desire (drop menu). In this case, I'm calling it RunLines, and mapping it to F9.



When you're done, hit OK. It'll take you back to this:



Just close the window, and the window with the .ini file.

NOTE: You gotta edit the file paths as necessary. I didn't install HelpFromWeb or NppExecute. If you need the AutoIt compiler, you can get it here. Works on Windows only. 

And now you all know what my desktop looks like.