2009/12/07

asynchronous loops in javascript

(filed under programming)

Javascript, is it nice or is it horrible? The language is very nice: small, concise, both functional and object oriented. The horrible part is that in modern AJAX environments almost everything becomes asynchronous, and the language has no wait/sleep/join mechanism for managing that.

Lately I find myself writing a lot of asynchronous loops, and I devised a pattern for it that is quite nice. To explain the pattern, I will explain currying first.
Currying is a technique in which a function that takes parameters is rewritten into another function which takes less parameters. Some parameters are prefilled.
Example:


function talktoperson(person,message)
{
   alert("I say "+message+" to "+person)
}
	
Function.prototype.curry = function() 
{
     var method = this, args  = Array.prototype.slice.call(arguments); 
  return function() 
  { 
    return method.apply(this, args.concat(Array.prototype.slice.call(arguments))); 
  }; 
};

var TalkToJan=talktoperson.curry("Jan");
TalkToJan("hi"); // will print I say hi to Jan.

Here we see the power of a language in which functions are datatypes, just like numbers and strings are. The curry method works on a function and returns another function which does the same thing but prepends the parameter that was passed to the curry function ("Jan") to the list of parameters.
so to create a new function TalkToJan, I just need to call the curry method with parameter "Jan" on the function talktoperson.

Okay, now lets return to our subject and wonder how we can use this pattern to create asynchronous loops. For simplicity I will assume that the work we need to do is in an array and that we want to loop over that array.

An asynchronous task can be written as a function that gets a callback function as parameter and that calls the callback function when done.

So what did I do? I wrote my task (lets say I wanted to add x to each element in an array) in this way:


function adder(x,arr,index,callback)
{
  // do something here.... for example an addition ...
  arr[index]=arr[index]+x;
  
  // call the callback with the array and the index+1.
  callback(arr,index+1);
}

x (and y,z, whatever...) are the parameters that you need besides the array, the index and a callback function. I put them in front of the parameter list, so that job.curry(x) gives us a function that can do the job just by passing in an array, an index and a callback function.

Now the magic trick:


function RunTasks(callback,task,arr,index)
{
  if (index==null) index=0;
  if (index>=arr.length) callback(arr);
  else {
    task(arr,index,RunTasks.curry(callback,task));
  }
}

What this generic function does is two things. First it checks if we are just starting (and sets the index to 0) or if we're stopping (calls the callback function when done).
After starting and if not stopping, it calls the task, and it curries itself into a callback function for the task.

This way, your task function can simply process array elements, and the generic RunTasks function can be used to run asynchronous functions on an array.

Calling it is really simple:


RunTasks(function (arr) { alert("finished "+arr.join(",")) }, 
   adder.curry(10), [1,2,3,4] ); 

// this will print 11,12,13,14

Of course adding 10 to an array is not really an asynchronous job, but RunTasks will also work fine on a job that truly is asynchronous.

Note: if you have big arrays, you'll need to modify this code to make sure the call stack is not getting too big. This can for example be done by adding window.setTimeout around the call to task in RunTasks.

2009/10/03

New version of Ancient Cities submitted

(filed under ancientcities)

Today I have submitted both the update to Ancient Cities and the Lite version to the App Store.

The earthquakes map is not yet included. It is not finished yet.

But I am pleased with the new high score screen, the possibility to play Easy, Normal, Hard games, and above all: a tutorial level!

2009/09/27

Making music on your iPhone

(filed under iphone)

This is by far the most expensive page in my iPhone start menu. What's even worse: most of this programs I bought this weekend... I just couldn't stop!

Saturday I felt a little bit tired. I have to do a lot of things for the Ancient Cities game, but I felt I needed a week end off.

