Archive for October, 2010


BlaatSchaap members might already know this, but I am working on an in-site translation tool.

If you want to help translating, please do so ;)

Well… I’ve been working on the site, and I am making progress. I have now a ‘menu’ in JavaScript/CSS.

I thought it was time to throw in some graphics. I’ve looked in the http://www.openclipart.org/ (Update: moved to https://www.clipsafari.com/ ) Open (Public Domain) clipart to find some graphics. (The current BS logo comes from there
as well)

Since we have modern browers nowadays, I decided to try to use the SVG format, as served on that site.

It works fine in Opera and Chrome, but Firefox is a bitch. Both Opera and Chrome will accept the img tag for an image in the svg format.

Firefox does not, and will only accept it through a object tag. The object tag has it’s problems, transparency is not respected and the onClick() events are not fired. And more problems, like it doesn’t scale lime I can so in the img tag. When I try that I will get scrollbars. Turned out I needed make some patches in the svg file itself to allow it to be scaled.

https://bugzilla.mozilla.org/show_bug.cgi?id=276431
(looks like it will be solved next firefox 4 beta?)
(a bug reported in 2004?)

MySQL

I should be studying. I have a databases exam
on monday, but in stead, I am scripting again.
Like I said before, it’s the wrong time for
my inspiration to kick in, but it did. lol.

Since I’ve learned some SQL during class I’ve
never seen before, I decided to use it. As, for
what I am trying to do, I needed something like
I’ve learned in class.

Welcome to reality: It doesn’t work in MySQL.
What good is it to be tought something that
doesn’t work like that in the Real World™?

Okay, MySQL is not the only database software
out there, but it’s one of the major SQL implementations
out there, isn’t it?

