Welcome to my unobtrusive blog!
By default I blog in english but there is also german content.

Kwort is not dead

December 13th, 2008 Posted in english | No Comments »

Today as always I talked to David B. Cortarello about the future of Kwort and he asked me what I’d expect from the new version and he asked for help but I still don’t know how deep I will be involved in the development of this new version but that only depends on the time I’ll have “as always”.
Last year the deadline for kwort 2.4 was christmas and hell, David turned into a monster the more christmas got nearer so I’m lucky that the new version is planned for some day in 2009 :).

Kwort is a Slackware based linux distribution with its origins from Argentina and it’s still being developed. I know that David has developed a lot of tools to make the life easier such as a ndiswrapper gui tool which assists you with installing ndiswrapper “drivers” for your wireless e.g.! People who used Kwort in the past know that the whole environment which is XFCE is really polished and extended with useful tools.

Let’s see what the future of kwort brings for us :).

Wordpress: Getting the category via a post id outside the loop

December 10th, 2008 Posted in english | 2 Comments »

If you want to get the category of a post outside the wordpress loop, you can use the following sql statement to get the category id, its name and its slug:

SELECT term_id AS category_id, name AS category_name, slug AS category_slug 
FROM wp_terms 
WHERE term_id = (SELECT term_taxonomy_id FROM wp_term_relationships WHERE object_id=__POSTID__)

Replace “__POSTID__” with the post’s id.

Perl is the most supported scripting language

December 8th, 2008 Posted in english | No Comments »

It’s time to talk about the old mercedes that’s going to get a bad reputation. This mercedes is perl.

I enjoyed several articles I found on reddit.com and several guys start to compare perl with php but you can’t compare Perl with PHP because PHP is popular due to its easy deployment. Create a text file “foobar.php”, enter some code and it’s ready for the WWW. Speaking of Perl web applications, deployment is rather bad just as bad as with ruby or python.

Don’t get me wrong. I own a server where I run several mod_perl2 web applications and deployment was easy because setting up mod_perl on a dedicated server _is_ easy.

I also ran and run some perl web apps over fastcgi which is easy to set up, too if you know what you are doing and if you know your business in general but the whole process compared to deploy a php script is completely different. Now consider people just having some shared web hosting account. In most cases you won’t find a decent mod_perl2, dbd::whatever etc… on that host. In fact most bigger shared webhosting providers don’t even offer mod_perl at all. What they only offer is “cgi scripts” which means perl over plain CGI and this is a KO for perl in this case. I wouldn’t consider perl as the language of choice as well in this case…just because there is no practical reason.

I can even understand the shared webhosting providers because setting up mod_perl2 for mass hosting can be an impossible task and I think it wasn’t even thought about of when mod_perl was developed. I know one big shared webhosting provider who is running mod_perl2 and I can confirm that it runs but I think it’s just because no one else uses it :P. I won’t name the provider here because I can’t recommend it…I used to store my personal photos there but I also tried out the “features” of the provider…doesn’t matter here. I start to believe that mod_perl2 was only installed because the distribution did it “accidentally” at setup because they ran a very old version of dbd::mysql and when I asked them to update this package they never did it so I think they just relied on the packages redhat offered them…dbd::mysql 3.02 or similar they had installed which couldn’t handle stored procedures…

One other web framework for perl is mojo which I can recommend because it’s another way to build a reliable web app in perl but still…
I don’t think a web framework like mojo will help perl to become more popular just because perl coders are already out there and if you can’t find them it means they are already hired for good money. And existent perl coders know the quality of perl and that’s not the language syntax or the super-idiot-proof regex ;). No, it’s simply the ability of doing anything you want with perl. Hack some small scripts to do task A or task B…no problem! Write some complex web app with mod_perl2+some other web framework. Yay, no problem, too. You don’t like framework A? Well, choose framework B, it’s available! Just kick your browser to search.cpan.org and you’ll find something, I promise.
You need to develop a graphical user interface? hell, no problem, choose wxperl e.g…