So instead of dropping all computer related activities completely, I started playing around a little bit. ( And didn't stop for the rest of the weekend, I am completely hopeless...) Friday I had talked to a fried about mod players, and inspired by this conversation I wondered how good iPhone music apps really are.

I tried so many that I think I can do a review. I had Composer and Noise.io and Loopy already bought, earlier. Composer was in fact one of my first apps ever. Because whenever I am on a new platform I allways feel drawn into software about creativity: music tools, drawing software. I learned from composer that not every item in the iPhone store is trustworthy. It is made by a guy who has made hundreds of iPhone apps, and doesn't really finish one of them. The feature set of composer is really promising, but it just will never be finished! Don't buy it!
Noise.io was my second attempt at a music program. After the previous experience I decided to read some reviews. This was on many sites regarded as the first true iPhone synthesizer. And indeed the sound of it seems good, the program has many many options. Instrument parameters can be coupled to a matrix on the touch screen, and to the tilt sensors. But it is a highly complex program and I would never be able to do something really interesting with it. I can only recommend it to a user who already knows synthesizers and who is good at life performing (as the touch screen stuff is mainly aimed at performing, not at sequencing).
Loopy I bought after hearing an podcast about "the making of..." It is a very great working loop recorder on the iPhone. Highly recommended. Also for life performing. (Not for me!!! But I bought it anyways because I was very curious to know more about how this app worked and how it was done).
This weekend I started trying Star piano. It is from the makers of noise.io so I had high expectations about the quality. But the app is a little bit limited. You can create chords with it, and perform them life, or store them in a wav file and open this wav file into other programs. But unfortunately, the ability to only play chords is a little bit too meager. It is also more aimed at life performance than at recording. And there is a lag in the control, which makes that chords don't allways switch exactly when you want it to happen. I cannot recommend this program.
So I looked at something more complex, but not too complex... I found Music Studio. It is a complete solution. You can record many instruments into a sequencer, edit the tracks, and mix a wav file. And yet... it is horrible! It looks as if it is a ported desktop program. Especially the note editing in the sequencer is a real pain in the ... finger. Just not ergonomic enough.
Then I found Piano studio. That's much better. You can define 12 buttons on your screen (in fact you have 5 screens in a song so that makes 60 buttons). A button can contain either a chord, a single note, or a sequence of notes. And then start jamming your piano piece! Works fine if you are great at life performing. I suck. Also the programming of the buttons is a little bit tedious work. But, nevertheless, might be a great tool for someone who can jam on buttons.

After that, I was a little bit tired, and i moved to Bloom. Bloom is not a music creation program, but more a work of art. Co-authored by Brian Eno. You can create ambient music simply by touching the screen. The resulting music sounds much like:... a work of Brian Eno that is slightly modified by you. Highly recommended for a relaxing moment. Not suited for musical production.
Trope is the sequel to Bloom, but it is not as convincing. Euphonics and Star melody are programs that tried to copy the concepts of Bloom into a music production tool. But that just doesn't work! It is very hard to generate much of the music content for the user, and at the same time give the user enough control to create a piece of music that really is his own! All "Star" programs (Noise.io, Star Piano, and Star melody) try to do some automation for the user and have highly original control schemes, but I think only Noise.io has cought a glimpse of the right direction in generative music...

Then I decided that if a sequencer or a piano tool was too hard to find, I might try a drum computer, and I ended up with Beatmaker. Really great. Really good for life performance. Sequencer, once again, sucks - bad editing! Also it is not really possible to enter pitch, so you are stuck with drums and melodic samples (but no true 'notes').
But highly recommended for real drummers who can drum with their fingers on an iphone screen.

Only the very last program I downloaded turned out to be my "winner app"...

The winner is... iSequence.

iSequence is inspired by mod software but nevertheless looks different. The user interface is very much designed for the iphone. What you see is a grid of squares with a piano keyboard under it. The grid is a pattern of notes that is played from left to right. Click a square, enter a note on the piano keyboard, and it is in the square! Really quick editing. Great for drum tracks, but also great for melodies.
I even managed to make a track with a length of 1 minute or something like that. That's not bad for someone like me (no musician at all...)
Highly recommended:
- easy user interface, simple to understand.
- very much control, and very fast editing.
- targeted at an audience that favours composing over life performing. But still might be even usefull for life performance.
- sound quality not as good as beatmaker (who has the best samples) but still very good.

One last word

It is amazing to see the state of the art of iPhone music programs. These little bastards are pretty expensive (compared to other iPhone apps). That is because a great deal of engineering is needed to create a good working synthesizer app on this platform. (composer has bad sound quality, it just plays wav files I think, but all the other apps sounded reasonably well, and some even sounded very good!)
A touch interface really is very inviting to develop new music interfaces for. So much more intuitive to play music on a touch device than on a computer. Already a lot of great music software has arrived! It is only the beginning....

2009/09/20

Youtube movie for ancient cities

(filed under ancientcities)

People asked me to add a tutorial to the game. I like to do that but it will take some time. So for now, I made a youtube movie, which shows some basic controls of the game. Together with the game rules, this should give you an idea how to get started!

2009/09/18

Ancient Cities approved by Apple!

(filed under ancientcities)

Now you can buy my little program! So do me a favour, and quickly head over to App Store and spend 2 dollars if you can afford that.

A new map planned.

Soon, I will be making a lite version for people who don't have 2 bucks or an apple device. The lite version will be pretty boring for those who buy the complete version, as the lite version will only have 2 maps in it.

I am also thinking about some exciting new maps, and I'll try to add one every month or so. To the paid version only of course ;-) and freely available for customers who have already payed. Since I have vulcanoes already in the game, wouldn't it be nice to make an earthquake map... where vulcanoes randomly start throwing out lava?
If you have an idea for a map you'd really like to see in the game, just let me know and I will see what I can do.

2009/08/25

Ancient Cities submitted to Appstore

(filed under ancientcities)

Visitors of this site may remember that I once worked on a game called Miniciv. I made a javascript version, and later on a java version I made that game because I had a love/hate relationship with the game 'civilisation' of Sid Meier. Civilisation is very exciting, but I never liked that it took so many hours to play a game. And that you had to move hundreds of units to do just one move in the play.

Far too much work!

So there was the idea for miniciv: a very minimalistic approach to a strategy game, playable in approximately 15 minutes or so.

And now I have adjusted it for the iPhone. I also renamed it to "Ancient Cities". Actually I liked the sound of the old name somewhat better... but the game doesn't look even close to civilisation so I think it is misleading.

The making of...

It was quite some work to port miniciv to "Ancient Cities". First, the interface had to be redesigned for touch. Then, the javascript game had to be wrapped inside an objective C app. Then the graphics had to be improved. I had to make additional maps, because one map would be boring. I had to do a lot of playing and balancing to test all this levels. I had to make a Highscore list... in al this time i could have played a 100 civilisation games or even more....

But I hope it was worth the effort and am eager to see how much people are going to download it. I decided that for all this effort, a small price should be attached to the program. I hope that does not keep you from downloading it. The money you spend on this program, helps me to convince myself the idea was worth the effort....!

Hopefully soon available

I still have one headache problem to solve. The app file will not upload to apple because of a code signing error. But the entry in the appstore is ready... hope I have this fixed soon...

Update: the headache problem isn't solved. It's probably caused by a wrongly signed static library. But I've made my own UIWebView app and dropped PhoneGap, so the app is submitted now!

Let's hope it doesn't get stuck in the dreaded review process...

2009/07/22

iphone demo

(filed under programming)

I was just playing around with iPhone css animations.
Here is a preliminary demo

2009/01/27

this is just a test

(filed under nwsnewsnieuws)

I'm having some trouble with my rss feeds. This message is just to check if I've fixed it.

england wrote at 2009-07-15 :

2009/01/25

Javascript Safe eval method using Narcissus

(filed under programming)

In my new web project (I will talk about it later... ;-) I need a way to evaluate javascript that is contributed by third party users of the site.

But javascript is fundamentally unsafe, because the browser objects are globally available in javascript. Once you give your users access to add javascripts to your site, they can alter your site completely!
They can steal cookies and crosspost it to their own domain, pull up unexpected html, ... the possibilities for evil hackers are endless.

So, I started to look around for some solutions:

These approaches did not work out. Adsafe was too restricted. It turns out that in order to get safe javascript, you really need to throw a lot of things out. Even the *this* keyword:

  function TryThis(value)
  {
    this.x=value;
    if (this.alert)
    {
      this.alert("Hi I can take control over your window!");
    }
  }

  var o=new TryThis(100); // if you use the function this way
                          // 'this' is just a harmless object.

  // but if you leave out the new keyword..
  TryThis(100);
  // then 'this' points to the browsers window object! 

So AdSafe strips javascript until nothing that I wanted is left in the language. Caja requires java, which I do not want to use. Ruby2js was not very well documented, and seemed more a command line utility than an API usable in the web server. I didn't try really hard to get this running, though, because I prefer that the users can enter javascript and don't have to learn another language for the client side.

Porting Narcissus

But then I thought, if javascript itself is so leaky, wouldn't it be much safer if I just could start a separate javascript interpreter in the browser. And luckily, there is a javascript interpreter written in javascript. It's called, for obvious reasons, Narcissus. So I downloaded it, and discovered that it runs in no single browser at all. This is because the author of Narcissus is also the author of spidermonkey, and he used spidermonkey specific code, that isn't even available in firefox yet.

It took some hours hard debugging (especially to make it work on IE too), but I've got a version running that works on IE, firefox, google chrome. It is a quick and dirty port, not thoroughly tested. Probably deep down it is not 100% compatible with all the language features of javascript.
But for 99.9% compatibility, it will work great. Another disclaimer: at present it uses global objects AND it pollutes your Object.prototype which isn't very nice if you use a lot of javascript libraries.

Running javascript in javascript

It is amazing to see that you can actually run javascript in javascript. Haven't run any performance tests yet, but for short scripts performance looks fine. It is not possible to access browser objects from the narcissus scripts (let me know if you disagree with that). You can expose browser functionality by wrapping it into functions. (Don't wrap it into objects because then they can be readed by the narcissus scripts)
Here's how you use it:


  // to wrap the browser alert function, assign it to the
  // narcissus global object. 
  global.alert=function(s) { 
     window.alert("Narcissus alert:"+s);
  }
  
  // evaluate: script, name, line number.
  // name and line number are for error reporting,
  // but this seems to be broken. 
  evaluate("alert('hello world');",'eval.js',1); 

