Interesting anomaly

My n-dimensional class templates begin to become interesting. Especially cause I found an interesting way to access it's members. Cause all members aren't accessed dynamically (rather by generating access points during compilation), I had to create special methodes for accessing each member individually. That may sound simple, but in fact it's an interesting concepts due to it's ability to access subdimensions from every other subdimension! Image there's a chain of statically combined dimensions using template classes: each dimensions has it's own value and a member representing the next dimension. The chain can be ended by using void as the member of the the last dimension (partial template specialisation). Now can access each member by calling obj.val, obj.next.val, obj.next.next.val etc. That can automated with by creating several accessors like T& x() or T& y() and so on. Originally, I thought this wouldn't work as you can't for example access z() if you already use z() from the last third dimension. But well - due to the compiler beeing unable to know what exact methods are now available (partial specialisation) you can still define it and he'll only complain about it if you use it a way where he can detect, that this function won't work. Neat, eh? That's why I like template: they enable programmer to do so many interesting things that go much, much beyond the normal ways of defining class. And with such a construct it could be possible to combine different object dimensions without heavy rewrite. I'm very optimistic about this one.


Free at last

Thanks Bool I'm free. My sister didn't turn pissed and we decided to find another one who can cope with this silly interaction environment. It's not the technical implementation beeing problematic, rather the whole development with Actionscript and Adobe's shitty technology. I'd be able to get it done with C/C++ and a proper graphics engine, but Flash is just a piece of shit you need to get used too. It's too highlevel for me. It's one thing to be able to write the most-efficient and well-designed code, but a completely different to overcome your knowledge and use something less effective/productive/well designed. Atlast I know what I don't what to do - not that I didn't knew that before... No, I'm free that I'm finally released and can concentrate on this that are designed for people who can think like computers and not like interaction diagrammists.

I give up

I give up. Actionscript is use- and worthless. I will tell my sister that there's no way I can program it. Extreme compile times, no debug output and a horrible, horrible feature set. Nobody needs it, it's the most useless sum on web programming earth. There is no way she can get me to do anything with it. I can't program with any output. I can cope with immediate program shutdowns due to errors, but not with programs running all day long without beeing to say anything. I could set up my own debug system for it, yes, but do you know how long this would take? I'm a PROGRAMMER, not a scripter. Scripts are for whiney wieners sitting all day long infront of their expensive workstation and trying to get shit ouf of this commercial, horribly usesless mess of mass media stupidity. You know what's good? Plain, old html.


Even if I dislike Actionscript, I like a few of it's syntax elements as far as I can remember, as well as it's event-based system. Though it's annoying that they made EVERYTHING event-based (you even have to wait for you main sprite (like the screen your drawing on) to appear before you can do anything with it by defining a callback). However, to make my peace with coding As3 (yuck, I still get the creeps when thinking about it), I implement a my version of an event-based system using templates in C++. Like every class of mine, it's tiny in implementation and maximizes the possibilities by beeing as versatile and fundamental as possible. As generic as it is, you can use for all sorts of events, hook it up with a callback and even check if it has an associated callback. Ok, that might be trivially trivial, but it gives me a better understanding about how to image to runs in Actionscript. One thing I love about C++ is that you can make everything as fast as you'd write it directly in one huge, highly optimized block. I can do almost everything with it and it's goin better and better. Recently I finally wrote a generic wrapper for Integer and Float types to get things like resetting the value to their native zero value (0 or 0.0), getting the min/max values, applying mathematical operations via member access and so on. All the neat things you can always need and use through your entire programming life. And the best thing is that there are only a few specializations of it, having essentially one base class for mathematical operations. Cool thing is that you can also use this class to wrap other kinds of user-defined Numbers with defined operators. No idea why anyone would do such a thing, but it would work great, too. Yeah, this is going to be cool thing. I still don't know how to efficiently solve the datatype definition problem for Indices in all my classes, but that should work one day, too. Atleast I'm happy with my event code. The best codes I ever wrote were the smallest ones. Of course, things change and so does my experience with it, but I can't helped - stuff's is elementary useful, almost atomic in design. Why would you split atoms if you won't be able to see the atom's content? You know what's in it.

(almost) done

