Archives of 2005

.NET Framework 2.0 - first impressions

Today Microsoft released .NET Framework 2.0. I already managed to convert this site and homokaasu.org to run on it. I didn't yet install it on the server, though, but got it running on my home computer. It was quite easy, but not as fluent as it could have been. Here are the first problems I've encountered and their solutions.

Extension mapping with build providers

Definition for extension mappings seems to have changed. Fw 2.0 introduces a design called BuildProvider, which take care of compiling the source code for different purposes on a web site. There are build providers for normal pages, user controls, master pages, web services and so on (check the full list at the machine.config file).

In addition to IIS mapping and http handler definition, non-standard extensions must be defined in a third place: inside the compilation tag of the web.config file, like this.

<compilation debug="true" batch="true" batchTimeout="120">
  <buildProviders>
    <add extension=".gas" type="System.Web.Compilation.PageBuildProvider" />
  </buildProviders>
</compilation>

The System.Web.Compilation.PageBuildProvider is the default build provider for aspx files and is used here. In this case, gas files are treated exactly as aspx files.

Creating IHttpHandler instances

For some reason, when creating the pages on the fly for wildcard extensions in this blog application as I previously described, the PageParser class used to create the IHttpHandlers (Page objects) fails with a null reference exception. I tracked the problem with Reflector and it seems that this depends on a new HostingEnvironment class, which is null at this point of the page lifecycle in 2.0.

This could have become nasty, but luckily the solution is quite easy. I noticed that the BuildManager has a method called CreateInstanceFromVirtualPath which appears to be very promising. It has two parameters: string virtualpath and Type requiredBaseType, which sound good, but it returns an Object. I made a guess and replaced...

return PageParser.GetCompiledPageInstance("/scaffold.aspx", Context.Server.MapPath("/scaffold.aspx"), Context);

...with...

return BuildManager.CreateInstanceFromVirtualPath("/scaffold.aspx", typeof(Page)) as IHttpHandler;

...in my PageHandlerFactory class definition and w00t! We get signal!

A bit sloppy though

Technically the framework seems to work well, but the adjoining information (documentation, error messages, comments in config files) is somewhat slipshod. For example, when I heeded this error message...

There is no build provider registered for the extension '.gas'. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is[sic] has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'

...by adding the definition and made very sure the appliesTo attribute was included, I was greeted with the following:

Unrecognized attribute 'appliesTo'. Note that attribute names are case-sensitive.

The end result was that the attribute wasn't needed, in fact, mustn't be there, although the error message and documentation told exactly the opposite.

The SDK documentation has dead links (and a very bland look).

Other noteworthy things

Aww... namespace attribute of @register directive is now case sensitive. Too bad for the sloppy developers who didn't notice the case inconsistency in namespaces and references before this...

MySql Connector/Net works (with MySql 5). Nant works but requires some directory name changes in it's config file. SharpDevelop works and recognizes the new framework automatically.

My multiuser game/chat server works perfectly. Unlike with the web apps, the complier didn't warn about anything obsolete. The server uses threading, xml and tcp-level network objects very extensively so it seems it is the web part of the framework that has experienced the biggest changes.

web.config can be at least partially edited using a new UI in IIS manager.

The only compilation errors I got were from Math.Floor and Math.Ceiling. The compiler could not decide whether the input parameter was a decimal or a double with lines like this: Math.Floor(a/3-1); in which a is an integer so it seems the methods are now more overloaded or the type handling of numbers has changes since this was fixed with return Math.Floor(a/3m-1m); (in which the m in 1m denotes a decimal value).

More experiences with .NET Framework 2.0 definitely coming up at some point - these were the results of the first hour of playing around or so.

Categories: Programming, Web
Posted by Matias at 07.11.2005 21.40 (11 years ago) | 112 comments

Targeting links to new browser windows with valid XHTML 1.1

One of the downsides of completely separating content from layout and programmatical behavious is the removed ability to set link targets so that they open new windows - a surprisingly common problem. In practice, this means that the a tag may not have target attribute in valid XHTML 1.1.

It is possible to include a special module for link targets and thus allow the usage of target, but that is quite a complex way to do such a simple thing. I have found out that a compromise which uses JavaScript (if available) works the best.

The solution is rather simple: by including the onclick attribute with code that opens the window and then returns false, the best behavior can be achieved. The link should also be written in the href attribute, as usual. The false return value of the click handler prevents the browser from opening the URI in href, yet it displays it in the status bar when the link is pointed with the mouse, as everyone expects. Also, browsers without JavaScript disabled can open the link, but it opens to the same window. Below is a simple example how to do it and here how it works: Google.

<a href="http://google.com" onclick="window.open('http://google.com'); return false;">Google</a>

