All of the interesting technological, artistic or just plain fun subjects I'd investigate if I had an infinite number of lifetimes. In other words, a dumping ground...

Thursday, 8 May 2008

more NTP scripts

http://saturn.dennishilberg.com/gathering_data.php

NTP Performance Monitoring, Client Stats, Data Plotting


How to determine if you program is using MMX, SSE and SSE2 extensions on Linux with GCC

1. compile for your particular processor, generating assembly files. Just use your normal compile command line and add -S and -march=
g++  -g -Wall -march=pentium4 -O2 -S -I.. *.cc
2. search through the .s files for the new instructions and xmm registers listed on this page: http://en.wikipedia.org/wiki/Streaming_SIMD_Extensions
eg.
fgrep "movss" *.s  | grep -v "\.string" -
fgrep "xmm" *.s  | grep -v "\.string" -

I found that it used xmm0 now and then but only used a couple of the new instructions a couple of times.
It makes me wonder if this will make it slower because it has to save the extra registers on to the stack every time. I can only assume GCC is smart enough so it knows it doesn't have to do this.

Tuesday, 6 May 2008

mapping #include files using dot and graphviz


grep "#include" *.c* | grep -v "<" - | grep -v "//" - > includes.txt
grep "#include" *.h | grep -v "<" - | grep -v "//" - >> includes.txt
Then modify the .txt file in VI and save it as .dot


