<?xml version="1.0"?>
<!-- name="generator" content="blosxom/2.0" -->
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">
  <channel>
    <title>MAPERL:   </title>
    <link>http://www.maperl.com/cgi-local/journal</link>
    <description> Blog of Capt. Ben</description>
    <language>en</language>

  <item>
    <title>SVMOP:VSTP: Wouldn't it be nice to just have a color attribute</title>
    <pubDate>Sun, 21 Dec 2008 21:52:00 EDT</pubDate>
    <link>http://www.maperl.com/cgi-local/journal/2008/12/21#VSTP=081221-color</link>
    <description>
&lt;p&gt;
As pristine an XML implementation as KML is, I feel
that giving an object some attributes rather than having
to only use separate style objects would make use color
so much easier.
&lt;/p&gt;

&lt;p&gt;
I have taken Kurt's first pass on generating KML from the
database and added the time field in a timespan attribute
to linestrings.
&lt;/p&gt;

&lt;p&gt;
I still have a long way to go to know what elements and
attributes fit where in KML.
&lt;/p&gt;</description>
  </item>
  <item>
    <title>SVMOP:VSTP: Where oh where</title>
    <pubDate>Mon, 08 Dec 2008 14:19:00 EDT</pubDate>
    <link>http://www.maperl.com/cgi-local/journal/2008/12/08#VSTP-081208-lost</link>
    <description>
&lt;p&gt;
did my little database go. It has been several months since I worked
on the Volutary Ship Observor Tracking project. I can't recall where
I put the most recent version. My subversion repository doesn't seem
to have the most recent postings. My computer at work doesn't seem 
to have it.
&lt;/p&gt;

&lt;p&gt;
I definitely need a more structure procedure to assist this failing
brain.
&lt;/p&gt;

&lt;p&gt;
Kurt asked that I do the SQL to KML piece this week so that he could
take it to a Google conference.
&lt;/p&gt;</description>
  </item>
  <item>
    <title>SVMOP:VSTP: Lessons learned (so far) from this project</title>
    <pubDate>Fri, 10 Oct 2008 07:13:00 EDT</pubDate>
    <link>http://www.maperl.com/cgi-local/journal/2008/10/10#VSTP-081010-lessons</link>
    <description>
&lt;p&gt;
Since I still am very green as a Python programmer and still think in Perl,
I have been learned from pain the differences in concept. For one, the concept
and implementation of global variables is different. 
&lt;/p&gt;
&lt;p&gt;
In Perl, the concept is that the language is more likely to be used for utilities
rather than applications, therefore everythink is global if not otherwise
declared. Global to the namespace (module/package) that is. Python, however,
assumes everything is private unless otherwise declared.
This brings up the question of when is it appropriate to use globals in Python.
&lt;/p&gt;
&lt;p&gt;
I asked Kurt, whom I regard as a seasoned Python programmer, when he used
globals. His answer: &quot;never!&quot; Where do I use globals? When variables (usually
application configuration settings and things like file pointers/objects) are
used in many of the subroutines/functions. Rather than continually passing
these variables as argument to the call, I just make them global.
&lt;/p&gt;
&lt;p&gt;
Here is another wierdness abouth Python globals: the calling function declares
them as global rather than the block enclosing the functions (as in Perl when
they are explicitly declared global). 
&lt;/p&gt;
&lt;p&gt;
I'll get used to it.
&lt;/p&gt;
&lt;p&gt;
Other things that take some getting used to are split, join, and string
formatting. They are just enough different that I am having to correct
myself often.
&lt;/p&gt;
&lt;p&gt;
I all, I really like Python for application development. I still want to
use Perl for utility programming, but I know I won't learn Python unless
I use it for utilities as well as applications. It is not likely I will
completely forget Perl in the process, at least not until so few of my
brain neurons are firing that it does make any difference.
&lt;/p&gt;</description>
  </item>
  <item>
    <title>SVMOP:VSTP: rsync - doesn't seem to work on the web server</title>
    <pubDate>Wed, 08 Oct 2008 06:28:00 EDT</pubDate>
    <link>http://www.maperl.com/cgi-local/journal/2008/10/08#VSTP-081008-rsync</link>
    <description>
&lt;p&gt;
This is a test to see if rsync works on mv.com. I don't think it is
installed, so I'm hoping that the rsh/rcp method works. Let's see.
&lt;/p&gt;

