Wednesday, June 23, 2010

missing unix2dos and dos2unix in ubuntu 10.04

unix2dos and dos2unix were handy tools used to convert files' endings from/to windows and Linux.
after i installed ubuntu 10.04 then installed the tofrodos package as usual i was surprised that the two programs doesn't exist , after some searching i discovered that the programs were just given different names
so:
the unix2dos become todos
and the dos2unix become fromdos
you can adopt to this new names or give them aliases if you wish...
hope that was useful.

Saturday, June 19, 2010

git packing

while i was reading the git community book , i have noticed this paragraph in the first chapter

It is important to note that this is very different from most SCM systems that you may be familiar with. Subversion, CVS,Perforce, Mercurial and the like all use Delta Storage systems - they store the differences between one commit and the next. Git does not do this - it stores a snapshot of what all the files in your project look like in this tree structure each time you commit. This is a very important concept to understand when using Git.
actually i didn't believe that ... i thought that would make git the most space inefficient scm ever created ... although data is compressed before storing but still each new change to a file however small will make git store ALL that file Again to the repository !!!!

so to make sure of that i wrote the following script

#!/bin/bash
git init
i=0
while [ $i -lt 20 ]
do
 echo commit $i
 du -hs
 git add a > /dev/null
 git commit -m "commit $i" > /dev/null
 i=$(($i+1))
 echo $i >> a
 echo '--------------'
done

the script appends one character to the file then commits the changes , at each commit it prints the size of the repository.
during the 20 commits the size of the repository grew from 1020K to 7.1 MB !!!

off course that is not the full story , git uses something called Packing ... it stores large number of objects in the same file using delta-compression , so data is not written more than one time , still newly created objects are stored again so periodic repacking is needed to reduce the repo size.

lets try to execute git gc in our repo
it prints the following
Counting objects: 60, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (40/40), done.
Writing objects: 100% (60/60), done.
Total 60 (delta 20), reused 0 (delta 0)

and the size of the repo became 1.3 MB !!! that is just great ...
so git is really space efficient compared to others.

Tuesday, May 18, 2010

Fix matlab gui in linux

This term I had to do some work on matlab so I installed the linux version but I found something very irritating in the guide gui builder , the gui wasnt stable at all and every time I move a button or any control all the window flickers like this …

at first I thought compiz was the reason for this but it turns out that disabling compiz has no great effect.
after a lot of searching I found that the reason of the problem was Java !! … matlab didnt find the jre location therefore couldn't render the gui well,
so a the executing this simple command in your terminal solves the problem

export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre/

note : you have to replace the path on the previous command with the correct path of the jre

Friday, April 30, 2010

Ubuntu 10.04 Released

Ubuntu 10.04 LTS





it has been long since my last post but today Ubuntu 10.04 was officially released and available for download with lots and lots of new features ...the sad news is iam still using 9.04 and i dont have any time for a clean install due to study and assignments :(

which reminds me about a program that i use to manage my todo lists and i wanted to blog about but unfortunately there was no time for it either ...
Getting Things Gnome is a small program to manage todo lists and tasks

pretty list , isn't it ? :)

just found that it will be getting an integration with online services like remember the milk which is great..
any way enjoy Ubuntu :)

Sunday, February 21, 2010

Wednesday, December 9, 2009

My First Google Chrome Extension

yesterday i have uploaded my first Google chrome extension to the official extension gallery that was opened for public few days ago.
say hello to Chrome MineSweeper :D



i know that some will say that mine sweeper is not some thing that you will use every day.. and i agree to some extent with but if you really understood this game you will find it really addicting .. i remember the first time i played it i finished the advanced board in 9 min !!!! but after some time my speed increased dramatically and i finished with this scores.

  • Small Board : 6 seconds
  • Medium Board : 41 seconds
  • Large Board :  135 seconds

which aren't a world class records :) but still makes me proud :D


