Archive for November, 2007

BarCamp Kerala 2007

Sunday, November 25th, 2007

Barcamp Kerala 2007

Yesterday I went to the first Kerala BarCamp. It was held at Techno Park, Trivandrum. I had to travel 225 kilometers to attend it - and it was totally worth it!

Sessions

Open Social

By Kenney Jacob

About the new OpenSocial API provided by Google. The talk was concentrated on its application on Orkut - as it is the most popular social networking site here.

Game Development in Ruby

By Vishnu Gopal

This session was about creating small 2D games in Ruby using the ‘Gosu’ library. You can get a small sample game he created for this session at N3wton Google Code

Presentation

Home Automation using Bluetooth

By Hari Krishnan

Using your mobile phone as an universal remote for all applications within your home.

Asterisk

By Bipin

Asterisk is a Open Source software PBX(Private branch exchange)

QT

By Dhaneesh and Dev

Using QT Designer to create GUI applications.

Computer Memory Based on Bacteriorhodopsin

By Jidhu

A new way of storing information - by changing the state of a protein. This is done by shining a different colour light on the protein. It is much faster and cheaper than the fastest RAMs available today. Also, it is non-volatile - so it can be as both the HardDisk and as the RAM. I found this the most interesting of all session.

Open Network Project

By Linoy Joseph

A implementation of a mesh style open network.

Android

by Renjith Ramachandran

Developing mobile application using the Android SDK provided by Google. The presentation showed us how to do it using Eclipse.

PHP Wiz

by Sreekanth G S

A small introduction to PHP and Web Application Development.

The People

The best part of the camp is the people you meet. I met a lot of people who I only knew only through the internet. Some of the people I met…

Until next time…

AGPL License

Tuesday, November 20th, 2007

License

AGPL or Affero General Public License Version is a new License released by FSF. This is aimed at Web Applications.

The GNU GPL allows people to modify the software they receive, and share those modified versions with others, as long as they make source available to the recipients when they do so. However, a user can modify the software and run the modified version on a network server without releasing it. Since use of the server does not imply that people can download a copy of the program, this means the modifications may never be released. Many programmers choose to use the GNU GPL to cultivate community development; if many of the modifications developed by the programs users are never released, this can be discouraging for them. The GNU AGPL addresses their concerns. The FSF recommends that people consider using the GNU AGPL for any software which will commonly be run over a network. (Emphasis mine)

Say I used AGPL for Nexty. You decide that it is a nice program - so you download it and use it. Then you make some changes to the code. So far so good.

Then you decide that you can put the modified version on your web server. The visitors can use the modified version of nexty - that is, you are not ‘distributing’ the software. If I used GPL, you could have gotten away with it - but if I use AGPL, you have to publish the code you modified as well.

The end result is that the end user is in a lot of confusion about what they should do with respect to the license. If they are not lawyers, they will not be able to understand what the license says. I have opted to use the BSD license due to factors like this - BSD license basically gives you the right to do anything with it - except claim that you wrote it.

Related Links

Creating PDF in Ruby on Rails - PDF::Writer

Monday, November 12th, 2007

PDF::Writer is my choice for creating PDF files in Ruby on Rails. Its simple, easy to use, and has all the features I am looking for.

Install PDF::Writer in Linux systems using this command…

gem install pdf-writer -y

Includes

We will require rubygems and pdf/writer.

require "rubygems"
require "pdf/writer"

The next line creates a new instance of PDF::Writer

pdf = PDF::Writer.new

Create a Heading(big font size)

pdf.select_font "Times-Roman"
pdf.text "Sample PDF Document", :font_size => 32, :justification => :center

The text function will add a string of text to the document, starting at the current position. It will wrap to keep within the margins - so you can specify text as big blocks. The text will go to the start of the next line when a return code “\n” is found.

The other arguments available for this function are…

:font_size
The font size to be used. If not specified, is either the last font size or the default font size of 12 points. Setting this value changes the current font_size.
:left
Gap to leave from the left margin
:right
Gap to leave from the right margin
:absolute_left
Absolute left position (overrides :left)
:absolute_right
Absolute right position (overrides :right)
:justification
This can be :left, :right, :center, :full
:leading
This defines the total height taken by the line, independent of the font height.
:spacing
Line spacing - usually set to one of 1, 1.5, 2 (line spacing as used in word processing)

Writing Text