&lt;p&gt;
Nope.. but rcp/scp does work. So I'll make a little script or alias
to shorten the call.  
&lt;/p&gt;</description>
  </item>
  <item>
    <title>SVMOP:VSTP: SQLite experiences</title>
    <pubDate>Tue, 07 Oct 2008 23:03:00 EDT</pubDate>
    <link>http://www.maperl.com/cgi-local/journal/2008/10/07#VSTP-081006-SQL-2</link>
    <description>
&lt;p&gt;
Dropping down to pysqlite from SQLalchemy wasn't too difficult. But the last
few details took an experienced pysqlite programmer (Kurt Schwehr) to
get things working. The issues were:
&lt;ul&gt;
&lt;li&gt;Be sure that there is a connection.commit() on a regular basis&lt;/li&gt;
&lt;li&gt;Be sure that proper parameter format is used in the INSERT&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
There are five different ways of specifying parameters. I still need
to find the one that works the best for me. Some do automatic value
casting.
&lt;/p&gt;</description>
  </item>
  <item>
    <title>SVMOP:VSTP: RDBMS and SQL -- the next phase for ShipTracking</title>
    <pubDate>Mon, 06 Oct 2008 22:09:00 EDT</pubDate>
    <link>http://www.maperl.com/cgi-local/journal/2008/10/06#VSTP-081005-SQL-1</link>
    <description>
&lt;p&gt;
The VOS (Voluntary Observation Ship) Tracking project has taken on a
new phase. The data will be read into a relational database as well as
the original XML format. 
&lt;/p&gt;

&lt;p&gt;
For the application user, there is little change. The major difference
is the specification for the database fields. Compare the SQL output
specification to the XML specification:
&lt;/p&gt;

&lt;pre&gt;
 &amp;lt;?xml version='1.0' encoding='iso-8859-1'?&amp;gt;
 &amp;lt;config&amp;gt;

  &amp;lt;inputDescr filetype=&quot;ASCII&quot;&amp;gt;
    &amp;lt;field name=&quot;year&quot;		start=&quot;1&quot;   	stop=&quot;4&quot; 	type=&quot;INT&quot;/&amp;gt;
    &amp;lt;field name=&quot;month&quot;		start=&quot;5&quot;   	stop=&quot;6&quot; 	type=&quot;INT&quot;/&amp;gt;
    &amp;lt;field name=&quot;day&quot;		start=&quot;7&quot;   	stop=&quot;8&quot; 	type=&quot;INT&quot;/&amp;gt;
    &amp;lt;field name=&quot;hour&quot;		start=&quot;9&quot;   	stop=&quot;12&quot; 	type=&quot;FLOAT&quot;/&amp;gt;
    &amp;lt;field name=&quot;lat&quot;		start=&quot;13&quot;  	stop=&quot;17&quot; 	type=&quot;FLOAT&quot;/&amp;gt;
    &amp;lt;field name=&quot;lon&quot;		start=&quot;18&quot;   	stop=&quot;23&quot; 	type=&quot;FLOAT&quot;/&amp;gt;
    &amp;lt;field name=&quot;callSign&quot;	start=&quot;35&quot;   	stop=&quot;44&quot; 	type=&quot;STR&quot;/&amp;gt;
  &amp;lt;/inputDescr&amp;gt;

  &amp;lt;outputDescr filetype=&quot;XML&quot; &amp;gt;
    &amp;lt;field name=&quot;year&quot; format=&quot;%d&quot; value=&quot;year&quot; /&amp;gt;
    &amp;lt;field name=&quot;month&quot; format=&quot;%d&quot; value=&quot;month&quot; /&amp;gt;
    &amp;lt;field name=&quot;day&quot; format=&quot;%d&quot; value=&quot;day&quot; /&amp;gt;
    &amp;lt;field name=&quot;hour&quot; format=&quot;%0.4d&quot; value=&quot;hour&quot; /&amp;gt;
    &amp;lt;field name=&quot;hrs&quot; format=&quot;%.2f&quot; value=&quot;float(int( hour /100) + ( hour /100.00 - int( hour /100))/.6)&quot; /&amp;gt;
    &amp;lt;field name=&quot;latitude&quot; format=&quot;%0.2f&quot; value=&quot;lat / 100&quot; /&amp;gt;
    &amp;lt;field name=&quot;longitude&quot; format=&quot;%0.2f&quot; value=&quot;lon / 100&quot; /&amp;gt;
    &amp;lt;field name=&quot;callSign&quot; format=&quot;%s&quot; value=&quot;trim( callSign )&quot; /&amp;gt;
  &amp;lt;/outputDescr&amp;gt;

  &amp;lt;outputDescr filetype=&quot;SQL&quot;&amp;gt;
    &amp;lt;field name=&quot;sqltime&quot; datatype=&quot;TEXT&quot; format=&quot;%s&quot; 
	   value = &quot;SQLtimeStr(year,month,day,0)&quot; /&amp;gt;
    &amp;lt;field name=&quot;latitude&quot; datatype=&quot;REAL&quot; format=&quot;%0.2f&quot; 
	   value=&quot;lat / 100&quot; /&amp;gt;
    &amp;lt;field name=&quot;longitude&quot; datatype=&quot;REAL&quot; format=&quot;%0.2f&quot; 
	   value=&quot;lon / 100&quot; /&amp;gt;
    &amp;lt;field name=&quot;wkt_geographic&quot; datatype=&quot;TEXT&quot; format=&quot;%s&quot;
	   value=&quot;wkt(lat,lon)&quot; /&amp;gt;
    &amp;lt;field name=&quot;callSign&quot; datatype=&quot;TEXT&quot; 
	   format=&quot;%s&quot; value=&quot;trim( callSign )&quot; /&amp;gt;
  &amp;lt;/outputDescr&amp;gt;

 &amp;lt;/config&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