digraph yms_dep {
allocate_main -> Yard;
allocate_main -> Slot;
allocate_main -> yard_shm_daem;
allocate_main -> cont;
allocate_main -> ContainerHelper;
allocate_main -> ECShmem;
allocate_main -> YtoHtml;
Allocation -> Slot;
Allocation -> XMLListener;
Allocation -> Allocation;
AllocationFilter -> AllocationFilter;
AllocationFilter -> Slot;
allocationtimes -> allocationtimes;
alloclistener -> ServerSocket;
alloclistener -> SocketException;
alloclistener -> Slot;
alloclistener -> Yard;
alloclistener -> alloclistener;
ban -> ContainerHelper;
ban -> ban;
bannedSlots -> ContainerHelper;
bannedSlots -> bannedSlots;
berths -> ContainerHelper;
berths -> stat;
berths -> Vessels;
berths -> VesselNotFoundException;
berths -> berths;
BestAlloc -> BestAlloc;
BestAllocsList -> BestAllocsList;
BestAllocsList -> Lock;
Block -> ReeferRow;
Block -> ContainerNotFoundException;
Block -> Block;
Ches -> Ches;
client -> ClientSocket;
client -> SocketException;
ClientSocket -> ClientSocket;
ClientSocket -> SocketException;
concreteObserver -> ContainerHelper;
concreteObserver -> concreteObserver;
concreteSubject -> concreteSubject;
Conslist -> ContainerHelper;
Conslist -> Statistics;
Conslist -> SocketException;
Conslist -> Lock;
Conslist -> tcp_msg;
Conslist -> Message;
Conslist -> Conslist;
Consol -> NullWiException;
Consol -> XMLListener;
Consol -> Ches;
Consol -> Consol;
ContainerHelper -> ContainerHelper;
ContainerHelper -> Yard;
ContainerHelper -> ContainerNotFoundException;
CostFunction -> CostFunction;
ctr_key_dump -> Yard;
ctr_key_dump -> Slot;
ctr_key_dump -> yard_shm_daem;
ctr_key_dump -> cont;
ctr_key_dump -> ContainerHelper;
ctr_key_dump -> ECShmem;
ctr_key_dump -> Wis;
ctr_key_dump -> WorkInst;
Delays -> Delays;
ECShmem -> ECShmem;
ExtAlloc -> ExtAlloc;
ExtAlloc -> Allocation;
hazslots -> ContainerHelper;
hazslots -> stat;
hazslots -> hazslots;
hideslots -> ContainerHelper;
hideslots -> stat;
hideslots -> hideslots;
json_spirit_reader -> json_spirit_reader;
json_spirit_reader -> json_spirit_value;
json_spirit_value -> json_spirit_value;
json_spirit_writer -> json_spirit_writer;
json_spirit_writer -> json_spirit_value;
Lock -> Lock;
Log -> Log;
main -> Yard;
main -> XMLListener;
main -> yms;
main -> statagg;
main -> alloclistener;
Message -> Message;
Nodes -> Block;
Nodes -> Row;
Nodes -> Nodes;
Nodes -> berths;
oow -> oow;
Oows -> Oows;
OptimizerJob -> OptimizerJob;
OptimizerJobsList -> Yard;
OptimizerJobsList -> OptimizerJobsList;
OptimizerJobsList -> WorkInst;
Parameters -> Parameters;
Params -> Params;
Params -> OptimizerJobsList;
Params -> Block;
Params -> Yard;
Params -> env;
Params -> ContainerNotFoundException;
Params -> VesselNotFoundException;
Params -> Statistics;
Params -> ContainerHelper;
Params -> berths;
reeferbay -> ContainerHelper;
reeferbay -> stat;
reeferbay -> reeferbay;
ReeferRow -> Block;
ReeferRow -> ReeferRow;
ReeferRow -> ContainerNotFoundException;
Row -> Row;
Row -> Block;
Row -> Yard;
Row -> ContainerHelper;
Row -> ContainerNotFoundException;
Row -> stat;
ServerSocket -> ServerSocket;
ServerSocket -> SocketException;
Slot -> Yard;
Slot -> Block;
Slot -> Row;
Slot -> ContainerHelper;
Slot -> ydslot;
Slot -> ContainerNotFoundException;
Slot -> Slot;
Socket -> Socket;
Socket -> SocketException;
statagg -> Block;
statagg -> reeferbay;
statagg -> statagg;
stat -> load_ctr;
stat -> ContainerHelper;
stat -> stat;
Statistics -> Statistics;
Statistics -> Allocation;
Statistics -> ContainerNotFoundException;
Statistics -> VesselNotFoundException;
str_to_time_t -> str_to_time_t;
tier -> tier;
truckArea -> ContainerHelper;
truckArea -> stat;
truckArea -> truckArea;
Vessel -> ContainerHelper;
Vessel -> XMLListener;
Vessel -> Vessel;
Vessels -> ContainerHelper;
Vessels -> XMLListener;
Vessels -> Vessels;
Wis -> Wis;
Wis -> Block;
Wis -> Yard;
WorkInst -> ec;
WorkInst -> ECShmem;
WorkInst -> NullWiException;
WorkInst -> Block;
WorkInst -> XMLListener;
WorkInst -> WorkInst;
XMLListener -> BestAllocsList;
XMLListener -> ContainerNotFoundException;
XMLListener -> Conslist;
XMLListener -> ServerSocket;
XMLListener -> SocketException;
XMLListener -> XMLListener;
XMLListener -> VesselNotFoundException;
XMLListener -> berths;
XMLListener -> truckArea;
XMLListener -> stat;
XMLListener -> oow;
Yardcom -> Yardcom;
Yardcom -> SocketException;
Yard -> yard_shm_daem;
Yard -> cont;
Yard -> Params;
Yard -> Nodes;
Yard -> Vessels;
Yard -> VesselNotFoundException;
Yard -> Yard;
yms -> eclimits;
yms -> SocketException;
yms -> ContainerHelper;
yms -> ContainerNotFoundException;
yms -> YtoHtml;
yms -> yms;
YtoHtml -> Block;
YtoHtml -> Row;
YtoHtml -> Slot;
YtoHtml -> ContainerHelper;
YtoHtml -> YtoHtml;
AllocationFilter -> Wis;
AllocationFilter -> Slot;
AllocationFilter -> Ches;
AllocationFilter -> Yard;
AllocationFilter -> Log;
AllocationFilter -> bannedSlots;
Allocation -> Slot;
alloclistener -> Yard;
alloclistener -> Params;
alloclistener -> yms;
ban -> bannedSlots;
ban -> ContainerHelper;
bannedSlots -> cont;
bannedSlots -> ContainerHelper;
bannedSlots -> Slot;
berths -> concreteObserver;
berths -> concreteSubject;
berths -> stat;
berths -> Nodes;
berths -> Yard;
BestAlloc -> Allocation;
BestAlloc -> Slot;
BestAlloc -> Block;
BestAllocsList -> Consol;
Block -> Slot;
Block -> Row;
Block -> Allocation;
Block -> Params;
Block -> Yard;
Block -> concreteObserver;
Block -> concreteSubject;
Block -> stat;
Block -> reeferbay;
Ches -> ECShmem;
Ches -> Oows;
Ches -> Wis;
Ches -> WorkInst;
ClientSocket -> Socket;
ClientSocket -> Message;
concreteObserver -> cont;
concreteObserver -> observer;
concreteSubject -> cont;
concreteSubject -> subject;
concreteSubject -> concreteObserver;
Conslist -> Consol;
Conslist -> Log;
Conslist -> Wis;
Conslist -> Yardcom;
Conslist -> Statistics;
Consol -> Slot;
Consol -> WorkInst;
Consol -> Allocation;
ContainerHelper -> cont;
ContainerHelper -> Reefer;
ContainerNotFoundException -> Exception;
CostFunction -> Params;
Delays -> Statistics;
ECShmem -> ecipc;
ExtAlloc -> Allocation;
hazslots -> concreteObserver;
hazslots -> stat;
hideslots -> concreteObserver;
hideslots -> stat;
json_spirit -> json_spirit_value;
json_spirit -> json_spirit_reader;
json_spirit -> json_spirit_writer;
json_spirit_reader -> json_spirit_value;
json_spirit_writer -> json_spirit_value;
Nodes -> Row;
Nodes -> Block;
Nodes -> Yard;
NullWiException -> Exception;
observer -> cont;
oow -> BestAllocsList;
oow -> Conslist;
Oows -> ECShmem;
OptimizerJob -> ecipc;
OptimizerJobsList -> OptimizerJob;
OptimizerJobsList -> Yard;
OptimizerJobsList -> Row;
Params -> Slot;
Params -> CostFunction;
Params -> Statistics;
Params -> Wis;
Params -> Ches;
Params -> ContainerHelper;
Params -> Yard;
reeferbay -> concreteObserver;
reeferbay -> concreteSubject;
reeferbay -> stat;
ReeferRow -> Row;
Row -> Slot;
Row -> Block;
Row -> Yard;
Row -> Allocation;
Row -> concreteObserver;
Row -> concreteSubject;
Row -> stat;
Row -> Reefer;
ServerSocket -> Socket;
Slot -> cont;
Slot -> yard_shm_daem;
Slot -> Reefer;
Slot -> concreteSubject;
Slot -> concreteObserver;
Slot -> tier;
Slot -> ban;
SocketException -> Exception;
Socket -> Message;
statagg -> Yard;
stat -> load_ctr;
Statistics -> Row;
Statistics -> Slot;
Statistics -> Yard;
Statistics -> Log;
Statistics -> WorkInst;
subject -> cont;
subject -> concreteObserver;
tier -> concreteSubject;
truckArea -> concreteObserver;
truckArea -> stat;
VesselNotFoundException -> Exception;
Vessels -> yard_shm_daem;
Vessels -> Vessel;
Wis -> ECShmem;
Wis -> Slot;
Wis -> WorkInst;
WorkInst -> ecshm;
WorkInst -> ECShmem;
WorkInst -> NullWiException;
WorkInst -> Slot;
WorkInst -> Row;
XMLListener -> yms;
XMLListener -> Yard;
Yardcom -> ClientSocket;
Yard -> Slot;
Yard -> Block;
Yard -> Allocation;
Yard -> yard_shm_daem;
Yard -> Params;
Yard -> Wis;
Yard -> Ches;
Yard -> Nodes;
Yard -> Vessels;
Yard -> Vessel;
Yard -> concreteObserver;
Yard -> stat;
Yard -> tier;
Yard -> truckArea;
Yard -> berths;
Yard -> hazslots;
Yard -> hideslots;
Yard -> allocationtimes;
yms -> sock;
yms -> tcp_msg;
yms -> Delays;
yms -> Yard;
yms -> Consol;
yms -> wi;
yms -> Statistics;
yms -> Params;
yms -> Parameters;
yms -> Wis;
yms -> Yardcom;
yms -> WorkInst;
yms -> AllocationFilter;
yms -> YtoHtml;
yms -> oow;
yms -> Log;
YtoHtml -> Slot;
YtoHtml -> Yard;
}

