tag:blogger.com,1999:blog-41467513349004053262024-03-14T00:00:34.341-07:00confessions of a cyberhobodmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-4146751334900405326.post-906952997813909712010-09-19T03:18:00.000-07:002010-09-19T03:20:49.327-07:00easy install node js.if you've got your ear to to ground you'll know that the thing all the web dev early adopters are raving about it node js.<br /><br />since yesterday, install it on ubuntu like this:<br /><pre><br />sudo add-apt-repository ppa:jerome-etienne/neoip<br />sudo apt-get update<br />sudo apt-get install nodejs<br /></pre><br /><br />do it!dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com0tag:blogger.com,1999:blog-4146751334900405326.post-14709190341214913442010-09-10T21:01:00.000-07:002010-09-10T21:13:20.977-07:00Run your ruby Gist on herokuGist is a great service on GitHub which serves up a copy-pasteable text boxes with full version control. <br /><br />It's useful for sharing snippets of code around... <br /><br />but what if you could run that code!<br /><br />well, now you can! with <a href="http://gist-runner.heroku.com">GistRunner</a> <br /><br />just enter the gist id into the field, or copy-paste the url of the gist.<br /><br />it'll download your gist and execute it on server!<br /><br />insane? maybe.<br /><br />it's pretty alpha, (wrote it all yesterday) so there is lots of room for improvement,<br /><br />but when you just want to convince your friends that we should all go to base 12, by wipping up a quick base 12 times table.... you can! <br /><br /><a href="http://gist-runner.heroku.com/gist?gist_id=573462">base12 times table</a><br /><br /><a href="http://gist.github.com/573462">base12 gist</a>dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com0tag:blogger.com,1999:blog-4146751334900405326.post-47332103955154951282010-09-09T02:21:00.001-07:002010-09-09T02:35:28.101-07:00sneak a custom gem into herokutoday, I've been trying to get <a href="http://github.com/mneumann/wee">Wee</a> running on heroku.<br /><br />I have a <a href="http://github.com/dominictarr/wee">custom version</a> of the gem, and want to run it on heroku.<br /><br />i looked down a few avenues, but decided they where all too complicated right now - I was having trouble getting something basic to work, if I tried something complex then that is just more stuff I will have to debug.<br /><br />so my plan was: load by custom gem as normal code in the local directoy<br /><code><br />> gem unpack wee<br /></code><br />then, add to my <code>config.ru</code>:<br /><br /><code>libdir = "wee-2.2.0/lib/"<br />$LOAD_PATH.unshift(libdir)<br /></code><br />now, when ever this is a line like require 'wee' it will look into the local <code>wee-2.2.0/lib/</code> and find <code>wee.rb</code> instead of loading from the gem directory.<br /><br />uploaded it to heroku and <a href="http://wee.heroku.com/">it worked!</a><br /><br />p.s. the rest of the <code>config.ru</code> looked like this:<br /><code><br />require 'continuations.rb'<br /><br />app = Wee::Application.new { Wee::Session.new(Page.instanciate, Wee::Session::ThreadSerializer.new) }<br />run app<br /></code>dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com1tag:blogger.com,1999:blog-4146751334900405326.post-18445778336417205402010-08-22T00:06:00.000-07:002010-08-22T00:45:44.978-07:00getting started with DataMapperI've just spent all day trying to get started with DataMapper<br /><br />I've found a few gotchas:<br /><br />say i have two model objects with a many to many relationship,<br />given two instances of those:<br />t = Thing.create<br />w = Whatever.create<br /><br />creating a joining resource:<br /><br />ThingWhatever.create(:thing => t, :whatever => w)<br /><br />[t] == w.things #true<br />[w] == t.whatevers #true<br /><br />#then create a second join resource from t to a new Whatever<br /><br />ThingWhatever.create(:thing => t, :whatever => (w2 = Whatever.create))<br /><br />[w,w2] == t.whatevers #false<br /><br />I'm new to DataMapper so this was very confusing.<br /><br />eventaully i discovered I could work around the problem with:<br /><br />t2.reload<br />[w,w2] == t.whatevers #true<br /><br />however, reload is not mentioned in the getting started documentation and it took me hours to figure out why it wasn't working.<br /><br />It's a bit of a leaky abstraction. you can see the database through the cracks.<br /><br /><a href="http://datamapper.lighthouseapp.com/projects/20609/tickets/1392-local-view-objects-dont-update-when-creating-joining-resources#ticket-1392-1">posted a ticket</a><br /><br />I considered trying ActiveRecord but it smelled even leakier.dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com1tag:blogger.com,1999:blog-4146751334900405326.post-89650045789927272062010-07-12T04:27:00.000-07:002010-07-12T06:23:36.679-07:00instance_eval weirdness in rubyI've been doing a lot of meta-programming in ruby recently, and ruby people are always saying eval is dangerious, or that using it is a sign you don't know what you are doing... but when someone questions them they can't give a straight answer...<div><br /></div><div>well, I just found one but <a href="http://perl.plover.com/varvarname.html">it's about perl</a> (and <a href="http://perl.plover.com/varvarname2.html">page two</a>, which is more direct)</div><div><br /></div><div>the link refers specifically to storing the name of a variable in a variable, the problem being that it can create collisions.</div><div><br /></div><div>in perl: </div><div>$value refers to the value of the variable 'value'</div><div>$$value refers to the value of the variable that is <i>named</i> 'value'.</div><div><br /></div><div>basically anything could end up in the variable, and if you change the value of that named variable you could change something important. particularity if it's an important variable that's core to the language like $0 or __FILE__. It sounds like this is a lot more dangerous in Perl, because variables <i>are global by default. </i>to define a local variable you have to say 'my $value'<blockquote></blockquote></div><div><i>no wonder perl people are against variable names stored in variables.</i></div><div><i><br /></i></div><div>basically, it's about scope. ruby doesn't have this <i>insane </i>global variable by default feature.</div><div><br /></div><div>but either way, if you only doing something boring like dynamicially deciding which variable your interested in, you can use hashes.</div><div><br /></div><div>lets use eval for cool stuff! </div><div><br /></div><div>like making some code in one place and calling it in other contexts, </div><div><br /></div><div>or allowing users to run arbitrary code on your web server!</div><div><br /></div><div>but seriously,</div><div><br /></div><div>you can still run into name collision problems. one I've just discovered (and fixed) today is as follows.</div><div><br /></div><div>say you want to define some code and run it in another context:</div><div><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div><div></div></div><blockquote><div><div><div><div><span class="Apple-style-span" style="font-family:'courier new';">class Context</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">attr_accessor :one,:two</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">end</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div><span class="Apple-style-span" style="font-family:'courier new';">def add (a,b)</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">puts "#{a} + #{b} = #{a+b}"</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">end</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div><span class="Apple-style-span" style="font-family:'courier new';">def context_a(l,code)</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">puts "context_a"</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">l.instance_eval(code)</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">end</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">def context_b(l,code)</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">puts "context_b"</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">one = 11</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">two = 22</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">l.instance_eval(code)</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">end</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">def context_c(l,code)</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">puts "context_c.1"</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">begin</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">l.instance_eval(code)</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">rescue Exception => e</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">puts e.message</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">end</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">puts "context_c.2"</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">one = 101</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">two = 202</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">l.instance_eval(code)</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">end</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">l = Context.new</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">l.one = 1</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">l.two = 2</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"> </span><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">code = "add one,two"</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">context_a(l,code)</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">context_b(l,code)</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">context_c(l,code)</span></div></div></div></div><div><br /></div><div></div></blockquote><div>so what will happen? </div><div>the <span class="Apple-style-span" style="font-family:'courier new';">eval</span> will call add and interpret the meaning of <span class="Apple-style-span" style="font-family:'courier new';">one</span> and <span class="Apple-style-span" style="font-family:'courier new';">two</span> from the context of the instance of <span class="Apple-style-span" style="font-family:'courier new';">Context</span> stored in <span class="Apple-style-span" style="font-family:'courier new';">l</span>, right?</div><div><br /></div><div>well... not quite. All that <span class="Apple-style-span" style="font-family:'courier new';">eval_instance</span> does is change the value of '<span class="Apple-style-span" style="font-family:'courier new';">self</span>' while it evaluates the code string. The variables in the local context are still visible, as if the current function was now inside the receiver of <span class="Apple-style-span" style="font-family:'courier new';">instance_eval</span>.</div><div><br /></div><div>here is the output:</div><div><br /></div><div><div></div><blockquote><div><span class="Apple-style-span" style="font-family:'courier new';">context_a</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">1 + 2 = 3</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">context_b</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">11 + 22 = 33</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">context_c.1</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">undefined method `+' for nil:NilClass</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">context_c.2</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">101 + 202 = 303</span></div></blockquote><div></div></div><div>Whats happening is the methods of <span class="Apple-style-span" style="font-family:'courier new';">Context</span> declared in each function are over written by the local variables in <span class="Apple-style-span" style="font-family:'courier new';">context_b</span> and <span class="Apple-style-span" style="font-family:'courier new';">context_c. context_c </span><span class="Apple-style-span" style="font-family:georgia;">is even more interesting, because here the local variable haven't even been initialized yet. however they already are already assigned </span><span class="Apple-style-span" style="font-family:'courier new';">nil</span><span class="Apple-style-span" style="font-family:georgia;"> at the start of the method!</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div><span class="Apple-style-span" style="font-family:georgia;"><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:georgia;">if you don't know what is in the code you will be evaluating is yet, or then potentially anything could come through and it might collide, producing unexpected errors which will be difficult to diagnose. </span></div><div><span class="Apple-style-span" style="font-family:georgia;"><br /></span></div><div><span class="Apple-style-span" style="font-family:georgia;">However, this problem is easily avoided.</span></div><div><span class="Apple-style-span" style="font-family:georgia;"><br /></span></div><div><span class="Apple-style-span" style="font-family:georgia;">o get a clean call of instance_eval you must call it from a function with a clean local context. </span></div><div><span class="Apple-style-span" style="font-family:georgia;">for example, adding the following function to Context and calling that instead will fix the problem.</span></div><div><span class="Apple-style-span" style="font-family:georgia;"></span></div><blockquote><div><span class="Apple-style-span" style="font-family:'courier new';">def clean_instance_eval(code)</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="white-space: pre;"> </span>eval code</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">end</span></div><div></div></blockquote><div><span class="Apple-style-span" style="font-family:georgia;">you could monkeypatch instance_eval, but then there might be some bit of code which depended on the weird behaviour of eval, and that monkeypatch is no longer bug compatible!</span></div><div><span class="Apple-style-span" style="font-family:georgia;"><br /></span></div><div><span class="Apple-style-span" style="font-family:georgia;">also note that a variable/method named 'code' within </span><span class="Apple-style-span" style="font-family:'courier new';">code</span><span class="Apple-style-span" style="font-family:georgia;"> will collide with the context of</span><span class="Apple-style-span" style="font-family:'courier new';"> clean_instance_eval</span><span class="Apple-style-span" style="font-family:georgia;">. you could parse code and escape any occurences of code with, but it is much more convienent to just name the code variable to something highly unlikely to be used as a variable for example append a magic number: </span><span class="Apple-style-span" style="font-family:'courier new';">code_324792523532</span><span class="Apple-style-span" style="font-family:georgia;"> or </span><span class="Apple-style-span" style="font-family:'courier new';">do_not_name_variable_this</span><span class="Apple-style-span" style="font-family:georgia;">. </span></div><div><span class="Apple-style-span" style="font-family:georgia;"><br /></span></div><div><span class="Apple-style-span" style="font-family:georgia;">Anyone naming a variable </span><span class="Apple-style-span" style=" ;font-family:'courier new';">do_not_name_variable_this </span><span class="Apple-style-span" style="font-family:georgia;">is looking for trouble, so they deserve it!</span></div><div><span class="Apple-style-span" style="font-family:georgia;"><br /></span></div><div><span class="Apple-style-span" style="font-family:georgia;"><br /></span></div>dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com0tag:blogger.com,1999:blog-4146751334900405326.post-6336081888839509132009-06-30T18:27:00.000-07:002009-06-30T18:50:15.093-07:00MakerSpace<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_QLvGmmWCOMY/Skq7zC_8p8I/AAAAAAAAAJU/5FuH5BJSeOM/s1600-h/grind-master.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_QLvGmmWCOMY/Skq7zC_8p8I/AAAAAAAAAJU/5FuH5BJSeOM/s320/grind-master.JPG" alt="" id="BLOGGER_PHOTO_ID_5353297592736065474" border="0" /></a><br />RRROOOOAAAARR!<br /><br />in this photo I am making a new chuck key for the <a href="http://makerspace.editkid.com/">MakerSpace</a> <a href="http://makerspace.org.nz/index.php?title=Lathe">lathe</a>. the MakerSpace is a communal workshop we've started in downtown wellington. It's been described to back me as play school for adults. which is a great idea.<br /><br />now that we are adults we can eat ice creme for dinner and stay up as late as we like.<br /><br />I remember when I was a child I imagined that when I was grown up, I'd like to have a big house and have a whole room dedicated entirely to Lego.<br /><br />I didn't think that my house would be a tent in the wellington town belt, but since I've got a room full of (grown up) lego I feel like I'm more or less exactly where I always wanted to be.<br /><br />plus, there are some big upsides to living in a tent.dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com0tag:blogger.com,1999:blog-4146751334900405326.post-16940623260524259692009-06-18T16:36:00.000-07:002009-06-18T17:07:32.716-07:00Ive been exploring the internet these last two days, and i've found some pretty weird stuff.<br /><br />the <a href="http://bootstrap.quebecblogue.com">first thing</a> was a stumbled upon something which had copy-pasted my blog through a english-french translator. I was searching for 'confessions of a cyber-hobo' and it got that before this site, (although returns this site now) they have discarded all but the title on the actual page now, but here is a copy-paste from the google cache:<br /><blockquote></blockquote><blockquote> <h2><a href="http://bootstrap.quebecblogue.com/2009/06/15/confessions-of-a-cyberhobo-grails-day-1-in-some-measure-2/" rel="bookmark" title="Lien permanent vers confessions of a cyberhobo: grails Day 1 in some measure 2"><b style="color: black; background-color: rgb(255, 255, 102);">confessions</b> of a <b style="color: black; background-color: rgb(160, 255, 255);">cyberhobo</b>: grails Day 1 in some measure 2</a></h2> <small>15 juin 2009 <!-- par bootstrap --></small> <p>Class Trip {String fictitious. Airline airline}class Airline{ plague constraints = { } String denominate String url String frequentFlyer String notes plague hasMany = [trip:Trip] }and all the other shove upstanding as the tutorial requires. I start up grails and glance at to localhost:8080/trip-planner/I discover an offload catalogue of trips, including the brand-new Airline area. thats uncommon. so I click on ‘create new’ and arise:Error 500: Error processing GroovyPageView: Error executing drag along with by: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating pathos [tripInstance?.airline?.id] on tactics [34]:<br /> </p> <p>...</p> <p>why doesn’t discern the characteristic airline? looking at the stockpile beaten path is unjaundiced more horrendous: by belittling by org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException</p> <p>...</p> <p>when you arise an slip-up you don’t know the sooner up is alway sample all the undeniable things and upon it goes away. 3 more this is an outrageously criptic slip-up.</p> </blockquote>What is the deal with this? it's done with wordpress and all about pages, etc and left on the default french-canadian settings. is this some sort of link farming opperation? there are no links back to the original articles.<br /><br />maybe they are duplicating blogs which link to them, plus a smoke screen of other blogs, so it doesn't look too suspucious? you could detect this, by crawling the page for links and seeing where they all point.<br /><br />also, i've found an exciting new keyword: <a href="http://en.wikipedia.org/wiki/Bootstrapping">bootstrapping</a>. this is an old term for a impossible task ("pull your self up by your bootstraps"), a less old computer term, and a new marketing term.<br /><br />it's bootstrap marketting which is the new term for me. do a google search, there are millions of people talking about "bootstrapping"<br /><br />back to the first bootstrap website <a href="http://bootstrap.quebecblogue.com">http://bootstrap.quebecblogue.com </a>who made it and what is it's purpose? I'm not sure. the only generality I can see is that it's often articles about bootstrap marketing and other website optimisation stuff...dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com0tag:blogger.com,1999:blog-4146751334900405326.post-76189213400839649542009-06-17T05:47:00.001-07:002009-06-17T07:17:45.037-07:00SmartSketch is crazy.I have a friend who says Flash used to be really, good and you would do anything with it... he could endlessly sing it's phrases, he isn't a java programmer, so i don't take him too seriously*, but anyway, I was reading about <a href="http://en.wikipedia.org/wiki/Adobe_Flash">flash on wikipedia...</a><br /><br />*maybe this is an unfair prejedus?<br /><br />It describes the company which developed it, <a href="http://en.wikipedia.org/wiki/FutureWave_Software">FutureWave Software</a> (who later sold out to <a href="http://en.wikipedia.org/wiki/Macromedia">Macromedia</a>, who had already consumed <a href="http://en.wikipedia.org/wiki/Altsys">Altsys</a>, and went on to gobble up iBand Software, <a href="http://en.wikipedia.org/w/index.php?title=Andromedia_Corporation&action=edit&redlink=1" class="new" title="Andromedia Corporation (page does not exist)">Andromedia Corporation</a>, <a href="http://en.wikipedia.org/wiki/Allaire_Corporation" title="Allaire Corporation">Allaire</a>, <a href="http://www.macromedia.com/macromedia/presedia" class="external text" title="http://www.macromedia.com/macromedia/presedia" rel="nofollow">Presedia</a>, and <a href="http://web.archive.org/web/20040711031939/http://www.ehelp.com/" class="external text" title="http://web.archive.org/web/20040711031939/http://www.ehelp.com/" rel="nofollow">eHelp Corporation</a> before they where themselves brought out by <a href="http://www.adobe.com/" class="l" onmousedown="return clk(this.href,'','','res','1','')">Adobe</a>... who interestingly acquired it with a stock swap, instead of paying money. I wonder what they swapped it for?<br /><br />anyway. Flash grew out of a product made by <a href="http://en.wikipedia.org/wiki/FutureWave_Software">FutureWave Software</a> for called SmartSketch, which apparently " was designed to make creating computer graphics as simple as drawing on paper" I've been having a few ideas about how to make drawing on a computer more like drawing on paper myself, so i thought I'd check it out. there was no wikipedia link so I googled it and got <a href="http://www.intergraph.com/products/ppm/smartsketch/">this</a><br /><br />It didn't seem like quite the same thing but apparently "SmartSketch provides powerful features such as parametrics and relationships that enable execution of design changes quickly and efficiently. It automatically creates and maintains relationships between geometric elements, and supports parametric graphics"<br /><br />which sound interesting as well. I used a CAD program for the first time a little while ago, but it was very disappointing to see that if i edited something, interrelated parts of the drawing didn't also change in a sensible way... if I changed my mind I had to start over. SmartSketch sounds like it has a way around this, so I thought well, I'll give it a go.<br /><br />Looking for a evaluation download is discover that you can't down load it! but they will post it to you on a CD for free... I started to fill out the form, but then had to impulse to read the license agreement.<br /><br />hell. it scared me. not only was it written <span style="font-size:180%;"><span style="font-weight: bold;">ALL CAPITALS AND BOLD IN A VERY LARGE FONT</span></span>, but it was also said things like "The PP&M Product is designed to automatically terminate without notice on the expiration date delivered with the evaluation key. " and "Upon expiration or termination of the license herein granted, Evaluator shall return to PP&M all copies of the Product and any other data furnished by PP&M in connection herewith".<br /><br />I have to return the CD? yes, and also destroy any notes you have made.<br />"In addition, Evaluator shall return to PP&M or destroy all reports or evaluations of the Product."<br /><br />plus your not allowed to tell anyone else what you saw on the CD, even after the evaluation ends. if you do gangs of highly payed Intellectual Property Lawyers will rape you in a dark alley.<br /><br />all, that, and they still don't make any "REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE PRODUCT, WHETHER EXPRESS OR IMPLIED, REGARDING ITS USE OR PERFORMANCE AND MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE"<br /><br />also, I am obliged to tell them what I think of the product, otherwise they will terminate the license "At any time" and presumably I will have to return the CD immediately.<br /><br />by now i was intimidated enough to not want to try the software.<br /><br />this is the most intense, scary, license agreement I have ever seen.<br /><br />it's like the time I brought the <a href="http://www.amazon.com/Dianetics-Modern-Science-Mental-Health/dp/088404632X">dianetics book</a>* from the <span style="text-decoration: underline;">Scientologists</span>. the ones i met seemed like completely ordinary, nice people, but a few months later I received a letter giving me the option of a trial subscription to a Scientology magazine... but only if I signed an agreement on the form which said I would do nothing against the church of Scientology.<br /><br />which is kinda creepy. they have something to hide and maybe i'd rather they didn't know where I lived.<br /><br />same goes for PP&M<br /><br />dianetics by the way, has a few simple interesting ideas, but is fatally flawed by mostly being unreadably absurd.dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com0tag:blogger.com,1999:blog-4146751334900405326.post-56592919330774271612009-06-14T23:38:00.000-07:002009-06-15T22:00:10.780-07:00wordpress 1installing wordpress in 5 minutes.<br /><br />monday 18:38 PM<br /><br /><ol><li> Download and unzip the WordPress package, if you haven't already. (actually I've already done this - but it didn't take long! it was only 2 megabytes)</li><li> Create a database for WordPress on your web server, as well as a <a href="http://codex.wordpress.org/Glossary#MySQL" title="Glossary">MySQL</a> user who has all privileges for accessing and modifying it. </li></ol><blockquote style="font-family:arial;"><span style=";font-family:lucida grande;font-size:85%;" >>mysql -uroot -p<br /><br />Welcome to the MySQL monitor. Commands end with ; or \g.<br />Your MySQL connection id is 44<br />Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)<br /><br />mysql> create database musicarc;<br />mysql> connect musicarc<br />Connection id: 47<br />Current database: musicarc<br /><br />mysql> grant all on musicarc to musicarcuser;<br />Query OK, 0 rows affected (0.01 sec)<br /><br />it took a bit of fluffing around to figure that out.<br /></span></blockquote>monday 19:08<br /><br /> 3. Rename the <tt>wp-config-sample.php</tt> file to <tt>wp-config.php</tt>.<br /> 4. Open <tt>wp-config.php</tt> in your favorite <a href="http://codex.wordpress.org/Glossary#Text_editor" title="Glossary">text editor</a> and <a href="http://codex.wordpress.org/Installing_WordPress#Step_3:_Set_up_wp-config.php" title="">fill in your database details</a> as explained in <a href="http://codex.wordpress.org/Editing_wp-config.php" title="Editing wp-config.php">Editing wp-config.php</a> to generate and use your secret key password.<br /><br />right. easy...<br /><br />Place the WordPress files in the desired location on your web server: <ul><li> If you want to integrate WordPress into the root of your domain (e.g. <tt>http://example.com/</tt>), move or upload all contents of the unzipped WordPress directory (but excluding the directory itself) into the root directory of your web server. </li></ul>then I forget about the instructions and race ahead and browse to localhost/wordpress/<br /><br />and get "<span style="font-style: italic;">Your PHP installation appears to be missing the MySQL extension which is required by WordPress.</span>"<br /><br />monday 19:15<br /><br />I put this down for several hours while a <a href="http://makerspace.org.nz/index.php?title=MakerSpace">makerspace meeting conviens.<br /></a>you'll be hearing alot more aout this later.<br /><br />I pick it back up at about<br /><br />monday 22:30 ish<br /><br />then i see<br /> 6. Run the WordPress installation script by accessing <tt>wp-admin/install.php</tt> in your favorite web browser. <ul><li>If you installed WordPress in its own subdirectory called <tt>blog</tt>, for example, you should visit: <tt>http://example.com/blog/wp-admin/install.php</tt> </li></ul>ah... same error.<br /><br />googled the error, and found something refuring to php.ini which i couldn't find, so I searched for the error + ubuntu. was recomended<br /><blockquote>sudo apt-get install php5-mysql<br /></blockquote>then restart server<br /><blockquote>sudo apachectrl restart<br /></blockquote>now I have an informative looking error message nicely formatted in the browser, with even friendly sounding suggestions as to what might be the problem!<br /><br />monday 22:41<br /><br />something about the user not being able to connect to the database. I think it must be something wrong with my grant command. I changed the user to the root mysql user anyway... I promise I'll fix it later.<br /><br />thats gotten past that error and yay! it worked.<br /><br />monday 23:08<br /><br />it's only taken 1 hours.<br /><br />alright, see you tomorrow.<br /><blockquote></blockquote>dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com0tag:blogger.com,1999:blog-4146751334900405326.post-87477153717612545192009-06-14T23:29:00.000-07:002009-06-14T23:37:56.965-07:00Bamm!i was begining to feel like I'd never find any work - so this afternoon i phone I start phoning all the cafe's in the phone book and ask them if they needed dishwashers, or baristas, or anything. I got to the letter E before I got an interview. Also, the first person I rang turns out i went to high school with.<br /><br />I know, making coffee ain't exactly cyber. but sometimes a hobo's gotta do what a hobo's gotta do.<br /><br />then - this afternoon I check my email and discover that someone wants me to make them a website! fantastic. this is my important first freelance job.<br /><br />he wants me to use wordpress, and rewrite his content. a quick check on wordpress site claim that you could install it in 5 minutes.<br /><br />I hope that is true. lets see.dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com0tag:blogger.com,1999:blog-4146751334900405326.post-4607224260869828132009-06-14T16:41:00.001-07:002009-06-14T18:20:08.779-07:00grails Day 1 part 2... then I hit a brick wall.<br /><br />following the <a href="http://www.ibm.com/developerworks/java/library/j-grails02128/index.html?S_TACT=105AGX02&S_CMP=EDU">second Mastering Grails</a> tutorial, I create an class Trip which has a object Airline, and an Airline class:<br /><br /><blockquote>Class Trip {<br />String destination<br />...<br />Airline airline<br />}<br />class Airline{<br /> static constraints = {<br /> }<br /><br /> String name<br /> String url<br /> String frequentFlyer<br /> String notes<br /><br /> static hasMany = [trip:Trip]<br /> }</blockquote>and all the other stuff just as the tutorial requires...<br />I start up grails and browse to localhost:8080/trip-planner/<br />I see an empty table of trips, including the new Airline field. so I click on 'create new' and get:<br /><blockquote><strong>Error 500:</strong> Error processing GroovyPageView: Error executing tag <g:form>: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [tripInstance?.airline?.id] on line [34]: java.lang.NoSuchMethodException: Unknown property 'airline'<br /> <strong>Servlet:</strong> grails<br /> <strong>URI:</strong> /trip-planner2/grails/trip/create.dispatch<br /> <strong>Exception Message:</strong> Unknown property 'airline'<br /> <strong>Caused by:</strong> Error processing GroovyPageView: Error executing tag <g:form>: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [tripInstance?.airline?.id] on line [34]: java.lang.NoSuchMethodException: Unknown property 'airline'<br /> <strong>Class:</strong> /WEB-INF/grails-app/views/trip/create.gsp<br /> <strong>At Line:</strong> [-1]<br /> <strong>Code Snippet:</strong></g:form></g:form></blockquote>hmm. thats strange. why doesn't know the property airline? looking at the stack trace is even more scary: <blockquote><pre>org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: Error executing tag <g:form>: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [tripInstance?.airline?.id] on line [34]: java.lang.NoSuchMethodException: Unknown property 'airline'<br />at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.handleException(GroovyPageView.java:134)<br />at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.renderWithTemplateEngine(GroovyPageView.java:112)<br />at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.renderMergedOutputModel(GroovyPageView.java:86)<br />at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:257)<br />at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1183)<br />at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:294)<br />at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)<br />at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)<br />at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)<br />at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)<br />at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)<br /><...heaps more...><br />Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <g:form>: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [tripInstance?.airline?.id] on line [34]: java.lang.NoSuchMethodException: Unknown property 'airline'<br />at home_dominic_code_trip_planner2_grails_app_views_trip_create_gsp.run(home_dominic_code_trip_planner2_grails_app_views_trip_create_gsp:81)<br />Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [tripInstance?.airline?.id] on line [34]: java.lang.NoSuchMethodException: Unknown property 'airline'<br />... 1 more<br />Caused by: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [tripInstance?.airline?.id] on line [34]: java.lang.NoSuchMethodException: Unknown property 'airline'<br />at home_dominic_code_trip_planner2_grails_app_views_trip_create_gsp$_run_closure10.doCall(home_dominic_code_trip_planner2_grails_app_views_trip_create_gsp:45)<br />at home_dominic_code_trip_planner2_grails_app_views_trip_create_gsp$_run_closure10.doCall(home_dominic_code_trip_planner2_grails_app_views_trip_create_gsp)<br />... 1 more<br />Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoSuchMethodException: Unknown property 'airline'<br />... 3 more<br />Caused by: java.lang.NoSuchMethodException: Unknown property 'airline'<br />at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1122)<br />at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:686)<br />at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:715)<br />at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:290)<br />at org.apache.commons.beanutils.PropertyUtils$getProperty.call(Unknown Source)<br />at home_dominic_code_trip_planner2_grails_app_views_trip_create_gsp$_run_closure10_closure18.doCall(home_dominic_code_trip_planner2_grails_app_views_trip_create_gsp:45)<br />... 3 more</g:form></g:form></pre> </blockquote>this is an extremely criptic error. when you get an error you don't understand the first step is alway try all the obvious things and hope it goes away... restart the server, make sure you followed the instructions precisely, etc. but no luck.<br /><br />the next step is to try and localize the problem. when does it start to occur? what is the last normal thing happen? this case is complicated by the fact that it it's all made from several different technologies strapped together, and presented as a single object. this means it's difficult to delve into the depths of the thing.<br /><br />but I do manage to find a clue. grails Bootstrap class. it's called when the application is started, and I'd seen a tutorial use it to load example data into the database.<br /><br />what if I use it to create a trip with an Airline object? will it cause the same error?<br /><br />I add this code to the Bootstrap class:<br /><blockquote>class BootStrap {<br /><br /> def init = { servletContext -><br /> println "boot strapping!"<br /> Airline a = new Airline(name:"XYZ",url:"www.xyz.com");<br /> a.save()<br /> new Trip(name:"XYZ", airline: a).save() <br /> }<br /> def destroy = {<br /> }<br />}<br /></blockquote><br />it causes exactly the same error... but in a different place! and the bootstrap code runs fine, it runs as the application starts, but the error doesn't occur untill you try to view <span style="font-style: italic;">localhost:8080/trip-planner/trip/list</span> remember that the first error didn't occur until I tried to view <span style="font-style: italic;">localhost:8080/trip-planner/trip/create</span>. this is progress. when you have an error like this every inch is an achivement. and you just get it to budge what ever way you can untill you can beat it's secret out of it.<br /><br />what do I know about the problem? well I know that the code itself worked fine. in the bootstrap class I created an Airline and a trip and set the trip property on the Airline. it's just ordinary groovy code so of course it should work.<br /><br />just as I was writing this, it occured to me that I hadn't tested printing out the Trip.airline field untill I had done that I couldn't really be sure that it's working.<br /><br />so I wrote some code to do that and guess what? the error again!<br /><br />questions:<br />why am i able to set the property 'airline' but not print it?<br /><br />I had read that grails takes your Plain Old Java Objects ("POJOs") and added stuff to it like getter and setter functions, so that you don't have to. It looks a little like the problem might be in this area.<br /><br />now that I have a decent clue i'll make a <a href="http://stackoverflow.com/questions/994207/strange-unknown-property-error-in-grails">post on a forum somewhere</a>dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com0tag:blogger.com,1999:blog-4146751334900405326.post-75057528967975666892009-06-14T02:25:00.000-07:002009-06-14T03:02:01.855-07:00Grails Day 1I've been living like an itinerant for nearly 6 months now. I've really been enjoying it, but my funds are beginning to run dry.<br /><br />I was looking for work, half-arsedly because I neither want to take something too uninteresting nor make an on going commitment, when someone suggested freelancing programming work.<br /><br />so poking around elance.com to get a smell of what was going i saw it's largely websites...<br /><br />considering that I have mostly experience with java, and have recently been using groovy. decided to give grails a try...<br /><br />reading the various introductions I learn grails will magically configure itself, install as easily as opening an envelope, and provide me with massive gains in productivity by not tiring my fingers writing too much code...<br /><br />sounds fantastic.<br /><br />I set about installing it on my Asus eee runing <a href="http://www.geteasypeasy.com/">ubuntu eee</a>.<br /><br />I download the <a href="http://www.grails.org/Download">latest grails release</a> from grails.org and follow the <a href="http://grails.org/Installation">installation instructions.</a> this proceeds smoothly.<br /><br />then following the <a href="http://grails.org/Quick+Start">quickstart tutorial</a> I run into my first error. trying to run the >grails create-app<br /><br />immediately throws an error about 'JAVA_HOME' not being set correctly. this is a pretty nube error, one that had been a nucance to me for some time.<br /><br />of course I had a line setting java home in my .profile:<br /><br />JAVA_HOME=~/java/jdk1.6.0_13/<br /><br />but, it didn't seem to work. it worked when I ran the above expression from the command line, but not when the line was inside a script. <span style="font-style: italic;">unless I ran it with the command :</span><br /><br />>. setjavahome.sh<span style="font-style: italic;"><br /></span><br />>sh setjavahome.sh<span style="font-style: italic;"><br /></span>did nothing.<br /><br />when you run a script with "sh" or "bash" it is as if it creates a new terminal and runs it in that. if you run it with "." it is as if it runs it in the current terminal.<br /><br />later I realise that the problem is I need to use the command "export".<br /><br />export JAVA_HOME=~/java/jdk1.6.0_13/<br /><br />thats the first thing I learned today.<br /><br />after that workaround I get through the <a href="https://www.ibm.com/developerworks/java/library/j-grails01158/">first Mastering Grails</a> tutorial easily.<br /><br />I am beginning to get excited about having full control of the awesome power of grails when I hit a brick wall...dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com0tag:blogger.com,1999:blog-4146751334900405326.post-76890121103512539022009-06-14T02:15:00.000-07:002009-06-14T02:25:22.946-07:00Hello, Worldit's a tradition in computer programming, the first program you show a student how to write will output the text "Hello, World"<br /><br />it's like playing chopsticks on paino.<br /><br />this is the first post on my first blog...<br /><br />I've started because of a mounting frustration installing and settingup a web development tool called Grails - more on that next post.<br /><br />I decided to start a blog because I know that this particular problem I'm tackling is too cryptic to just post on a forum. And this will create both a better resource than a forum thread, but also, committing to writing it will force me to think out the problem in a more effective way.<br /><br />as well as being a platform for my ruminations about life, and stories of my various adventures which are both quite fascinating!<br /><br />so: Hello, World. and get the fuck out of my way!dmt10http://www.blogger.com/profile/09824949527326430525noreply@blogger.com0