<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>David's Computer Stuff Journal: Tag hecl</title>
    <link>http://journal.dedasys.com/articles/tag/hecl</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Hecl Syntax: A Survey</title>
      <description>&lt;p&gt;[ Taken and modified from a post to the hecl-devel mailing list ]&lt;/p&gt;

&lt;p&gt;I've been talking with a company about a consulting job regarding a programming language for mobile apps. Sounds familiar, right?&lt;/p&gt;

&lt;p&gt;There is, however, a bit of discussion regarding the syntax - my contact at said company maintains that &lt;a href="http://www.hecl.org"&gt;Hecl&lt;/a&gt;'s syntax is unfamiliar to many programmers, and I think on the face of it, I'd have to agree.  Of course, Hecl's syntax is like it is because when I started the project, being &lt;em&gt;very small&lt;/em&gt; was a necessity, and a very simple syntax facilitated that goal nicely.  Additionally, the syntax allows for extreme flexibility, letting you create new control commands, and "DSL's" (domain specific languages) easily.  Also, sticking with small/simple means that the interpreter and parser can both reside on the phone, instead of doing some kind of solution where the development/host computer compiles the scripting language to byte code, and the interpreter on the phone runs the byte code.  That sort of strategy has some advantages, but has disadvantages too: if you don't have an on-board parser, you don't get "eval".&lt;/p&gt;

&lt;hr/&gt;

&lt;h4&gt;A quick Hecl syntax refresher:&lt;/h4&gt;

&lt;p&gt;In Hecl, &lt;em&gt;everything&lt;/em&gt; is a command, seperated by spaces, and grouped with {}:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;if { ... } { ... }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Is a command that takes two arguments.  It evaluates the first one, and if it's true, evaluates the second one.  This is different from languages like C, Python or Ruby, where 'if' is part of the language.  For those unfamiliar with languages like Lisp, where this looks strangest is probably in conditions or other expressions:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;if { = $foo 10 } { puts "foo is ten" }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Or&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;set foo [+ [* $bar 10] [- $beebop $doowah]]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Which is certainly a different take on things than most 'mainstream' languages.  That radical simplification is, however, one of the ways that I used to save space in the interpreter.&lt;/p&gt;

&lt;hr/&gt;

&lt;p&gt;Personally, I'm pretty happy with how Hecl looks, but I am sensitive to the 'marketing' argument: popularity helps, and this isn't the first time I've heard complaints about Hecl looking "funny" to people.&lt;/p&gt;

&lt;p&gt;What do you think?&lt;/p&gt;

&lt;p&gt;A) "I like Hecl just the way it is and wouldn't want to change it!"&lt;/p&gt;

&lt;p&gt;B) "Hecl is quite useful, but I just want a mobile scripting language, the syntax doesn't matter much."&lt;/p&gt;

&lt;p&gt;C) "I think the syntax is ugly, but I use it because I need an interpreter."&lt;/p&gt;

&lt;p&gt;Also related:&lt;/p&gt;

&lt;p&gt;1) "I don't care too much about code size.  My current apps target &lt;strong&gt;N&lt;/strong&gt; kb as an acceptable size."&lt;/p&gt;

&lt;p&gt;2) "Small is really important.  The smaller the better."&lt;/p&gt;

&lt;p&gt;And:&lt;/p&gt;

&lt;p&gt;I) "I don't care about eval, or being able to run human readable code on the phone."&lt;/p&gt;

&lt;p&gt;II) "I really like the fact that you can download or even write code directly on the phone."&lt;/p&gt;

&lt;p&gt;And finally:&lt;/p&gt;

&lt;p&gt;X) "I don't care about midp1.0"&lt;/p&gt;

&lt;p&gt;Y) "The fact that Hecl runs on midp1.0/cldc1.0 is important to me."&lt;/p&gt;

