Jul 20 2010

WordPress theming – how-to guides and tutorials to a beautiful WordPress theme

We love WordPress for blogs and simple presentation sites. While we prefer Drupal for more complex projects, WordPress is simpler and faster for basic projects as has a friendlier admin interface to boot. On top of that, WordPress has more themes available compared to Drupal themes.

There are many free and affordable WordPress themes available as well as good providers of theming services. But often you want something a bit more customized and unique. If you know some basic HTML and CSS, these guides and tutorials can help you do everything from small modifications to building your own theme from scratch:

Guides and Tutorials

WordPress theming frameworks

Simple Wordpress theme generator – as a starting point

WordPress tutorial videos (theming and others)

  • Share/Bookmark

Jul 20 2010

iPhone 4 and the new gyroscope – much improved augmented reality

The iPhone 4 features a gyroscope for the first time (which is much more sensitive than the old accelerometer based motion sensor). This leads not only to much improved gaming but also a less jerky augmented reality experience.

The iPhone apps, however, have to be rewritten to take advantage of the new sensor. AcrossAir has done just that and posted a comparison video of the new improved AR experience.

How well does the gyroscope work for gaming? Take a look at the first iPhone 4 gyroscope game. Another video of “Gun Range” here.

  • Share/Bookmark

Jul 16 2010

Drupal theming resources – free themes and paid designs

As we rely more and more on Drupal for our Web projects, theming becomes an increasingly larger part of our development process. Everyone wants a site that looks and feels unique and professional. Luckily, there many resources available for Drupal theming if you don’t have as much time or are on a tighter budget:

Free Drupal Themes

Paid Drupal design themes and services

Coding sources/tools

What are your favorite free Drupal themes?

  • Share/Bookmark

Jun 29 2010

Beautiful graphics done without images: CSS3 and HTML5

I recently came across some beautiful Web graphics done without the use of any images, done purely in HTML 5 and CSS 3. I thought I’d share these little nuggets with you:

The examples work best in HTML5/CSS3 compliant browsers, ideally Safari 5 and Chrome 5, and to a lesser extent in Firefox and Opera. Don’t bother looking at these with Internet Explorer. :)

If you have any more examples of pure CSS, post them in the comments!

  • Share/Bookmark

Jun 13 2010

Performance Tuning Apache Web Server – Enabled Modules

There are many different aspects to tuning Apache. In this post, I will focus on tuning which modules are compiled into Apache and also dynamically enabled. The more modules you have enabled, the more memory Apache will consume and the more processing it needs to perform; try to enable the minimum amount of modules required on your Web server to improve performance and reduce memory consumption:

1) First, list which Apache modules you have enabled on your server:

apache2 -l — this will list all the compiled in modules

a2dismod — this will list all dynamically loaded modules

2) Decide which modules you can disable and disable them:

For the compiled in modules, the list for the compiled modules in Ubuntu’s Apache web server will look something like this:

Compiled in modules:
  core.c
  mod_log_config.c
  mod_logio.c
  prefork.c
  http_core.c
  mod_so.c

These are usually required modules. You may be able to do without these in certain circumstances:

mod_log_config.c — This module is required for logging. If you want to disable logging, you can do without. This is usually not recommended though.
prefork.c — This module is only needed if you use Apache’s prefork mode rather than using threaded workers.

If you determine that you can live without some of these modules, you can choose to recompile Apache without the unnecessary modules.

For the dynamically loaded modules, the output will look something like:

~$ a2dismod
Your choices are: alias auth_basic authn_file authz_default authz_groupfile authz_host
authz_user autoindex cgi dav dav_svn deflate dir env mime negotiation passenger php5
rewrite setenvif ssl status wsgi
Which module(s) do you want to disable (wildcards ok)?

Which modules you require depend strongly on your application. Try to research what each module does and determine if it is required. Once you have determined that a module is not necessary, you can disable it via

sudo a2dismod [module name]
sudo /etc/init.d/apache2 reload

3) Recompile apache with only the needed modules?

Once you have your system narrowed down to the exact list of modules you need, you can gain a bit more performance by compiling them directly into apache rather than loading them dynamically. However, keep in mind that this makes future updating (security updates etc.) much more complex. Usually your time is better spent on other optimizations.

  • Share/Bookmark

Jun 2 2010

Excited for Drupalcamp Romania in Timisoara

I am excited for the upcoming Drupalcamp in Timisoara, Romania. My team and I are going to showcase some of the newest Drupal modules we developed for our latest project, Urbo – a business directory focused on Romania.