Yay, I'm almost done with all of my current projects. Interestingly, it seems that our chess viewer project will get best marks - like my C++ assignment got. I planned to do it with another student, but then I had nothing to and thought about beginning it alone so he cold continue working on the chess project. I got it perfect without any further modifications after one and a half day, so it wasn't really a mark I had to do additionaly work for. However, the only thing left is of course a set of 6 exams, some extra research for an already almost finished talk and the image processor I have to code in Java. Oh, and... yeah. This one thing I'm working on with my sister, this one rather "educational" rabbit game in Actionscript3. Currently, I strongly dislike Actionscript. I found that it's essentially the same shit like Javascript and it really showed yesterday when I was coding cool things like a mad monkey only to notice later than Actionscript actually doesn't support all aspects of object-oriented polymorphism. This sucks, I really put a lot of time to get this done and then it hit me like a 12k ton block of solid steel. So I have to start from the beginning. This day I'll limit myself to procedural programming and minimal object-orientation use. Later I'll have to make a proper game of it, a fool was I to believe that Actionscript would make it easy. Now I'd rather prefer coding it in OpenGL or another engine or so. But shit, that's not possible as she wants a game playable in a browser. And I already pinned down how the game's technique will work it the end, heavily SWF-based. So there's no way to go and no way to escape. Fine. How shitty that feels. I'll never promise my sister a game. Never. Ever. And I'll not post it here on this blog, no. This is embarassing to me, having to do a shitty job cause the language doesn't support better possibilities. I'm not the fan for any kind of web-related scripting shit - I have it. However, I only need to give a quick, dirty demo to her til wednesday, so it's nothing impossible to do - only tedious and annoying. And I feel disgust thinking about how I will need to abuse my term break freedom for a silly and superfluous language and project in general. I hope she doesn't read my blog, but currently I'd like to throw away everything that's not my personal motivation. And I don't even get anything for it. I give a shit on the game's value and I give a shit on what it aims to be. In the end it's the game for someone who'll benefit from it where I won't. Actionscript is nothing good to me, it's a bad thing, a full impersonation of bad language concepts the fucking web enthusiasts brought to us. It's for designers without deeper knowledge, nothing you should learn on you own. I wish I could rewind the whole story about and get my more free time back. You would want to if you were me, seriously. This Adobe stuff is nothing a good programmer should use.


Why I prefer working alone

I haven't posted in some time here, so I'm glad I remembered I have this blog. And I wasn't able to blog for a reason. The last days I worked non-stop on my student project had to take over all the 3D coding from another student. He's such a fucker not working for months and then complaining about how difficult everything is. What a fucking bitch, first not to work while he had to and then complaining about his own stupidity. However, he's also the guy you don't want to work with if you already did a project with him. He wasn't able to tackle the 3D model rendering problem, he wasn't even able to calcalte the position in a simple 2D grid. Not even in his most "advanced" source code version I saw even on formular for doing so. He just seems stupid enough to not even know how to do this. It's something even small children can do, and he just can't! He should even study here, instead selling burgers at McDonals or something appropriate for his intellect. However, he one time did his job but didn't tell my other teammate so. This one (who is working better, if not completely useful) did even tell me more crap and never started to implement it. So instead he told me something like "he coded something somewhere and I don't care asking him to implement it". HOWEVER, the lazy bum nobody wants to work did actually create the little chessboard animation he had to code, but this never reached my ears. He was never present when we other two were working and so I didn't knew it. Instead of wasting time I simply started to overtake his work and created really awesome animations for every possible move and they worked really fine. But well, as we tried to combined it with current project the lazy bum appeared and raged about why we didn't integrated his part and whatnot else. So what should I do other than saying that I didn't see it? I really didn't and now I know it wasn't a bad idea to implement it on my own. He's a joke of a programmer and now he's telling me that he already solved. What a fucker, seriously. I looked at his code and he still used hard-coded positions. If I work on a project, this project has be work flawlessy - technically and conceptionally. I don't care about people stupid enough to insist their shitty code is better than min. I know if my code is better or not - both things happen regularly to me. My version of the code didn't use any textures but generated colors (which look much better than shitty textures). So as I began to make him more neutral towards the situation, my other teammate suggest to implent his shitty textures, too... Friday is presentation day, so I need to make it RIGHT NOW. Fuck, why destroy beauty with bad taste and even worse code. *sigh* This is why I don't like to works in teams. Atleast if they don't work. If they work, everything's well. But otherwise I have to correct all their mistakes because they'd the work of all other teammates. FUCK, I hate bad apples. Next time I work ALONE.


The problems of parsing shitty PGN files