dot -Tpng includes.dot -o includes.png

Gmail IMAP and virtual box


Gmail IMAP


VirtualBox is a family of powerful x86 virtualization products for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL). See "About VirtualBox" for an introduction.

Presently, VirtualBox runs on Windows, Linux, Macintosh and OpenSolaris hosts and supports a large number of guest operating systems including but not limited to Windows (NT 4.0, 2000, XP, Server 2003, Vista), DOS/Windows 3.x, Linux (2.4 and 2.6), and OpenBSD.


Wednesday, 30 April 2008

Postgresql - versioning the schema and running totals, sums and moving averages

Robert Treat

http://people.planetpostgresql.org/xzilla/index.php?/archives/341-getddl-now-available.htmlgetddl now available

One common discussion we see on the postgresql mailing lists is that of how to track changes and do versioning of schema within a database. One of the common solutions offered is the idea of grabbing schema from the system catalogs, writing it to a file, and then committing that to svn. In theory you could write an elegant tool for such a task, but given the number of times someone has asked me to send them a copy of the script we use at OmniTI, I'm guess that even the hacky script we use will probably be helpful. To that end, I've finally gone ahead and put a public copy of our getddl tool up on labs. Be aware that the script has some issues; I've include a TODO of some items that I'd like to see improved, but it meets our current needs, so you're better off writing patches than waiting for a new release (;-)), but hopefully it will still be of some value.

