Wednesday, December 23, 2009

#emo

A few years down the line, we will have little devices stuck on your cheeks monitoring facial expressions. And then they will tweet "nikhil is #laughing", "nikhil is #sad" and perhaps even "nikhil got #slapped" - The cult of microblogging...

Sunday, December 20, 2009

Trending


Twitter usually syncs with the (developed) world pretty fast in hashtags. But I'm surprised Copenhagen is not on it.

To add some semblance of code: I've been mucking with node.js and some of the effect is simple TagLib bindings with that being used for something more important soon. Much improved ( or rather simplified ) kwin-tiling too with a few regressions like moving and resizing.

Sunday, December 06, 2009

Foss.in Day 4 and 5

foss.in day 4 gave me a chance to attend quite a few talks. In the morning Girish Ramakrishnan and Prashanth had a open session for anyone interested in Qt, so I got a few things clarified about MVC in Qt, and had a quick introduction to QGraphicsView ( I haven't got around to trying it yet ).

Then I spent the afternoon compiling trunk, again with repeated power failures, until I finally had a really great KDE desktop. I love the new Add Applet panel, the new netbook view for the desktop and other smooth effects. Qt Kinetic raises animation to a whole new level, check out the examples.

Later I attended “Writing plugins for Qt Creator” — another great feature I didn't know existed. What is with Qt and great software? Gopal introduced libjit. But Philip Tellis gave perhaps the best talk I've ever seen, with on the fly shell hacking to analyse Apache logs. It was true open source collaboration with the audience interjecting about sed options and redundancy, especially since Philip couldn't see all of the screen :). He also demonstrated some Javascript hacks and YQL


On day 5, I had only a few hours there before catching my flight. I chose to implement Imgur support for the Pastebin applet, which is now on the Reviewboard

Foss.in Day 3

This was KDE Project of the Day at foss.in/2009

This was best captured by Sujith, so you should go there.

My slides “My next KDE application”

Foss.in Day 2

( Forgive the past/present tense conflicts )

My computer started behaving oddly ( again ) today. It has a tendency to randomly shut off once in a while. I'm not sure if it is due to over heating or some issue with the power supply. This is interrupting a lot of my compiles or svn updates. The rest of the KDE dev gang arrived today — Akarsh, Prakash, Sujith and Kashyap.

My laptop is now desecrateddecorated with a KDE bumper sticker, and I have a KDE sweatshirt I can't wait to try on. foss.in is turning out to be a great investment :D, what with trying out the Nokia N900 and having my first ever Wi-Fi experience.

The rest of the day was spent in fixing up the slides, getting code to compile and having a final meeting to decide the course of the next day, the KDE Project of the Day.

Foss.in Day 1

( This series of posts was published on 6th Dec 2009, but written almost daily )
Today was the first day of foss.in and although getting to the place was a bit of a hassle due to everything new, I did get there on time. A great opening by Atul Chitnis formally started foss.in. Chana masala was the first thing on my mind after that since I hadn't eaten in hours. After that I finally met some KDE guys, Kartik Mistry, Pradeepto and Shantanu, Santosh, Madhusudan and more. So we spent the next 4 hours at the KDE booth setting up flyers, stickers and other schwag to get people into KDE ( yes we at KDE bribe people to contribute :p ). So I have three KDE badges and one sticker on my foss.in entry pass.

Incidentally the release of Qt 4.6.0 coincided with day 1 of foss.in. With so many KDE guys around I decided it was time to rebuild kde trunk from scratch after almost two months. Behold the power of git daemon, I just copied qt-kde and ready to go.

I finally took some time off and attended Ramkumar's Haskell talk. The guy really knows his functional programming !

Dimitris Glezos was the first keynote speaker, he talked about building a disruptive open source project and sticking to the goal.

( Which reminds me, I should get someone to list my name in the speakers when all the PotD's get their slides attached )

Thursday, November 26, 2009

Automatic builds with some inotify magic

The inotify feature in the linux kernel allows you to receive events about changed files. Using pyinotify, here is a simple script to watch for changes to source code and run "make". Everything is hard coded right now, and since I was using CMake with out-of-source builds, the directory structure is that way. It also uses the command line notify-send tool to display notifications. Perhaps some day I will make it configurable and more useful.

Cheers.



# Notification tool
# Run with the directory to watch
# currently hardcoded to use
#
# +
# |- src - contains source code and is monitored
# |- build - assumes build to be here
#
# (c) 2009, Nikhil Marathe
# Licensed under the MIT License

import sys
import os
import subprocess
import re
from pyinotify import WatchManager, Notifier, ProcessEvent, IN_MODIFY

wm = WatchManager()

class Compile( ProcessEvent ):
def process_IN_MODIFY( self, event ):
print event.path, event.name, event.mask & IN_MODIFY

if re.match( '[a-zA-Z]*.cpp', event.name ):
os.chdir( event.path.replace( 'src', 'build' ) )
ex = subprocess.call( 'make' )
subprocess.call( ['notify-send', "Build output", "%s" % ( ex == 0 and "Success" or "Error" )] )

c = Compile()
notifier = Notifier( wm, c )
wm.add_watch( sys.argv[1], IN_MODIFY, rec=True )

notifier.loop()


Saturday, November 07, 2009

Chrome: Little UI touches

I forgot to mention that I made a life changing decision change of browser about 2 weeks ago. I've been exclusively on Chrome ever since. I love the minimalist look, the great search features for downloads and the best feature is perhaps Ctrl+PgUp/Dn to switch tabs. Its also very fast on shutdown and startup compared to my firefox, almost Firebug like Developer Tools, really awesome view-source: component ( inspired by kio? ). I love the fact that I can kill some flash/java applet without crashing the browser. So fellow archers go and grab the PKGBUILD

But the really interesting thing I noticed today is this:

Hide the bookmarks toolbar. Open a new tab. In SpeedDial, notice how the bookmarks are shown at the top. Now show the bookmarks toolbar. Voila, bookmarks are hidden.

As for the firefox plugins, well I don't miss any of them yet, except for the Delicious plugin, which I try to compensate for using the bookmarklet.

Monday, November 02, 2009

Macros for Observers

Here are two little macros too make implementing the Observer design pattern less repetitive. This is C++

File: observermacros.h



#ifndef DDM_OBSERVERMACRO_H
#define DDM_OBSERVERMACRO_H

#define MAKE_OBSERVABLE( obscls ) \
private:\
std::list< obscls *> m_observers;\
public:\
void addObserver( obscls *obs ) {\
m_observers.push_back( obs );\
}\
void delObserver( obscls *obs ) {\
m_observers.remove( obs );\
}

#define NOTIFY( obscls, obsmethod, argument ) \
for( std::list::const_iterator it = m_observers.begin();\
it != m_observers.end(); it++ )\
(*it)->obsmethod( argument )

#endif




Now if you want a class to be observable do



#include "observermacros.h"

class NeedsObserving
{
MAKE_OBSERVABLE( Observes );
};



Observes is the name of the class which will observe NeedsObserving.



// add/del observers
NeedsObserving no;
Observes o = new Observes;
no.addObserver( o );
no.delObserver( o );

// To notify observers of changes

void NeedsObserving::didSomething()
{
// CoolThing *coolThing is modified/used here
// ...
NOTIFY( Observes, coolThingDone, coolThing );
// Calls Observes::coolThingDone( CoolThing * );
}


The code is pretty naive, but it might help. Cheers

Saturday, October 24, 2009

Spectacular failure ( success? ) at IEEEXtreme

Solved 2/12 problems in the first set successfully. Tried to solve 2 more, but not accepted. Can't take the straight concentration anymore. I'm hungry, dropping the contest. This was more appropriate for twitter, but I don't have an account. :o

Thursday, October 22, 2009

Non-trivium

When you don't post for a long time, it usually means you have nothing interesting to do. But for me it usually means that I have a lot of things to do. And the last month have been horrible in terms of free time.

We had a really great one day trip to Diu, but from then on, it was all underhill :)

You might want to check out the Synapse website which was crafted from scratch with a little help from these guys. This was done under constant pressure of the not so great marks I received in the first midsem exam and the looming second insem, so I applaud myself.

This was accompanied by Concours 09, the first time DA-IICT ever held an inter-college sports fest. We reached the finals and lost! (in football). But now the exams were just a week away.

This exam week was the worst of my short stint in DA. Never before have I skipped football for 5 days straight. And the woozy feeling in the head when I soaked up about 1024Kb worth of signals and systems and put more than half out on the paper. This followed by Algebraic Structures meant that I was with tics for the whole day. Whoo what a semester this is turning out to be...

Thankfully I've been home for almost a week now, enjoying great food after quite some time. But my football holiday is now up to 15 days! I have hacked on the Synapse registration, read 3 chapters of Programming Scala, watched the first part of A curious course on Concurrency and Coroutines, submitted a first code review of kwin-tiling, and procrastinated on some other things. Through all this I also read a few books, and watched the first 5 episodes of Heroes Season 4. That was a lot of stuff in retrospect. Meanwhile FOSS.in is starting to pick up steam and I'm looking forward to when the registration for simple attendance begins.

I'm also on the look-out for an internship.

In the next 48 hours, its back to DA, and time to get cracking on IEEEXtreme, at which I am going to fail miserably, since I don't get time to do pure algorithm practice.

And I thought I was on a holiday :(

PS: I wish some one would sponsor me to go to Camp KDE or atleast Akademy.

Saturday, September 26, 2009

KDE introductory talk

The Open Source Initiative in DA-IICT is our effort to get more students interested in open source, and get them to start contributing to projects. As part of that I evangelized KDE, showed off our cool apps, and demonstrated how Krunner + Kwin + Plasma come together to improve productivity a LOT. Here are the slides, Unfortunately my notes were handwritten, so you can't glean much from here. But someone else might be able to use it ( please attribute it to me though, thanks ).

Download the slides ( pdf, 461k )

Monday, August 24, 2009

Tiling screencast

With a lot of requests to see tiling in action, I've uploaded my first ever video. Unfortunately I couldn't get my microphone to work. There are also a few glitches, forgive me for that.

Friday, August 21, 2009

Dynamic layouts are here

kwin-tiling now features dynamic layout switching per desktop. Use Meta+PgUp for Columns and Meta+PgDn for Spiral. Watch the windows change their place on the fly!

A few bugs in both the layouts are also fixed. Overall kwin-tiling is pretty stable for now, so give it a whirl and notify me of any bugs you can find.

What it still lacks is Xinerama awareness, but otherwise its virtually feature complete for the first release.

Unfortunately since college has begun I've been able to work on Kwin for only a few hours a week, so progress is a bit slow.

But the good news is that since GSoC is over, we should start seeing loads of new features being integrated into trunk/ to play around with.

Sunday, August 02, 2009

Introducing Cq

Cq ( Commit Queue ) is a bridge between Mercurial and Subversion. Its whole objective is to allow you to work offline on Subversion repositories, but continue doing atomic commits. Useful when you are on the move and don't have internet access.

The premise is that you copy the working copy into a Mercurial repository. Hack away in the repository, and commit to the repository. Once you are back online, run cq commit to actually commit the changes to the Subversion repository. So it keeps track of commit messages and diffs using Mercurial hooks.

This is not stable software yet, and shouldn't be used for critical code. That said, it definitely won't delete any code unless you tell it to. I also have no idea how this will interact with mercurial branches or some uncommon svn operations. Get it from Bitbucket and read the README to use Cq. You can fork it or send patches or feature requests on Bitbucket or email.

(KDE folks might be interested in this)

Wednesday, July 29, 2009

Hello Planet

( One of my entries already got aggregated, but this is the traditional introduction )

Hello KDE people! My name is Nikhil Marathe. I'm a relatively new KDE developer ( ~3 months ), currently working on implementing tiling in kwin.

I started using KDE when I switched to ( what was ) Mandrake in 2001. I think it was KDE 3.2. Well I loved it, and have stuck with KDE ever since, following every release with great excitement. But I never considered myself able enough to hack the code. But it seems all those years of learning paid off, and motivation come in the form of Google's Summer of Code. Unfortunately tiling support didn't get a slot, but I decided to implement it anyway. And now it's coming along just fine. Thanks to Martin (mgraesslin), my mentor, for his guidance and Jonathan for his early interest in the code.

So a little bit about myself. I'm 18 years old. I'm an Indian. I'm currently in the 2nd year of the undergraduate course at DA-IICT. Though I'm currently in Gandhinagar, I'm a Mumbai boy through and through.

When I'm not hacking away I usually read or play football.

Thats it. I hope to keep contributing to KDE for many more years. I remember when I used to read the Planet wondering whether I would ever feature on it. Some dreams do come true!

Tuesday, July 28, 2009

KWin tiling progress

Between yesterday and today I made quite a lot of changes in kwin-tiling. Layouts now have a superclass which manages certain things. Each desktop now has its own layout. The root tile is no longer stored directly by the workspace, instead the workspace stores layouts for each desktop. For now each desktop has the Spiral layout, but it should be possible to dynamically change layouts for each desktop a few weeks down the line. Right now the plan is to fix certain layout issues ( such as spiral not understanding when a window is removed and adjusting the next one properly ).

The other major change is that cross virtual desktop moving is now supported. This was a major problem when it first arose, but once the first change was implemented, it was simply a matter of removing a tile from the old desktop and adding it to the new desktop.

There is no screenshot because none of these changes can be shown in a static image. But you can always try using the branch!

In other news I'm back in college. The third semester began yesterday, which means development time is now seriously down. I hacked on a (cool?) tool in the last two weeks, and I'll be announcing that soon. I'm also planning to add my blog to PlanetKDE.

Thursday, July 16, 2009

Harry Potter and the Half-Baked Prince

I've just returned from watching the Half Blood Prince, and it was a mess. I don't know what they were playing at, but I've never seen a worse Potter movie. The linear plot is suffocating. While the movie begins with somewhat of a bang, the rest of it proceeds at some enforced speed limit, leaving no climatic or anti-climatic moments. In addition some of the key characters are missing or have such restricted roles that is it disgusting to watch ( the Dursleys, Neville Longbottom ). In addition Harry actually seems to be supporting the Ministry. The lack of Rufus Scrimgeour even prevents him from being Dumbledore's man through-and-through. Ron Weasley is made somewhat of a tag-along for the Harry-Hermione pair. It seems they were trying to put forth the idea of a Harry-Hermione pair, but that is ruined by the obvious Harry-Ginny romance throughout the movie. The only point where Ron does something is to play Quidditch.

Speaking of Quidditch, if you expected a nice match like the first three movies, you will instead be treated to the 7 Great Saves of Ronald Weasley.

Darkness is indeed rising, but that does not mean that the Order of the Phoenix do nothing while Death Eaters abound. It was somewhat of a joke to see Arthur, Tonks and Lupin running (yes!), when Harry and Ginny are trapped by the Death Eaters. But wait a minute, what is Bellatrix doing at the Burrow, and how does it just burn down. Wasn't it given the most protection by the Ministry of Magic?

It was also surprising to see the absence of the Order and Dumbledore's army at the Lightning Struck Tower ( or Dumbledore's tower as in the movie ). Meanwhile Harry stands around like some idiot while the Death Eaters and Dumbledore have a chat.

The Half Blood Prince was essentially meant to explain Voldemort's past, the story of the Gaunts, and hints to the Deathly Hallows. All of this is pushed aside and replaced by two tiny memories of the orphanage and Horace Slughorn. The ring has no mention of the Peverell coat of arms, nor physically nor in speaking.

If deviations from the book are not enough, David Yates failure to capture key moments was particularly visible. The kissing scene is just pathetic, the fear in the Wizarding world seems to be totally absent and the whole lake scene was just too lame. There is no palpable sense of magic about the cave ( quartz isn't magical you know ), nothing special in the potion ( it looks like water ) and the return to Hogwarts is far too easy. Dumbledore's death is very very underplayed. There is no dead silence, no grief in any of the characters except for a few unnatural tears.

Overall every scene seems to have some kind of half-heartedness in its execution. The only thing the movie has going for it is the comedy and some of the romance. The fixation with feet is also a bit annoying. Who the hell ties their boyfriend's shoelaces? Since the previous movie Hogwarts seems to have become just another Muggle school, with robes hardly ever being worn. I think that HBP will only do well because it is riding on the success of the earlier movies. But do not expect book fans to come out satisfied. This is the only Potter movie which doesn't leave you with a sense of magic when you get out of the theater. I don't know how it has received brilliant pre-release reviews but apparently the reviewers seem to have seen the movie as some disconnected one of a kind event, but it fails to capture Harry Potter, the story as well as the phenomenon.

Monday, July 13, 2009

The little things screw up

I had this really weird bug in kwin for half a week. When you started resizing windows, all of them would start dancing about the screen. There would be little gaps between them and so on. And I couldn't figure out why. So today I finally tried comparing ( x + width ) and ( right ) of a window. Turns out they are always off by one. So to the QRect::right() documentation:
Returns the x-coordinate of the rectangle's right edge.

Note that for historical reasons this function returns left() + width() - 1; use x() + width() to retrieve the true x-coordinate.

Argh! That ( and bottom() ) was causing the mess. What a relief.

Tuesday, July 07, 2009

KWin dynamic resizing and the first layout

After a short break due to various other responsibilities and a general lack of clarity in planning some of the code, I've made progress and now you can resize windows while in tiling mode and watch all the others adjust themselves to fit the screen. Admittedly there are a few kinks, and an annoying bug where the resize pointer suddenly makes the window super-tiny, but they should be fixed in two or three days. I also implemented a basic Spiral layout today which keeps halving windows and moves towards the centre in a spiral. Gradually layouts will be in the form of a plugin system, and you would be able to choose different layouts for each virtual desktop. Here is the latest screenshot. House of Cards it is.


Monday, June 22, 2009

KWin tiling ratios and orientations...


... now with minimize support.

KWin tiling has been proceeding forward at a steady rate. If you check out the latest revision, you will not only have a pretty stable experience, but will also get a design document for free.

So orientation is horizontal and vertical, and ratio is how much space the left child gets. Using these two properties I expect to be able to do most layouts. For now you can use D-BUS calls to actually use tiling pretty well.

Here are the calls


qdbus org.kde.kwin /KWin slotToggleOrientation
qdbus org.kde.kwin /KWin slotSetRatio <float> # between 0 and 1
qdbus org.kde.kwin /KWin dumpTiles # get a nice tree if you have debugging enabled and visible


Some applications will cause trouble. Especially some plasma widgets and Kruler aren't setting the right window attributes, so I can't exempt them from tiling. So don't launch panel settings or Kickoff menu, it won't look so well.

Minimize and restore works now, it will keep track of where the window was before you minimized it and put it back there.

Please leave feedback about bugs here or on the KWin mailing list, it will be appreciated.

Wednesday, June 10, 2009

Kwin : tree based tiling


In the quest to implement tiling in KWin, I've decided to use binary trees as an internal representation. This morning, I hacked on it to produce a decent prototype, just to check if the idea would work well enough, without introducing too much complexity in the code. At the moment, it does tend to crash or have repaint issues once in a while. But it works, and it does what tiling is supposed to do. Of course there is a lot to do yet. Moving and Resizing remain particularly icky because so many choices about what is good as a default, what is expected, how to implement it, will have to be made. If you are adventurous enough to try the kwin-tiling branch, do not move the windows, or basically abuse it in anyway :)

Friday, June 05, 2009

Internship and back to college

Well, my holiday has been cut short...

I'm leaving next Saturday to spend the last month and a half of my vacations in college.

I've received an internship opportunity to work as a Playtester and Beta-tester MILLEE.

I really enjoyed the short vacation though, I learnt to drive, did a lot of swimming, and hacked some decent code.

The last year (academic) has been really really unique, perhaps the most satisfying and enjoyable one. But thats for another post

KWin preliminary tiling

Yesterday I committed code which adds a semblance of tiling to kwin. Every time you launch a window, it will be maximized vertically, but each window shares the width of the screen equally. You can check out code from KDE svn. The location is /home/kde/branches/work/kwin-tiling/

You'll need to edit $KDEDIR/share/config/kwinrc and set Placement=Tiling.

Then you are ready to go.

Right now there are no configuration options, no key bindings, nothing! Still a long long way from a functional release.

Please leave feedback and bugs.

Sunday, May 17, 2009

May updates

I'm home! Till almost the end of July I'll be @ home. Which means a better internet connection at the very least :p

So I've been swimming and learning to drive! Driving is fun, I've finished five days out of the 22 and I've managed not to hit anyone or anything.

In programming, I'm working on a game using Canvas for the CodeChef game contest. You can track its progress on github.

Also I've been doing some C socket programming, mainly doing segmented multithreaded HTTP downloads. Right now all the code is prototype, but someday it will be a decent download manager.

I'm also working on implementing tiling in KWin along with Martin Graesslin, my mentor. Right now there isn't much real progress apart from a KWin branch which maximizes every window you open.

And yesterday I got a copy of Real World Haskell. Yay!

Wednesday, April 22, 2009

I didn't get in, better luck next time

Well, none of my two proposals got selected for Summer of Code 09. Of course I will be applying to Summer of KDE soon, and getting a lot of experience over the next year, so that I have higher chances next time.

Which reminds me, I am on the way to getting a KDE svn account, and I already have 5 patches into KGet. :) My code will be in 4.3!

Monday, March 30, 2009

Multiple improvements in KGet

* This is another GSoC related post, normal users please ignore it.





Abstract
========
KGet is a versatile and user-friendly download manager for KDE.
This project will add various features to KGet to improve its functionality and
usability. These include semantic information via Nepomuk, support for digital
signatures, better Metalink integration and good Plasma support.

Personal details
================

Name: Nikhil Marathe

Email Address: nsm.nikhil@gmail.com

Freenode IRC Nick: nsm

Location (City, Country and/or Time Zone): Mumbai, India ( GMT + 5:30 )



Proposal Name
==============
Making downloading easier, safer, better - multiple improvements to Kget

Motivation for Proposal / Goal
==============================
Kget is a very good download manager, with a crisp interface and nice
integration into KDE. At the same time there is always room for improvements. These include quick renaming of partial downloads, support for
verification of downloaded files and ability to download from multiple sources.
I will attempt to add these improvements.

Goals
-----
As specified in the proposal:
* Add support for a context menu to alter download properties.
* Allow manual addition of URLs to multithreaded downloads.
* Integration of downloads from multiple sources - Bittorrent/HTTP/FTP.
* Integrate KGpg to verify digital signatures.
* Integrate Nepomuk support if available.
* Metalink creation support.
* Support to download an MD5SUMS file from servers if available and verify
downloads. Manual intervention possible if the MD5SUMS is not found.
* In case of a Metalink, attempt to verify PGP checksums using KGpg.

In addition I have the following features I would like to implement:
* Add Plasma applet drop target which can be added to panel - KGet's current drop target tends to cover up screen content. Tucking it away in
the panel seems a good workaround.
* Allow KGet to display transfer details in the system tray tooltip - this
feature ( seen in ktorrent ) is very useful.
* Allow KGet to restart on crashes - it is very annoying to find that the download you left on and went for lunch didn't finish because KGet crashed and didn't restart. This should fix it.

Apart from the motivation of improving KDE, I have a somewhat selfish motivation
for improving KGet since it seems to be the only download manager that can
resume partial files on my computer :)