As you will see, the alert that pops up says Narcissus alert:hello world. So the alert function is no longer the browser alert function, and there is no way you can access any browser object (like window, document, top, history, XMLHTTPRequest...) from the Narcissus script.
I have made a sandbox, where you can try it out.

2009/01/11

AppJet!

(filed under programming)

Appjet is so very cool! It is a service (currently very very alpha) to host a javascript application in the 'cloud'.

Because javascript is my favourite programming language (really really rapid to develop in) I'm very pleased that something like this exists. I've created a little test script: a small webserver, so that I can host a site on appjet instead of just a script. It isn't finished yet, but here you can find my webserver

2008/12/13

Android telefoon programmeren

(filed under programming)

Als je je registreert is de android telefoon is bij google te koop voor $399. Ook al is het geen geweldige telefoon...

Het boeiende aan Android is dat de telefoon in principe te programmeren is (tot op zekere hoogte) zonder ook maar 1 letter code naar het apparaat zelf te verplaatsen.
Dit komt omdat Google Gears in de browser van Android is ingebouwd.

Google Gears kan een website locaal opslaan, een locale database geven en een shortcut. Alles wat je dus nodig hebt voor een eenvoudige Android applicatie is wat html, javascript en een webserver!

Zeer aantrekkelijk.... jammer dat de telefoon een beetje achterloopt met veel huidige topmodellen.

2008/08/09

notebook

(filed under programming)

I created a new application. It is a spectacular web application to create notes. Spectacular because it can also be used when you are not online!
It works with firefox 2.0. Other browsers haven't been tested yet.

It will be soon available for download. You can preview read only version here. The notebook scales if you increase/decrease your browsers font size.

2008/04/27

test

(filed under comics)

It is really nice weather outside and I should not be sitting behind my pc. So after testing if this new image upload feature of my site works, I'll be gone...

I'll use it to keep you updated about my comic.

test wrote at 2008-05-22 :

test

we hebben een spamfilter!
2008/04/20

experiences with laszlo

(filed under programming)

After a long road of searching for the right app/plugin/tool to write a nice image gallery for this blog, which I am currently improving with tons of nice feats, I stumbled upon a programming framework called OpenLaszlo. It is actually the predecessor of the Adobe Flex framework.

If gallery flash/dhtml scripts were extremely difficult to obtain, I would have had a good reason to try out Laszlo. But I've allways longed to do something with flash. I tried sometimes, but was always very frustrated by the fact that flash does not seem to have source code and I never seem to possess a working flash editor.

Laszlo is a flash compiler (it can target to DHTML too). But it is also a framework which makes flash look more like html. Code is notated in xml files. Here is a sample XML file, to give an impression what it looks like:

<canvas>
  <button onclick="vw.toggleSize()" 
          text="Toggle Size" />
  
  <view id="vw" y="30" width="100" height="200" 
        bgcolor="blue" >
    <wrappinglayout spacing="10" xinset="5" yinset="5" />
    <view bgcolor="yellow" width="20" height="20" />
    <view bgcolor="yellow" width="20" height="20" />
    <view bgcolor="yellow" width="20" height="20" />
    <view bgcolor="yellow" width="20" height="20" />
    <view bgcolor="yellow" width="20" height="20" />
    
    <method name="toggleSize">
      var w = this.width;
      var h = this.height;
      this.setWidth(h);
      this.setHeight(w);
    </method>
  </view>
</canvas>

The reason why the code is xml is probably because Laszlo emphasizes declarative code and familiarity with the html/javascript combination. From a technical point of view, XML is a bad choice. The underlying language, javascript, requires you to use symbols like && and >. So this means that you often need CDATA sections to escape the javascript.

The Laszlo experience was enjoyable for me. I feel at home in html and I could instantly program something in Laszlo. But i did not manage to write my gallery in a single afternoon. The framework was too large and there were too many new elements to be that productive.

