Thursday, May 21, 2009

Virtual Filesystem: Building A Linux Filesystem From An Ordinary File

You can take a disk file, format it as an ext2, ext3, or reiser filesystem, and then mount it, just like a physical drive. It's then possible to read and write files to this newly-mounted device. You can also copy the complete filesystem, since it is just a file, to another computer. If security is an issue, read on. This article will show you how to encrypt the filesystem and mount it with ACL (Access Control Lists), which gives you rights beyond the traditional read (r), write (w), and execute (x) permissions for the three user groups "file", "owner", and "other".

This is an excellent way to investigate different filesystems without having to reformat a physical drive, which means you avoid the hassle of moving all your data. This method is quick -- very quick compared to preparing a physical device. You can then read and write files to the mounted device, but what is truly great about this technique is that you can explore different filesystems such as reiserfs, ext3, or ext2 without having to purchase an additional physical drive. Since the same file can be mounted on more than one mount point, you can investigate sync rates.

Creating a filesystem in this manner allows you to set a hard limit on the amount of space used, which, of course, will be equal to the file size. This can be an advantage if you need to move this information to other servers. Since the contents cannot grow beyond the file, you can easily keep track of how much space is being used.

First, you want to create a 20MB file by executing the following command:

      $ dd if=/dev/zero of=disk-image count=40960
40960+0 records in
40960+0 records out

You created a 20 MB file because, by default, dd uses a block size of 512 bytes. That makes the size: 40960*512=20971520.

      $ ls -l disk-image
-rw-rw-r-- 1 chirico chirico 20971520 Sep 3 14:24 disk-image

Next, to format this as an ext3 filesystem, you just execute the following command:

      $ /sbin/mkfs -t ext3 -q disk-image
mke2fs 1.32 (09-Nov-2002)
disk-image is not a block special device.
Proceed anyway? (y,n) y

You are asked whether to proceed because this is a file, and not a block device. That is OK. We will mount this as a loopback device so that this file will simulate a block device.

Next, you need to create a directory that will serve as a mount point for the loopback device.

      $ mkdir fs

You are now one step away from the last step. You just want to find out what the next available loopback device number is. Normally, loopback devices start at zero (/dev/loop0) and work their way up (/dev/loop1, /dev/loop2, ... /dev/loopn). An easy way for you to find out what loopback devices are being used is to look into /proc/mounts, since the mount command may not give you what you need.

      $ cat /proc/mounts

rootfs / rootfs rw 0 0
/dev/root / ext3 rw 0 0
/proc /proc proc rw,nodiratime 0 0
none /sys sysfs rw 0 0
/dev/sda1 /boot ext3 rw 0 0
none /dev/pts devpts rw 0 0
/proc/bus/usb /proc/bus/usb usbdevfs rw 0 0
none /dev/shm tmpfs rw 0 0

On my computer, I have no loopback devices mounted, so I'm OK to start with zero. You must do the next command as root, or with an account that has superuser privileges.

      # mount -o loop=/dev/loop0 disk-image fs

That's it. You just mounted the file as a device. Now take a look at /proc/mounts, you will see this is using /dev/loop0.

      $ cat /proc/mounts

rootfs / rootfs rw 0 0
/dev/root / ext3 rw 0 0
/proc /proc proc rw,nodiratime 0 0
none /sys sysfs rw 0 0
/dev/sda1 /boot ext3 rw 0 0
none /dev/pts devpts rw 0 0
/proc/bus/usb /proc/bus/usb usbdevfs rw 0 0
none /dev/shm tmpfs rw 0 0
/dev/loop0 /home/chirico/junk/fs ext3 rw 0 0

You can now create new files, write to them, read them, and do everything you normally would do on a disk drive. First, I'll give access to the chirico account.

      # chown -R chirico.chirico /home/chirico/junk/fs

Now, under the chirico account, it is possible to create files.

      $ cd /home/chirico/fs
$ mkdir one two three
$ ls -l

total 15
drwx------ 2 chirico chirico 12288 Sep 3 14:28 lost+found
drwxrwxr-x 2 chirico chirico 1024 Sep 3 14:34 one
drwxrwxr-x 2 chirico chirico 1024 Sep 3 14:34 three
drwxrwxr-x 2 chirico chirico 1024 Sep 3 14:34 two

$ df -h

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 17G 11G 4.6G 71% /
/dev/sda1 99M 83M 11M 89% /boot
none 62M 0 62M 0% /dev/shm
/home/chirico/junk/disk-image
20M 1.1M 18M 6% /home/chirico/junk/fs

