<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Christian Sunesson</title>
 <link href="http://noss.github.com/atom.xml" rel="self"/>
 <link href="http://noss.github.com/"/>
 <updated>2009-08-11T10:36:20-07:00</updated>
 <id>http://noss.github.com/</id>
 <author>
   <name>Christian Sunesson</name>
   <email>chsu79@gmail.com</email>
 </author>

 
 <entry>
   <title>A difference between OOP and COP</title>
   <link href="http://noss.github.com/2009/05/19/a-difference-between-oop-and-cop.html"/>
   <updated>2009-05-19T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/05/19/a-difference-between-oop-and-cop</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-05-19&lt;/p&gt;
&lt;p&gt;Let me try to explain a difference I keep in mind for Concurrency Oriented Programming (&lt;span class=&quot;caps&quot;&gt;COP&lt;/span&gt;) versus Object Oriented Programing (&lt;span class=&quot;caps&quot;&gt;OOP&lt;/span&gt;). Erlang flavour.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;OOP&lt;/span&gt; is all about where data ends up being stored. You give things that store data descriptive names that corresponds to what they keep and what they model in the real world. Threads that go around and mutate state in the objects are secondary citizens, you dont give them good names, if you try to name a thread in a given OO design it would probably be something generic, such as &amp;#8220;Worker&amp;#8221;, &amp;#8220;Executor&amp;#8221;, &amp;#8220;Handler&amp;#8221;. They&amp;#8217;re things that do stuff.&lt;/p&gt;
&lt;p&gt;In &lt;span class=&quot;caps&quot;&gt;COP&lt;/span&gt; it is the other way around. You dont focus so much on things that store stuff. You pay all the attention on things that accomplish stuff. You want those things to do small and well-defined things. You want to give them names that describes the things they do. You want them to go away when they have done what they should.&lt;/p&gt;
&lt;p&gt;This is &amp;#8220;Object&amp;#8221; versus &amp;#8220;Process&amp;#8221;.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Erlang packaging format</title>
   <link href="http://noss.github.com/2009/05/01/erlang-packaging-format.html"/>
   <updated>2009-05-01T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/05/01/erlang-packaging-format</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-05-01&lt;/p&gt;
&lt;p&gt;Just having read Paul Mineiro&amp;#8217;s article &lt;a href=&quot;http://dukesoferl.blogspot.com/2009/05/need-for-language-specific-packaging.html&quot;&gt;The Need for Language Specific Packaging&lt;/a&gt; I finally see a solution for erlang software packaging that I like. I have mostly ignored all the people asking for an Erlang version of things like Perl&amp;#8217;s &lt;span class=&quot;caps&quot;&gt;CPAN&lt;/span&gt;. And that goes for the existing efforts, such as &lt;a href=&quot;http://www.erlware.org/&quot;&gt;erlware&lt;/a&gt; and &lt;a href=&quot;http://cean.process-one.net/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;CEAN&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The reason I have ignored it is because I dont see myself using yet-another-tool-for-installing-software. I have been quite happy using the ones from linux distributions I know. You seem to be able to add third-party-vendor package repositories for both redhat&amp;#8217;s dot-rpm and for debian/ubuntu dot-deb files. The problem then are &amp;#8220;those other people&amp;#8221; that use macs or windows or whatever.&lt;/p&gt;
&lt;p&gt;So my take from reading Paul&amp;#8217;s article is that &lt;strong&gt;what we need&lt;/strong&gt; is a format for describing the package, so that tools can be made to automatically build package files for each package system in existance now and in the future. We &lt;strong&gt;do not need&lt;/strong&gt; our own distribution system, our own package file format, our own software update system, and our own documentation.&lt;/p&gt;
&lt;p&gt;The file could probably be something simple as a single main package description, then one file with specifics for each package file-format target. Everything in convenient file:consult/1-able text formats.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Reverse engineering oracle protocol</title>
   <link href="http://noss.github.com/2009/04/28/reverse-engineering-oracle-protocol.html"/>
   <updated>2009-04-28T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/28/reverse-engineering-oracle-protocol</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-04-28&lt;/p&gt;
