Dec 07 2008

CCK & Views, My First Experiences

and probably my last one ..

I mentioned a couple of weeks ago that I was looking into a way of converting my static page with published papers, articles and presentations in a more dynamic page where I could create RSS feeds from the updates and feed them into another site for everybody to use.

Some people suggested that I'd have a look at CCK & Views for this. While up till now when creating an app I had usually written my own Drupal module with my own database schema and manually written SQL Queries. This indeed looked like the perfect opportunity to dig into the CCK and Views thingie.

Now I must admit that I`m not really fond of "generated queries"

I've had nightmares before when having to debug 2Mb Hibernate queries that could be reduced to a single select value from table where query but Hibernate used a zillion join on tables I didn't need.
So I was a bit afraid of what Views would do ..

So here's what happened, I created 2 pages .. presentations. and publications. Personally I'd go for 1 table each with some smart indexes and then the only thing you want is SELECT * FROM table ORDER BY date

Now if I'd create a special content type for this I probably get some more benefits.
And I could get the data from the tables with a rather simple query like this :

  1. SELECT node.nid,
  2. content_type_presentation.field_datum_value,
  3. content_type_presentation.field_location_value,
  4. content_type_presentation.field_country_value ,
  5. content_type_presentation.field_event_link_title,
  6. content_type_presentation.field_event_link_url
  7. FRON content_type_presentation, node
  8. WHERE node.type="presentation" AND node.nid = content_type_presentation.nid
  9. ORDER BY content_type_presentation.field_datum_value desc;

However when using Views , this is what is being created.

  1. SELECT DISTINCT(node.nid) AS nid,
  2. node_data_field_country.field_datum_value AS node_data_field_country_field_datum_value,
  3. node_data_field_country.nid AS node_data_field_country_nid,
  4. node.type AS node_type,
  5. node_data_field_country.field_event_link_url AS node_data_field_country_field_event_link_url,
  6. node_data_field_country.field_event_link_title AS node_data_field_country_field_event_link_title,
  7. node_data_field_country.field_event_link_attributes AS node_data_field_country_field_event_link_attributes,
  8. node_data_field_country.field_location_value AS node_data_field_country_field_location_value,
  9. node_data_field_country.field_country_value AS node_data_field_country_field_country_value,
  10. node_data_field_link.field_link_url AS node_data_field_link_field_link_url,
  11. node_data_field_link.field_link_title AS node_data_field_link_field_link_title,
  12. node_data_field_link.field_link_attributes AS node_data_field_link_field_link_attributes,
  13. node_data_field_link.nid AS node_data_field_link_nid
  14. FROM node node
  15. LEFT JOIN content_type_presentation node_data_field_country ON node.vid = node_data_field_country.vid
  16. LEFT JOIN content_field_link node_data_field_link ON node.vid = node_data_field_link.vid
  17. WHERE UPPER(node_data_field_country.field_country_value) != UPPER('')
  18. ORDER BY node_data_field_country_field_datum_value DESC

So there's some joins, a zillion more fields that I don't really need being fetched from my database.
The explain also tells me some interesting things.. like the Using temporary AND Using Filesort

  1. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  2. +----+-------------+-------------------------+--------+---------------+---------+---------+-------------------------------------------+------+----------------------------------------------+
  3. | 1 | SIMPLE | node_data_field_country | ALL | PRIMARY | NULL | NULL | NULL | 33 | Using where; Using temporary; Using filesort |
  4. | 1 | SIMPLE | node | eq_ref |vid | vid | 4 |buytaert_blog.node_data_field_country.vid | 1 | |
  5. | 1 | SIMPLE | node_data_field_link | eq_ref | PRIMARY | PRIMARY | 4 | buytaert_blog.node.vid | 1 | |
  6. +----+-------------+-------------------------+--------+---------------+---------+---------+-------------------------------------------+------+----------------------------------------------+

Now my simpler query uses the same amount of rows to return the result but doesn't build a temporary table.

  1. +----+-------------+---------------------------+------+-----------------------+------+---------+---------------------------------------------+------+----------------+
  2. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  3. +----+-------------+---------------------------+------+-----------------------+------+---------+---------------------------------------------+------+----------------+
  4. | 1 | SIMPLE | content_type_presentation | ALL | nid | NULL | NULL | NULL | 33 | Using filesort |
  5. | 1 | SIMPLE | node | ref | PRIMARY,node_type,nid | nid | 4 | buytaert_blog.content_type_presentation.nid | 1 | Using where |
  6. +----+-------------+---------------------------+------+-----------------------+------+---------+---------------------------------------------+------+----------------+

In this small example there isn't much difference in performance to be noticed, but with bigger tables you will see other results. However I still prefer my personal query approach.

The other thing that bugs me is the excessive use of aliases. The MySQL internal experts can shed a light on the performance impact of using them, but if you are running queries remotely you at least have an increase in bandwidth usage. Not a problem now, but who knows later when you are big and famous :)

Now Drupal seems to do it pretty ok .. it's aliasing table.field to table_field which still makes sense. Not unlike some other tools that alias table.field to dynamically_generated_unreproducable_unreadable_key_word_with_no_relevant_meaning , try debugging that for a change. And yes I see valuable use for resultset aliasing, but I also se it is often overused.

But the short summary ... given my background I prefer writing the module and crafting my own queries over having Views create
a query for me.

Dec 07 2008

Puppy FUD

Dries commented on Seth reporting about the puppyfud some proprietary company not understanding open source was uttering.

It was a pretty lousy comparison actually .. they compared Open Source software to a Free Puppy.. it looks nice and cheap at first but it will cost you anyhow as it needs food and shots etc so it isn't really free after all.

Now the fact is that with the proprietary stuff they are trying to shove down their customers throats, their CMS's also need configuration, updates, and styling left and right, probably just as much as the Open Source alternative out there.
Now as they have a proprietary platform the chance that they have an equally big expert group around their product is small, people don't just buy software to learn it, however they will download a piece of interesting open source software to get aquanted with it.. There probably won't be that much free examples and tips and hints a round, or even free themes to base a site on ..

So no the purebred puppy really isn't the better alternative it's going to cost you equally in maintenance and you have to pay the high cost to actually be able to play with it .. or did you think it would be your software after you payed the pricetag ?

Now there's more bad news for the purebred software buyer. He isn't free to go to any vet, no , he has to go to a specialized one in his breed, actually if he doesn't do so once.. he risks never to be helped by another one in the future either.
And no choosing which food to buy for the puppy, no ther's just 1 brand that works, or maybe 2 .. but the prices have been set .. and it won't be cheap.

So what do you want .. the freedom to go to any vet you like, and to buy dogfood where you want , or even give them some of your own leftovers. Or the heavy pricetag, AND the limited choice in vets and food.

Dec 06 2008

The Eclipse of Sun

If you've been reading this blog for a while you'll know that
for the past decade I've had a love-hate relation ship with Sun.

Sun has done a lot of good things in their open source journey such as MySQL, openOffice , Virtualbox and opensourcing Java. But on the other hand they had troubles with creating really organic opensource.

I've always wondered why a company that bought StarDivision because it was cheaper than buying the MS Office license keeps wasting money on building it's own operating systems, albeit in a pretty open model, but with zero to no relevant community.

Yes I've ranted on their marketing boys and girls when they polluted forums I liked. But no I don't want this to happen. (Slicing up Sun)

However I`m in fear it actually might happen, the funny thing is that I already mentioned the same idea in offline conversations during the last couple of months.