So for myself I can say that perl is the most supported scripting language available. I can do almost anything with it and I can do it fast. I also have a lot of experts available in the WWW that are willing to help even when problems are really special. What it lacks for web apps is the “plug and play” functionality that php e.g. offers. “put script a in directory b and just run it”. It doesn’t matter for me as long as I can run a dedicated server for myself. If I had to use a shared hosting account though, I probably would switch to php for web apps. That’s for sure and why? Well, just because I have to choose the right “tool” for the right “job” and situation. The situation then would be “no fastcgi’ied perl, no mod_perl”…au revoir in _that_ case :). I don’t think I have to choose shared webhosting again but who knows.

And please don’t believe people when they say that perl is dead or in the process to die…it’s not. <– a dot, do you see that? :).

Kind regards,
Andreas.

Ada Webserver AWS Hello World Example on Debian 4.0 Etch and Ubuntu 8.10

December 4th, 2008 Posted in english | No Comments »

Hi, I wanted to experiment with the Ada Webserver called “AWS” and I faced several small problems that prevented me from running even a simple “hello world” example but with the help of the mailing list (archive) I could solve my problems and I want to share it with you.

The easiest way to get AWS up and running is to use Debian or Ubuntu Server and there may be other distributions out there that work fine as well but these two I did my testing on. I just can tell you that the setup under Microsoft Windows is cumbersome. Really, don’t waste too much time with it.

For Debian 4.0 “Etch” and Ubuntu 8.10 install the following packages with apt-get:

  • gnat
  • libaws-dev

I personally prefer Ubuntu 8.10 Server on my local test machine because Ubuntu provides newer versions of both packages. But the install process is the same…

If you are using Ubuntu Server 8.10 this will install the following packages:

binutils, gcc-4.3, gnat, gnat-4.3, gnat-4.3-base, libc6-dev, libgnat-4.3, libgnatprj4.3, libgnatvsn4.3, libgomp1, linux-libc-dev, libasis2007, libaws-bin, libaws-dev, libaws-doc, libaws2.5, libldap2-dev, libtemplates-parser-dev, libtemplates-parser11, libxmlada-dev, libxmlada3, zlib1g-dev

Create the following directories in your home or wherever you want:

  • awstest
    • obj

In the directory “awstest” create the file “default.gpr” with the following content:

with "aws";
 
     project default is
 
        for Main use ("helloworld.adb");
 
        for Source_Dirs use (".");
 
        for Object_Dir use "obj";
 
	package Linker is
  		for Default_Switches ("Ada") use ("-laws");
	end Linker;
 
     end default;

Now in the same directory create the file “hello_world.adb” with the following content:

with AWS.Response;
with AWS.Server;
with AWS.Status;
 
procedure HELLOWORLD is
   WS : AWS.Server.HTTP;
   function HW_CB (Request : in AWS.Status.Data)
                   return AWS.Response.Data
   is
      URI : constant String := AWS.Status.URI (Request);
   begin
      if URI = "/hello" then
         return AWS.Response.Build ("text/html", "<p>Hello world !");
      else
         return AWS.Response.Build ("text/html", "<p>Hum...");
      end if;
   end HW_CB;
