Wednesday, December 26, 2007

Friday, December 07, 2007

RSS feed reader 3rd Update

Added toaster-pop-up like notification for updates . Clicking the Pop-up will open the corresponding blog entry in the browser.






from sgmllib import SGMLParser
import feedparser
from threading import Thread
from time import mktime, sleep
from re import sub
import pygtk
pygtk.require("2.0")
import gtk

class ParseDoc(SGMLParser):
def get_vals(self):
return self.datalist
def parse(self, data):
self.feed(data)
self.close()
def __init__(self, verbose=0):
SGMLParser.__init__(self, verbose=0)
self.datalist = []
def start_outline(self, attributes):
attrdict = {}
for name, value in attributes:
attrdict[name]=value
self.datalist.append(attrdict)


class FetchFeed(Thread):
def __init__(self, xmlurl):
Thread.__init__(self)
self.xmlurl = xmlurl
self.feedresult = None

def run(self):
d = feedparser.parse(self.xmlurl)
if d.feed.has_key('title'):
self.feedresult = d
def strip_html(text):
def fixup(m):
text = m.group(0)
if text[:1] == "<":
return ""
if text[:2] == "&#":
try:
if text[:3] == "&#x":
return unichr(int(text[3:-1], 16))
else:
return unichr(int(text[2:-1]))
except ValueError:
pass
elif text[:1] == "&":
import htmlentitydefs
entity = htmlentitydefs.entitydefs.get(text[1:-1])
if entity:
if entity[:2] == "&#":
try:
return unichr(int(entity[2:-1]))
except ValueError:
pass
else:
return unicode(entity, "iso-8859-1")
return text
return sub("(?s)<[^>]*>|&#?\w+;", fixup, text)


class ParseBlogs(ParseDoc):

def __init__(self, opmldoc = None):
ParseDoc.__init__(self, verbose=0)
self.lastenty = None
if opmldoc:
fileobj = open(opmldoc);
filedata = fileobj.read()
fileobj.close()
ParseDoc.parse(self, filedata)
self.blogsdata = ParseDoc.get_vals(self)
del self.blogsdata[0]
self.opmldocflag = 1
self.resultlimit = 3

else:
self.blogsdata = ['http://mvblogs.org/mvblogs.xml']
self.opmldocflag = 0
self.resultlimit = None
self.feedresults = []

self.threadlist = []
self.lastparsetime = None

def getfeeds(self, min=0, max=1):

for i in self.blogsdata[min:max]:

if self.opmldocflag:
t = FetchFeed(i['xmlurl'])
else:
t = FetchFeed(self.blogsdata[0])
t.start()
self.threadlist.append(t)

for tl in self.threadlist:
tl.join()
self.getfeed(tl)
self.threadlist = []

def getfeed(self, tl):
results = []
if tl.feedresult:
tlfeed = tl.feedresult.feed
tlresult = tl.feedresult.entries

results.append(tlfeed)
results.append(tlresult)
self.feedresults.append(results)


def printfeeds(self, onlyupdates = 'false'):
print "printing"
for i in self.feedresults:#for each feed

#if limit not set fetch all entries
if not self.resultlimit:self.resultlimit = len(i[1])

for j in range(self.resultlimit):#for each entry

#if onlyupdates then ignore old entries
if onlyupdates == "true" and self.lastparsetime:
if mktime(i[1][j].updated_parsed) <= mktime(self.lastparsetime):
continue

if self.opmldocflag:
print i[0]['author']
print i[0]['title']

print i[1][j].date
print i[1][j].title
print i[1][j].link
print strip_html(i[1][j].description)
print "#"*100
#for updates display popup
if onlyupdates =="true" and self.lastparsetime:
toasterpop = Popup(i[1][j].title, i[1][j].link)

self.lastparsetime = self.feedresults[0][1][0].updated_parsed
self.feedresults = []

class Popup:
def clicky(self, widget, link=None):
os.system("firefox "+link)
gtk.main_quit()

def delete_event(self, widget, event, data=None):
return False

def destroy(self, widget, data=None):
gtk.main_quit()

def __init__(self,message = "Hello World", link="http://vishah.blogspot.com"):
self.toaster = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.toaster.set_title("New!!")
self.toaster.connect("destroy", self.destroy)
self.toaster.connect("delete_event", self.delete_event)
self.button = gtk.Button(message)
self.button.connect("clicked",self.clicky, link)
self.toaster.add(self.button)
self.toaster.set_gravity(gtk.gdk.GRAVITY_SOUTH_EAST)
self.toaster.resize(150,150)
width, height = self.toaster.get_size()
self.toaster.move(gtk.gdk.screen_width() - width, gtk.gdk.screen_height() - height)
self.toaster.show_all()
self.main()


def main(self):
gtk.main()

#parseobj = ParseBlogs('mvblogs-export.xml')
#parseobj.getfeeds(0,3)
parseobj = ParseBlogs()
while(1):
parseobj.getfeeds()
parseobj.printfeeds('true')
sleep(20)



Sunday, December 02, 2007

Invitation for Linux and free software enthusiasts

http://www.facebook.com/group.php?gid=2433611028

Join this facebook group for discussion and support.

Why Free/Open Source Software??
http://www.gnu.org/philosophy/