&lt;p&gt;This is one of those &amp;#8220;so clever it is dumb&amp;#8221; things. Sitting with wireshark to verify system behaviour in connecting to oracle i happen to see some exchange in the protocol.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Everybody follows&lt;br /&gt;
Speedy bits exchange&lt;br /&gt;
Stars await to gl@ow&amp;quot;&lt;br /&gt;
The preceding key is copyrighted by Oracle Corporation.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The idea is likely that by having this copyrighted poem required in the protocol, no body but oracle can implement the protocol without breaching their copyright to the poem. (&lt;a href=&quot;http://dacut.blogspot.com/2008/03/oracle-poetry.html&quot;&gt;Not only my guess&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;And those guys just bought &lt;span class=&quot;caps&quot;&gt;JAVA&lt;/span&gt;. Yay.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Credit card usability fail</title>
   <link href="http://noss.github.com/2009/04/28/credit-card-usability-fail.html"/>
   <updated>2009-04-28T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/28/credit-card-usability-fail</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-04-28&lt;/p&gt;
&lt;p&gt;Today it happened again at the store. The guy in front of me in line forgot his credit card in the card reader, but I noticed half a minute after he had walked away into the masses. The cashier handled it and in our spontaneous discussion about it she pointed out that she gets plenty of them now when the old magnet-strips are being phased out with a chip.&lt;/p&gt;
&lt;p&gt;Magnetic strips are slid through the reader and you stand there with your card in your hand. With chips, you insert the card, type in your code and agree with the sum to pay, then you stand there without the card in your hand. Then comes the final important step that is essential but tiny enough to forget. Take the card back.&lt;/p&gt;
&lt;p&gt;I dont understand why they dont go the route of car seat-belts, beep, and that until you take the card out. Or flash, if the noise would be an issue.&lt;/p&gt;
&lt;h3&gt;PS&lt;/h3&gt;
&lt;p&gt;Like this idea, Banks? I would gladly accept a small symbolic fee of 0.1 cent per cc transaction. A simple token of your appreciation. Mmmkay?&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Wake up again</title>
   <link href="http://noss.github.com/2009/04/24/wake-up-again.html"/>
   <updated>2009-04-24T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/24/wake-up-again</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-04-24&lt;/p&gt;
&lt;p&gt;Put on your reflective sun-glassess and get into &lt;a href=&quot;http://www.amazon.com/reader/0470289627/#reader&quot;&gt;multi-core programming in C++&lt;/a&gt;. Professional multi-core programming.&lt;/p&gt;
&lt;p&gt;Erlang is for girls.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/2009/03/03/wake-up.html&quot;&gt;Wake up!&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>More erlang-gettext hack</title>
   <link href="http://noss.github.com/2009/04/14/more-erlang-gettext-hack.html"/>
   <updated>2009-04-14T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/14/more-erlang-gettext-hack</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-04-14&lt;/p&gt;
&lt;p&gt;Implemented this interface:&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
1&amp;gt; gettext_generate:compile(se, &amp;#8220;swedish.po&amp;#8221;).&lt;br /&gt;
{module,se}&lt;br /&gt;
2&amp;gt; gettext_generate:compile(es, &amp;#8220;spanish.po&amp;#8221;).&lt;br /&gt;
{module,es}&lt;br /&gt;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But read &lt;a href=&quot;http://github.com/noss/erlang-gettext/tree/master&quot;&gt;erlang-gettext &lt;span class=&quot;caps&quot;&gt;README&lt;/span&gt;-generated.textile&lt;/a&gt; at github instead.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Erlang gettext hack</title>
   <link href="http://noss.github.com/2009/04/14/erlang-gettext-hack.html"/>
   <updated>2009-04-14T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/14/erlang-gettext-hack</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-04-14&lt;/p&gt;
&lt;p&gt;I set out to improve gettext i18n in Erlang tonight. Given the &lt;a href=&quot;/2009/04/02/constant-pool-erlang-hack.html&quot;&gt;erlang constant pool&lt;/a&gt; being optimized so that it returns references into it rather than &amp;#8220;consing&amp;#8221; a duplicate copy&amp;#8230; do you see where this is going?&lt;/p&gt;
&lt;p&gt;My result so far is just a proof of concept, too early to be released really. I just want to spread the word and show what the concept is:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Parse gettext &amp;#8220;.po&amp;#8221; file&lt;/li&gt;
	&lt;li&gt;Generate erlang module that exports Mod:gettext/1, taking an atom, returning a string.&lt;/li&gt;
	&lt;li&gt;Compile said module&lt;/li&gt;
	&lt;li&gt;Use &lt;code&gt;I18N:gettext('Hello World')&lt;/code&gt; in source, but probably as &lt;code&gt;?_('Hello World')&lt;/code&gt; or &lt;code&gt;?__(I18N, 'Hello World')&lt;/code&gt;. The existing code uses the process dictionary to store the I18N table to use, and so can I.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I&amp;#8217;ll get back when I have better code generation. Perhaps generating &lt;span class=&quot;caps&quot;&gt;AST&lt;/span&gt; and compiling down to a .beam directly. Right now it generates source text and doesnt even escape strings.&lt;/p&gt;
&lt;p&gt;Oh yeah, and a link: &lt;a href=&quot;http://github.com/noss/erlang-gettext&quot;&gt;noss/erlang-gettext @ github&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Using google guice in webstart</title>
   <link href="http://noss.github.com/2009/04/12/google-guice-in-webstart-fail.html"/>
   <updated>2009-04-12T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/12/google-guice-in-webstart-fail</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-04-12&lt;/p&gt;
&lt;p&gt;I spent all night trying to get google guice working inside a java webstart sandbox. The results of the all-nigher to &lt;a href=&quot;http://groups.google.com/group/google-guice-dev/browse_thread/thread/42399276af2f1fec&quot;&gt;get guice working in java webstart&lt;/a&gt; can be read there.&lt;/p&gt;
&lt;p&gt;In short:&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;FAIL&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Ehh.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Processes in Erlang</title>
   <link href="http://noss.github.com/2009/04/09/processes-in-erlang.html"/>
   <updated>2009-04-09T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/09/processes-in-erlang</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-04-09&lt;/p&gt;
&lt;p&gt;Found &lt;a href=&quot;http://www.sheysrebellion.net/blog/2009/04/09/processes-in-erlang/&quot;&gt;Processes in Erlang&lt;/a&gt; today. Inspired me to a comment:&lt;/p&gt;
&lt;p&gt;&lt;acronym title=&quot;concurrency oriented&quot;&gt;&lt;span class=&quot;caps&quot;&gt;CO&lt;/span&gt;&lt;/acronym&gt; programming differs from &lt;acronym title=&quot;object oriented&quot;&gt;&lt;span class=&quot;caps&quot;&gt;OO&lt;/span&gt;&lt;/acronym&gt; programming in an important way.&lt;/p&gt;
&lt;p&gt;A process represents something happening. If you have a process that represent a passive object, it is OO programming. In CO you use values to represent passive things. (The process identifier tends to not be a good value, since it has a beginning and end, is connected to the node that created it, wont survive node restarts, it is only good if the value represented also is short-lived.)&lt;/p&gt;
&lt;p&gt;The process has a mission, it is doing things to reach a result. Think of the meaning of &amp;#8220;process&amp;#8221; outside of programming (how laws are passed in parliamentarism, how a customer support issue is handled at your company, and so on). That is what CO processes are about. Compare it to the typical OO example: A Shape superclass with Sphere, Rectangle, and Polygon (etc&amp;#8230;) subclasses. Those classes of objects have no goal. They just exist to be used.&lt;/p&gt;
&lt;p&gt;In many situations the difference in actual code will be quite small. There will often be one process coordinating tasks for one passive object. The difference will be in your head, in how you name things, and thus how you relate to them.&lt;/p&gt;
&lt;p&gt;In the example of the article linked to, stocks and money changing owners, the active task is the transaction. It is a process that knows the amount of stock, the amount of money, the stock owner registry, the buyer and seller (actually, bank accounts of theirs). It has a goal to perform the transaction so that no party loses property or money, or give up.&lt;/p&gt;
&lt;p&gt;The transaction will have to use a protocol involving the processes providing services for the passive things, a stock ownership registry and two bank accounts, to complete an atomic transaction. Using a two-phase commit, for example. The processes that provide service will likely be looked up using the values representing them. A bank might not have a process for each account all the time, but create them on demand, limiting it to only one process to exist at any time.&lt;/p&gt;
&lt;p&gt;Of course, the pattern of performing an atomic transaction involving changes to multiple entities looked up by representing value is so common that it already exists. Mnesia.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>What everybody already know about Erlang</title>
   <link href="http://noss.github.com/2009/04/07/what-everybody-already-know-about-erlang.html"/>
   <updated>2009-04-07T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/07/what-everybody-already-know-about-erlang</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-04-07&lt;/p&gt;
&lt;p&gt;What is &lt;a href=&quot;http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about.html&quot; rel=&quot;nofollow&quot;&gt;this guy&lt;/a&gt; talking about? Lots of words with a very vague red thread, and in the end:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;It has been suggested in the comments that when people say that Erlang style actors don&amp;#8217;t share state they mean it doesn&amp;#8217;t share memory. First, I clearly defined state in the previous article as being different from its representation. But, just as importantly, I think that saying &amp;#8220;we don&amp;#8217;t share memory&amp;#8221; is a distinction without distinction. It&amp;#8217;s an implementor&amp;#8217;s point of view that doesn&amp;#8217;t reflect how a user must think about actors.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Having been on the internets before, I know that when people begin to clear up (adjust?) definitions, you know something fishy is going on. I mean, shaking the definitions have been used before (&lt;a href=&quot;http://en.wikipedia.org/wiki/List_of_U.S._presidential_faux-pas,_gaffes,_and_unfortunate_incidents#Bill_Clinton&quot;&gt;what is the definition of &amp;#8216;is&amp;#8217;&lt;/a&gt;, anyway?). Of course, it is an argument tactics that has many success stories (prisoner of war/illegal combatant, torture/interview, theft/performance bonus, christianity/intelligent design, etc.)&lt;/p&gt;
&lt;p&gt;The particular post above smells more like a desire to bash Erlang as it is new and different, clashing with the programmer community the author identifies with and has his experience with. Not at all for pointing out something yet unknown and/or really bad about Erlang or the actor model itself. I could be wrong. I&amp;#8217;m waiting for the movie based on the post. He is definitely not asking for clarification on something he doesnt understand though.&lt;/p&gt;
&lt;p&gt;For future reference, here is what everyone already know about erlang (not exhaustive, not all related to the above article):&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;It is possible to share state in erlang. Just create a public ets table or open a file and read/write from multiple processes. Evil shared state at work!&lt;/li&gt;
	&lt;li&gt;It is possible to have as-good-as mutable-variables in Erlang, use the process dictionary. Actually, you can even read the process dictionary of another process without it knowing. Yay for race-conditions if abused.&lt;/li&gt;
	&lt;li&gt;Yeah, mnesia. Mutable table rows. We know that too. Dirty transactions for fun and profit!&lt;/li&gt;
	&lt;li&gt;At any one moment, a running Erlang program has lots of internal state that together form the current state that will shape how the system progress from there on, and that progress will likely change lots of state isolated in processes and in the mutable storages just mentioned.&lt;/li&gt;
	&lt;li&gt;One can implement asynchronous message-passing style in your favourite language too. That is not news to us. We dont get angry if you do. We encourage you to do it. We like the programming paradigm.&lt;/li&gt;
	&lt;li&gt;Erlang distinguishes itself from other languages&amp;#8217; syntax. It is kind of the point.&lt;/li&gt;
	&lt;li&gt;Scalability does not come by itself from using Erlang. Software still has to be designed with it in mind.&lt;/li&gt;
	&lt;li&gt;Erlang has all-or-nothing security. And the nothing-kind is itself kind of unsecure since node-communication is not encrypted out-of-the-box.&lt;/li&gt;
&lt;/ul&gt;</content>
 </entry>
 
 <entry>
   <title>Mnesia sucks ... not</title>
   <link href="http://noss.github.com/2009/04/04/mnesia-sucks-not.html"/>
   <updated>2009-04-04T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/04/mnesia-sucks-not</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-04-04&lt;/p&gt;
&lt;p&gt;&amp;#8230; well no it doesn&amp;#8217;t suck. But titles like that are good for attention. :-/&lt;/p&gt;
&lt;p&gt;Mnesia is one of the killer applications in Erlang. A killer application that get people to take a deeper look at Erlang. Some come with the expectation that it will be a silver bullet solution to all their scalability and performance problems, or that it will be easy to move over to from their current database. When Mnesia fails to be what they thought it would be, we all get to read about how mnesia sucks.&lt;/p&gt;
&lt;p&gt;So if you&amp;#8217;re getting into Mnesia, my first recommendation is this &lt;a href=&quot;http://www.erlang.se/publications/mnesia_overview.pdf&quot;&gt;mnesia overview&lt;/a&gt;. It is just 15 pages (pdf) and contains the rationale and a basic feature overview.&lt;/p&gt;
&lt;blockquote cite=&quot;http://www.erlang.se/publications/mnesia_overview.pdf&quot;&gt;
&lt;p&gt;In telecommunications applications there are needs different from the features provided by traditional DBMSs. The applications we now see implemented in the Erlang language need a mixture of a broad range of features which generally are not satisfied by traditional DBMSs. Mnesia is designed with requirements like the following in mind:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Fast realtime key value lookup.&lt;/li&gt;
	&lt;li&gt;Complicated non realtime queries mainly for operation and maintenance.&lt;/li&gt;
	&lt;li&gt;Distributed data due to distributed applications.&lt;/li&gt;
	&lt;li&gt;High fault tolerance.&lt;/li&gt;
	&lt;li&gt;Dynamic re-configuration.&lt;/li&gt;
	&lt;li&gt;Complex objects.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;What sets Mnesia apart from most other DBMSs is that it is designed with the typical data management problems of telecommunications applications in mind. Hence Mnesia combines many concepts found in traditional databases such as transactions and queries with concepts found in data management systems for telecommunications applications such as very fast realtime operations, configurable degree of fault tolerance (by means of replication) and the ability to reconfigure the system without stopping or suspending it. Mnesia is also interesting due to its tight coupling to the programming language Erlang, thus almost turning Erlang into a database programming language. This has many benefits, the foremost being that the impedance mismatch between data format used by the &lt;span class=&quot;caps&quot;&gt;DBMS&lt;/span&gt; and data format used by the programming language which is being used to manipulate the data, completely disappears.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Usage scenario&lt;/h2&gt;
&lt;p&gt;For example, with pre-paid cards for mobile phones, calls progress by reserving money for the next few seconds. If there is a reserve failure, the call will be cancelled, else the seconds will pass and the reserved amount will be debited. With millions of subscribers you can easily have a hundred thousand concurrent sessions. Each session will want to reserve and debit every few second.&lt;/p&gt;
&lt;p&gt;This problem has a real-time requirement, you cant start to lag with processing reservation requests above those few seconds, because then people will have their phone-calls dropped, and they will not be happy customers. Instead they will get another operator. And you dont want to solve your performance problems by losing customers.&lt;/p&gt;
&lt;p&gt;Typically, when systems like these fail, you allow users to call for free rather than cancelling all calls in progress and disallowing further calls (for happy-customer reasons again). This means that downtime is quite easy to measure in amount of money lost. You just extrapolate from average traffic from the same time this day earlier weeks. Assuming calls reserve money every 10 seconds, there is 100 000 concurrent sessions and the cost per-minute is 0.69 swedish krona, &lt;a href=&quot;http://www.google.com/search?q=100000*0.69+SEK+in+EUR&quot;&gt;this calculation&lt;/a&gt; tells us a minute of undebited calls is 6 430.24542 Euros (&lt;span class=&quot;caps&quot;&gt;SEK&lt;/span&gt;:&lt;span class=&quot;caps&quot;&gt;EUR&lt;/span&gt; exchange rate at the time this is written).&lt;/p&gt;
&lt;p&gt;So you could buy a beefy server for each minute you&amp;#8217;re not debiting customers. It is no longer excusable to have downtime because a comparably cheap hard drive failed, or psu burned, or computer-hall electricity surged, instead it is very excusable to have a hot standby server that can take over within a second. Relative response time to get someone to the server and fix hardware problems can easily reach an hour. Humans are slow.&lt;/p&gt;
&lt;p&gt;This is what mnesia is built for. Not for distributed storage and querying your copy of wikipedia, or other archival purposes. Just plain online and transient data for soft realtime access. The storage limit of dets-backed tables that is at 2 (or 4?) Gb, means that 100000 users can have 20 (or 40) kilobyte data about them. But you dont want to keep that on disk, you keep it as a ram_table so you can handle the high transactions-per-second. And ets-backed ram_tables do not have any limit other than available-memory in your machine.&lt;/p&gt;
&lt;h2&gt;Further reading&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;The &lt;a href=&quot;erlang.org/doc/pdf/mnesia.pdf&quot;&gt;Mnesia User Guide&lt;/a&gt; is 134 pages (pdf) of useful details. The intended user is a developer.&lt;/li&gt;
	&lt;li&gt;Function reference for the &lt;a href=&quot;http://www.erlang.org/doc/man/mnesia.html&quot;&gt;mnesia module&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;The &lt;a href=&quot;http://erlang.org/faq/mnesia.html#11&quot;&gt;Mnesia &lt;span class=&quot;caps&quot;&gt;FAQ&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;A complement to Mnesia&amp;#8217;s shortcommings &lt;a href=&quot;http://couchdb.apache.org/&quot;&gt;CouchDB&lt;/a&gt; (okay, you probably already heard about that one).&lt;/li&gt;
	&lt;li&gt;Kai, scalaris, ringo, dynomite, disco&amp;#8230; these are all erlang project names related to distributing and querying data.&lt;/li&gt;
&lt;/ul&gt;</content>
 </entry>
 
 <entry>
   <title>Self-referencing anonymous functions in Erlang</title>
   <link href="http://noss.github.com/2009/04/03/self-referencing-anonymous-functions-in-erlang.html"/>
   <updated>2009-04-03T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/03/self-referencing-anonymous-functions-in-erlang</id>
   <content type="html">&lt;p&gt;A somewhat frequent question on &lt;a href=&quot;http://www.erlang.org/pipermail/erlang-questions/2009-April/042907.html&quot;&gt;erlang-questions&lt;/a&gt; :&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Would it be a bad idea to introduce a keyword for self referencing anonymous functions?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That discussion has been had several times on this list. I think nothing is done because those that are capable of doing it don&amp;#8217;t feel that it is important. The shell is just used for basic inspection and evaluation, not for building systems. Get distel to compile into real modules if you want more interactive development. If you want recusion in real modules you can define a named function. Giving non-trivial things a name is generally a good thing. It makes it much easier to talk about.&lt;/p&gt;
&lt;p&gt;Anyway.&lt;/p&gt;
&lt;p&gt;Introducing a magical keyword that refers to the surrounding closure would be a bad thing anyway. First for introducing yet another keyword. Secondly because it is only referring to one surrounding fun when erlang allow funs to return funs that return funs, and so on.&lt;/p&gt;
&lt;p&gt;The better approach would be to add an optional name that is scoped to the fun-body. This way you can have multiple nested funs and they can refer to the outer funs or itself, and the programmer can give them meaningful names.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Erlang XML soon faster</title>
   <link href="http://noss.github.com/2009/04/02/erlang-xml-soon-faster.html"/>
   <updated>2009-04-02T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/02/erlang-xml-soon-faster</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-04-02&lt;/p&gt;
&lt;p&gt;Fresh rumour from erlang-questions &lt;a href=&quot;http://www.erlang.org/pipermail/erlang-questions/2009-April/042870.html&quot;&gt;&lt;span class=&quot;caps&quot;&gt;OTP&lt;/span&gt; is working on xmlerl improvements&lt;/a&gt;, leaked by Kenneth Lundin at &lt;span class=&quot;caps&quot;&gt;OTP&lt;/span&gt; himself:&lt;/p&gt;
&lt;blockquote cite=&quot;http://www.erlang.org/pipermail/erlang-questions/2009-April/042870.html&quot;&gt;
&lt;p&gt;We are working on significant performance improvements and new API&amp;#8217;s for &lt;span class=&quot;caps&quot;&gt;XMERL&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The new &lt;span class=&quot;caps&quot;&gt;XMERL&lt;/span&gt; will be at least 4 times faster than the current version. The base for this is a completely new &lt;span class=&quot;caps&quot;&gt;SAX&lt;/span&gt; parser that you also can use directly with new API&amp;#8217;s.&lt;/p&gt;
&lt;p&gt;The memory consumption will also be significantly reduced.&lt;/p&gt;
&lt;/blockquote&gt;</content>
 </entry>
 
 <entry>
   <title>Constant-pool erlang hack</title>
   <link href="http://noss.github.com/2009/04/02/constant-pool-erlang-hack.html"/>
   <updated>2009-04-02T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/04/02/constant-pool-erlang-hack</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-04-02&lt;/p&gt;
&lt;p&gt;Erlang R12B-0 added &lt;a href=&quot;http://erlang.org/download/otp_src_R12B-0.readme&quot;&gt;a per-module memory area for constants&lt;/a&gt;, the literal values in a module are stored there. Before, they were allocated on the heap every time they were referenced. This meant that some kinds of optimization that avoided literal lookup-tables became irrelevant in one go (without even recompiling the source). A great example of the kind of improvements that &lt;span class=&quot;caps&quot;&gt;OTP&lt;/span&gt; focus on: removing speed-bumps to having beautiful code.&lt;/p&gt;
&lt;h2&gt;From the release notes of R12B-0&lt;/h2&gt;
&lt;blockquote cite=&quot;http://erlang.org/download/otp_src_R12B-0.readme&quot;&gt;
&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;OTP&lt;/span&gt;-6850:  Literal lists, tuples, and binaries are no longer constructed at run-time as they used to be, but are stored in a per-module constant pool. Literals that are used more than once are stored only once.&lt;/p&gt;
&lt;p&gt;This is not a change to the language, only in the details of its implementation. Therefore, the implications of this change is described in the Efficiency Guide.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The &lt;a href=&quot;http://www.erlang.org/doc/efficiency_guide/processes.html#8.2.1&quot;&gt;erlang efficiency guide on constant pools&lt;/a&gt; pretty much say the same thing. But Björn Gustavsson adds this very interesting remark about &lt;a href=&quot;http://www.erlang.org/pipermail/erlang-questions/2009-March/042736.html&quot;&gt;unloading a module and the constant pool&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;The hack&lt;/h2&gt;
&lt;p&gt;If one has very assymetric access patterns to some value, Maybe millions of times more reads than updates, and this is a measured problem, one can reach for hacks such as &lt;a href=&quot;http://www.erlang.org/pipermail/erlang-questions/2009-March/042778.html&quot;&gt;generating a module containing the values as literals&lt;/a&gt; and thus have a global configuration value that will not grow your heap unecessary.&lt;/p&gt;
&lt;h2&gt;But&amp;#8230;&lt;/h2&gt;
&lt;p&gt;As always, remember &lt;a href=&quot;http://www.erlang.org/doc/efficiency_guide/introduction.html#1.1&quot;&gt;when to optimize&lt;/a&gt;.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Google feedfetcher feed-id</title>
   <link href="http://noss.github.com/2009/03/29/google-feedfetcher-feed-id.html"/>
   <updated>2009-03-29T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/29/google-feedfetcher-feed-id</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-29&lt;/p&gt;
&lt;p&gt;Since 2009-03-23 the user-agent header in feedfetcher requests include a &lt;code&gt;feed-id&lt;/code&gt; part with a longer number. What is this? Can I use it to go and kill further requests against that feed?&lt;/p&gt;
&lt;p&gt;A mystery.&lt;/p&gt;
&lt;p&gt;The only change since the last post about &lt;a href=&quot;/2009/03/21/google-feedfetcher-meet-http-status-410-gone.html&quot;&gt;google feedfetcher doesnt understand 410 gone&lt;/a&gt; is that now feedfetcher hits up to 12 times a day for missing feeds. :/&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Erlang io:format to string</title>
   <link href="http://noss.github.com/2009/03/29/erlang-io-format-to-string.html"/>
   <updated>2009-03-29T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/29/erlang-io-format-to-string</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-29&lt;/p&gt;
&lt;p&gt;This is quite a &lt;a href=&quot;http://erlang.org/faq/faq.html&quot;&gt;&lt;span class=&quot;caps&quot;&gt;FAQ&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;How do you get the result from &lt;a href=&quot;http://www.erlang.org/doc/man/io.html#format-3&quot;&gt;io:format&lt;/a&gt; into a string.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So here goes.&lt;/p&gt;
&lt;p&gt;There is an &lt;a href=&quot;http://www.erlang.org/doc/man/io_lib.html#format-2&quot;&gt;io_lib:format&lt;/a&gt; which returns the formatted result instead of printing it. Notice io_lib as module name instead of io. The result is not necessarily a flat list. No. The result might look like the following.&lt;/p&gt;
&lt;pre&gt;
1&amp;gt; io_lib:format(&quot;foo ~p bar~n&quot;, [42]).
[102,111,111,32,&quot;42&quot;,32,98,97,114,&quot;\n&quot;]
2&amp;gt; erlang:iolist_to_binary(v(1)).
&amp;lt;&amp;lt;&quot;foo 42 bar\n&quot;&amp;gt;&amp;gt;
3&amp;gt; lists:flatten(v(1)).
&quot;foo 42 bar\n&quot;
&lt;/pre&gt;
&lt;p&gt;But as you see, there are ways to flatten the result. It is not done per automation since all data sent to ports are flattened there anyway. Ports include files, other processes, sockets, etc. The concept is called &amp;#8220;iolist&amp;#8221;. If you want the byte-count of an iolist, then use &lt;a href=&quot;http://www.erlang.org/doc/man/erlang.html#iolist_size-1&quot;&gt;erlang:iolist_size&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Finally I would like to point out a little useful function called &lt;a href=&quot;http://www.erlang.org/doc/man/lists.html#concat-1&quot;&gt;lists:concat&lt;/a&gt; (which is nothing like &lt;a href=&quot;http://www.erlang.org/doc/man/lists.html#append-1&quot;&gt;lists:append&lt;/a&gt;).&lt;/p&gt;
&lt;pre&gt;
4&amp;gt; lists:concat([foo,&quot; &quot;, 42, &quot; &quot;, bar, &quot;\n&quot;]).
&quot;foo 42 bar\n&quot;
&lt;/pre&gt;</content>
 </entry>
 
 <entry>
   <title>Software engineering mud</title>
   <link href="http://noss.github.com/se/2009/03/28/software-engineering-mud.html"/>
   <updated>2009-03-28T00:00:00-07:00</updated>
   <id>http://noss.github.com/se/2009/03/28/software-engineering-mud</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-28&lt;/p&gt;
&lt;p&gt;I found and read &lt;a href=&quot;http://www.laputan.org/pub/foote/mud.pdf&quot;&gt;Big ball of mud&lt;/a&gt; (pdf, 41 pages) today. It is a paper on software architecture in the &amp;#8220;real world&amp;#8221;.&lt;/p&gt;
&lt;p&gt;It has many good reflections, and remarks such as that hard-to-understand code is more evolutionary fit because it is less likely to be comprehended and changed, that is both funny and cynical at the same time.&lt;/p&gt;
&lt;p&gt;I recommend the read.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Only green threads are green</title>
   <link href="http://noss.github.com/2009/03/23/only-green-threads-are-green.html"/>
   <updated>2009-03-23T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/23/only-green-threads-are-green</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-23&lt;/p&gt;
&lt;p&gt;I often see userspace threads being called &lt;a href=&quot;http://en.wikipedia.org/wiki/Green_threads&quot;&gt;Green Threads&lt;/a&gt;. It was a name that I had never heard before Java was released. Everyone uses it as an established name for the userspace threading concept as if it has been established for many decades. At the time of writing even Wikipedia makes it appear as if the name existed before the point Java was implemented.&lt;/p&gt;
&lt;p&gt;Some googling and I found evidence of my suspishion. &lt;a href=&quot;http://www.cincomsmalltalk.com/blog/blogView?showComments=true&amp;amp;entry=3303013147&quot;&gt;Green threads is a name &lt;span class=&quot;caps&quot;&gt;FROM&lt;/span&gt; the Java project&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote cite=&quot;http://www.cincomsmalltalk.com/blog/blogView?showComments=true&amp;entry=3303013147&quot;&gt;
&lt;p&gt;When Java 1.0 first came out on Solaris, it did not use the native Solaris library libthread.so to support threads. Instead it used runtime thread support that had been written in Java for an earlier project code-named &amp;#8220;Green.&amp;#8221; That thread library came to be known as &amp;#8220;green threads.&amp;#8221;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If anything I think the name for what Erlang has should be &amp;#8220;Williams Processes&amp;#8221; by what was said in this &lt;a href=&quot;http://www.se-radio.net/transcript-89-joe-armstrong-erlang&quot;&gt;talk with Joe Armstrong&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote cite=&quot;http://www.se-radio.net/transcript-89-joe-armstrong-erlang&quot;&gt;
&lt;p&gt;Yeah, and so Mike came along and he wrote an emulator C. Mike is pretty good in C. So, he really, I think he and I sort of, he told me quite a lot about C and Mike had a lot of experience with concurrent languages. And so he said well, the performance of a concurrent language is predicated by three things, it is the context-switching time, it is message-passing time and it is the time to create a process. So, these are fundamental. You know, in any programming mode you start with something fundamental. And you implement that very very very very well. Then you build your tower on top of it. And so, what Mike did in the emulator there was, he broke the C and then he turned on the optimiser and he printed a heavy assembly and stated it many times and did it again and again and again.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;He had insight in what was needed, started the research, and did the hard work to get there. Java can have their Green threads. Green is the color I associate with people that feel sick to their stomach. Suits fine.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Inline CSS test</title>
   <link href="http://noss.github.com/test/2009/03/21/inline-css-test.html"/>
   <updated>2009-03-21T00:00:00-07:00</updated>
   <id>http://noss.github.com/test/2009/03/21/inline-css-test</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-21&lt;/p&gt;
&lt;p&gt;Some experiments with inline style, and how feed readers filter out style-attributes or values inside style-attributes:&lt;/p&gt;
&lt;p style=&quot;color:blue;&quot;&gt;This should be blue.&lt;/p&gt;
&lt;p&gt;Text here.&lt;/p&gt;
&lt;p style=&quot;padding: 20px 0;&quot;&gt;This paragraph has 20 pixel of vertical padding.&lt;/p&gt;
&lt;p&gt;Text here.&lt;/p&gt;
&lt;p style=&quot;padding: 0 20px ;&quot;&gt;This paragraph has 20 pixel of horizontal padding.&lt;/p&gt;
&lt;p&gt;Text here.&lt;/p&gt;
&lt;p style=&quot;font-size: x-large;&quot;&gt;This paragraph is in x-large font-size.&lt;/p&gt;
&lt;p&gt;Test end.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Google Feedfetcher, meet HTTP status 410 Gone</title>
   <link href="http://noss.github.com/2009/03/21/google-feedfetcher-meet-http-status-410-gone.html"/>
   <updated>2009-03-21T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/21/google-feedfetcher-meet-http-status-410-gone</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-21&lt;/p&gt;
&lt;p&gt;I used to host an &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; feed on a domain I own. Someone added it to google reader or igoogle, so google feedfetcher will fetch it. But the feed was very short lived, and removed so feedfetcher got a 404 reply.&lt;/p&gt;
&lt;p&gt;About two years later, google feedfetcher is still trying to fetch that feed, and it attempts so 8 (!) times every day.&lt;/p&gt;
&lt;p&gt;Expecting much from google, I find the &lt;span class=&quot;caps&quot;&gt;FAQ&lt;/span&gt; entry &lt;a href=&quot;http://www.google.com/feedfetcher.html#robotsinfo&quot;&gt;How do I request that Google not retrieve some or all of my site&amp;#8217;s feeds?&lt;/a&gt; in their feedfetcher help. No wait&amp;#8230; dead links to the removals page. Well, it was not really what I wanted. I want to tell it that the feed is no more so there is not sensible to fetch it anylonger.&lt;/p&gt;
&lt;p&gt;The &lt;span class=&quot;caps&quot;&gt;FAQ&lt;/span&gt; indicates that google feedfetcher is too good to abide by robots.txt rules to target the feedfetcher spider. You see Google is fetching it for a user, and users are more important than publishers. A publisher that ask google to stop fetching a dead feed seems to be a preposterous request.&lt;/p&gt;
&lt;p&gt;Really google? Is this the best you can do?&lt;/p&gt;
&lt;p&gt;Okay. Maybe it is my fault. Maybe you keep trying to download the page because 404 is so often just an indication of a temporarily broken web server. After all that is the default response for an url that doesnt exist for most of the web servers out there. You are just missing a counter to how many times or how long time you have been getting the 404. I get it. I should respond something more sensible for you to de-subscribe all users that try to get at this feed. I could have made such a mistake as well if I had implemented feedfetcher.&lt;/p&gt;
&lt;p&gt;So looking through &lt;span class=&quot;caps&quot;&gt;RFC&lt;/span&gt; 2616 for &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt;/1.1 I find the &lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.11&quot;&gt;410 Gone&lt;/a&gt; status code:&lt;/p&gt;
&lt;blockquote cite=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.11&quot;&gt;
&lt;p&gt;The requested resource is no longer available at the server and no forwarding address is known. This condition is expected to be considered permanent. Clients with link editing capabilities &lt;span class=&quot;caps&quot;&gt;SHOULD&lt;/span&gt; delete references to the Request-&lt;span class=&quot;caps&quot;&gt;URI&lt;/span&gt; after user approval. If the server does not know, or has no facility to determine, whether or not the condition is permanent, the status code 404 (Not Found) &lt;span class=&quot;caps&quot;&gt;SHOULD&lt;/span&gt; be used instead. This response is cacheable unless indicated otherwise.&lt;/p&gt;
&lt;p&gt;The 410 response is primarily intended to assist the task of web maintenance by notifying the recipient that the resource is intentionally unavailable and that the server owners desire that remote links to that resource be removed. Such an event is common for limited-time, promotional services and for resources belonging to individuals no longer working at the server&amp;#8217;s site. It is not necessary to mark all permanently unavailable resources as &amp;#8220;gone&amp;#8221; or to keep the mark for any length of time &amp;#8212; that is left to the discretion of the server owner.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Ah! Of course! Someone at google must have thought about this concept to let publishers kill feeds!&lt;/p&gt;
&lt;p&gt;There is just one problem, I changed my dead rss feed to serve 410 back in october 2008, and feedfetcher is still hitting me 8 times a day&amp;#8230;&lt;/p&gt;
&lt;p style=&quot;text-align:right;&quot;&gt;&lt;span class=&quot;caps&quot;&gt;EPIC&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;FAIL&lt;/span&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>HTTP activity diagram</title>
   <link href="http://noss.github.com/2009/03/20/http-activity-diagram.html"/>
   <updated>2009-03-20T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/20/http-activity-diagram</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-20&lt;/p&gt;
&lt;p&gt;This is more of a reminder to myself for something I should use for future work in &lt;a href=&quot;http://frihjul.net/iserve&quot;&gt;iserve&lt;/a&gt;. The &lt;a href=&quot;http://thoughtpad.net/alan-dean/http-headers-status.html&quot;&gt;Alan Dean &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; Header Status&lt;/a&gt; diagram. That&amp;#8217;s some beautiful work.&lt;/p&gt;
&lt;p&gt;If there is something else to say in this post it is a complaint with myself that I am not better with tools to create such diagrams, or generally, I am not good at visualizing situations using diagrams.&lt;/p&gt;
&lt;p&gt;Programming is so very much about communicating your interpretation of requirements and your intentions in how to solve them, and diagrams can say so much more than an A4 page full of text.&lt;/p&gt;
&lt;p&gt;One particular school for modelling is the &lt;a href=&quot;http://www.fmc-modeling.org/quick-intro&quot;&gt;fundamental modeling concepts&lt;/a&gt; described as:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;FMC&lt;/span&gt; is the acronym for &amp;#8220;Fundamental Modeling Concepts&amp;#8221;, primarily a consistent and coherent way to think and talk about dynamic systems. It enables people to communicate the concepts and structures of complex informational systems in an efficient way among the different types of stakeholders. A universal notation originating from existing standards, easy to learn and to apply, is defined to visualize the structures and to communicate in a coherent way. In contrast to most of the visualization and modeling standards of today it focuses on human comprehension of complex systems on all levels of abstraction by clearly separating conceptual structures from implementation structures.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It is a very beautiful visual language that Erlang programmers should find useful. Another thing I like with &lt;acronym title=&quot;Fundamental Modeling Concepts&quot;&gt;&lt;span class=&quot;caps&quot;&gt;FMC&lt;/span&gt;&lt;/acronym&gt; is that it focuses on using the visual model for human comprehension and not for that &lt;span class=&quot;caps&quot;&gt;FAIL&lt;/span&gt;-&lt;span class=&quot;caps&quot;&gt;IDEA&lt;/span&gt; that is &lt;span class=&quot;caps&quot;&gt;UML&lt;/span&gt; based code stub generation. I much rather generate visual presentation of written code than generate code from visual presentations.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Concurrent separation of concerns</title>
   <link href="http://noss.github.com/2009/03/19/concurrent-separation-of-concerns.html"/>
   <updated>2009-03-19T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/19/concurrent-separation-of-concerns</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-19&lt;/p&gt;
&lt;p&gt;I spent much of this week debugging java, from post mortem dumps, to find a problem related to that all threads in a pool were trying to talk with a remote service that had crashed. Therefore nothing else in the java process was handled, making it appear dead. It is a typical stability anti pattern to not mark the service as broken and not attempting new connections for a while. This pattern is called &lt;a href=&quot;http://www.pragprog.com/titles/mnee/release-it&quot;&gt;the circuit breaker&lt;/a&gt; in the book &amp;#8220;Release It&amp;#8221; from pragmatic programmers. (Very good book, if you&amp;#8217;re into long-running software you should read it!).&lt;/p&gt;
&lt;p&gt;But the circuit breaker is not what I want to get at with this post. A little trend on this blog is for me to reflect on java programming vs erlang programming.&lt;/p&gt;
&lt;p&gt;Joe Armstrong call Erlang&amp;#8217;s paradigm &lt;a href=&quot;http://www.sics.se/~joe/talks/ll2_2002.pdf&quot;&gt;concurrency oriented programming&lt;/a&gt; to tell it apart from the object oriented programming that java is identified with.  Also, Steve Yegge points out a difference in thinking &lt;a href=&quot;http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html&quot;&gt;primary about nous, or primary about verbs&lt;/a&gt; in his blog post.&lt;/p&gt;
&lt;p&gt;If object oriented programming is about things that are, then concurrency oriented programming is about things that do. Nouns vs verbs.&lt;/p&gt;
&lt;p&gt;Now, in this blog I also have a tendency to write about testable code. And there are three rules to make your code more testable (which also happen to be three rules for good architecture overall, that writing unit tests will guide you into):&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Separation_of_concerns&quot;&gt;Separation of Concerns&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Principle_of_least_knowledge&quot;&gt;The Law of Demeter&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dependency_inversion_principle&quot;&gt;Dependency inversion principle&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Having spent time trying to debug the above java mentioned thread problem I see that in java, the programmers violates separation of concerns enormously when it comes to threads. A good rule of thumb is that if you describe somethings purpose, and use the word &amp;#8220;and&amp;#8221;, then you should break it up into parts until you do not use &amp;#8220;and&amp;#8221; anymore. In Erlang you actually do this with processes. A gen_server process is there to fullfill a single purpose (if the design is good). All the calls and casts are there to archive this one purpose. Short lived processes are spawned to do one thing and get back with the result when done.&lt;/p&gt;
&lt;p&gt;In java, it is absolutely not so. I would not be exaggering if I said that most threads&amp;#8217; purpose description will use the word &amp;#8220;and&amp;#8221; at least 5 times. It is the thread that accepts the socket and and executes its handler and queries the database and fetches from memcache and writes to the log and talks to the credit card processor and renders the result page and sends it back.&lt;/p&gt;
&lt;p&gt;Maybe it is just a side-effect of java programming being the kingdom of the nouns, and erlang being the kingdom of the verbs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PS&lt;/strong&gt;&lt;br /&gt;
I am well aware that one can use a more message passing approach in Java using java.util.concurrent blocking queues and copy on write arrays and hashmaps. I&amp;#8217;m merely pointing out the &amp;#8220;cultural&amp;#8221; difference resulting from the programming language concepts. A point that I will try to use for future Java programming.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>R13A and Schedulers</title>
   <link href="http://noss.github.com/2009/03/18/r13a-and-schedulers.html"/>
   <updated>2009-03-18T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/18/r13a-and-schedulers</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-18&lt;/p&gt;
&lt;p&gt;So now is &lt;a href=&quot;http://erlang.org/workshop/2008/Sess11.pdf&quot;&gt;the future of erlang&lt;/a&gt;. We have multiple schedulers. And with interesting release notes such as:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;OTP&lt;/span&gt;-7692  The Erlang process lock implementation has been improved by Mat Hostetter at Tilera Corporation.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;OTP&lt;/span&gt;-7852  Enhanced build environment for cross compilation to Tilera Tile architecture.  Support for native ethread atomics on Tilera Tile64/TilePro&lt;br /&gt;
	      (Thanks to Tilera Corporation).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&amp;#8230; I can only assume that the &lt;a href=&quot;http://en.wikipedia.org/wiki/Tilera&quot;&gt;future multicore world is already here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;erlang:system_info(system_version)&lt;/code&gt; output changed in R13A. It looks something like&lt;/p&gt;
&lt;pre&gt;
Erlang R13A (erts-5.7) [smp:2:2] [rq:2] [async-threads:0]
&lt;/pre&gt;
&lt;p&gt;Which not only fixes &lt;a href=&quot;http://erlang.org/pipermail/erlang-questions/2008-November/039520.html&quot;&gt;this erlang version&lt;/a&gt; issue, but also conveys some new multiple-scheduler settings.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;+S Schedulers:SchedulerOnline&lt;/code&gt; \\&lt;br /&gt;
    Sets the amount of scheduler threads to create and scheduler threads to set online when &lt;span class=&quot;caps&quot;&gt;SMP&lt;/span&gt; support has been enabled. Valid range for both values are 1-1024. If the Erlang runtime system is able to determine the amount of logical processors configured and logical processors available, Schedulers will default to logical processors configured, and SchedulersOnline will default to logical processors available; otherwise, the default values will be 1. Schedulers may be omitted if :SchedulerOnline is not and vice versa. The amount of schedulers online can be changed at run time via &lt;a href=&quot;http://www.erlang.org/doc/man/erlang.html#system_flag_schedulers_online&quot;&gt;erlang:system_flag(schedulers_online, SchedulersOnline&lt;/a&gt;). \\&lt;br /&gt;
    This flag will be ignored if the emulator doesn&amp;#8217;t have &lt;span class=&quot;caps&quot;&gt;SMP&lt;/span&gt; support enabled (&lt;a href=&quot;http://www.erlang.org/doc/man/erl.html#smp&quot;&gt;see the -smp flag&lt;/a&gt;).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is what &lt;a href=&quot;http://www.erlang.org/pipermail/erlang-questions/2009-March/042438.html&quot;&gt;ulf wiger have to say about the system_version&lt;/a&gt; and I suspect the thread will continue to clear up any remaining confusion.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Erlang list comprehension with no generator</title>
   <link href="http://noss.github.com/2009/03/17/list-comprehension-no-generator.html"/>
   <updated>2009-03-17T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/17/list-comprehension-no-generator</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-17&lt;/p&gt;
&lt;p&gt;The R13A release readme has this note:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;OTP&lt;/span&gt;-7846  There will no longer be any warnings for list comprehensions without generators, as such list comprehension have turned out to be useful.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I found it curious what kind of use or possible abuse one could have for this. So I set out for some googling and found this discussion on erlang-questions about &lt;a href=&quot;http://erlang.org/pipermail/erlang-questions/2007-April/025950.html&quot;&gt;using list comprehensions without a generator&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Thought I would share it with the blargosphere.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Erlang release R13A</title>
   <link href="http://noss.github.com/2009/03/17/erlang-release-r13a.html"/>
   <updated>2009-03-17T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/17/erlang-release-r13a</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-17&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.erlang.org/download/otp_src_R13A.readme&quot;&gt;Erlang R13A&lt;/a&gt; was just released a couple of hours ago. &lt;del&gt;R13A is an alpha release of R13B&lt;/del&gt;. There are some very interesting things in this release.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Correction&lt;/strong&gt;: R13A is a beta release of the next R13B major release.  We do not recommend it for use in live products. &amp;#8212; the R13A readme&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
	&lt;li&gt;The scheduler has finer lock-granularity. Several schedulers, one for each processor/core, better process affinity and cache usage. This will mean better scalability with increasing numbers of cores, proving that Erlang is to depend on when it comes to future multi-core systems.&lt;/li&gt;
	&lt;li&gt;A beta release of wxErlang, an erlang application for making desktop guis using &lt;a href=&quot;http://en.wikipedia.org/wiki/WxWidgets&quot;&gt;wxWidget&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;A new module called unicode for converting unicode character encodings and latin character sets.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;PS.&lt;/p&gt;
&lt;p&gt;Download the &lt;a href=&quot;http://erlang.org:6969/&quot;&gt;erlang torrent&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://erlang.org:6969/file?info_hash=%CBR%F9%158%DAo%FF%C4%14P%C5%9F%EC%90L%F8%5E%09%83&quot;&gt;otp_src_R13A.tar.gz&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://erlang.org:6969/file?info_hash=%21%1A%3By%AF%DF%E1/%17%C9%14%5C%BB%9B7%97%93%8B%11%F5&quot;&gt;otp_win32_R13A.exe&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content>
 </entry>
 
 <entry>
   <title>Compiling erlang R13A including wx</title>
   <link href="http://noss.github.com/2009/03/17/compiling-erlang-R13A-with-wx.html"/>
   <updated>2009-03-17T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/17/compiling-erlang-R13A-with-wx</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-17&lt;/p&gt;
&lt;p&gt;Compiling R13A was not a breeze, wxErlang had a few dependencies for it to work. My system is ubuntu 8.04.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;wxWidgets version 2.8.0 or higher!
	&lt;ul&gt;
		&lt;li&gt;libwxbase2.8-dev&lt;/li&gt;
		&lt;li&gt;libwxgtk2.8-dev&lt;/li&gt;
		&lt;li&gt;libgl1-mesa-dev&lt;/li&gt;
		&lt;li&gt;libglu1-mesa-dev&lt;/li&gt;
		&lt;li&gt;libglut3-dev&lt;/li&gt;
	&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Maybe these are not all required. But after installing them I could ./configure with wx enabled.&lt;/p&gt;
&lt;p&gt;Oh, and also, it is a &lt;strong&gt;very good idea to actually have a c++ compiler installed&lt;/strong&gt;. There is a package in ubuntu called c++ that fetches g++ 4.2 for you. There was actually no check for that dependency in the autoconf script, but it is documented as a requirement.&lt;/p&gt;
&lt;p&gt;After installing erlang in /opt/erlang-R13A there is an example wx gui in /opt/erlang-R13A/lib/erlang/lib/wx-0.98/examples/minimal called minimal.erl:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;%%%-------------------------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;%%% File    : minimal.erl&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;%%% Author  : Matthew Harrison &amp;lt;harryhuk at users.sourceforge.net&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;%%% Description : Minimal example of a wxerlang application&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;%%%&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;%%% Created :  18 Sep 2008 by  Matthew Harrison &amp;lt;harryhuk at users.sourceforge.net&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;%%%-------------------------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;minimal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;include_lib&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;wx/include/wx.hrl&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]).&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;compile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;export_all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;Wx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;batch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;create_window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Wx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nn&quot;&gt;wxWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nn&quot;&gt;wx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;destroy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;ok&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;create_window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Wx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wxFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Wx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Minimal wxErlang App&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;600&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;400&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}}]),&lt;/span&gt;

    &lt;span class=&quot;nv&quot;&gt;Path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dirname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;which&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;?MODULE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)),&lt;/span&gt;    
    &lt;span class=&quot;nn&quot;&gt;wxFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setIcon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;nn&quot;&gt;wxIcon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;filename&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;sample.xpm&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))),&lt;/span&gt;

    &lt;span class=&quot;nn&quot;&gt;wxFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;createStatusBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,[]),&lt;/span&gt;
    &lt;span class=&quot;nn&quot;&gt;wxFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;close_window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;

    &lt;span class=&quot;nv&quot;&gt;MenuBar&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wxMenuBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;FileM&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wxMenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([]),&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;HelpM&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wxMenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([]),&lt;/span&gt;

    &lt;span class=&quot;c&quot;&gt;% unlike wxwidgets the stock menu items still need text to be given, &lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;% although help text does appear&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;QuitMenuItem&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wxMenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;FileM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;?wxID_EXIT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;amp;Quit&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;% Note the keybord accelerator&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;AboutMenuItem&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wxMenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;HelpM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;?wxID_ABOUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;amp;About...\tF1&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;

    &lt;span class=&quot;nn&quot;&gt;wxMenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;appendSeparator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;HelpM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;    
    &lt;span class=&quot;nv&quot;&gt;ContentsMenuItem&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wxMenu&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;HelpM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;?wxID_HELP_CONTENTS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;amp;Contents&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nn&quot;&gt;wxMenuItem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;enable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ContentsMenuItem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;enable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]),&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;ok&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wxFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;command_menu_selected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; 

    &lt;span class=&quot;nn&quot;&gt;wxMenuBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;MenuBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;FileM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;amp;File&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nn&quot;&gt;wxMenuBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;MenuBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;HelpM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;amp;Help&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nn&quot;&gt;wxFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setMenuBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;MenuBar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;ok&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wxFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setStatusText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;Welcome to wxErlang!&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,[]),&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;receive&lt;/span&gt; 
        &lt;span class=&quot;nl&quot;&gt;#wx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;#wxClose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{}}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nn&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;~p&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; Closing window &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;~n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()]),&lt;/span&gt;
            &lt;span class=&quot;nn&quot;&gt;wxFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;destroy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ok&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;#wx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;?wxID_EXIT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;#wxCommand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;command_menu_selected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nn&quot;&gt;wxWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;destroy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;ok&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;#wx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;?wxID_ABOUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;#wxCommand&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;command_menu_selected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nn&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Got about &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;~n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]),&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;dialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;?wxID_ABOUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nv&quot;&gt;Msg&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
            &lt;span class=&quot;nn&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Got &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;~p&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;~n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]),&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;after&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nn&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fwrite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;loop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;dialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;?wxID_ABOUT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;Str&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Welcome to wxErlang.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
                       &lt;span class=&quot;s&quot;&gt;&amp;quot;This is the minimal wxErlang sample\n&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                       &lt;span class=&quot;s&quot;&gt;&amp;quot;running under &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                       &lt;span class=&quot;nn&quot;&gt;wx_misc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;getOsDescription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
                       &lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; 
                      &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nv&quot;&gt;MD&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;wxMessageDialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                             &lt;span class=&quot;nv&quot;&gt;Str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                             &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;?wxOK&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;bor&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;?wxICON_INFORMATION&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; 
                              &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;caption&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;About wxErlang minimal sample&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}]),&lt;/span&gt;

    &lt;span class=&quot;nn&quot;&gt;wxDialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;showModal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;MD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nn&quot;&gt;wxDialog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;destroy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;MD&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;So &lt;a href=&quot;http://erlang.org/doc/man/wx.html#new-0&quot; title=&quot;&quot;&gt;new&lt;/a&gt; gets a handle to wx that is used to construct the application. And &lt;strong&gt;if you&amp;#8217;re not running the erlang vm with &lt;span class=&quot;caps&quot;&gt;SMP&lt;/span&gt; enabled here is where it will crash&lt;/strong&gt; with this message:&lt;/p&gt;