My Advice to Sun. : Stop putting money in things you can co-create with other organisations, if there's only 2 features in your product that count for some people, contribute those 2 features to something bigger.
(That's D-Trace and ZFS and the Linux Kernel I`m talking about in case you didn't realise) Why keep throwing money down the drain ?

Also let Google, Percona and others contribute to MySQL, don't keep it as closed as it is today. As after al it's more Free software than it is Open Source, but it has a great community which I love to be part of .. and I hope for a long time to come..

I`m going to try to keep my mouth shut on this for a while.. as I think Jonathan is listening anyhow. If he was, he would have known that at some point in time when you step out of the shower and there is too much hair dropping from your skull every morning, it's time to cut off the ponytail.. , not opensource it. I did that years ago.. and it's growing much thicker again now.

My hair that is ..

Dec 06 2008

Wordpress is Slow !

because of a fine DNS problem

So it can obviously happen to other platforms as well :)

Dec 04 2008

Ripped of at RestaurantWeek.be

My mother suggested that she would babysit while the 2 of us went out to eat yesterday. The idea was to have a good dinner in one of the restaurants that took part of the Restaurantweek.be action.

The idea is that you get a 3 course dinner for 25 Euro a person in a good quality restaurant .. therefore no brasserie or pubfood. With different of the top restaurants of antwerp taking part of the action we decided to pic a new one we didn't know yet.

Branche Restaurant , which is the restaurant of the new Golden Tulip Hotel next to the Antwerp Train station.

When we arrived there yesterday we got asked for a voucher for the 2 for 1 action. We were pretty clueless at that point as we never heard of the 2 for 1 action. We were there for a culinary action from Restaurantweek.

The menu for the evening was going to be schrimp salad, pepper steak and tiramisu. WTF ? I can make that myselve, or If I`m hungry and I need to eat that's what I grab in a tavern, that's not what I wan't to have when I go out to eat !