begin
   AWS.Server.Start
     (WS, "Hello World", Port => 1234, Callback => HW_CB'Unrestricted_Access);
   delay 60.0;
end HELLOWORLD;

Now compile this app with: “gnatmake -Pdefault.gpr” and you should see something like this:

gnatmake -Pdefault.gpr
aws.gpr:40:35: warning: unknown unit "aws.os_lib"
gcc-4.3 -c -I- -gnatA /home/andreas/awstest/helloworld.adb
gnatbind -shared -I- -x /home/andreas/awstest/obj/helloworld.ali
gnatlink /home/andreas/awstest/obj/helloworld.ali -shared-libgcc -laws -L/usr/lib -laws -L/usr/lib -ltemplates_parser -o /home/andreas/awstest/obj/helloworld

This will give you an executable binary in directory “obj” with the name “helloworld” so let’s try executing it.
-> ./obj/helloworld

You can then access this httpd at “http://localhost:1234″ but hurry, you only got 60 seconds to try it. The normal “/” request will give you “hum…” and the request to “/hello” will give you “Hello World !”.

One last hint: for Debian 4.0 you need the “package linker…” part in your project file because the compiler in debian 4.0 is not aware of “library project files” that “aws.gpr” in “/usr/share/ada/adainclude” is. Thanks to Ludovic Brenta for that piece of information.

However, this was a rather basic example and you may get more ideas while browsing the documentation at https://libre.adacore.com/aws/aws-gpl-2.3.0.html and https://libre.adacore.com/aws/templates_parser-gpl-2.3.0.html.

It’s “finnish” but not the end :P…

Oracle, you failed attracting me for now

November 18th, 2008 Posted in english | 2 Comments »

Dear Oracle,
today I had some spare time I wanted to use for something productive so I decided to setup Oracle 11g on a 64bit linux system but I quickly found out that I can only use Oracle 10g XE for free where XE stands for Express Edition so I headed for this version on your website and I was looking for a 64bit linux binary which simply wasn’t available. I hit google to find out if it’s just a thing of your well designed and structured website but apparently it’s not because people are trying to load all kinds of 32bit libraries to get your 32bit Oracle 10g XE binary for linux running in a 64bit environment. After I discovered that I was thinking about setting up virtualbox to set up a clean 32bit linux environment but then I read up an article on wikipedia.org which claimed that Oracle 10g XE is only willing to handle up to 1G of ram…ehh…failed!

If you really want to come down from your arrogant turd start to be “compatible” and “portable”. In the meantime I’m playing with more compatible and portable systems.

Thanks.

IPSwitch WS-FTP Server 6.1.0.0 sucks!

November 13th, 2008 Posted in english | No Comments »

I just got a phone call from a customer who complained about the short timeout of the ftp server which is 60 seconds and I agreed with him and I promised him to change the value to 300 or whatever is bigger than 60 but now comes in the catch and it’s called WS-FTP Server 6.1.0.0. Believe it or not but you can’t change the default timeout via the administration panel but I found out that there is an update to 6.1.1.0 which includes this incredible feature of changing the timeout but I couldn’t download this update because you have to register this product at ipswitch and I don’t know the freaking details :/ so no luck at all you damn bastard. I remember the older versions of ws-ftp server where the administriation tool was a win32 application and you _could_ edit the default timeout there…of course you could…damn, that’s a standard feature!

I wouldn’t complain at all if there would still be the windows administration application but it’s not and now they have this “super fast web interface” which can handle less than the original windows app and with their updates they pull out new functionalities which are missing…in other words: they sold an unfinished product and the dumb asses out in the world are willing to throw out their money for crap like this.

DISGUSTING!

Ajax Webserver Jaxer from Aptana – Javascript on the server – my criticism

November 7th, 2008 Posted in english | 7 Comments »

Aptana is a Canada based company who is known for their integrated development environment and some weeks ago they released a new product which is called Jaxer, the Ajax Server that enables you to write serverside and clientside javascript at the same time and being able to write serverside javascript gives you a lot of new opportunities regarding flexibility, simplicity and speed. I could be a marketing guy, eh? :) But no…that’s just the impression when you read Aptanas’ website carefully. At least they got my attention and so I tried it out…

So what exactly is Jaxer?
It’s…

  • both client-side and server-side code can be written in JavaScript
  • server-side engine is based on Mozilla Gecko, the same browser engine that’s in the Firefox browser
  • server-side DOM manipulation
  • database access
  • file system access
  • network communications
  • user sessions