any way ,
hope you like the extension ...
and please don't hesitate to leave your feedbacks and/or comments here.

back to blogging

i really have to apologize for that long time without even a single post but i was really busy in my study and exams.
i have a few posts coming soon about google wave and my first google chrome extension :D before returning to the final exams :(

Friday, August 21, 2009

Happy Ramadaaan

to the few who follow this blog and to all the world....Happy Ramadaaaan

Thursday, June 25, 2009

Quine-mcCluskey Logic Simplifier

in our fundamentals of logic design course we were required to implement the Quine-mcCluskey tabular method as (a summer project) to simplify boolean function and i was able to implement it using python  so i decided to share it hope it could be useful to some one ...

here is an executabe version for windows..(made using py2exe project)


and here is the python source code files...


it is worth mentioning that the source files consists of :
tabular.py : which the main program is found and u could also execute it from the command line using arguments
gui.py : which is a graphical user interface for the program using tkinter libs
   
features:
  • able to solve Boolean function upto 26 variable (theoretically it can do more but this just a limit that i enforced to be able to represent the variables using A,B,C....Z Notations , of course u can  remove this limit)
  • displaying the prime and essential implicants ( by default the program displays the implicants on letters but u can also change this to display them in numbers )
  • perform petric brute force algorithm to get the best (lowest cost) solution
  • draw the Prime Implicant chart before finding the essential prime implicants and after finding them...
to do :
those are some ideas that may/may not be done...
  • adding column and row dominance simplifying techniques.
  • adding a documentation for tabular.py and more comments to illustrate the algorithms used.
  • adding an interactive mode to solve the problems step by step.
  • adding a karno-map simulation.
  • improving the gui....
  • adding the project to source-forge ?...may be... :)
ScreenShots:
using gui mode



using the command line ( this picture is a part of the output not all of it)



finally... i will really appreciate any feedbacks , bug reports and/or opinions.
please send them to

or here in the comments...
thanks...
           

Sunday, June 14, 2009

Shutdown after Update in ubuntu

last two weeks i was busy in my exams and ubuntu wanted to download alot of updates..that is normal but for people with low connection speed having alot of updates is not that nice...as i will have to leave the computer open for a long time and offcourse i will not be able to use the Internet as the update-manager draws all the speed..so i decided to leave it open and go some where but i found no option in ubuntu update manager to close the computer after finishing updates so i created this small python script that will shutdown the computer after finishing all the updates and here it is...


import time
import os
import getpass
password = getpass.getpass('please enter your password : ')
x = os.popen('ps -ef | grep "/usr/bin/gksu --desktop /usr/share/applications/update-manager.desktop"')
s=x.readline()
x.close()
if s.find("grep") == -1 :
 running=True
 print "updating manager is working..."

 while(running):
   x = os.popen('ps -ef | grep "/usr/bin/gksu --desktop /usr/share/applications/update-manager.desktop"')
   s=x.readline()
   x.close()
   time.sleep(10)
   print "still working..."
   if s.find("grep") != -1 :
    running=False
  
  os.popen("sudo -S shutdown -h 5", 'w').write(password)



Script usage is very simple :
just lunch the update manager and start the update process as usual then open a terminal and lunch the script (python "scriptname.py")
you will have then to write your password it is only used to call the shutdown command (i promise :D ) then you can go to sleep :D and the script will do the rest...
after finishing updates the script will give you 5 min to cancel the shutdown proccess if you have changed your mind...
hope you found this script useful

Saturday, May 9, 2009

Google Chrome Ad


While I was browsing my Google reader today I found this interesting news…

Google will start promoting their browser "chrome" through a TV ad !!!
Although I still consider Firefox my main browser for many reasons I really liked the ad idea so have a look and tell me your opinions...

5 years of kotbcorp

Two days ago this blog completed its 5th year  :). So congratulations to my self and Thanks for the few followers that have been here for ...