Implementation Details
======================

NOTE: Wherever UI changes are required, they will be made to the web interface too in case required.

My current implementation plan includes:
* Modify KGet UI for context menu. This also involves adding the appropriate HTML/Javascript/CSS to support the same through the web interface.
* Add KIO operations for moving/copying files when download location is changed
to the KGet core.
* Add support to verify signatures using KGpg command line options ( as KGpg
does not seem to have a D-BUS interface. )
* Add dialog for creation of Metalinks from downloaded files, or local
filesystem files, including automatic MD5 and PGP checksumming.
* Submit data to Nepomuk about download location, download server.
* Allow user to add tags/rating to download while it is going on.
* Discreet option to add multiple download links for non-Metalink downloads.
* For MD5SUMS verification, attempt to guess multiple types of filenames (
MD5SUMS, md5sums.txt etc. ) or allow the user to enter link or checksum
manually.
* Implement plasma drop target which should also have settings for the
following -
Prompt for download by raising KGet window or just downloading to a default location and not breaking the user's workflow.
* Provide a setEmergencySaveFunction and crashHandler so that we can attempt to rescue files from corruption and restart KGet when it crashes.

Tentative Timeline
==================

now - May 23rd : Understand relevant KGet code. Take a look at how to hook into
Nepomuk. Plan the UI and backend design.

