Monday, December 24, 2007

Login as root in Ubuntu

It's been believed that root is not available in ubuntu,and sudo is only way to get the authority.But this is not exactly right. I accidently found out the way to get a #
sudo su
Check it out!

Wednesday, December 19, 2007

Editing PDF file in Ubuntu Linux

There are several ways available to edit pdf on Ubuntu linux. I've found two direct tool for editing pdf: flpsed and pdfedit ,there are debs for both of them on the internet. The second way is to open pdf file with GIMP and add things into it page by page.Save the pages each and combine them to one pdf file again.

Ubuntu Installation On Gateway T1616

For convenience,I installed i386 edition instead of 64bit.Which happened 1 mouth ago.But for Gateway T1616, there were two main problem after the basic installation: 1

Wireless doesn't work

Here's the result of lspci for wireless :

08:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E PCI Express Fast Ethernet controller (rev 01)
The way to make it work should be:

1 Install ndiswrapper :

sudo apt-get install ndiswrapper
2 Download the driver of wireless card for Windows

for Gateway,we need the driver rtl8187b Downloaded. And use ndiswrapper to install the driver: ndiswrapper -i xxx.inf Load ndiswrapper by sudo modprobe ndiswrapper

VERY IMPORTANT: If you have a Vista on the laptop,the wireless will simply NOT work,I don't know why,but after my OpenSUSE accidentally disabled the Vista,which came with Gateway T1616,the wireless magically started to work! Update: This method works not very well, if this is true for you, you may want to try the Native Driver for RTL8187B 2

Sound Card Doesn't work

The solution turned out to be very simple:install the package alsa-tools
sudo apt-get install alsa-tools
Then make sure that every thing displayed in alsamixer is NOT muted.
alsamixer
Use key left and right to switch between different column,us key m to voice the muted ones\ After these two things, Gateway T1616 basicly functioned completely.Except that the mic and web camera is still not working. I'll working on it~~

Friday, December 14, 2007

Recalled a little bit C

It took me almost an hour to code the messy thing in C,which wouldn't take me more than 5 minutes to achieve 1 year ago. Its basic job is to output all the possible combinations of 5 input characters, including those have less than 5 characters. I used DFS to transverse the answer tree, and output the recorded path every time it arrived a leaf.Meantime,there's a variable to control the depth of the search increases so that we get all the combinations made up from 1 to 5 characters. Here it is~
//out put all the combinations of 5 input characters,less than 5 included #include<stdio.h> void try(int); //DFS function int used[5]; //to record if one charater is used char result[6]; char letters[5]; int depth; //to limit the depth of the search int main (void) { int i,j; for (i=0;i<5;i++) scanf("%c",&letters[i]); for (depth=1;depth<=5;depth++){ for (j=0;j<5;j++) used[j]=result[j]=0; try(0); } return 0; } void try(int lim) { int i; if (lim == depth) { //reach the leaf,time to output for (i=0;i<depth;i++) printf("%c%s",result[i],(i==(depth-1))?"\n":""); return; } for (i=0;i<5;i++) { if(!used[i]){ //pick an unused character used[i]=1; result[lim]=letters[i]; try(lim+1); //go deeper used[i]=0; //set back the usage state back } } }

Tuesday, December 11, 2007

The way to implement buttons with CSS and list in HTML

Here is a way to display list with links looks like buttons in HTML.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>This is a damn test</title> <style type="text/css"> li { display: inline; } a { float:left; width:8em; background-color:navy; text-align:center; margin:0 2px 0 2px; color:white; } a:hover { background-color:green; } </style> </head> <body> <ul> <li><a href="http://danmarner.blogspot.com">one</a></li> <li><a href="http://www.xfocus.net">two</a></li> <li><a href="http://www.justlinux.com">three</a></li> </ul> </body> </html>

The method is to display the li element as inline,so that the list will be horizontal.Set the background color of a:hover differntely to make the change.

Sunday, December 9, 2007

Creating An Independent Grub Without Losing Original Linux

Inspired by this essay,I decided to rearrange the partition on my laptop so that I would be able to install new OSs and chainload them easily.But the MBR is already occupied by Ubuntu,which means that there's not a boot loader in its own partition's boot sector. It is not chainloadable! With help from justlinux.com I finally figured out the way to make the partition chainloadable and chainloaded it by a independent GRUB newly installed on its own partition. My whole Ubuntu is installed on sda3, and I assigned 300MB as sda1 for the independent GRUB.Here comes what I did: On Ubuntu 7.10:
$ sudo mount -t ext3 /dev/sda1 /media/sda1 $ sudo mkdir /media/sda1/boot $ sudo mkdir /media/sda1/boot/sda1 $ cp /boot/grub/* /media/sda1/boot/grub
make /media/boot/grub/menu.lst like this:
defaulte 0 title Ubuntu Linux root (hd0,2) chainloader +1
Reboot the system,press "c" when GRUB appears.
Grub> root (hd0,0) Grub> setup (hd0) Grub> reboot
Again,You will find that the menu becomes the new one when GRUB appears,press "c"
Grub> root (hd0,2) Grub> setup(hd0) Grub> chanloader +1 Grub> boot
This time the GRUB menu on sda3 will appear.Which means that Ubuntu is chainloaded by the independent GRUB on sda1.And we needn't do any thing next time. Next time A new Linux being installed,just make sure it won't take over MBR, and add this to menu.lst on sda1:
title Name of new OS root (hdi,j) chainloader +1
(hdi,j) stands for the partition of the new system.

Saturday, December 8, 2007

Vista Removed,Ubuntu Wireless worked!

What's the difference between secrets and mysteries? The former are boring while the latter are fun. I installed openSUSE on my laptop.For some unknown reason it disabled vista,which came with the Gateway T1616,and was the only OS on which the wireless worked(Yes,it was in good condition,typically slow,and I seldom used it). Before that,I've tried every method I can find from google to get wireless work on ubuntu,but it somehow didn't work. However,that's no longer true after Vista disappeared! Microsoft always surprise us!