Leo Hsu and Regina Obe

How to calculate Running Totals and Sums in SQL

People have asked us how to calculate running totals a number of times; not a lot but enough that we feel we should document the general technique. This approach is fairly ANSI-SQL standard and involves using SELF JOINS. In a later article we shall describe how to calculate moving averages which follows a similar technique but with some extra twists.

Note that the below examples can also be done with a correlated sub-select in the SELECT clause and in some cases that sometimes works better. Perhaps we shall show that approach in a later issue. We tend to prefer the look of the SELF JOIN though and in practice it is generally more efficient since its easier for planners to optimize and doesn't always result in a nested loop strategy. Just feels a little cleaner and if you are totaling a lot of columns (e.g number of items, products) etc, much more efficient.



Tuesday, 29 April 2008

Literate Programming

http://www.literateprogramming.com/

Donald Knuth. "Literate Programming (1984)" in Literate Programming. CSLI, 1992, pg. 99.

I believe that the time is ripe for significantly better documentation of programs, and that we can best achieve this by considering programs to be works of literature. Hence, my title: "Literate Programming."

Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.

The practitioner of literate programming can be regarded as an essayist, whose main concern is with exposition and excellence of style. Such an author, with thesaurus in hand, chooses the names of variables carefully and explains what each variable means. He or she strives for a program that is comprehensible because its concepts have been introduced in an order that is best for human understanding, using a mixture of formal and informal methods that reinforce each other.


http://www-cs-faculty.stanford.edu/~knuth/cweb.html
http://www.amazon.com/Literate-Programming-Center-Language-Information/dp/0937073806/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1208825413&sr=1-1
http://www.google.com.au/url?sa=t&ct=res&cd=1&url=http%3A%2F%2Fwww.codesourcery.com%2Fvsiplplusplus&ei=b50WSJ6iDJqYoQSplaiQAg&usg=AFQjCNHTSRxmKfTemxCOKWoXHC1M4vwq6Q&sig2=OQj0AIdV1HXYTYD9nkRl1A

More NTP

http://www.schlitt.net/scripts/ntp/index.html

NTP management scripts

I've been participating in the NTP pool project since July 2003, and during this time, I've developed a few scripts to help monitor and manage NTP stuff. I figure that these scripts might be useful to others, so I'm posting them here, but please don't expect anything fancy. The documentation is bad, there are few comments, and they haven't been tested on any machine other than mine. Feel free to use the scripts for anything you want. They are in the public domain.

I recommend getting at least ntp_clients, ntp_clients_stats, and ntp_pool_dns. These can all be downloaded via ntp_scripts.tar.gz.


http://gpsd.mainframe.cx/
This is a gpsd server in a really bad location beautiful suburban Sunnyvale. Very poor visibility from here: view1.png view2.png The hardware is a Garmin GPS18/LVC attached to a Soekris Net4801 (view the dmesg). running OpenBSD, gpsd and some custom utilities This machine is maintained by Chris Kuethe.

http://tycho.usno.navy.mil/gpstt.html

USNO GPS Time Transfer



The U.S. Naval Observatory (USNO) monitors the timing of the GPS to provide a reliable and stable coordinated time reference for the satellite navigation system. The USNO provides two modes of operation to monitor the GPS: the Standard Positioning Service (SPS) and the Precise Positioning Service (PPS). The USNO SPS consists of a coarse acquisition (C/A) code, single channel timing receiver and the processed data are available on the USNO GPS timing data website http://tycho.usno.navy.mil/gps_datafiles.html.

IGS Products

The IGS collects, archives, and distributes GPS and GLONASS observation data sets of sufficient accuracy to meet the objectives of a wide range of scientific and engineering applications and studies. These data sets are analyzed and combined to form the IGS products shown in the table below.

IGS products support scientific activities such as improving and extending the International Terrestrial Reference Frame (ITRF) maintained by the International Earth Rotation and Reference Systems Service (IERS), monitoring deformations of the solid Earth and variations in the liquid Earth (sea level, ice sheets, etc.) and in Earth rotation, determining orbits of scientific satellites, and monitoring the troposphere and ionosphere.

http://www.penninespringmusic.co.uk/rich/software/

tim's shared items

Add to Google Reader or Homepage