May 23rd - June end: Attempt to implement the core functionality of manual URL
insertion, renaming and moving, and integration of multiple download methods.
Integrate KGpg and Nepomuk. Add Metalink PGP verification.
Write plasma drop target applet. Implement tooltip functionality.

July : Implement Rating and Tagging support. Add configuration options.
Implement MD5SUMS verification. Fix bugs, write documentation.

August 1-10th: Fix remaining bugs, wrap loose ends, test test test.

More personal details
=====================
Do you have other obligations from late May to early August (school, work,
etc.)?:

My 3rd semester begins in the last week of July, which means I'll have
a bit less time ( around 25 hours a week ) towards the last two weeks of coding.
Therefore I will attempt to finish almost all
of my proposal by the end of July.

About Me
========

I'm 18 years old. I study in Gandhinagar, India. I'm pursuing
a B. Tech. in Information and Communication Technology at DA-IICT where I'm in
the first year.

I've been programming and using Linux for about 6 years now. I'm fascinated by
all the areas of computing, including compilers, operating systems, graphics and
web design+development. Python is the coolest language for me, although C/++
comes pretty close. I have significant experience in Qt ( including the new MVC
architecture ) - having developed a local network instant messaging client using
it. I am also familiar with the HTTP and FTP protocols and have used PGP
encryption/signing to some extent. In addition I have a decent web development experience, including Ajax and JS effects, which are required for the KGet web interface.

