Tuesday, February 9, 2010

Prayer Clock

Written by using C and C++, depends on GTK+ and Expat. I spent about 3 days to study GTK+ and Expat since never used them before. I wrote this application because sometimes, I want to say a prayer, especially Angelus. But I need the prayer to read and also a reminder. So, I decided to wrote this program, at the same time I can also learn about GTK+ and Expat. And I decided to open source it as a contribution to Catholics.

I upload it with the source code included. Click here to download. There is a lot of improvements can be added.

After running the program, minimise it. Then at 6:00 am, 12:00 am, and 6:00 pm, the window will pop-up with Angelus. At 3:00 pm, 3 o'clock prayer to the Divine Mercy will pop-up.


Bookmark and Share

Sunday, February 7, 2010

USB flash drive partition on Linux

Previously on booting PC-BSD through USB flash drive, I mentioned that I used Linux to perform "dd" operation towards the pendrive.

Yesterday, I just found that, my 8G pendrive now only 2G. There are 6G storage missing. I used Windows' Disk Management Utility to check, then I found that there were two partitions in USB pendrive. And we know that, we cannot perform partitioning in Windows platform. Try to search from Internet about some information for partitioning USB pendrive, but none of them works.

So, go back to Linux, the most possible solution. Then using "fdisk /dev/sdb" (because my USB pendrive is /dev/sdb), delete the partition, make new partition. Then using "mkfs.vfat /dev/sdb1". Yes, format my USB pendrive to FAT32 with 8G storage and only 1 primary partition. How great it is?


Bookmark and Share

Saturday, February 6, 2010

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.

However, there are limitations and advantages for both projects. Cygwin is more powerful to develop the cross-platform applications. This is because Cygwin provides a POSIX layer on Windows. Therefore, it is able to compile the source code which depends on X11, pthreads, etc. As a result, we can use Cygwin to compile some of the libraries that Visual C++ cannot compile.

On the other hand, MinGW is highly depends on Win32 API. Therefore, MinGW cannot compile the source code depends on X11. And because of this limitation, several cross-platform libraries downloaded from Internet are difficult to be compiled under MinGW.