Part of the project is our new login system, called OpenForis. It will allows users to keep a single identity across our growing network of sites. We are also leveraging OpenLayers to give us the best of OpenStreetMaps, Bing, Yahoo and Google Maps. Urbo is currently in beta as we are tweaking the last few details for an official launch. We are hoping to post some Drupal training videos about these modules on our Drupal training videos page soon.

  • Share/Bookmark

Apr 2 2010

Find the largest image file within a directory structure (e.g. largest jpeg on disc)

For our latest project, Urbo.ro, I needed to find the largest image file (.jpg) in a big directory structure with 50,000+ images but also other files in it. Manually searching it would have been impossible. I turned to our Linux ninja, Alexandru Ionica, who came up with the following that I wanted to share:

find /directory/ -iname "*.extension" -printf "%s " -print | sort -n -r | head -n1

This Linux snippet give you the largest file that ends with .extension inside of whichever directory structure you specify. To search the whole file system, just specify /.

  • Share/Bookmark

Mar 30 2010

MySQL: SELECT not working on TRIM queries – a workaround

We recently noticed that MySQL does not work for WHERE queries with TRIM like:

UPDATE tablename SET column = TRIM(column) WHERE column != TRIM(column)

Technically a query like this is unnecessary, you can just TRIM directly.

But say you wanted to do a SELECT since you need to do something else with those records. This does not work:

SELECT * FROM tablename WHERE column != TRIM(column)

We found an simple workaround for this this MySQL shortcoming. Just use:

SELECT * FROM tablename WHERE CHAR_LENGTH(column) != CHAR_LENGTH( TRIM(column) )

  • Share/Bookmark

Jan 31 2010

How to unmount a disk drive in Ubuntu (device is busy)?

Unmounting disks in Ubuntu is a bit more challenging than it should be. Say you have an external drive mounted on /media/disk. Trying the standard

sudo umount /media/disk

will often result in an error such as

umount: /media/drive: device is busy.

It is advisable to check what files may be open on the drive with

lsof | grep /media/disk

If something important is still open on the disk, make sure to close the files or programs using the disk. If nothing else should be keeping the disk busy, you can usually achieve an unmount with

sudo umount -vl /mnt/external_disk

This performs a verbose, lazy unmount – i.e. Ubuntu unmounts the disk drive when the device is no longer busy, showing any errors in the unmount if there are any.

To confirm that the device has been properly unmounted, use

mount

This will list all the currently mounted devices – your drive should no longer be in the list. If your list is too long or you don’t feel like scanning it mount | grep /media/disk will return nothing if the device has been successfully unmounted.

In case of an unresponsive NFS mount, you can also try

sudo umount -vf /mnt/nameofnfsmount

The -f argument forces an unmount for unresponsive NFS and usually doesn’t help in other cases.

Although umount should perform this automatically, running sync after the unmount can make sure that the file system was properly synced. Happy unmounting!

  • Share/Bookmark

Jan 30 2010

Securely erase hard drive on Ubuntu (unrecoverable shred command)

Did you ever want to securely erase a hard disk on your server so the data is unrecoverable? Maybe you are selling the drive or the computer and want to be sure that no sensitive data can be recovered by a future owner. Ubuntu has a command line tool for just that purpose. If you want to completely erase the drive your system is on, first boot your computer using a Ubuntu LiveCD or the server install disk. Then, from the terminal (located in Applications->Accessories->Terminal if you use the Desktop LiveCD) enter the shred:

sudo shred -vfz -n [times] [your hard drive]

For example, you could type
sudo shred -vfz -n 5 /dev/sda

This would overwrite the data on the drive in /dev/sda with random data in 5 passes – the default is 3. Then it would overwrite the drive one more time with just zeros in a sixth pass. The parameters mean the following (see man shred for more):

v

Verbose output (see everything on screen)

f

Force permission changes (so you can overwrite everything

z

Overwrite with zeros (so it’s extra unrecoverable) in one more pass at the end

Overwriting your data with zeros through shred adds extra security, as does repeating the process a few times. 5 times may be a bit overkill though. Even overwriting it with random data once should be secure enough for most purposes. If you are paranoid about security or have truly sensitive data, you may try a higher number. Keep in mind that this increases the time required dramatically! Even on just a 500 GB hard drive (5400 rpm), a single pass with a final overwrite with zeros can take more a day.

Note: shred can also be used to overwrite individual files. However, this does not work well on modern operating systems for the reasons outlined in man shred.

  • Share/Bookmark