A complete list of my projects can be found at
http://22bits.exofire.net/browse/code

KDE has been a really great piece of software for me ever since I first used
version 3.2. I've always been a fan of its configurability and the momentum and
innovation in the KDE community, and KDE 4 totally took it to the next level. It
has been a kind of
dream to work on KDE someday. Unfortunately I could never participate in GSoC
due to age restrictions. I also didn't have the experience to enter such a huge
project until last year, but now I'm ready to become a full time contributor to
KDE. I have recently patched bug 164137 (
https://bugs.kde.org/show_bug.cgi?id=164137 ) in KWin to remove a redundant
checkbox, which is currently awaiting feedback from KWin developers.

When not in front of the computer I also love playing football, reading and
listening to music.

Tuesday, March 24, 2009

Proposal for Tiling support in KWin

*Note to my normal blog readers, this post may not be of interest to you

Abstract:
This project will add a tiling layout mode to KWin. Tiling window managers displays all windows on the desktop at once, side by side. This allows easy navigation and allows tasks shared across applications to be carried out effortlessly. Unfortunately it is usually presented as a power user option. This will be an attempt to make it more accessible to new users.

Name: Nikhil Marathe



Email Address: nsm.nikhil@gmail.com



Freenode IRC Nick: nsm



Location (City, Country and/or Time Zone): Mumbai, India ( GMT + 5:30 )



Proposal Name:
Implement support for tiling in KWin



Motivation for Proposal / Goal:

Tiling is a very good way to view multiple tasks/windows together. This is well
suited for tasks like writing reports where you can keep looking at references, or watching multiple pictures/videos and even programming. Fast window
switching via the keyboard also improves productivity and decreases needless
Alt+Tabbing. Although tiling window managers have existed for a long time, KWin
does not have this feature. It has been requested for a long time now too ( https://bugs.kde.org/show_bug.cgi?id=59338 ), and
will be useful for those who want to use KDE yet still want a tiling WM.
In addition tiling WMs have always tried to appeal to power users, leaving a gap for the new user to jump. They eschew the mouse and more often the configurability, while available in abundance, often requires scripting. My belief is that the tiling mode should be an intuitive and friendly user experience and should be offered to the new user as a must-have feature.

Goals:
* Provide an intuitive tiling mode, with different layouts ( like Awesome ) and
support for certain floating windows.
* Expose a D-BUS API for tiling so other applications, including Plasma can hook into it.
* Use compositing and the mouse wherever possible for a fluid experience.
* A feature where windows dragged to the edges will automatically resize themselves to half the screen size as suggested here http://lists.kde.org/?l=kwin&m=122749581132588&w=2 . Of course this could be extended and made more powerful.
* Marking/Selection - Move/tile only certain windows.
* Tiling Stacks - An entire set of
windows could be pushed back, brought in front or moved, each preserving there tiled layout. This could easily be extended to work across multiple monitors.
* Another UI feature that I would like to bring in from 'Present Windows'. The user should be able to select windows by typing a certain filter for the window titles. So a search for Dolphin followed by a keystroke would only tile dolphin instances, leaving xchat floating in the centre.

Implementation Details:

My goal would be to implement a complete tiling solution for KWin. This would
involve:

* Communicate with KWin team and community feedback, along with some help from the KDE Usability team to decide how best it can be made user friendly.

* Add tiling code to the core, including new Placement modes, support for Stacks, session management and screen edge gestures. ( Currently when a window is being moved, edge gestures are still passed on to KWin which rotates the desktop or something else. I'd like to intercept these if the user says so to enable tiling )

* Tiling architecture would be somewhat based on Awesome. Awesome is well engineered and well commented, and some of its principles can be adopted into KWin's tiling mode.

* Ensure tiling plays well with layout commands like Cascade or Unclutter or Present Windows.

* Add marking/selection and relevant key bindings.
Marking would be light weight, relevant only for the current window motion, while a Stack would be more permanent. This would use something like the resize geometry display box or if compositing is enabled, tinting or some similar effect.

* Add D-BUS API.
* Is tiling enabled?
* Available layouts, current layout.
* Switching layouts
* Stack awareness.

* Add configuration options for movement, shortcuts to layouts.
This would be intuitive. The shortcuts would only be active in tiling mode and not clash with application shortcuts. For example. in a multimedia keyboard Next would go to next track in Amarok, but Meta + Next would go to next layout or next stack.
Mouse (especially the scroll wheel) would be used extensively to do almost anything the keyboard can.

* Implement panel applet and plasma grouping by editing relevant taskbar code and leveraging the D-BUS API.

* Allow certain windows/applications to preserve their tiling by using KWin's Special Window/Application settings.

* Write user documentation, fix up bugs.

Tentative Timeline:

now - May 23rd : Understand relevant KWin code. Use KWin less, use a tiling WM more. Read KDE documentation, interact with the mentor and
community. Investigate entry points into code. Design the project and plan how the user interface should behave in
tiling mode.


May 23rd - June end: Attempt to implement the core completely. This includes the main tiling
components, the D-BUS API, working well with Plasma and so on. This will include
testing and bug squashing. Have a working tiling mode by the evaluation period.

July : Implement configuration dialogs/options, write user documentation, make the UI
sensible. Implement non critical features such as compositing support, bells and whistles.

August 1-10th: Fix remaining bugs, wrap loose ends, test test test.

Do you have other obligations from late May to early August (school, work,
etc.)?:

My 3rd semester begins in the last week of July, which means I'll have
a bit less time ( around 25 hours a week ) towards the last two weeks of coding. Therefore I will attempt to finish almost all
of my proposal by the end of July.

About Me (let us know who you are!):

I'm 18 years old. I study in Gandhinagar, India. I'm pursuing
a B. Tech. in Information and Communication Technology at DA-IICT where I'm in
the first year.

I've been programming and using Linux for about 6 years now. I'm fascinated by
all the areas of computing, including compilers, operating systems, graphics and
web design+development. Python is the coolest language for me, although C/++

comes pretty close. I have significant experience in Qt ( including the new MVC
architecture ) - having developed a local network instant messaging client using
it.

A complete list of my projects can be found at
http://22bits.exofire.net/browse/code

KDE has been a really great piece of software for me ever since I first used
version 3.2. I've always been a fan of its configurability and the momentum and
innovation in the KDE community, and KDE 4 totally took it to the next level.
Okular and Amarok are the killer applications for me. It has been a kind of
dream to work on KDE someday. Unfortunately I could never participate in GSoC due to age restrictions. I also didn't have the experience to enter such a huge project until last year, but now I'm ready to become a full time contributor to KDE.

When not in front of the computer I also love playing football ( soccer ).
Otherwise I can be found reading or listening to music.

Sunday, February 22, 2009

GMail Notifier on an Arduino

The exams are over and I've been hacking a bit on the Arduino today. So I came up with a simple hack which blinks an LED on the Arduino if you've got unread mails in your Gmail inbox. I assume that you're familiar with the basics of Arduino.

Equipment

  • A computer with an internet connection

  • Python

  • pySerial

  • Arduino ( I'm using Duemilanove )

  • Red LED

  • Pushbutton (optional)

  • Wires

On the computer

A python script will run continuously on the computer, and fetch the Gmail RSS feed every few minutes. pySerial will be used to notify the Arduino of new mails.

Here are our imports and constants

# ~ Gmail Notifier for Arduino
# ~ This file is released under the public domain

import httplib
import getpass
import base64
import re
import time
import serial

INTERVAL = 5 # check every INTERVAL minutes

serv = 'mail.google.com'
path = '/mail/feed/atom'
# ask user name and password and encode them for authentication

auth = base64.encodestring(
'%s:%s'%(raw_input('Username: '),
getpass.getpass()))


So first, fetching the feed. We'll use httplib. Here is the code:

def getfeed():
print 'Checking...'
conn = httplib.HTTPSConnection(serv)
conn.putrequest('GET', path)
conn.putheader('Authorization', 'Basic %s'%auth)
conn.endheaders()
return conn.getresponse().read()


Next lets get the count. Gmail replies in the following format. In the case of new mails there is more information, but we don't care about that. We're mainly interested in fullcount.

<?xml version="1.0" encoding="UTF-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#">
<title>Gmail - Inbox for nsm.nikhil@gmail.com</title>
<tagline>New messages in your Gmail Inbox</tagline>
<fullcount>0</fullcount>
<link rel="alternate" href="http://mail.google.com/mail" type="text/html" />
<modified>2009-02-22T11:00:33Z</modified>
</feed>


So we'll use regular expressions to get the count.

def count(data):
matches = re.findall('<fullcount>([0-9]+)</fullcount>', data)
if len(matches) == 0:
print 'Error in parsing feed, check user name and password are correct'
return 0
return int(matches[0])


We'll need to write this to the serial port.

def writeSer(data):
try:
# the best way to find this out is to launch the Arduino environment
# and see what it says under Tools -> Serial Port
ser = serial.Serial('/dev/ttyUSB0')
ser.write(data)
except serial.serialutil.SerialException:
print 'Error writing to serial device'
raise


Now that we're done with the functions, it's time to make them work together


# subtract so that we check first time
last_check = time.time() - INTERVAL*60

while True:
if time.time() - last_check < INTERVAL*60:
continue
last_check = time.time()
msgs = count(getfeed())
print msgs,'mails'
writeSer(str(msgs))



Thats the computer part.

On the Arduino


The circuit :



The LED is on pin 13 and goes to ground. The button takes 5V through the power pins on the analog side, via a 220 ohm resistor. The other leg is grounded. Pin 4 can be used to read the state of the button. The wire from pin 4 connects to the 5V leg of the button.

The code is dead simple and so is presented together.


int ledPin = 13; // connect led to digital pin 13, or use default small one
int bPin = 4; // connect button to digital pin 4
boolean blink = false; // holds our current state

int INTERVAL = 200; // led blink rate in milliseconds

void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}

void loop() {
if(Serial.available() > 0)
blink = Serial.read() > 48;// 48 is 0 is ASCII

if(digitalRead(bPin) == LOW) // button pressed
blink = false;

// blink is true if we got serial input
// or we had got serial input and button hasn't been pressed yet.
if(blink) {
digitalWrite(ledPin, HIGH);
delay(INTERVAL);
digitalWrite(ledPin, LOW);
delay(INTERVAL);
}
else
digitalWrite(ledPin, LOW);
}


The button is used to switch off the blinking once you've noticed that you've got mail and don't want it to keep blinking till the next check.

Running

Verify and Upload the code to the Arduino. You can try entering numbers in the Serial Monitor to check that the circuit works. Remember to switch off the Serial Monitor.

Now start your script, python mailarduino.py. Enter authentication details. Now sit back and relax... oh wait, you've got mail.

Full python script ( mailarduino.py )

import httplib
import getpass
import base64
import re
import time
import serial

INTERVAL = 5 # check every INTERVAL minutes

serv = 'mail.google.com'
path = '/mail/feed/atom'

auth = base64.encodestring(
'%s:%s'%(raw_input('Username: '),
getpass.getpass()))

def count(data):
matches = re.findall('<fullcount>([0-9]+)</fullcount>', data)
if len(matches) == 0:
print 'Error in parsing feed, check user name and password are correct'
return 0
return int(matches[0])

def getfeed():
print 'Checking...'
conn = httplib.HTTPSConnection(serv)
conn.putrequest('GET', path)
conn.putheader('Authorization', 'Basic %s'%auth)
conn.endheaders()
return conn.getresponse().read()

def writeSer(data):
try:
ser = serial.Serial('/dev/ttyUSB0')
ser.write(data)
except serial.serialutil.SerialException:
print 'Error writing to serial device'
raise

last_check = time.time() - INTERVAL*60 # subtract so that we check first time

while True:
if time.time() - last_check < INTERVAL*60:
continue
last_check = time.time()
msgs = count(getfeed())
print msgs,'mails'
writeSer(str(msgs))

Tuesday, January 27, 2009

Techfest 09 and the Arduino

I was in mumbai over the weekend, attending Techfest 2009 at IIT Bombay. Techfest has been a large and great event for many years now, bringing cutting edge technology to students and holding great lectures by iconic people in technology.

Me and three of my friends went specifically to attend the Physical Computing workshop by Keyur Sorathia, an interaction designer. This was my first foray into hardware hacking, mainly because hardware components are not so accessible in India.

On day one, we hacked a keyboard, figured out which pins pressed which key and connected a tilt sensor to do the same. Then we popped them into an helmet. Unfortunately, soldering wasn't our strong point and although the helmet worked, we couldn't wear it on our head. Keyur also showed us videos about various which aim to make computer interaction more like interacting with real objects.




Day two, and we finally got our hands on the Arduino. The Duemilanove is the latest iteration of Arduino and we had fun programming LEDs to light up on key presses. Of course we didn't get to see all of the Arduino's magic in a two day workshop. But we did get infrared sensors, peizo sensors and buttons to mess around with, which I'll start using soon.


On day three, the workshop unofficially over, we first saw Robot Wars, which was a bit of a disappointment because one of the machines got stuck and didn't move much for the remainder of the match. Then we attended an interesting lecture by Rhythm and Hues. Directi had a booth where they had 3 C snippets and visitors had to predict the output. Two out of the three were pretty tough, but I managed to answer 2/3 and got myself a T-shirt that says <geek> on the front and </geek> on the back.

Nissan concept car Pivo2

Due to our train and other schedules, we were unable to attend Technoholix on any of days, which was bad. So next year I'm gonna take off more time and stay at Techfest and attend all the great events.