&lt;p&gt;Now, I am &lt;em&gt;not&lt;/em&gt; going to run off and change Hecl!  Code that currently runs ought to continue to run, modulo some tweaks here and there, api changes, and the normal stuff.  If I do something 'new', it would probably be a clean break (although of course code that could be reused would be), and will be &lt;em&gt;in addition&lt;/em&gt; to Hecl, rather than instead of Hecl, because I would be working on the 'new' language as a day job.  I do that with Hecl too, but not all the time, as I often have consulting/contracting work.&lt;/p&gt;</description>
      <pubDate>Tue, 12 Aug 2008 11:59:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:c9c83924-2121-4530-8f24-854f27abddcd</guid>
      <author>David N. Welton</author>
      <link>http://journal.dedasys.com/articles/2008/08/12/hecl-syntax-a-survey</link>
      <category>hecl</category>
      <trackback:ping>http://journal.dedasys.com/articles/trackback/1888</trackback:ping>
    </item>
    <item>
      <title>New Hecl Release</title>
      <description>&lt;p&gt;I've added a new Hecl release to the sourceforge site:&lt;/p&gt;

&lt;p&gt;http://sourceforge.net/project/showfiles.php?group_id=122383&lt;/p&gt;

&lt;p&gt;Although, as always, you're probably better off checking it out of subversion.  We mainly do releases in order to focus on polishing things up just a bit, and as a way to promote Hecl by creating a reasonably stable release.&lt;/p&gt;

&lt;p&gt;Some of the things that we've got working pretty well for this release include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Google Android support.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Java reflection/integration - &lt;a href="http://journal.dedasys.com/articles/2007/12/05/hecl-java-integration"&gt;call Java directly from Hecl&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And of course a lot of numerous other little tweaks and fixes that crop up over time.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
      <pubDate>Thu, 31 Jul 2008 02:37:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:8d8ba6d0-ec70-4560-a329-495ba9b0102b</guid>
      <author>David N. Welton</author>
      <link>http://journal.dedasys.com/articles/2008/07/31/new-hecl-release</link>
      <category>hecl</category>
      <trackback:ping>http://journal.dedasys.com/articles/trackback/1884</trackback:ping>
    </item>
    <item>
      <title>An impressive amount of resources</title>
      <description>&lt;p&gt;In the &lt;a href="http://www.techcrunch.com/2008/05/28/live-from-google-io/"&gt;TechCrunch coverage&lt;/a&gt; of &lt;a href="http://code.google.com/events/io/"&gt;Google IO&lt;/a&gt;, I was impressed by this:&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;Not every team has the resources Google does to build for every platform. Google is betting on browser over time for mobile devices; it will be the entry point for many applications.&lt;/p&gt;
    
    &lt;p&gt;But today, the only browsers capable for supporting mobile apps include iPhone and few others. So Google is developing Android, which includes world class Webkit browser.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here at the world headquarters of DedaSys LLC (which for the time being happens to be "in front of David's computer, wherever that is"), we too have some suspicions about the browser becoming the platform of choice for mobile phones, although there is a big if: &lt;/p&gt;

&lt;p&gt;When will the carriers make always on, cheap internet connections widespread?&lt;/p&gt;

&lt;p&gt;Until that happens, client side apps will still probably dominate for many things.  And of course for applications requiring hardware access, some kind of local program will be necessary as well for the foreseeable future.  (And of course, &lt;a href="http://www.hecl.org"&gt;Hecl&lt;/a&gt; is a good choice "for the time being", too!)&lt;/p&gt;

&lt;p&gt;Coming back to the phrase cited above, what blows me away about it is the sheer amount of time and money that they're investing in something that "over time", they're not really betting on, in the sense that they just want browsers everywhere?  Jumping into a market with a new "OS", toolkit, etc... just to spread a platform with a decent browser?&lt;/p&gt;