&lt;pre&gt;
$ /opt/erlang-R13A/bin/erl -run minimal
Erlang R13A (erts-5.7) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false]

{&quot;init terminating in do_boot&quot;,{not_smp,[{wxe_server,start,0},{wx,new,0},{minimal,start,0},{init,start_it,1},{init,start_em,1}]}}
init terminating in do_boot ()
&lt;/pre&gt;
&lt;p&gt;So run the example like this:&lt;/p&gt;
&lt;pre&gt;
/opt/erlang-R13A/lib/erlang/lib/wx-0.98/examples/minimal$ /opt/erlang-R13A/bin/erl -smp -run minimal -noshell -run erlang halt
&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;/erlang/Screenshot-Minimal-wxErlang-App.png&quot; title=&quot;A screenshot of wx&quot; alt=&quot;A screenshot of wx&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: Just like Mats Cronqvist mentions, I too did &lt;a href=&quot;http://www.erlang.org/pipermail/erlang-questions/2009-March/042471.html&quot;&gt;start over with a fresh untar&lt;/a&gt; after installing the dependencies needed for wx.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>N ways to decrease coupling in software</title>
   <link href="http://noss.github.com/2009/03/15/N-ways-to-decrease-coupling-in-software.html"/>
   <updated>2009-03-15T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/15/N-ways-to-decrease-coupling-in-software</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-15&lt;/p&gt;
