Programming

Wordpress to Drupal

I know I have not posted at KalaaLog.com for quite a long time (a little more than a year). The reason for this, is not the subject matter of this post. The things that I started to ponder when I was upgrading the Wordpress installation is the subject matter.

C++ vs Java

Those who have been following me on twitter, would have realized that I have started to dabble in C++ recenlty. Those who know me personally, would know that I did quite a bit of my programming antics in that language. It is only for the past couple of years that I had gotten involved into Java.

Not to say that I have quit Java, but I find it quite refreshing to work in C++ again. There are some new constructs and features that the language is providing since I stopped working on it. Moreover, it seems like there are lot more standardization effort that has taken place.

Here are some to and fro articles in terms of Java and C++:

I am not really sure of the credibility of these authors, so please do your research before taking them as facts.

Speaking of C++, I do feel obligated to link to the Bjarne Stroustrup - the designer and implementor of C++.

deviantART Embed - Drupal Module - Beta Release 2

The deviantART Embed Drupal module version 1.0-beta2 is released.

In terms of user features, there is nothing new. But in terms of going the Drupal way, a major overhaul has been done on the module.

The dependancy list now includes the CCK, Embedded Media Field and Views modules. The project itself is split into two modules: deviantART Embed, and deviantART blocks.

deviantART Embed project architectture

This project is mainly the glue between core Drupal and the other reliable contributed modules. In fact, all the current features of deviantART module can be installing and enabling these dependent modules and manually configuring them. The module aims at providing the 'out of the box' experience in terms of integration with deviantART.com with a Drupal powered website.

The 6.x-1.0-beta2 release is usable, and I would release the final 1.0 version after some feedback.

The next item on my TODO list for this project is to provide user account association with a deviantART account.

deviantART Embed - Drupal Module - Beta Release

Just checked in the custom Drupal 6 module - deviantART Embed.

Further progress can be tracked over at the Drupal.org deviantART Embed project page.

The deviantART Embed 6.x-1.0-beta1 release is ready for download and feedback.

Use Twitter module - not Twitter Block

Yes, you are right. I am asking you to shift to using Twitter module instead of Twitter Block that I developed.

The reason is simple - Twitter module does a lot more than provide a Twitter block. It allows you to post directly to Twitter from your Drupal site. Just note that to use Twitter module as a Twitter block, you will need to install and activate Views and Views UI module.

It may seem like complicating things, but if you need flexibility and reliablity of a large team of Open Source enthusiasts, you should opt for the one that gets more effort put into.

You may not notice any change on my homepage sidebar, but I have shifted to using the Twitter module and it looks as my custom module with minimal change to the CSS. (I just changed the class to id supplied by the View).

Perhaps, I will write some basic documentation of what I got using the Twitter module.

deviantART Embed - Drupal Module

This is the second custom module, after Twitter Block, called the deviantART Embed module.

Unlike the last, this module creates another content type, which is similar to a Page or Story types except for another field called embed-id. This is the string of numbers at the end of the deviantART entry.

The module generates the embed code during display of a page. It also generates the required CSS class names so that it can be styled any way you want. For example, check out the first deviantART embed entry here.

Download: deviantART Embed

The module also gives a block that displays links to the latest published deviantART embed nodes. The number of links can be configured through Administer » Site configuration » deviantART module settings.

I have done some preliminary testing. If you find any bugs, do not hesitate to mention in the comments below.

Twitter Block - Drupal Module

This is related to the Twitter status you see on my homepage.

Update: There will be no support for Twitter Block module. Please use Twitter module instead. Read the reasoning here.

Styled Twitter Block

I was browsing around, when I came across Aaron's on adding Twitter to a Drupal site. Since I am in the process of redesigning my site, I was a little more aware of the closure variable and hence I commented so on his post. He nudged me on his respone through Twitter.

Thus, I created the Twitter Block module. It is quite minor and straight forward at this moment and advanced modules have already been coded. (See the modules download page over at Drupal.org).

Download module: Twitter Block

I am yet to put the license files, but it is provided under GPL. The installation is simple - just copy to your modules or sites/all/modules folder. You should get the Twitter Block menu in the admin/settings once you enable it. It lets you configure:

  • Twitter User Account
  • Twitter Block Title
  • Disable/Enable Follow Me link
  • Text of the Follow Me link

As far as the comment goes, I was able to add the Javascript references to the $closure variable. For a background, you can see from Twitter page, that putting the Javascript references near the footer increases the page load times.

Hot tip! To ensure loading of your page even in the case of twitter.com non-loading, move the two lines that start with <script type="text/javascript"... to the bottom of your page (just above </body>).

