SofuJS – Release Canidate 1

March 9, 2008

Got it to work today.

It can read and write Sofu files, just like the other libraries.

I made a example JavaScript (no AJAX or server needed) Sofu Editor with TreeView and Value-Editor (so you don’t need to escape your values).

The Value-Editor is active after you click on a value in the TreeView.

You can try it out here (Javascript required, of course)

It works (as I tested it) in Firefox 2.0 and IE 7 (maybe more).
Try this Sofu file (for a little more complex example)

List = (
	"1"
	"2"
	"3"
	"4"
)
Map = {
	Content = "This is some demo content"
	OtherContent = (
		{
			Content = "Some more content"
		}
		{
			Content = "Even more content"
		}
	)
	<> = "This Value has an empty key"
}
Advertisement

ECMAScript, Javascript, JScript and Sofu

March 8, 2008

Some say JavaScript is annoying and should be turned off in the Browser.
Some others say Javascript is a very ugly language to program with.I say they are both right.
I did one thing in Javascript till today (Plasma’s 3d map view to be exact), and I don’t liked it that much. Today I had one of those stupid ideas that take away your whole weekend (And more). After finishing the dokumentation of Sofu.Net (0.2.1), I thought: “Why not do Sofu in JavaScript?” and “How hard can it be?”.