&lt;p&gt;Coupling sneaks up on your software project silently. Every quick-fix sums up to a mudball software design, something far from your initial intentions.&lt;/p&gt;
&lt;p&gt;There are a few reasons why software projects grow until they stall, the costs and risks to changing the smallest detail become much too high to make financial sense. These are factors I have observed to play a part:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Bad understanding of high coupling among developers. What it does to the code base and how it makes future software redesigns expensive.&lt;/li&gt;
	&lt;li&gt;Stressed project deadlines where software is shipped that is far from ready quality-wise.  Developers that dont have enough pride in their work to actually produce a good product, or are easily coerced to prematurely saying the software is done.&lt;/li&gt;
	&lt;li&gt;Problems with programming languages and tools.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These points need further explainations.&lt;/p&gt;
&lt;h2&gt;Bad understanding&lt;/h2&gt;
&lt;p&gt;If an accounting package starts out with a good separation of concerns, such as the model-viewer-controller architecture, where the view uses the external interface of the model. That means it will be easy to to add new views for the model, a desktop interface could be replaced or completed with a web based interface. But with inexperienced programmers this clear separation can start to break down, maybe the currently single view implementation, the desktop, passes classes directly to the model, for the model to populate with values. Suddenly the model has coupling with a specific user interface, additional projects do not only bear their own implementation costs, but also the changes to other components.&lt;/p&gt;
&lt;p&gt;This failure to understand problems related to high coupling is often only gained by experience. A focus on writing automatic tests, at small unit-test level or higher automated integration tests, will display where there is coupling. In the above accounting package example, if a test needs to make sure the values are correct in the model, it will quickly be obvious that it is a bad idea to have a coupling to a large user-interface library, it makes writing the test fixture a headache. However, if it is easy to test anyway, it will also not pose a large problem if a different view would be added.&lt;/p&gt;
&lt;p&gt;Automatic tests give direct feedback in how bad any given coupling is. Favouring low coupling.&lt;/p&gt;
&lt;h2&gt;Stressed project deadlines&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;Managment typically want to deliver quickly, because that means money-flow will start. This is understandable and reasonable, that is where the money comes from.&lt;/li&gt;
	&lt;li&gt;Project leaders are typically pressed between demanding managment and vague developers. They want to please everyone, but they know the direction money flows and, rightly so, takes order from managment.&lt;/li&gt;
	&lt;li&gt;Developers do what they do well, and avoid what is ill understood in the project requirements. Requirements are vague or incomplete. They form their own ideas and get to designing and writing software, because that is what they&amp;#8217;re hired to do, not to contact the customer&amp;#8217;s users and see what they need.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Try to get a different customer relation where features are each valued (as in money) by the customer and time-estimated by the developers. Use agile methods with fixed timeframe sprints, where the highest yield features are implemented first. Basically, deliver the smallest and most valuable feature first.&lt;/p&gt;