PGN is a terrible format. Chess notations are also terrible. Everything is easier for a computer than parsing chess notations! Seriously, this stuff is so non-trivial that you need to read tokens from game start to game end, then analyse it the same direction but interpret it backwards cause all optional informations come BEFORE the necessary ones. How fucking stupid must one butt head be so invent such A FUCKING SILLY SHIT. Goddamnit, I invested so much time into it and now everything's useless cause there's anoher stupid rule that is possible. I HATE CHEEEESSSSSSSSSSSSSSSSSSSSS. I don't even know where to continue from here. Problem is that I know there are exception in the files I need to parse, so I can't just write something that assumes everything's written in the correct format. I even started to not work on it anymore - fatal if it's a mandatory component for your project. I wasn't even able to sleep this night due to this problem. I just don't know how to solve it with less work. I'm desperate and confused, nothing is going right in here. I WILL kill the guy who invented it if I'll ever meet him.

It's such a useless junk format. The problem is the move notation which lists all rounds and turns in the game including comments, annotations, alternate moves and the game end itself. I got a parser for a single turn done, but it only works if you already have the full turn cause it reads it backwards (wasn't able to figure out a way to read from start to end due to this ridiculous order of optional fields). However, the order in which stuff can appear is:

  • round number and '.'
  • white's turn
  • optional whitespace
  • optional comment or alternate turn followed by an optional repetition of the current round number with one or three '.' after it (optional whitespace between all these)
  • black's turn
  • optional whitespace
  • optional comment or alternate turn followed by an optional repetition of the current round number with one or three '.' after it (optional whitespace between all these)
  • optional whitespace
  • repetition of this list or one the following tokens indicating the game end: "*", "1-0", "0-1" or "1/2-1/2"
Also, you can add annotation and comments anywhere between whitespaces I think. I don't know.

It's just ridiculous to parse, especially with all these whitespace inbetween. Maybe it's just me having worked on it too much. Maybe I can't just see the solution or so. Maybe I should take a break, but I don't have the time for that. There are only a few weeks til presentation and I need to get this done... And then there's the problem that it's driving me sleepless. A circle of doom, nothing more. Maybe I should check again if the format is more strict so that I can create a more simple structure to parse. It would be easier if it weren't such an implicit structure with so many optional parts in it.

However, I think I should put it away a day or two until I have clear head and a quiet place to work on it. I guess I'm just not getting anything at the moment... It's not my time. Yes, let's do something else to relax. I can't really sleep at the moment, so I'll probably just put stuff into my head to give maximum flower power or something like that.



Damnit, and I thought it would work this time! I forgot one little detail about the RTTI functionality. I got it fixed, but I won't be able to access objects normally. Only way I could guerantee it was to allocate the object data itself dynamically and store in a special class made for accessing it. This is so far the only possible solution I could come up with. Oh man, that sucks! What's the point of having RTTI when you can't access objects the normal way you'd usually do without? Seriously, I'm angry about this. It effectively minimizes the previous awesomness about it. If I want to use RTTI in a productive way, I don't want to bother about a special syntax. I want it EXACTLY like the normal syntax. Of course is that possible when you choose to make everything RTTI - but's that NOT what I WANT!


That feels much better. However, my real problem is that if I use a base object for every class (and thus beeing able to access class member with no special function, "object.member") I'd need to make that for every object even if I don't want to always have RTTI for this class. My current version bases on a template wrapper that is derived from the class you wish to make an RTTI object of. The drawback of it is that you can't access the typeID cause depending on how big the original base class was, the typeID will have a different offset and will thus not be found. So you can only solve this by making a special object class that points to an allocated member. So you can always access the typeID with no different offset. But hey, I got an idea... I could implement sizeof() in a special variant and offset from the object address to it's typeID storage. That's a good solution I think! I only need to implement some more bits and maybe some other things, too. However, I think this could still work fine then. Yes, maybe not everything is lost. Atleast I hope so.


Little Breakthrough