If you need to umount the filesystem, as root, just issue the umount command. If you need to free the loopback device, execute the losetup command with the -d option. You can execute both commands as follows:

      # umount /home/chirico/junk/fs
# losetup -d /dev/loop0

Using RWX -- The Old Way To Collaborate

Before we get started with ACL, how would you set up rights on the filesystem so that users could create and save documents that others could modify? For instance, let's say that users chirico and sporkey are collaborating on a project together.

Well, you have to add everyone to the same group. You would execute commands like these:.

      # groupadd sharefs
# chown -R root.sharefs /home/chirico/junk/fs
# chmod 2775 /home/chirico/junk/fs
# usermod -G sharefs sporkey
# usermod -G sharefs chirico

Note that if these changes do not take effect for your users (for example, if they were logged in when you executed the commands), they'll have to log out and log in again or execute the "$ newgrp sharefs" command. No big deal, right? Well, keep reading, and see how ACL avoids this step.

More importantly, even though the old way worked for you, at some point, new users may need to be added to the project. What if some of these users only need a subset of the rights? For instance, you have developers, testers, managers, and a few special people. There are limits to what the rwx type rights can do. ACL solves a lot of these problems.

ACL, Reiserfs, and AES Encryption: The 2.6 Kernel

For the next steps, I will assume that you are running Red Hat Fedora Core 2. If not, reference the 2.6 kernel upgrade section below. Four things will be covered in this section:

  • Create A File With Random Data
  • Set Up An AES Encrypted Loopback Device With Password
  • Build A Reiser Filesystem On The Loopback Device
  • Mount With ACL Capabilities

Your installation of Fedora Core 2, by default, will be configured for loop, cryptoloop, and aes, but it is highly unlikely that you will have all of these modules loaded. So, execute the following commands to load these modules (you will need to do this as root):

      # modprobe loop
# modprobe cryptoloop
# modprobe aes

Next, create a directory to store the files. The Reiser filesystem will require more space than the ext3 filesystem.

      # mkdir /home/diskimg
# cd /home/diskimg

Instead of creating the file zeroed out, like you did with the ext3 filesystem, this one is going to contain random bits, which may add a little extra security.

      # dd if=/dev/urandom of=disk-aes count=102400

We need to encrypt the loop device, so you need to use losetup. You will be prompted for a password, which you will need to remember when you mount the device.

      # losetup -e aes /dev/loop1 ./disk-aes
Password:

This step is new also. Instead of formating the file directly, you will format the loop device. The file stays encrypted. Again, you will be prompted to continue, so just enter "y".

      # mkfs -t reiserfs /dev/loop1

mkfs.reiserfs 3.6.13 (2003 www.namesys.com)

A pair of credits:
Elena Gryaznova performed testing and benchmarking.

The Defense Advanced Research Projects Agency (DARPA, www.darpa.mil) is the
primary sponsor of Reiser4. DARPA does not endorse this project; it merely
sponsors it.


Guessing about desired format.. Kernel 2.6.8-1.521 is running.
Format 3.6 with standard journal
Count of blocks on the device: 12800
Number of blocks consumed by mkreiserfs formatting process: 8212
Blocksize: 4096
Hash function used to sort names: "r5"
Journal Size 8193 blocks (first block 18)
Journal Max transaction length 1024
inode generation number: 0
UUID: 435e3495-5e2e-489d-bf55-1b5f9a44b670
ATTENTION: YOU SHOULD REBOOT AFTER FDISK!
ALL DATA WILL BE LOST ON '/dev/loop1'!

Continue (y/n):y
Initializing journal - 0%....20%....40%....60%....80%....100%
Syncing..ok

Tell your friends to use a kernel based on 2.4.18 or later, and especially not a
kernel based on 2.4.9, when you use reiserFS. Have fun.

ReiserFS is successfully created on /dev/loop1.

Create the mount point /fs, and mount this device. Note that you will be entering the acl option as well. Plus, you will prompted for a password.

      # mkdir /fs
# mount -o loop,encryption=aes,acl ./disk-aes /fs
Password:

Ok, now take a look at the mount command. It should show up as the Reiser filesystem, encrypted, using ACL. Note that it says loop2; it mounted it on /dev/loop2, which is one above what losetup specified, /dev/loop1.

      $ mount
/home/diskimg/disk-aes on /fs type reiserfs (rw,loop=/dev/loop2,encryption=aes,acl)

Exploring ACL

With ACL (Access Control Lists), you have finer control over access permissions. With the rwx permission scheme, you cannot easily change rights without creating new groups to handle the users. With ACL, you can set user permissions without creating a group, and individual users can add or remove access.