Here is an xsl template for the a element, which outputs xhtml, in which external links (recognized by the fact that they start with http://) open in new windows, but internal links open in the same window.

<xsl:template match="a">
  <xsl:element name="a">
    <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>
    <xsl:choose>
      <xsl:when test="starts-with(@href, 'http')">
        <xsl:attribute name="href"><xsl:value-of select="@href" /></xsl:attribute>
        <xsl:attribute name="onclick">window.open('<xsl:value-of select="@href" />');return false;</xsl:attribute>
      </xsl:when>
      <xsl:otherwise>
        <xsl:attribute name="href"><xsl:value-of select="@href" /></xsl:attribute>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:apply-templates />
  </xsl:element>
</xsl:template>

Another good solution is to programmatically change the link targets after the page has loaded - a script should iterate through the document object tree and change the targets of the a tags encountered. However, in my opinion, as a general rule, it is better to have the actions written explicitely in the document than to change them afterwards. In this case it wouldn't cause any problems, but it would definitely harden the maintaining and debugging of a more complex system.

Categories: Programming, Web
Posted by Matias at 06.11.2005 11.10 (11 years ago) | 429 comments

Veren tytär

The image “http://arje.net/files/surma-cover-small.jpg” cannot be displayed, because it contains errors. I designed cd covers for my friends' band, Surma! The title of the cd is Veren tytär. Bigger version of the cover here.

(Surma is a poetic word for death in Finnish - I believe bane would be quite a good translation. Veren tytär means Daughter of Blood - at least the genre provides the pretext.)

The covers turned out pretty well, although the print quality was not the best possible. As is probably obvious, the covers were heavily (no pun intended) influenced by modern Japanese horror movies, although the gradient map here goes from black to green instead of white. Usage of complementary colours is probably against the mindset of pretty much anyone with even rudimentary knowledge of chromatics but hey, METAL IS ABOUT BREAKING RULES, EVEN CHROMATOLOGICAL ONES!!!!!!!!!!! Teenage rebellion via graphic design.

Get the trollstormingly true Finnish death metal cd from the nicest of the Finnish domains!

Categories: Art, Creations, Music
Posted by Matias at 03.11.2005 20.57 (11 years ago) | 840 comments

Of Games and Fame

Yay! In-depth analysis of the little games I occassionally tinker!

GasGames offers a unique take on casual games as illustrated by its creativity in game design and aesthetics.

Thanks, Jay, for the article! I'm honored - and feel surprisingly institutionalized :). However, here is a point I'd like to make.

The site homokaasu.org was never intended to be a pure gaming site - it's a platform for artistic experiments unlimited by boundaries of good taste or target audiences. We recognize that our audience could be even bigger than the 400000 monthly visitors if the site was tasteless to no extent. For example, The Rasterbator has missed some huge publicity due to other content on the site, but that's a decision we stand behind. (Reminisce your favourite quote about Picasso, creativity and taste now.) So rather than "many of the games are worthy of mention, despite the site they are hosted on", I feel that "many of the games are worthy of mention, because of the site they are hosted on" - in other words: free creativity equals creative outcome.

I just removed the confirmation dialog that used to come up when changing the game - it was a leftover from a time when the game apps were displayed at a much smaller size and I had received some complaints from people who accidentally ended their game. Thanks also for pointing that out.

Categories: Games, Web
Posted by Matias at 21.10.2005 22.26 (11 years ago) | 18 comments

Leading by Example

This is so ironic. Former Miss Finland, drunk driver, Minister of Culture, Tanja Karpela has been caught sporting a pirated Prada bag in Slovenia in a formal occasion. Here's a short summary of selected recent occurrences.

  1. Ms Karpela dubiously rams through a copyright legislation, which (among other malevolent things) makes the receiver of illegally distributed copyrighted material liable even though several experts and committees held this liability too difficult for consumers.
  2. Ms Karpela buys counterfeited goods.
  3. She justifies this:
    It is very hard for an ordinary tourist to know which is genuine and what is not. The distributor of the goods is liable. This is something that copyright legislation still has much room for improvement.
  4. And regrets:
    If the bag really is a copy, I paid way too much for it.

(Quotes and page image from the 20.10.2005 issue of Iltalehti, here is an image of the article)

Our Minister of Culture, the one responsible for copyright issues, who takes pride in "making decisions using intuition", bought pirated item from criminals and explained that it is too difficult to know which goods are genuine. And what she regrets is that SHE PAID TOO MUCH for a pirated bag. I can think of two options which would explain such a conduct: either she has quite opprobrious double standards or she's a downright stupid git. Way to go, Keskustapuolue, backbone of Finland.

Categories: Advocacy
Posted by Matias at 22.10.2005 20.33 (11 years ago) | 950 comments

Developments re Copyright Legislation

Since the Draconian law that everyone here except the representatives of Keskusta (Centre Party) and SDP (Social Democratic Party) hates, has been passed, some quite interesting developments in the field of copyright legislation have occured.

Foulness?

Minister of Culture Tanja Karpela claimed that a document from the European Commission exists, which states that circumventing copy protection for personal use must be forbidden by the member states. However, subsequently she has been unable to show any such document. This implies she has been lying to the Parliament and its committees.

At least five complaints have been made to the Parliamentary Ombudsman about the fact that the civil servant responsible for the preparation of the new law text, Jukka Liedes, has a position in Gramex, one of the main beneficiaries of the new law.

Wide renewal imminent?

This is huge if it is going to happen. Presidential candidate of the Green League, Heidi Hautala, writes in her blog (translation to English by me):

I'm now in the middle of a fascinating correspondence with the Ministry of Justice and I'm going to concentrate on changing the problems of the law following the example made by France and Norway. The Grand Committee wants also that Finland will, during it's EU precidency at the latter half of the next year, let the cat, the completely outdated copyright legislation, out of the bag. Oh, minister Karpela could NOT bring out the "very specific information, black on white on what the directive means and what it does not mean". The x-files were not found, which means the minister spoke to the Parliament against better knowledge. I am waiting for an apology.

Seems that the emails, demonstrations and other campaigning have actually started something. And given that different civic organizations have actually learned the methods of very effective lobbying, chances that something good comes out, are good. I'm reminded of what MEP Alexander Stubb said to the industry lobbyists during the software patent schism:

Your lobbying was miserably bad. The Open Source folk beat you hands down, by 100 to zero.
Categories: Advocacy
Posted by Matias at 20.10.2005 20.45 (11 years ago) | 68 comments

Rasterbator now in Turkish

Now available in Turkish also: The Rasterbator. Thank you, Metin Selcuk.

Categories: Art, Creations, Programming
Posted by Matias at 16.10.2005 18.39 (11 years ago) | 160 comments

Breaking the Copyright Law

For Sale

Katamari Damacy PlayStation 2 game, never published in Europe, bought from Amazon USA and imported to Finland with intention to resell.

How to decrypt DVDs

/*     efdtt.c     Author:  Charles M. Hannum <root@ihack.net>             */
/*     Thanks to Phil Carmody <fatphil@asdf.org> for additional tweaks.    */
/*     Length:  434 bytes (excluding unnecessary newlines)                 */
/*     Usage is:  cat title-key scrambled.vob | efdtt >clear.vob           */
#define m(i)(x[i]^s[i+84])<<
unsigned char x[5],y,s[2048];main(n){for(read(0,x,5);read(0,s,n=2048);write(1,s
,n))if(s[y=s[13]%8+20]/16%4==1){int i=m(1)17^256+m(0)8,k=m(2)0,j=m(4)17^m(3)9^k
*2-k%8^8,a=0,c=26;for(s[y]-=16;--c;j*=2)a=a*2^i&1,i=i/2^j&1<<24;for(j=127;++j<n
;c=c>y)c+=y=i^i/8^i>>4^i>>12,i=i>>8^y<<17,a^=a>>14,y=a^a*8^a<<6,a=a>>8^y<<9,k=s
[j],k="7Wo~'G_\216"[k&7]+2^"cr3sfw6v;*k+>/n."[k>>4]*2^k*257/8,s[j]=k^(k&k*2&34)
*6^c+~y;}}

How to circumvent audio disc copy protection

If the audio disc is protected using MediaMax CD3, press and hold SHIFT when inserting the disc into a Windows machine. Or use Tweak UI to turn off cd autoplay.

Making your Internet operator liable

Only personal use of the following program is allowed by its author. Under no circumstances may companies make copies of the program, especially internet operators in regard to caching.

// utility to copy images from camera
using System;
using System.IO;

class cp {
  public static void Main(string[] args) {
    string TargetDir=@"g:\pics"+System.DateTime.Now.ToString("yyyyMMdd")+@"";
    if(!Directory.Exists(TargetDir)) Directory.CreateDirectory(TargetDir);

    string SourceDir=@"p:\dcim\101msdcf";
    if(!Directory.Exists(SourceDir)) SourceDir=@"o:\dcim\101msdcf";

    string[] Files=Directory.GetFiles(SourceDir);
    int Count=0;
    foreach(string s in Files) {
      Count++;
      string fn=s.Substring(s.LastIndexOf(""));
      Console.WriteLine("copying "+fn+" ("+Count+"/"+Files.Length+")");
      File.Move(s, TargetDir+fn);
    }
  }
}

Posted by Matias at 05.10.2005 20.21 (11 years ago) | 94 comments

Demonstration against the proposed new copyright legislation

Here's a press release which I translated from Finnish (with proofreading help from Brian Peary). The youth organisations of Kokoomus and Vasemmistoliitto backing up the same demonstration - I doubt that has ever happened before. The preparations indicate it will be big. Spread the word.

Demonstration in Helsinki against the new proposed Finnish copyright law

PRESS RELEASE
FOR IMMEDIATE RELEASE

On Tuesday 4th of October 2005 at 13:00 we shall organize a demonstration against the new copyright law in front of the Parliament Building. We invite members of parliament and representatives of the media to come to discuss the proposed copyright law and where our society should be directed in regard to immaterial rights.

Problems of the proposed copyright law

The most integral problems of the copyright law are its producer-orientedness, complexity, and inadequate preparation. The law will expand the rights of the producers significantly and unpredictably in regard to technical protective measures. The position of the consumer has not been given enough thought even though it is exceptionally important when it comes to copyright legislation.

Other fundamental problems with the new copyright law are as follows:

  • The forbiddance to disseminate information on how to deactivate copy protection measures, which goes against our freedom of speech.
  • The forbiddance to distribute information or computer programs that can deactivate copy protection measures.
  • The sales ban in Finland on articles that were originally published outside of the EEA.
  • The law will cause harm especially to Open Source software such as Linux.

It is difficult to understand the law - even experts and those who prepared it are confused and divided in opinion on how the law should be interpreted. The law’s current form has set off an outcry amongst our citizens, but this outcry has had no influence on the actions of our government whatsoever. As compliance to the law would be virtually impossible to oversee, the result will be an unsound piece of legislation.

Our demands

We demand that the parliament abandon the current proposition for the new copyright law and start over the preparation of the law from scratch. The preparation of this law must take notice of consumers’ rights. The legislation must be prepared and managed using better form of governance, taking into account the fundamental rights such as the freedom of speech that are provided to citizens by the constitutional law.

The Committee for Education and Culture ignored the remarks of the Committee for Constitutional Law regarding the problems of the law. We demand that the Committee for Education and Culture state why they failed to take into account the standpoints of the Committee for Constitutional Law. We also demand that the decision-makers explain how freedom of speech and other constitutional rights can be realized in Finland, if the changes demanded by the Committee for Constitutional Law are considered only normative and can be skipped as “baffling” when needed.

We demand that the Minister of Culture Tanja Karpela explain why the opinions of consumer interest groups such as the Consumer Agency and numerous civic organizations were not taken into account sufficiently during the law’s preparation, nor noted in the proposition. We also demand an explanation as to why the Ministry of Education has prepared the law so inadequately, as it contains numerous controversies and unclarities.

We especially hope that the members of parliament give reasons for interpreting the large scale awakening of citizens to oppose the poor quality and distorted law as “terrorization” of the MPs.

In the spirit of representative and conversational democracy we demand that different members of parliament explain their standpoints and indicate that they understand the aspects relating to the complicated copyright legislation. If they are going to vote for the new law, we ask that they will state their reasons and answer our questions in public.

In Helsinki on the 30th of September 2005

Mikko Särelä, researcher
mikko.sarela@iki.fi
040 544 6379

Olli-Poika Parviainen
opp@vihrealiitto.fi
044 548 1861
Vihreiden nuorten ja opiskelijoiden liitto - ViNO ry

Jussi Saramo
jussi@vasemmistonuoret.fi
041 503 4000
Vasemmistonuoret ry

Petteri Oksa
petteri.oksa@demarinuoret.fi
0400 934 257
Sosiaalidemokraattiset Nuoret ry

Tuomas Nurmela
tuomas@kokoomusnuoret.fi
040 542 0009
Kokoomusnuoret ry

Johanna Niku
johanna.niku@keskustanuoret.fi
0400 620 772
Suomen Keskustanuoret ry

Toni Heinonen
toni.heinonen@iki.fi
040 836 1815
Liberaalinen nuorisoliitto ry

Arto Teräs
ajt@flug.fi
050 594 1416
Finnish Linux User Group FLUG ry

Further information (in Finnish):
http://www.masinointi.org/

Categories: Advocacy, Events
Posted by Matias at 01.10.2005 17.53 (11 years ago) | 54 comments

Rasterbator på svenska

Courtesy of Lennart Pettersson, I'm happy to announce the Swedish translation of The Rasterbator. Any speakers of Icelandic willing to complete the coverage for the Nordic countries?

Categories: Art, Creations, Programming
Posted by Matias at 21.09.2005 20.55 (11 years ago) | 47 comments

Stopping a Flash movie completely

As far as I know, there is no direct way to easily stop everything that is going on in a Flash movie, that is, stopping every movieclip. It is a complex task, since the movieclips can be playing or be still or there may be ActionScript events that go on and cause things to move. Even more difficult is to resume the action where it was left so that only those movieclips that were playing will continue and ActionScript events will continue going on.

How to use

Here is some program code that will perform those tasks. However, it is not completely fool proof. It does take into account the following:

  • Play and stop states of different movieclips
  • OnEnterFrame events

But it does not work correctly with the following:

  • Events that are assigned in the first and only frame of a movieclip (they are re-assigned at every frame, this can be resolved by adding a second frame)
  • Timers

The code is easy to use, just copy and paste the code below to the first frame of the movie root and invoke Freeze(); or Defreeze(); when needed. Of course, adding new method to the MovieClip prototype would be nicer, but, alas, this was written for the need to stop everything in the movie.

How does it work

Since there is no easy way to determine whether a movieclip is playing or not, the _currentframe property of every movieclip is saved. Then, on the next onEnterFrame event the _currentframe property is determined to the saved result and if these differ, the movieclip is presumed to be playing. The play state is saved and only those which were playing are defrozen. This means the freeze does not happen immediately but only at the next frame.

The onEnterFrame events, if any, are saved to a temporary variable at freeze. Defreezing reassigns them.

There are recursive functions and infinite loops are bound to occur if there are references from the movieclips to others. These are avoided by checking whether a nested movieclip's _parent is the nestee.

The Code

function SavePlayState(s) {
  s.PreviousFrame=s._currentframe;
  s.PreviousOnEnterFrame=s.onEnterFrame;
  for(m in s) if(s[m]._parent==s) SavePlayState(s[m]);
}

function DoFullStop(s) {
  s.Playing=s.PreviousFrame!=s._currentframe;
  if(s.Playing) {
    s.stop();
    s.onEnterFrame=null;
  }
  for(m in s) if(s[m]._parent==s) DoFullStop(s[m]);
}

function InitiateFullStop() {
  DoFullStop(_root);
  delete onEnterFrame;
}

function DoStart(s) {
  if(s.Playing) {
    s.play();
    s.onEnterFrame=s.PreviousOnEnterFrame;
  }
  for(m in s) if(s[m]._parent==s) DoStart(s[m]);
}

function Freeze() {
  if(_global.FullStopState) return;
  SavePlayState(_root);
  onEnterFrame=InitiateFullStop;
  _global.FullStopState=true;
}

function Defreeze() {
  if(!_global.FullStopState) return;
  DoStart(_root);
  _global.FullStopState=false;
}

_global.FullStopState=false;
Categories: Programming, Web
Posted by Matias at 17.09.2005 22.50 (11 years ago) | 455 comments

Reitti 2000 by bike

I finally managed to complete Reitti 2000 (Route 2000), a 110 km track intended primarily for hiking, but which is also suitable for offroad biking. This was my fourth attempt, the first and second (in 2003 and 2004) where interrupted because I just wasn't fit enough. And the third attempt, a week ago, failed because the rear transmission control wire snapped after 10 kilometers.

There are a few locations where I would suggest temporarily deviations from the official route, if travelling by bike. The square numbers refer to the 2005 edition of the Outdoor map of Helsinki Metropolitan area, in which the Route 2000 is quite prominently marked (larger map on the backside).

  • Square 35 vertical / 94 horizontal. In Lakisto, after the golf club building, there's a golf practicing area on the left followed by one golf course. After that, just before the bigger road, take the parallel bicycle road to the left and after a few hundred meters, take the underpass to the right. Follow this road to lake Majalampi (square 34/93) and along the road on it's eastern shore. After the lake there's a Reitti 2000 signpost pointing to the right (I believe this is not the current route, but a leftover from an older version). Follow the markings and when you get to a road, go right. You'll join the route again in the crossroads at square 32/93. This will avoid several kilometers of forest path, very difficult to bicycle and save an hour.
  • Square 36/84: after Pirttimäki there will be many forest paths in which it's very hard to bicycle. It will be easier to take the road going east from the route. However, should I go again, I wouldn't avert here.

The route is very manageable even with my 24-gear hybrid bicycle, not meant for hardcore cross-country, although I've installed a bit wider and more patterned tyres than those that came with it. Mostly the route is gravel road, which is quite light to travel, although there are lots of very steep hills between Solvalla and Pirttimäki (this area is known as "legendary" amongst offroad bikers).

The trip took 9 hours (including pauses totalling 45 minutes) and the total travelled distance was 117 kilometers. The average speed was 14 km/h. I ate a few smallish rye bread slices, two müsli bars and two chocolate bars. I had 1,5 liters of water which was way too little (I intended to get more water at a camping area along the route, but that was unfortunately closed so I was quite thirsty when I got home - I had dehydrated 2,5 kg).

The nature and scenery along the route is impressive and very diverse (however after 70 kilometers the exhaustion eradicated it's allurement). The route is well planned and marked (however a map is obligatory), courtesy of City of Helsinki Sports Department.

Categories: Gear
Posted by Matias at 08.08.2005 12.37 (11 years ago) | 486 comments

Portugal

Spent ten days in Portugal. Lisbon was a bit irritating, but the quiet northern countryside towns were very nice. Images available in gallery.

Categories: Events, Photography
Posted by Matias at 30.07.2005 11.59 (11 years ago) | 50 comments

The Rasterbator 1.21

The Rasterbator 1.21 is here, containing a few bug fixes and lots of new languages (Croatian, Czech, Danish, Norwegian and Romanian) - thanks to everyone who provided them! Download it (883 kb).

Categories: Art, Creations, Programming
Posted by Matias at 28.07.2005 12.07 (11 years ago) | 524 comments

How Not to Handle Bad Publicity

Herkko Hietanen wrote a reclamation about the bad service he and his companions received at Ravintola Lehtovaara at the beginning of the year 2004. He received no reply and he subsequently blogged the letter. Now, one and a half year later, the restaurant sent him a nastygram demanding that he removes the post from the Internet and pays them 80000 euros for damage.

One of the most tenable sayings that exist is never attribute to malice what stupidity can explain. In this case, unfamiliarity with the workings of Internet communities is probably a more likely case than just plain stupidity. Accordingly, I assume that the restaurant just wanted to get rid of the writing, which appeared as the third search result in Google when searching for "lehtovaara". Resorting to outrageous legal threats just made the situation worse for the restaurant, by several orders of magitude! Probably they just tried to scare Mr. Hietanen, who happens to be an IT lawyer by trade, so in this case the scare factor of the letter may have been largely reduced.

It's not uncommon to find unflattering commentary on any restaurant, hotel or bar, and acute net users surely know that with thousands of customers there is bound to be someone who is not satisfied. I have never been to Lehtovaara, but I do know several restaurants in Helsinki area which I shall never enter again, even though others have praised these very same eating-houses. Had I planned having a dinner at Lehtovaara, I would not have changed my mind based on the writing, since Google provided mostly good reviews.

However, this is completely different. Legal threats tend to get very strong reactions in web communities. For example, boingboing.net grabbed the story using the illustrious headline Helsinki's Lehtovaara: Crappy service and a bullying owner. Without the legal threat, the 1,5 million readers of boingboing (and the few thousands of this site) would never have known about the bad service someone had at the restaurant, let alone it's ways of handling critique - and this is just the first day of the snowball effect that is likely to come! There will be many potential customers who will read about the case and who will choose not to support a restaurant acting thusly.

It's surprisingly common that people just do not understand that criticizing or even scolding posts have much less impact than the bad publicity that results from the attempts to stifle them. Several people will write about this case in their blogs and the likely outcome is that several result pages of Google will have few other issues than the arrogant behavior of the restaurant management. I wouldn't be surprised if some Finnish magazines or news sites wrote about the case, too.

PR stunt of the year, indeed.

Categories: Advocacy, Web
Posted by Matias at 28.07.2005 12.06 (11 years ago) | 268 comments

Rasterbator now in Norwegian

New language in The Rasterbator: Norwegian. Thanks to Terje Moe!

Categories: Art, Creations, Programming
Posted by Matias at 22.05.2005 10.40 (11 years ago) | 97 comments

Complex numbers in ActionScript

Here's a class for handling complex numbers and their basic operations with ActionScript. With minor modification it should work with JavaScript as well. It should be pretty obvious to use by just looking at the source code. Due to lack of operator overloading, there are methods for Add, Subtract, Multiply, Divide and Equals. It's probaly a lot slower than the native Number class/data type.

function Complex(r, i) {
  this.r=r;
  this.i=i;
}

Complex.prototype=new Object();

Complex.prototype.Add=function(im) {
  return new Complex(this.r+im.r, this.i+im.i);
}

Complex.prototype.Subtract=function(im) {
  return new Complex(this.r-im.r, this.i-im.i);
}

Complex.prototype.Equals=function(c) {
  return this.r==c.r && this.i==c.i;
}

Complex.prototype.Multiply=function(im) {
  return new Complex(this.r*im.r-this.i*im.i, this.i*im.r+this.r*im.i);
}

Complex.prototype.Divide=function(im) {
  var c=this.Multiply(im.Conjugate());
  var d=im.r*im.r+im-i*im.i;
  return new Complex(c.r/d, c.i/d);
}

Complex.prototype.Argument=function() {
  return Math.atan2(this.i, this.r);
}

Complex.prototype.Modulus=function() {
  return Math.sqrt(this.r*this.r+this.i*this.i);
}

Complex.prototype.Conjugate=function() {
  return new Complex(this.r, -this.i);
}

Complex.prototype.toString=function() {
  if(this.r==0 && this.i==0) return "0";
  var s="";
  if(this.r!=0) s+=this.r;
  if(this.i>0 && this.r!=0) s+="+";
  if(this.i==1) {
    s+="i";
    return s;
  }
  if(this.i==-1) {
    s+="-i";
    return s;
  }
  if(this.i!=0) s+=this.i+"i";
  return s;
}
Categories: Programming
Posted by Matias at 03.03.2012 07.52 (5 years ago) | 331 comments

The Halcyon Days of System.Threading.Timer

Did installing Windows Server 2003 Service Pack 1 break your multithreaded application? My first guess would be that the application uses a class called System.Threading.Timer, which apparently is something the testing dept. of Microsoft does not care much about.

Quite a few people have encountered the same problem.

This also suggests that since the server is otherwise working perfectly well with SP1, Microsoft is not using .NET Framework very extensively in it's own implementations. Given the complexity of IIS, for example, there's bound to be some kind of timer functionality.

Post-SP1, the following code works only for a minute or so - after that the Timer just stops sending the events. Prior to SP1 the service application and the timer have been running continuously for months.

public Timer ServiceTimer=new Timer(); // System.Threading.Timer

private void OnTimer(Object Source, ElapsedEventArgs e) {
  // ... do the periodical stuff
}

public void StartService() {
  ServiceTimer.Interval=PollInterval;
  ServiceTimer.Elapsed+=new ElapsedEventHandler(OnTimer);
  ServiceTimer.Enabled=true;
}

public void StopService() {
  ServiceTimer.Enabled=false;
}

Fortunately it is quite easy to work around the functionality of the Timer object by creating another thread and using the static Thread.Sleep method, but the workaround done with C# does not use native platform methods directly, so it might be unsuitable for very time-critical purposes. .NET Framework has also another server-type timer, System.Timers.Timer - I'm unsure if that still works in server environment.

Here's how I fixed the timer. Note that there is a significant difference in the behavior, which may be very relevant. In the previous example, the time taken to execute the periodical stuff is excluded from the timer interval, ie. the interval between the start time of executions is constant. In the following, the interval between the executions is a constant.

private Thread TimerThread=null;
private bool Running=false;

private void OnTimer() {
  while(Running) {
    // ... do the periodical stuff
    Thread.Sleep(PollInterval);
  }
}

public void StartService() {
  Running=true;
  TimerThread=new Thread(new ThreadStart(OnTimer));
  TimerThread.Start();
}

public void StopService() {
  Running=false;
}
Categories: Programming
Posted by Matias at 26.06.2005 16.54 (11 years ago) | 190 comments

Preventing deep linking of Flash games

Several times, the Flash-based GasGames have been copied to other, completely unrelated sites or deep linked (the Flash application is embedded directly to another page so that the user has no clue about the origin of the app), of course without authorization. This article is not about copyright issues; suffice it to say that I don't mind people downloading the games and copying them to their friends, but deep linking and displaying advertisements next to the game is not acceptable.

Here are a few countermeasures I have implemented. None of them are completely secure, but they should provide enough of an obstacle so that the potential violators go somewhere else. These tricks are not platform-specific on the server side and they can be adapted to other formats apart from Flash, provided that some browser variables can be accessed programmatically. Some of the tricks rely on certain browser features, which are common, but not everyone has them enabled; they work in most cases nevertheless.

Intermediate page that serves the Flash file

The Flash application is not directly available, ie. it is not under the root directory of the site. Instead of that, there is a script or a page that serves the Flash file if several things check ok:

  • The format of the request parameters is correct. Such a basic thing: always validate parameters!
  • The game is already published. In this case, all the games have a specific time of publication; it's fairly easy to guess if the address of the newst game ends with getgame.gas?26 that there might be a new game at url getgame.gas?27.
  • The referrer is not an external site, or it is empty. Browsers send the referring url with every request. If a link to an external site is clicked from here, there will be a line in the http request that says HTTP_REFERER: http://arje.net. It's quite an easy way to tell if something deep linked. However, some ISPs filter out the referrer from the requests and requests without the referrer are always accepted.
  • The file assigned to the ID number exists. Just to fail gracefully even if someone forgets to copy the file to the server.

If any of the checks fail, the web server sends a response, which redirects the browser to the index page of the games.

Time-dependant hash code

A very effective way to prevent deep linking is to use cryptography. The page containing the Flash application creates a digital signature based on a secret word and the current time (year, month, day, hour and minutes). The signature is appended to the url. This effectively changes the url of the Flash file every minute (or precisely, every other minute; there must be some tolerance to allow requests that were sent at 59 seconds and 99 hundedths of a second of a certain minute and that would get to the server at 00.01 of the next minute).

Framekiller

The index page checks whether it is the outermost frame; this will cause pages linked using frames to load themselves directly to the window. In other words, it kills the other content on the page. This is very simple to accomplish using Javascript:

if(top.location!=location) top.location.replace(location);

English translation: "if the location of the outermost frame is not the location of this page, load this page to top". If the page is outermost, the location of top is the same as the location of the page and nothing is done.

This has quite an interesting effect when combined to the previous methods, since deep linked games open the index page of all the games without the external site. The deep linked game, used to lure people into external site opens the source site and the external site becomes the one providing visitors. (This may have some really bizarre legal issues, I pre-emptively pity the court that needs to judge such a case.)

Url checks in Flash apps

If an external site loads source code to be executed from your site, you get the chance to do quite a lot of different things. In Flash environment, the sandbox security model of Flash prevents anything truly nasty being done (such as delete files), but it provides ways to control the browser of the visitors of the external site.

Before doing anything, all the Flash applications check the source url. If this is in the list of acceptable urls, it proceeds. Otherwise it opens the source site. In ActionScript this is as follows:

var urls=new Array("http://www.homokaasu.org/", "http://homokaasu.org/");
var ok=false;
for(var i=0;i<urls.length && !ok;i++) {
  var u=urls[i];
  if(_url.substr(0, u.length).toLowerCase()==u) ok=true;
}
if(!ok) {
  getURL("http://homokaasu.org","_top");
  stop();
} else {
  play();
}

This will cause the Flash application to stop at the first frame if the url of the game does not begin with any of the urls listed in the first row. A bit more efficient way would be to somehow encrypt the urls. It wouldn't stand decompilation and a lot of scrutiny, but at least it would be effective against direct editing and replacement.

If the url of the game file is not in the list, it opens the front page of homokaasu.org to the outermost frame. Same effect as described previously.

Being nice

The outcome of the previous methods is rather nice. I decided to be kind and just grab the visitors - who quite likely don't even realize what happens.

Being nasty

Of course, it would be as easy to display goatse to visitors of the deep linking site or crash their browser. It would also be it easy to make it seem to visitors that the deep linking site is stretching the boundaries of obscenity or that it causes their browser to crash. It's just the final step that does all this.

Maybe I shouldn't tell this very nasty way to irritate people:

while(true) getURL(_url, "_blank");

The previous line of ActionScript causes the Flash application to open an infinite amount of windows, containing duplicates of the application, which start opening new windows...

Categories: Games, Programming, Web
Posted by Matias at 05.05.2005 20.42 (11 years ago) | 455 comments

Rasterbator now in Romanian

Romanian language file added to The Rasterbator, thanks to Vlad Dumitreanu for the translation!

Categories: Art, Creations, Programming
Posted by Matias at 24.04.2005 18.47 (12 years ago) | 60 comments

Shooting stars

I made a small game for the band of my friend's friends, Apulanta, in which you're - obviously - a maniac who tries to shoot the band members. Maybe not my favourite type of music, but they have a huge audience (the cd went straight to top of the charts) and the game idea was too great to pass. The game was ready a month ago and it should have been published then, at the same time as their new album came out, but for some reasons the promo site for the new album, Kiila, was delayed and it opened last Monday, I think.

My opinion is that the game turned out pretty well: it's honest, naive, tasteless cartoon violence aimed to please the teenaged splatter freak in all of us. Although the graphics (and the entire game concept) are really simple, the gameplay is quite nice, at least if you have fast enough computer. Especially the machine gun has a great feel to it. The people who provided the sounds did quite a good job. And I finally got the chance to try some silly splatter effects with Flash. At least the fans seem to like it.

Here's a direct link to the game if you don't want to go through the site. Try to get to level 3, in which you get the assault rifle and the game gets a lot more fun: dismemberment ensues. If it is too hard, here's a clue: what do people need to move quickly?

Categories: Creations, Games, Web
Posted by Matias at 24.04.2005 18.48 (12 years ago) | 381 comments

Envisaging conurbation

I visited London last week for three days. The trip was work-related so I didn't have very much time for personal escapades, but it was nice to see the climes the coevals of Isaac Newton (with de Dullier of course) had treaded - such as Traitor's Gate, the Monument and White Tower - intertwined with modern urbanity even briefly. Thanks to my hosts, who were extremely hospitable.

Here are some images from the trip, of course almost exclusively the major sights.

Categories: Events, Photography
Posted by Matias at 19.04.2005 22.08 (12 years ago) | 200 comments

Eastertime in Oslo

We were in Oslo during Easter. The idea originated from an advertisement of Inferno Festival, which told that one of the best bands, Arcturus, played there. I had not seen the band before, but the trip was well worth it. Of course, the attandance to the festival expanded into a short holiday.

Here is a quick summary:

  • The show of Arcturus gained a place in my "top3 shows ever" list. The show was even more theatrical than the music. When playing The Chaos Path, there were about 20 actors on stage performing different circus-like things, which fitted the music perfectly. The Rockefeller Music Hall, where the festival was held is quite like Tavastia Klubi, but bigger and with three-level auditorium.
  • No smoking allowed in a club is a great idea, hopefully the ban will come effective in Finland, too
  • The Norweigian hotel breakfasts are obscene (in a gluttonious way)
  • Oslo has a poshy center with gaudy glass buildings and tactless shopping centers and that's where everything and everyone are. Then there are a few quieter shopping streets, and the rest lies in quietude.
  • I would like to live in Grünerløkka

For elaboration, view the images.

Categories: Events, Photography
Posted by Matias at 02.04.2005 23.02 (12 years ago) | 222 comments

Participation in Plan*B for Arkadianmäki

Background

During Autumn 2004, the enactors of Plan*B for Arkadianmäki kindly asked our web community (homokaasu.org) to participate in the project. The project sounded very interesting, hence there was no objections to joining it.

We had meetings and a lot of communication with the project organizers and the guidelines for the project were outlined. The crux of the project was to experiment with alternative ways of indoctrination, expression of opinion and voting.

Our participation came down to that homokaasu.org should provide a question that would be subjected to voting and commenting in Kiasma and the project web site. It was left for the core team of homokaasu.org to determine in which ways this could be accomplished.

Voting system and framework

We chose to explore the relatively unfamiliar and arcane paradigm of gerontocracy and that in terms of participation timespan rather than physical age.

Another important rule established at this point was that the proprietors of the web site would have minimal effect on the content of the votings; they would only provide the framework and the voting system. The content would be entirely user-supplied. (It turned out that one important exception to this had to be made.)

Phase one

The voting system was laid out thusly. In the first phase, effective from 28th November 2004 to 12th December, the registered users could suggest questions. There would be no limitations in the scope or number of the questions, except that they should make at least some sense. The web site included a short introduction to the project (both the big picture and the subproject at the site), what the questions were for and what would happen to them. Registered users could fill in a form that contained the following fields:

  • The question
  • Optional explanation
  • Optional reason for asking this very question

The members submitted about 150 different questions.

Phase two

In the second phase of the project, the members of the community would rank the importance of the questions according to their own set of values.

The aforementioned exception took place here. Since we did not expect that the members would read and rate such a huge amount of questions, we chose 12 questions amongst those suggested. The selection was done without formal rules, using gut feeling: questions that were suggested several times or that were extraordinary in some manner prevailed. However, we included also a few completely different questions just for further experimentation.

The members had drastically inequal number of votes – this was where the gerontocratic principles chosen earlier took form. The amount of votes of a user was the amount of other users that had registered to homokaasu.org after her. At the time of the voting there were about 92000 registered users. The 10000th registered user had 92000-10000=82000 votes. The penultimate registered user had one vote.

The twelve questions were presented to the members with an easy user interface for ranking the importance of the questions. They users should just click on a bar. The system took care of distributing the votes of the user to different questions according to the ratings the user provided.

The balancing of the votings was kept simple. The votes were distributed linearly: the ratings were normalized and the distribution of the ratings was also the distribution of the votes. For example, if rated two questions was rated equally important (and there were no other rated questions), they would both get 50% of the votes. If one question was 100% important, and two questions 50% important, the first question would get 50% of the votes and the latter 25% each.

We expected that not all the members would read and rate all the questions. If the users failed to read the last questions, that would bias the voting in favour of those questions represented earlier. This potential flaw was eliminated by listing the questions in random order to each of the members (they did not appear to shift places; the questions were always in same order for a certain user, but the order was different to that seen by some other user).

There were votes from 500 different members.

Results of the subproject

The question that received the most votes and thus was the question provided for Project*B was

Why the media is not an objective conveyor of information?

An elaboration was included:

Why the media is allowed to influence too much and create distorted impressions of the society? Why nobody complains about it?

The question was asked by homokaasu.org member vanth. The entire list of questions and their votes can be viewed here (though in Finnish only).

Question subjected to public voting

The question was then subjected to voting in Kiasma and the web site of Plan*B similarily to all the other questions.

The answer to the question of homokaasu.org that got the most votes was

Because there is no absolute objective information.

While being arguably correct and true to the word of the question, our view is that it is not true to the spirit: the question was about the influence of media, not about the characteristics of information. Maybe the wording should have been different, or the explanatory text should have been more visible, because the meaning was distorted. Ironic, given the question. The answer was scarcely commented. The comments were mostly about how the personal opinion of both the reader and the writer of a news item effect on the outcome.

The second and third answers,

Business is more important

and

The media is too centralized in Finland

evoked a lot more comments. These strongly featured the notion that all the newspapers and tv and radio channels exist primarily to provide income to their owners. It is cheaper and more convenient to consumers to address things in a light manner.

Other noteworthy answers were

Objective information is either what sells the most (commercial media) or conflicts the least with surrounding information (national broadcasting companies)

and

Media tells about things that interest the greatest mass and evades politically sensitive subjects.

The rest of the answers more or less repeated the notions or content of those presented here.

Selective demographics

Though quite obvious, it is noteworthy that the questions and votes provided by the members of homokaasu.org are not in line with the opinions of the great public. The active members of the site are very specifically selected (even the address of the site filters out certain kind of people very effectively). The selection process is not proactive – anyone can join the community – but reactionary: it is a secondary effect of the content and style of the web site. Also, the existing community certainly has some effect on the persons who choose or decline to join.

No formal research on the subject exist, but it seems that the archetype of an active user of the site has the following rudimentary characteristics:

  • At least some academic education
  • 20-25 years old
  • More politically active than average person
  • Strongly liberal (as opposed to authoritarian – no clear correlance in economic left/right position)
  • Very critical towards mass media

The questions and their importance ratings seem to reflect the characteristics of the typical user rather well.

It is very difficult to conclude anything about the user demographics of the public voting, but it seems that the answers reflected the question and the background.

It is possible that the question reached best those already in fetters with the mass media and provoked them to answer, or that the entire Plan*B project got the best response from a certain, non-representative portion of the population. However, when considering answers and comments to other questions, this does not seem to be the case.

The result

Although the single most voted answer was that objective information does not exist, the similarity of several less voted options is in our opinion more momentous.

We deem that the general public answered to the presented question

Why the media is not an objective conveyor of information?

with the following:

There always exists a trade-off between objectivity and personal or political agenda or economical or other aspirations. The distorting elements cannot be eliminated. When receiving information from any source, this must be considered.

About homokaasu.org

Homokaasu.org is a web site developed to promote artistic experiments. The site features many experimental web applications and projects and interactive and communal elements.

A very important aspect are the users: a community of 98000 registered users (20th March 2005). Usually 10000 of them are active (visit every week) and 1000 very active (visit every other day). The title is based on an urban legend.

There has been features concerning homokaasu.org or part of it in several very prominent media such as the respected newspapers The Guardian and The Independent, the monthly supplement of Helsingin Sanomat (Kuukausiliite) or tv channels such as BBC and ProSieben.

Categories: Advocacy, Art, Web
Posted by Matias at 20.03.2005 21.15 (12 years ago) | 22 comments

The Rasterbator 1.2 released!

The Rasterbator 1.2 is now available! Most notable improvements are several language files and optimized rasterbation algorithm.

In the first month of availability of the standalone version there were 40650 downloads. These include both 1.0 and 1.1, which means the amount of unique downloaders is smaller, but nevertheless, the number is tenfold compared to what I expected.

Categories: Art, Creations, Programming
Posted by Matias at 06.03.2005 11.12 (12 years ago) | 1642 comments

How to Irritate Bandwith Leeching Suckers

Seems that someone is selling rasterbated posters at the German eBay. Selling the posters is fine with me, but I find it a bit irritating that he or she is using the pictures of other users to promote his service and fails to give proper credit. The perpetrator of this deed plainly begs to be punished.

Bandwidth leech as our villain is, simply switching one image residing in this site will provide at least temporary annoyance.

Here are screenshots of the ebay page before and after the image change.

Categories: Web
Posted by Matias at 28.02.2005 21.58 (12 years ago) | 2008 comments

If classical music is boring...

I stumbled upon a most interesting musical work, 9 Beet Stretch, by Leif Inge. It is quite simple, yet ingenious: The 9th Symphony of Ludwig van Beethoven slowed down so that it lasts for 24 hours. The music is not simply slowed down so that the pitch lowers and the music sounds like "vööööyyyyyyy", but there is some advanced mathematics involved and the tonality is retained original; only the timing is altered. The work is available for download here.

About half a year ago I wrote about the experience of listening to band called Esoteric. Listening to 9 Beet Stretch feels surprisingly similar, but when you think about it, the similarity makes sense.

All the primary information - the instantly audible melodies - of the original piece has disappeared. The music is composed entirely of long chords one after another. They are way too long to form a memorable melody, but the structure - secondary information - can be percieved. In fact, the details are more audible than in the original version. Data-wise, and according to my understanding, classical music adheres to very strict rules of structure: the art of composing classical music is to create melodies while still retaining the structure and tonality, so I'm quite sure Beethoven meant to include every bit of information.

So, could you achieve the same effect by slowing down anything, like Mikä sulla on by the revered Antti Tuisku? Most certainly not. Pop music is, almost without exceptions, just about melody and rhythm (and sounds): the primary information. When Risto Asikainen composes a fugue for at least five melodies, I might change my opinion. Of course, the division between classical and pop music is not obvious; there are plenty of simple classical music (such as the works of Johann Strauss, if I remember correctly).

Yes, the title of this entry is ironic. There will be concerts of 9 Beet Stretch - how could I arrange 24 hours of free time?

Categories: Art, Information, Music
Posted by Matias at 27.02.2005 22.27 (12 years ago) | 156 comments

Snow, sky and cables

Snow, sky and cables Snow, sky and cables Snow, sky and cables

Today was a rather sunny day!

Categories: Photography
Posted by Matias at 27.02.2005 21.10 (12 years ago) | 248 comments

Dotage

Everything was just fine and normal until late November, when the phenomena started, at least visibly. The first indication of the series of supernatural occurrences was caused by the cheap, kitchy, decorative christmas lights people hang outside their houses, into trees, porches and fences. I was walking at the countryside and there was very little external light. Strings of little luminiscent dots of multiple colors floated under the heavy clouds in the autumnal darkness, caused by lack of snow as well as lack of light. A gusty wind made them flutter around in their electric leashes. I recall perceiving the extraordinary properties of the christmas lights, but did not take any action back then. In retrospect, I'm glad to confess, there indeed was neither need nor reason to do anything.

I noticed the strangeness in a dark remote location with no other light except those of the christmas decorations. It was my shadow. The shadow cast by the lights upon the ground seemed to have a border, which composed of dots. The interior of the shadows was solid as it ever should be, but the border seemed somehow unnatural. It was like someone had applied a cheap Photoshop filter to the real world, to every moment that passed it. I remember thinking something in the lines that because of the multiple, adjacent light sources there was some kind of bizarre diffraction, which, combined to the texture of the wet, ragged ground and the sporadic wind, caused the pattern to appear... the dots were not immobile: they moved following such complex routes than tracing any singular dot was next to impossible. Then again, it seems like denying the obvious now. I just wanted to be ignorant of what was already happening.

A few days or a week after that I realized that all the outdoor advertisements were strangely visible: I noticed them more easily than before. It was as if they were highlighted in their surroundings. I could not recall anything that was in the images, only the existence of the advertisements, which wasn't that exceptional... I think the same happened with most other printed images also, no matter where they were located or placed, but I'm not that sure, since the flood of information often stifles itself.

New Year's Eve: the first thing that actually alarmed me, making me realize that something was wrong, were the fireworks. They exploded into the familiar, regular pattern. Not that usually assigned to fireworks, but the pattern familiar to me from the countryside abnormality. I didn't see the connection instantly: my first impression was that it was quite amazing that the Chinese manufacturers of the products could control the explosion that well... The exploded pattern was visible for only a few seconds and it expanded rapidly, so it really is no wonder that it was nothing but admired..... The realization hit me only later - the spread of the fireworks were quite similar than the pattern I had seen in the borderline of the shadow. No one else, I reckon, took any notice, at least any which I could have observed... Hence, I was quite uncertain whether the strangeness is emerging from inside or outside of my mind...

I tried to find out whether anyone else had perceived the emerging patterns, but my entire research was to no avail. I could find no reference to the patterns from newspapers or science magazines. I tried even reading heavy tomes discussing the physical properties of light, but it seemed that such a formation of patterns was unfamiliar to everyone. Unfortunately, these strivings were halted by the amplification of the phenomenon...

...the picture on tv screen and computer monitor is nothing but dots - as it always has been, dots are the picture - but this time it was different. The impression is very hard to describe in any other words than making the notion that the dots are simply just obvious...! No more could I be able to look at the picture, because I just did not see it: no comprehension of the tv programme, no understanding of computer applications, since I saw nothing but dots and dots and dots and dots and dots... ...it was as if they were even flowing out of the image, onto surfaces nearby. Like watching static yet the programme was there. The perforation of the tv speakers was apparently moving, it's pattern twirled, turned and tangled and was like nothing I had ever seen. The eerie effect reached even music: staccato in everything, staccato in everything. The effect was omnious which made it ominous: I could hear the dots in staccato. It was easy to mentally form an image of their symbolic representation in note sheets..... on and on: staccato in everything.....

...presently, it seems that this multisensory, cataclysmic, Seuratian communion of dots is everywhere... they penetrate every material, they undulate in every sound, they fill every strata ... objects dot everything. and vice versa: dots objectify everything... the two-dimensional symbol (or is it three-dimensional? four-dimensional?) ... representing zero dimensions ... split into elementary parts ... the strife! ... fills every surface I see, corrupts every sound I hear......... ....I still do not have any idea whether this ... dot product of dot production ... is mental or ... the strife? ... even worse...: extra-mental....... and I cannot think of any way of how to find that out: whether it's mental, my mind can easily obfuscate the results; or extramental, I that case I dare not even think of what abominable forces could have an effect on the test results in such a world........

... ... ... .... ... ..... the information is blowing up, shattering to ... the ... smallest ... possible ... units, incomprehensible by themselves, without any surrounding structure or context ... the strife! ... providing no comfort, since after all, even the definition of information is information ... ... it's like being in an infinite metaphysical recursion ... plunging into the fragile logical structures, collapse being imminent, imminent ...

... and in no case ......... are these repercussions diminishing ... what is diminishing is their paroxysmality ......... the repercussions and their power do just the opposite ... reaching divinity ................

....... .......... the entire world is ... I descry and cry ... actually deteriorating ... into elementary particles ... a singularity of entropy ... collapsing ..... shattering ... fracturing ....... shivering .... disintegrating ........

into....

oodles of oozing dots ........ ... the very dimensions of the world itself ... waning one by one... into ... a ...

......................... ............. .

Categories: Creations, Stories
Posted by Matias at 21.02.2005 20.07 (12 years ago) | 561 comments

A different approach to ASP.NET master pages

Quite a few people have created their own solutions to the one of the most famous shortcomings of current versions of ASP.NET: the lack of master pages. It's notoriously arduous to enclose content into a designated area of a page that has programmatical functionality elsewhere.

I am not very keen on the ASP.NET 2.0 design, either. That requires the developer to write specific server control definitions and references here and there. What I want to accomplish is to make the master paging as easy as possible (of course, easy when excluding the implementation of the master paging system).

My implementation works like this: I write an user control (.ascx) and save it in the web application directory. It is automatically mapped to a certain url and when that url is loaded, the control is enclosed into the content area. In addition to this, the system has gotten rid of file extensions, a legacy (do I hear sounds of disappointment for the lack of .aspx or .cfm or .whatever?).

Here's how it works. I have written a specific PageHandlerFactory (download), which implements the IHttpHandlerFactory interface. All the requests except for a list of predefined file types are routed to this class. The PageHandlerFactory then uses the following logic to invoke the page (.aspx) to be executed.

  • If the .aspx file corresponding to the requested url exists, the execution is returned to the .NET infrastructure using PageParser.GetCompiledPageInstance(Url, Path, Context);
  • If the .aspx file corresponding to the requested url sans the .aspx file extension exists, the execution is returned to the .NET infrastructure. For example, if the user requests url http://arje.net/rss and file rss.aspx exists, the page object defined by this file will be invoked.
  • If the first segment of the local path of the url has a corresponding .aspx file, this will be executed. For example, requests to http://arje.net/trackback/a_page and http://arje.net/trackback/another_page are both handled by file trackback.aspx.
  • If none of the previous conditions are met, a special file, scaffold.aspx, is invoked.

The scaffold.aspx file contains the menus, headers and everything else that is consistent from one page to another. It loads the content by searching for a control in a specific directory mapped to an url. For example, if the url is http://arje.net/archive, the Scaffold searches for archive.ascx and loads that into a placeholder control. If the file does not exist, Scaffold loads a default page.

In this blog implementation the default page does the following:

  • Searches the database for an entry corresponding to the url.
  • Uses regular expressions to determine if the user requested an archive page.
  • Displays a 404 page (with a nifty close-matching using the Levenshtein algorithm, deliberately quite lax). An example.

This implementation requires a bit more setting up to do than ASP.NET 2.0 Master Pages, but once it is set up, I think it offers better embracement for a web site, albeit you have to learn a bit more and take into account thingssuch as that files may block access to directories of the same name. There shouldn't be any additional security implications as only .aspx files will get to be executed. Of course, it is not a general purpose solution, which obviously is the aim of the .NET developers.

The setting up requires the following steps:

  • Wildcard script mapping in IIS web site properties dialog. This is done differently in every IIS version so I'm not explaining it here.
  • Adjustments to web.config, namely, the following segment:<httpHandlers>
    <add verb="*" path="trace.axd" type="System.Web.Handlers.TraceHandler" />
    <add verb="*" path="*.asax,*.ascx,*.config,*.cs,*.vb" type="System.Web.HttpForbiddenHandler" />
    <add verb="*" path="*.png,*.gif,*.jpg,*.css,*.js,*.zip,*.swf" type="System.Web.StaticFileHandler" />
    <add verb="*" path="*" validate="false" type="arje.net.PageHandlerFactory, name-of-dll" />
    </httpHandlers>

    List the static files you wish to provide in the StaticFileHandler entry. Other extensions will be treated as 404 even if the file existed.

Download the PageHandlerFactory class. However, please be advised that the PageHandlerFactory changes the behaviour of ASP.NET page execution logic and there may be some residual effect I haven't thought of! Use at your own risk.

Categories: Programming
Posted by Matias at 17.02.2005 20.42 (12 years ago) | 289 comments

The Rasterbator 1.1 released!

The Rasterbator 1.1 with some cool features is now released. See the Rasterbator page for details and to download.

Oh dear, it seems that according to this blog, my entire life revolves around small dots. Or small dots revolve around my life... HERE THEY ARE AGAIN: EVEN MORE DOTS! LEAVE ME ALONE!

Categories: Art, Creations, Programming
Posted by Matias at 14.02.2005 21.22 (12 years ago) | 68 comments

Help on running The Rasterbator

In the first 24 hours 3400 people downloaded The Rasterbator and a German support site emerged, which is way greater response than I expected. Please upload pictures (photographs) of the rasterbated images (generated by either the web version or the standalone) preferably in their surroundings to the Rasterbation Gallery.

Troubleshooting

Being a computer program, it's bound to beget trouble. Here are few common problems and hopefully their solutions.

When running the program, an error window with code 0xc0000135 or with message "The dynamic link library mscoree.dll could not be found in the specified path..." pops up

The computer does not have .NET Framework 1.1 installed. Run the installer program and try again. Please note that you need to have sufficient rights (depending on your network settings) to install the framework.

I cannot find the output file

If you did not change anything in phase 5, it is in the same directory where the source file. The filename is the same as of the source file, except that the extension is .pdf (the computer may not show the extensions, depending on your configuration).

I still cannot find the output file

If you did not extract the .dll files from the archive and run the program, the rasterbation won't succeed. (There's no error message, which is of course confusing and this will be fixed.)

Things to wait for

I hope to release quite soon version 1.1, which would support external language files. This enables people to translate the program into different languages rather easily.

Categories: Art, Programming
Posted by Matias at 21.02.2005 20.09 (12 years ago) | 2466 comments

The Rasterbator 1.2

Invader Zim rasterbated by Bryon T. Smedley

Monochromatic rasterbation detail

Online version update (27 Jan 2013)

Online version of The Rasterbator has renewed - it's located at rasterbator.net!

Download

Click here to download (866 kb)

Solutions for most common problems

Introduction

To see what's new, see the Change Log.

The Rasterbator is an application which creates rasterized versions of images. The rasterized images can be printed and assembled into enormous (or smaller, if you prefer) posters. Enter the online Rasterbation Gallery to see what the images look like.

The Rasterbator originated as a web application at homokaasu.org, but it has gained so much popularity that the web server occassionally cannot handle the load and a standalone version was in place.

The standalone version is the same as the web version, except that downloading images from the web and image cropping are not supported, and you have to set the output size numerically (number of pages wide/high) rather than using a fancy drag handle. The results are exactly the same.

Download

Click here to download The Rasterbator Standalone 1.2! (866 kb)

The zip file includes the application, its source code and SharpDevelop project files. The source code is licensed under the GPL.

Requirements

The application requires .NET Framework 1.1.To print the posters, you need a pdf reader such as Adobe Reader. The application might also work with .NET Framework 1.0 (comes with Windows XP) and Mono (available for many platforms, such as Linux or Mac), but the compatibility has not been tested. If you manage to run it on Linux or Mac, please tell me!

The Rasterbator uses iTextSharp and SharpZipLib libraries. These are included in the file.

Instructions

Installation

No installation is needed. Just unzip the file contents and run the included Rasterbator.exe application. The application is wizard-like, which means it asks you questions and you click Continue button (or Back if you want to change what you previously answered). There are five screens with different options.

1. Select source image

In this phase you need to select the image you wish to rasterbate from your hard disk. Either enter the file name (with path, such as c:\images\snowman.jpg) in the box, or click Browse... to open the standard file dialog, which you can use to select the file. Note that the Continue button will be disabled if the file does not exist.

2. Select paper size

The rasterbated image will automatically be split onto several pages and in this screen you select the size of the paper you wish to use. Either use one of the predefined paper sizes (such as A4 or US Letter) and choose either portait or landscape printing (horizontal or vertical alignment of the paper), or use custom paper size. In the latter case, you need to input the paper width and height in millimeters.

3. Define output size

Using the paper size you selected, choose the size of the rasterbated poster you wish to use. You can define a specific amount of papers to both dimensions: width and height. The other dimension will be calculated automatically from the dimensions of the source image. The image size and paper consumption will be displayed on the page. Also, the preview image will show how the image will be distributed to different pages.

4. Set rasterbation options

In this screen you set up the preferred output options. The options are the following:

  • Draw cutout line around rasterbated area (default value: on)
    This option wil draw a dim rectangle around the rasterbation graphic of each page. The border will make it considerably easier to cut away the empty margins. If you plan not to cut out the margins, you should uncheck this.
  • Dot size (default value: 10 mm)
    Dot size defines the maximum size of the dots of the rasterbation. As a general rule, select small dot size for small output images and larger dot size for bigger output images. For a typical rasterbation job, good values are between 5 and 25 mm. Please note that dot size is the distance between centers of adjacent dots, as the dots may overlap.
  • Color mode (default value: black)
    The color mode affects the color of the dots in the poster. Black and custom color mean one-colored dots: the brightness is conveyed by using smaller or bigger dots. Multi-color includes the original color from the source image to the rasterbated poster.

5. Save rasterbation as

This should be pretty easy. The default value for the output file is the file name and directory of the source file, except that the file suffix (such as .jpg) is replaced with .pdf. If a file of the similar name exists, the suggested output file name will be suffixed with such a number that there exists no file the name.

Rasterbate!

Then, click the Rasterbate! button. The program will produce the output image. If you want to use other programs while rasterbating, check the "Rasterbate on low priority" option. This will slow down the rasterbating, but it makes other programs more responsive.

When the rasterbation is completed, you have the option to automatically open the produced image file (requires that you have a pdf reader in your computer system).

If you like it...

The Rasterbator is free, but surprisingly many users of the web version would have liked to make a contribution. Please consider making a donation to, for example, the following organisations instead of me:

Change Log

28.7.2005 - version 1.21 released

  • New languages: Croatian, Czech, Danish, Norwegian, Romanian
  • Minor bug fixes, especially in handling of nonexistent directories

6.3.2005 - version 1.2 released

  • The installation package includes now the following translations: Dutch, English, Finnish, French, German, Italian and Spanish. Thanks for everyone who sent language files!
  • A little better error handling: on failed rasterbation an error message will be shown instead of silent failure
  • Optimized bitmap reading speeds up the rasterbation of jpeg, png and tiff images.
  • Optimized rasterbation algorithm.

14.2.2005 - version 1.2 released

  • Support for multiple languages
  • Finnish and German translations. Special thanks to Dominik Zirkelbach for the German translation. Visit his German Rasterbator support site at http://www.rasterbator.de.vu/.
  • Output dot size was smaller than selected (bug in the conversion from mm to pdf units)
  • If the required dll files aren't available an a error dialog box was shown instead of a silent failure
  • Symbols depicting portrait and landscape paper alignment
  • Resizable window (enables bigger preview output image)

6.2.2005 - version 1.0 released

  • Initial version
Categories: Art, Creations, Programming
Posted by Matias at 28.07.2005 12.11 (11 years ago) | 8153 comments

Public Opinion

I'll be participating in a panel discussion titled Julkinen mielipide (Public Opinion), which will be held in Kiasma on Sunday 6th of February at 13.00. The discussion is a part of the Plan*B for Arkadianmäki project masterminded by Juha Huuskonen.

More thoughts about the very interesting project impend.

Categories: Art, Events
Posted by Matias at 01.02.2005 18.40 (12 years ago) | 50 comments

The Lecture

I was going to attend a lecture, which was held at the top floor of a very tall building, but I was running late. Normally, I wouldn't have cared that much about being late, but the bad thing was that God was giving the lecture.

I entered the building, and encountered a lobby that could have been a lobby of any unimaginative corporate building, which was felt quite weird, since I suspected God sort of avoids the non-radical, non-unhappy, non-discriminating, non-nothing business culture and it's visual manifestations. This impression may have come across me from the tale in the Old Testament, in which He sent several bears to mutilate children who mocked a bald man. Would any corporation which tells of their candidness by showing people of different races in their brocures, hire a fellow with such a fame? (Without the publicity it'd be ok, I guess.) Although you have to admit that action really was - despite being shotgun approach of a worst kind - thinking outside the box.

