Posts from — January 2008
Update…..
I returned after writing my english exam today at FIITJEE. Hats off to them for having thrown the practical examination 3 days after the prefinals end. I have never seen an institution with such excellent planning. I am not going to waste space on this blog writing about this education factory. Let me instead dwell upon what I have done in the past week.
I finished reading the final year project of PrashMohan (His IRC nick). His FYP talks about a semantic filesystem - SemFS. SemFS is a filesystem implements file-searching based on the file’s metadata. This is a solution to the ever-increasing hard-disk capacity making it difficult to retrieve files.
SemFS allows a user to choose either the traditional “/home/shriphani/bingo.txt” hierarchy or a mechanism based on queries to offer virtual directories. SemFS provides properties of “Owner” and “Timestamp” by default. Files like JPEG images and MP3s of course carry info about the height and width (image properties) and length and artist respectively.
SemFS reminds me of Beagle, the search engine that comes with Ubuntu nowadays (and makes computers like mine groan under the strain - I use debian though
). I had a look at how Beagle worked and it seems to work in the same fashion by look at a file’s metadata.
It was a good read indeed and I have decided to create my own semantic filesystem ! I was trying out something called LUFS-Python when I was in class 11. LUFS allows you to create filesystems in Python. I will direct towards devices like iPods ( I love mine ). I have been pissed by the impracticality of picking ext3fs as the filesystem. I believe media players need filesystems with features like:
- Versioning - Do take snapshots at times and do not let the user fiddle with these. If snapshots promise to tick off all the media, just archive the metadata of each song. It will be of great help in combating piracy and will for once force people to look beyond recording labels for artists who release their music under open-source licenses.
- Lightweight caching application for updating the metadata. Tag-cache from rockbox sucks too much of my battery.
I will keep adding to this list and then see how it turns out.
BTW this blog has undergone another transformation and I picked this theme as I like its feel. I am going to put up a post for Lorelle Van Fossen’s blogging challenge. But first BOFH beckons !
January 25, 2008 1 Comment
Pushing projecteuler ahead
I am busy writing dad’s pdf script. The real troubles begin when you parse 1000 pages using trash like pyparsing (yes, I am back to it). Anyway, let me see how it goes. I did another projecteuler.net sum today ( question 8 ). The question is:
Find the greatest product of five consecutive digits in the 1000-digit number. 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244523161731856403098711121722383113 62229893423380308135336276614282806444486645238749 30358907296290491560440772390713810515859307960866 70172427121883998797908792274921901699720888093776 65727333001053367881220235421809751254540594752243 52584907711670556013604839586446706324415722155397 53697817977846174064955149290862569321978468622482 83972241375657056057490261407972968652414535100474 82166370484403199890008895243450658541227588666881 16427171479924442928230863465674813919123162824586 17866458359124566529476545682848912883142607690042 24219022671055626321111109370544217506941658960408 07198403850962455444362981230987879927244284909188 84580156166097919133875499200524063689912560717606 05886116467109405077541002256983155200055935729725 71636269561882670428252483600823257530420752963450
Here is what I wrote to solve this problem:
bigno = input(’Number:’ ) #I am doing this because typing in the number distorts this blog.
divideIntoGroups(bigno):
bigno_to_str = str(bigno)
lower_limit = 0
upper_limit = 5
fives_list = []
while upper_limit < len(bigno_to_str):
lower_limit = lower_limit + 1
upper_limit = upper_limit + 1
fives_list.append(bigno_to_str[lower_limit:upper_limit])
return fives_list
def splitFurther(fives_list):
another_list = []
for stringed_number in fives_list:
commode = []
for char in stringed_number:
commode.append(int(char))
another_list.append(commode)
return another_list
def multiplyIndividualNumbers(another_list):
product_list = []
for commode in another_list:
products = reduce(mul, commode)
product_list.append(products)
return product_list
def checkGreatest(product_list):
return max(product_list)
print checkGreatest(multiplyIndividualNumbers(splitFurther(divideIntoGroups(bigno))))
There. It took 0.03 seconds to work. Not bad for a budding computer scientist I suppose
Right, I’ll write again later.
January 19, 2008 1 Comment
PySoy - 3D Game Engine and my contribution to it.
I have finished another task at the GHOP, this time a task involving OpenGL. Sounds like fun ? Of course it was fun. With a bit of coordinate geometry knowledge, one can very easily get things to animate using pysoy. My task involved defining 8 default materials covering a wide range of specular highlights, colors and shininess. I did it in 2 days. My work is now accepted and I am happy. I got to play with OpenGL and of course this brilliant gaming engine - PySoy. In PySoy, the camera ends up as a collision object (just like a sphere or a cube). This means that you don’t need to recreate meshes for every little thing. You can design objects in Blender ( a great tool !) and man this thing is just in beta2 ! Oh boy such a lot has already been incorporated in 3 months time ! kudos to these devs ! (Excuse the excitement, it is natural). Anyway, let me show you what I did.
Arc Riley (my mentor) told me about how stupid a platform Debian GNU/Linux was for devs. I realized what he meant when I tried to install PySoy. Debian’s repositories are a bit too outdated. I had to compile about 3 packages from source. Well anyway I am eager to get to the part that involved my work.
Pysoy makes it extremely easy to create spheres and cubes and impart to them a certain velocity or rotation. Superb work really. Since my task involved working with diffused light, ambient light and specular light, all I had to do was create a sphere and a cube and get them to rotate so that I could make out the defects in my imagination of diffused and ambient light and the specular highlights. Here is the code ( beautiful, a few lines and the job is done, superb stuff this PySoy thing ):
#!/usr/bin/python import soy sce = soy.Scene() scr = soy.Screen() win = soy.Window(scr, 'Mesh shape test', background=soy.colors.Black()) cam = soy.bodies.Camera(sce) cam.position = (0.0, 0.0, 20.0) lig = soy.bodies.lights.Light(sce) lig.position = (-10.0,10.0,2.0) pro = soy.widgets.Projector(win, camera=cam) mat = soy.materials.Rhodonite() key = soy.controllers.Keyboard(win) key['q'] = soy.actions.Quit() key[ 1 ] = soy.actions.Quit() # 9 = esc key wcn = soy.controllers.Window(win) wcn['close'] = soy.actions.Quit() sha1 = soy.shapes.Box(1.5, 1.5, 1.5) cube = soy.bodies.Body(scene=sce,mesh=soy.meshes.Shape(mat),shape=sha1) cube.position = (2, 0, 0) cube.rotation = (0.25, 0.25, 0.25) sha2 = soy.shapes.Sphere(1.0) spr = soy.bodies.Body(scene=sce,mesh=soy.meshes.Shape(mat),shape=sha2) spr.position = (-2, 0 , 0) spr.rotation = (0.5, 0.5, 0.5)
That bit of code creates a sphere and a cube and imparts rotation to them at a particular velocity. My work (involving the implementation of specularity, diffusion and ambience) can be seen in the svn.diff I have attached below.
Pics of the output can be seen at my new gallery installation
Oh by the way, here is the svn.diff
And this is what my mentor had to say:
, Today (22 hours ago)
Verified.
Shriphani’s work shows an eye for detail and has done a fantastic job with this task.
, Today (3 hours ago)
Marking this as completed. w00t!
I have to thank Google for having given kids the opportunity to contribute to the open source world. At the GHOP, I have written docs and messed with OpenGL. I want to do another task, hopefully involving Django (not advocating its use but creating a site or something like that.).
January 12, 2008 No Comments
Back to square one.
I keep going round and round in circles. I began with perl at the behest of a sysadmin and made the switch to python and then went to perl and then python and thankfully stopped. I wrote two deployable web applications in TG and Django and switched between them a gazillion times before finally zeroing on Django (despite the fact that the design of django itself contradicts my incremental web development style) and then went in a circle with Lisp and Python in April and now I have done it again. After having spent nights writing regular expressions to match patterns in a html file which is 500 pages long ( NEVER USE REGULAR EXPRESSIONS TO PARSE HTML. TYPICAL PAIN IN THE A$$ ), then decided to use pyparsing. Pyparsing’s documentation is as elaborate as the book, “How to please Shriphani Palakodety with horribly written Perl (I admit you don’t need to put extra efforts to achieve that but let us say you spend that extra minute trying to ruin your code further)”. They advertise an ebook that doesn’t have any bloody examples. I had to spend hours reading stupid presentations on the Internet to figure out what was to be done and now I have decided to come back to using orthodox html parsers.
After that long rant, I am once again participating at the GHOP. I have picked task 320 without knowing anything about OpenGL. Lets see how it goes.
January 9, 2008 No Comments
Tweaking Django and pdf script progress
I have to put this up here. I was tweaking up timepass and at a particular stage when I was working on the CRUD (admin interface that django provides), I was faced with the situation of throwing in 7 BooleanFields one after the other. It looked disgusting. I then modded Django a bit to ease things out. I am not going to explain the stuff over here as I have to rush, but the code is commented well enough
from django import oldforms
from django.db import models
from django.utils.functionalimport curryclass CheckBoxManyToMany(models.ManyToManyField):
def get_manipulator_field_objs(self):
if self.rel.raw_id_admin:
return [oldforms.RawIdAdminField]
else:
choices = self.get_choices_default()
return [curry(oldforms.CheckboxSelectMultipleField, choices=choices)]
def get_manipulator_fields(self, opts, manipulator, change, name_prefix='', rel=False, follow=True):
"""
Returns a list of oldforms.FormField instances for this field. It
calculates the choices at runtime, not at compile time.
name_prefix is a prefix to prepend to the "field_name" argument.
rel is a boolean specifying whether this field is in a related context.
"""
field_objs, params = self.prepare_field_objs_and_params(manipulator, name_prefix)
# BooleanFields (CheckboxFields) are a special case. They don't take
# is_required.
if 'is_required' in params:
del params['is_required']
# Finally, add the field_names.
field_names = self.get_manipulator_field_names(name_prefix)
return [man(field_name=field_names[i], **params) for i, man in enumerate(field_objs)]
There !
Now, let me elaborate upon the pdf script that I was making to ease out stuff for my dad.
My plan is to create new ebooks out of each chapter. Each chapter is obviously going to be smaller than 1.5 MB and that should be it !
The route I am taking involves creation of a html file from the pdf file. This html is parsed and the required data obtained and so on. I promise to put up a working version soon.
I am going to spend the rest of the day reading Prashanth Mohan’s Final Year Project. See you later !
January 8, 2008 1 Comment
Surprise mail and ideas.
Here is an excerpt from a mail in my gmail inbox:
Hide quoted text -
On Mon, Jan 07, 2008 at 09:31:39AM +0530, Shriphani Palakodety wrote:
> Hello,
> You are my IDOL !!. Every ext2fs utility that I see is made by you.
> There are countless times when debugfs and e2fsck played an important
> part in my “piddling” around with external devices. I applied to MIT
> for a place in the class of 2012 and I aim to be like you.
I’m glad those tools have been helpful for you.
Good luck getting into MIT!!
- Ted
That was a mail from Theodore T’so, the extremely cool maintainer of the e2fsprogs package and one of North America’s first Linux developers. He has like 2 degrees from MIT ( YAY!) and now works at IBM and gets paid to hack on Linux ( in short, gets paid to do what he likes ).
So let’s move on to something else. I happened to see this article on Semantic Filesystems and began thinking about it the entire day. I was trying to figure out the purpose they would serve. I then thought of the now-hacked TWINCLING WIKI (our mistake really). The web2.0 philosophy is more about reaching out using the Web and other nonsense, let us just say one opens up a “publicly editable” content management system - one where without logging into an account, an individual can put content up for the world to see (something like free advertising space - an idea? probably
). Let us say, I install something like drupal and implement FCKEeditor to allow people to throw content on this site. php’s file apis are more or less unix-like. If one gets the weird idea of throwing an “rm -rf” in there and getting it to execute somehow, BOOM!
It might seem easy to recover at first. But beware, once this CMS is removed, there is every chance that the backup is kicked out as well (if the backup is in the same directory as the CMS). Let us just say we had a file-system that knew about this installation and knew where the backups were. Within minutes after the attack, the intelligence the fs possesses should enable it to reinstall the CMS and put all the posts back. This is a better way of doing things than let’s say reinstalling the CMS manually hours after the it has been compromised. Sounds like a far cry, but is possible.
There can be worse situations at times. Let us just say that an administrator has found that a certain movie is taking up too much space on the filesystem(probably the movie is 5 gigs in size). He goes on to delete this file and realizes that no space has been freed. This is because the file will continue to take up space on the drive till the process which opened them is killed. Now that the file has no name, it is much harder to deal with. A filesystem with inherent intelligence should be able to perform the hardkill (signal 9) on every process accessing this file (this process could well be a search application keeping track of the files). Such enormous potential is what intelligent filesystems hold. 5 months till college. I can hardly wait.
By the way, that tweet over there —> will soon change ![]()
January 7, 2008 1 Comment
The year that was…..
This was a special year for me in many ways. This year marked my return to full physical fitness and I have decided to move on. I have made up for most of what I missed during grade 11 and 12.
But there is something I love better, programming. So I am going to get back to that. This month was the least productive in this year as I had to draft applications and so on. I have finished all of them and hence I can sit back and allow the “luck” part to take over.
Well let me describe the iLugHyd meeting on the 30th of December.
The ROR session (I am a bit bored by the excessive importance ROR gets and Django doesn’t). The very same cool features of Ruby and the Rails framework (I have to admit, really cool features) were stated all over again. I won’t bother stating them here as a google search lands you at a webpage that does this Django vs. ROR thing quite well.
I am instead compelled to talk about the shortcomings of the rails framework. The CEO of rknowsys told me that rails was bad at handling transactions and J2EE I suppose walks away with this one. Web applications like ebay therefore cannot be created in Rails.
I was also told about the number of users trying to pull data from the database. Seemingly, the more the number of users the uglier it gets with Ruby.
There really needs to be a Django session in Hyderabad.
Oh BTW, TWINCLING Society has a session on Distributed Computing on the 5th of January.
January 1, 2008 No Comments


