Download of the day: VMware Player 2

Posted on in Categories Download of the day, Linux, Linux desktop, Windows, Windows server last updated May 31, 2007

VMware Player 2 is now available!

VMware Player enables anyone to easily run, evaluate and share software distributed as a virtual appliance on a Windows or Linux PC.

Virtual appliances are pre-built, pre-configured and ready-to-run software applications packaged along with an operating system in a virtual machine. You can choose from over 450 virtual appliances available for download on the VMware Virtual Appliance Marketplace at vam.vmware.com. Simply download and run the virtual appliance with VMware Player quickly and easily – no software installation or configuration needed :)

What’s new in VMware Player 2.0

* Experimental support for 2-way Virtual SMP assigns more than a single CPU to a virtual machine.
* Share data seamlessly between the virtual machine and host computer.
* Windows Vista support as a host and guest OS.
* Support for USB 2.0 devices allow you to use high speed performance peripherals like MP3 Players within your virtual machine.
* Broad host and guest OS support includes over 60 supported 32- and 64-bit guest OS’s.
* Appliance view allows you to start a virtual appliance and review brief description and other relevant information provided by the appliance author.
* New Home Page allows you to open existing virtual appliances or browse any of the 425 virtual appliances in the VMware Virtual Appliance Marketplace.

=> Download link

Download of the day Firefox 2.0.0.4 for Linux / Windows Vista

Posted on in Categories Download of the day, Linux, Linux desktop, Mozilla, OS X, Ubuntu Linux, UNIX, Windows last updated May 31, 2007

The award-winning Web browser is better than ever. Faster, safer, and easy to use, Firefox delivers a better Web experience and has been released a new version 2.0.0.4

What’s New in Firefox 2.0.0.4

=> Security update: Various security issues have been fixed.

=> Windows Vista support – More enhancements and fixes for Windows Vista are included,

=> And much more

Download Firefox 2.0.0.4

=> Visit official website to download firefox

Related:

=> How to install firefox-2.0.tar.gz in Linux

Howto: Connect MySQL server using C program API under Linux or UNIX

Posted on in Categories C Programming, FreeBSD, Gentoo Linux, Howto, Linux, MySQL, OpenBSD, RedHat/Fedora Linux, Solaris, Suse Linux, Tips, Ubuntu Linux, UNIX last updated October 8, 2007

From my mailbag:

How do I write a C program to connect MySQL database server?

MySQL database does support C program API just like PHP or perl.

The C API code is distributed with MySQL. It is included in the mysqlclient library and allows C programs to access a database.

Many of the clients in the MySQL source distribution are written in C. If you are looking for examples that demonstrate how to use the C API, take a look at these clients. You can find these in the clients directory in the MySQL source distribution.

Requirements

Make sure you have development environment installed such as gcc, mysql development package etc. Following is the list summarize the list of packages to compile program:

  • mysql: MySQL client programs and shared library
  • mysqlclient: Backlevel MySQL shared libraries (old libs)
  • mysql-devel: Files for development of MySQL applications (a must have)
  • mysql-server: Mysql server itself
  • gcc, make and other development libs: GNU C compiler

Sample C Program

Following instructions should work on any Linux distro or UNIX computer. Here is the small program that connects to mysql server and list tables from mysql database.(download link):

/* Simple C program that connects to MySQL Database server*/
#include <mysql.h>
#include <stdio.h>

main() {
   MYSQL *conn;
   MYSQL_RES *res;
   MYSQL_ROW row;

   char *server = "localhost";
   char *user = "root";
   char *password = "PASSWORD"; /* set me first */
   char *database = "mysql";

   conn = mysql_init(NULL);

   /* Connect to database */
   if (!mysql_real_connect(conn, server,
         user, password, database, 0, NULL, 0)) {
      fprintf(stderr, "%s\n", mysql_error(conn));
      exit(1);
   }

   /* send SQL query */
   if (mysql_query(conn, "show tables")) {
      fprintf(stderr, "%s\n", mysql_error(conn));
      exit(1);
   }

   res = mysql_use_result(conn);

   /* output table name */
   printf("MySQL Tables in mysql database:\n");
   while ((row = mysql_fetch_row(res)) != NULL)
      printf("%s \n", row[0]);

   /* close connection */
   mysql_free_result(res);
   mysql_close(conn);
}