Why Sofu in JavaScript: Sofu is a file format, JavaScript can’t access files. Makes not a lot of sense, does it….
Well there is one application. Since Perl and .net (escpecially ASP.NET) now can now work with sofu files, you can use it to send structured data to the client (Webbrowser). This is done mostly during AJAX calls to the server.
Lets review what other structured data formats are there for AJAX communication:

  1. XML: This is a big one, it has bindings to almost any language running on webservers, but it is quite slow to parse and it tends to get very big if you write understandable tags.
  2. JSON: (Java Script Object Notation) Its easy to generate in most, easy to parse for JS (unsecure if parsed wrong) but it doesn’t support references and circular data structures…
  3. YAML: (http://www.yaml.org/) This is the way to go, mostly. Its quite fast, a superset of JSON, safe and supports references. Has also bindings in almost every language (even .Net, but that one hasn’t been active for almost 2 years now).

So where does Sofu fit in?
Sofu also supports references and the same datastructures as YAML, and its smaller than XML. And there are bindings to .Net, Perl and D.

But mostly I’m doing it to see if I can do it.

Current progress:

  • Not documented for now (How do I document JavaScript anyway, is there a nice API doc tool like POD for perl or Sandcastle for .net)?
  • API is very much the same as SofuD or Data::Sofu::Object of sofu.pm (Or Sofu.Net if you write the first letter of each method in lowercase).
  • Still missing a way to overload “for (var x in SofuMap) {}”, but I guess there is none.
  • Output is also working. (Well into a textarea of the browser).
  • Parsing is due after I sleep.
  • No Binary Sofu (I don’t think its useful and/or needed).
  • No SofuML (SofuML output: maybe, Parsing: Nope, not needing the parsing problem again)
  • Rest is working fine.

Mac OS X and Vista and XP x64

February 27, 2008

After my boss using a Mac and me reading Applegeeks a lot I bought a MacBook (2 Ghz, 2GB Ram) last year. I switched my PC to Vista (x64) at the same time. And I must say:

I love my Mac. (Well it still has BootCamp but I’m rarely using it, thx to Wine).

I have been using Linux, XP, Vista and MacOsX Tiger last year and I really enjoyed just sitting in front of my Mac (its looking pretty). Everything I need I can get for it (Vim, D, perl is installed) or emulate. Even .Net development is easy.

Sadly it can’t run Freelancer, but neither can Vista (at least not in Multiplayer, I had avast installed and I won’t reinstall just for games). So I have been switching back to XP a lot. After I switched my Mainboard I had to reinstall Vista (and reactivate) but not XP x64 (not even reactivate).

I still think if it’s Windows you need, Xp x64 is the way to go, It has already the better memory management (I have 4GB RAM) and it’s got not that much trouble with root-kits or similar (they only attack the 32 Bit part). Every game works on it (FarCry looks better too) and it provides full Direct Sound acceleration.

Well I got an X-FI and thanks to ALchemy it works under Vista Direct Sound works under Vista, but any other Soundcard is just lost. The sound is sounding dead. I can make better FX with my mouth.
And Vista got another problem there, it randomly mutes speakers. (ALchemy/OpenAL is not affected). Sometimes my front speakers go off, sometimes the back, sometimes I just hear from the center. I have no idea what that is all about.

Stil Mac OS X is the way to go, it still looks prettier and after 2 days working with exposé you will miss it the rest of your life.

And its cheaper, too.


Sofu – SofuML

February 16, 2008

Got bored (again) and wrote SofuML and binary file support for Sofu.Net.

Don’t get me wrong, but I don’t like XML for saving structured data. XML is fine for doing layout and stuff, but if you don’t use proper indentation (as most exporters do) it looks kinda confusing. If you do indentation with tabs, it looks better, but than there is the whole white-space issue: Try saving a value with a leading whitespace, you can’t difference it from an indentation. Sure, you can use xml:space = “preserve” (20 or 22 more bytes in every element), but than you can’t use indentation again.

Than you will have to write the whole name of the element again in the closing tag, (more space used) Which only serves one purpose: To help the parser (or something). You can’t close any other tag than the last opened. This leads to XML elements getting named very short, which defies the whole readability purpose. (Anyone who has seen a MS-Word XML file will probably agree here)

One the other hand XML is a standard and the whole shebang around it has gotten quite powerful. XSLT (with XPath) is one example, no other data-format can be converted that easily (especially to produce HTML output).

That’s why I thought it would be neat to convert .sofu files to .xml files. and I called it SofuML. So you can transform it easily without having to code a program.

XML already brings a way to reference other element (in the same file) and the rest that is needed. (This will still keep the whole whitespace issue, but you can escape leading and trailing whitespaces. (The whole .sofu file will not be changed after being written and read again, but the final product after converting depends a lot on the parser)

Take this .sofu file for example:

somemap={
somelist=(1 2 3)
somevalue="Hello World"
}

Will be converted to this:

<Sofu>
<Element key="somemap">
<Map>
<Element key="somelist">
<List>
<Value>1</Value>
<Value>2</Value>
<Value>3</Value>
</List>
</Element>
<Element key="somevalue">
<Value>Hello World</Value>
</Element>
</Map>
</Element>
</Sofu>

This is not that nice and small, but you can use XSLT to convert it into HTML or even back to Sofu.

The XSLT to convert it to sofu is not complete, (I have found no way to escape keys and values if needed,) but it is funny anyways.

This is what happens if you put it through a compatible browser (IE or Firefox works great): http://sofu.sf.net/test.xml, also check “View Sourcecode” and you will see its just the XML file.


Sofu – Coding Mania

February 13, 2008

I had a coding attack this week and wrote a lot new stuff for Sofu:

First of all I finally finished (and documented) Data::Sofu and Config::Sofu which are currently processed by CPAN and should be there soon.

And to satisfy my coding needs I implemented the long planned Binary Sofu file format. Which can be streamed over 7-Bit only streams or just written to a file. The reader even autodetects binary files and reads them as if they were normal ones. Maybe later I could implement something like XMLRPC (maybe SofuRPC).

Then I went a coded Sofu.Net in about 2 days, my first “real” C# project. I had used C# only for study so far, but I was quite happy with the language. I think I should test some other languages as well, maybe a JSofu or one for Phyton. Sofu is a nice task to implement, most time was consumed by the documentation anyway.

Both can be downloaded at Sourceforge and http://sofu.sf.net.

By the way: Anyone noticed how hard it is to extract the in-line documentation of .Net Projects to a simple browse-able HTML page?

It took me 3 hours, first I tried NDoc, but that only works for .Net 1.1, then NDoc 2005. which assumed some strange directory structure and always wanted to have its files in my personal folder (Users\Maluku\AppData\Documentor ???) and only says to work on 2.0 (Didn’t work at all for me, even after I ported my project to .Net 2.0).

Next up was Microsoft Sandcastle, which is quite good with the extracting, but someone has to be punished for that User-Interface. So I tried Sandcastle-Builder, which said all went fine but it produced no output. (Or one empty file after some tweaking).

I tried DocProject next, but the web-page was slow as hell and made no sense to me.

Finally I got it to work with Sandcastle Help File Builder (from the same website), which looks like NDoc but works and produced:

One .chm file.

Which I couldn’t use to put on the Internet, so I had to extract that one (with chm2web.) which looks quite nice now.

Suddenly I came to realize why I love Perl so much. You just include your documentation using POD in the file and then run pod2html or pod2latex or pod2wiki or whatever you like on the file and you are done. That’s why the documentation for Data::Sofu only took about 30 Minutes (including building a .css and some frames around the generated .html files).


Angriff der Dateien (Attack of the files)

January 2, 2008

Sorry, this post has to be german. English version further down.

Man kann sich ja über vieles unötig aufregen, und das ist normalerweise auch berechtigt. Was mich seid neustem immer wieder zum Lachen bringt sind die im Radio und Fernsehen aufkommenden “Dateien”. Eine Kinderschänderdatei, eine Terroristendatei und auch noch die Bundestrojanerzieldatei.

Das würde dann wahrscheinlich so aussehen: Terror file

So sehr wie unsere Regierung Microsoft Produkte liebt, wird es wahrscheinlich Excel oder Word werden. Allerdings kann Excel nicht so viele Einträge verwalten wie es Muslime in Deutschland gibt. Das Ganze noch zentral irgendwo in einer Datenbank zu verwalten kommt keinem Politiker in den Sinn, der grade das Wort Datei von einem anderen Politiker gehört hat und auch schon mal von seinem/r Sektretär/in beiläufig aufgeschnappt hat. Und da auch die Kosten überschaubar bleiben müssen wird die Datei in dem PC des/der Sektretäres/in landen. (Du kennst dich doch mit Dateien aus …. ) und mit dem nächsten Plattencrash verschwinden.

English explanation:

Currently in Germany all the politician’s and newspapers are talking about files. A terrorists file for example, which stores all the bad bad people suspected of evil (or the “wrong” religion). And knowing the German government and its policy on software: If they are talking about a file, they want a file. Not a database or something else useful. I think it might be a Microsoft Word document, because Excel can only hold 65536 entries, not enough for all the bad people. This whole files project will end in one secretary having a word document on her PC with all the suspects in it.


Plasma – Forums

December 20, 2007

I coded the Plasma Forums in 4 days, 3 hours a day, that’s got to be a record, I also included: Skins, a News system, a better transfer screen and a lot of other stuff, its currently running under http://aurora.dbb.at/plasma.

Also new is the register feature. Well its needed if you want to create a new account. Although Hotmail seems to be blocking my emails send to them, probably a spam filter or something. You even can now claim accounts under my accounts. Its works quite easy, you simply select a character to claim as yours and then you log into Freelancer with that character and you will get a password send to you. Just enter this on the claim-page and the whole account (5 characters) are yours. It work like that on the first try, I never had to do bugfixing for it … and no admin is needed.

Forums features now include:

  • Plasma-based right managment, you can for example say this Forum (Subforum) can be moderated by the Clanleader of a specific clan. and the clan can decide on its own who can moderate. Same goes for other permission, like “Admin” for Server Rules or similar sections or just plain old “USER” or “” permission where only users or everyone can post. You can set permissions for read, post and moderate
  • Support for BBCode and HTML post. HTML is checked by HTML::CGIChecker (thanks to whoever wrote that) and it forces the post to not kill the design and it even removes javascript and similars.
  • Moderators can move, split and merge threads with about 3 clicks.
  • It has not all the real features of a phpBB or similar: You can’t upload files, it only supports Signatures, Avatars and Custom Titles (No ICQ and Home and Phonenumbers, but I don’t need that anyway)
  • Complete backtracking of all the changes made (as a moderator) to a post.
  • Completly skinable using the Plasma skin sytems. (I already had that one, so why not use it).
  • All the other common Forum features: Unread posts, Sticky, Closed Thread, Quotes and Editable posts

Coding is fun 🙂


KB932596: death for non WHQL drivers under Vista x64

August 15, 2007

I just updated my Windows an guess, what: A lot of error messages telling me drivers can’t be found or installed (mainly PeerGuardian 2 and my TV-Card) , those drivers were not (for whatever reason) certified by Microsoft, so you had to  use “bcdedit -set loadoptions DDISABLE_INTEGRITY_CHECKS” to make them work, but after this “up”-date they won’t work anymore, so you will have to unistall KB932596 in your software-tab and reboot to fix this. I don’t think this update is used for anything else than to annoy people. Since the “more information” link (http://go.microsoft.com/fwlink/?LinkId=85125) currently doesn’t  show anything at all (at the time of writing). this one is staying of my system until someone has figured out how to circumvent this annoyance.

By the way: You will have to exclude this update in your Windows-Update tab or it will be installed again tomorrow.

Edit:

I found Microsoft’s explanation of this update, but  I am not very happy with it, as it gives no details at all: http://support.microsoft.com/?kbid=932596


Plasma – Maps v2

March 13, 2007

All my messing around with OpenGL has finally payed of a litte. I was able to introduce a small feature to plasma which makes the user able to rotate, zoom and move around the generated map of a system. The fun part is: All the 3D calculations (or what I think of it) is done in the browser by a small javascript, so it is  (somewhat) fast and produces no server load at all.

Thanks to this you can now move view maps that leave the ecliptic like Guanaga Proxy in Freelancer Evolutions. This makes understanding such systems a lot easier, since the top-down view is not much help at all.

New York

By the way, this is the first time I admitted Javascript is good for something at all.
Half a year ago  I would have said everything with “Java” in it is unusable and not needed for (yes even the coffee and the island) but since I was forced to deal with Java and Javascript I’m starting to like it both. Still not sure about the coffee. (Or coffee at all).

I think I’m losing it, but who cares. (Not me)

Addition: I can implemented much nicer looks now by mapping the z-coordinate to the z-index property of CSS.

z-index in action


Plasma – Maps

March 5, 2007

While I was still trying to replace IONCROSS with Plasma, I figured: why not replace Datastorm as well?
On my machine Datastorm takes around 10 Minutes to read all the information on systems, items, markets, bases and ships into its database and shows it. Plasma reads the same (including also the .cmp files for the ships to get all possible hardpoints for a model) in around 3 seconds.

Next thing to do was to build a nice output into the website and this is what came out of it (after a long fight between me and Cascading Style Sheets):

The Universe (TNG Mod)The New-York system (TNG Mod)

All images rendered in Minefield (Firefox 3.0 beta), because in Firefox 2, Opera or Internet Explorer the grafics look kind of pixelated. Thats because I can’t use transparent PNGs in IE. I have to use GIFs and downscale them and only Minefield can scale transparent GIFs bicubic which looks a lot better.