Sunday, December 28, 2008

Happy new year... and good bye.

party

I've long wanted to capture this - the social interactions between the cans of drink :-)

I like the result.

With this post the non-secondlife part of dalien wishes to say goodbye to you all. 3 posts short of 365, this blog was a fun story of various adventures. But as the time passes, and as the first-life identity gets bigger and bigger footprint - maintaining the two gets a bit tedious. No, I'm not going into the off-line monastery and closing off - I'll continue to post, but with my other, more conventional identity. This blog will stay silent - at least for now.

If you feel like some of the sketches that I make are fun - you're welcome to hang around at http://bnpcs.blogspot.com/, which is devoted to adventures of the same avatar in a much more entertaining game of the First Life.

Thursday, December 4, 2008

A wonderful article on concurrent programming

Mostly as a bookmark for myself:

http://portal.acm.org/citation.cfm?doid2=1454456.1454462

Monday, December 1, 2008

My new blog about u-Simulator...

For those of you who might have seen some strange posts with the tag "cosimus"...

As the code gets a bit more functionality, there's now a bit more explanation about what those posts mean - and the subsequent posts will go to http://cosimus-news.blogspot.com/

Thursday, October 9, 2008

I still believe...

While poking around with the matrix, stumbled across this piece. Wonderful.

Enjoy.

Wednesday, August 6, 2008

SL-aware server prototype in ruby...

It's no big doubt that Ruby is a high-level language. Probably opensim svn still has my stupid ruby scripts which pretend to do something with the protocol - in effect just being more or less compact "plugs" for testing.

One of these evenings I did not feel like doing anything productive, so I decided to hack up a prototype packetserver in ruby.

So, the below set of files allows me to "login" (in quotes because the login info is not really checked :) with the viewer.



$ ls -al
total 228
drwxr-xr-x 2 dalien dalien 4096 Aug 6 04:46 .
drwxr-xr-x 12 dalien dalien 4096 Jul 31 22:23 ..
-rw-r--r-- 1 dalien dalien 183208 Jul 28 17:44 1.18.3.5.txt
-rwxr-xr-x 1 dalien dalien 8629 Jul 28 17:36 login_server.rb
-rwxr-xr-x 1 dalien dalien 14901 Jul 29 04:27 parse_template.rb
-rw-r--r-- 1 dalien dalien 3710 Jul 31 22:27 pkt_server.rb
-rw-r--r-- 1 dalien dalien 1719 Jul 28 21:59 str_hex.rb
$



The main cleverness is in parse_template.rb, which sucks in the 1.18.3.5.txt being the message template, and generates a bunch of classes, courtesy of Ruby being an interpreted language, something like this:

t = SLPacketTemplateFile.new("1.18.3.5.txt");
t.pt.each { |x| SLMessage.register_message(x, eval(x.to_ruby)) }


So, this defines a bunch of classes with the exact same names as the messages in the message templates, and allows to write a message handler in a nice and conscise way as a class method for a "client handler" class:


def message(msg)
send_packet_ack(@client_ip, @client_port, msg.sequence)
handler = (msg.class.to_s + "_handler")
if self.respond_to? handler
send(handler, msg)
else
pp msg
end
end


And, as soon as I define a "_handler" method within that class, it gets automagically hooked up! Cool, huh ?
For example, something like this:


def MoneyBalanceRequest_handler(msg)
pkt = MoneyBalanceReply.new
md = pkt.MoneyData[0]
md.AgentID = msg.AgentData[0].AgentID
md.TransactionID = msg.MoneyData[0].TransactionID
md.TransactionSuccess = 1;
md.Description = "Test\00"
md.MoneyBalance = 1234;

send_to_client(pkt)
end


where "send_to_client" is again dead simple:


def send_to_client(pkt)
@sock.send(pkt.to_bytes, 0, @client_ip, @client_port)
end


Oh, and you'll probably be amused with this totally stupid-looking message loop:



def run
print "Started server...\n"
loop {
data, from = @sock.recvfrom(8192)
port = from[1]
host = from[2]
rdr = SLDataReader.new(data)
msg = SLMessage.from_bytes(rdr)
if msg.class == UseCircuitCode
print "New client connection!\n"
@clients[host.to_s + ":" + port.to_s] = ClientHandler.new(self, msg, host, port)
else
clt = @clients[host.to_s + ":" + port.to_s]
if clt
clt.message(msg)
else
print "Unknown client:\n";
pp msg
end
end
}
end



Of course, the CPU usage of all this horrific mess is terrible - given that even the simple members like U32 are objects in themselves, but it's fun nonetheless.

The interesting thing that parse message template + generate the code + dynamically evaluating it (creating message classes) takes around2 seconds - which I think is not too bad.

There is one downside however, the debugging of the autogenerated code is a pain. I need to so how to do it better.

Oh yes, and get rid of the braces in the loop {} construct, they do look ugly and out of place.

Dalien landless, no more sales for primskirtbuilder from me (for now, at least).

heh. appears I'm (finally) out of land where the thing was being sold. Hence, not selling the primskirtbuilder anymore.

The copies should be around, and if you apply a certain effort, you might find a free copy.

The exercise did teach me an interesting lesson - apparently the value of "free" is not really understood nor appreciated, and if you put a decent price tag, people seem to be MORE willing to get it.

