tigblogs

Mohamed Abdelatif - My Blog

Update online status with what you are listening



It may not seem as easy as it actually is, that's why I decided to share it.
Here it is a bash script that once executed updates pidgin's status with the name of the track running Rhythmbox music player


#!/bin/bash

while [ 1 ]
do
out=$( rhythmbox-client --no-start --print-playing)
#echo "I'm now listening to $out"
echo `/usr/bin/purple-remote "setstatus?status=available&message=Listening to $out"`
sleep 5
done

Tags:


Automatically attach Windows formatted partitions on booting Ubuntu



As the title say, I consider in this how-to attach windows formatted partitions (FAT32, NTFS ..), it would be a very close procedures to attach other formats.
  1. Step One: Determine Which partition do you want to mount automatically.
    You have to know your target partition's Linux name, which differs from partitions' labels (those names given to partitions in Windows like "Sources", "Entertainment" ..).
    • Installing a suitable Disk-Scanner is a good idea to give you good information about your disk if you don't already know, I suggest gparted
      sudo apt-get gparted
    • Once installed, run it
      sudo gparted
      to see something like:


      now determine which partition you'd like to attach, and know its name (the column at the most left with heading "Partition"), I'll assume it is [my_part]
  2. Step Two: Determine Where to attach the target partition
    Lets assume you want attach the partition in the directory [my_dir], you have to create the directory
    sudo mkdir [my_dir]
  3. Step 3: Tell Ubuntu to attach Partition[Step 1] in Directory[Step 2]
    • Open the file /etc/fstab as root
      gksudo gedit /etc/fstab
    • Add the line
      [my_part] [my_dir] vfat auto,users,uid=1000,gid=100,utf8,dmask=027,fmask=1 37 0 0
      And dont forget to
      • Replace [my_part] with your partition (got from step 1)
      • Replace [my_dir] with your directory (got from step 2)
      • Replace "vfat" (which is for FAT32 partitions) with ntfs for NTFS partitions
    • Save and close /etc/fstab
  4. Step Four: Try attaching new entries in the /etc/fstab
  5. , by typing
    sudo mount -a

Enjoy ..

Tags:


Open Command Prompt here



Opening the command prompt/shell interpreter in a specific is handy, and is very common to much many people.
I'll be talking in this post about how to do it in three different platforms.

First Windows Vista

Recently I shared an article that shows how to do it in Vista, which is not more difficult than just holding another button before hitting mouse's right one.

Second Debian based systems

It is also as simple here as installing any other program, here is a How - to which illustrate the operations.
At the end an additional option is added to the right click.

By clicking it, the terminal should be opened in the specified directory (in my case the desktop):


Third Windows XP

Operations here are a bit more tricky, I'll go in some details:
  1. Open Control Panel => Tools Menu => Folder Options => File Types Tab
  2. Select the "File folder" file type.
  3. Click the "Advanced" button.
  4. Click New (to add new action).
  5. Enter action's name, which will be some thing like "Open Command prompt here".
  6. Enter
    cmd.exe /k cd "%L"
    against the "Application used to perform action".
    Menu state should end up to something like:


  7. Press OK, OK.
Good, but it is not the end.
We need now to assure that folders behave normally, i.e. The default action of the folder file type is to be opened by windows explorer.

  1. Press Start => Run
  2. Write
    Regedt32.exe
    and hit enter.
  3. Open HKEY_CLASSES_ROOT/Directory/Shell
  4. From the Edit list choose the name (Default).
  5. Edit Menu => Modify



  6. Enter None and hit OK.


Right click any folder now and note the new action:




Tags:


The age of embedding Web-servers



The last period witnessed a "web-server-mania". Although I'll talk about running my pc as a server but this is not the reason why I say that.
About running my PC as a server it is not very sophisticated and can be done, just five systematic steps
  • Obtain static IP address.
  • Open port 80 (The port responsible for receiving HTTP requests).
    1. Adjust local firewall settings (to let HTTP requrests pass in).
    2. Do port forwarding (To open the port from the network and direct requests to the proper computer - To do it I downloaded the manual of my Router and searched for "port forwarding").
    3. Check the port is opened.
  • Install the server software on the pc; normally the word "Server" refers to two meanings the first: the Computer running as a server and the second: The software that translates clients' requests and reply by suitable responses (like what the browser does on the client side).
  • Register for a dynamic name service; that maps a certain DNS to your static IP address.
But the process even after its success is full of disadvantages, this article which summarizes the drawbacks of hosting on your own PC.


Back to the main thing that made me write this post ..
A Japanese Company called FreeBit had announced an iphone application that "server-ize" the iphone ...

 Yes once this application is installed on the iphone, all PCs can access it exactly like a web server.
Check this post for more information.

From the ability to "attach" the server on my PC to "embedding" it to a pocket device will change many concepts or at least make them more flexible and different from long age they were.


Tags:


Sample Project I



Not only because some colleagues advised me to do, but also because i found it a good idea to publish a sample project of each year and/or semester ..

I'll start by this one "Sorting simulator" was done in the second year with my partner Moustafa.

Why I'm starting with that project especially? Because it had many uniqueness properties not in many other projects.

  • It 's UI is inspired from Microsoft office 2007 ribbon.
  • It's UI is developed in SWT library and the program in Java.
  • We used the Hexapixel project.
  • We used the Nebula project (The pshelf on the left).
  • Time of working in this project was directly before the final exams by 2:3 weeks, we felt that we either won't finish the project or it would affect our exams badly, but thank God all are finished and all are over.
Project size:
  • Src directory contains 9 packages.
  • Model package contains 12 classes.
  • UI main class contains 1322 lines.





Notes about the project
  • Worth mentioning that the program can simulate as long list as the screen resolution permits it to do.
  • All actual sorting algorithms are actually finished normally without being disturbed by UI rendering instructinos. How do we simulate then? After each swap of a pair of elements, a new node is pushed to the simulation queue of this sorting type, which (the queue) is popped purely asynchronously by another thread.
  • Why we did that? To make the running time of the sorting algorithm accurate and not affected by simulation.
The source is available to anyone, just send me an email or comment demanding it.

Finally Here are you some screen-shots due to the bad quality video

  • The options panel:
  • The Results panel:

  • The input panel (ribbon oriented):
  • An overall running instance:

Update The project is now opensource.

Tags:


« previous 5

Mohamed Abdelatif's Profile

Mohamed Abdelatif's Friends


Latest Posts


Update online status...
Automatically attach...
Open Command Prompt here
The age of embedding...
Sample Project I

Monthly Archive


September 2008
October 2008
November 2008
December 2008
January 2009
February 2009
July 2009
October 2009

Change Language




Friends
Amelia Jallayu
Nivedita
Reymond Otieno Odoyo
Wiaamj
Yashoda
`Dayo Greats


2874 views
Important Disclaimer