After one afternoon of laszlo I also have my fundamental doubts about flash and about laszlo. Layout management of flash and text rendering capabilities seem limited, so for rich sites I think plain old dhtml (enhanced with flash if special graphics are needed) is superior. (Perhaps I should try to use Laszlo that way... since it can also target dhtml) But the ajax framework of laszlo... well, it is 2008 now and there are 10 million ajax frameworks out there. And then there is the gui components question... new frameworks need rich gui components. Laszlo provides a gui library, and i was impressed by the clean xml needed to build a form. The look and feel are not very great: it looks ugly and grey in the default look. And the components are not as rich as for example swing components.
Also I suspect the performance of the framework is slower than a java applet would be. I don't have perfomance numbers but this is just my impression after one afternoon of usage.

In Laszlo, objects can have computed properties. For instance: The x coordinate of component 2 is the x coordinate of component 1 plus the width of component 1. Once you resize component 1,component 2 is automagically moved to the right.
JavaFX is clearly inspired by flex (and so by Laszlo), and also has this notion of computed properties. Both microsoft's Silverlight and JavaFX bring desktop gui libraries (microsoft WinForms, swing) to the web environment via a browser plugin.
The future of application building in your browser is ready for a next step. We will see wat it brings...

Meanwhile, I'll still have to make a gallery plugin for my blog.

2008/04/19

een grappige discussie

(filed under meditatie)

Ik ben sinds januari aan het mediteren. Elke week probeer ik een meditatie-bijeenkomst bij te wonen, wat vaak wel lukt maar soms ook niet. De laatste paar weken waren er wat nieuwe mensen bij de meditatie. Een paar studenten, jongemannen die psychologie studeren, zeer intellectueel ingesteld. En een paar meisjes die al aan het werk zijn.

Er ontspon zich een heel grappig gesprek tussen de nieuwelingen in de nabespreking van de meditatie. Een van de meisjes vertelde dat ze het heel fijn vond om te doen, en dat het ook impact had op haar dagelijkse leven.
"Als ik gestresst ben op mijn werk of ik ben geirriteerd dan ga ik ook even dat benoemen en dat helpt me dan weer om er weer wat meer los van te komen." vertelde zij.
Later vroeg een van de intellectuele jongens zich iets af. Hij zei: "Bij meditatie gaat het dus om accepteren wat er is. Maar soms wil je ook wel eens iets doen aan een probleem."
Het meisje sprong hier onmiddelijk op in. "Soms kun je ergens niks aan veranderen." zei ze. "Stel, er staat een heipaal voor mijn deur en ik ga mediteren dan kan ik benoemen dat het heien mij irriteert. En doordat ik het benoemd heb wordt het gelijk al minder irritant."
"Ja," zei onze begeleidster. "Mediteren gaat om het opmerken, om het bewust worden van. Want vaak ben je geirriteerd zonder dat je het zelf weet, en dat is pas echt onprettig. Dan kun je ook niet kiezen hoe je reageert, en dan kun je die irritatie ook moeilijker loslaten"
Nu kwam de hele grappige reactie van de jongen... je zag hem nadenken... en... "je kunt dus problemen onderverdelen in twee categorieen: dingen waar je wat aan kunt doen en dingen waar je niks aan kunt doen..."
Hij was helemaal aan het probleemoplossen, en dat terwijl hij net twee uur achter elkaar de gelegenheid had gehad om niks te doen, alleen maar te zijn. Zo moeilijk kan het voor een beginneling zijn om te herkennen waar het om gaat in de meditatie.
Ook grappig om te merken: ik ben amper drie maanden ver met mediteren en vind deze gedachten van die jongen dus erg lachwekkend, terwijl ik drie maanden geleden precies hetzelfde had kunnen reageren...
Het kan dus heel moeilijk zijn om te herkennen waar het om gaat, maar eenmaal herkend is het eigenlijk niet een heel ingewikkeld iets.

Het voorbeeld van het meisje is misschien ook wel net zo misleidend als de gedachten van de jongen. Doordat zij zo snel insprong op de discussie met haar eigen ervaringen, hoe zij het toepast in haar leven, lijkt meditatie gekoppeld aan niet-handelen. Maar je kunt het combineren met activiteiten: lopen, praten, alles eigenlijk. Iemand als Ghandi laat ook wel zien dat mediteren ook heel erg bruikbaar is als je juist heel erg bezig bent met een concreet doel. Meditatie hoeft dus helemaal niet te betekenen dat je de rest van je leven op een stoel doorbrengt.

Even later vroeg de jongen: "ik dacht dat meditatie ook ging om meester worden van je gedachten, wat valt daar dan over te zeggen?"
Iemand schoot in de lach en zei: "Haha, probeer eerst maar eens te zorgen dat de gedachten niet de meester van jou zijn."
Dat was wel een geestige samenvatting van wat er gebeurd was.

2008/04/19

test minitext

(filed under nwsnewsnieuws)

hmm, dit was een test.

jan wrote at 2008-08-09 :

test

test
2008/04/05

Comicbookedit 1.10 released

(filed under comicbookedit)

There is a new version of comicbookedit. Lots of bugs have been fixed. There are also some great new features:

 

- rotating and flipping figures.

- selecting more than one control-point once you are in editing mode. The selected points also can be rotated and flipped! This can be useful: for example when you draw a leg you can select the lower part of the leg and rotate it without rotating the upper part of the leg.

- easy browsing in grouped figures. Once you have a grouped figure selected, you can press F5. After that you can select and edit parts of the grouped figure. You can also use control-F5 to hide the rest of the drawing temporarily.

 

MMXjjLEnD wrote at 2008-04-23 :

SDsaPlTiwvJsQFpb