&lt;p&gt;Make the customer understand that while the aim is to implement a system that is useful after each short sprint, the system might not be useful &lt;em&gt;enough&lt;/em&gt; to actually deploy. The customer needs to take an active part and monitor what is being developed with product prototype demos. Explain that they actually get more for their money because they can make sure they get exactly what they need and not just an interpretation of a boring old requirements document, and that it will not take more time than the traditional: here-is-a-requirements-documents, see-you-in-six-months.&lt;/p&gt;
&lt;p&gt;Implementing no more features than necessary minimizes things that can go wrong.&lt;/p&gt;
&lt;h2&gt;Tool problems&lt;/h2&gt;
&lt;p&gt;The least that is needed is a unit-test framework. All languages have them. All unit-test ought to be used with code-coverage analysis. A code-coverage report is a great way to realize behaviour in the code which has not been tested. The solution is either to test the code or remove the code. Make sure all developers know how to run the unit-test suite and read the results.&lt;/p&gt;
&lt;p&gt;Some languages provide the features needed for low-coupling between parts of the software, but have a big difference in effort in doing the quick way and the correct way. In java it takes quite a lot more typing to create an interface and a class to implement the interface, so it can losen up coupling, instead of calling the class one wants to avoid coupling with. This can be remedied by better editors that are language-aware.&lt;/p&gt;
&lt;p&gt;There are also conceptual &amp;#8220;holes&amp;#8221; with some programming languages. In &lt;acronym title=&quot;object oriented&quot;&gt;&lt;span class=&quot;caps&quot;&gt;OO&lt;/span&gt;&lt;/acronym&gt; programming the synchronous method call is a first-class concept. It is often difficult to break out of habit and implement a asynchronous handover of values between components. It is not impossible but it is simply not something one considers each time values need to be transferred between components. In Erlang, function call and messaging are both first class concepts, so developers will naturally think about what is needed on-a-case-by-case basis. Always using synchronous calls means that you get a coupling on the relative time to complete something (this particular problem always come up in &lt;acronym title=&quot;remote procedure call&quot;&gt;&lt;span class=&quot;caps&quot;&gt;RPC&lt;/span&gt;&lt;/acronym&gt;, each call can easily take 1ms to finish instead of 1ns).&lt;/p&gt;
&lt;p&gt;Also conceptually, a system that produces values does not really need to know who consumes the values. A message-queue based communication channel between components means that you only need to know your queue name, but not where values go or come from. Not many software designs start out this way, it is something implemented first when need arises. For the OO world this is the Observer pattern.&lt;/p&gt;
&lt;p&gt;Programmers that know many programming languages (and their concepts) have a larger potential for making good designs in whatever language they use.&lt;/p&gt;
&lt;p&gt;See also:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;/2009/02/24/software-design-with-low-coupling.html&quot;&gt;Software design with low coupling&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Coupling_%28computer_science%29&quot; title=&quot;computer science&quot;&gt;Coupling&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://misko.hevery.com/&quot;&gt;The testability explorer blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;</content>
 </entry>
 
 <entry>
   <title>Pi day!</title>
   <link href="http://noss.github.com/test/2009/03/14/pi-day.html"/>
   <updated>2009-03-14T00:00:00-07:00</updated>
   <id>http://noss.github.com/test/2009/03/14/pi-day</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-14&lt;/p&gt;
&lt;p&gt;Today is pi day! Because of 3.14 and today&amp;#8217;s date.&lt;/p&gt;
&lt;p&gt;Ok, this was silly. I&amp;#8217;m actually just testing out multiple _posts directories for blogs, and this one is ending up in a different directory than my ordinary feed.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Userspace threading benefit is erased by performance gains over the years</title>
   <link href="http://noss.github.com/2009/03/12/userspace-threading-benefit-is-erased-by-performance-gains-over-the-years.html"/>
   <updated>2009-03-12T00:00:00-07:00</updated>
   <id>http://noss.github.com/2009/03/12/userspace-threading-benefit-is-erased-by-performance-gains-over-the-years</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-12&lt;/p&gt;
&lt;p&gt;Being an Erlang developer it is quite strange to see something like this about &lt;a href=&quot;http://java.sun.com/docs/hotspot/threads/threads.html&quot;&gt;userspace threads in java&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Version 1.1 is based on green threads and won&amp;#8217;t be covered here. Green threads are simulated threads within the VM and were used prior to going to a native OS threading model in 1.2 and beyond. Green threads may have had an advantage on Linux at one point (since you don&amp;#8217;t have to spawn a process for each native thread), but VM technology has advanced significantly since version 1.1 and any benefit green threads had in the past is erased by the performance increases over the years.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So now we know that.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Testing Iserve</title>
   <link href="http://noss.github.com/2009/03/08/testing-iserve.html"/>
   <updated>2009-03-08T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/03/08/testing-iserve</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-08&lt;/p&gt;
&lt;p&gt;I probably broke iserve build-simplicity tonight. I&amp;#8217;m still fumbling with common test. Writing a *_SUITE.erl is simple and straight-forward. What is difficult is to setup common_test cleanly.&lt;/p&gt;
&lt;p&gt;And as it is appreciated that &lt;a href=&quot;http://pokingarounderlang.wordpress.com/2009/03/07/newbie-test-iserve/&quot;&gt;setting up iserve is a newbie delight&lt;/a&gt; it is probably a bad idea to make it difficult to build.&lt;/p&gt;
&lt;p&gt;For now I am going to leave it like this. Hopefully someone can take mercy on me and help me organize the mess I have in my test/-directory.&lt;/p&gt;
&lt;p&gt;PS.&lt;br /&gt;
I think I committed a dependency on &lt;a href=&quot;http://frihjul.net/emock&quot;&gt;emock&lt;/a&gt; as well. Just for the tests though.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Common Test progress</title>
   <link href="http://noss.github.com/2009/03/04/common-test-progress.html"/>
   <updated>2009-03-04T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/03/04/common-test-progress</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-04&lt;/p&gt;
&lt;p&gt;Another day, a little bit wiser than yesterday.&lt;/p&gt;
&lt;p&gt;Apparently other people have been blogging about &lt;a href=&quot;http://streamhacker.wordpress.com/2008/11/26/unit-testing-with-erlangs-common-test-framework/&quot;&gt;erlang&amp;#8217;s common test&lt;/a&gt;. And he&amp;#8217;s much more succinct than me.&lt;/p&gt;
&lt;p&gt;Also: Copying common_test and test_server from the installed erlang, and the version suffixes are already there. I have coverage working on &lt;a href=&quot;http://frihjul.net/emock&quot;&gt;emock&lt;/a&gt;. It just worked. Temporarily I installed common_test like this (current working directory in the emock checkout topdir):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;	&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;mkdir etc etc/log
	&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;etc
	&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;cp -a /opt/erlang-R12B-5/lib/erlang/lib/common_test-1.3.4 .
	&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;cp -a /opt/erlang-R12B-5/lib/erlang/lib/test_server-3.2.4/ .
	&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;./common_test-1.3.4/install.sh &lt;span class=&quot;nv&quot;&gt;$PWD&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;Then run &lt;code&gt;make test&lt;/code&gt; and the coverage reports are there. And that is how far I got tonight.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Wake up!</title>
   <link href="http://noss.github.com/2009/03/03/wake-up.html"/>
   <updated>2009-03-03T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/03/03/wake-up</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-03&lt;/p&gt;
&lt;p&gt;This is probably &lt;a href=&quot;http://esr.ibiblio.org/?p=532#comment-227613&quot;&gt;the funniest thing said in the defence of C++&lt;/a&gt;. Sadly I am not sure it was said with the amount of of irony I read into it.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Wake up, it’s 2008. std::tr1::shared_ptr&amp;lt;&amp;gt; exists, and is readily available.&lt;/p&gt;
&lt;/blockquote&gt;</content>
 </entry>
 
 <entry>
   <title>Initial success with common_test!</title>
   <link href="http://noss.github.com/2009/03/03/initial-success-with-common-test.html"/>
   <updated>2009-03-03T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/03/03/initial-success-with-common-test</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-03&lt;/p&gt;
&lt;p&gt;So I read through the &lt;a href=&quot;http://www.erlang.org/doc/apps/common_test/part_frame.html&quot;&gt;common test userguide&lt;/a&gt; again and also I noticed that &lt;a href=&quot;http://code.google.com/p/scalaris/&quot;&gt;scalaris&lt;/a&gt; uses common_test for its test suites. Equipped with some realistic testing and more insight to common_test I just threw myself into using ct for running my unit-tests.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://www.erlang.org/doc/apps/common_test/install_chapter.html&quot;&gt;most essential part is that you have to install common_test&lt;/a&gt;. It is not difficult or anything.  See my short summary:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Create a temporary dir &lt;code&gt;$SOMEWHERE&lt;/code&gt;.&lt;/li&gt;
	&lt;li&gt;Go ahead and &lt;code&gt;cp -a&lt;/code&gt; common_test and test_server from your erlang source dir.&lt;/li&gt;
	&lt;li&gt;mv common_test to common_test-&lt;span class=&quot;caps&quot;&gt;VSN&lt;/span&gt; where &lt;span class=&quot;caps&quot;&gt;VSN&lt;/span&gt; is whatever common_test/vsn.mk says. In my case it is common_test-1.3.4&lt;/li&gt;
	&lt;li&gt;Do the same process for the test_server directory (by its vsn.mk).&lt;/li&gt;
	&lt;li&gt;run &lt;code&gt;./common_test-VSN/priv/install.sh $SOMEWHERE&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Common test will be storing reports and test-run logs in this directory.&lt;/p&gt;
&lt;p&gt;The simple suite i wrote was this (common_test looks for *_SUITE to find tests):&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iserve_master_SUITE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;ni&quot;&gt;compile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;export_all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;unittest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;unittest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(_&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;Config&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nn&quot;&gt;eunit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iserve_master_test&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;ok&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;Then I ran &lt;code&gt;$SOMEWHERE/priv/bin/run_test -dir ~/src/gits/iserve/test&lt;/code&gt; (it is the dir where my iserve_master_SUITE.erl reside). A quick execution later and I could find a @$&lt;span class=&quot;caps&quot;&gt;SOMEWHERE&lt;/span&gt;/index.html$ file where i could easily browse the generated report.  Running the test suite several times and common_test accumulates historical test results.&lt;/p&gt;
&lt;p&gt;It is a bit annoying that I had to do all these things to start, but in retrospect it did not hurt that much. The important thing is that it did work.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m not quite there with coverage reports yet, nor happy-happy-fun-fun single-command-run-all-tests setup. I feel much more likely that I will get there though.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Erlang coverage integration</title>
   <link href="http://noss.github.com/2009/03/02/erlang-coverage-integration.html"/>
   <updated>2009-03-02T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/03/02/erlang-coverage-integration</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-02&lt;/p&gt;
&lt;p&gt;So I am trying to set up a sweet automatic test setting for an Erlang codebase. The tools are in &lt;span class=&quot;caps&quot;&gt;OTP&lt;/span&gt; already. There is &lt;a href=&quot;http://erlang.org/doc/man/cover.html&quot;&gt;cover&lt;/a&gt; for coverage analysis. There is &lt;a href=&quot;http://erlang.org/doc/man/eunit.html&quot;&gt;eunit&lt;/a&gt; for running unit tests xUnit-style. There is &lt;a href=&quot;http://erlang.org/doc/man/make.html&quot;&gt;make&lt;/a&gt; for compiling.&lt;/p&gt;
&lt;p&gt;But it is not that simple to Just Use It&amp;#8482;. I&amp;#8217;m diving into the source for make.erl to see if there is some hidden feature to make it cover-compile my erl files for me. If it does not, then I will have to use plain old Makefiles to compile instead.&lt;/p&gt;
&lt;p&gt;The slightly frightening application &lt;a href=&quot;http://erlang.org/doc/man/ct.html&quot;&gt;ct&lt;/a&gt; seem to be able to &lt;a href=&quot;http://erlang.org/doc/apps/common_test/run_test_chapter.html&quot;&gt;build and run test suites and generate reports&lt;/a&gt;. There is at least some kind of &lt;a href=&quot;http://erlang.org/doc/apps/common_test/cover_chapter.html#cover&quot;&gt;integration with cover in ct&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I just wish I could find some code that uses Common Test already.&lt;/p&gt;
&lt;p&gt;Oh. And dialyzer should be included in this build process as well.&lt;/p&gt;
&lt;p&gt;Lots of infrastructure setup&amp;#8230; :/&lt;/p&gt;
&lt;p&gt;Update: Perhaps the &lt;a href=&quot;http://code.google.com/p/fwtemplates/wiki/FwTemplateErlangWalkthrough&quot;&gt;extensible build system and a collection of templates&lt;/a&gt; could be what I want.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Firefox's focus keybindings</title>
   <link href="http://noss.github.com/2009/03/01/firefox-focus-keybindings.html"/>
   <updated>2009-03-01T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/03/01/firefox-focus-keybindings</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-03-01&lt;/p&gt;
&lt;p&gt;I have a slight pain in my right shoulder from too much mousing, so I&amp;#8217;m always inclined to to learn keybindings for those short interrupting needs to reach for the mouse.&lt;/p&gt;
&lt;p&gt;As such, the control-l to give focus to the address bar is lovely, and if i press tab, focus moves over to the search field (or, more accurately, the google field :). That is how to google!&lt;/p&gt;
&lt;p&gt;Moving between tabs there is alt-1 to alt-8, which will change to tab 1 through 8. Alt-9 will change to the right-most tab. This pretty much makes it annoying to have more than 9 tabs open. (Oh, and if you develop web sites, please do pay attention to the favicon/shortcut icon. When many tabs are open, the title will be truncated and the icon is the last thing displayed.)&lt;/p&gt;
&lt;p&gt;For in-page searching there is control-f which makes a search panel appear below the page. Pressing control-f while the panel is visible will give the search field in it focus. Pressing escape will hide it. (What I miss here is the ability to find a link in the page and using only key-bindings follow it/open in a new tab.)&lt;/p&gt;
&lt;p&gt;What I have not found so far:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;A way to focus on the page itself. A single keybinding and have focus in the page so I dont have to tab the firefox focus to the page.&lt;/li&gt;
	&lt;li&gt;Moving to adjacent tabs.&lt;/li&gt;
	&lt;li&gt;Opera&amp;#8217;s keyboard-driven link navigation (using arrow keys to move the focus between links, being able to open the focused one).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;PS.&lt;/p&gt;
&lt;p&gt;It is also quite rewarding to open up the keyboard shortcut help in google reader (press ? when the page has focus). Shift-N and shift-P goes up and down in feeds. shift-O will open the focused feed. Plain n and p will move focus between items within a feed, and o will open the focused one.&lt;/p&gt;
&lt;p&gt;Shift-a will mark everything as read in the currently open feed. And j and k are shortcuts to n+o and p+o, that is, move to next/prev and open it.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Testable code means FP</title>
   <link href="http://noss.github.com/2009/02/28/testable-code-means-fp.html"/>
   <updated>2009-02-28T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/28/testable-code-means-fp</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-28&lt;/p&gt;
&lt;p&gt;I just noticed that there are more people that have realized that &lt;a href=&quot;http://www.programmersparadox.com/2008/08/27/oo-side-effect-free-programming/&quot;&gt;OO side-effect free programming&lt;/a&gt; leads to more testable code, and that it is very similar to functional programming. That is pretty much exactly what I said about how &lt;a href=&quot;http://noss.github.com/2009/02/25/writing-unit-tests-is-reinventing-functional-programming-in-non-functional-languages.html&quot;&gt;unit tests make you use functional programming practices&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Today I need to write some test-cases to demonstrate how to use &lt;a href=&quot;http://github.com/noss/emock&quot;&gt;emock&lt;/a&gt; for a realistic code-base. I need to make a convincing argument that it is a Good Thing&amp;#8482; to make your dependencies parametric to startup code. This is because I got this remark earlier today:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;noss: I mean, I don&amp;#8217;t want to code in a way that is enforced by my testing framework, but I want to code and have the framework adapt. (that&amp;#8217;s only possible to a degree, of course)&lt;/p&gt;
&lt;/blockquote&gt;</content>
 </entry>
 
 <entry>
   <title>Unit test aid for Erlang</title>
   <link href="http://noss.github.com/2009/02/27/unit-test-aid-for-erlang.html"/>
   <updated>2009-02-27T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/27/unit-test-aid-for-erlang</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-27&lt;/p&gt;
&lt;p&gt;I noticed &lt;a href=&quot;http://sheyll.blogspot.com/2009/02/erlang-mock-erlymock.html&quot;&gt;erlymock&lt;/a&gt; today. It&amp;#8217;s for mocking dependencies in Erlang so that tests can be performed in isolation.&lt;/p&gt;
&lt;p&gt;I have just studied it briefly, but im not sure this is how I would want to work with mocks in erlang unit tests. I imagine a unit-test that uses something like:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;  &lt;span class=&quot;nv&quot;&gt;GenServerFun&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;
     &lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;do_stuff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;X&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
       &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;X&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
     &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nv&quot;&gt;GenServerMock&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;mock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gen_server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;GenServerFun&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
  &lt;span class=&quot;nn&quot;&gt;gen_server&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;GenServerMock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;do_stuff&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}).&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;This would replace the full gen_server (with the separate module and all the behavior callbacks). Preferably the mock-servers should not need internal state. But it would not be difficult to add.&lt;/p&gt;
&lt;h3&gt;Testing in the small&lt;/h3&gt;
&lt;p&gt;Something is to be said about putting most of your effort into unit tests. A unit test is least fragile. They take the smallest amount of time to develop, and real unit tests should not break if anything else than the code under test is changed.&lt;/p&gt;
&lt;p&gt;The higher you get in testing, the more likely it is that you will break tests when you change things in intended ways.&lt;/p&gt;
&lt;p&gt;PS&lt;br /&gt;
&lt;strong&gt;Not to self&lt;/strong&gt;, maybe I should implement that mocking library, I&amp;#8217;ve got all weekend.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Quick and useful mocking of OTP gen behaviors</title>
   <link href="http://noss.github.com/2009/02/27/quick-and-useful-mocking-of-otp-gen-behaviors.html"/>
   <updated>2009-02-27T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/27/quick-and-useful-mocking-of-otp-gen-behaviors</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-27&lt;/p&gt;
&lt;p&gt;So earlier today I theorized about mocking &lt;span class=&quot;caps&quot;&gt;OTP&lt;/span&gt; gen behaviors.&lt;/p&gt;
&lt;p&gt;This is the resulting project &lt;a href=&quot;http://github.com/noss/emock/tree&quot;&gt;emock: Erlang Mocking&lt;/a&gt;. There is even &lt;a href=&quot;http://github.com/noss/emock/tree/master/doc&quot;&gt;a little bit of documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The code is so tiny that it would probably be no problem to get this added to eunit which is already in &lt;span class=&quot;caps&quot;&gt;OTP&lt;/span&gt; now. I&amp;#8217;ll try to get in touch with the responsible developer there once I use this a bit.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Not so useful, Dear Github</title>
   <link href="http://noss.github.com/2009/02/27/not-so-useful-dear-github.html"/>
   <updated>2009-02-27T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/27/not-so-useful-dear-github</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-27&lt;/p&gt;
&lt;p&gt;This is a little usability problem that keeps annoying me at github. The git repo address that is displayed on the project webpage at github, it has some javascript on it that change the webpage when I select it. The text turns into a textbox, to help me cut and paste it.&lt;/p&gt;
&lt;p&gt;Apparently there was &lt;a href=&quot;http://github.com/blog/341-copy-and-paste-is-so-yesterday&quot;&gt;something wrong with the clone urls&lt;/a&gt; which made it worth to add those icons to do heavy duty select-and-paste work for me.&lt;/p&gt;
&lt;p&gt;But&amp;#8230; no.&lt;/p&gt;
&lt;p&gt;It doesnt work.&lt;/p&gt;
&lt;p&gt;That technology copies into the selection buffer. I need to mark ordinary text so i can paste it into an xterm. I use the traditional xorg xterm without silly menues. Middle button pastes from the X cut buffer.&lt;/p&gt;
&lt;p&gt;It would work better if it just printed out the git repo address as plain text and added the href links after it.  (Perhaps some margins around the text so that it is easier to aim.)&lt;/p&gt;
&lt;p&gt;Ohh! And github would do well if it removed some javascript magic. On my slow machine I often get asked by firefox if I want to continue running the long-running scripts on github pages. Which also have the even more annoying affect that all my firefox tabs dont render while firefox is bogged down.&lt;/p&gt;
&lt;p&gt;PS. Dont get me wrong github. I&amp;#8217;m addicted to you. I should seriously look into paying even though you have such a good free plan.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Lessons learned in Software Testing</title>
   <link href="http://noss.github.com/2009/02/26/lessons-learned-in-software-testing.html"/>
   <updated>2009-02-26T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/26/lessons-learned-in-software-testing</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-26&lt;/p&gt;
&lt;p&gt;Today I left work early, the electric power went out at 2 PM. To have something to excuse myself for leaving early I brought a book from the company library (actually, a single shelf :). The title is &lt;a href=&quot;http://www.amazon.com/Lessons-Learned-Software-Testing-Kaner/dp/0471081124&quot;&gt;Lessons learned in Software Testing&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Scanning it quickly it seemed to have some valuable insights, that is why I brought it with me. After reading a good part of it, I think that if you work with QA / Testing of software this is a must-read. Now, I&amp;#8217;m a programmer, but I like food for thought in how to make software engineering better.&lt;/p&gt;
&lt;p&gt;The first thing I learned from the book is that I am not a very good tester. I do optimistic testing. I only check that things when used as intended do sensible things. That is of course useful, but, testing how things work when used in different ways than intended is often more interesting.&lt;/p&gt;
&lt;p&gt;There are 11 Chapters with small page-sized lessons:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;The role of the tester&lt;/strong&gt;: Some career advice. What arguments to take and not. What responsibilites to reach for and to avoid.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Thinking like a tester&lt;/strong&gt;: Some self-reflection on your thinking. Makes you know what happens in your brain.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Testing Techniques&lt;/strong&gt;: Basically good names and classification so you can talk about various methods and attack angles on testing.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Bug Advocacy&lt;/strong&gt;: A lot about how to communicate bugs with others. How to use tools. How processes around bug reports are to be handled.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Automating Testing&lt;/strong&gt;: This is the chapter that made me take the book with me. I&amp;#8217;m working on an internal project to introduce more automated testing at work. Developers and QA have been brainstorming and exchanging knowledge for very many meetings now. So I have spent a lot of thought on what automated testing is good for. I think this is why that the 39 lessons on these 32 pages all made me think &amp;#8220;AH! Why didn&amp;#8217;t I read this book 6 months ago?&amp;#8221;. If you&amp;#8217;re starting a strategy for automated testing, this is a must-read.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Documenting Testing&lt;/strong&gt;: I haven&amp;#8217;t read this far yet. Nor anything after it.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Interacting with Programmers&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Managing the Testing Project&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Managing the Testing Group&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Your Career in Software Testing&lt;/strong&gt;&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Planning the Testing Strategy&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All in all there are 293 lessons together in the chapters, and that on 245 pages. The way the book is written, one should probably pick it up again and again to compare it to the reality you work in. Some lessons I did not understand now will probably appear much more sensible once I have experienced the situation and the problems.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Writing unit tests is reinventing functional programming in non-functional languages</title>
   <link href="http://noss.github.com/2009/02/25/writing-unit-tests-is-reinventing-functional-programming-in-non-functional-languages.html"/>
   <updated>2009-02-25T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/25/writing-unit-tests-is-reinventing-functional-programming-in-non-functional-languages</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-25&lt;/p&gt;
&lt;p&gt;So yesterday I posted this to the erlang list about &lt;a href=&quot;http://www.erlang.org/pipermail/erlang-questions/2009-February/041969.html&quot;&gt;testable code and functional programming&lt;/a&gt;. The mailing list followups disappointed me, since people just focused on the use of &amp;#8220;academic&amp;#8221;. Maybe that hurt some feelings.&lt;/p&gt;
&lt;p&gt;Today I get up just to see a similar argument about &lt;a href=&quot;http://news.ycombinator.com/item?id=493963&quot;&gt;testable code and functional programming at hacker news&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Hey! Someone submitted my story! This is a big day for me. :)&lt;/p&gt;
&lt;h3&gt;Repeated again:&lt;/h3&gt;
&lt;p&gt;I used to think that I liked erlang programming just because it was&lt;br /&gt;
quite academic, and that this was just a personal preference. But I&lt;br /&gt;
have come to realize that side-effect free programming is easier to&lt;br /&gt;
reason about. Not always easier to write though. Being easier to&lt;br /&gt;
reason about means that I can imagine more execution in my head than I&lt;br /&gt;
can in languages that rebind variables and mutate values. Because&lt;br /&gt;
those destructive changes defines a before-change, and after-change,&lt;br /&gt;
sequence, order, and there are only so many steps one can keep the&lt;br /&gt;
mind without the brain starting to lie to you, filling out the blanks&lt;br /&gt;
without telling you.&lt;/p&gt;
&lt;p&gt;I recently read an article published in idg.se where Erik Stenman of&lt;br /&gt;
kreditor was quoted saying that (something like) java systems grow&lt;br /&gt;
complex over time in a way that Erlang does not as much. This is&lt;br /&gt;
something I experience with Java systems. In Java there is no cost in&lt;br /&gt;
adding more things that keep state. It is said that you just&lt;br /&gt;
encapsulate state it in your object, but that state is not as&lt;br /&gt;
encapsulated as you think. Problems are fixed by adding more things&lt;br /&gt;
with state, and more. and more. Pretty soon you have behavior that&lt;br /&gt;
depends on several hundred mutable variables, and the code-base feels&lt;br /&gt;
hard to grasp, difficult to reason back into previous code execution&lt;br /&gt;
to see the &amp;#8220;big picture&amp;#8221;. It makes architectural fixes more difficult.&lt;br /&gt;
And the problems accelerates, since more quick fixes are added. (I&lt;br /&gt;
really need to get better at describing this.)&lt;/p&gt;
&lt;p&gt;The funny thing is that the &lt;span class=&quot;caps&quot;&gt;OOP&lt;/span&gt; world have found one way to manage the&lt;br /&gt;
complexity and the code-bases that grow ugly: They are using unit&lt;br /&gt;
tests, and practice the art of writing testable code. (&amp;#8220;Testable code&amp;#8221;&lt;br /&gt;
is something that is simple to write unit tests for. )&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;You make it very easy to supply the dependencies to code under test&lt;br /&gt;
need. Avoid things that go out and grab values from global state.&lt;/li&gt;
	&lt;li&gt;You avoid side-effects, and the side-effects you need (database&lt;br /&gt;
updates, writing files etc) you make sure that you perform with a&lt;br /&gt;
layer of indirection so that during tests you can replace the real&lt;br /&gt;
object with (for example) a do-nothing mock.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What they are doing is that they are making as much of their code as&lt;br /&gt;
possible to be side-effect free and placing all that code in one&lt;br /&gt;
method so it can be called from a unit test. They are concentrating&lt;br /&gt;
side-effects to well-defined places, carefully avoiding mixing&lt;br /&gt;
side-effects and testable/test-worthy logic.&lt;/p&gt;
&lt;p&gt;What they are doing is that they&amp;#8217;re reinventing functional programming.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PS&lt;/strong&gt;&lt;br /&gt;
Anyone care to make my argument better or shoot it down?&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Software design with low coupling</title>
   <link href="http://noss.github.com/2009/02/24/software-design-with-low-coupling.html"/>
   <updated>2009-02-24T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/24/software-design-with-low-coupling</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-24&lt;/p&gt;
&lt;p&gt;The idea in dependency injection is that you should depend on an interface instead of a specific implementation. That way the implementation that implement the necessary interface can be injected, facilitating low coupling among components in your software.&lt;/p&gt;
&lt;p&gt;Low coupling is nice for writing testable code, since you can inject your mock/dummy objects that facilitate your test-scenario. Which means you dont have to set up all components of your system for one small test. The test can run in isolation, and perhaps even concurrently with other tests.&lt;/p&gt;
&lt;h3&gt;Where do you draw the line ?&lt;/h3&gt;
&lt;p&gt;But how much should be injected? &lt;strong&gt;I&amp;#8217;m asking since I actually want to know good rules of thumb.&lt;/strong&gt; So far the only thing I have found is (actually I mailed asking Miško, and he had already written this) &lt;a href=&quot;http://misko.hevery.com/2008/09/30/to-new-or-not-to-new/&quot;&gt;To new or not to new&lt;/a&gt;. But I find it to be a bit lacking and not matching with the actual problem situations when coding. It does define the useful adjectives &amp;#8220;Newable&amp;#8221; and &amp;#8220;Injectable&amp;#8221; though! (Read it!)&lt;/p&gt;
&lt;p&gt;The thoughts I have had so far:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;objects that you &lt;code&gt;new&lt;/code&gt;-constructed (Newables) and stored as a member variable in your class, those objects should not escape out from the object. They are your internals and part of the logic. Other code should certainly not have dependencies into your internals.&lt;/li&gt;
	&lt;li&gt;objects passed through the constructor (Injectables) should not escape out from the object either (by escaping i mean to be returned from methods or stored in objects passed to methods), if other objects need them, they should likewise be injected to them at object construction. Feel free to return objects methods on your injectable would return to you though.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This leaves a few remaining objects, such as those that need to be constructed and returned from the method (or passed to an argument object). Lets call them &amp;#8220;Escapable&amp;#8221; objects. If these need injectable objects in the constructor you should resort to something like &lt;a href=&quot;http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/Provider.html&quot;&gt;the guice provider class&lt;/a&gt;. A Provider knows how to construct an object, and it is injected to you. If the Escapable need both injectable and newable it might be an architectural flaw (is it possible for you to pass newable objects post-construction, using setters?).&lt;/p&gt;
&lt;h3&gt;Summary for Erlang&lt;/h3&gt;
&lt;p&gt;Each process in erlang has its own isolated memory. So naturally all your values are internal, and you can only send out snapshots from current values. So it is in a way impossible to let your internals leak out. And Erlang do provide a healthy low coupling between processes. This makes me feel that me and &lt;a href=&quot;http://en.wikipedia.org/wiki/Law_of_Demeter&quot;&gt;The Law of Demeter&lt;/a&gt; agree. Dont touch your friend&amp;#8217;s private parts!&lt;/p&gt;
&lt;p&gt;Injectables in Erlang come in the form of other processes to communicate with. Here the big no-no is to hard code names to registered processes, they should still be injected by args to &lt;a href=&quot;http://www.erlang.org/doc/man/erlang.html#spawn-3&quot;&gt;spawn&lt;/a&gt; or &lt;a href=&quot;http://www.erlang.org/doc/man/gen_server.html#start_link-3&quot;&gt;gen_server&lt;/a&gt; init-args. The registered process is just a convenience for your &lt;a href=&quot;http://www.erlang.org/doc/man/supervisor.html&quot;&gt;supervisor&lt;/a&gt; to get external references when wiring you up. Your automated test wants to supply a mock process there.&lt;/p&gt;
&lt;p&gt;If you need to construct new processes that need injectable closures, the Provider solution from java/guice is potentially a bit dangerous. The natural way would to pass a fun that returns newly spawned processes each time called. But for long running processes it is not safe to hold on to closures from other processes, they can go bad after code upgrades. Instead it would be safer to inject a process that you can ask to construct an object for you.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>A plan for increased productivity</title>
   <link href="http://noss.github.com/2009/02/23/a-plan-for-productivity.html"/>
   <updated>2009-02-23T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/23/a-plan-for-productivity</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-23&lt;/p&gt;
&lt;p&gt;Sometimes it feels like I spend days working and get nothing done. But there is a cure for that.&lt;/p&gt;
&lt;p&gt;The cure is to give your subconcious a chance to forget and drop issues by planning every work task in small, concrete and objectively finishable chunks.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Small, so you can finish it in a few hours at most, which helps the task to be&lt;/li&gt;
	&lt;li&gt;Concrete, so you know what work to put in, there is no vague details or planning to be done, so it is&lt;/li&gt;
	&lt;li&gt;Objectively finishable, and by that I mean that you know when you are done. No looking back to if you could have done a better job or if it was necessary at all etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This always get me into &lt;a href=&quot;http://en.wikipedia.org/wiki/Flow_%28psychology%29&quot;&gt;flow&lt;/a&gt;. Once you are done, you will not have a nagging feeling that you should go back and do something different. Because that is not the rules you have set for yourself. The task was finished because you had defined an objective measurement of what finished meant, and this before you started.&lt;/p&gt;
&lt;h3&gt;Sounds like scrum?&lt;/h3&gt;
&lt;p&gt;Yes it does! Scrum is all about setting up a &amp;#8220;time-box&amp;#8221; and concrete backlog items. With tdd you must have objective goals, because you cant write an automated test for &amp;#8220;attractive gui&amp;#8221; or &amp;#8220;well written documentation&amp;#8221;.&lt;/p&gt;
&lt;h3&gt;How I use this&lt;/h3&gt;
&lt;p&gt;Together with a few entreprenurial friends I have regular meetings where we discuss things to finish, and we each set up a &amp;#8220;sprint backlog&amp;#8221;. Typically we have dinner together during this get-together.&lt;/p&gt;
&lt;p&gt;We work in 2 week sprints. So we have a sprint demo at the end, where we show each other what we have produced, and excuse ourself for what didnt make it and why we failed. This is because there should be some form of shame of not finished what you have taken on.&lt;/p&gt;
&lt;p&gt;Each backlog entry is time-estimated, and continously updated to how many hours left there are on each task. Typically you learn that something is much easier than expected, and other things are much more difficult. I have a google spreadsheet for this if anyone is interested. Nothing fancy really.&lt;/p&gt;
&lt;p&gt;As a guy without kids, and 2.3 training evenings per week, I manage to squeeze out 20h of backlog items while still working 40h weeks.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>A different kind of sadomasochist</title>
   <link href="http://noss.github.com/2009/02/22/a-different-kind-of-sadomasochist.html"/>
   <updated>2009-02-22T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/22/a-different-kind-of-sadomasochist</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-22&lt;/p&gt;
&lt;p&gt;I just read &lt;a href=&quot;http://alumnit.ca/~apenwarr/log/?m=200902&quot;&gt;Programmers and Sadomasochism&lt;/a&gt; and my first reaction was more along the lines of:&lt;/p&gt;
&lt;p&gt;&amp;#8220;Uh&amp;#8230; align=right? Give that div a css-class and style it up using text-align:right in &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;.&amp;#8221;&lt;/p&gt;
&lt;p&gt;I guess I am a different kind of sadomasochist.&lt;/p&gt;
&lt;h3&gt;About &amp;#8220;broken&amp;#8221; html&lt;/h3&gt;
&lt;p&gt;Humans write &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;. The fact that browsers are lenient about mistakes is what made the web succeed (the web as based on http and html). Without it we would never have reached the break-even point where there is just too much useful things contributed to the web to decide to not publish more to it.&lt;/p&gt;
&lt;p&gt;If the web had instead been built on a stricter markup language, lets call it &lt;span class=&quot;caps&quot;&gt;SGML&lt;/span&gt;. Then that format would had just been a historical accident, it had quickly been replaced with a simpler alternative that works better In The Real World&amp;#8482;.&lt;/p&gt;
&lt;h3&gt;Disclaimer&lt;/h3&gt;
&lt;p&gt;As a web developer, you should of course validate your html pages with the &lt;a href=&quot;http://validator.w3.org/&quot;&gt;w3 html validator&lt;/a&gt;. I would avoid the &lt;span class=&quot;caps&quot;&gt;XHTML&lt;/span&gt; doctypes and go for the &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; ones (actually, the transitional/loose one):&lt;/p&gt;
&lt;pre&gt;
  &amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;
  &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&amp;gt;

  &amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
  &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;

  &amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Frameset//EN&quot;
  &quot;http://www.w3.org/TR/html4/frameset.dtd&quot;&amp;gt;
&lt;/pre&gt;
&lt;p&gt;The advantages of using a doctype are two:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;The validator will complain to you about not having one, and produce good results when you have one&lt;/li&gt;
	&lt;li&gt;It trigs something called &amp;#8220;doctype switching&amp;#8221; in browsers, turning them into &amp;#8220;standards compliant mode&amp;#8221; in how they interpret &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; and even &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;. This is especially interesting for IE and how it measures widths of boxes in relation to padding and margin.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;PS&lt;/h3&gt;
&lt;p&gt;I dont much like the use of &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt; for data-exchange either. The format doesnt even have integers, just text required to parse to an integer. How lame is that in data exchange!?&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Testable code drags OOP into Functional Programming</title>
   <link href="http://noss.github.com/2009/02/21/testable-code-drags-oop-into-functional-programming.html"/>
   <updated>2009-02-21T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/21/testable-code-drags-oop-into-functional-programming</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-21&lt;/p&gt;
&lt;p&gt;I think I am on to something about functional programming. Something that will make it easier to explain &lt;acronym title=&quot;Functional Programming&quot;&gt;&lt;span class=&quot;caps&quot;&gt;FP&lt;/span&gt;&lt;/acronym&gt; to someone with their head stuck in object-oriented programming. It takes a certain insight to test-driven design though.  I&amp;#8217;ll try to get my thoughts out on the subject in this long article.&lt;/p&gt;
&lt;p&gt;One of my favourite blog topics is quality and testing. Software engineering produces very complex systems, it is amazing that anything works at all really.  But to allow us to keep up with the ever increasing complexity demands and cost pressure, we need to look at how to improve quality both in the end product, and in the engineering work to produce it.  This is something all software projects feel.&lt;/p&gt;
&lt;h3&gt;Unit tests&lt;/h3&gt;
&lt;p&gt;Google has a &lt;a href=&quot;http://googletesting.blogspot.com/&quot;&gt;testing blog&lt;/a&gt; where &lt;a href=&quot;http://misko.hevery.com/&quot;&gt;Miško Hevery&lt;/a&gt; is brilliant in every post.  I can thank Miško for much of my understanding in the needs of unit testing in Java.  Of course, he writes about Java (and I do Java during day-hours) though my favourite language is Erlang.  This makes me notice what applies to Erlang, and what is unecessary in Erlang. (Oh, and while I&amp;#8217;m dropping links, the rest of my understanding of unit testing Java comes from &lt;a href=&quot;http://crazybob.org/2008/05/guice-google-io.html&quot;&gt;guice&lt;/a&gt;. &lt;a href=&quot;http://docs.google.com/Doc?id=dd2fhx4z_5df5hw8&quot;&gt;Guice tutorial&lt;/a&gt;)&lt;/p&gt;
&lt;h3&gt;Dysfunctional programming?&lt;/h3&gt;
&lt;p&gt;First of, the word &lt;strong&gt;functional&lt;/strong&gt; in FP does not relate to functional/dysfunctional.  It is a made up word using latin suffix &amp;#8220;-al&amp;#8221; which means something relating to, as in (&lt;b&gt;giggle&lt;/b&gt;) anus/anal or vagina/vaginal. Basically, FP is programming related to functions.  But very important: functions as they are known in math. Stone-cold side-effect free ones that map from one set of values to another set of values.  I used to think it was just a bunch of mathematicians that wanted a programming paradigm name to flaunt.&lt;/p&gt;
&lt;p&gt;To actually get unit tests written I can&amp;#8217;t say it better myself: &lt;a href=&quot;http://googletesting.blogspot.com/2008/08/by-miko-hevery-so-you-decided-to.html&quot;&gt;there are no tricks to writing tests, there are only tricks to writing testable code&lt;/a&gt;.  A common pitfall is that your codebase is too monolithic.  Everything seems to depend on each other so you can&amp;#8217;t write a single automated test without having to rig a real &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt; database and make real &lt;span class=&quot;caps&quot;&gt;HTTP&lt;/span&gt; requests, or anything else external.  This is an effect of having hard-coded dependencies that should have been parametric to the code using them.&lt;/p&gt;
&lt;h3&gt;Yay, independence day&lt;/h3&gt;
&lt;p&gt;In java the hard-coded dependencies come from using &lt;code&gt;new&lt;/code&gt; on specific dependant classes and from static methods to get singleton objects. In erlang, they come from calling registered processes.  The solution is the same in both cases. Provide the dependency as a parameter.  In java this means through the constructor, in Erlang it means through the process &lt;code&gt;spawn&lt;/code&gt; parameters (or indirectly through gen_server init args).  This simple practice makes it possible to provide &lt;em&gt;mocks&lt;/em&gt;.  A mock is something that walks and talks like the actual dependency, but behaves in a way that aids in your test.&lt;/p&gt;
&lt;p&gt;Hey, thanks for reading this far.  I&amp;#8217;m getting to the point now!&lt;/p&gt;
&lt;h3&gt;Getting to the point&lt;/h3&gt;
&lt;p&gt;Once you have split your hard dependencies, you can write unit tests on modules. And they all go something like:&lt;/p&gt;
&lt;pre&gt;
  assertEquals(42, theQuestion(&quot;life?&quot;));
&lt;/pre&gt;
&lt;p&gt;Or perhaps I should use a purely functional math function as the example:&lt;/p&gt;
&lt;pre&gt;
  assertEquals(3, sqrt(9));
&lt;/pre&gt;
&lt;p&gt;We are writing our testable code so that we can call the side-effect free parts, parts where we have control of all inputs and can check all outputs.  Writing testable java code means that you focus on making sure you can call pure functions. It just doesnt look that way with all the mocks and abstract classes that your test implements to shield off side-effects.  Underneat it all it is Functional Programming. Or is it just a coincidence?&lt;/p&gt;
&lt;p&gt;Erlang already foster you to write side-effect free code since values are immutable and variables are single assignment.  Erlang is not pure though, since you can still send and receive messages from everywhere in your code.  And you can write or read from ets tables anywere, or access the process dictionary.  Though, interestingly. These non-functional practices are exactly the same thing that makes your code harder to test!  Koinkidink again?&lt;/p&gt;
&lt;h3&gt;Another observation related to concurrency&lt;/h3&gt;
&lt;p&gt;If we look at Haskell, which is a bit more strict about side-effects than Erlang.  In Haskell you can not perform side-effects without the &lt;a href=&quot;http://en.wikipedia.org/wiki/Monad_(functional_programming)&quot;&gt;monad&lt;/a&gt;.  If you were not called with the Monad then you can only return a description of the side-effects you want performed to your caller, until you get to some function that has the Monad and can act on them.&lt;/p&gt;
&lt;p&gt;Well, unless you take the monad with you wherever you go so you can always perform side-effects. That makes Haskell appear like an ugly version of visual basic.  You will be sad and Haskell will be sadder.&lt;/p&gt;
&lt;p&gt;If you stop fighting the language, you will slowly get to think of side-effects as &amp;#8220;costly&amp;#8221;.  You rather accumulate lists of side-effects to be done.  You will device problem solutions that minimizes the checkpoints in your program that need side-effects. Erlang &lt;a href=&quot;http://yaws.hyber.org/&quot;&gt;yaws&lt;/a&gt; is a good example of this programming style. The dynamic page does not tell any http reply object to do anything, instead it returns what should be done to it (such as sending a redirect):&lt;/p&gt;
&lt;pre&gt;
  out(_Arg) -&amp;gt;
      L=&quot;http://www.google.com/search?num=20&amp;amp;hl=en&amp;amp;lr=lang_en%7Clang_sv&amp;amp;q=yaws&quot;,
      {redirect, L}.
&lt;/pre&gt;
&lt;p&gt;You will start to think of side-effects as how they must or must not happen in order. File copying must obviously read the source file before it can write to the destination file. But it is not always that apparent. The logging of a web request must not necessarily happen before the web request itself is replied to. Unless logging of successful reply is needed, but is it? That is an example of what you will think about.&lt;/p&gt;
&lt;p&gt;Much of the speed of Erlang is from removing unecessary ordering of events.  It is so trivial to start a process or ask some other process to do something for you, and then continue with that which must happen in order.  This gives the user that snappy feeling.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>The economy in automated testing</title>
   <link href="http://noss.github.com/2009/02/19/the-economy-in-automated-testing.html"/>
   <updated>2009-02-19T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/19/the-economy-in-automated-testing</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-19&lt;/p&gt;
&lt;p&gt;Before leaving work today I had a small unofficial meeting with my collegues in how we should argue for a large investment in an inhouse project to automate testing. Managment listens to economic reasoning. We developers have a hunch it will be good.&lt;/p&gt;
&lt;p&gt;Is this something you have been through, or was it natural for everyone involved to go for automated testing?&lt;/p&gt;
&lt;p&gt;The arguments we collected are basically along these lines:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;if we write automated tests, we free up manual testing man-hours. Especially since we have different parallell product lines (stable and experimental), and we can easily test on our list of supported platforms,&lt;/li&gt;
	&lt;li&gt;with automated tests we can make more releases per year, which means we&amp;#8217;re more agile in customer-ordered projects,&lt;/li&gt;
	&lt;li&gt;automated tests are better than buying cheap outsourced labour, so we can stay smaller and more high-competence,&lt;/li&gt;
	&lt;li&gt;finally, automated tests is a new kind of testing for us that allow us to find race conditions and deadlocks from long-running tests (plus, while writing them we will likely find new issues other testing was not as effective at finding).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is actually quite difficult to translate the above list into absolute savings in money. It is all very vague and word of mouth that it is a good approach. In the end it is all about optimizing the profit of the product.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>More-Erlang-at-Github WIN!</title>
   <link href="http://noss.github.com/2009/02/18/more-erlang-on-github-win.html"/>
   <updated>2009-02-18T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/18/more-erlang-on-github-win</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-18&lt;/p&gt;
&lt;p&gt;I just noticed that &lt;a href=&quot;http://github.com/klacke&quot;&gt;klacke joined github&lt;/a&gt;. Klacke is the author of yaws, and it seems like yaws is being moved over to git.&lt;/p&gt;
&lt;p&gt;This pretty much means that all the popular erlang web servers/frameworks have moved to git now.&lt;/p&gt;
&lt;p&gt;I really like git, because &lt;acronym title=&quot;distributed version control system&quot;&gt;&lt;span class=&quot;caps&quot;&gt;DVCS&lt;/span&gt;&lt;/acronym&gt; allow you to hack other libraries better. You can clone the original, and commit your fixes locally. When you think changes are good enough to share, you can make your github fork, and push your local git to your clone.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;GIT&lt;/span&gt; makes it practical to change other open source projects, and easier to contribute.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Erlang Hype</title>
   <link href="http://noss.github.com/2009/02/15/erlang-hype.html"/>
   <updated>2009-02-15T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/15/erlang-hype</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-15&lt;/p&gt;
&lt;p&gt;Erlang was released as open source over 10 years ago. In 1998. It did not get much attention at the time. Inside Ericsson Erlang was developed to manage the complexity of phone switches, and meeting the up-time requirements.&lt;/p&gt;
&lt;p&gt;What appealed to me from the start about Erlang was how it seemed to be the product of telecoms people turning software developers, and not the product of software developers turning telecom. It had a completely different attitude toward system quality.&lt;/p&gt;
&lt;p&gt;Most programming languages (or the communities around them) have some kind of mind-share you must get into to really work with the language. When it comes to Forth it is about minimalism. For Lisp it is about language adaption. Etc.&lt;/p&gt;
&lt;p&gt;For Erlang it is about writing systems that can operate for decades. This colors the way you think in Erlang.&lt;/p&gt;
&lt;p&gt;In a decade, your powersupply capacitors can burn up. In a decade your hard drives fail multiple times. In a decade hardware upgrades can/will happen on the running system.  You are programming in the precense of errors. You are programming &lt;span class=&quot;caps&quot;&gt;EXPECTING&lt;/span&gt; them to happen. Because failures &lt;span class=&quot;caps&quot;&gt;WILL&lt;/span&gt; happen if your system runs for a decade. You just dont know when and where, just that it will be costly if your system isnt working.&lt;/p&gt;
&lt;p&gt;The past years Erlang has gained huge traction in &lt;span class=&quot;caps&quot;&gt;USA&lt;/span&gt;. It is known as the language to make good use out of multi-core cpus. Not much else.&lt;/p&gt;
&lt;p&gt;Please dont forget the roots of Erlang. Multi-core scalability and easy clustering are positive side effects. But Erlang is all about robust systems.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Crash-only_software&quot;&gt;Crash-only Software&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Microreboot&quot;&gt;Microreboot&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content>
 </entry>
 
 <entry>
   <title>Article ideas feedback</title>
   <link href="http://noss.github.com/2009/02/15/article-ideas-feedback.html"/>
   <updated>2009-02-15T00:00:00-08:00</updated>
   <id>http://noss.github.com/2009/02/15/article-ideas-feedback</id>
   <content type="html">&lt;p class=&quot;meta&quot;&gt;2009-02-15&lt;/p&gt;
&lt;p&gt;I do not yet know what to use this blog for. It was more that it seemed so simple to start blogging using github pages (and it was!). So I just created it. :)&lt;/p&gt;
&lt;p&gt;Some ideas I have had:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Write short snippets of code and link into the Erlang manual pages for some google linkjuice to them.&lt;/li&gt;
	&lt;li&gt;Review &amp;#8220;Release It!&amp;#8221; from pragmatic programmers, in the context of how the robustness patterns map to Erlang.&lt;/li&gt;
	&lt;li&gt;Write public promises of development, so I dont slack, but get stuff done.&lt;/li&gt;
	&lt;li&gt;Get a steady flow of usage examples for my projects.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What should I prioritize?&lt;/p&gt;</content>
 </entry>
 
 
</feed>