The never ending wonders of the human soul... Oh well, they wrote exactly that in the MBA book. It's good to confirm the theory by practice.

Sunday, August 3, 2008

Videos in HD

Videos in HD - and quite a lot of interesting ones. Probably good thing that HD has not hit the masses too much yet...

Enjoy.


The glove from Bewegtbildarbeiter on Vimeo.

Monday, July 21, 2008

Installing debian on eeepc instead of Xandros

It's been a while since I wrote - a lot of things happening, a very busy RL, no time for SL, and broken ADSL at home which I have no time to fix for now. But thought to write up something to show I am still alive :-)

As I've already wrote, I think - I've got a shiny new eeepc a few months ago. All well, but its internal flash (which they call "solid state disk") broke at some point - giving the hardware errors. The failure happened at a very distinct moment in time - I left the eeepc on for a few days, and then - whoops. I do not suspect the FUDed "flash wear" - because there were even the read errors. Much more a possible overheating causing it to fail. So, since I do not believe in warranty (And the warranty on this item would've caused more pain anyway), I decided to buy a SD card and use it as a main storage - the experiments showed that the built-in flash was dead only in some selected range, so the first few dozen megabytes were usable.

My favourite Gentoo was out of question immediately - it'd be a madness to compile everything on a system with a smaller CPU and a very slow flash-backed storage. So, I've evaluated a few others and finally settled on Debian - since it was apparently the only one who was ok with my SDHC 4Gb card that I bought.

There was not much to an install - just follow the instructions here and I got a working system.

However, at first when I tried to just use SDHC, it failed to boot from it - complaining that the cylinder number is larger than the one supported by BIOS (notably, after the boot the SDHC card appears to work fine).

So, in the end I made the following: boot into installer from the external USB memory stick, then blow away the default partition table on the internal "Hard Disk" and create two partitions on it - the first one will be the root partition, the second one is the exact copy of the installer USB stick image.

Using the same trick that GRUB uses to boot windows, I can force the installer to boot - so I have a way to recover the system in case something goes wrong. (I think it's pretty hard to install grub from the installer itself - I used the root filesystem that was previously installed - so technically I went through the install procedure twice).

The side benefit of such a setup is that now internally I have only the grub/kernel - and everything else is on the SDHC card - so in theory if I unplug that one, I can have an alternative setup (and in the case of the external HDD it can be even Gentoo).

Wednesday, May 21, 2008

GPU fun..



Quite impressive. Imagine the possibilities.

Friday, May 16, 2008

7 habits of highly effective men

I'm writing this one from eeepc - really funny feeling, feels bit like trying to open the door through the keyhole (from the other side, obviously :) and the real pc is left at the office by the human - who spent a good half of the evening exercising his throat, trying to get under the Purple Rain, also he was Chasing Cars and trying to express his feelings towards someone name Ruby - I have no clue who that person is, but he was trying really hard... it was entertaining to watch. Nonetheless, there's whole 3 weeks before the show, so he will sort the things out.

So, about being a decent man... Tiessa writes about her opinion of 7 habits a man should have - and i figured i'd take a note for myself as well as write some things on the side.

7) Pick up the dirty socks off the bedroom floor.

good that this is the last one in order. gonna be the toughest one. try to plan the house so the washing machine is not far from the bedroom so you can sneakingly drop them there later on - after all, they'll complain anyway if you go to the washing machine during the most precious moment. I suspect it is an RFP check item to fend off those they could not get rid of by other means.

6) Put the cap back on the toothpaste tube.

ahha, now i know why they invented the snap-on caps (which are actually pretty hard to NOT put back on. if you manage to buy a toothpaste which has detachable cap - you deserve your destiny.

5) Clean the sink after shaving.

shave in the shower. besides the irreplaceable experience of blind shaving, all the annoying details are taken care of automagically. cleaning the short pieces of hair off the sink is a pretty boring experience - there's always something left.

4) Know how to use a mop.

which one.... note: educate myself on that part about the dice retrieval. looks pretty unuseful, but hey, who knows - maybe one day it saves the life...

3) Carry shopping bags for more than 20 minutes without whining.

the shops have parkings, as well as trolleys. plan and manage the shop routing accordingly, so the heavy stuff is in the very end (it's typically food). the "things" are usually voluminous, but light. in order to minimize the amount of this, plan the shopping such that it is shortly before the closing hours - or shop more frequently. the remote shopping villages in the middle of nowhere are very good. you can get her to buy something-or-two-versace, and you've got a lead in the shopping management for the rest of the month. somehow they like those, so it's a no-brainer. just remember: the food store is the *last* place in the supermarket to visit.

2) Ask for directions before we are late for the event.

get a GPS. know the address. tell the time of the event 30-40 minutes in advance of the real one - this way you will be always on time and won't have to shrug when asked where have you been. the delta might need careful adjustment - the only thing worse than being late for the event is being early for it. if you are early indeed - pray for a good weather, and suggest a walk. neer ask for directions - the folks around don't have a clue anyway, it will only make her angry that you were not able to find an appropriate person to help.
if you follow the wrong directions - it's your fault. a decent car in addition to the GPS is a very good plus - it's being looked at. possible theory: in connection to item 3 above. but a good car is an advantage even with no additional variables in the equation.

1) Cunnilingus

the jury does not have any objections on this item and nods emphatically.