I got a greate little breakthrough for my RTTI implementation! I was able to get rid of runtime-generated typeID integers and replacing with something different - that's a little secret I won't reveal until I released it, but in essence it defines each class by how you construct and destruct it. Anyway, that should be enough to guess. My new implementation also enables me to delete objects from their typeID and calling the correct constructors even it's was casted to a totally different object. I'll also implement further features like a dynamic sizeof operator giving the actual size of the object. The only drawback of this method is that you can also pass random pointers to completely different data structures. I also found a way to give atleast partial safety since it'd very rare to see random data having the same typeID of my classes (it's not a simple integer anymore). I'm thinking about more things I could implement besides typeID and a sizeOf clone. Maybe class names? I don't know. I guess a lot can change in the current implementation, so let's see where this is going. All in all I prepared this otherwise limited RTTI to enable fully functional garbage collectors. I'll implement two versions: one that works for only one datatype and no RTTI (or only if you define it's template parameter with an RTTI object) and one that's completely RTTI-based and thus more flexible. I'm a happy programmer now! I'm really, really glad I solved this problem. I stop developing further cause I didn't like the idea of my previous garbage collector design (the one limited to only one data type). Every other solution was just messy and didn't work so nicely as the new concept. And holy fuck, it's even faster and equally ressource-consuming than before.

So yes, this is a good day! I found a good, fully automatic solution while also expanding it's features by atleast 300%. If that's not a good day, I don't know!



I found a surprising difference in bolt-action gun design called "A-Bolt" or something like that. Well, it's basically just a straight pull and movable lever instead of the usual rotation cylinder. It's exactly the same design I created for my legofied model and I think it's the only way you can get it to work with Lego. I took the time to break the long time I wasn't working on it and did some nice progress. So far, the most difficult bolt part seems to work reliable. Now I need an equally reliable lever to lock the breech and prevent the bolt from moving around too free. I'm not sure whether to go for pure weight-based locking or some other snap lock to keep it also safe when shooting from different gun body rotations. However, I rather prefer a strong locking I can also apply to other designs. I know Lego can get loose over time and usage, it is no solution to rely on weight and simple blocking.


License stuff

As I'm enjoying the freetime I've taken, I did some more goal-oriented researches about different software licenses and decided to releases my toolkit(s) (which I'll push in the next term break) under the GPL license. The reason is quite simple: I want to share my code and give other open source developers the chance to use it while preventing commercial devs from making profit with it. As I'm just a student, a life with no real job or experience in it, there is no reason for giving away my own work to people making money without my involvement. I will always need to sell my work in later life - why let other make profit out of it? That said, it's own of most clean things I have in my mind at the moment. And in the end I can still decide to use my own code in personal, commercial projects since I'm the original author of it. And I can still prevent others from doing so, too. I think that's a nice tradeoff.


Another idea

Since I had this idea of making my own programming language that translates to NBC, I got some nice ideas in general for making a language for programming. Some thoughts I came to the conclusion that I don't want to create a language that doesn't use typical computer science  terms for it's elements. That might sound strange, it gives you a better idea what's behind the code you're writing. When you learn a new language, you'll need to what terms do what in the language, where it puts which kinds of variables and what other concepts it used etc and so on. Sometimes you'll never know what kind of variables lies in the stack, is static or part of the heap. You'll have to figure it out or read it in the 300+ pages manual. Sometimes things aren't really explained in details or how they work internally. My idea is, if I'll ever design a language -which will probably happen in my life-, I'll try to make EVERYTHING as direct as possible. Which means that if you want to put something on the stack, you call some kind of global function with "stack" in the name. The same for static and heap objects, etc. Even better, I could use only object-oriented access structures. So there'd three objects, "static", "stack" and "heap", representing the memory objects you'd add something to. Spanning it over more than just basic allocation, there'd be a "class" object you can use to add classes and so on. I kind of like the idea and it has nice side effect: you could port it to other languages using a converter and it would say you immediately that you can't use certain objects or features in the destination language. You'd also have immediate knowledge about where objects would lie and why something is slow like hell or so. If you get a nullpointer error cause you referenced a not-anymore-existent object from the stack, you could easily identify it cause you've put a big "stack" in front of it.

That's basically what I'm usually complaining about. One syntax for all, exporting to a language of choice using the right converter. So you benefit from a more consistent, non-confusing syntax and destinations languages performance (of course depending on how the converter does it). And well, designing it gives me also an insight to OOP and language design problems in general. One design floating in my head was to have declaration/definition-less programming. Instead of making declarations before you use a class or object, you could write random function names and it runtime-check for it's existence, and link name and declaration on demand as you go. It'd be like having a pool of identifiers you could branch into more identifiers, ultimately leading some kind of randomly accessed chaos lists. The only way the find, for example, a method of a class would be to use a class identifier and search for it inside the pool. Once you found it, it would be linked to the name you used via runtime. I thought about a longer while and came to the fact that you'd need a huge hash table to look if the identifier was already linked. An identifier would consist of checksums of their names you used in the code. And that also means that you'd need identify a single class by using all it's superior scope identifiers. This way you can guarantee that it's possible to identify even completely new classes on demand and so on.

This brings some advantages and some disadvantages. The advantag is that you can have totally random objects with totally random classes. You could probably even generate classes on the fly and search for matching functions using parameter analysis and so on. So no more loss due to definition changes. It'd be like a search engine - maybe add tags, too, and it's possible to find a lot of different things. The first disadvantage coming to my mind is that it'd require to check EVERY member or class access using the hash table. Hash calculation and searching can be costly, especially when a lot of types share a single hash entry. And if the identifier wasn't found yet (happening EVERY first time access) it would also search through all branches coming from the superior identifier. That's quite a heavy overhead, even if you look for already know identifier before the real program starts. And the other big disadvantage is type safety and debugging. You can't just check for non-existing members during compilation since every member set is unknown/expandable. And type safety? Well, forget that. Not during compilation, that only works during execution. Of course would it be possible do to some dry checks during compilation, but that doesn't as you can add everything anytime. Ok, hm... with some special keywords it'd be possible mark a class as fixed. That could integrate nicely into my current language concept! Yes, that's it. Well, I guess I'd need a bytecode interpreter for that... However, the export to other languages could still work as I can simply disable export if specific language features where used. Good idea! Yes, I think that's the "glorious way to go" for me.

Good news

I was so glad reading a post from one of leJOS' developer where he mentioned that the new version will have support for raw PCM files from memory! This effectively solves all my problems with unsufficient audio support. Though, with some further experiments, I got a rather concept for polyphony using it's standard playTone() function. It may sound rather weird with many tones playing, so I'm glad that there will be support for it. However, I can still implement and perfection the design I had in my mind - it should work fine with the current quick'n dirty polyphonie mixer and the one for later firmware. So when the next update time has come, I can simply extend it to feature both ways of mixing multiple voices. I'm quite optimistic about this one. And it's also a good reference work using limited ressources but still offering a flexible feature palette.

Anyway, I'll have to freeze this project for a while as I'm now entering the hot phase of the current semester. I need to finish my PGN database interface (one function is still missing), write a little image processing plugin and prepare a talk about risk management in a project of my choice. And well, then there's this fucking Flash rabbit project for my sister.... So annoying.


Some NXC sound experiments

Since it's taking me ages to build the nxtOSEK compiler, I started some sound experiments using the NXC and got quite nice sounding, little bleep and blop effects, The output is horribly tinny, but I think I can be solved with some physical "wrappers" around the speakers to get an altered acoustic output. However, I kind of fell in love with the idea how polyphony (atleast for two voices) and create a little systems that alters the currently played sequence in rapid manor for some kind of messy frequency modulation. The result were... well... let's say it's between disharmony/noise and arpeggiator sounds. I'd only use this for special effects, but otherwise it plainly sucks (though I haven't yet tested in a real song arranment). But then I got another idea! The NXC allows only four volume levels, but nxtOSEK and leJOS can give you a range of 0 to 100 - enough to get any kind of modulation done. So my idea is to choose a very, very low oscillation frequency but a rapid volume change. Rapid enough to create sound waves on my own, effectly enabling new sound waves. Unfortunately, this wouldn't result in a direct and smooth response like with an already preset sound wave. I studied leJOS source code and found out that they use premade, hard-coded sound waves, put them in a buffer and give it to the soundcard. If that's not what I want! Unfortunately, I don't think there's a way to access it except communicating directly with the hardware or modifying leJOS. I don't want to do this, I'm just not somebody digging so deep only for a hobbyist project. I also don't feel any joy by going dirty with the hardware on such a direct way. I prefer abstraction with fast and minimal functionality.

So to get less gaps between these dirty volume-based waves, I'm trying to run nxtOSEK, again. I hope it works this. Otherwise I'd have to code in Java... And that's a performance fail by default.

OMFG part 2

Ok, somehow this stuff is getting annoying. Now that I'm able to code more or less fluently in NXC, there comes another annoying limitation: the firmware's sound API! I can cope with only beeing able to code my synthesizer using a specific sound wave (I can still use LFOs for frequency and sound manipulation). But what's this? Only four different different sound levels in the standard firmware? WTF? I can't believe that I'll AGAIN switch firmware only to get my sound working properly. Other firmware do have better sound playback support, but I wasn't yet able to install them except the LeJOS software. Unfortunately (or fortunately, however you may interpret it...), LeJOS does even have a function for using a custom sound wave. What I'd like to get is some kind of direct access, filling a buffer to played by the sound card and updating it as required. But I guess I won't be able to do so. Another drawback is the speed of LeJOS. Judging from a very useful table, I think it's rather a drawback than something that'd be good. I don't know what to do. Maybe I should simply leave for a while and try to get nxtOSEK running properly. My only problem was that I couldn't compile the compiler properly. That may have to do with different versions, not installed packages etc... I really don't know. And I don't know how to continue. It's no problem coding in one or another C or C++ variant. I don't mind, they all have basic functions for all other things robot-related. I don't know, I really don't know. The new year doesn't begin as good as I'd like to.