These rights are set with the setfacl command. The command below will give the users donkey, chirico, and bozo2 access to this new filesystem that we mounted. Again, I'm assuming that you are using Fedora Core 2, or some distribution that is set up for ACL.

# setfacl -R -m d:u:donkey:rwx,d:u:chirico:rwx,d:u:bozo2:rwx /fs

Next, create a few directories as one of the users. The example below was done as the user chirico.

      $ mkdir /fs/one
$ touch /fs/one/stuff
$ ls -l /fs/one/stuff
-rw-rw----+ 1 chirico chirico 0 Sep 3 17:48 /fs/one/stuff

Notice the plus sign in the last line. It tells us a little about who has access. So, as user chirico, the getfacl command can be executed:

      $ getfacl /fs/one/stuff                                   

getfacl: Removing leading '/' from absolute path names
# file: fs/one/stuff
# owner: chirico
# group: chirico
user::rw-
user:chirico:rwx #effective:rw-
user:donkey:rwx #effective:rw-
user:bozo2:rwx #effective:rw-
group::r-x #effective:r--
mask::rw-
other::---

We now see that donkey, chirico, and bozo2 have effective rights on this file. Chirico has enough rights to remove bozo2.

      $ setfacl -x u:bozo2 /fs/one/stuff
$ getfacl /fs/one/stuff
getfacl: Removing leading '/' from absolute path names
# file: fs/one/stuff
# owner: chirico
# group: chirico
user::rw-
user:chirico:rwx
user:donkey:rwx
group::r-x
mask::rwx
other::---

This is just scratching the surface of what can be done with ACL. For more information, see some of the references below.

2.6 Kernel Upgrade

This article will get you started with the 2.6 kernel if you are currently running Red Hat 8 or 9. You may want to take a look at it to see what is involved. If you decide to upgrade, you will need to configure your kernel for the following:

      CONFIG_BLK_DEV_LOOP
CONFIG_BLK_DEV_CRYPTOLOOP
CONFIG_CRYPTO_AES_586

This is done in the .config file, and you can download my config file here. Just look for kernel-2.6.8.1-i686-chirico-reiserfsacl.config in the tar.gz.

In addition to upgrading the kernel, you will need the latest version of the Linux utilities. Currently, there is no need to patch this version. In the past, there was a patch, but this version worked fine for me.

Monday, May 18, 2009

Top 10 KDE4 Applications

Yakuake - Great terminal application
Yakuake is a very popular Quake-style terminal application which sits in the background unless it's invoked with the (default) F12 global shortcut. It can inherit Konsole's settings and it is probably the best alternative to Konsole. Just like Konsole, Yakuake supports full transparency effects, various colour schemes and backgrounds, middle-click paste and tabs. Definitely an essential tool.
Homepage

Yakuake