I pressed the shiny elevator button and the elevator doors opened. I was really running late and I think I might have been a bit afraid. Fortunately, the elevator ride was quick and swift and ahead of me the doors opened to reveal a nice view across a smaller lobby and the horizon beyond.

The lecture hall entrance was just around the corner, so I did not need to look for it. Carefully, I opened the door and entered the hall. It was quite awkward: God had obviously been waiting for me. Everybody in the audience looked at me. I think I managed to mumble something apologetic.

"That's ok", God said. "I knew that you would have been late and I had some things to do so I came here a bit late too. But just a few seconds before you so that it would seem that I had been waiting for you." Omniscience and a sense of humor are an exhilarating combination.

Categories: Creations, Stories
Posted by Matias at 21.01.2005 23.25 (12 years ago) | 297 comments

Printing to HP PSC Series Windows share from Linux

Here's a quick reminder for myself, since I have a feeling I have to do this again (and again), since after a month or two of usage, when trying to access the scanner, Windows heroically gets jammed and does not unjam until everything (drivers, registry keys, local setting folders) with "HP" is removed from the system. At least I did not found a less painful way.

To share a HP PSC 1200 printer connected to Windows so that Linux users (with older version of Samba, I reckon) can print too, the "Enable bidirectional support" option must be unchecked. This can be found from the Ports sheet of the property window of the printer.