3HTrHM <a href="http://dabknwjfqkns.com/">dabknwjfqkns</a>, [url=http://fhqhelhceoxe.com/]fhqhelhceoxe[/url], [link=http://qdiedhszivsj.com/]qdiedhszivsj[/link], http://xfwfaaqihgwi.com/
2008/03/25

New site

(filed under nwsnewsnieuws)

The promised updates for Comicbookedit are still not finished yet. Instead I found myself busy with this website. It really needed a fresh look! I also think this urge of me to rewrite the website has to do with an urge to be more buzzy with content and drawings. I've been drawing a lot the last few months. I am happy to report that there is much progres...

 

Nevertheless, I won't forget to update the program! I'm still planning to have a good working rotation feature, and 90% of that is already built. I find it very hard needed, because re-drawing hands and feet all the time when you move the characters is an awfull lot of work...

2008/03/09

Bernard bedient

(filed under comics)
'Bernard bedient' heeft een heleboel nieuwe pagina's...

matthijs wrote at 2008-06-04 :

Bernard Bedient

Leuk die nieuwe pagina's! Ben benieuwd hoe het verder gaat.
2008/02/20

new release for comicbookedit

(filed under comicbookedit)

It has been a bit quiet on the site. But a lot is happening: I have been working on my comic, and while doing so, I've added some fixes and new functionality to the program.

Soon I'll do an upload, and I hope this will bring the following features:

- better undo/redo support for large documents.

- rotating!

- selecting and moving more than one control points at once.

- perhaps: flipping figures.

So stay tuned for comicbookedit 1.1 which I hope to release somewhere in the next 2 weeks.
2008/01/12

Comicbookedit 1.01

(filed under comicbookedit)
There are some important bugs with multiple pages, and with adding clipboxes to pages. I will upload a fix soon.
2008/01/06

Comicbookedit 1.0!!!

(filed under comicbookedit)

Finally, I made a version 1.0 of comicbookedit. Not that it is ever finished, but I feel it is finished enough now to call it 1.0. 1.0 has a lot of new features:

- build in help

- alignment system, to place two points/figures on one line.

- export to bitmap (only *.png seems to work though) and export bitmap to clipboard

- textboxes can now be invisible, rendering only text

And there is also:

- a nice executable installer! (this is windows only) For people who don't know how to start jar files. It creates menu shortcuts and an uninstaller.

More info and downloads here

2007/06/15

JSpring presentation: Swing and XUL

(filed under programming)

I had this talk on the NLJUG's JSpring event, about SwiXml, a XUL tool that I use to render the GUI in ComicBookEdit (and also in an unreleased java game)

I made a powerpoint presentation and some demo's wich are much alike to my earlier Thinlet demo's.

I liked giving a talk about a technical topic. And I like to do it again, in the future....
2007/06/15

Jan's vijf seconden roem op JSpring

(filed under programming)

Het zit er weer op, Jspring 2007, waar Jan dus zijn eerste 5 seconden roem beleefde door een presentatie te geven over SwiXml, een XUL tool die in ComicBookEdit wordt gebruikt.

De presentatie ging redelijk zoals gepland. In het zaaltje zaten zo'n 70?-100? mensen. Ik wist mijn verhaal binnen de tijd te vertellen. In hoeverre het praatje enige indruk maakte op hoeveel procent van de zaal, vind ik erg moeilijk te beoordelen. Maar er waren genoeg vragenstellers, wat ik als een positief teken beschouw. Helaas kon ik die mensen niet echt de ruimte gunnen die ik zou willen, want ik had mijn presentatie strak af in de maximale tijd. Tijdens het oefenen hield ik altijd een paar minuten over. Het verschil komt vermoedelijk doordat de zaal ook niet op tijd dichtging waardoor de sessie vermoedelijk toch 5 minuten korter was dan volgens 'officiele' tijden. Maar dat is achteraf speculeren... ik zat in een dusdanige tunnelvisie dat ik geen moment op de klok keek. Net zo min als ik de mensen in de zaal echt goed geteld heb.

Ook waren er een paar (maar niet veel) napraters. Gegeven het feit dat elke naprater dubbel telt als je vlak voor de lunch presenteert ;-) denk ik dat al deze dingen er wel op wijzen dat het praatje wel overkwam...

Uiteraard ging 1 van de demo's mis! Dat hoort zo bij een 'officiele presentatie'. Hoe kon dat nu weer? Ik heb de dag van te voren de demo applicatie nog uitgebreid, om de Gridbag- en de menu voorbeelden toe te voegen. Deze eigenlijk niet om ze echt goed te presenteren, maar meer omdat ze gewoon leuk zijn voor achteraf, als mensen de demo file's kunnen downloaden.

Ik had per ongeluk een oudere versie aangepast en deze meegenomen richting JSpring.... very stupid! (En toch weer iets niet getest natuurlijk).

Maar al met al vond ik het presenteren een bijzonder leuke ervaring. Ik ga het nog wel vaker doen. Een bijzonder boeiend onderdeel van de ervaring was ook van te voren in de "artiestenkamer" nog even alles doornemen, en daar andere sprekers te ontmoeten en te zien wat die vlak voor hun presentatie nog deden.

Sommigen zaten heel geconcentreerd te werken. Anderen waren juist heel erg uit op een gesprek. Ikzelf was vooral 'niets aan het doen'. Een soort van mediteren. Mijzelf heel prettig voelen. Ik voelde me inderdaad prettig... kon heel goed alle spanning even loslaten. De spanning kwam vlak van te voren, toen ik de zaal binnen ging, wel weer terug, natuurlijk, maar het was echt merkwaardig hoe rustig ik kon worden, en hoe erg ik ook kon genieten van de stilte, vlak voor die presentatie. Dat moment van stilte zou ik ook niet graag gemist willen hebben!

Ik heb ook nog wat gekletst met de andere sprekers. 1 spreker vertelde mij dat hij het wel vaker doet, en dat hij het heel erg leuk vind, en dat voor hem de uitdaging ook is om voor steeds grotere groepen presentaties te geven.

Dat heb ik nu ook wel een klein beetje... maar tegelijkertijd heeft het spreken-voor-publiek bij mij ook weer de herinnering opgeroepen aan schrijven-voor-publiek. Je kunt, zelfs in een kort artikel, je veel genuanceerder en dieper uitdrukken dan in zo'n 50 minuten praatje ooit zou lukken. Het lukken of niet lukken van de communicatie is veel minder afhankelijk van 1 piekmoment. Daar staat dan weer tegenover dat je met een goed praatje misschien de harten van mensen kunt stelen en daardoor meer overtuigend kunt zijn dan met een goed artikel.