Amarok 2 - Probably the most popular Linux audio player (full review here)
Amarok's port to KDE4 was probably one of the most controversial releases in the last few months and it generated many discussions whether Amarok 2 took the right way. My answer: yes. Although Amarok 2 was initially stripped by major features (to mention a few: lack of equalizer, currently poor functionality), but instead it is a new ground for new features. It's true, Amarok 2.0.2 was effectively full of bugs (I'm sure not even the devs can argue against this), but the upcoming 2.1 release includes a new, customisable playlist which should please users which complained about it. Amarok 2 still misses a lot of features, but the good thing is that developers are aware of the needs of users and plan to implement them in future versions. Among the new features this wonderful player comes with are widget support, a completely rebranded playlist and interface (if you ask me, I like how the space is managed in the interface), support for many services like Last.fm, Magnatune, and several other music stores. Development advances at a fast pace and pretty soon I'm sure Amarok 2 will be what Amarok 1.4 was and even more.
Homepage

Amarok 2.0.2

K3b - Arguably the best KDE burning application (full review here)
Even if it is currently in alpha, K3b has a port for KDE4 now. No new features available and the interface hasn't changed, but this is the ground for what is to come next. K3b is probably the most powerful and full-featured, open-source CD/DVD burning application on Linux.
Homepage

K3b 1.65.0 alpha - first KDE4 port

SMPlayer - Full-featured video player using Qt
Now that VLC comes with a Qt interface too, I guess this puts SMPlayer and VLC at the same level, but I opted for SMPlayer because I believe it has a more compact interface and it seems to me to be easier to use.

Although SMPlayer does not actually depend on KDE4 libraries, it's still a Qt 4 application, and one of the most powerful video players out there. Using the mplayer engine, SMPlayer is a very powerful, feature-rich and highly configurable video player, which can play any format around, including DVD ISO images or Matroska MKV videos. One of the great features SMPlayer has for a long time now is the ability to remember all the settings for a specific file (like the time position, video settings, window size and position etc). Very useful when you have to close the player, and then later you have to restart a certain video without the need to scroll to the last position in the video. SMPlayer has an interface which fits well with KDE4 and it allows to configure the shortcuts, it provides icon themes, subtitles support, video functions like rotate video, aspect ratio, or various filters.
Homepage

SMPlayer

digiKam - Photo management application
digiKam is a popular photo management application which constitutes the perfect alternative to the closed-source application from Google, Picasa. Starting with version 0.10 it also has a KDE4 port too. digiKam organises your pictures and photographs into albums and collections and comes with a huge number of options and support for many digital cameras.
Homepage

digiKam 0.10

Krusader - Powerful file manager
With a funny codename, Krusader 2.0 'Mars Pathfinder' was released on April 11 and it is the first Krusader version for KDE4. Krusader was always the first alternative to Konqueror back in the KDE3 days, and its twin-panel interface and powerful features can please any user looking for an advanced file manager for KDE4.
Homepage

Krusader

KTorrent - Full-featured BitTorrent client (full review here)
A while ago I put up a full review of KTorrent for KDE4 here. KTorrent has come a long way and is a completely full-featured BitTorrent client, including various useful plugins, torrent information, rich configuration settings, ability to download only certain files in torrents, possibility to create your own torrents and much more. If you are a KDE user and you didn't give it a try, you surely need to.
Homepage

KTorrent

Gwenview - image viewer and editor
Gwenview is in a continuous development, with more features and improvements added with every new release. Plans for the upcoming 2.3 release of Gwenview include a redesigned places and history handling, which will now include an 'URL bag' (or 'recent URLs' as it will probably be called), so that whenever you start Gwenview to view an image on the web it will keep the address in the history for fast access afterwards.

Gwenview supports various image formats, has good KDE integration, it comes with a file browser and thumbnail previews. One of the features of Gwenview is the ability to use basic image manipulation plugins, which extend its functionality too.
Homepage

Gwenview

Kdenlive - wonderful video editor
Linux has several popular video editors praised by some and hailed by others, and those include Kino and Cinelerra. A newer alternative to those is Kdenlive, which in my opinion is just the perfect application for non-linear video editing in KDE. Kdenlive supports various video formats, includes video and audio effects, and it organises your work in projects. You can create, crop, delete and bassically manipulate videos easily in any way possible with the help of this application.
Homepage

Kdenlive

SpeedCrunch - complex calculator
Maybe not an application which can compete with a video player or image management application, a calculator is still an essential tool for any desktop. SpeedCrunch is a complex calculator application built in Qt 4 and which also features a scientific mode.
Homepage

SpeedCrunch

As you can see, I decided not to include applications which come by default with KDE, so you won't find applications like Kopete or Konsole here. Instead, this is a top of KDE4 applications which I consider most powerful and (probably) essential for any KDE4 user after installing a KDE-based distribution.

Noteworthy applications left out
Unfortunately I couldn't include several good programs either because they are currently in alpha state (due to porting to KDE4 libs) or they don't have a KDE4 version. Included here is Kaffeine, a Xine-based video player which is among the top KDE players, BasKet, an extremely nice notes-taking application and not only: BasKet comes with great features which allow you to build entire projects, not only take notes. KDevelop currently has a beta release of the KDE4 port too, and it is a powerful integrated development environment which allows to program KDE applications. To say nothing about KOffice, for which the first release candidate of version 2.0 was put out just last month. A powerful music editor for Linux is Rosegarden, which is a good KDE replacement for Audacity for example.

Friday, May 15, 2009

5 Free and Open Source Desktop Project Management Tools


Project Management Software applications help Project Manager to track Schedule, Performance, Cost and Resource utilization. Microsoft Project is the industry leader and a proprietary software that costs significant amount of money. If money is a constraint, then don’t think again because there are equally good Project management software applications that cost nothing!

Project_Management_Page-23

Image Source: TrueSolutions (Project Management Services)

1. GanttProject (Alternative to Microsoft Project)

We had already featured GanttProject last month, which is a cross-platform desktop tool for project scheduling and management. It runs on Windows, Linux and Mac OS X, it is free and its code is open source.

Ganttproject-house-building-sample

2. KPlato

KPlato (part of KOffice on K Desktop Environment-KDE) is a project management application for Linux. It supports resource allocation, work breakdown structure, critical paths, Gantt chart and many more. A complete project management application for Linux

gantt_small_2006_01

3. OpenProj (Alternative to Microsoft Project)

OpenProj is a free, open source project management solution. OpenProj is a complete desktop replacement of Microsoft Project and other commercial project solutions. OpenProj shares the industry’s most advanced scheduling engine with Project-ON-Demand and provides Gantt Charts, Network Diagrams (PERT Charts), WBS and RBS charts, Earned Value costing and more. It is very popular and crossed more than a million downloads in the few months since its launch.

OpenProj_big

4. Open Workbench (Alternative to Microsoft Project)

Open Workbench is an open source desktop application that provides robust project scheduling and management functionality. Already the scheduling standard for more than 100,000 project managers worldwide, Open Workbench is a free and powerful alternative to Microsoft Project. It runs on Windows platform with Sun JRE 1.3.1 or higher.

OpenWorkbench

5. TaskJuggler

TaskJuggler is a modern and powerful, Open Source project management tool. Its new approach to project planning and tracking is more flexible and superior to the commonly used Gantt chart editing tools. It has already been successfully used in many projects and scales easily to projects with hundreds of resources and thousands of tasks. TaskJuggler runs on Linux/Unix. However, there are ports for Windows and Mac OS exist. For more info, please click here.

Task Juggler

Best of open source developer tools

The InfoWorld Test Center picks the top free and open source RIA platform, AJAX framework, business rule management system, version control package, object database, Web service test tool, and HTTP client library.

Best_of_OS_Developer_tools

1. Object databasedb4o

Db4o leverages cutting edge technologies to achieve unprecedented level of performance and flexibility. By simply embedding db4o’s open source object database engine into your application, it allows you to store and retrieve even the most complex object structures with only one line of code.

db4o started life as a Java database library, but its designers have since created parallel editions for the .Net languages. In 2005, db4o implemented Native Queries, which allow you to express queries as Java (or .Net) methods. Recent additions to the library include Transparent Update and Transparent Activation, which more completely automate object persistence. The engine itself deduces how much of a persistent object’s members must be read from and written to storage, simplifying coding and providing better memory management. Also new in db4o is support for Microsoft LINQ

db4o

2. Version controlGit

Git is an open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Every Git clone is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Branching and merging are fast and easy to do.

Git is used for version control of files, much like tools such as Mercurial, Bazaar, Subversion, CVS, Perforce, and Visual SourceSafe.

git

3. Web client libraryHttpClient

HttpClient is an open source Java HTTP client library begun in 2001. Formerly a component of Jakarta Commons, it is now being maintained by the HttpComponents project. Though there’s nothing earth-shatteringly new about HttpClient, it is as useful as ever. Particularly helpful are property settings that let you configure HttpClient to dump detailed “on the wire” data to System.out. If you’re a Java programmer with a complex application staring at you, swing by the HttpClient-3.x site and you’ll have your client application done in no time.

HTTP_Client

4. Parallel programming - Intel Threaded Building Blocks (TBB)

The effective use of multicore processors is one of the more difficult and pressing problems facing software developers today. Over the years, there have been many proposals to address parallelization, many of which involved new languages. Intel Threaded Building Blocks (TBB) is a portable template-based C++ library that implements a higher-level, task-based parallelism that abstracts platform details and threading mechanism for performance and scalability.

Intel® Threading Building Blocks (TBB) offers a rich and complete approach to expressing parallelism in a C++ program. It is a library that helps you take advantage of multi-core processor performance without having to be a threading expert. Threading Building Blocks is not just a threads-replacement library. It represents a higher-level, task-based parallelism that abstracts platform details and threading mechanism for performance and scalability and performance.

Intel_TBB

5. Business rule management system - JBoss Drools

Drools is a business rule management system (BRMS) and an enhanced Rules Engine implementation, ReteOO, based on Charles Forgy’s Rete algorithm tailored for the JVM. More importantly, Drools provides for Declarative Programming and is flexible enough to match the semantics of your problem domain with Domain Specific Languages, graphical editing tools, web based tools and developer productivity tools.

JBoss Drools is a worthy rival to leading enterprise competitors Blaze Advisor and JRules, but is available free under the Apache open source license. It combines a very fast runtime engine, a full-featured rule repository, excellent Eclipse-based developer tools, and support for Excel-based decision tables, allowing rules to be written and maintained by business analysts. The developer group is large, and the project moves fast. Drools even has one feature the market leaders lack: the capability to import rules from almost any other BRMS.

Jboss_Drools

6. Rich Internet applications - open-sourcing the Flex SDK

InfoWorld has given high marks to Adobe Flex Builder 3.0, which is a commercial product. We would also like to honor Adobe for open-sourcing the Flex SDK (although not the Flex Builder IDE) under the MPL model. This move opens the door for open source tools and applications targeting the Flex framework, which in turn is one of our favorite ways of producing rich Internet applications. Competitors to Flex include OpenLazlo and better performers such as Curl and Silverlight 2.0, but those last two products are not open source, even though they may be used for free in some scenarios.

Flex

7. JavaScript frameworkPrototype

Prototype is a JavaScript Framework that aims to ease development of dynamic web applications.

Featuring a unique, easy-to-use toolkit for class-driven development and the nicest Ajax library around, Prototype is quickly becoming the codebase of choice for web application developers everywhere.

Prototype is a JavaScript Framework that aims to ease development of dynamic web applications.

Featuring a unique, easy-to-use toolkit for class-driven development and the nicest Ajax library around, Prototype is quickly becoming the codebase of choice for web application developers everywhere.

prototype

8. Web services test toolsoapUI

soapUI is the leading tool for Web Service Testing. With more than 760 000 downloads, it’s the most used tool for SOA testing in the world.

soapUI is a free and open source desktop application for

  • inspecting Web Services
  • invoking Web Services
  • developing Web Services
  • Web Services Simulation and Mocking
  • Functional, Load and Compliance testing of Web Services

It is mainly aimed at developers and testers providing or consuming WSDL or REST based Web Services (Java, .net, etc). Functional and Load Testing can be done both interactively in soapUI or within an automated build or integration process using the soapUI command line tools.

Mock Web Services can easily be created for any WSDL and hosted from within soapUI or using the command-line MockService runner. IDE-plugins are available for

soapUI requires Java 1.5 and is licensed under the LGPL license

soapUI

Source: Best of Open Source Software Awards 2008 InfoWorld’s 2008 Bossies recognize the top free and open products for business, IT, and personal productivity

Architecture diagrams for open source projects

We had earlier posted an article on static code analysis done be Coverity Scan. Now, there is even more interesting stuff that they have for us!

Coverity Scan has recently released the Architecture Library - A collection of architecture data files, and directory and file relationship diagrams for over 2,500 open source software projects, all released under a Creative Commons Attribution license. Here is the Press Release text.

This is nice and will help the developer community to study the successful projects and learn from the architecture. For a beginner it is often difficult to understand the code layout and structure. Coverity’s architecture library will definitely be handy as it has clear component level details of most of the known projects.

Each of the architecture diagrams in the Library have been generated using Coverity Architecture Analyzer. The tool uses information gathered during the build of a codebase to create a comprehensive list of interdependencies in the code. These dependencies can be investigated interactively with the Architecture Analyzer desktop application. It can also be used to generate diagrams like the one shown on the right.

This diagram shows a version of the Apache webserver, displayed at the directory level, with all dependencies between files rolled up into the file’s directory. Some minor directories have been omitted to simplify the diagram.

apache-minimal

Source: Coverity Scan Site.

The full collection of diagrams for a wide variety of C and C++ open source projects can be browsed By Category or By Name.

MPlayer Frontend (MPF)

MPlayer Frontend (MPF) is a full-featured frontend for the gratest media player ever, MPlayer.


Unfortunately, MPlayer is mainly for Linux systems, Windows port lacks the graphical user interface. Operating a media player from command line is not so good, so I wrote a frontend (inspired by Smerli) to ease your job!
The only thing you should do is to download the latest version, install it and use it! You don't have to install ANY codecs, as this player already contains almost everything.

Features of MPlayer Frontend (MPF) 1.0 :

• Here are some features of the MPF frontend I wrote:
- You can drag&drop files onto the window
- Accepts commandline filename, so can be associated with movie files
- Playlist with subtitles
- Shutdown system after play
- Normalize volume, extra stereo
- Brightness, contrast, etc. control
- Can open subtitles even from a ZIP file
- Subtitle font and size can be adjusted
- PanScan emulation, Expand mode (make subtitles and osd appear on the black stripes under/above film)
...and more
• And some features of MPlayer itself:
- Can play almost every media file!
- No codec needed!
- Very fast playing (on my 850Mhz celeron consumes about 20-30% CPU avarage)
- Great picture quality
- INSTANT SEEKING
...and much more... take a look at mplayer homepage.

What codecs should i install?

MPlayer does not need any codec. Indeed it will not use any codecs installed. However it can play a great number of formats. If you find that a certain movie is unsupported by mplayer, than you should try downloading the MPlayer codec pack from the homesite.

These codecs are specially for MPlayer, so other movie players won't use them, and of course the system won't be messed up. You have to uncompress the contents of the codec pack archive into the directory /mplayer/codecs, MPlayer will use it automatically.
Usually recent QuickTime, RealVideo or WMV movies need this option.

Tuesday, May 12, 2009

Hướng dẫn : Tự tạo đĩa Ubuntu Live CD

Trong bài viết này tôi sẽ hướng dẫn các bạn tự tạo đĩa cài đặt ubuntu livecd cho riêng bạn .
Bạn có thể dùng,tặng cho bạn bè hay người thân .

CHUẨN BỊ

-Một HDH dùng để custom .Ở đây tôi dùng ubuntu
- File ISO của Ubuntu ,ở đây tôi dùng bản ubuntu-9.04-desktop-i386.iso
-Và một số tools khác cần khi tạo livecd như :
+ apt,dpkg,chroot và Squashfs để tạo định dạng cho livecd (Mấy tools này nếu bạn nào đang dùng ubuntu thì có sẵn hết rồi)
-Chuẩn bị thư mục dùng để mount ISO và thư mục làm việc cho quá trình tạo livecd :

$mkdir /tmp/livecd
$sudo mount -o loop ~/Desktop/ubuntu-9.04-desktop-i386.iso /tmp/livecd
$ mkdir ~/livecd
$ mkdir ~/livecd/cd
Său đó copy nội dung của file ISO đã mount ,vào thư mục làm việc của chúng ta
$ rsync --exclude=/casper/filesystem.squashfs -a /tmp/livecd/ ~/livecd/cd
Tạo thư mục custom và squashfs său đó mount và copy nội dung squashfs trong iso vào :
$ mkdir ~/livecd/squashfs
$ mkdir ~/livecd/custom
$ sudo modprobe squashfs
$ sudo mount -t squashfs -o loop /tmp/livecd/casper/filesystem.squashfs ~/livecd/squashfs/
$ sudo cp -a ~/livecd/squashfs/* ~/livecd/custom
Copy hai file /etc/resolv.conf và /etc/hosts vào ~/livecd/custom/etc (Để sử dụng mạng său khi chuyển root sang thư mục làm việc)
$ sudo cp /etc/resolv.conf /etc/hosts ~/livecd/custom/etc/
Và chroot vào thư mục làm việc "
$ sudo chroot ~/livecd/custom
# mount -t proc none /proc/
# mount -t sysfs none /sys/
# export HOME=/root

Bây giờ chúng ta bắt đầu chỉnh sửa để tạo ra livecd của riêng ta :

TẠO LIVECD :

-B1 : Gỡ bỏ các gói không cần thiết :
# apt-get remove --purge gnome-games*
# apt-get remove --purge `dpkg-query -W --showformat='${Package}\n' | grep language-pack | egrep -v '\-en'`
Nếu bạn vẫn muốn chơi game thì có thể bỏ qua command đầu .Lệnh thứ 2 dùng để bỏ đi các gói ngôn ngữ không phải tiếng anh.
Ngoài ra bạn có thể muốn gỡ bỏ nhiều phần mềm khác mà đối với bạn là không cần thiết .Bạn có thể dùng lệnh său để xem danh sách các phần mềm đã cài đặt sẵn :
# dpkg-query -W --showformat='${Package}\n' | less
-B2 : Cập nhật các gói mới nhất cho livecd của bạn :
Sửa file /etc/apt/sources.list và cho phép nó sử dụng kho universemultiverse :
# vim /etc/apt/sources.list
Thêm vào các dòng său :
deb http://mirror-fpt-telecom.fpt.net/ubuntu/ jaunty restricted universe multiverse
deb-src http://mirror-fpt-telecom.fpt.net/ubuntu/ jaunty restricted universe multiverse
deb http://mirror-fpt-telecom.fpt.net/ubuntu/ jaunty-updates restricted universe multiverse
deb-src http://mirror-fpt-telecom.fpt.net/ubuntu/ jaunty-updates restricted muniverse ultiverse
deb http://mirror-fpt-telecom.fpt.net/ubuntu/ jaunty-security restricted universe multiverse
deb-src http://mirror-fpt-telecom.fpt.net/ubuntu/ jaunty-security restricted universe multiverse
Bây giờ ta sẽ update cho livecd :
# apt-get update
# apt-get dist-upgrade
-B3 : Thêm các gói mới cho livecd .Ở đây ta thêm cho nó bộ gõ tiếng việt,bộ từ điển stardict,phần mềm nén rar và giải nén unrar .Phần mềm nghe nhạc realplayer và bộ codec để nghe nhạc.Plugin cho firefox.Các driver cho wireless để ta có thể dùng được wireless khi chạy livecd. Một số network tools khác như :wireshark,nmap,ettercap,traceroute .Tôi dùng thêm cả Sky và vmware-server cũng nên cho vào luôn.
Său khi xác định được các gói cần thêm vào rồi thì ta bắt đầu cài :
+Bộ codec nghe nhạc :
# apt-get install gstreamer0.10-ffmpeg gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse vlc mplayer mplayer-fonts libdvdread4
# /usr/share/doc/libdvdread4/install-css.sh
+Realplayer :
# wget http://www.debian-multimedia.org/pool/main/r/realplay/realplayer_10.0.9-0.2_i386.deb -O /tmp/realplay.deb
# aptitude install /tmp/realplay.deb
+Rar và unrar :
# apt-get install rar unrar unace-nonfree
+Wireless driver :
# apt-get install ndiswrapper-common ndiswrapper-utils-1.9 cabextract unshield \
bcm43xx-fwcutter \
kismet aircrack-ng
+Một số network tools :
# apt-get install wireshark nmap ettercap traceroute
+Plugin cho firefox:
# apt-get install flashplugin-nonfree mozilla-plugin-vlc
+Sky và vmware-server :
# apt-get install libqt4-core libqt4-gui
# wget http://skype.com/go/getskype-linux-ubuntu -O /tmp/skype.deb
# aptitude install /tmp/skype.deb
# apt-get install vmware-server
+Từ điển Stardict :
#apt-get install stardict
#wget http://prdownloads.sourceforge.net/stardict/stardict-dictd_anh-viet-2.4.2.tar.bz2 -O /tmp/stardict-dictd_anh-viet-2.4.2.tar.bz2
#wget http://prdownloads.sourceforge.net/stardict/stardict-dictd_viet-anh-2.4.2.tar.bz2 -O /tmp/stardict-dictd_viet-anh-2.4.2.tar.bz2
#tar -xjvf /tmp/stardict-dictd_anh-viet-2.4.2.tar.bz2
#tar -xjvf /tmp/stardict-dictd_viet-anh-2.4.2.tar.bz2

#mv stardict-dictd_* /usr/share/stardict/dic/
+Bộ gõ tiếng việt x-unikey :
#wget http://nchc.dl.sourceforge.net/sourceforge/unikey/x-unikey_1.0.2b-1_i386.deb -O /tmp/x-unikey_1.0.2b-1_i386.deb
#aptitude install /tmp/x-unikey_1.0.2b-1_i386.deb
#echo -e "export LANG=en_US.UTF-8\nexport XMODIFIERS="@im=unikey"\nexport GTK_IM_MODULE=xim">>~/.profile
-B4 : Dọn rác .Ta phải xóa các gói đã down về trong quá trình cài,các file rác tạo ra khi cài trước khi tạo livecd :
#apt-get clean
# rm -rf /tmp/*
# rm -f /etc/hosts /etc/resolv.conf
-B5 : Bước cuối cùng là ra khỏi chroot và tạo file livecd iso của chúng ta :
# umount /proc/
# umount /sys/
# exit
$ chmod +w ~/livecd/cd/casper/filesystem.manifest
$ sudo chroot ~/livecd/custom dpkg-query -W --showformat='${Package} ${Version}\n' > ~/livecd/cd/casper/filesystem.manifest
$sudo cp ~/livecd/cd/casper/filesystem.manifest ~/livecd/cd/casper/filesystem.manifest-desktop
Tạo lại squashfs :
$ sudo mksquashfs ~/livecd/custom ~/livecd/cd/casper/filesystem.squashfs
Chỉnh sử file ~/livecd/cd/README.diskdefines để để lại chút dấu ấn chứ nhỉ ;))
$sudo echo "Ubuntu Desktop livecd ,created by LHX" ~/livecd/cd/README.diskdefines
Său đó tạo lại checksum :
$ sudo rm ~/livecd/cd/md5sum.txt
$ sudo -s
# (cd ~/livecd/cd && find . -type f -print0 | xargs -0 md5sum > md5sum.txt)
Now let's make my iso :
$ cd ~/livecd/cd
$ sudo mkisofs -r -V "Ubuntu-Live-Custom" -b isolinux/isolinux.bin -c isolinux/boot.cat -cache-inodes -J -l -no-emul-boot -boot-load-size 4 -boot-info-table -o ~/Desktop/Ubuntu-Live-9.04-custom.iso .
Nào ,bây giờ kiểm tra lại thành quả và ghi ra CD phân phát cho bạn bè đồng nghiệp thôi :D