pdf.text "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam sodales velit ac ante. Suspendisse felis mi, convallis at, semper id, malesuada eu, mauris. Integer orci. Sed consectetuer orci. In hac habitasse platea dictumst. Duis nec pede. Ut lacinia eros ut magna. Maecenas lectus dui, lacinia vel, porttitor a, fringilla nec, turpis. Nulla odio nisi, mattis ac, porttitor at, malesuada ac, nibh. Nam suscipit mi ut justo. Phasellus aliquam lorem non velit ornare bibendum. Nullam mollis. Ut elementum rutrum justo. Pellentesque ac sapien. In facilisis lorem a enim. Curabitur vitae felis. In eget tellus nec ligula egestas semper. Nulla facilisis urna nec magna. Pellentesque fringilla pulvinar risus. Aliquam rutrum, nisi ut lobortis consequat, nisl felis posuere risus, at sollicitudin nibh dui et felis.

Fusce tristique dapibus neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut felis mi, dictum ut, vehicula non, fermentum quis, elit. Quisque ultricies purus quis enim. Integer turpis elit, porttitor quis, volutpat consequat, interdum vitae, quam. Donec tempus, dolor eget bibendum euismod, metus dolor imperdiet purus, vitae nonummy est mi non orci. Aenean eu massa. Fusce euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nullam quis massa id sem commodo eleifend. Cras eu velit rutrum leo egestas adipiscing. Nulla volutpat, lectus sit amet sagittis gravida, erat tortor condimentum sem, vitae sollicitudin lectus diam eget felis. Aliquam augue. Vestibulum viverra est. Fusce tellus ligula, euismod sed, placerat vel, cursus dictum, erat.", :font_size => 12

I used the text() - but this time with 12 as the font_size. The long text will wrap around and the \n will be converted to line breaks.

Inserting Images

PDF::Writer provides an easy way to insert images…

pdf.image "default.png"

That’s it - it will insert an image called ‘default.png’. The other option are…

:pad
The number of PDF userspace units that will be on all sides of the image. The default is 5 units.
:width
The desired width of the image. The image will be resized to this width with the aspect ratio kept. If unspecified, the image’s natural width will be used.
:resize
How to resize the image, either :width (resizes the image to be as wide as the margins) or :full (resizes the image to be as large as possible). May be a numeric value, used as a multiplier for the image size (e.g., 0.5 will shrink the image to half-sized). If this and :width are unspecified, the image’s natural size will be used. Mutually exclusive with the :width option.
:justification
The placement of the image. May be :center, :right, or :left. Defaults to :left.
:border
The border options. No default border. If specified, must be either true, which uses the default border, or a Hash.

Tables

Inserting tables are slightly more complicated than the last two items. If you are using SimpleTable, you have to add
require "pdf/simpletable"
along with the other includes.

table = PDF::SimpleTable.new
table.title = "Sample Tables"
table.column_order.push(*%w(first second))

table.columns["first"] = PDF::SimpleTable::Column.new(”first”)
table.columns["first"].heading = “First”

table.columns["second"] = PDF::SimpleTable::Column.new(”second”)
table.columns["second"].heading = “Second”

table.show_lines    = :all
table.show_headings = true
table.orientation   = :center
table.position      = :center

data = [
	{"first"=> "1", "second"=> "2"}, # First row
	{"first"=> "One", "second"=> "Two"}, # Second row
	{"first"=> "Mono", "second"=> "Di"}, # Third row
]

table.data.replace data
table.render_on(pdf)

The above code will create a table with two column and three rows of data. The code should be easy to decipher - so I am not going into any more explanation.

Saving the PDF

Finally, saving the created PDF…

pdf.save_as("report.pdf") 

Links

Hacker: The ‘Correct Meaning’ - And Why its Wrong

Thursday, November 8th, 2007

Ever been to a LUG meeting where a member uses the term ‘Hacker’ when they should have said ‘Cracker’? The others crucify the poor soul within seconds. In programming circles, a hacker is a rather good programmer. “A person who enjoys exploring the details of programmable systems and how to stretch their capabilities, as opposed to most users, who prefer to learn only the minimum necessary.” (Jargon File). In the popular media, the term hacker refers to a person who breaks security on a system. Programmers call them Crackers.

Before 1985, there was no word for ‘Crackers’ - both good an bad hackers were know as, well, hackers. Soon the good hackers got tired of being lumped together with the bad guys. So they created a term for the baddies - the Crackers. And they got very upset when the media did not use the new word.

What I don’t get is why people cannot understand that the word ‘hacker’ has two(or more) different but equally valid meanings. I believe that the term ‘hacker’ can be used in the place of ‘cracker’ - as long as the understood that the word has two meanings.

The term hacker comes from the word hack - and the most valid meaning for the term is to circumvent the security of a system. As in “I can hack into your computer within minutes.” So people who ‘hack’ are called hackers.

Conclusion

In short, don’t get upset when others use the term hackers in the ‘wrong way’. If you want you can continue using the term cracker - that will solve the issue of ambiguity of the term ‘hacker’. Just don’t try to enforce your meaning upon others.

I am sure many of you would disagree, but you are all Schizophrenics - why should I care what you have to say? ;-)

Related Links

Subscribe to Feed