Of ik nu zo'n sterspreker ben dat ik echt de harten van mensen kan stelen... betwijfel ik, maar ik ga het vast nog wel eens vaker proberen, als het zo uitkomt.
2007/05/21

Comicbookedit 0.5 released

(filed under comicbookedit)

It has been a long time since I've updated comicbookedit. In september 2006 I bought a new PDA, and decided to try to write a small drawing program for it. I got hooked into designing a low level drawing program. Soon after september I dropped the "PDA" part, switched back to java, and now... 8 months later, I have worked out this "new drawing program" into a rewrite of comicbookedit.

So, one of the main improvements is that now, you can draw with comicbookedit. (The previous versions you had to paste svg into the editor).

Support for other drawing tools has become less, because this version does not support a decent svg import. But I'll plan to improve that!

I will be back soon with more releases!
2006/07/30

Michel Faber - de Fahrenheid-tweeling

(filed under boeken)

Weinig mensen houden van verhalenbundels. Maar verhalen kunnen wonderschoon zijn, juist omdat ze wat beperkter zijn dan romans.

Denk bijvoorbeeld eens aan verhalen van Toon Tellegen, Roald Dahl, of Belcampo. Allemaal schrijvers die erg kunnen uitblinken in een korte tekst.

Michel Faber kan dat zeker ook. In deze verhalenbundel vind je vaak verhalen die verbluffend simpel van opzet zijn. Verhalen die een slechts een kleine, beperkte gebeurtenis beschrijven, grotendeels realistisch, alhoewel er soms ook een een kleine 'draai' aan de realiteit gegeven is.

De verhalen zijn vaak best wel deprimerend, gaan over probleemmensen in acherstandsgebieden. Drugsverslaafden. Daklozen. Verbroken relaties.

De schrijver sympathiseert altijd wel heel erg met zijn hoofdpersonen en laat ze vaak iets doen om hun eigen leven dragelijker te maken. Soms pakt dat dan helemaal verkeerd uit, doordat de hoofdpersonen al zo'n verknipte kijk op de realiteit hebben dat hun daad de boel alleen maar erger maakt. Maar soms pakt het ook wonderlijk goed uit. En dan is "de Fahrenheid-tweeling" een erg troostvol boek om te lezen, volgepakt met kleine juweeltjes.

Ik zal hier 1 verhaal verklappen, om toch een voorbeeldje te kunnen geven. In 1 van de verhalen lezen we over Manny. Manny is verslaafd aan een computerspel. Hij eet pizza, drinkt cola, en woont op een flat zonder contact met de buren te hebben. Heel zijn leven draait om het spel. Op een avond belt de onderbuurvrouw aan. Zij heeft qua indeling precies dezelfde flat, maar er staan hele andere spullen in. Zij is een alternatieveling, vegetarisch, en ze gelooft in een of andere vage new age achtige religie. Ze belt aan omdat er een muis in haar huis zit.

De twee wereldvreemde personen houden de onderlinge interactie erg kort. Die verloopt ook hoogst houterig. Achteraf vraagt Manny zich nog af of hij toch een versierpoging had moeten doen, omdat hij per slot van rekening een man is en zij een vrouw.

Die versierpoging zou uiteraard weinig kans van slagen hebben tussen twee van die 'eilanden'. Maar toch, ondanks alles, slaagt Manny erin om zijn onderbuurvrouw te helpen met haar muizenprobleem. Aanvankelijk is Manny van plan de muis te doodden. Maar het meisje wil dat niet hebben en dus vangt hij de muis zelfs levend voor haar.

Dan zegt zij dat hij de muis van het balkon (2 hoog) naar beneden moet gooien, volgens haar overleven muizen zo'n val wel. In het aandoenlijke slot van het verhaal lezen we hoe Manny met een zaklantaarn in de bosjes controleert of de muis de val inderdaad ook overleefd heeft...

De bundel staat vol van dit soort hele menselijke verhalen. Het is een absolute aanrader!

2006/07/30

Daniel Pennac - De dictator en de hangmat

(filed under boeken)

Erg grappige boeken zijn best wel moeilijk te vinden. John Irving vind ik zeldzaam grappig. Kan ik nog een ander voorbeeld verzinnen....? Er komt nu even niks naar boven.

Probleem met grappigheid is dat als je er veel van in een verhaal stopt, de verhalen vaak andere, minder oppervlakkige emoties gaan ontberen. En de schrijver gaat ook vaak wel wat zelfgenoegzaam klinken van veel grapjes.

Maar kortgeleden las ik dus "De dictator en de hangmat" van de Franse schrijver Daniel Pennac. Dit is er echt weer eentje!

De plot: een dictator van een zuidamerikaanse bananenreplubiek stelt een dubbelganger aan, omdat hij bang is vermoord te worden. De dubbelganger houdt het een tijdje uit maar besluit dan op zijn beurt ook weer een dubbelganger aan te stellen, die ook weer... enz.

Het verhaal gaat over de dictator, de eerste dubbelganger (die naar Hollywood emigreert omdat hij filmacteur wil worden), en enige andere dubbelgangers.

Het wordt afgewisseld met hoofdstukjes waarin de schrijver over zichzelf vertelt, en hoe hij op het idee gekomen is om de "Dictator en de hangmat" te schrijven.

Die hoofdstukjes zijn af en toe wel erg Frans en postmodern van stijl. Soms wordt het daar iets minder grappig van. Maar over het algemeen genomen is het boek zo grappig dat het beslist de moeite van het lezen waard is!
2006/07/30

Anna Enquist - De thuiskomst

(filed under boeken)

Hoe is het als je als moeder je man en al je kinderen overleeft? En hoe is het om de vrouw van een 18e eeuwse zeeman te zijn, iemand die reizen maakt die vaak jarenlang duren en die lang niet altijd goed aflopen?

Dat zijn de thema's van Anna Enquist's roman "de thuiskomst". Het is het verhaal van James Cook gezien vanuit het perspectief van zijn vrouw.

Anna Enquist is naast schrijfter ook musicus. In een lezing van haar over literatuur en muziek las ik dat ze er naar streeft om literatuur te schrijven die klinkt als muziek.

