2009/04/30

Screen Capture in Ubuntu

In Ubuntu, you can easily capture the full screen by press [Print Screen]or [Alt]+[Print Screen] to capture the image of an activated window.And then image processing program can be used to modify the captured image if necessary.

Windows XP in Virtual Box on Unbuntu

Some website applications are not running well in Linux platform. So that I shall have one copy of Windows XP. And the free solution is Virtual Box... [*] Host OS : Ubuntu 9.04 [*] Virtual Box 2.2.2 r46594 Download your Virtual Box from its website first. (http://www.virtualbox.org/wiki/Downloads) And then install it. [*] Guest OS : Windows XP Service Pack 2

OS Exercise - Disk Scheduler

A simple C program which implements the disk scheduling algorithm including FCFS, SSTF, SCAN, CSCAN, LOOK and CLOOK.


Please choose your disk scheduling algorithm:
1. FCFS  - First Come First Serve
2. SSTF  - Shortest Seek Time First
3. SCAN  -
4. CSCAN - Circular Scan
5. LOOK  - Scan without moving to ends
6. CLOOK - Circular Look without moving to ends
Your choice is (1~6, other input means EXIT):
1

*** MAIN MENU *************************
0. Change Disk Schedule Algorithm - FCFS
1. Print Disk Scheduling Result
2. Input Disk Request to Device Queue
3. Exit
Please enter your choice (0~3):1
Process#   Tracks#
--------------------------
Current     53
     1      98 (+ 45=  45)
     2     183 (+ 85= 130)
     3      37 (+146= 276)
     4     122 (+ 85= 361)
     5      14 (+108= 469)
     6     124 (+110= 579)
     7      65 (+ 59= 638)
     8      67 (+  2= 640)
--------------------------
Total movement: 640 tracks

*** MAIN MENU *************************
0. Change Disk Schedule Algorithm - FCFS
1. Print Disk Scheduling Result
2. Input Disk Request to Device Queue
3. Exit
Please enter your choice (0~3):3
Terminated by user

Source Codes per request

OS Exercise - Memory Allocation

Screenshot as below. It can do First/Best/Worst Fit...


Please choose your allocation algorithm:
1. First Fit
2. Best Fit
3. Worst Fit
Your choose is (1/2/3, other input means EXIT): 2

MAIN MEUN
1. Display memory usage status
2. Input memory request to request queue
3. Allocate memory to the first requestor in queue
4. Terminate process in memory
5. Exit
Please enter your choice (1-5):2

INPUT MEMORY USAGE
Input Process #, Request Memory Size: 100, 1000

MAIN MEUN
1. Display memory usage status
2. Input memory request to request queue
3. Allocate memory to the first requestor in queue
4. Terminate process in memory
5. Exit
Please enter your choice (1-5):1

MEMORY....
Start  End   Size Process#
---------------------------
0400 - 2559 (2160)  free

QUEUE....
Start  End   Size Process#
---------------------------
0000 - 0999 (1000)  100


MAIN MEUN
1. Display memory usage status
2. Input memory request to request queue
3. Allocate memory to the first requestor in queue
4. Terminate process in memory
5. Exit
Please enter your choice (1-5):3
Fit : 2

MAIN MEUN
1. Display memory usage status
2. Input memory request to request queue
3. Allocate memory to the first requestor in queue
4. Terminate process in memory
5. Exit
Please enter your choice (1-5):1

MEMORY....
Start  End   Size Process#
---------------------------
0400 - 1399 (1000)  100
1400 - 2559 (1160)  free

QUEUE....
Start  End   Size Process#
---------------------------

MAIN MEUN
1. Display memory usage status
2. Input memory request to request queue
3. Allocate memory to the first requestor in queue
4. Terminate process in memory
5. Exit
Please enter your choice (1-5):5
Terminated by user.

Source Codes per request

3 Qt Exercises After 1 Week Classess

After one week classes, we are asked to write some codes.

 1. Something like ping-pong. >> (2 buttons are used, one as ball and another as board).  



 2. A simple painter. >> Undo

 3. An address book records some basic information. >> Open/Save/Insert/Delete/Head/Prev/Next/Tail
 

 It's a pity that I don't have time to improve them at this moment. Because more other lessons are there.

2009/04/25

Qt 4.5 SDK Installation

Download the SDK from Qt website. http://get.qtsoftware.com/qtsdk/qt-sdk-linux-x86-opensource-2009.02.bin Then make the file executable by chmod u+x. Execute as root. ./qt-sdk-linux-x86-opensource-2009.02.bin Then you can find Qt Creator in /opt/qtsdk-2009.01 (default) or somewhere you specify during installation. However something may be required if someother packages are not present. sudo apt-get install build-essential sudo apt-get install libgtk2.0-dev

ubuntu 9.04 Installation from HDD

If you want to taste Ubuntu in your XP only, click the wubi.exe in the live cd. or you want a new Ubuntu in another partitiom. 1. Put the live iso in a FAT partition. 2. Extract the vmlinuz, initrid.gz from casper in iso file... 3. Install Grub4dos if you have XP only. 4. and add some words in your menu.lst as below title (090424) Install Ubuntu 9.04 root (hd0,5) kernel /vmlinuz boot=casper iso-scan/filename=/ubuntu-9.04-desktop-i386.iso initrd /initrd.gz (hd0,5) is the partition which all aboves are located. 5. Fllow the installation procedure, you will get some message that /isodevice in't able to unmount. Then you have to umount it from terminal as root with parameter -l (#umount -l /isodevice) Some error message will happen, but installation continues :) 6. After reboot, you get a whole new Ubuntu 9.04 (jaunty) with kernel 2.6.28-11.generic.

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

chanyenping@chanyenping:~$ mysql ERROR 1045 (28000): Access denied for user 'chanyenping'@'localhost' (using password: NO) chanyenping@chanyenping:~$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.0.75-0ubuntu10 (Ubuntu) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>