I am talking about the EXCEPT operator
( http://en.wikipedia.org/wiki/Set_operations_(SQL)#EXCEPT_operator )
which is not supported by MySQL
( http://bugs.mysql.com/bug.php?id=1309 )

The example on Wikipedia doesn’t exactly need
the except operator, could be written by just
changing the where clause.

The problem I am running into, makes it hard
to rewrite without the except operator.

As I am rewriting the site, the internal database
structure changed as well. I am trying to write
a script that imports data from the old database
to the new database.

The affected part is the rights management system.
The old site has only an access list for private photos.
This is stored per-photo. A simple table with three colums
(id, photo, user) where photo is the photo id and user is
the user id. Plain and simple.

The new rights management system will be more complex.
The idea is to create groups of friends, and assign one or
more of there friendsgroups as authorised to access the
item. (As it will not be limited to photos anymore in the
new design)

Now, the conversion. I look at each private photo, and
take it’s ID. I look this ID up in the table I described above,
and retrieve the user IDs of this photo.

Now, I want to check if there exsist a friend list
containing these people AND NOONE ELSE.

select `list` from `friendlist` where `friend`=’14’ or `friend`=’41’ except (select * from `friendlist` where not `friend`=’14’ and not `friend`=’41’)”;

This would be the query to do so, except for the fact
that MySQL doesn’t support EXCEPT.

Like I’ve mentioned before, I am working on a new version

of the BlaatSchaap Website. This is supposed to be a ‘live’ 
website. Loading content dynamic without refreshing á la AJAX.
So, depending on what page the user is looking at, I
include different JavaScript source files, using the method found on
On page load, this method works correctly, but since I want to 
be able change the content of the site from JavaScript only
after the initial site is loaded, I want to include more script
based on user events.
That’s when the trouble appears. When I try to use this method,
after the initial page load, the document.write function, used
in this method causes my whole document to disappear.
I’ve only started using this method, after my initial attempts to
just write the code to a div caused in no result, the code wasn’t
being parsed. It seems the code is only parsed when I use the 
document.write function.

How to be successful in life?
What does that even mean?
Making your own choices, and live with
the results, whatever they might be.
Maybe that’s what it means?

In February, I started studying at the
Eindhoven University of Technology.
I’ve moved out, living on my own since
March. My choices. My own choices.
I have more freedom now, not living
with my family now. I am free to do
what I want. But that also means I am
free to screw up now. With that, I mean,
if something goes wrong, it was my fault,
no one else to blaim. But it also means,
if something goes wrong, it’s my problem,
I don’t have to justify it to anyone, just myself.

Let’s see…. I started studying in February.
Now, I am taking the basic math and linear
algebra and logic courses again. I failed for those
tests half a year ago. I will also have to take the
statistics a course again, which I also failed.

At the beginning of this year, I wasn’t very stable.
That might explain why I didn’t pass all my tests.
Let me say, I even worse before I started studying,
and nowadays I am feeling much better. But what
was going on, earlier this year?

Like I said, I wasn’t being very stable, and, like I
mentioned before in my other blogposts, there was
Joshua. I was in love with him, and he made me happy.

But, what was the problem then? I was too dependant.
I depended on him to be happy. It was like, I could only
be happy when I was talking to him, and so, I spend all
my time talking to him, neglecting my homework. And so
I failed my tests.

But like I said, my problem, not yours! I will take the test
again, and succeed this time. That’s the plan! And I am
not giving up that plan, because, like I said, I am here,
here in Eindhoven, only because it was my choice.

This is my life, my choices, and I am not allowing anyone
to stop me from doing what I choose to do. And even if I
will fail, then it’s only because of the choices I made.

And I might have explained why I failed the first time, but
also, that was my choice, I didn’t have to do that.

Even if I will fail university, I will still be successful in life,
because, it was all because of my choices, and what resulted
from them, and not because I let you made that choice for me.

P.S. I might blog some more soon ;) I might have some
inspiration by some conversations I had recently.

Yeah, another post, I am spamming, allright?
I can think about a few more things I wish to
write down. Well…. like I mentioned in my
previous post, I was supposed to do my AJAX
stuff during summer vacation, but I didn’t.
No movitation, no inspiration.

Well… the reason behind the lack of
motivation, well… I was just emotionally
not feeling like doing something like that.

I guess…. I wasn’t feeling that well the
first half of this year. Not complaining though,
I’ve mentioned this before, I don’t want to use
the word depressed, since, compared to
December 2005, it was nothing.

Then, how did I get through the first
half of this year? Well, I guess, most of
the people who read this already know
the answer to that… was Joshua.

Man, I was really in love with him, and then,
from one day to the next, he started acting
like never anything happened between us.

It wasn’t going well between us for a while.
It started when summer vacation started, and
that also explains why no coding happened
during summer, since I was feeling sick because
I missed Josh so much. Yet another time my
heart was broken. Another love disappeared
into nothingness. Is that all that ever happens to me?

I think I will tell more in another blogpost, because
there are still many things, on various related
subjects I want to tell.

But Josh…. the thing that bothers me most is the way
it ended. He just started acting like nothing ever
happened, even though, just days before, he was
saying things like he would always be there for me,
yada yada, then, he disappeared, and then,
when he returned, he was acting, well,
like nothing ever happened. But the worst thing is,
when I asked him about it, he refused to answer.

Yet, to the point where I am now…. do I wish I
never knew him? The answer is… I wouldn’t
want to change anything that happened,
I was having a tough time, and he helped me through.
He even made me happy, if only for a short while,
he did.

And besides that, because of Joshua, I’ve made some
new friends on facebook. People I wouldn’t know
without him, so, in the end, I wouldn’t even want to
change anything to what happened. The people I
know because of him, and an old friends I started
talking to again, because of him.

And when I think about it….it’s all a chain of events,
everything started, that afternoon, at college, that
afternoon, when I decided not to go home get, but
sit in the canteen and surf a bit on the internet….
An action, seeming to insignificant, but it seems,
that decision had a huge impact on my life.

Okay, people started complaining I should blog some more,
so, here it goes.

I’ve finally started something that I planned to do during summer
vacation. But until recently, I was lacking inspiration and motivation.

But, what I planned to do, and what I started to do, is take a look
at JavaScript and more specifically, AJAX.

I’ve never used the language before, but well… it’s just another
language. The basics of coding are the same anyways.

So, what I trying to do, is to bring the BlaatSchaap site to a new
level. Let’s call it “BlaatSchaap Live”. Basically, it means, let the
site do stuff that facebook does. Notifications if someone leaves
you a comment, without refreshing, and stuff like that.

When I started working on the current site, about two years
ago, I decided to do no JavaScript. Everything would be
server rendered, to make the site depend on the browser
as least as possible. In practice, it turned out, old browsers
wouldn’t render the site correctly anyways.
*casts a dirty look at internet explorer* Yeah, Internet Explorer,
older then version 8, renders CSS in a…. rather weird way.
This is something I experienced with the Radio BlaatSchaap
site back in the days. Two divs next to each other, with the
same height specified in the CSS would render with a
different height.

Well… enough about that. *casts another dirty look at MSIE*
That browser is officially ‘unsupported’ at my website anyways.

So, AJAX, JavaScript and PHP it is. So, I am rewriting everything.
Both server side and client side. I am working on a more modular
design too. I am thinking about writing a server rendered version too,
within the same new modular design, I am trying to separate functionality
from rendering code.

In the old design, it was all-in-ons. Every functionality module just added
it’s output (HTML code) into a variable, that get’s echo’d in the end.
In the new design, everything gets stored as XML in a variable.
In AJAX mode, XML renderer, the XML code gets simply echo’d
again.

If I decide to create a server rendered version of the site, this XML
gets processed again and so the content will be generated. This
may seem a little double work, encoding and decoding XML again,
but this way I can generate my content more flexible.

Current BlaatSchaap mobile support is also minimal. And the rendering
of the mobile part is also determined in the functional modules, another
reason to implement the new design.

There are also some other things about the current BlaatSchaap site that
must be changed, but I’ve decided to change them while rewriting, since
everything will be re-designed to fit in the new modular structure.
I am talking about redesigning the messaging system, adding photo album
support rather then just photo uploads.

A new feature I already started working on in the old model, and that
most likely won’t appear live in the old design, is a ‘facebook-like’ wall
support. The current WIP implementation already supports posting
external photos to your wall, with on server image caching.
Well… this feature will have to be ported to the new structure.

I might even restart some other BSCP’s (BlaatSchaap Coding Projects)
that have been frozen for the past years.

*pokes Nuky*  I might even consider BlaatNET ;) I even have my
plans for that :P