Internally, there are some serious additions for the database
specification parsing and record insertion. However, the hard part was
deciding which Python modules to use and non use. After looking at 
SQLalchemy, we have decided to keep it simple and just use pysqlite.
(SQLite is the database engine we have picked.)
&lt;/p&gt;
</description>
  </item>
  <item>
    <title>SVMOP:VSTP: Wrapping it up</title>
    <pubDate>Mon, 24 Dec 2007 15:46:00 EDT</pubDate>
    <link>http://www.maperl.com/cgi-local/journal/2007/12/24#VSTP-071224</link>
    <description>
&lt;p&gt;For Christmas (and the winter) I'm wrapping up the programming of fields2xml.py. The basic
use can be understood by running fields2xml.py --help. It has the option of turning off the
metadata in the XML output with -s option. Sample code is on cowfish projects/bendev/ShipTracking.
&lt;/p&gt;</description>
  </item>
  <item>
    <title>SVMOP:VSTP: First run with full data set</title>
    <pubDate>Sat, 22 Dec 2007 23:27:00 EDT</pubDate>
    <link>http://www.maperl.com/cgi-local/journal/2007/12/22#VSTP-071222exceptions</link>
    <description>
&lt;p&gt;I've downloaded the entire GTS data set to my server at home, and,
after adding some more exception handling to the fields2xml.py
program, ran the entire data set: once with tab delimited formating to 
a single file, and then to separate xml files for each file in the
data set. That is 83 files. Each file took about 20 seconds to run.
The single tab delimited file resulted in 487565 records! &lt;/p&gt;

&lt;p&gt;I need some place on the CCOM servers to put this stuff. If it
gets down to the crunch before I leave, I'll just make a CD of it.&lt;/p&gt;</description>
  </item>
  <item>
    <title>SVMOP:VSTP: Benchmark for fields2xml.py</title>
    <pubDate>Fri, 21 Dec 2007 13:18:00 EDT</pubDate>
    <link>http://www.maperl.com/cgi-local/journal/2007/12/21#VSTP-071221benchmark</link>
    <description>
&lt;p&gt;After some code cleanup, I ran the program on a full months data (6400 records) of
GTS format. It took approximately 15 seconds to produce the XML. This was done
on my Toshiba laptop model A-105 with:
&lt;pre&gt;
model name      : Genuine Intel(R) CPU           T2050  @ 1.60GHz
stepping        : 8
cpu MHz         : 800.000
cache size      : 2048 KB
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;Not bad&lt;/p&gt;</description>
  </item>
  <item>
    <title>SVMOP:VSTP: It has some smarts.</title>
    <pubDate>Fri, 21 Dec 2007 11:39:00 EDT</pubDate>
    <link>http://www.maperl.com/cgi-local/journal/2007/12/21#VSTP-071221intell</link>
    <description>
&lt;p&gt;I have added data types to input specs so that I can
do expression evaluation specs for the output. In other words,
instead of just making a reference in the output value to an input field (e.g. &quot;lat&quot;),
you can have an expression that evaluates (e.g. &quot;lat / 100&quot; &quot;( hour * 60 * 60 ) + ( min * 60 ) 
&lt;ul&gt;
&lt;li&gt;sec&quot; ). Notice that all tokens must be delimited by white space for this to work.&lt;/p&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;The project sits at https://cowfish/projects/bendev/ShipTracking&lt;/p&gt;</description>
  </item>
  </channel>
</rss>