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

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 ...