sed, awk (gawk), and Perl
As a programmer, I like the Unix commands “find” and “grep”. They are too good. “find” to find the files recursively based on file name, file type, etc, then execute command towards the files.
“grep” is even more better, when I want to find some words in the source code, and I can use regular expression. Combine “grep” with “sed”, one can perform search and replace.
However, when I want to search and replace for multiple patterns, “sed” will be difficult to be used. One can write a shell script to perform the task. But “awk” (or GNU awk) will be a better solution for me. Write an awk script, can search and replace easier, and awk script allows to use variables.
Chromium is really good in netbook
Compare to the Firefox, I prefer to run Chromium in my netbook. This is because the screen of the netbook is small, and the resolution is low. Using Firefox, the toolbars and file menu already occupies half of the screen. I think Firefox 4.0 will solve my problem.
Then, using Firefox on the netbook with Ubuntu, playing Castle Age will make Firefox slow down. May be the reason is the netbook memory is smaller than normal laptop.
Huawei E1552 on Ubuntu
I was using Huawei E220, a very old USB Modem. Yet, running on Ubuntu does not have any problem.
Then I tried the new Huawei E1552 on Windows. Nicer interface. Newer is better. But when I tried it on Ubuntu, yes, Huawei Mobile Partner icon is on the desktop. Can open it. But I cannot connect to internet.
So, in order to solve this problem, I tried to search from Internet. Right, I need USB_ModeSwitch to solve this problem. Reading the page, you will find a lot of steps need to follow.
Regular expression, find and replace using Unix tools
I need to add some text to a lot of text files. Previously, I used jEdit to perform regular expression for several files. But currently, I need to add the text for about 120 files. In order to do this, I tried using Unix tools, “sed”, “grep”, and “xargs”.
Firstly, I tried MSYS, yet it fails. Because the “sed” version was too old. Then, I used Cygwin.
My problem was to add the following text to the text files:
MinGW and Cygwin
I am a software developer. I like cross-platform development. And I prefer lower level programming language like C. My OS is Windows. Thus, I normally use Visual Studio Express Edition to compile the source code. But using Microsoft Visual C++ compiler is not a good idea for cross-platform development, because it highly depending on the Microsoft platform. Besides that, it doesn’t have C99 standard.
So, the best cross-platform C and C++ compiler is GCC (GNU Compiler Collection). However, it is used in Unix-like OS. Yet, there are two projects porting GCC to Windows: MinGW and Cygwin. These two projects provide us GCC to compile cross-platform source code such as libjpeg, libpng, zlib, etc. This indicates that, we can also write our own cross-platform source code and compiled by using GCC in Windows and other Unix-like OSes.
Success booting PC-BSD through USB flash drive
Hahaha. When I wrote my previous post, I found that I possibly made a mistake when copying the IMG image to USB pendrive. Yes, I used “dd” incorrectly because I didn’t know how to use it exactly.
This was how I used “dd” in Linux:
dd if=PC-BSD-7.1.1-x86.img of=/dev/sdb1 bs=1024
Now, the problem was the “/dev/sdb1”. We should use “/dev/sdb” instead of “/dev/sdb1”. This is because “sdb1” indicates the partition, yet “sdb” indicates the drive. And I should copy (dd) the whole file system and data of IMG to the drive, not to the partition. That was why, after I used the statement above, I still found that my pendrive was in FAT32 format.
Difficulties for installing PC-BSD
I like Unix philosophy. I like open source. I want to install PC-BSD to my netbook, but finally I realised that I failed to do so. I have tried several ways, then I give up now.
Actually, I preferred to install FreeBSD. But FreeBSD is targeted for server, so I choose PC-BSD. And PC-BSD has GUI installation, which makes everything easier (I tried it on VMware). So, I downloaded DVD ISO image. Then, I tried to use UNetbootin, since the site mentioned that it supports to create LiveUSB for FreeBSD 6.3 and 7.0. I assumed that it can also support for PC-BSD which is based on FreeBSD. However, I failed.
gparted from Parted Magic
The story continues from my previous post.
I used Parted Magic to perform the partition tasks. However, I found that Kingston DataTraveler 2.0 USB Device cannot boot as LiveUSB. It cannot find pmagic-4.5.sqfs. And even Parted Magic 4.8, there is something like dev_list cannot be found. But, there is no problem for Kingston DT 101 II USB Device. Weird!
Okay, after I delete E: F: and resize D: to occupy the space. But in Windows, I found that the D: properties show that the space is still the same. But in Disk Management utility, the space is already used for D:. I tried CHKDSK, the problem still there. Then I remember a phrase from a movie:
GRUB problem
Playing around my HP Mini Netbook with different OSes really troublesome.
Today, I am trying to install PC-BSD on my netbook. But before I install PC-BSD, I need to make some space for it. And according what I read,
Be aware that BSD operating systems, and hence PC-BSD, only recognise primary partitions and consider any logical partitions as a whole primary partition. Trying to install on a logical partition will convert your extended partition into a primary partition and erase all logical partitions of your system. PC-BSD can be installed on any primary partition; it doesn’t necessarily have to be on the first one. [PC-BSD guide]
Ubuntu Netbook Remix USB detection
As a newbie to Linux, using Ubuntu Netbook Remix gave me some trouble. Because I found that, when I plug in the USB pendrive, there is no response. So I cannot mount it manually, and there is no information in /dev drive.
Search for a long time for the solution, study a lot, read the forum. I found some solution like “udev”. However, I already installed udev, but there is no detection found. Finally I join Ubuntu IRC to ask for information, but there is no solution yet.