a new idea

May 31, 2007

for some time i have been wondering about the ‘page’ option in wordpress, in addition to adding posts. the default one is the about me page, but i recently removed it from my blog. instead i hit with a new idea, during a conversation with tuxmaniac. we often search for some software and sometimes hit upon a software we were really looking for. it also happens a lot of softwares pop up during the discussions in irc. as personal preferences differ widely, we all use a lot of softwares; not all use the same set of softwares. but still, we miss a huge amount of softwares, they go unknown. i thought of using this page option, by starting a new page in my blog named “FOSS apps” and tell a few words about the softwares i either use or come in knowledge of.

this whole idea started with a recent post in planet ubuntu by Og, about a fast and light IDE called as Geany. i tried it out and really liked it. this made me feel that there are indeed a lot of softwares which are not brought into light. this is one such little endeavor to identify such softwares/apps. and there is nothing prohibiting me from adding my favorites like emacs, IDLE and digiKam into the list ;)


Promising Projects - Brainwave and Returnable

May 18, 2007

In the past two days, I happen to see two mails regarding two new projects. Though both did not attract the best of my interests that I jump out and dig my hands into it. Rather I felt I can write about them. Here I go with a brief introduction to both of them.

Brainwave

Brainwave is said to be a Software Development Kit which comes along with a very different database engine, a rich API widgets library and a deployment server. I came to know through a mail sent to Bangypy mailing list. Though the question whether this product is Open Source is yet to be answered, there is an interesting component in this product which is told as a pending-patent technology.

The main components of this SDK are

  • Iris, the Application server
  • Aphrodite, the User Interface
  • Poseidon, the Database
  • Cerberus, the Security component

Iris is the application server (or the deployment server) which is actually built over the very popular CherryPy Python-based web server. Aphrodite is a XSLT based standard templating system, which renders the templates as HTML 4.0 Transitional compliant code for IE5+ and FF1.0+ (but it is said for Windows and Mac, urgh!).

Poisedon is said to be the core of Brainwave, being the database system with a difference. It is an non relational DBMS with no requirement of schema. Instead of tables and columns, data is stored as ‘memes’ and ‘links’ which are types of neurons. While memes are fundamental units of data, links are relationships between neurons. Links have a subject (origin), an object (target) and a verb (modifier). Thus data is stores as neurons linked to one another by the links defined by the verbs. This model imposes no constrain on the type of data that can be handled. This is a very new idea which is yet to hit the masses.

Cerberus is the security manager for Poisedon and it acts based on capabilities and policies.

Brainwave is a promising product indeed, but until the question of FOSS gets answered let me wait to dig my hands into it.

Returnable

Returnable serves as an open platform architectural guide to advance the URL as a DSL for specifying 3 traits - the content, its delivery and its behavior on the web through the use of Returnable elements embedded within the web pages.

This is not a big endeavor such as Brainwave, but rather a personal project from Bhasker Kode (who had mailed the ilugc mailing list about this). It involves a bit of JS, PHP, url rewrtie, regext and CSS. This is just a way to create events using HTML as the API, provided that the initial script was added to the DOM.

He claims it to be a great utility for bloggers, for an easy way to create tool-tips. The following are some links associated with this project.

—————— The End —————————


Positional Parameters in Bash

May 16, 2007

Been long since I posted something on Bash and as usual, I again post something from Mrugesh’s (floyd_n_milan) key board. This time its an explanation of Positional parameters in Bash, which was actually a reply to a question in GLUG-BOM mailing list. I felt the explanation to be more clear than what I found in many books on the same, hence here goes his explanation (slightly edited).

$* expands the positional parameters. 

Positional parameters are arguments passed to a command.
When you run your script by doing, say, 

$ ./image-resize image1 image2 image3 

the positional parameters get set to ./image-resize,
image1, image2 and image3. 

The positional parameters can be used as the variables
$0 to $n where n is any integer. $0 is always set to
the name of the script, in this case image-resize.
The parameters from $1 onwards are the actual
arguments. So in this case, 

$1 == image1
$2 == image2 and
$3 == image3 

These are read only variables. You can't manually
assign a value to them. You must use either set or shift. 

When you process the arguments, you can either call them
individually, or, as is most common, process them in a
loop, one by one. You've used the second method. 

$* and $@ are two variables that can be used to query
all the positional parameters together. When unquoted,
they are subject to IFS word splitting like any other
variable in bash. What this means is that if your arguments
have spaces or newlines embedded in them, they'll be
split up to be two different entities. 

