The Zeroth

Abhishek Patil's Blog…

thezeroth.net is back

leave a comment »

Hello every one please update you Bookmarks with http://thezeroth.net

and feeds with http://thezeroth.net/feed/rss/ this is my all new website and  blog  :)

Written by Abhishek Patil

February 12, 2010 at 6:24 AM

KDE: Kate add a file by right-click in Filesystem Browser

with 3 comments

One more Kate wish completed by me :) .  Bug no. 93230 and this will also be in KDE 4.5 :) .

Problem/Wish: There is no way to add a file by rightclicking to a folder in Filesystem Broswer(filebrowser plugin).

Solution: Updated the KDirOperator with KNewFileMenu wrapper “setNewFileMenuSupportedMimeTypes” which will Only show the files in a given set of mimetypes it Internally uses  KNewFileMenu::setSupportedMimeTypes. In general now we can restrict options to be shown in Create New, this is useful in specialized applications like kate etc.  while file managers, on  the other hand, want to show all mimetypes.  (thanks to David Faure for moving KNewMenu to kdelibs as KNewFileMenu).

* for more details  here is the bug description.

This is how the new context menu of kate Filesystem Browser will look:

To download patch click here.


Written by Abhishek Patil

January 28, 2010 at 12:15 AM

Posted in bug fix, kate, kde, Tech

Tagged with , , , ,

KDE: Kate close/save multiple files.

with 3 comments

One more patch from my side to Kate. This time it’s from kate wish-list Bug No. 62998 and this will be in KDE 4.5 :) .

Problem/Wish: There was no option for closing and saving multiple (selected) files in document list.

Solution: Changed the document list’s selection mode to QAbstractItemView::ExtendedSelection and added two options in list’s context-menu, Save Selected and  Close Selected , now user can select multiple  files in document list by Left-click + Ctrl combination and close them using Right-click + Close Selected or/and save them using Right-click + Save Selected options.

* for more details  here is the bug description.

This is how the new context menu of kate document list will look :

To download patch click  here.

Written by Abhishek Patil

January 13, 2010 at 12:29 AM

Posted in bug fix, kate, kde, Tech

Tagged with , , , ,

My 1st Open-Source contribution

with 2 comments

Long time since I made a blog post … My new year started with a bang .. completing one item from my own wish list i.e contribute to a Open-Source project.

I have started contributing to KDE Kate. My 1st patch accepted for BUG No. 184055 which is now in kde 4.4 :) . Hurray …

About the fix:
Problem : Previously in Kate’s document view the last added file was not getting sorted as per the given sorting option.
Solution: Whenever user open the file call the document views sorting.

* for more details  here is the bug description .

To download patch click here.

Though it was really small bug fix it was really a good learning experience. I will try to be consistent with contributing to KDE :) .

All credit goes to Pradeepto and Prashanth for encouraging and guiding me :) . Thanks guys.

Written by Abhishek Patil

January 12, 2010 at 11:05 PM

Posted in Hacks, kate, kde, Tech

Tagged with , , ,

Python CSV Hack!

with 2 comments

This is just a simple hack I did today morning.

This is to calculate my total internet data usages.

From my ISP Reliance Netconnect Broadband + I get one CSV file with all the details, and to view this I don’t have any spreadsheet viewer kinda thing installed on my system, so how to calculate the usages?

I wrote small python script to do so, this is about it how it works.

contents of CSV file looks something like this :

Date Of Access,Time Of Access,Session Duration,Data Upload(KBs),Data Download(KBs),Total Data Transferred(KBs)
22-10-2009, 07:36:58,2623,1060.50390625,7934.458984375,8994.962890625
22-10-2009, 19:47:34,13675,22826.49609375,344230.265625,367056.76171875
22-10-2009, 23:35:29,229,24.2666015625,33.56640625,57.8330078125
22-10-2009, 23:39:18,13792,838.701171875,11057.255859375,11895.95703125
23-10-2009, 03:32:53,14839,18841.23046875,104978.8837890625,123820.1142578125
23-10-2009, 20:47:20,292,117.1015625,647.9287109375,765.0302734375
23-10-2009, 20:52:12,233,226.669921875,2429.98828125,2656.658203125
23-10-2009, 03:32:49,4,0,0,0
23-10-2009, 20:56:08,22657,57322.56640625,939251.0869140625,996573.6533203125
24-10-2009, 03:13:45,1399,145.619140625,287.9228515625,433.5419921875
24-10-2009, 03:37:03,4745,199.060546875,289.611328125,488.671875
24-10-2009, 19:40:46,3172,799.1708984375,5288.591796875,6087.7626953125

Basically divided into 6 Fields ie.

Date Of Access  | Time Of Access | Session Duration  | Data Upload(KBs) | Data Download(KBs) | Total Data Transferred(KBs)

separated by “,” (comma) .

Here my required field is Total Data Transferred(KBs), thats the last field.

means I need to add last field of each row.

the python scrip for the same is:
# Open file
f = open("tel.csv")

# Read all lines in list called lines
lines = f.readlines()

# Initialize variable to store the total
total = 0.0

""" Remove the 1st line from the lines list as
it's the header which we don't require"""

lines.pop(0)

for i in lines:

""" Split each line on ","(comma)
so that you will get all the 6 fields for that line as list"""

i = i.split(",")

""" Take the last value, convert it to float
and add it to the total variable"""

total += float(i[-1])

# Print the total in Kb
print "total data uses in Kb: " + total
# Print the total in Mb
print "total data uses in Mb: " + total/1024
# Print the total in Gb
print "total data uses in Gb: " + (total/1024)/1024

Happy Hacking !!

Written by Abhishek Patil

December 9, 2009 at 10:59 PM

Posted in Hacks, Tech

Tagged with , , , ,

The Sapling Project

with 2 comments

http://thesaplingproject.com

Great Initiative by Satish Vijaykumar and Ranjeetsinh Walunjpatil. Great work dudes.
I am Participating…

 

Sapling, originally uploaded by Bombayite.

You can be a part too…

Written by Abhishek Patil

November 29, 2009 at 12:01 PM

Posted in General

Tagged with

Late Night Drive On Bangalore-Pune Highway

with 2 comments

After a long Time (and first time in Bangalore) on a late night Drive with Sharath for Late Night Photography on 27 Nov 2009.

After lots of re-take on Bangalore-Pune Highway Finally we got a good pic around 2:30 AM.

 

Roadrunning, originally uploaded by Sharath M Srinivasan.

Written by Abhishek Patil

November 28, 2009 at 11:31 PM

Posted in General

Tagged with , ,

Foss.in/2009

with one comment

Written by Abhishek Patil

November 28, 2009 at 7:47 PM

Posted in General, Tech

Tagged with , ,

main()

leave a comment »

{

In “Array” Index of 1st element is 0th :)
For the other who don’t know the Array .
In programming normally the 1st element is refereed as 0th element ,  and in decimal number system the 1st number is also “0″.
I think this is much more clear explanation for the term “The Zeroth” .  :)

}

Written by Abhishek Patil

November 28, 2009 at 2:30 PM

Posted in Tech

Tagged with

Follow

Get every new post delivered to your Inbox.