Therefore, Cygwin can be considered better than MinGW in the sense of software development. However, there is licensing issue about Cygwin. Using Cygwin to develop an application will link against cygwin1.dll. And, this cygwin1.dll is released under GPL license. Consequently, the applications or libraries linking against cygwin1.dll will be affected by GPL license. Cygwin licensing terms mention:
In accordance with section 10 of the GPL, Red Hat permits programs whose sources are distributed under a license that complies with the Open Source Definition [See http://www.opensource.org/docs/osd/  for the precise Open Source Definition and a list of the licenses certified by OSI as conforming to that definition] to be linked with libcygwin.a/cygwin1.dll without libcygwin.a/cygwin1.dll itself causing the resulting program to be covered by the GNU GPL. [Cygwin API Licensing Terms]
As a result, the applications and libraries need not be GPLed, but must be open source and conform to Open Source Definition. MinGW which doesn't depend on cygwin1.dll allows permissive license. That means, if we develop an application using MinGW, we can commercialise the application and make the application close source. Therefore, in the sense of commercialisation, MinGW is more suitable to be used.

Actually, Cygwin has a feature allows us to build the application without linking against cygwin1.dll. We can do this by using "-mno-cygwin" during the linking of the objects and libraries. This is because Cygwin provides MinGW runtime libraries. That means we can use Cygwin as it is MinGW, but giving up the POSIX related functions.

Because of the licensing term, I am very confused. And I also emailed and asked for the information about the Cygwin licensing terms. But nobody can a definitive answer. Since Cygwin license allows linking to cygwin1.dll with the Open Source Definition, that means if library A is zlib/libpng license, it will not be GPLed. Then, the question is, if another library, B, linked against library A, which is zlib/libpng, yet A linked against cygwin1.dll, could we commercialise the library B without open source?

Still very doubtful.

Bookmark and Share

Friday, January 29, 2010

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.

So, just now I tried the following statement:

dd if=PC-BSD-7.1.1-x86.img of=/dev/sdb bs=1024

Then, I successfully booting PC-BSD. Besides that, the file system from "fdisk -l" shows that the drive is in FreeBSD format. So, I realised that, the booting of an OS also depends on the file system. If I set the boot sector correctly, and the boot loader also set correctly, but the file system is different, then the booting will fail.

That is why, syslinux targets on FAT32 and isolinux targets on ISO filesystem. Though Linux kernel for the booting is already in the drive, but file system is different will cause the booting failed. So, syslinux project is targeted to solve the file system problem for booting the OS.

After I successfully booting in PC-BSD. But I decided not to install it. Because the screen resolution is too big for my netbook. @_@

Note: Remember backup USB pendrive data before "dd", cause data will be removed.

Bookmark and Share

Thursday, January 28, 2010

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.

I found that UNetbootin uses syslinux. It is used for creating LiveUSB for Linux. Syslinux project also includes isolinux for creating LiveCD for Linux. So, I finally realised the reason why there is two different applications, syslinux and isolinux. This is because isolinux is for ISO image and it has its own file system, yet syslinux is for FAT file system. That is why I failed to use UNetbootin to boot PC-BSD in pendrive.

Then, I assumed that syslinux is for Linux installation. So, I tried to use "dd" command as following the instruction from PC-BSD Users Handbook:
To write the USB ISO file to a Flash Card or USB pen drive you can do this with the Unix command 'dd':
dd if= of=/dev/da0 bs=1m
Just substitute da0 with the device name of your USB stick.
Since the instruction mention the ISO file, I tried to use the ISO image I downloaded. But I still failed to boot into the PC-BSD in pendrive. Then, I assumed that ISO file system for the pendrive which is formatted as FAT32 (if I am wrong, please tell me, because I am a newbie in FreeBSD and Linux).

Next, I think the possible solution is to use the IMG image provided from the site. Downloaded, "dd", and I still failed. So, I give up now. And continue using Linux.

(I think may be I used "dd" for the "of" argument incorrectly, I will try out again tomorrow.)

I personally still have an idea to boot the PC-BSD through USB pendrive using syslinux. But I didn't tried out. Since it is possible to boot the USB pendrive with syslinux, and it is possible to boot FreeBSD through GRUB (or GAG, or LILO). So, if it is possible to use syslinux to boot to GRUB as a boot manager, then from GRUB to boot into PC-BSD, then installation is possible.

So, the conclusion based on my experience is:
PC-BSD is still not yet matured enough for LiveUSB installation and netbook. Unlike Linux distributions, there are several Linux distributions targeted on netbook, which allow users to install easily.

Note: Remember backup USB pendrive data before "dd", cause data will be removed.

Bookmark and Share

Wednesday, January 27, 2010

Regular expression search and replace of jEdit and Notepad++

I just found that there are some differences for the regular expression in search and replace for both jEdit and Notepad++. Both of them are great text editors. jEdit requires Java Runtime Environment. Notepad++ is based on Scintilla, so Notepad++ regular expression is based on Scintilla.

So, what are the differences I found? Notepad++ regular expression for search and replace, we can use \1, \2, \3 to \9 syntax. For jEdit regular expression, it uses $1, $2, $3 to $9 syntax.

Next, Notepad++ regular expression does not support alternation operator, "|", but jEdit support. So, I prefer jEdit to do the regular expression.


Bookmark and Share

The online accounts we should sign up

The world is evolving. Internet already becomes a need for everyone just like electricity and mobile phone service. There are a lot of freeware, open source applications, online services, even free OSes. Internet connects everyone of us with our friends despise the geographical differences.

So, what online accounts we should sign up? Popularity is the most essential factor. And also based on your area. Because some services are popular in one country but not the others. The list below is only based on my opinion:

Email account - GMail, Yahoo! Mail, Windows Live Hotmail. Sign up these webmail services not only allows us to use email service, but also other services depend on the corporation provides. For example, Windows Live also provides Skydrive service for us to upload and share our files. Google provides Picasa Web Albums for us to share the photos.
The most prominent email service is GMail, which provides IMAP and POP3. And IMAP is integrated with Mozilla Thunderbird. Great!

Social networking service - Facebook, Twitter. Connect you with your friends. They are very very popular.

Blogging - Blogger, WordPress.

Photo sharing - Flickr.

Other services:
Xmarks - Synchronise our bookmarks.




Bookmark and Share