But it was only going to cost us 25 euro for the 2 of us claimed the waiter.
Well.. we had to eat anyhow so why not ..

Somehow they forgot we had ordered one steak well done, and neglected to ask about how the other one. So we sent the rare steak back to the kitchen. I actualy had to get up and go ask where it stayed after about 20 minutes. By then the fries were cold.. so I asked for new ones.. by the time we got those.. the steak was cold. We got offered a free drink for the delay .. but never saw that drink anyhow.

We had dessert ... and asked for the check .. obviously I was kind of surprised that they had charged us 2x 25 Euro, unlike what they had told us upfront.
The waiter explained that he didn't know about the Restaurantweek arrangement and he mistakenly assumed we had the other , the 2 for 1 offer, the 2 for one offer got that menu for 39 Euros for 2 persons. And well.. they had given us the same menu for 2x25 euro ..

We weren't there for some cheapo fries and steak in the first place.. we went there for a culinary dish. And 39 euro's for that menu would have been a big RipOff anyhow. The only reason why we accepted the offer was because it was damn cheap and we had to eat anyhow. So now we had had crappy and way to expensive food, and bad service as well and we were inadvertedly informed that most of the tables around us that actually had the 2for1 offer even paid 10 euro less for the same menu.

Upon asking for a "btwbonneke" the waitress was absolutely clueless, c'mon .. if you work in a restaurant in Belgium you have to know what a 'btw-bonneke' is.
She didn't , luckily her collegue knew.

So Restaurantweek really should have communicated better with their restaurants that people signing up for the offer expect something different from Steak with Fries and a small schrimp salad upfront.

And as for the Branche Restaurant service .. well.. guess you'll never see us again .. and I gues you'll never see the table that was sitting next to us again either. The least you should have done was actually give us the menu for 39Euro's like some of the other tables and give us another drink as you had promised anyhow.

But all you got now .. was bad publicity. But then again .. you won't go bankrupt ..as you are part of a hotel, and a hotel needs a restaurant anyway so why should you bother in the first place.

Dec 01 2008

Tab Dump , Drupal Performance

Have to close some tabs .. what more can I say ..

2 interresting articles about Drupal and MySQL performance tuning

here and here

Enjoy

Dec 01 2008

Next Step, Done

I just blogged that I wanted the skype plugin to work in my pidgin, only to have 1 central chat window.

Guess what .. this really works. it's that simple .. copy the 2 files, then setup the account .. I just had to disable the annoying skype sounds :)

Dec 01 2008

Upgrading to Fedora 10

As some of you know I run Fedora on my main Laptop, and Ubuntu on my EEE and my office Desktop. My Ubuntu installs were pretty fresh, but my fedora was long due for an upgrade. As after years of abuse (--force --nodeps) it usually is impossible to do a regular upgrade, so my best way out was a quick and fresh install on an isolated root partition. (my /home/ etc live on separate volumes)