Free software is a matter of freedom: people should be free to use software in all the ways that are socially useful. Software differs from material objects—such as chairs, sandwiches, and gasoline—in that it can be copied and changed much more easily. These possibilities make software as useful as it is; we believe software users should be able to make use of them.

  • The freedom to run the program, for any purpose (freedom 0).
  • The freedom to study how the program works, and adapt it to your needs (freedom 1). Access to the source code is a precondition for this.
  • The freedom to redistribute copies so you can help your neighbor (freedom 2).
  • The freedom to improve the program, and release your improvements to the public, so that the whole community benefits (freedom 3). Access to the source code is a precondition for this.

Saturday, December 01, 2007

openSUSE YeaaaHH

Installed the latest openSUSE version 10.3 today.In my opinion this is the distro which has the best implementation of KDE.

5:40 At the moment installing NVIDIA drivers
http://en.opensuse.org/NVIDIA
As you can see in the NVIDIA page, it's very easy to install software ..Instead of downloading the RPMs and manually installing, you can install any software in their catalog by 1-Click technology.

5:52 installing Compiz Fusion
http://en.opensuse.org/Compiz-Fusion
This is for the eye candy..Minimizing effects, fire on the screen.ripple effects etc. Some plugins increases usability also.

6:10 Installing dhivehi fonts.There is a GUI way of downloading the fonts manually and installing it..But using a script or a set of commands is also an option.
su
mkdir fonts
cd fonts
mkdir /usr/share/fonts/truetype/Dhivehi
wget http://www.haveeru.com.mv/fonts.zip
mkdir dhivehifonts
unzip -d dhivehifonts fonts.zip
rm fonts.zip
wget -P dhivehifonts "http://www.mcst.gov.mv/Downloads/New/Divehi%20xp%20fonts/Mv%20GroupX%20Avas.otf.ttf" "http://www.mcst.gov.mv/Downloads/New/Divehi%20xp%20fonts/Mv%20Iyyu%20Normal.otf.ttf" "http://www.mcst.gov.mv/Downloads/New/Divehi%20xp%20fonts/Mv%20MAG%20Round.otf.ttf" "http://www.mcst.gov.mv/Downloads/New/Divehi%20xp%20fonts/Mv%20MAG%20Round%20XBold.otf.ttf" "http://www.mcst.gov.mv/Downloads/New/Divehi%20xp%20fonts/Mv%20Sehga%20Old.otf.ttf" "http://www.mcst.gov.mv/Downloads/New/Divehi%20xp%20fonts/Mv%20Iyyu%20Nala.otf.ttf" "http://www.mcst.gov.mv/Downloads/New/Divehi%20xp%20fonts/Mv%20Lady%20Luck.otf.ttf" "http://www.mcst.gov.mv/Downloads/New/Divehi%20xp%20fonts/Mv%20MAG%20Round%20Hollow.otf.ttf" "http://www.mcst.gov.mv/Downloads/New/Divehi%20xp%20fonts/Mv%20Sehga%20FB.otf.ttf" "http://www.mcst.gov.mv/Downloads/Fonts/Mv%20Galan.ttf"
mv dhivehifonts/*.TTF dhivehifonts/*.ttf /usr/share/fonts/truetype/Dhivehi/
fc-cache -f -v

Configuring Compiz
Enable Expo


Enable Cube Gears


Suse kickoff menu
has been ported to KDE 4.



1:46 Multimedia codecs
( after going out for a little birthday celebration :D )
http://opensuse-community.org/Multimedia

openSUSE.org

Thursday, November 29, 2007

RSS reader update

If 'onlyupdates' flag is set it will run on the background and print only the updates.



import sgmllib
import feedparser
from threading import Thread
import time
import re
import urllib

class MyParse(sgmllib.SGMLParser):
def get_vals(self):
return self.datalist
def parse(self, data):
self.feed(data)
self.close()
def __init__(self, verbose=0):
sgmllib.SGMLParser.__init__(self, verbose=0)
self.datalist = []
def start_outline(self, attributes):
attrdict = {}
for name, value in attributes:
attrdict[name]=value
self.datalist.append(attrdict)


class FetchFeed(Thread):
def __init__(self, xmlurl):
Thread.__init__(self)
self.xmlurl = xmlurl
self.feedresult = None

def run(self):
d = feedparser.parse(self.xmlurl)
if d.feed.has_key('title'):
self.feedresult = d
def strip_html(text):
def fixup(m):
text = m.group(0)
if text[:1] == "<":
return ""
if text[:2] == "&#":
try:
if text[:3] == "&#x":
return unichr(int(text[3:-1], 16))
else:
return unichr(int(text[2:-1]))
except ValueError:
pass
elif text[:1] == "&":
import htmlentitydefs
entity = htmlentitydefs.entitydefs.get(text[1:-1])
if entity:
if entity[:2] == "&#":
try:
return unichr(int(entity[2:-1]))
except ValueError:
pass
else:
return unicode(entity, "iso-8859-1")
return text
return re.sub("(?s)<[^>]*>|&#?\w+;", fixup, text)


class ParseOpml(MyParse):

def __init__(self, opmldoc = None):
MyParse.__init__(self, verbose=0)
self.lastenty = None
if opmldoc:
fileobj = open(opmldoc);
filedata = fileobj.read()
fileobj.close()
MyParse.parse(self, filedata)
self.blogsdata = MyParse.get_vals(self)
del self.blogsdata[0]
self.opmldocflag = 1
self.resultlimit = 3

else:
self.blogsdata = ['http://mvblogs.org/mvblogs.xml']
self.opmldocflag = 0
self.resultlimit = None
self.feedresults = []

self.threadlist = []
self.lastentry = None

def getfeeds(self, min=0, max=1):

print self.blogsdata[0]
for i in self.blogsdata[min:max]:

if self.opmldocflag:
t = FetchFeed(i['xmlurl'])
else:
t = FetchFeed(self.blogsdata[0])
t.start()
self.threadlist.append(t)

for tl in self.threadlist:
tl.join()
self.getfeed(tl)

def getfeed(self, tl):
results = []
if tl.feedresult:
tlfeed = tl.feedresult.feed
tlresult = tl.feedresult.entries

results.append(tlfeed)
results.append(tlresult)
self.feedresults.append(results)
if not self.lastentry:self.lastentry = tlresult[len(tlresult)-1]

def printfeeds(self, onlyupdates = 'false'):
for i in self.feedresults:

if not self.resultlimit:self.resultlimit = len(i[1])
for j in range(self.resultlimit):
if onlyupdates:
if self.lastentry.date<i[1][j].date:
continue

if self.opmldocflag:
print i[0]['author']
print i[0]['title']

print i[1][j].date
print i[1][j].title
print i[1][j].link
print strip_html(i[1][j].description)
print "#"*100
if onlyupdates:
self.lastentry=None



#parseobj = ParseOpml('mvblogs-export.xml')
#parseobj.getfeeds(0,3)
parseobj = ParseOpml()
while(1):
parseobj.getfeeds()
parseobj.printfeeds('true')
time.sleep(30)


RSS feed reader

The idea is to have a pop up notification for blog updates..But was too bored to complete it.






import sgmllib
import feedparser
from threading import Thread
import time
import re
#parse the list
class myparse(sgmllib.SGMLParser):
def get_vals(self):
return self.datalist
def parse(self, data):
self.feed(data)
self.close()
def __init__(self, verbose=0):
sgmllib.SGMLParser.__init__(self, verbose=0)
self.datalist = []
def start_outline(self, attributes):
attrdict = {}
for name, value in attributes:
attrdict[name]=value
self.datalist.append(attrdict)


class fetchfeed(Thread):
def __init__(self, xmlurl):
Thread.__init__(self)
self.xmlurl = xmlurl
self.feedresult = None

def run(self):
d = feedparser.parse(self.xmlurl)
if d.feed.has_key('title'):
self.feedresult = d
def strip_html(text):
def fixup(m):
text = m.group(0)
if text[:1] == "<":
return ""
if text[:2] == "&#":
try:
if text[:3] == "&#x":
return unichr(int(text[3:-1], 16))
else:
return unichr(int(text[2:-1]))
except ValueError:
pass
elif text[:1] == "&":
import htmlentitydefs
entity = htmlentitydefs.entitydefs.get(text[1:-1])
if entity:
if entity[:2] == "&#":
try:
return unichr(int(entity[2:-1]))
except ValueError:
pass
else:
return unicode(entity, "iso-8859-1")
return text
return re.sub("(?s)<[^>]*>|&#?\w+;", fixup, text)

#parse the OPML document.
fileobj = open('mvblogs-export.xml');
filedata = fileobj.read()
fileobj.close()
parseblogs = myparse()
parseblogs.parse(filedata)

blogdata = parseblogs.get_vals()
del blogdata[0]
tlist = []
for i in blogdata[0:10]:
t = fetchfeed(i['xmlurl'])
t.start()
tlist.append(t)

for tl in tlist:
tl.join()
if tl.feedresult:
tlfeed = tl.feedresult.feed
tlresult = tl.feedresult.entries
print "author:" + tlfeed['author']
print "title:" + tlfeed['title']
for i in range(3):
print tlresult[i].date
print tlresult[i].title
print tlresult[i].link
print strip_html(tlresult[i].description)
print "#"*100



Friday, November 09, 2007

Fedora8

http://fedoraproject.org/wiki/Releases/8/ReleaseSummary
Werewolf" moves across the land
Router meltdowns close at hand
Sysadmins in search of blood
For those who caused this bandwidth flood
And whosoever took the risk
But failed to make an extra disc
Must face the Bastard Op from Hell
And lose his access to the shell

The best of Linux now is here
To kill the FUD and strike with fear
The hearts of those who steal your rights
And hide their code far from your sight
Closed source takes away what's yours
But you'll never shake the horror
Until you taste the freedom and
The power of FEDORA!

Saturday, November 03, 2007

The Greatest Hacker In Maldives

I'm proud we have such elite hackers in Maldives.Though we are a country of only 300,000 people, there are masters in every field specially computing..It fills me with joy so much that I get cramps by reading the interview with The Greatest Hacker in Maldives..

the interview: http://crymv.blogspot.com/2007/11/blog-post.html

тнє υηвσяη: am telling only u ingey abt this, so dnt tell anyone. i have stpd hackin last year dec...cus microsoft n lotsa others lookin for me..i am from The Legion..i was their leader and i led them 4 almst 1 n 1/2 yrs.its an international group of hackers n no one knws each others name or identity....only reason y we r still arnd, evn microsoft dono who we r..

Sunday, October 28, 2007

Dhiraagu edirectory lister 3rd update



Changes:

  • "Get All" will show the results in a single block instead of page by page.
So it's possible to redirect the output to a file in a single go.
For instance
vishah@vishah-desktop:~$ python edir.py >edirlog.txt

If the query gives a large set of results, the program might appear frozen, because threading is not implemented yet..give it some time and it'll hopefully complete.

  • Click the code.



# ____________________________________
#/ dhiraagu edirectory lister 3 rd    \
#\ version                            /
# ------------------------------------
#
import pygtk
pygtk.require("2.0")
import gtk
import urllib2
import urllib
import sgmllib
import re
import cookielib

class MyParser(sgmllib.SGMLParser):
       def __init__(self, verbose=0):
               sgmllib.SGMLParser.__init__(self, verbose)
               self.numbers = []
               self.bumbers = []
               self.inside_td_element = 0
               self.inside_tdno_element = 0
               self
       def parse(self, data):
               self.feed(data)
               self.close()

       def start_td(self, attributes):
               if attributes == []:
                       self.inside_td_element = 1
               else:
                       self.inside_tdno_element = 1

       def end_td(self):
               self.inside_td_element = 0
               self.inside_tdno_element = 0

       def handle_data(self, data):
               if self.inside_td_element == 1:
                       self.numbers.append(data)
               if self.inside_tdno_element == 1:
                       self.bumbers.append(data)

       def get_numbers(self):
               return self.numbers

       def get_bumbers(self):
               return self.bumbers



       phonenumbers=""
class duck:
       def clicky(self, widget, textbuffer, entry, next=None,first = None,listall = None):

               urlobj = None
               urlobjdata = ""
               cmpobjres = None
               cmpobj = None
               global phonenumbers

               if first != None:
                       urlobj = urllib2.urlopen('http://www.dhivehinet.net.mv/index.php', urllib.urlencode({'action':'edir', 'query':entry.get_text(), 'searchtype':'number'}))
                       for i in range(0,len(self.button)):
                               self.button[i].destroy()
                       self.button=[]

               else:
                       self.cj.load('/tmp/edircookie')
                       urlobj = urllib2.urlopen('http://www.dhivehinet.net.mv/index.php', urllib.urlencode({'action':'edir','page':next}))

               self.cj.save('/tmp/edircookie')

               urlobjdata = urlobj.read()
               if (int(self.nextpage) == int(next)) or ( first != None ):
                       cmpobj = re.compile(r'<a id=\"nextPage\" href=\".+?page=([0-9]{1,})\"', re.DOTALL)
                       cmpobjres = cmpobj.search(urlobjdata)

               if cmpobjres is not None:
                       print "sssssssssssss"
                       self.nextpage = cmpobjres.group(1)
                       buttonindex = int(self.nextpage)
                       if listall == None:
                               self.button.append(gtk.Button(self.nextpage))
                               print buttonindex
                               self.hbox.pack_start(self.button[buttonindex-1],True,True,0)
                               self.button[buttonindex-1].connect("clicked",self.clicky,textbuffer, entry, buttonindex )
                               self.button[buttonindex-1].show()
                       else:
                               self.clicky(widget, textbuffer, entry, buttonindex, None, "yes")
               else:
                       ass = "true"

               diParser = MyParser()
               cmpobj = re.compile(r"id=\"edir\".+?table>", re.DOTALL)
               feeddata = cmpobj.search(urlobjdata).group()
               diParser.feed(feeddata)
               asw = diParser.get_numbers()
               asd = diParser.get_bumbers()
               prrr = ''
               if listall == None:
                       for i, j in zip(asw, asd):
                               prrr = prrr + "\n" + j.ljust(12,' ') + i.ljust(20, ' ')
                       textbuffer.set_text(prrr)
               else:
                       for i, j in zip(asw, asd):
                               prrr = prrr + "\n" + j.ljust(12,' ') + i.ljust(20, ' ')
                       phonenumbers = phonenumbers + prrr
                       print phonenumbers
               if int(self.nextpage) != int(next):
                       textbuffer.set_text(phonenumbers)

       def closethingy(self, widget, event, data=None):
               gtk.main_quit()
       def __init__(self):
               self.button = []
               self.cj = cookielib.LWPCookieJar()
               opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cj))
               urllib2.install_opener(opener)
               self.nextpage=0
               self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
               self.window.set_title("Dhiraagu edirectory lister")
               self.window.connect("delete_event", self.closethingy)
               self.vbox = gtk.VBox(False, 0)
               self.hbox = gtk.HBox(True,0)
               entry = gtk.Entry(50)
               self.vbox.pack_start(entry, False, False, 0)
               button = gtk.Button("Get List")
               buttonall = gtk.Button("Get All")
               textview = gtk.TextView()
               textbuffer = textview.get_buffer()
               button.connect("clicked", self.clicky, textbuffer, entry,0,"yes")
               buttonall.connect("clicked", self.clicky, textbuffer, entry,0,"yes","yes")
               scrolledwindow = gtk.ScrolledWindow()
               scrolledwindow.set_policy(gtk.POLICY_ALWAYS,gtk.POLICY_ALWAYS)
               scrolledwindow.add_with_viewport(textview)
               self.vbox.pack_start(button, False, False, 0)
               self.vbox.pack_start(buttonall, False, False, 0)
               self.vbox.pack_start(scrolledwindow, True, True, 10)
               self.vbox.pack_start(self.hbox,False,False,0)
               self.window.add(self.vbox)
               self.window.set_border_width(3)
               self.window.resize(700, 500)
               self.window.show_all()


if __name__ == "__main__":
       duck()
       gtk.main()


Friday, October 19, 2007

Ubuntu gets Gutsy

Screen Shots
http://www.ubuntu.com/products/whatisubuntu/screenshots-710

Review
http://www.wired.com/software/softwarereviews/news/2007/10/ubuntu_gutsy

Tour
http://www.ubuntu.com/getubuntu/releasenotes/710tour

This Release by defaults enables Compiz Fusion 3D Effects :- Visual Appeal unmatched in any other OS, and has also refined its image as an OS for the average joe by including features such as easy installation of flash plugin. Installing Software is made much easier than Windows or OSX by the Synaptic package management tool which lists thousands of software and installation of any is only a few clicks away..

Thursday, October 04, 2007

NO TO TERRORISM! DON'T TOUCH OUR MALDIVES!

Maldivian Tuxers beware, you are in for a Wahaabee Devil Scare!!!
(Normal Wahaabees can have a stable kernel! Not DIRECTED at YOU fellas)



"We don't want terrorists and terrorism in our Maldives!

Join the cyber-protest by Maldivian bloggers."

Sunday, September 23, 2007

Dhiraagu e-directory lister update.






# ____________________________________
#/ dhiraagu edirectory lister 2 nd    \
#\ version                            /
# ------------------------------------
#
import pygtk
pygtk.require("2.0")
import gtk
import urllib2
import urllib
import sgmllib
import re
import cookielib

class MyParser(sgmllib.SGMLParser):
  def __init__(self, verbose=0):
      sgmllib.SGMLParser.__init__(self, verbose)
      self.numbers = []
      self.bumbers = []
      self.inside_td_element = 0
      self.inside_tdno_element = 0
      self
  def parse(self, data):
      self.feed(data)
      self.close()

  def start_td(self, attributes):
      if attributes == []:
          self.inside_td_element = 1
      else:
          self.inside_tdno_element = 1

  def end_td(self):
      self.inside_td_element = 0
      self.inside_tdno_element = 0

  def handle_data(self, data):
      if self.inside_td_element == 1:
          self.numbers.append(data)
      if self.inside_tdno_element == 1:
          self.bumbers.append(data)

  def get_numbers(self):
      return self.numbers

  def get_bumbers(self):
      return self.bumbers



class duck:
  def clicky(self, widget, textbuffer, entry, next=None,first = None):

      urlobj = None
      urlobjdata = ""
      cmpobjres = None
      cmpobj = None

      if first != None:
              urlobj = urllib2.urlopen('http://www.dhivehinet.net.mv/index.php', urllib.urlencode({'action':'edir', 'query':entry.get_text(), 'searchtype':'number'}))
              for i in range(0,len(self.button)):
                      self.button[i].destroy()
              self.button=[]

      else:

              self.cj.load('/tmp/edircookie')
              urlobj = urllib2.urlopen('http://www.dhivehinet.net.mv/index.php', urllib.urlencode({'action':'edir','page':next}))

      self.cj.save('/tmp/edircookie')

      urlobjdata = urlobj.read()
      if (int(self.nextpage) == int(next)) or ( first != None ):
              cmpobj = re.compile(r'<a id=\"nextPage\" href=\".+?page=([0-9]{1,})\"', re.DOTALL)
              cmpobjres = cmpobj.search(urlobjdata)

              if cmpobjres is not None:
                      print "sssssssssssss"
                      self.nextpage = cmpobjres.group(1)
                      self.button.append(gtk.Button(self.nextpage))
                      buttonindex = int(self.nextpage)
                      print buttonindex
                      self.hbox.pack_start(self.button[buttonindex-1],True,True,0)
                      self.button[buttonindex-1].connect("clicked",self.clicky,textbuffer, entry, buttonindex )
                      self.button[buttonindex-1].show()

      diParser = MyParser()
      cmpobj = re.compile(r"id=\"edir\".+?table>", re.DOTALL)
      feeddata = cmpobj.search(urlobjdata).group()
      diParser.feed(feeddata)
      asw = diParser.get_numbers()
      asd = diParser.get_bumbers()
      prrr = ''
      for i, j in zip(asw, asd):
          prrr = prrr + "\n" + j.ljust(12,' ') + i.ljust(20, ' ')
      textbuffer.set_text(prrr)

  def closethingy(self, widget, event, data=None):
      gtk.main_quit()
  def __init__(self):
      self.button = []
      self.cj = cookielib.LWPCookieJar()
      opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cj))
      urllib2.install_opener(opener)
      self.nextpage=0
      self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
      self.window.set_title("Dhiraagu edirectory lister")
      self.window.connect("delete_event", self.closethingy)
      self.vbox = gtk.VBox(False, 0)
      self.hbox = gtk.HBox(True,0)
      entry = gtk.Entry(50)
      self.vbox.pack_start(entry, False, False, 0)
      button = gtk.Button("Get List")
      textview = gtk.TextView()
      textbuffer = textview.get_buffer()
      button.connect("clicked", self.clicky, textbuffer, entry,0,"yes")
      scrolledwindow = gtk.ScrolledWindow()
      scrolledwindow.set_policy(gtk.POLICY_ALWAYS,gtk.POLICY_ALWAYS)
      scrolledwindow.add_with_viewport(textview)
      self.vbox.pack_start(button, False, False, 0)
      self.vbox.pack_start(scrolledwindow, True, True, 10)
      self.vbox.pack_start(self.hbox,False,False,0)
      self.window.add(self.vbox)
      self.window.set_border_width(3)
      self.window.resize(700, 500)
      self.window.show_all()


if __name__ == "__main__":
  duck()
  gtk.main()



Saturday, September 22, 2007

pclinface




#!/bin/bash
username="your_email"
password="password"

if [[ ( $# -gt 1 ) && ( ( "$1" = "wall" ) || ( "$1" = "cmd" ) ) ]]
then
wget -O /tmp/pclinfacelogin --user-agent="Mozilla/MozVer (Platform; Security; SubPlatform; Language; rv:Revision[; Extension]*) Gecko/GeckVer [Product/ProdVer]" --save-cookies=/tmp/pclinfacecookies --load-cookies=/tmp/pclinfacecookies --keep-session-cookies --post-data="email=${username}&pass=${password}" https://login.facebook.com/login.php

case "$1" in
"wall")
shift
wget -O /tmp/pclinfacewall --user-agent="Mozilla/MozVer (Platform; Security; SubPlatform; Language; rv:Revision[; Extension]*) Gecko/GeckVer [Product/ProdVer]" --save-cookies=/tmp/pclinfacecookies --load-cookies=/tmp/pclinfacecookies --keep-session-cookies --post-data="post_form_id=4bef82826c71b2d394d9013e43628399&id=4951817788&wall_text=${@}" http://www.facebook.com/wallpost.php;;

"cmd")
shift
wget -O /tmp/pclinfacecmd --user-agent="Mozilla/MozVer (Platform; Security; SubPlatform; Language; rv:Revision[; Extension]*) Gecko/GeckVer [Product/ProdVer]" --save-cookies=/tmp/pclinfacecookies --load-cookies=/tmp/pclinfacecookies --keep-session-cookies --post-data="post_form_id=4bef82826c71b2d394d9013e43628399&body=${@}" "http://www.facebook.com/edittopic.php?&action=4&uid=4951817788&topic=3100&post=&reply_to=" ;;
*)echo "Usage: `basename $0` wall|cmd data";;
esac
else
echo "Usage: `basename $0` wall|cmd data"
shift
echo "$@"
fi

Wednesday, August 29, 2007

Richard Stallman



President of Free Software Foundation.

Monday, August 13, 2007

Why learn Regular Expressions

Scenareo:A friend has been given the task by his office, to find the no of eligible voters for each of the islands. The data is in pdf files, with different files having different structures. There are headings, numbers, text in between lines etc. He had an idea of importing the files to excel and calculating the no of rows.But the headings and notes in between lines meant that there's a lot of deleting to do..Imagine doing that for an Island like Hithadhoo with over 9000 records. Instead of wasting time doing redundant work we can always make use of regular expressions.
Heres a quick script to do that.

#!/bin/bash
for i in *
do
pdftotext -layout -nopgbrk $i out
sed -r -f sedfile out > ${i}out
done

sedfile

/^[ ]{7}[A-Za-z]+$/d
/^[A-Za-z]+.*$/d
/^.*[A-Za-z]+[0-9]+.*$/d
/^.*Vote.*$/d
/^.*Total.*$/d
/^$/d
/^[ ]+$/d

Monday, June 11, 2007

7 Habits For Effective Text Editing

Bram Moolenaar talks about effective ways of text editing.

Friday, June 08, 2007

Ubuntu full circle magazine issue 1.

Contents:

Install Ubuntu Feisty Fawn, step by step

Howtos:
  • Linux Directory Structure
  • MythTV Intro
  • Scribus (desktop publishing) Part I
  • Add/Remove Software
  • Review: GRAMPS geneaology software
  • Interview: Deluge BitTorrent Client developer
  • News, “Top 5″, Letters, Desktops, and much moreDownload here

Wednesday, June 06, 2007

An alternative way to notify, in kopete

  1. First install X onscreen display: sudo apt-get install xosd-bin
  2. From kopete menu goto Settings>Configure Notifications
  3. Select "A contact has come online"
  4. Click "Advanced" button
  5. Deselect "show message in pop up"
  6. Select "Execute a program"
  7. Paste the following:



echo %s | sed -r 's/<qt><i>(.+)<\/i>(.+)<\/qt>/\1 \2/g' | osd_cat -f -*-arial-*-r-*-*-15-*-*-*-*-*-*-* -p bottom -A right -c yellow -s1

Tuesday, June 05, 2007

eyeOS 1.0



eyeOS is an open source web Desktop Environment.
http://demo.eyeos.org/

Tuesday, May 22, 2007

script to download pictures from fotovagu.com






#!/bin/bash

echo "Albums 1)Maldivian Girls 2)Emme Reethi Bitun.(enter 1 or 2):"
read i
#varnoof pics is the no no pics in the album
case "$i" in
1)varnoofpics=4777;varalbum=1;;
2)varnoofpics=530;varalbum=2;;
*)exit
esac
echo -n "Enter username:"
read varusername
echo -n "password:"
read varpassword
wget --save-cookies=fotovagucookies --keep-session-cookies --post-data="username=${varusername}&password=${varpassword}&remember_me=checked&submitted=Login" -O pimpim http://www.fotovagu.com/gallery/login.php

varerror=`cat pimpim |grep -o "Couldn't log in"`
if [ "$varerror" == "Couldn't log in" ]
then
echo "Invalid username/password"
exit
else
echo "Username and Password accepted..continuing"
fi

wget --load-cookies=fotovagucookies --keep-session-cookies -O pimpim http://www.fotovagu.com/gallery/index.php

j=0



while (( $j<$varnoofpics ))
do


wget --load-cookies=fotovagucookies --keep-session-cookies -O pimpim "http://www.fotovagu.com/gallery/displayimage.php?album=${varalbum}&pos=${j}"

varpic=( `cat pimpim|grep -oE "albums\/userpics\/[0-9]+\/[A-Za-z0-9_-]+\.jpg"|grep -v thumb` )

wget --load-cookies=fotovagucookies --keep-session-cookies http://www.fotovagu.com/gallery/${varpic}

(( j++ ))

done

Monday, May 21, 2007

Metisse Window Manager

Metisse is a window manager developped by the In Situ project. Available under the GPL Licence and in exclusivity for Mandriva Linux, Metisse differs from a classic 3D desktop ("the cube") in the way that it offers innovative windows interactions, thus enforcing work efficiency

videos

Thursday, May 03, 2007

Skype Communications

NETGEAR’s Skype devices enable consumers to make unlimited free domestic and international calls to other Skype users over a wireless network without being tied to a computer. The WiFi phone will work anywhere in the world a user has a secured or open access to a WiFi network — in any home, office, public hot spot, or municipal wireless access point that does not require browser-based authentication.

read more about this here

Saturday, April 28, 2007

Free Ubuntu Magazine

"Full Circle is an e-magazine run by the Ubuntu community that covers the world of Ubuntu, open source, and technology.
Full Circle is community written and community run, so please consider contributing an article to the magazine."

The #0 edition of the magazine is available for download here.

This issue contains history of Ubuntu releases ( Warty Warthog, Hoary Hedgehog, Breezy Badger, Dapper Drake, Edgy Eft ) and Ubuntu Feisty Fawn’s new features.

The highlighted features of the current release 'Feisty Fawn' are Migration assistant, Easy codec/restricted drivers installation, Desktop effects, Easier connections to wireless networks and support for the new Intel Mac.

The next release is to be called "Gutsy Gibbon", which will include default graphical desktop effects, unattended installation, and Linspire's Click'N'Run options (GUI-based means of installing free and proprietary software.Commercial proprietary software is also available at discount rates).

Thursday, April 26, 2007

Nautilus script to set an image as desktop background



Download nautilus-script archive
The location of nautilus scripts is ~/.gnome2/nautilus-scripts

#!/bin/bash
cwd=`echo "$NAUTILUS_SCRIPT_SELECTED_URIS"|grep -oE '[/][^//].+'|sed 's/%20/ /g'`
gconftool-2 -t "str" --set /desktop/gnome/background/picture_filename "$cwd"



Wednesday, April 25, 2007

Top Ten Linux Distributions

The following link will give an unbiased attempt to list the most widely-used distributions available today, complete with brief overviews of their history, purpose, pros and cons, available editions, and possible alternatives. The page should serve as a good starting point to those computer users looking to switch to an open source operating system or trying to find their ideal distribution.

http://distrowatch.com/dwres.php?resource=major

For new users I recommend (In order)

  1. Ubuntu ( The most popular GNU/Linux Distribution )
  2. Freespire
  3. PCLinuxOS
  4. KNOPPIX ( Best Live CD )
  5. openSUSE
  6. CentOS ( for RedHat fans )


Summary of the article:

Ubuntu

  • Pros: Fixed release cycle and support period; novice-friendly; wealth of documentation, both official and user-contributed
  • Cons: Some of Ubuntu's own software (e.g. Launchpad, Rosetta) are proprietary; lacks compatibility with Debian
  • Software package management: Advanced Package Tool (APT) using DEB packages
  • Available editions: Ubuntu, Kubuntu, Edubuntu and Xubuntu for 32-bit (i386) and 64-bit (x86_64) processors; Ubuntu Server edition also for SPARC processors
openSUSE
  • Pros: Fixed release cycle and support period; novice-friendly; wealth of documentation, both official and user-contributed
  • Cons: Some of Ubuntu's own software (e.g. Launchpad, Rosetta) are proprietary; lacks compatibility with Debian
  • Software package management: Advanced Package Tool (APT) using DEB packages
  • Available editions: Ubuntu, Kubuntu, Edubuntu and Xubuntu for 32-bit (i386) and 64-bit (x86_64) processors; Ubuntu Server edition also for SPARC processors
fedora
  • Pros: Highly innovative; large number of supported packages; strict adherence to the Free Software philosophy
  • Cons: Less community-oriented than other major distributions; its priorities tend to lean towards enterprise features, rather than desktop usability
  • Software package management: YUM graphical and command line utility using RPM packages
  • Available editions: Fedora for 32-bit (i386), 64-bit (x86_64) and PowerPC (ppc) processors; Red Hat Enterprise Linux for i386, IA64, PowerPC, s390x and x86_64 architectures; also live CD and live DVD editions
  • Suggested Fedora-based alternatives: BLAG Linux And GNU (desktop, free software), Berry Linux (live CD), Yellow Dog Linux (Apple's PowerPC-based systems)
  • Suggested Red Hat-based alternatives: CentOS, Scientific Linux, StartCom Enterprise Linux, Lineox
Debian
  • Pros: Very stable; remarkable quality control; includes over 20,000 software packages; supports more processor architectures than any other Linux distribution
  • Cons: Conservative - due to its support for many processor architectures, newest technologies are not always included; slow release cycle (one stable release every 1 - 3 years); discussions on developer mailing lists and blogs can be uncultured at times
  • Software package management: Advanced Package Tool (APT) using DEB packages
  • Available editions: Installation CD/DVD and live CD images for 11 processor architectures, including all 32-bit and 64-bit processors from Intel, AMD, Power and others
  • Suggested Debian-based alternatives: Ubuntu, Damn Small Linux, KNOPPIX, sidux, Dreamlinux, Elive, Xandros, 64 Studio
Mandriva

  • Pros: Beginner-friendly, especially the commercial editions; excellent central configuration utility; very good out-of-the-box support for dozens of languages; installable live CD
  • Cons: The company's customer service has developed bad reputation over the years; complex, confusing web site infrastructure; dropping popularity due to its commercial nature and unpopular corporate decisions in the past
  • Software package management: URPMI with Rpmdrake (a graphical front-end for URPMI) using RPM packages. "SMART" available as an alternative method
  • Available editions: Freely downloadable Mandriva Free and One editions for 32-bit (i386) and 64-bit (x86_64) processors; commercial Mandriva Discovery, PowerPack and PowerPack Plus editions for 32-bit (i386) and 64-bit (x86_64); also high-end "Corporate" solutions for desktops, servers and firewalls, all with long-term support options
PCLinuxOS
  • Pros: Out-of-the-box support for graphics drivers, browser plugins and media codecs; fast boot times; up-to-date software
  • Cons: No 64-bit edition offered; no out-of-the-box support for non-English languages; lacks release planning
  • Software package management: Advanced Package Tool (APT) using RPM packages
  • Available editions: MiniMe, Junior and BigDaddy editions for 32-bit (i586) processor architectures
MEPIS
  • Pros: Beginner-friendly; excellent hardware auto-detection and support; intuitive, installable live CD
  • Cons: Software in its repositories not always up-to-date, lacks development roadmap
  • Software package management: Advanced Package Tool (APT) using DEB packages
  • Available editions: SimplyMEPIS for 32-bit (i386) and 64-bit (x86_64) processors
KNOPPIX
  • Pros: Unparalleled hardware auto-detection and auto-configuration; portable operating system that can be used for rescue, demonstration and testing tasks; provides a hard-disk installation script
  • Cons: Recent releases somewhat buggy; lack of polish and unification of menus across the different desktop environments; slow when run from DVD
  • Software package management: Advanced Package Tool (APT) using DEB packages
  • Available editions: Live CD and Live DVD editions for 32-bit (i386) processors
  • Suggested Debian/KNOPPIX-based alternatives: Damn Small Linux, sidux, Xandros Desktop, Elive, Dreamlinux, Parsix GNU/Linux, grml
Slackware
  • Pros: Highly stable, clean and bug-free, strong adherence to UNIX principles.
  • Cons: Limited number of officially supported applications; conservative in terms of base package selection; complex upgrade procedure; no official 64-bit edition
  • Software package management: "pkgtools" using TGZ (TAR.GZ) packages
  • Available editions: Installation CDs and DVD for 32-bit (i486) processors
gentoo
  • Pros: Excellent software management infrastructure, unparalleled customisation and tweaking options, superb online documentation
  • Cons: Occasional instability and risk of breakdown, the project suffers from lack of directions and frequent infighting between its developers
  • Software package management: "Portage" using source (SRC) packages
  • Available editions: Minimal installation CD and live CD (with GNOME) for Alpha, AMD64, HPPA, IA64, MIPS, PPC, SPARC and x86 processors; also "stages" for manual installation from command line
  • Suggested Gentoo-based alternatives: SabayonLinux (desktop live CD/DVD), VLOS (desktop), Ututo (desktop, free software only)
  • Other source-based distributions: Lunar Linux, Source Mage GNU/Linux, Sorcerer, Linux From Scratch

Friday, April 20, 2007

Overwhelming Demand For Ubuntu Linux 7.04 "Feisty Fawn"

The latest version of Ubuntu Linux, which has just been released, has been downloaded so heavily that requests have backed up on Canonical's download site and its 160 mirrors. Ubuntu now includes Sun Microsystems' Java Platform, Standard Edition (JDK 6) along with a Java database system, the GlassFish Enterprise Edition 5 implementation, and the development environment NetBeans version 5.5.
read more of this story