≡ Menu

Open source coding

Download of the day: WordPress 2.7

WordPress version 2.7 has been released and available for download. From the announcement page:

The first thing you'll notice about 2.7 is its new interface. From the top down, we've listened to your feedback and thought deeply about the design and the result is a WordPress that’s just plain faster. Nearly every task you do on your blog will take fewer clicks and be faster in 2.7 than it did in a previous version.

What is new in WordPress 2.7

For a visual introduction to what 2.7 is, check out this video (available in HD, and full screen):

Download the latest release of WordPress version 2.7, released on 10 December 2008 (via official blog).

Linux / UNIX: Find Out If a Directory Exists or Not

I've already written a small tutorial about finding out if a file exists or not under Linux / UNIX bash shell. However, couple of our regular readers like to know more about a directory checking using if and test shell command.

General syntax to see if a directory exists or not

[ -d directory ]
test directory
See if a directory exists or not with NOT operator:
[ ! -d directory ]
! test directory

Find out if /tmp directory exists or not

Type the following command:
$ [ ! -d /tmp ] && echo 'Directory /tmp not found'
$ [ -d /tmp ] && echo 'Directory found' || echo 'Directory /tmp not found'

Sample Shell Script to gives message if directory exists

Here is a sample shell script:

if [ $# -ne 1 ]
	echo "Usage: $0 {dir-name}"
	exit 1
if [ -d "$DIR" ]
	echo "$DIR directory  exists!"
	echo "$DIR directory not found!"

Google Releases Android Mobile Platform As Open Source Project


Android is now open source software and available for download from official website. It is a software platform and operating system for mobile devices. It is based upon Linux kernel and developed by Google and Open Handset Alliance. Today, Google made exciting announcement - they have now released the source code for Android. There's a huge amount of code and content there, so head over to official website to grab all the details.

From the project site:

Android is the first free, open source, and fully customizable mobile platform. Android offers a full stack: an operating system, middleware, and key mobile applications. It also contains a rich set of APIs that allows third-party developers to develop great applications.

=> Android is now Open Source

shoes – A cross-platform Windowing Applikit

Shoes is a very informal graphics and windowing toolkit. It's for making regular old apps that run on Windows, Mac OS X and Linux. It's a blend of my favorite things from the Web, some Ruby style, and a sprinkling of cross-platform widgets. Shoes uses Ruby as its interface language.

It borrows a few things I like from the web:
=> Hyperlinks and URLs within Shoes and to the web.
=> Simple text layout -- though Shoes eschews floats.
=> Images and colors in the layout and in the background.
=> Margin and padding.
=> Resizable layouts.

How do I install shoes ?

First, get source code, enter:
$ cd /tmp
$ wget http://shoooes.net/dist/shoes-0.r925.tar.gz

Untar it:
$ tar -zxvf shoes-0.r925.tar.gz
$ cd shoes-0.r925
Now install required stuff under Debian / Ubuntu Linux:
$ sudo apt-get install libcairo2-dev libpixman-1-dev libpango1.0-dev libungif4-dev libjpeg62-dev libgtk2.0-dev vlc libvlc0-dev libsqlite3-dev libcurl4-openssl-dev ruby1.8-dev rake
If you are using RHEL / CentOS / Fedora Linux, enter:
# yum install giflib-devel cairo-devel libpixman-devel pango-devel libjpeg-devel gtk2-devel sqlite-devel vlc-devel libcurl-devel ruby-devel
Install it:
$ make
$ sudo make install

Sample output:

build options: shoes raisins (0.r925) [i486-linux]
CC       = cc
RUBY     = /usr
installing executable file to /usr/local/bin
installing libraries to /usr/local/lib/shoes

See READM for for more information.

Hello World application

Sample hello.rb

Shoes.app {
  para strong("Hello, "), " world!"


Shoes.app (:width => 200, :height => 50, :title => "Hi, Guest!") {
   para strong("Hello, "), " world!"
   @buttonQuit = button "Exit"
   @buttonQuit.click { exit() }

Run it as follows:
$ /usr/local/bin/shoes hello.rb
Another example:

Shoes.app {
  name = ask("Please, enter your name:")
  para "Hello, ", name

You can include images from web or create a simple links / urls:

Shoes.app (:title => "My App" ) {
  image "http://theos.in/wp-content/uploads/2008/06/honda-fcx-clarity-car-photo.jpg"
  para( link("Info").click{ alert ("The FCX Clarity, which runs on hydrogen and electricity, emits only water and none of the noxious fumes believed to induce global warming.") })
  para( link("Exit").click{ exit() } )

Sample output:

Loading images from the web

Fig.01: Loading images from the web

Sample applications

You can find sample application in /tmp/shoes-0.r925/samples/ directory. Here is animated clock program:

# Shoes Clock by Thomas Bell
# posted to the Shoes mailing list on 04 Dec 2007
Shoes.app :height => 260, :width => 250 do
  @radius, @centerx, @centery = 90, 126, 140
  animate(8) do
    @time = Time.now
    clear do
      stack do
        background black
        para @time.strftime("%a"),
          span(@time.strftime(" %b %d, %Y "), :stroke => "#ccc"),
          strong(@time.strftime("%I:%M"), :stroke => white),
          @time.strftime(".%S"), :align => "center", :stroke => "#666",
            :margin => 4
      clock_hand @time.sec + (@time.usec * 0.000001),2,30,red
      clock_hand @time.min + (@time.sec / 60.0),5
      clock_hand @time.hour + (@time.min / 60.0),8,6
  def draw_background
    background rgb(230, 240, 200)
    fill white
    stroke black
    strokewidth 4
    oval @centerx - 102, @centery - 102, 204, 204
    fill black
    oval @centerx - 5, @centery - 5, 10, 10
    stroke black
    strokewidth 1
    line(@centerx, @centery - 102, @centerx, @centery - 95)
    line(@centerx - 102, @centery, @centerx - 95, @centery)
    line(@centerx + 95, @centery, @centerx + 102, @centery)
    line(@centerx, @centery + 95, @centerx, @centery + 102)
  def clock_hand(time, sw, unit=30, color=black)
    radius_local = unit == 30 ? @radius : @radius - 15
    _x = radius_local * Math.sin( time * Math::PI / unit )
    _y = radius_local * Math.cos( time * Math::PI / unit )
    stroke color
    strokewidth sw
    line(@centerx, @centery, @centerx + _x, @centery - _y)
Fig. 02: Animated clock

Fig. 02: Animated clock

Shoes manual

The manual can be launched by typing the following command
$ shoes -m

Further readings:

Free Software Usability Issues and Solutions

Matthew has published a nice easy titled as "Why Free Software has poor usability, and how to improve it":

Many of these problems are not specific to Free Software in particular, but to volunteer software. Hobbyist proprietary programs often have poor designs for many of the same reasons. But the easiest way of getting volunteers to contribute to a program is to make it open source. And while thousands of people are now employed in developing Free Software, most of its developers are volunteers. So it’s in Free Software that we see volunteer software’s usability problems most often.

Download of The Day: WordPress 2.6

Wordpress Logo

WordPress 2.6 has been released and available for download almost a month ahead schedule. New
features in wordpress 2.6:

=> Wiki-like tracking of edits
=> Post from wherever you are on the web
=> Turbo-speed your blogging - Gears is an open source browser extension project started by Google that developers like us can use to give you features we wouldn’t normally be able to.
=> SSL login support
=> Theme Previews: See it before your audience does and much more

Download WordPress 2.6

=> Visit official download page.

Related: Upgrade wordpress quickly in 3 easy steps from UNIX shell prompt

Linux / UNIX: Geany Lightweight Integrated Development Environment

If you wanted to quickly edit PHP, Java, C etc, Geany IDE is perfect. It is a small and lightweight integrated development environment. It was developed to provide a small and fast IDE, which has only a few dependencies from other packages. Geany is known to run under Linux, FreeBSD, NetBSD, MacOS X, AIX v5.3, Solaris Express and Windows.

Basic features of Geany
=> syntax highlighting
=> code folding
=> code completion
=> auto completion of often used constructs like if, for and while
=> auto completion of XML and HTML tags
=> call tips
=> many supported filetypes like C, Java, PHP, HTML, Python, Perl, Pascal and many other
=> symbol lists
=> build support (to compile, link, run programs)
=> plugin interface (C, Lua)