&lt;p&gt;Wow.  That is a company with a lot of spare change.  Most people and companies in business are doing the best they can to stretch out their dollars or euros as best they can.  I guess it really takes a behemoth to pour so much in the way of engineering talent and financial resources into something that's in some ways a bump in the road in terms of their long term vision.  Or maybe I'm just reading too much into one phrase?&lt;/p&gt;</description>
      <pubDate>Fri, 30 May 2008 11:53:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:c4928e3a-6eeb-42b1-b19a-46f0e147bc86</guid>
      <author>David N. Welton</author>
      <link>http://journal.dedasys.com/articles/2008/05/30/an-impressive-amount-of-resources</link>
      <category>hecl</category>
      <category>mobile</category>
      <category>google</category>
      <trackback:ping>http://journal.dedasys.com/articles/trackback/1873</trackback:ping>
    </item>
    <item>
      <title>Neat Hecl app from newcomer</title>
      <description>&lt;p&gt;This is a cool little application, and a helpful tutorial for people trying Hecl for the first time.  Since I know the system so intimately, people doing these kinds of pages are always a helpful reality check, pointing out where people new to the language hit stumbling blocks, and providing a guide for people who haven't "been there and done that":&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lauri.ojansivu.googlepages.com/heclcommandlineapp"&gt;http://lauri.ojansivu.googlepages.com/heclcommandlineapp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks Lauri!&lt;/p&gt;</description>
      <pubDate>Fri, 16 May 2008 08:47:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:88e1b7f0-4127-41da-ba48-69d118729189</guid>
      <author>David N. Welton</author>
      <link>http://journal.dedasys.com/articles/2008/05/16/neat-hecl-app-from-newcomer</link>
      <category>hecl</category>
      <trackback:ping>http://journal.dedasys.com/articles/trackback/1870</trackback:ping>
    </item>
    <item>
      <title>Hypothetical Hecl</title>
      <description>&lt;p&gt;I did some 'playing' with &lt;a href="http://www.hecl.org"&gt;Hecl&lt;/a&gt; the other day, to see what it might look like if implemented in a slightly different way, and I thought I'd share what I was thinking about.  Keep in mind that&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;I haven't thought this through completely:-)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's not something I'm going to just rush out and do in the near future.  It's definitely a Hecl 2.0 sort of idea.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;My notion was to make use of the &lt;code&gt;ClassCommand&lt;/code&gt; feature to have at least simple types be hooked directly to the relevant Java types, and dealt with through methods, rather than commands.  For instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$i + 10
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;instead of&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;+ $i 10
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Where $i is, in the first case, a Java &lt;code&gt;Integer&lt;/code&gt;, rather than a Hecl type.&lt;/p&gt;

&lt;p&gt;What it would be doing internally is something like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;$i is recognized as the object to act on.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It's an &lt;code&gt;Integer&lt;/code&gt;, so the corresponding &lt;code&gt;ClassCommand&lt;/code&gt; is looked up and executed with &lt;code&gt;+&lt;/code&gt; and &lt;code&gt;10&lt;/code&gt; as arguments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The classcommand for Integer has a &lt;code&gt;+&lt;/code&gt; method that accepts an argument, in this case, 10, which is added to the value of &lt;code&gt;$i&lt;/code&gt;, and returned as a new &lt;code&gt;Integer&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Without a "real" (where real also means bloated, memory and space hungry) parser, Hecl is never going to have a C-like syntax - you still wouldn't be able to do &lt;code&gt;foo = 1 + 2 + 3&lt;/code&gt; -  but this just might make a significant amount of people more comfortable with Hecl, which would be a good thing.  You could do something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;set i 1

