Computer Scientist

Tuesday, 26 June 2012

Install MySQL and Development environment in Fedora 17

The installation of MySQL in Fedora is easy and trivial task because the MySQL server package is available in official yum repository. It can be installed both by yum and GUI installer.

The most important task is to configure the MySQL into a usable basic status. Because the Fedora 16/17 introduced another system service manipulating program, "systemctl", which is recommended by Fedora 16/17 in their deployment documentations, the configuration procedure is a little different from the previous Fedora systems that use "service" and "chkconfig" commands. These old programs, however, are still accessible in Fedora 16/17. Here is an example of "systemctl" usage:

systemctl status mysqld.service

Notice that the service name is followed by a word "service".


Enabling a service to start automatically at boot time:

systemctl enable mysqld.service


Disabling a service to start at boot time:

systemctl disable mysqld.service


Checking the service status:

systemctl status mysqld.service


Running, Stoping and Restarting a service:

systemctl [start | stop | restart] mysqld.service



After the MySQL service is started and is added to the start queue at boot time, several privilege settings should be done. There are many methods to accomplish this task. I'd like to use the provided program: "mysql_secure_installation". When this step is completed, the password for root is changed, and the anonymous account and test database should be properly set as desired.


In order to access the MySQL from remote machines, do not forget to open the port 3306 for the MySQL server.

More configurations and database set up can be done by using the GUI workbench of MySQL.

Friday, 22 June 2012

Linux driver for the wifi on P8Z77-V-Deluxe

On Asus P8Z77 motherboard, a powerful wireless network card is provided. It is a dual wireless 802.11 a/b/g/n network card and is more powerful than that is provided by the pro version board, which is a single one with only one antenna without blue tooth. A fabulous set of drivers and utilities is included in the ASUS driver disk for Windows system. However, there is nothing coming with the package even a simple driver to Linux. I cannot found any thing in ASUS website, either.

It is not impossible to drive the wifi on P8Z77 in Linux. I got a box with the latest Fedora 17 32-bit installed. The kernel is 3.4.3 .

I installed a USB wireless card from Cisco Linksys AE1000 on my previous Linux box without too much difficulties. It is not hard to find some articles on the Internet to teach you to install it because the Linux driver is available to the public. The only troublesome task is to identify the correct chipset of the device, which is usually also the most basic and important task to install a device driver in Linux. The AE1000 uses the Ralink's chipset RT3572 according to a website. The Internet is a good tool to save me a lot of time and works to disassemble the network card, which would be a really massive task. Fortunately, the Ralink's official Linux driver is all over the Internet. Downloading, Unpacking and Installing will easily accomplish the task.

My sanguine about the Linux driver of the ASUS wifi go's card keeps until I saw someone's thread saying that the Deluxe version of p8z77 got a wireless network card from broadcom with very limited Linux drivers available on the Internet, especially the official Linux driver. I happened to find an official Linux version driver for broadcom chipset in the official website of the broadcom. However, for some reasons, it cannot be installed correctly because the compilation process is ending with an error message. Fortunately, I found another forum thread representing another method to install this driver.

The chip in the ASUS's board is BCM43228 according to the 'lspci' command in Linux. The only available method to drive this wireless card is to install the official Linux driver which is mentioned above. But, if the RPM fusion is installed in the system, the installation process can be accomplished by a yum installation command, which would be much more reliable. But bear in mind that, the non free repository of RPM fusion should also be installed. The name of package is 'kmod-wl'. However, it cannot be used in my case because I have upgraded my Linux kernel to 3.4.3. The kernel version of both kmod-wl and kmod-wl-PAE require some specific kernel version such as 3.4.2. So I have to use the last one 'akmod-wl', which is kernel version independent. I have successfully installed the driver of the network card by using this method.

In order to find much more information for the wireless network card with broadcom chip installation on Linux you should refer to:
http://forums.fedoraforum.org/showthread.php?t=239922
This guy maintained a very comprehensive article for broadcom chip's Linux installation.

Tuesday, 12 June 2012

How to estimate the order of magnitude of Factorial product

The Factorial of a number usually denotes a very big order of magnitude, especially for the computer world. In order to approximate the magnitude of the factorial of a number, it is necessary to find a method to represent the factorial of a number and to keep it into the computer memory. In my example, I am estimating the factorial of 200 which exceeds much more than the capability of any type of C programming language to keep it. An uniform method to represent this big number is important during the estimation. The only way to represent this gigantic big number is by using some smaller numbers that are with in the capability of a C compiler.

My method to represent a number is to use the prime numbers that is smaller that this number. The big number can be factorised into these prime number, so the big number can easily represented the some powers of these prime numbers. For example:

10! = 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10
      = 1 x 2 x 3 x ( 2 x 2 ) x 5 x ( 2 x 3 ) x 7 x ( 2 x 2 x 2 ) x ( 3 x 3 ) x ( 2 x 5 )
      = 28 x 34 x 52 x 7

In this case, the factorial of 10 can be represented by these four much smaller prime numbers: 2, 3, 5, 7 with their exponential numbers. Although it is difficult to reproduce the similar procedure for the factorial of 200 by sketching on the paper, the result of the factorial of 200 is not difficult to estimate, because the only difference of the factorial of 200 and that of 10 is the number of prime numbers involved. According to the prime number list referring to the wikipedia page, there are only 47 prime numbers smaller than 200. The factorial of 200 is easily represented by these prime numbers with their exponential numbers. The problem of finding all of the prime numbers smaller than a number is out of discussion of this thread. I will discuss it in more details in another thread.

When we've got the prime-numbers representation of the factorial number, the next task should be concerned is how to estimate its magnitude using this prime_number representation.

As the scientific representation is used to represent a big number, what we concern is the number zeros following the number if the first radix point is placed immediately after the first significant digit, for example, 1.23456 x 1020. The magnitude of this number is ten raised to power of 20. In other words, we are counting the number of zeros when we are talking about the magnitude of a number. The example mentioned above is for decimal number. As for the binary number, zero should still be the digit to be counted, but with different means.

I will give the method for decimal number magnitude estimation, firstly. In order to count the number zero which means a ten (10), we need to make a logarithm to the original number. Using the prime-number representation will make a more convenient way to calculate.

log10(10!) = log10(28 x 34 x 52 x 7)
                  = log(28) + log10(34) + log10(52) + log10(7)
                  = 8 x log10(2) + 4 x log10(3) + 2 x log10(5) + log10(7)

These much smaller prime-numbers logarithm is easily to be calculated. Then the number of zeros ( x 10) can be evaluated form this method.

As for a binary number the log2() should be used to calculate the number twos.