Johan tricked me into installing a FC10 x86-64 setup which required some more work than usual, but I`m back in the same state as I was before I started the upgrade. We'll almost .. as I expect I`ll be reinstalling packages I don't daily use on a frequent basis over the next couple of weeks.

I'll dig a bit deeper in my x86_64 struggles later but first I had to tackle the problems I had with stepping my Evolution to a fresh and hopefully more stable version.

Evolution fails to recognise the fact that I have multiple calendars, or got confused.. anyway .. my calendar was empty and I had to recreate them all and import them again one by one.
Luckily the content was still available in .ics

Also Evolution partly forgot about all my email accounts , it remembered their passwords after recreating them, but not their settings.. well. that is if I managed to recreate them all :)
(If I`m not replying to a mail you sent me sinc last thursday.. I might just have forgotten about that email address ..

On to the x86_64 stuff then. Bort pointed me to the
Adobe Labs site that had a working flash plugin. The right symlink in my .mozilla/plugins and the first problem was solved.

There's 2 apps from Google that I sometimes abuse, I don't know why I still use Picasa, there must be plenty of good open source alternatives out there .. however for Google Earth I don't really have a good alternative. bot work (unlike previous Fedora/Googl Earth combinations)

The only thing that annoyed me was Google Earth and selinux , I had to run some chcon s to solve the problems.

  1. chcon -t textrel_shlib_t '/opt/google-earth/libminizip.so'
  2. chcon -t textrel_shlib_t '/opt/google-earth/librender.so'
  3. chcon -t textrel_shlib_t '/opt/google-earth/libauth.so'
  4. chcon -t textrel_shlib_t '/opt/google-earth/libevll.so'
  5. chcon -t textrel_shlib_t '/opt/google-earth/lib*'
  6. chcon -t textrel_shlib_t '/opt/google-earth/libnavigate.so'
  7. chcon -t textrel_shlib_t '/opt/google-earth/liblayer.so'
  8. chcon -t textrel_shlib_t '/opt/google-earth/libmeasure.so'
  9. chcon -t textrel_shlib_t '/opt/google-earth/libbasicingest.so'
  10. chcon -t textrel_shlib_t '/opt/google-earth/libgps.so'
  11. chcon -t textrel_shlib_t '/opt/googleearth/libgooglesearch.so'
  12. chcon -t textrel_shlib_t '/opt/googleearth/libinput_plugin.so'
  13. chcon -t textrel_shlib_t '/opt/google-earth/libflightsim.so'

A couple of more frustrations later and the SELinux config got changed. Afterall .. Life is to short for SELinux.

A must, if you used too have Livna , or FreshRPMS is RPMFusion a merger of the old repositories

Skype seemed to be a bit more difficult. I tried installing the rpm at first but I failed , then I read some tips which suggested to use yum localinstall skype*.rpm

As I`m more of an apt-get user (yes even on CentOS etc) I don't usually try installing packages that way .. but it worked like a charm. Skype started, I could connect to the servers , however a test call reveals no input sound. Maybe if I try again with a headset later.

Anyway, I`m pretty satisfied so far ...

Next step is to get that skype chat integrated in pidgin.. or hope people will realize they have to drop that proprietary tool one day..

Nov 28 2008

! Barcamp Gent II :(

I predicted it to some people and it actually became true :(

I just removed myselve from tomorrows BarcampGent 2 subscription list.

It seems I can make it to most of the "odd" issues of Belgian Barcamps, I made it to BarcampBrussels, BarcampBrussels3 and the first BarcampGent, but for the Even Barcamps , Brussels2 and 4 and now Gent2 there always seems to be something that eventually blocks me from going. Just like with the BXL edition family priorities kicked in.

Anyway .. have fun tomorrow .. I`ll be thinking of you folks
and see you next time :)

Nov 25 2008

Santa Came Early

Santa delivered his goods early at Inuits this year

Sorry John, but we figured the Girls in Your shirt trick would be better than the tags on your Fedora one :)

Bort has another pic, and Dieter suddenly wants to test Zenoss too :)