The safe way is to double quote ( " ) the variables,
which prevents this internal splitting. 

Mind the double quotes. VERY important. 

Here's an example: 

$ set "foo bar" baz blah
$ # "foo bar" is intended to be a single argument.
$ # set can be used to set various bash options and
   positional parameters.
$ echo $1
foo bar
$ echo $2
baz
$ echo $3
blah
$ for i in $@; do echo '==> '${i}' <=='; done
==> foo <==
==> bar <==
==> baz <==
==> blah <==
$ # Notice that foo and bar have been split up. Undesirable.
$ for i in $*; do echo '==> '${i}' <=='; done
==> foo <==
==> bar <==
==> baz <==
==> blah <==
$ # When unquoted $@ and $* produce the same result.
$ for i in "$@"; do echo '==> '${i}' <=='; done
==> foo bar <==
==> baz <==
==> blah <==
$ # I suppose this is what you wanted?
$ for i in "$*"; do echo '==> '${i}' <=='; done
==> foo bar baz blah <==
$ # When double quoted, $@ and $* differ vastly..
$ # And that's not the result you wanted either.
$ # Always use "$@".

And here is a small addition from cydork,

<cydork> add that when you use “$*” the positional parameters will be separated with first char of IFS ;)

And one additional point from Mrugesh himself,

the ${array[@]} and ${array[*]} behave in a similar manner


My Guru got Married (Updated)

May 3, 2007

Last week I got a surprise mail from Suraj Kumar, the one person who should take a great part of the credit for getting me into GNU/Linux and FOSS and hence tagged my “Guru”, that he is getting married. First I thought it was a prank mail, as April had not still ended. But, reading the mail fully made me realize that I was wrong and indeed he was getting married.

Now, am ready to leave tonight and attend the marriage reception tomorrow at Bangalore. Sridhar Ratna is also coming with me to attend the reception and thus I have a company for the trip. Planning to stay in R T Nagar itself as the choultry is close to my grandpa’s house. As it happens to be a working day, I can not expect my buddies to spend time with me.

This is going to be a memorable trip and a more memorable meeting with my Guru. Will try to take some snaps and add it to this post with updates from the trip. :)

Updated…

It was one of the most memorable days in my life. We landed at Bengalooru in the early hours of Friday, at the cantonment station. As the autowalas asked almost 3 times the ideal fare, me and Srid decided to go by bus. We luckily got an auto from the bus stand who turned on the meter. we reached the choultry by 6 a.m. and Suraj was at the door welcoming us with a hug. We joined Suraj in the queue for the bathroom and all us were ready by 7.

We had the morning breakfast and left for the temple, where the marriage was supposed to happen, in batches using the couple of cars available. The actual marriage happened at the Kalyana Venkatesa Perumal Koil. Suraj and Deepti were wearing a tam-brahm attire (Panjakachham and madisar, respectively). The thirumangalya dharanam or the trying the knot of the holy thread as a symbol of marriage happened in the shrine. Then we returned to the choutlry for the rest of the customs surrounding a marriage.

Though Deepti was a North Indian, Suraj’s mother wanted her son’s marriage to happen in a perfect iyengarish manner. The ceremony took another couple of hours to complete. There were a lot of friends of Suraj, including me and Srid, that it was so fun being around. There were at least half a dozen cameras flashing and taking snaps of the couple.

We stayed in Suraj’s house for the afternoon and made him ready for the evening reception. This was the first time Suraj was wearing a formal dress and it began with a Suit. We were there with Suraj for almost 16 hours and came back home with memoirs of the day still in our eyes.

I have uploaded all the pictures to my flickr album, but still will put one snap which I will cherish for the rest of my life :)

Cherished moments


PyProgram #5 - SMTP Mail Sender

May 3, 2007

Had some requirement to send mails in my project, so we were digging into the smtplib module. Thought of trying out a small script which will send mails. The example code was fine, but modified the functions and added “Subject: ” header to it. Tested it and voila it sent mails :P A rather trivial piece of code, but posting it to save it somewhere in my web space ;)

#!/usr/bin/env python

"""Command-line SMTP Mail Sender
This script can send mails provided you have an account
with an SMTP server.

The inputs have to be given at the
command line. The recepients address can be a space
separated list of emails.

The subject can be multiple lines, seperated by empty lines.
When done, end the subject with Ctrl+D to send the mail.
"""

import smtplib

# function to fetch the input from command line
def prompt(prompt):
return raw_input(prompt).strip()

fromaddr = prompt("From: ")
toaddrs = prompt("To: ").split()
subject = prompt("Subject: ")
print "Enter message, end with ^D (Unix):"

# Add the From: and To: headers at the start
msg = ("From: %snTo: %snSubject: %snn" %(fromaddr, ", ".join(toaddrs), subject))
while 1:
try:
line = raw_input()
except EOFError:
break
if not line:
break
msg = msg + line

print "Message length is " +repr(len(msg))

# connect and send the mail
server = smtplib.SMTP()
# connects to default port, if not specify it as additional argument
server.connect('mail.myhost.com')
# specify username and password
server.login('me.myhost.com','me1234me')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
# done!