While coding this module, I took a wrong turn with the drupal_add_js() function, and after some trial and error, use the hook_footer() to get these Javascripts into the $closure variable properly.

Once you install and configure this module, you can sytle it by lathcing on to the block-twitterblock class. You can see the result of my current theming on the Twitter Block.

Credit goes to DryIcon via SmashingMagazine for providing the Twitter icon.

Deleted Kernel and Video Drivers

I guess I should be taking extra care when I am doing multi-tasking. I was casually cleaning up the old kernel images of my Ubuntu install, and I realized that I had removed all the kernel. I still had my OS up and running, and in working condition and from my experience, it can go on theoretically for ever as long as there is power supply.

But, I was anxious to restore, and quickly serched for the Kernel MetaPackages. Quoting:

These metapackages install the latest linux kernel and modules through a series of dependencies. These make upgrading the kernel much easier, and safer, since they ensure that all required modules and headers are also installed.

  • linux-generic: Always depends on the latest generic Linux kernel available.
  • linux-headers-generic: This package always depends on the latest generic kernel headers available.
  • linux-image-generic: This package always depends on the latest generic kernel image available.
  • linux-restricted-modules-generic: This package always depends on the latest restricted modules available for generic kernels.

So I fired up Synaptic Package Manager and installed those packages. To ensure everything was working, I rebooted.:)

Next login, I was greeted with a command line.

Snooping around, I found out that my nVidia drivers had gotten uninstalled and it was not able to start the X session.

It took a bit more snooping around in the command line. Brought back some memories - I know, it sounds geeky.

$ sudo apt-get install nvidia-glx nvidia-kernel-common

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package nvidia-glx is a virtual package provided by:
nvidia-glx-96 96.43.09-0ubuntu1
nvidia-glx-180 180.11-0ubuntu1~intrepid1
nvidia-glx-177 177.82-0ubuntu0.1
nvidia-glx-71 71.86.04-0ubuntu10
nvidia-glx-173 173.14.12-1-0ubuntu4
You should explicitly select one to install.
E: Package nvidia-glx has no installation candidate

$ sudo apt-get install nvidia-glx-180 nvidia-kernel-common

That installed the video drivers. A startx would not start the X session. So another boot, and I was back to normal.

Fun times.

On Ubuntu and Eclipse

I have been working on C++ again after a break of more than two years, and I found that Eclipse can be a good tool to do so. I have learned to get myself to be more productive in Java projects, but translating that knowledge to developing C++ in Eclipse requires at least Eclipse Europa - it is for me of course, because I have gotten used to that simultaneous release of Eclipse at work.

Sadly, Eclipse is at a older version - Callisto - in Ubuntu, even after the latest upgrade to the distribution itself - Ubuntu Intrepid Ibex.

Being open source, it lets me dig quite deep to find the status on this project:

  1. Ubuntu Brainstorm Idea # 1265
  2. Ubuntu Launchpad Bug # 123064
  3. Debian Bug # 432350

It is actually nothing new for me - at my day job, I deal with a lot of proprietary tools, and support - even when paid for - is quite flaky. At least, here I get some transparency.

Going through the Debian bug does give a bleak feel on the situation. Now, I have a choice:

  1. Live with it. ;)
  2. Live with an encumbered process of installing it myself and maintain it - but I am quite addicted to Synaptic Package Manager (read it as I am lazy).
  3. Dual boot (triple boot) to Fedora 10
  4. Help those maintainers to package Eclipse into Ubuntu/Debian repositories

I am not keen on option two. I might try out option three sometime. Since I am at the moment so fond of Ubuntu, I should be going for option four - but I do not know where to begin with to package an application and create a deb. I think I should start learning about it, so I guess I will be choosing option one for a while. :)

SQLite - Amalgamated Size

In my earlier post (SQLite - Embedable Database), I mentioned that a SQLite program takes about 26kB. This is not entirely true, since I think I had forgotten the exact nature of the linker.

The excutable program that resulted when I compiled and linked the test program, I had to use the -lsqlite3. The library resided in my system, and I am not sure if it was packaged into the resulting executable object. To check how much SQLite really took in terms of space, I got the SQLite3 Amalgamated source code, got the sqlite3.c and sqlite3.h into the test project and recompiled it.

The resulting program is 938779 bytes (~917kB), still less than 1MB. Not sure if I can calculate this way, but the SQLite3 takes about 891kB when embedded into a program. I think it also depends on the compiling and linking environment, but I am not sure of that.

Subscribe to RSS - Programming