Archive for the 'Just programming' Category

Where did all the RIAsses go?

Saturday, November 10th, 2007

I am not sure if this was only my perception or if it was true. Around 6 months ago when I was making a desktop application in Java for some client, the whole desktop world was talking about RIAs (Rich Internet Applications). Flash was making buzz with Flex and Apollo (now named Adobe AIR), MS released Silverlight (- aka the Flash Killer) and Sun had to do something too and they announced JavaFX on JavaOne.

The language wars warmed up on blogs and forums, “applets are dead”, “flash is still slow and clunky”, “MS only cares for the money” … I think everybody had a feeling.. “uh shit, If I don’t pick the winning new technology or continue with this old tech I will be left behind while everybody else will be writing declarative MXML and making cool animated and shaded web-apps with transitions in minutes”. The other side of my brain didn’t agree…

So after 6 months… where are the killer RIA apps from Flex, Silverlight and Sun that squish old clunky web-app-wannabes on first sihgt?

p. language: HaXe & Neko

Saturday, November 3rd, 2007

I should have mentioned this language ages ago. Almost all my flash games are made in it. Haxe is interesting because it has 3 target platforms. It can create flash SWF files, javascript inside a browser and a general Neko Virtual Machine.

The language is similar to javascript but is strongly typed and has some specialities that I don’t yet totaly understand. Although I made around 5 flash games in it I know to use it only in basic ways. It seems I will be doing some more things in it and then I can post some interesting code.

So, language Haxe is interesting, but Neko the VM is maybe even more interesting. If all goes well I will be able to report about it in a while…

Tiny half-evil REBOL script

Wednesday, October 31st, 2007

I was waiting for someone on some forum today. Eagerly waiting so I kept reloading that page scrolling to the bottom, scanning for his name and it consumed my time and energy again and again.. So a REBOL one-liner came to my help…

>> ;open rebol shell and type this in, press enter
>> online?: func [name][ either find find read http://forums.hidden.com/ "Currently Active Users" name ["yes"]["no"]]
>> ;you defined a function that loads a page over http,
>> ;finds "Currently Active Users" because that name could appear above in the list of last topics
>> ;than from that point tries to find the name and prints yes or no accordingly

Then instead of reloading and scrolling every half of minute press up arrow and enter. You type it the first time

>> online? "JackieChan"
== "yes"

Aha .. I got you now! You you … ***** ;)

p. languages: Lua

Thursday, August 23rd, 2007

I am no experienced Lua-er. But I got very intrigued after the first “aha” moment happened to me: “aha, so lua is like some super-table language?”. That is of course not all, and many more aha-s did and will follow.

I love minimalism and this is a minimalism at it’s best!

Just some random code to confuse you:

function makeHiSayer(name)
  return function()
    function sayHi(name1)
      print("hi, I am " .. name1)
    end
    local n = name
    sayHi(n)
  end
end
hi = makeHiSayer("janko")
hi()
-- hi, I am janko

from Wikipedia: Although Lua does not have a built-in concept of classes, the language is powerful enough to easily implement them using two language features: first-class functions and tables. By simply placing functions and related data into a table, an object is formed. Inheritance (both single and multiple) can be implemented via the “metatable” mechanism, telling the object to lookup nonexistent methods and fields in parent object(s).

In next example I am not using any of the proposed methods for doing OO in Lua. Basically I am just making stuff up as I go and yet it works.

AmIABulletClass = { x = 10, y = 20, dx = 1, dy = 1,
  update = function (self)
    self.x = self.x + self.dx ;
    self.y = self.y + self.dy
  end }
bul = AmIABulletClass
bul.update(bul)
print(bul["x"])
-- 11
print(bul["y"])
-- 21
bul.update(bul)
print(bul.x)
-- 12
print(bul.y)
-- 22