And another reminder while I'm at it: to adjust bicycle brake pads, a 5 mm hex wrench and a 10 mm set wrench are needed.

Categories: Computers
Posted by Matias at 17.01.2005 18.12 (12 years ago) | 277 comments

First images from Titan


I sent a probe to Titan, too, and it transmitted the first batch of images and data. Incredibly, it seems that this satellite of Saturn consists of blurry mountains and rocks.

However, I had to reduce the quality of the images to make them look as authentic as the images of the other "probe" that was "sent" to "Titan".

(No offense to the ESA team intended - just tributary veneration and praise.)

Categories: Photography
Posted by Matias at 17.01.2005 19.44 (12 years ago) | 593 comments

Internet legends come true

MemoryBlog has a piece about a rather interesting document - although I am not completely sure of it's genuinity - according to which, the US Air Force has been planning, or at least thought of planning, to develop quite bizarre chemical weapons. These include chemicals which would aggravate irritating animals such as insects, but the funniest passage is as follows:

Chemicals that effect human behavior so that discipline and morale in enemy units is adversely effected. One distasteful but completely non-lethal example would be strong aphrodisiacs, especially if the chemical also caused homosexual behavior.

The quote is at the beginning of the second page of the document (pdf).

As every enlightened netizen knows, the Catholic Church has been doing this for years, which means that the supremacy of the US Army is only an illusion and the true power is elsewhere.

If the US military success in developing the chemical weapons and start to use them, what would happen to warfare media coverage? Surely they couldn't show the effects of these weapons on public channels. Maybe the raucous HBO would take on the role of propaganda machine for future wars.

UPDATE (19.1.2005): It's on BBC.

Categories: Web
Posted by Matias at 19.01.2005 21.42 (12 years ago) | 496 comments

content licensed under Creative Commons BY-NC-SA - Valid HTML 5