How do I compile and link program against MySQL libs?

MySQL comes with a special script called mysql_config. It provides you with useful information for compiling your MySQL client and connecting it to MySQL database server. You need to use following two options.
Pass –libs option – Libraries and options required to link with the MySQL client library.

$ mysql_config --libs
Output:

-L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto

Pass –cflags option – Compiler flags to find include files and critical compiler flags and defines used when compiling the libmysqlclient library.
$ mysql_config --cflags
Output:

-I/usr/include/mysql -g -pipe -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing

You need to pass above option to GNU C compiler i.e. gcc. So to compile above program, enter:
$ gcc -o output-file $(mysql_config --cflags) mysql-c-api.c $(mysql_config --libs)
Now execute program:
$ ./output-file
Output:

MySQL Tables in mysql database:
columns_priv 
db 
func 
help_category 
help_keyword 
help_relation 
help_topic 
host 
tables_priv 
time_zone 
time_zone_leap_second 
time_zone_name 
time_zone_transition 
time_zone_transition_type 
user 

References:

  • MySQL C API – A must read – official MySQL C API documentation

nixCraft FAQ Roundup May 29, 2007

Posted on in Categories FAQ last updated October 30, 2008

Recently updated/posted Linux and UNIX FAQ (mostly useful to Linux/UNIX new administrators or users) :

Enjoy!

What is the most efficient Linux file system for laptops?

Posted on in Categories Ask nixCraft, File system, Howto, Linux last updated May 29, 2007

There is some debate going on and the question is:

What is the most efficient Linux file system for laptops?

I think ext3 doing well but again I don’t have complete answer here.

We have some smart people around here. So please add your thoughts and suggestion in comments. If you can’t offer a complete answer it’s still helpful to get things started and point people in the right direction for more information :)

What is Nokia Maemo Linux?

Posted on in Categories Debian Linux, Linux, Linux desktop, Linux Embedded devices, Linux portables last updated May 29, 2007

From the my mailbag:

A friend of mine was talking about Maemo Linux. Can you explain what is Nokia maemo Linux?

What is Nokia Maemo Linux?

The Nokia N800 Internet tablet is a wireless Internet appliance from Nokia. The N800 was developed as the successor to the Nokia 770. It is designed for:
a] Wireless Internet browsing
b] E-mail functions
c] Includes software such as Internet radio, an RSS news reader, image viewer and media players for selected types of media.

Maemo Linux is used in Nokia N800. It is a development platform for handheld devices. You can think Maemo as a desktop for handled device. It is modified version of Debian Linux. According to project webpage:

Maemo provides an open source development platform for Nokia Internet Tablets and other Linux-based devices. It is build from components widely used in open desktop and mobile systems. We strive to make maemo open, accessible and useful to all developers wanting to squeeze the possibilities of the mobile desktop and the Internet.

The maemo SDK contains the tools needed to create and port integrated applications, replicating the Internet Tablet environment in your PC. The Hildon Application Framework is a good entry point to understand the peculiarities of this platform. A shortcut for you to consider.

This website offers official documentation, tutorials, bug reporting tools and repositories of unstable versions for testing. It also provides services devoted to and maintained by the maemo community: software catalog, project hosting, documentation wiki, Planet news plus mail and IRC support channels.

You can purchase this cool toy N800 at Amazon! I’m going to get one before XMS :D

Howto build an open source digital entertainment system using MythTV

Posted on in Categories GNU/Open source, Howto, Linux, Linux desktop, Linux portables, OS X, Ubuntu Linux, Windows, X server last updated May 28, 2007

MythTV is a GPL licensed suite of applications that, together, provide a complete home entertainment system. The system’s capabilities include television, movies, music, photography and the display of other information like weather and news. It has been developed using only open source components and works under a variety of operating systems from Linux to Mac OS X.

This TechBrief provides an introduction to the leading open source home media convergence system, Mythical TV, more commonly referred to as MythTV.

MythTV is a digital entertainment suite that is as sophisticated as any commercial system available on the market today. Part 1 serves as an introduction to MythTV and guide to install the latest development frontend and backend on Ubuntu Linux. It covers building the development branch of the project suite using the latest source. Due to the complexity and variations of hardware and software, this brief will only focus on North American service. Part 2 will focus on building and installing the complete set of official modules.