Another project, that has been sitting in the freezer for years
is BlaatScrobbler. This project was frozen because I had some
Mutex problems, on Windows, that is. and as you might know,
Windows is not my favourite OS, and that includes coding for it.
Interprocesscommunication, you know. I have my shared memory
working, but I need to signal my application when it can read data
from the shared memory, but that damn mutex refused to wait…

Yeah, that was another coding project from long ago.
So much to do….. so much I should have done the past
years. But now, now I finally have found my motivation,
I have more important stuff to do, like studying for my exams.
Damn math!

When you google for information about converting NTFS to ext2/3/4,
you will find many pages saying it’s impossible.
Actually, it’s possible, and rather simple to perform this conversion.

The command to perform this conversion is “anyconvertfs”,
which is part of the “anyfs-tools” package.

[root@blaatkonijn andre]# anyconvertfs  /dev/sdd1 ext3


Converting of “/dev/sdd1” from fuseblk to ext3

New filesystem label: “”

Old filesystem blocksize: 4096

Blocksize for new filesystem: 4096

Mount point: “/tmp/anyconvertfs2910/mountpoint”

Mount options: “rw”

Temporary directory: “/tmp/anyconvertfs2910”

Inode table: “/tmp/anyconvertfs2910/inodetable”

First step which destroy old filesystem: 5

Rescue List: “/tmp/anyconvertfs2910/rescue.list”

Rescue Directory: “/tmp/anyconvertfs2910/rescue”

Please, attentively check information above,

and then press Enter



Step 1. Building inode table (with build_it).

build_it 0.85.1c (19 Jun 2010)

creating inode table: 99.84% (18383/18413) done   

Done


Step 1a. Rescue (copy) files not aligned with block boundaries.

Done


Step 2. Noops (check if enough space) reblock anyfs (with reblock).

Good. Filesystem already has 4096 blocksize

Skip


Step 3. Reblock anyfs (with reblock).

Skip


Step 4. Noops (check if enough space) build new filesystem (with “build_e2fs”).

build_e2fs 0.85.1c (19 Jun 2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

61063168 inodes, 122096000 blocks

6104800 blocks (5.00%) reserved for the super user

First data block=0

3727 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks: 

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 

4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 

102400000


Starting search of info blocks at system blocks

Search user info at system blocks: 99.99% (122084808/122096000) done   

Releasing blocks of system info successful

Starting building ext2fs filesystem

building inodes: 100.00% (135772/135776) done   

Creating journal (32768 blocks): 

Done


Step 5. Build new filesystem (with “build_e2fs”).

Sleep 7 seconds… It’s your last chance to save the old filesystem.

Press Ctrl+C to cancel converting.

7…6…5…4…3…2…1…0…

build_e2fs 0.85.1c (19 Jun 2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

61063168 inodes, 122096000 blocks

6104800 blocks (5.00%) reserved for the super user

First data block=0

3727 block groups

32768 blocks per group, 32768 fragments per group

16384 inodes per group

Superblock backups stored on blocks: 

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 

4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 

102400000


Starting search of info blocks at system blocks

Search user info at system blocks: 99.99% (122084808/122096000) done   

Releasing blocks of system info successful

Writing inode tables: 99.97% (3726/3727) done   

Starting building ext2fs filesystem

building inodes: 100.00% (135772/135776) done   

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done


This filesystem will be automatically checked every 32 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

Done


Step 5a. Move rescued files to new filesystem.

Done

Inode table was saved. See “/tmp/anyconvertfs2910/inodetable”.

rmdir: failed to remove `/tmp/anyconvertfs2910′: Directory not empty

Successful