De emoties van muziek zijn er zeker, het is een intens boek. Muziek wordt als thema het boek binnengesmokkeld: een van de zonen van Cook is in het boek erg musicaal, en diens leraar, de organist Hartland (een van de karakters van het boek die fictief is toegevoegd aan het historische verhaal) speelt voor de moeder een muziekstuk na het overlijden van deze zoon.

"In het tweede gedeelte werd zelfs de baslijn door vertwijfeling getekend. Daarboven vulde de melodie met klaaglijke snikken en uitroepen tot barstens toe de strakke cadans van de maat. Alles daalde, viel, stortte neer.

Toen gebeurde het wonder. Vanuit de diepte kwam de melodie, nu geormd door regelmatige, zekere tonen, gestaag omhoog, gesteund door de stevig meeklimmende bas. Het kwam Elisabeth voor alsof een venster opensloeg en zicht bood op een oneindige weidsheid. Daar zou zij kunnen gaan, met opgeheven hoofd en zonder tranen, in het nesef dat haar oon deze muziek had liefgehad."

Al met al is "De thuiskomst" dan ook beslist geen "echte" historische roman. De karakters voelen vaak een beetje 20e eeuws aan. Wat wel erg goed gelukt is is het leggen van emoties in de tekst. Het boek heet de thuiskomst, en het huis is ook erg belangrijk in het boek. Kleine dingen in het huis roepen steeds weer herinneringen en gevoelens op aan mensen die weggegaan zijn.

Toch heb ik het gevoel dat bovenstaand muziekcitaat uit het derde deel een beetje de kern van de plot blijft... het idee dat je iets met muziek en literatuur samen moet doen.

Dat lukt niet zo. Dit citaat maakte me reuzenieuwsgierig naar over welke muziek het nu eigenlijk ging (Bach), maar het is meer een soort recensie-binnen-een-verhaal dan dat de taal hier nieuwe muziek op zichzelf is.

 

 

2006/02/12

Status update over miniciv

(filed under programming)

ofwel, wat doet zo'n programmeur nou de hele dag?

Skinnen en XUL-layouten (niet dat ik één van die dingen ooit eerder een hele dag gedaan had). Ik kon voor Miniciv kiezen uit

.

Ik heb gekozen voor SWiXML omdat ik dan tenminste makkelijk skins kon krijgen. Een geweldige website hiervoor is javootoo waar ik een degelijke Duitse skin vond, tinyLAF genaamd. Hiermee kon ik lekker op de "golden" tour gaan...

TinyLAF aan de praat krijgen was heel gemakkelijk... maar er ging nog heel veel tijd zitten in het maken van de XUL-file voor Miniciv (ook zichtbaar in de afbeelding...). Het probleem hiermee was dat SwiXML eventuele excepties gaarne voor je afvangt en ze wegtovert. Ik moest bijna een hele dag debuggen in SwiXML voordat ik er achter kwam dat ik GridBagConstraints.LINE_START verkeerd had gespeld. Dat is wel heel jammer aan deze library. Als ie niet open source was geweest had ie nu echt in de prullenbak gemoeten, dan was ik er nooit achter gekomen...

toch blijf ik het nu wel gebruiken... je code blijft er mooi clean van en ik weet ondertussen op welke punten ik problemen van mijn spelfouten kan verwachten...

Ook wel zorgwekkend is wat al die libraries doen met je downloadgrootte .... tot nu toe:

We zitten dus al over de 1Mb, ai...!

2006/01/28

Eindelijk iets nieuws dan - Thinlet XUL Tutorial

(filed under programming)

updated at 2006-02-10

Ik was best wel ziek de afgelopen 2 dagen... maar het bloed kruipt waar het niet gaan kan. Dus gisteravond, toen het net weer een beetje beter ging, eindelijk eens een beloofde update voor de website gemaakt... alweer totaal niet hetgeen ik gepland had... maar ziehier de Thinlet XUL tutorial die zijn eigen source kan tonen, en runnen!

tijs wrote at 2006-02-04 :

comic

wanneer komt de volgende aflevering van de strip?
2005/09/25

Comic Book Editor 0.41

(filed under comicbookedit)

Comicbookedit 0.41 is ready and available. Fixes for two bugs and the new 'embed font' code have been built. You should take a look at the font tag as specified in the xml-format documentation.

 

I am also reconsidering to built code for auto balloon sizing. The embedded font definitions contain kerning tables so I can calculate how much space a text occupies.

 

2005/09/24

Font problem

(filed under comicbookedit)

This week was my first work week after two weeks of holidays and writing the first comics pages... and I discovered that fonts aren't very consistent over different windows machines. Text that at home fitted its box did not do so at work.

 

Even worse: text that shows right in mozilla 1.5 beta (with svg) is larger in IE+Adobe SVG. On the same machine, with the same font files installed!

 

So I will be starting a 'fix'-release and adding embedded-font-support to Comic Book Edit.
2005/09/12

Comic Book Editor 0.4

(filed under comicbookedit)

Comicbookedit 0.4 is released. This is the first version I plan to use for a comic. Although there are no edit commands, you can make a comic by writing the xml by hand and using the program only to examine the results.

 

There also is a new screenshot. It shows some first pictures of my soon-to-be-found-online comic.

 

Releases of comicbookedit will be less frequent from now on, as I will have to divide my time between improving the program and using it.

 

I think that is a great reason for releasing less frequent ;-)
2005/08/29

Comic Book Editor 0.3

(filed under comicbookedit)

Comic Book Editor 0.3 was released today. I am still ahead of schedule, so I implemented part of version 0.4 - some balloon support.

 

Which means that drawing allmost can start...! I will start drawing as soon as version 0.4 is finished and maybe even earlier.

 

Since everything is going so well, I've added some extra features to the plan for release 0.4 which I think will be usefull, such as: balloons that automatically adjust to text size, svg in separate files.

 

2005/08/24

spreadsheet algorithm finished

(filed under programming)

I've finished the spreadsheet algorithm. You can download it by clicking the "some other things" link above.