while { $i &amp;lt; 1000000 } {
    set i [$i + 1]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;instead of&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;set i 1

while { &amp;lt; $i 1000000 } {
    set i [+ $i 1]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I actually built a really simple HeclInteger class that implements &lt;code&gt;&amp;lt;&lt;/code&gt;
and &lt;code&gt;+&lt;/code&gt; as methods to Integer ObjectThings, in order to test out this idea, and it seems to run &lt;em&gt;about&lt;/em&gt; as fast as the regular Hecl version.&lt;/p&gt;

&lt;p&gt;I welcome any thoughts or comments on the idea.&lt;/p&gt;</description>
      <pubDate>Sun, 04 May 2008 01:54:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:d4287983-28fa-4a73-a388-fed07b4ba3c2</guid>
      <author>David N. Welton</author>
      <link>http://journal.dedasys.com/articles/2008/05/04/hypothetical-hecl</link>
      <category>hecl</category>
      <trackback:ping>http://journal.dedasys.com/articles/trackback/1866</trackback:ping>
    </item>
    <item>
      <title>XML handling for Hecl</title>
      <description>&lt;p&gt;We received an interesting contribution to &lt;a href="http://www.hecl.org"&gt;Hecl&lt;/a&gt; recently: Martin Mainusch put together a Hecl interface to &lt;a href="http://kxml.sourceforge.net/"&gt;kxml&lt;/a&gt;, and also sent in some demo code that fetches and parses weather forecast information.  I thought it was pretty cool:&lt;/p&gt;

&lt;p&gt;&lt;img src="/files/hecl_weather.png" alt="Hecl Weather Forecast"/&gt;&lt;/p&gt;

&lt;p&gt;Note that it's not compiled into the default build, so you have to change a property from 0 to 1 and recompile, and...being new there might be some issues, but still, it's nice to have that to let people play around with simple "web service" type things that use XML.  Of course, another strategy might be to have a 'proxy' server that fetches the actual XML, and returns a tagged Hecl list so that Hecl can parse it directly, but that requires a server and has more overhead.&lt;/p&gt;</description>
      <pubDate>Thu, 24 Apr 2008 11:35:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:eba94401-644a-4193-9692-02e9a26d9e6f</guid>
      <author>David N. Welton</author>
      <link>http://journal.dedasys.com/articles/2008/04/24/xml-handling-for-hecl</link>
      <category>hecl</category>
      <enclosure type="image/png" url="http://journal.dedasys.com/files/hecl_weather.png" length="76423"/>
      <trackback:ping>http://journal.dedasys.com/articles/trackback/1864</trackback:ping>
    </item>
    <item>
      <title>Hecl Jacta Est</title>
      <description>&lt;p&gt;I don't know if androids dream of electric sheep, but I've certainly been losing a lot of sleep over Google's Android, and am glad that the Android Developer Challenge is winding up, as I've been doing all Android, all the time for the past month or so.&lt;/p&gt;

&lt;p&gt;I have greatly enjoyed working with Android, as it's much more capable than Java ME.  It's still very much a work in progress, and only time will tell if Google and their partners are able to best current mobile programming systems... or if the web will simply obviate the whole thing, as it's doing in many other areas.  Win or lose, I will continue to support Android as a platform that &lt;a href="http://www.hecl.org"&gt;Hecl&lt;/a&gt; runs on, but in the meantime, I hope to go back and look at some less future-oriented code and get back to some Java ME work.  More on that soon...&lt;/p&gt;

&lt;p&gt;In any case, here's hoping that the contest judges see the value in bringing a scripting language to mobile phones!  I also hope to see actual hardware soon, as I'm really looking forward to getting my own Android phone.&lt;/p&gt;</description>
      <pubDate>Mon, 14 Apr 2008 07:35:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:cf024734-da37-44f9-a121-5496758fe649</guid>
      <author>David N. Welton</author>
      <link>http://journal.dedasys.com/articles/2008/04/14/hecl-jacta-est</link>
      <category>hecl</category>
      <category>android</category>
      <trackback:ping>http://journal.dedasys.com/articles/trackback/1861</trackback:ping>
    </item>
    <item>
      <title>Mass customization of Android applications</title>
      <description>&lt;p&gt;As I mentioned in an &lt;a href="http://journal.dedasys.com/articles/2008/03/09/bypassing-androids-resources"&gt;earlier article&lt;/a&gt;, one of the goals for the Android port of Hecl is to make it as easy as it is to create Java ME applications:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write the script.&lt;/li&gt;
&lt;li&gt;Wrap it up and send it to the phone.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;No "compiling" (well, none that's obvious or explicitly asked of the user, at least, as we'll see) or fiddling with build files or writing new Java classes or any of that.&lt;/p&gt;

&lt;p&gt;We're still not there yet 100%, but I did managed to hack together a system that, from an original &lt;code&gt;Hecl.apk&lt;/code&gt;, creates a new application that can be installed on the emulator.  This is tricky, because Android looks at the uniqueness of the package and class utilized for the application, meaning you can't just rename &lt;code&gt;Hecl.apk&lt;/code&gt; to &lt;code&gt;Foo.apk&lt;/code&gt; and install it as a separate app.  The emulator will overwrite your old copy of Hecl.&lt;/p&gt;

&lt;p&gt;Here's what we go through to make this work.  Be forewarned - big, ugly hacks that are not for the faint of heart follow.  The command line isn't exactly beautiful either, but it beats all the individual steps that it replaces, as we'll see.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;java -jar /home/davidw/workshop/hecl/jars/AndroidBuilder.jar -android \
    /opt/android-sdk_m5-rc15_linux-x86/ -class Example -label "Hecl Example" \
    -package my.example -permissions ACCESS_LOCATION,ACCESS_GPS
&lt;/code&gt;&lt;/pre&gt;

&lt;ol&gt;
&lt;li&gt;The first thing that needs to be done is to replace the &lt;code&gt;AndroidManifest.xml&lt;/code&gt; that is contained within our "template" application, that resides in &lt;code&gt;Hecl.apk&lt;/code&gt;, a copy of which is contained within the AndroidBuilder jar file.  Since the compiled version of the xml file is a binary format that hasn't been reverse engineered or documented yet, the best way to do this was to simply:&lt;/li&gt;
&lt;li&gt;Write out a new &lt;code&gt;AndroidManifest.xml&lt;/code&gt; in our temporary work directory that uses our provided package name, label and class.&lt;/li&gt;
&lt;li&gt;Using the &lt;code&gt;aapt&lt;/code&gt; command in the SDK, create a new, empty apk file, specifying the newly created xml file as the manifest file to use.&lt;/li&gt;
&lt;li&gt;Now we can extract the compiled version of the xml file, for later use.&lt;/li&gt;
&lt;li&gt;At this point, we extract a version of &lt;code&gt;Hecl.jar&lt;/code&gt; contained within &lt;code&gt;AndroidBuilder.jar&lt;/code&gt; to the temp directory.&lt;/li&gt;
&lt;li&gt;Now we need to generate some Java classes that correspond to the new package and class names that we've passed to AndroidBuilder.  Ideally, I would have done this with some tools to write the byte code out directly, since the classes are so simple: all they do is subclass the &lt;code&gt;Hecl&lt;/code&gt; and &lt;code&gt;SubHecl&lt;/code&gt; classes so that methods fall through to those.&lt;/li&gt;
&lt;li&gt;But instead, I just write out the .java code and compile it.&lt;/li&gt;
&lt;li&gt;The two new classes get stashed inside the copy of &lt;code&gt;Hecl.jar&lt;/code&gt; that we're working with.&lt;/li&gt;
&lt;li&gt;We now use the &lt;code&gt;dx&lt;/code&gt; command to compile the entire jar into the &lt;code&gt;classes.dex&lt;/code&gt; file that Android uses.&lt;/li&gt;
&lt;li&gt;Since &lt;code&gt;Hecl.apk&lt;/code&gt; is just a zip file, we can replace the &lt;code&gt;AndroidManifest.xml&lt;/code&gt; file and &lt;code&gt;classes.dex&lt;/code&gt; file with the new files we have created.&lt;/li&gt;
&lt;li&gt;At this point, we rename the whole works, and move it out of the temporary working directory to the current directory.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Phew!  That's a lot of ugly work.  It's obvious that a lot of this should and could be handled in a less "brute force" way, but for now it gets the job done.  The only thing left to do is replace the Hecl script, which is very easy:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;zip -r Example.apk res/raw/script.hcl
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This makes it possible to whip out new Android Hecl scripts without carrying around a lot of project infrastructure - all you really need is &lt;code&gt;AndroidBuilder.jar&lt;/code&gt; and your script.&lt;/p&gt;

&lt;p&gt;Naturally, all of this is very much a work in progress, so it may not work as advertised, and, given the mess that we go through, bugs are likely as well.  Do report them if you find any, and have fun!  In the future, it will be necessary to make it so that it's possible to add resources to the apk file with zip, and have them be available to Hecl applications, which was actually the focus of the previous article.&lt;/p&gt;</description>
      <pubDate>Tue, 11 Mar 2008 14:57:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:664e4f29-1c9c-4288-88e1-d74225e5266a</guid>
      <author>David N. Welton</author>
      <link>http://journal.dedasys.com/articles/2008/03/11/mass-customization-of-android-applications</link>
      <category>hecl</category>
      <category>android</category>
      <trackback:ping>http://journal.dedasys.com/articles/trackback/1857</trackback:ping>
    </item>
    <item>
      <title>Bypassing Android's &amp;quot;Resources&amp;quot;</title>
      <description>&lt;p&gt;Android relies heavily on something called "resources" to access portions of the system that aren't directly in the Java code.  For instance, if you had an ogg file that you wanted to use to play a sound with, you would add it as &lt;code&gt;res/raw/foo.ogg&lt;/code&gt;.  Then, during compilation, the &lt;code&gt;aapt&lt;/code&gt; tool transforms all your resources into a Java file called &lt;code&gt;R.java&lt;/code&gt;, which is basically a series of integers that can be used to reference the actual resources.  For instance, to set up our hypothetical ogg file, we would do:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;MediaPlayer mp = MediaPlayer.create(context, R.raw.foo);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's all well and good as far as it goes, and if you don't have any reason not to use it, you should.&lt;/p&gt;

&lt;p&gt;However, with &lt;a href="http://www.hecl.org"&gt;Hecl&lt;/a&gt;, one of my goals is to make it &lt;em&gt;very easy&lt;/em&gt; to create applications.  This means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;No complex directory layout structure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No big long build files that require tools like ant.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No complex compilation steps.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm not there yet, on the Android platform, which is a bit more complex than Java ME (where it is indeed so easy to create new Hecl .jars that it's possible to do it on the fly via this web site: &lt;a href="http://builder.hecl.org"&gt;http://builder.hecl.org&lt;/a&gt;), but I am making progress.&lt;/p&gt;

&lt;p&gt;One thing that a user might want to do is add their own files to the &lt;code&gt;.apk&lt;/code&gt; file that actually gets installed on the phone.  Since it's just a zip file, that's pretty easy:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;zip -r Hecl.apk res/raw/foo.ogg
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;However, without a resource, there is no way to access that file, so the question is: how  can we get ahold of it somehow?  &lt;/p&gt;

&lt;p&gt;The first piece of the puzzle is Java's &lt;code&gt;ZipFile&lt;/code&gt; class, which lets us open up a zip compressed file, such as the .apk file that contains the ogg file we're interested in in this case.&lt;/p&gt;

&lt;p&gt;The critical passage is getting ahold of the actual filename on the Android filesystem of the code that's currently running.  It turns out to not be too difficult, if a bit obscure:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;String filename = this.getPackageManager().getApplicationInfo(packagename, 0).sourceDir;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With that information in hand, we can feed it to ZipFile, and then access the contents at run time.&lt;/p&gt;

&lt;p&gt;It's not a perfect nor complete solution, yet. So many of the Android API's require a resource ID, so it takes some extra coding to do things from the &lt;code&gt;InputStream&lt;/code&gt; that we can get out of the zip file, but there may be ways to make this easier.  For instance, we could simply dump the contents of &lt;code&gt;raw/&lt;/code&gt; into an application specific data directory the first time an application runs, in order to at least be able to access the files as files, rather than InputStreams connected to ZipEntries.  In any case, at least it's possible to access files added to the .apk without requiring the compilation step.&lt;/p&gt;

&lt;p&gt;I'm not sure how many other use cases there might be for direct access to the &lt;code&gt;.apk&lt;/code&gt; file, but if other people need to do this, hopefully this information will be helpful.&lt;/p&gt;</description>
      <pubDate>Sun, 09 Mar 2008 03:47:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:979ba2ab-d00e-4749-a712-5feebeb1a649</guid>
      <author>David N. Welton</author>
      <link>http://journal.dedasys.com/articles/2008/03/09/bypassing-androids-resources</link>
      <category>hecl</category>
      <category>android</category>
      <trackback:ping>http://journal.dedasys.com/articles/trackback/1855</trackback:ping>
    </item>
    <item>
      <title>iPhone - nice, but not for me</title>
      <description>&lt;p&gt;Being fairly interested in this whole mobile phone software thing, it's pretty hard not to sit up and take notice of the iPhone SDK that was just announced.  A few thoughts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Of course it's nice, polished, and lets you do some interesting things with the phone.  That was not too surprising though.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The "investment fund" seems like something of a response to the &lt;a href="http://code.google.com/android/adc.html"&gt;Android Developer Challenge&lt;/a&gt;, and is certainly an interesting move on Apple's part.  Strategically, it certainly alters the focus of the money flowing into the equation.  Comparing the two, the dollar amounts in  the ADC are much smaller, but they are also more "concrete": N people will get X dollars in time frame T.  As an independent developer, that works fairly well for me as something to have a go at and then move on from, win or lose.  An investment fund backed by Kleiner Perkins is on a whole different scale and level.  The amount of money is huge (they won't even bother with less than 100K), but who knows how that works out in practice, or how much of that is actually 100% committed to iPhone companies.  KP aren't the sort of people that are going to just hand that out to any old company that does an iPhone app. They're also going to want to be involved in the companies, which means there won't be too many of them.  In short, it brings in all the good and bad aspects of venture capital.  In short: in one corner, lots of money for relatively big, organized players, and in the other, small, quick incentives to do cool things that anyone has a shot at.  We won't really be able to judge the results until we see how it plays out.  (As an aside, I still have some bad memories of the management that KP foisted off on &lt;a href="http://en.wikipedia.org/wiki/Linuxcare"&gt;Linuxcare&lt;/a&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The system for selling applications is smart.  You will have one place to go to to get your apps, and as a user you'll have some assurance that they're up to certain quality standards.  People will like that kind of thing, and is far nicer than anything JavaME ever had.  Instead of multiple, fractured marketplaces, you get one big one.  Of course, it also keeps Apple in control of everything, which also has some negative implications as well.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="http://www.37signals.com/svn/posts/900-iphone-sdk-apples-touch-platform-and-the-next-two-decades"&gt;37 Signals&lt;/a&gt; seem to be wildly ecstatic about Apple's potential, but I'm a bit less sanguine.  I don't doubt that the iPhone has a bright future, that much is pretty obvious.  However... dominate?  First of all, if it's so widespread, it loses some of its cachet, doesn't it?  I don't think Apple wants that.  I don't see them licensing the system so that other phone manufacturers can use it, so it will only be adapted as widely as Apple sees fit.  Cheaper Nokia models are very popular over here in Europe.  Will iPhones at those price points (less than 100 euro) be available and competitive with Nokia's offerings?  Open and adaptable aren't necessarily things that Apple is known for, which might be the difference between "strong presence" and "dominate", as we saw with Mac vs Windows.  Getting 10-15% towards the high end of the market might be what they aspire to, rather than ubiquity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I could, however, very easily envision Apple getting into some kind of business niche and dominating that completely, as they did with education for a while.  That might not extend to the broader market, though.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Moving on to other considerations, this one is important to me: apparently, according to the license agreement, you can't run an interpreter that fetches code and executes it, amongst the various other restrictions!  That's kind of a deal breaker for &lt;a href="http://www.hecl.org"&gt;Hecl&lt;/a&gt;, which counts that ability as one of its strengths.  I don't think a port was in the works in any case since Hecl is written in Java.  Still, though, that's the kind of annoying restriction that reaffirms my commitment to open source.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As an aside, I wonder what Sun is up to at this point - between this and Android, they have to be under enormous pressure to release a successor to Java ME, which was a good effort for its time, but is beginning to look dated and limited, even though it is &lt;em&gt;very&lt;/em&gt; widely deployed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'm an open source guy at heart.  I love openness and source code and the freedom to tinker... and while I'll certainly give Apple their due for making some fine products, closed and controlled is simply not for me.  Others may feel differently - it's a matter of taste and preferences.&lt;/p&gt;

&lt;p&gt;So for the moment, my efforts will be focused on Android, which I see as the best, most open thing out there at the moment.&lt;/p&gt;</description>
      <pubDate>Fri, 07 Mar 2008 02:09:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:1cfb51e5-9f81-4946-b0a7-444333c24f2f</guid>
      <author>David N. Welton</author>
      <link>http://journal.dedasys.com/articles/2008/03/07/iphone-nice-but-not-for-me</link>
      <category>hecl</category>
      <category>android</category>
      <category>iphone</category>
      <category>javame</category>
      <trackback:ping>http://journal.dedasys.com/articles/trackback/1853</trackback:ping>
    </item>
  </channel>
</rss>
