<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>myGrid developer blog</title>
	<atom:link href="http://www.mygrid.org.uk/dev/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mygrid.org.uk/dev/blog</link>
	<description>The developers of myGrid tell of their quest of the code</description>
	<pubDate>Mon, 15 Feb 2010 15:53:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Getting data out of MySQL (and then back in)</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=29</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=29#comments</comments>
		<pubDate>Wed, 20 Jan 2010 10:59:32 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[database]]></category>

		<category><![CDATA[dump]]></category>

		<category><![CDATA[export]]></category>

		<category><![CDATA[import]]></category>

		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=29</guid>
		<description><![CDATA[There seems to be lots of ways to get your databases out of a MySQL database and an even more bewildering array of ways to get it back in.  I have found that the following commands seem to be the best way to do it (for me):
Out
mysqldump &#8211;databases database_name -u username -p &#62; dumpfile.sql
In
mysql -u [...]]]></description>
			<content:encoded><![CDATA[<p>There seems to be lots of ways to get your databases out of a MySQL database and an even more bewildering array of ways to get it back in.  I have found that the following commands seem to be the best way to do it (for me):</p>
<p>Out</p>
<p>mysqldump &#8211;databases <em>database_name</em> -u <em>username</em> -p &gt; <em>dumpfile.sql</em></p>
<p>In</p>
<p>mysql -u <em>username</em> -p <em>database_name</em> &lt; <em>dumpfile.sql</em></p>
<p>Find the reference <a title="MySQL database dump reference" href="http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html">here</a>.</p>
<p>15/02/10: Here is another variation on getting stuff out:</p>
<p>mysqldump <em>db_name</em> <em>table1</em> <em>table2</em> <em>table3</em> -u <em>usernam</em>e -p &gt; <em>dumpfile.sql</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=29</wfw:commentRss>
		</item>
		<item>
		<title>Zipfiles, CSV and UUIDs</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=28</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=28#comments</comments>
		<pubDate>Fri, 04 Dec 2009 10:28:27 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[csv]]></category>

		<category><![CDATA[parse]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[uuid]]></category>

		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=28</guid>
		<description><![CDATA[MethodBox currently uses a java servlet to create Comma Separated Value (CSV) files inside a zip file.  These are then sent back to the rails application on demand over http.  What we needed was a metadata file to go into the zip file explaining what the CSV files had in them.  It was easiest to [...]]]></description>
			<content:encoded><![CDATA[<p>MethodBox currently uses a java servlet to create Comma Separated Value (CSV) files inside a zip file.  These are then sent back to the rails application on demand over http.  What we needed was a metadata file to go into the zip file explaining what the CSV files had in them.  It was easiest to use the active records about the CSV columns to get the metadata.</p>
<p>For the zipfile manipulation thanks go to this <a href="http://www.superwick.com/archives/2007/06/14/generating-zip-file-archives-via-ruby-on-rails/">post</a> and the original <a href="http://rubyzip.sourceforge.net/">rubyzip</a> API.</p>
<p>So, first make the HTTP request:</p>
<p>http = Net::HTTP.new(&#8221;localhost&#8221;, 10000)<br />
http.read_timeout=6000<br />
response = http.get(&#8217;csvserver/download/+ filename)</p>
<p>#check that the request was OK<br />
if response.response.class == Net::HTTPOK</p>
<p>#check what the response contains</p>
<p>if response.content_type == &#8216;application/zip&#8217;</p>
<p>#make a new file to hold the zipped data</p>
<p>uuid = UUIDTools::UUID.random_create.to_s</p>
<p>#you might need to install the uuidtools gem</p>
<p>File.makedirs(RAILS_ROOT + &#8220;/&#8221; + &#8220;filestore&#8221; + &#8220;/&#8221; +filename)<br />
uf = File.open(RAILS_ROOT + &#8220;/&#8221; + &#8220;filestore&#8221; + &#8220;/&#8221; + filename  + &#8220;/&#8221; + uuid+ &#8220;.zip&#8221;,&#8221;w&#8221;)</p>
<p>#write the content in the response out to the zip file<br />
uf.write(response.body)<br />
uf.close</p>
<p>After this the metadata is created and written to a string called metadata which can then be added to the zip we just created from the http response.  This next line adds the metadata string to the zip inside a file called metadata.txt.</p>
<p>Zip::ZipFile.open(RAILS_ROOT + &#8220;/&#8221; + &#8220;filestore&#8221; + &#8220;/&#8221; + filename  + &#8220;/&#8221; + uuid+ &#8220;.zip&#8221;, Zip::ZipFile::CREATE) {|zip| zip.get_output_stream(&#8221;metadata.txt&#8221;) { |f| f.puts metadata}}</p>
<p>We can then send the completed file back to the requester</p>
<p>send_file RAILS_ROOT + &#8220;/&#8221; + &#8220;filestore&#8221; + &#8220;/&#8221; + filename  + &#8220;/&#8221; + uuid+ &#8220;.zip&#8221;, :filename =&gt; &#8220;something&#8221; + &#8220;.zip&#8221;, :content_type =&gt; @archive.content_type, :disposition =&gt; &#8216;attachment&#8217;</p>
<p>I have also been looking at using Ruby to do all the CSV file creation but so far speed is proving to be an issue.  However, I found the following <a href="http://snippets.aktagon.com/snippets/246-How-to-parse-CSV-data-with-Ruby">link</a> which mentions several libraries.  I am now looking at using a combination of FasterCSV and <a href="http://raa.ruby-lang.org/project/csvscan/">CSVScan</a> (also available as a <a href="http://github.com/sandofsky/csvscan">gem</a>).  This enables me to write incredibly complex code like this (don&#8217;t you just love ruby&#8217;s blocks!):</p>
<p>CSVScan.scan(infile) { |row| line = FCSV.parse(row[0], :col_sep =&gt; &#8220;\t&#8221;); new_row = Array.new; if i==0: variable_hash[key].each {|var| pos.push(line[0].rindex(var))} end; i=i+1; pos.each {|col| val = line[0][col];new_row.push(val)}; csv_arr.push(new_row)}</p>
<p>Yeah, it scared me as well!!  It parses a CSV file for several headers and then pulls out the columns which correspond to these headers and adds them into an array.  In MethodBox these files can have 2000 header (ie columns) and 20000 rows so you can see why speed is important when only pulling out a subset of these.</p>
<p>We can then use FasterCSV to write out the new CSV file:</p>
<p>FasterCSV.open(outfile, &#8220;w&#8221;) do |csv_file| csv_arr.each {|csv| csv_file &lt;&lt; csv} end</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=28</wfw:commentRss>
		</item>
		<item>
		<title>More bits == better?  AKA Snow Leopard broke my Gems</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=27</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=27#comments</comments>
		<pubDate>Thu, 26 Nov 2009 15:54:16 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=27</guid>
		<description><![CDATA[Snow Leopard install went fine.  Running methodbox after this didn&#8217;t.  ImageMagick, libxml and mysql gems were all broken.  Followed this advice to get it all working.  Boils down to re-install MacPorts, install ImageMagick and libxml2 from ports, re-install the RMagick and libxml-ruby gems, install mysql-64bit, re-install mysql gem (in 64 bit mode).
Easy!!  Only took 2 [...]]]></description>
			<content:encoded><![CDATA[<p>Snow Leopard install went fine.  Running methodbox after this didn&#8217;t.  ImageMagick, libxml and mysql gems were all broken.  Followed this <a href="http://www.gregbenedict.com/2009/08/29/fixing-ruby-gems-mysql-and-passenger-phusion-on-snow-leopard-10-6/">advice </a>to get it all working.  Boils down to re-install MacPorts, install ImageMagick and libxml2 from ports, re-install the RMagick and libxml-ruby gems, install mysql-64bit, re-install mysql gem (in 64 bit mode).</p>
<p>Easy!!  Only took 2 hours.  So that&#8217;s about 4 hours (and 2GB+ downloads) for the snow leopard upgrade so far!</p>
<p>Also found this <a href="http://github.com/chdorner/magick-installer/blob/master/magick-installer.sh">script</a> for installing ImageMagick.  I couldn&#8217;t get it to work but maybe you can.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=27</wfw:commentRss>
		</item>
		<item>
		<title>There&#8217;s something good around the corner</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=26</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=26#comments</comments>
		<pubDate>Wed, 25 Nov 2009 11:13:06 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[corners]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=26</guid>
		<description><![CDATA[Up until now we have been using images to fake rounded edges on divs etc.  This is fine until you want to change the styling and resize anything.  So, I had a look at doing it in pure CSS.  Luckily, so have lots of other people eg. Nifty Corners and Spiffy Corners.  I used the [...]]]></description>
			<content:encoded><![CDATA[<p>Up until now we have been using images to fake rounded edges on divs etc.  This is fine until you want to change the styling and resize anything.  So, I had a look at doing it in pure CSS.  Luckily, so have lots of other people eg. <a href="http://pro.html.it/esempio/nifty/">Nifty Corners</a> and <a href="http://www.spiffycorners.com/">Spiffy Corners</a>.  I used the Spiffy Corners one since it comes with a nice code creator which saves lots of time and is easy to re-use.  All you have to do is enter in the class name for the CSS, colour of the bar and the background colour and it generates both the CSS and the html.  Job done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=26</wfw:commentRss>
		</item>
		<item>
		<title>Sorry for the delay - we&#8217;ve been on the rails</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=25</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=25#comments</comments>
		<pubDate>Thu, 19 Nov 2009 11:50:12 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=25</guid>
		<description><![CDATA[So it&#8217;s been a few months since the last post about adventures in flex.  The final verdict, quite nice but without more developer support the obesity-elab project was too big for one person.  So, we decided to go with the flow and follow the rails path like myExperiment and Sysmo.  This gave us a big [...]]]></description>
			<content:encoded><![CDATA[<p>So it&#8217;s been a few months since the last post about adventures in <a href="http://www.adobe.com/devnet/flex/">flex</a>.  The final verdict, quite nice but without more developer support the obesity-elab project was too big for one person.  So, we decided to go with the flow and follow the rails path like <a href="http://www.myexperiment.org">myExperiment</a> and <a href="http://seek.sysmo-db.org">Sysmo</a>.  This gave us a big codebase to play with.  We still needed some back end components to handle csv file parsing and creation so a <a href="http://www.mortbay.org/jetty/">jetty </a>based webapp was created using the <a href="http://ostermiller.org/utils/CSV.html">Ostermiller Utilities</a> for the CSV handling. We (well, me) also used <a href="http://lucene.apache.org/solr/">Apache solr</a> with the ruby <a href="http://github.com/railsfreaks/acts_as_solr">acts_as_solr</a> plugin for searching the metadata.</p>
<p>Writing complex apps in html is certainly an interesting challenge and after having created the first version of what we now call <a href="http://www.methodbox.org">methodbox</a> I can see why frameworks like <a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a> and flex are so appealing.  Having to insert hidden objects into the html so the application can remember them between clicks gets a bit tedious after a while! However, we overcame a few hurdles along the way and here are some things I found useful:</p>
<p><strong>Things I needed to know about Rails but was too much of a newby to find out from the books<br />
</strong></p>
<p>1. routes.rb.  How to specify routes correctly.  Part of the functionality of methodbox is selecting multiple surveys and searching them.  I couldn&#8217;t get the app to return to the correct route after doing the search. Of course, I had not specified the route correctly.  So, if you are returning a collection you need something like this:</p>
<p><em>map.resources:surveys, :member =&gt; {:download =&gt; :get}, :collection =&gt; {:add_to_pseudo_cart =&gt; :get,  :data =&gt; :get, :datagrid =&gt; :get,:hide_info =&gt; :get, :more_info =&gt; :get, :search_variables =&gt; :get,:sort_variables =&gt; :get }  do |survey|</em></p>
<p>2. Check box tag.  Use check_box_tag to allow you to select multiple objects in the page and send them across inside a hash to the controller.</p>
<p><em>&lt;%= check_box_tag &#8220;entry_ids[]&#8221;, item.id,false, :class=&gt;&#8217;survey_checkbox&#8217; %&gt;</em></p>
<p>where item is the object which you want to select or not, false means unchecked when created</p>
<p>3. Selecting, unselecting checkboxes programatically.  Lets say you want a gmail style select all, none (and an &#8216;invert&#8217; selection - ie. select those not selected and vice versa).  Use link to function and some javascript like this:</p>
<p><em>&lt;%= link_to_function &#8216;All&#8217;, &#8220;$$(&#8217;input.survey_checkbox&#8217;).each(function(checkbox) { checkbox.checked = true; });&#8221; %&gt;</em></p>
<p><em>&lt;%= link_to_function &#8216;None&#8217;, &#8220;$$(&#8217;input.survey_checkbox&#8217;).each(function(checkbox) { checkbox.checked = false; });&#8221; %&gt;</em></p>
<p><em>&lt;%= link_to_function &#8216;Invert selection&#8217;, &#8220;$$(&#8217;input.survey_checkbox&#8217;).each(function(checkbox) { if (checkbox.checked == true) {checkbox.checked = false;} else {checkbox.checked = true; } });&#8221; %&gt;</em></p>
<p>where &#8217;survey_checkbox&#8217; is the class name of the check_box_tag (see 2 above).</p>
<p>4. XML creation and parsing.  Tried the various libraries but found <a href="http://libxml.rubyforge.org/">libxml</a> the fastest.  I needed to parse some fairly big (1 meg+) xml files which contained the metadata for the surveys we are using.  These surveys take the form</p>
<pre id="line1">&lt;<span class="start-tag">metadata</span><span class="attribute-name"> year</span>=<span class="attribute-value">&#8220;2000&#8243;</span>&gt;
&lt;<span class="start-tag">variable</span>&gt;
&lt;<span class="start-tag">name</span>&gt;difbpc1&lt;/<span class="end-tag">name</span>&gt;
&lt;<span class="start-tag">description</span>&gt;BP Probs: No problems taking blood pressure&lt;/<span class="end-tag">description</span>&gt;
&lt;<span class="start-tag">information</span>&gt;
&lt;<span class="start-tag">info</span>&gt;
&lt;<span class="start-tag">Value</span>&gt;-9&lt;/<span class="end-tag">Value</span>&gt;
&lt;<span class="start-tag">Label</span>&gt;Refusal (8)&lt;/<span class="end-tag">Label</span>&gt;
&lt;/<span class="end-tag">info</span>&gt;&lt;<span class="start-tag">info</span>&gt;&lt;<span class="start-tag">Value</span>&gt;-8&lt;/<span class="end-tag">Value</span>&gt;
&lt;<span class="start-tag">Label</span>&gt;Don&#8217;t know (9)&lt;/<span class="end-tag">Label</span>&gt;
&lt;/<span class="end-tag">info</span>&gt;&lt;/<span class="end-tag">information</span>&gt;
&lt;<span class="start-tag">MissingValues</span>&gt;-99  thru -1&lt;/<span class="end-tag">MissingValues</span>&gt;
&lt;/<span class="end-tag">variable</span>&gt;
&#8230;.
&#8230;.
&lt;/metadata&gt;</pre>
<p>Here is some sample code to parse (some of) this using libxml (don&#8217;t forget your require &#8216;xml&#8217; bit):</p>
<p>parser = XML::Parser.file(&#8217;metadata.xml&#8217;)<br />
doc = parser.parse</p>
<p>nodes = doc.find(&#8217;//metadata/variable&#8217;)</p>
<p>nodes.each do |node|<br />
namenode = node.find(&#8217;child::name&#8217;)<br />
namecontent = namenode.first.content<br />
variable.name = namecontent</p>
<p>descnode = node.find(&#8217;child::description&#8217;)<br />
desccontent = descnode.first.content</p>
<p>catnode = node.find(&#8217;child::category&#8217;)<br />
catcontent = catnode.first.content</p>
<p>dernode = node.find(&#8217;child::derivation&#8217;)<br />
dercontent = dernode.first</p>
<p>dertype = dercontent.find(&#8217;child::type&#8217;)<br />
dertypecontent = dertype.first.content</p>
<p>dermethod = dercontent.find(&#8217;child::method&#8217;)<br />
dermethodcontent = dermethod.first.content</p>
<p>infonode = node.find(&#8217;child::information&#8217;)<br />
infocontent = infonode.first.content</p>
<p>end</p>
<p>5. <a href="http://www.gotapi.com/rubyrails">gotAPI</a>.  I used this online resource &#8216;a lot&#8217;.  A superb go to when the books are confusing or hard to navigate.</p>
<p>So, a few things which confused me and one major resource you really need.  See you on the Rails.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=25</wfw:commentRss>
		</item>
		<item>
		<title>Your FLEXible friend</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=22</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=22#comments</comments>
		<pubDate>Mon, 30 Mar 2009 16:18:35 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[adobe]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=22</guid>
		<description><![CDATA[For the last 3 months I have been using Adobe FLEX to develop a front end for the Obesity eLab.  Now, I don&#8217;t want to get into discussions about the rights and wrongs of RIAs etc. but just thought I would pass on a few interesting FLEX/Flash/Actionscript things I have found out during this coding [...]]]></description>
			<content:encoded><![CDATA[<p>For the last 3 months I have been using Adobe FLEX to develop a front end for the Obesity eLab.  Now, I don&#8217;t want to get into discussions about the rights and wrongs of RIAs etc. but just thought I would pass on a few interesting FLEX/Flash/Actionscript things I have found out during this coding voyage.</p>
<ul>
<li>Remember your <a title="Cross Domain policy for Flex" href="http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html">Cross Domain policy</a> or your client will not be able to talk to your server</li>
<li>When adding custom MXML modules programatically there is no guarantee that any of the components inside will exist.  Can lead to lots of annoying null pointer exceptions.  You might have to check that they are not null and create them in actionscript.  I have found that doing something with the parent module eg. adding to a tab navigator forced the child components into life.  Setting the creationPolicy to ALL seems to have no affect.  I look forward to finding out the correct way to do this because I have found little to help on the web.</li>
<li>When downloading files using FileReference you have to add an event listener to handle the IOErrorEvent.IO_ERROR or else you get a #2038 IO Error</li>
<li>To add an icon to a button that has been created in ActioScript you have to declare the icon you want to use like this:</li>
</ul>
<ol>
<li>[Embed(source=&#8217;/assets/analysis_small.png&#8217;)]<br />
[Bindable]<br />
private var analysisImage:Class;</li>
<li>Assign using code: analysisButton.setStyle(&#8221;icon&#8221;, analysisImage);</li>
</ol>
<ul>
<li>Events seem to pass from child to parent but not the other way.  When adding event listeners you need to add them to the level above the originator of the event.  Has meant all sorts of weird things like systemManager.addEventListener and Application.application.addEventListener.  Now, I might be getting this wrong but no amount of googling has led to a sensible answer.</li>
</ul>
<p>Overall, FLEX seems great for UIs which are not reacting to data changes but needs a bit of tweeking by Adobe to make it a real power users language of choice.  Doing things like grids which react to check box clicks needs quite a bit of code.  There also seems to be some fundamental UI components missing eg. dockable drag and drop panels.  Sure, there is usually some open source solution available or you can write your own but it would be nice if the core API had these things.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=22</wfw:commentRss>
		</item>
		<item>
		<title>Statistically speaking</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=21</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=21#comments</comments>
		<pubDate>Mon, 05 Jan 2009 14:49:08 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=21</guid>
		<description><![CDATA[We have been investigating data requirements for the Obesity e-Lab project recently.  This required some analysis of data created by the stata stats package.  However, we had to read it using the R tool instead (firstly because we can then use Taverna workflows to execute R scripts and secondly because Stata is not free).  After [...]]]></description>
			<content:encoded><![CDATA[<p>We have been investigating data requirements for the Obesity e-Lab project recently.  This required some analysis of data created by the <a title="Stata statistics analysis package" href="http://www.stata.com/">stata</a> stats package.  However, we had to read it using the <a title="R statistical package" href="http://www.r-project.org/">R</a> tool instead (firstly because we can then use <a title="Taverna workflow engine" href="http://www.mygrid.org.uk/tools/taverna/">Taverna</a> workflows to execute R scripts and secondly because Stata is not free).  After some head scratching we figured out that you had to use the &#8216;foreign&#8217; library and the read.dta function.  This mean turning on the foreign library in the Package Manager using the R gui first and then executing the following command:</p>
<p>read.dta(&#8221;filename&#8221;, convert.dates = TRUE, tz = NULL, convert.factors = TRUE, missing.type = FALSE, convert.underscore=TRUE, warn.missing.labels=TRUE)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=21</wfw:commentRss>
		</item>
		<item>
		<title>Remote control debugging</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=20</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=20#comments</comments>
		<pubDate>Thu, 04 Dec 2008 11:32:47 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[application]]></category>

		<category><![CDATA[debug]]></category>

		<category><![CDATA[eclipse]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[remote]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=20</guid>
		<description><![CDATA[If you are developing in java with eclipse then add this to the start up script of any apps you are developing  -Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=8993
You can then connect to them remotely using the Remote Java Application debug configuration in eclipse.  You can then use the eclipse debugger to step through any tricky code.
The application will start [...]]]></description>
			<content:encoded><![CDATA[<p>If you are developing in java with eclipse then add this to the start up script of any apps you are developing  -Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=8993</p>
<p>You can then connect to them remotely using the Remote Java Application debug configuration in eclipse.  You can then use the eclipse debugger to step through any tricky code.</p>
<p>The application will start with &#8220;Listening for transport dt_socket at address: 8993&#8243; and you connect to it through this port. Inside eclipse you can add any jars, local projects etc. to the debugger as it steps into new classes and you can then view the code (and the application) as it runs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=20</wfw:commentRss>
		</item>
		<item>
		<title>Hellllloooooooo, where are you RESTLet</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=19</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=19#comments</comments>
		<pubDate>Thu, 14 Aug 2008 12:56:41 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=19</guid>
		<description><![CDATA[We are currently developing a little REST based service for the storage of RDF.  It uses openAnzo (2.5.1) and Restlet (1.0.5).  All was going well until the client calls disappeared into a black hole.  No responses were coming back from the server, in fact nothing seemed to be arriving there.  Turns out that when you [...]]]></description>
			<content:encoded><![CDATA[<p>We are currently developing a little REST based service for the storage of RDF.  It uses <a title="Open Anzo RDF store" href="http://www.openanzo.org" target="_blank">openAnzo</a> (2.5.1) and <a title="RESTFul services for Java" href="http://www.restlet.org" target="_blank">Restlet (1.0.5)</a>.  All was going well until the client calls disappeared into a black hole.  No responses were coming back from the server, in fact nothing seemed to be arriving there.  Turns out that when you get a Response back from Restlet it has a stream which it would like you to either read or close, for example:</p>
<p>response.getEntity().getStream().close();</p>
<p>or</p>
<p>response.getEntity().write(System.out);</p>
<p>Otherwise the client keeps trying to send to the server but can&#8217;t get an open socket to get there.  Another problem solved!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=19</wfw:commentRss>
		</item>
		<item>
		<title>Cross platform fun</title>
		<link>http://www.mygrid.org.uk/dev/blog/?p=18</link>
		<comments>http://www.mygrid.org.uk/dev/blog/?p=18#comments</comments>
		<pubDate>Thu, 07 Aug 2008 12:15:30 +0000</pubDate>
		<dc:creator>Ian Dunlop</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[absolute path]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[line break]]></category>

		<category><![CDATA[osx]]></category>

		<category><![CDATA[separator]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.mygrid.org.uk/dev/blog/?p=18</guid>
		<description><![CDATA[While debugging some test problems with the T2 code I discovered some issues between OSX and Windows regards file paths and line breaks.  Seems that instead of just
inputs.put(&#8221;fileUrl&#8221;, LocalworkerTranslator.class.getResource( &#8220;/AAC4_HUMAN.sp&#8221;).getFile());
you have to ensure that the absolute path is correct by doing
URI uri = LocalworkerTranslator.class.getResource(&#8221;/AAC4_HUMAN.sp&#8221;) .toURI();
File newFile = new File(uri);
inputs.put(&#8221;fileUrl&#8221;, newFile.getAbsolutePath());
Also, you can&#8217;t expect checks for [...]]]></description>
			<content:encoded><![CDATA[<p>While debugging some test problems with the T2 code I discovered some issues between OSX and Windows regards file paths and line breaks.  Seems that instead of just</p>
<p>inputs.put(&#8221;fileUrl&#8221;, LocalworkerTranslator.class.getResource( &#8220;/AAC4_HUMAN.sp&#8221;).getFile());</p>
<p>you have to ensure that the absolute path is correct by doing</p>
<p>URI uri = LocalworkerTranslator.class.getResource(&#8221;/AAC4_HUMAN.sp&#8221;) .toURI();</p>
<p>File newFile = new File(uri);</p>
<p>inputs.put(&#8221;fileUrl&#8221;, newFile.getAbsolutePath());</p>
<p>Also, you can&#8217;t expect checks for &#8220;\n&#8221; style line breaks to work in Windows because they insert things like &#8220;\r\n&#8221; instead.  So , you should use System.getProperty(&#8221;line.separator&#8221;) instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mygrid.org.uk/dev/blog/?feed=rss2&amp;p=18</wfw:commentRss>
		</item>
	</channel>
</rss>