Jaxer in fact is an apache module that wraps the gecko javascript engine used in firefox 3 to parse and execute javascript code at the serverside if the programmer explicitly stated it with the “runat=server” property.
So if you e.g implement the following javascript into your “index.html” which is served by the jaxer module, it will be executed only on the server which also means that the client doesn’t see this code:

<script type="text/javascript" runat="server">
	pageId = Jaxer.request.parsedUrl.queryParts.id;
	switch(pageId) {
		case "index":
			loadScript("scripts/index.js");
			break;
		case "about":
			loadScript("scripts/about.js");
			break;
		default:
			loadScript("scripts/index.js");
	}
</script>

If the client now requests your “index.html” it doesn’t see this javascript code because it’s executed and evaluated before it’s being send to the client. If you would write “runat=client” instead, this code would be executed at the client which would result to a problem because my defined “function” “loadScript” uses methods from the Jaxer framework to include javascript files but still we can workaround it because Jaxer adds the “proxy” property which you can apply to every function you define and it’s really useful because the “Jaxer-Framework” contains a lot of methods that are only available at the serverside. So imagine we wanted to execute “loadScript” at the clientside (”runat=client) then we had to provide the proxy property…

loadScript.proxy = true;

Then you could use this function from the clientside. Even if it uses serverside functions. This is beside the ability to modify dom elements from the server side the most valuable feature. If you want to dig in to this topic a little deeper, check out Aptanas’ guide on this: http://www.aptana.com/jaxer/guide/develop_proxies.html

BUT…Javascript and the whole concept of all this has several big drawbacks which kick this whole concept to the ground where it belongs to. I’m really sorry that I even spent my free time on this because I was tricked and I really believed this _thing_ could make my life as a web developer more enjoyable but it didn’t and it won’t.