At work I use it for populating comboboxes. I add two nodes for each combobox. If I have a combobox called "brand" for example, I add a node called brand and a node called pop:brand.

I also specify a relation: pop:brand calculates/defines brand. This relation is nice because changing a combo's population might change its value (this happens if the current value is not in the new population), so if that happens, things which are dependand on the value, brand also need to be recalculated.

Also you can use the calculation event for values to load them during form start up.

Another idea: haven't tried it self yet - you might also have a node state:brand which represent the control-state of the brand combobox. (If it is enabled or disabled).
2005/08/24

About

(filed under about)

Who am I: Jan Tuitman, computer programmer and wanna-be-comic-book-writer

This site: just a creative outlet, not overly organized. But it is 100% made by me.

How to contact:Just press the reply button under this text.

Doeke en Tabe wrote at 2005-12-29 :

MINICIV

Hej,

Dus nu ook met plaatjes....

 

:)

 

Ziet er erg goed uit.

Greetzz..

matthijs wrote at 2006-01-12 :

Ha

Ziet er leuk uit Jan. Ik ga straks je miniciv eens proberen.

 

Kom binnenkort graag een keer bij je langs (of kom hier weer een keer).

 

moi!
2005/08/19

spreadsheet algorithm

(filed under programming)

Some years ago Doeke and I were buzy on a project called wForms. The idea was to make some sort of simplified XFORMS like language that could run in current browsers.

It triggered me to implement the Recalculation sequence algorithm of XFORMS in javascript.

The implementation I made was only accessible via an associated Expression object. You had to make javascript expressions like $a=$b+$c where all $ variables were retrieved from underlying data-objects and the relations were automatically parsed from the expressions. Typical usage:

	ev.AddExpression('a','$b*2+($c-$b)+$d');
	ev.AddExpression('c','$d+$e+$f+4');
	ev.SetData('b',new Value(10));
	ev.SetData('d',new Value(22));
	ev.SetData('e',new Value(1));
	ev.SetData('f',new Value(3));
	ev.Recalc(true);
	DEBUG("RESULTAAT :"+ev.GetValue('a'));

Nowadays, i am yet again triggered to use a spreadsheet algorithm. But I am more minimalistic and better in designing cleaner interfaces (at least, I hope I am). I've written a new implementation that can be far easier coupled to other code because it doesnt have expressions and it doesnt know anything at all about the nodes it calcs. In fact, it just fires an event to do the calcing. This is the synopsis:

/*** Evaluator class **/
/*
   Synopsis:
		var e=new Evaluator();
		 e.addNode('a',['b','d']);// b and d depend on a
		 e.addNode('b',['d']);
		 e.addNode('c',['b']);
		 e.addNode('d',[]);
     e.prepare(); // a master dependancy graph is built.

     e.addCalcEventListener(function(nodeName){});  // listeners that need to trigger/perform the actual calculation.

     e.calc(); // calcs all , based on the masterGraph.
     e.calc([['c']) // calcs only the nodes based on the fact that c is dirty. 

   Asynchronous use:
     TODO.    

*/

I will upload the code soon.

2005/08/07

Comic Book Editor 0.2

(filed under comicbookedit)

Comic book editor 0.2 has been released, one week ahead on schedule. Parts of the file format is documented also in this release. This documentation is also accessible via the web site.

 

2005/08/05

Mijn nieuwe links-page

(filed under nwsnewsnieuws)

Elly's nieuwe site staat nu op mijn nieuwe links pagina.

We hebben http://www.jalbum.net/ gebruikt, een heel vriendelijk foto-naar-album programma. Zo kan mijn zusje nu zelf de albums vervangen of commentaar onder de foto's gaan zetten (dat moet ze nog gaan doen), zonder dat ze iets technisch hoeft te snappen.

2005/07/30

new on tuitman.org: Comicbookedit 0.1

(filed under comicbookedit)

I've followed the open source mantra "release early and release often" and produced a version which does allmost nothing at all ;-)

 

But it is on my site now and, more interesting, it is also my first sourceforge.net project.

 

 

Doekman wrote at 2005-07-30 :

Ding

Zo'n mail interface kan best handig zijn. Ik zou ook zoiets willen hebben, maar dan wil ik er ook een notes queue bij hebben. Nu bewaar ik concept berichten in gmail enzo...

Hans wrote at 2005-07-30 :

Dus...

Goed bezig!

 

Ik heb 'm geprobeerd op de Mac. En inderdaad, hij doet keurig bijna niets. ;-)
2005/06/11

mailend blog

(filed under nwsnewsnieuws)

Ik heb mijn site voor de zoveelste keer leeg gegooid en iets nieuws erop gezet... (Nog steeds op zoek naar de ideale vorm)

 

Deze keer heb ik mijn ervaringen van mijn nieuwe werkplek gebruikt om een nieuw, zeer minimalistisch blog-systeem te programmeren dat ik One Train Trip's Blogging heb genoemd.

 

(Het optimistische idee was natuurlijk dat ik het programma gedurende 1 treinreis zou schrijven... het werden er 3 plus nog wat extra dagen voor debuggen)

 

Het leuke van dit blog is dat ik de blogberichten ook als mailtje kan versturen. Ik hoop daardoor wat regelmatiger en gerichter te kunnen gaan schrijven.

 

Maar don't worry, ik ben niet van plan om mensen te gaan bestoken met onpersoonlijke nietszeggende berichten (zoals deze wel is.........)

 

groetjes van Jan.

mundy wrote at 2005-06-13 :

blogcheck ;)

Hey Jan!

 

Lijkt me leuk als je strip d'r ooit es echt gaat komen!

 

Veel plezier bij't concert!

 

Mundy

Berend Tuitman wrote at 2005-07-10 :

goidaag

Ben je nog niet verder????????????

jan wrote at 2005-07-10 :

jawel...

ik ben veel verder maar dat valt niet zo te zien. De meeste dingen die ik maak publiceer ik niet.

 

Maar er gebeurt juist een hele hoop op dit moment.

Blog menu

about

ancientcities

boeken

comicbookedit

comics

iphone

meditatie

nwsnewsnieuws

programming