The first thing that bugged me was the documentation which really looked promising at first but there are several methods with the wrong case…there is simply no Jaxer.Response e.g. as written in the documentation…hell, I tried to simply redirect to google.com with “Jaxer.Response.redirect(’http://www.google.com’);” but I simply got “Jaxer.Response.redirect is not a function” in the error log which absolutely made no sense at that time but after I hit google I found out that the “object” is called “response” and not “Response”…ok, so “Jaxer.response.redirect(’http://www.google.com’);” worked, yay…I only lost a couple of minutes ;). But why didn’t they simply had an alias for it if they can’t remember it when writing documentation? I wanted to submit a ticket so they can fix it but I had to register for it and that was beyond my motivation, really…this is disgusting.

The second problem is to write proper xhtml because Jaxer modifies every html file, so e.g. the following conversion happens:
_original_

<img src="foobar.png" alt="foo bar" />

_rendered_

<img src="foobar.png" alt="foo bar">

And your html file will probably start like this:

<html><head>
		<script src="/jaxer/framework/clientFramework_compressed.js?version=1.0.0.4147"></script>

So if that’s not what you want, you don’t want Jaxer at all, because it limits you here. You are punked again, haha.

The next problem is to structure your project with Jaxer because you have to start with an html file where you probably have some javascript but how do you go on?

Let’s face a typical tiny example: a website that has an index and about page, both with the same header and footer.
So we create the directory “templates” for the “header.html” and “footer.html” template files. Then we create the “scripts” directory where we store the so called “controller” files which we name the same as the page: index.js and about.js. Cool, we are starting to get a usable structure which we could hand over to other programmers or developers but wait! Jaxer doesn’t supply a template engine at all so what are we doing now? Nothing except finding a javascript template engine which in my case is “jsRepeater” from http://jsrepeater.devprog.com which works really nice with jaxer/server-side. It’s based on jquery which you also have to download. I put all my serverside assets into a folder called “assets_server”.

My structure looks like this:

  • assets_server
    • jquery
      • jquery.js
      • jsrepeater.js
  • scripts
    • index.js
    • about.js
  • templates
    • footer.html
    • header.html
    • blogroll.html
  • index.html

Now my “index.html” looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<script type="text/javascript" src="assets_server/jquery/jquery.js" runat="server"></script>
<script type="text/javascript" src="assets_server/jquery/jsrepeater.js" runat="server"></script>
<script type="text/javascript" runat="server">
	pageId = Jaxer.request.parsedUrl.queryParts.id;
 
	switch(pageId) {
		case "index":
			loadScript("scripts/index.js");
			break;
		case "about":
			loadScript("scripts/about.js");
			break;
		default:
			loadScript("scripts/index.js");
	}
 
	function loadScript(scriptFile) {
		absolute = Jaxer.Dir.resolve(scriptFile, Jaxer.request.currentFolder);
		if (Jaxer.File.exists(absolute)) {
			Jaxer.load("file://"+absolute);
		}
	}
 
	function file_get_contents(theFile) {
		var p=Jaxer.Dir.resolve(theFile, Jaxer.request.currentFolder); 
		var f=new Jaxer.File(p); 
		f.open(); 
		myContent = f.read(); 
		f.close(); 
		return myContent;
	}
</script>

This script is simple. It just decided when to load what script file. So far this is acceptable and it really just works fine, so no complaint at this point. Keep an eye on “runat=server” because here we also run jquery and jsrepeater serverside which will make it invisible to the client.

The following file is my “index.js” which controls what is being displayed when you request ?id=index:

1
2
3
4
5
document.write(file_get_contents("templates/header.html"));
$("title").html("this is my frecking title");
document.write(file_get_contents("templates/index/blogroll.html"));
$("#blogroll").fillTemplate({"blogname":"blog.as.tl", "blogurl":"http://blog.as.tl"});
document.write(file_get_contents("templates/footer.html"));

file_get_contents is a function I defined in “index.html” which is globally available as we load all scripts through “index.html”. Sounds strange, but that’s it.

In line 1 the script simply reads and displays the header template file.
In line 2 the title will be changed. Remember that all this happens serverside. Keep in mind that this is functionality from jquery, not from jaxer.
In line 3 we print out another template which really contains “template tags” for “jsrepeater”. The template itself is simple and looks like this:

<h2>This is my blogroll</h2>
<div id="blogroll">
	<div class="blogname">${blogname}</div>
	<div class="blogurl">${blogurl}</div>
</div>

The method “fillTemplate” simply eats some JSON and if you want more documentation for this template library, please visit: http://jsrepeater.devprog.com/introduction.html. JsRepeater is meant to be run on the clientside but with Jaxer jsRepeater really turns out to be very useful.

This is all very easy and it simply works as expected but what really bugs me is that you can code as sluggish as you want and it seems that the whole “framework” which is Jaxer in this case fosters this behaviour, especially when you take a look at their examples. Sure, they all work fine but I promise you when your project starts to become complex your progress will slow down as you have to cope with the mess you produced with Jaxer.

Another thing that just caught my attention is that scripts that you include via…

<script type="text/javascript" src="scripts/bla.js" runat="server"></script>

…are still accessible from outside the server (worldwide access). I’m not the security guy but what if I put my mysql connection information into such a javascript file? Ya, the whole world could read that file just by knowing its location.
Perhaps I’m digging into how to work with Jaxer and databases but I don’t think that Jaxer has such a great future for me personally. It’s just ugly, messy, find a word for yourself.

I hope you enjoyed my little journey to World-Jaxney.

Kind regards,
Andreas Schipplock.

Syntax Highlight GeSHi for MediaWiki 1.7 Debian 4.0

November 4th, 2008 Posted in english | No Comments »

For those who have installed mediawiki 1.7 on debian 4.0 wanting to highlight sourcecode probably tried SyntaxHighlight_GeSHi to work properly but failed with every attempt, so did I but finally I found a version that works just fine and I also packaged it for you (Download).

Online video lectures

November 1st, 2008 Posted in english | No Comments »

English:

German: