Thursday, September 24, 2009

Excel macros delete empty rows

Below are 6 methods that will delete rows from within a selection. If you know the range you can replace "Selection" with your Range(). It is important to note that the least efficient methods involve those that use loops. This is because they only delete one row at a time!
In some examples we turn off Calculation and Screenupdating. The reason we turn off calculation is in case the range in which we are deleting rows contains lots of formulas, if it does Excel may need to recalculate each time a row is deleted, slowing down the macro. The screenupdating being set to false will also speed up our macro as Excel will not try to repaint the screen each time it changes.
Subs: DeleteBlankRows1, DeleteBlankRows3 and both Worksheet_Change events are slightly different as they first check to see if the ENTIRE row is blank.

Sub DeleteBlankRows1()
'Deletes the entire row within the selection if the ENTIRE row contains no data.
'We use Long in case they have over 32,767 rows selected.
Dim i As Long
'We turn off calculation and screenupdating to speed up the macro.
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
'We work backwards because we are deleting rows.
For i = Selection.Rows.Count To 1 Step -1
If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
Selection.Rows(i).EntireRow.Delete
End If
Next i
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub

Sub DeleteBlankRows2()
'Deletes the entire row within the selection if _
some of the cells WITHIN THE SELECTION contain no data.
On Error Resume Next
Selection.EntireRow.SpecialCells(xlBlanks).EntireRow.Delete
On Error GoTo 0
End Sub

Sub DeleteBlankRows3()
'Deletes the entire row within the selection if the ENTIRE row contains no data.
Dim Rw As Range
If WorksheetFunction.CountA(Selection) = 0 Then
MsgBox "No data found", vbOKOnly, "OzGrid.com"
Exit Sub
End If
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
Selection.SpecialCells(xlCellTypeBlanks).Select
For Each Rw In Selection.Rows
If WorksheetFunction.CountA(Selection.EntireRow) = 0 Then
Selection.EntireRow.Delete
End If
Next Rw
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub

Sub MoveBlankRowsToBottom()
'Assumes the list has a heading
With Selection
.Sort Key1:=.Cells(2, 1), Order1:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End With
End Sub

Sub DeleteRowsBasedOnCriteria()
'Assumes the list has a heading.
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=1, Criteria1:="Delete"
.Range("A1").CurrentRegion.Offset(1, 0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub

Sub DeleteRowsWithSpecifiedData()
'Looks in Column D and requires Column IV to be clean
Columns(4).EntireColumn.Insert
With Range("D1:D" & ActiveSheet.UsedRange.Rows.Count)
.FormulaR1C1 = "=IF(RC[1]="""","""",IF(RC[1]=""Not Needed"",NA()))"
.Value = .Value
On Error Resume Next
.SpecialCells(xlCellTypeConstants, xlErrors).EntireRow.Delete
End With
On Error GoTo 0
Columns(4).EntireColumn.Delete
End Sub

To use any or all of the above code:
Open Excel.
Push Alt+F11 to open the VBE (Visual Basic Editor).
Go to Insert>Module.
Copy the code and paste it in the new module.
Push Alt+Q to return to Excels normal view.
Push Alt+F8 and then select the macro name and click Run. Or select Options and assign a shortcut key.

Removing Blank Rows Automatically
The codes above will work fine for removing blank rows from a list that already has some, but as the saying goes "Prevention is better than cure". The two examples below will remove blank rows as they occur. Either code should be placed within the Worksheet module and will occur each time a cell changes on the worksheet.
In both codes you will notice the Application.EnableEvents=False this is often needed within Event codes like this, else the Event will be triggered again once the code executes which in turn will again trigger the Event and so on.....
You will no doubt also notice the GoTo SelectionCode which occurs if the number of cells within the selection exceeds one. The reason for this is an error would occur if the code reached the Target keyword as Target refers to a single cell.
The second example uses the Sort method rather than the EntireRow.Delete and is the preferred method to use if possible. What happens is, any blank rows are placed at the bottom of the range should the entire row be blank.
The use of the keyword Me is a good habit to get into when working within Worksheet and Workbook modules. This was shown to me by my internet friend from Belgium, Geert Dumortier.

Private Sub Worksheet_Change(ByVal Target As Range)
'Deletes blank rows as they occur.
'Prevent endless loops
Application.EnableEvents = False
'They have more than one cell selected
If Target.Cells.Count > 1 Then GoTo SelectionCode
If WorksheetFunction.CountA(Target.EntireRow) = 0 Then
Target.EntireRow.Delete
End If
Application.EnableEvents = True
'Our code will only enter here if the selection is more than one cell.
Exit Sub

SelectionCode:
If WorksheetFunction.CountA(Selection.EntireRow) = 0 Then
Selection.EntireRow.Delete
End If
Application.EnableEvents = True
End Sub

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'Sorts blank rows to the bottom as they occur
'Prevents endless loops
Application.EnableEvents = False
'They have more than one cell selected
If Target.Cells.Count > 1 Then GoTo SelectionCode
If WorksheetFunction.CountA(Target.EntireRow) <> 0 Then
Me.UsedRange.Sort Key1:=[A2], Order1:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End If
Application.EnableEvents = True
Exit Sub 'Our code will only enter here if the selection is _
more than one cell.

SelectionCode:
If WorksheetFunction.CountA(Selection.EntireRow) = 0 Then
Me.UsedRange.Sort Key1:=[A2], Order1:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End If
Application.EnableEvents = True
End Sub

To use either one of the above codes:

Open Excel.
Right click on the Sheet name tab.
Select View Code from the Pop-up menu
Copy the code and paste it over the top of the default Event
Push Alt+Q to return to Excels normal view.
Push Alt+F8 and then select the macro name and click Run. Or select Options and assign a shortcut key.

Export All Tables from MS Access Database ToExcel

Public Sub ExportAlltablesToExcel()
Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef
Dim strFolder As String

strFolder = "C:\Folder\"

Set dbCurr = CurrentDb
For Each tdfCurr In dbCurr.TableDefs
If (tdfCurr.Attributes And dbSystemObject) = 0 Then
DoCmd.TransferSpreadsheet acExport, , tdfCurr.Name, _
strFolder & tdfCurr.Name & ".xls", True
End If
Next tdfCurr

Set tdfCurr = Nothing
Set dbCurr = Nothing

End Sub

Saturday, September 19, 2009

Free and Open Source Graphics Applicationss

Open Source Photo Management. Gallery is an open source, web-based photo management and album organizer application available for Linux and Windows. It's recently out in a Beta 2 release of Version 3.0. Licensed under the GPL, Gallery makes it easy to blend photo management into a web site or blog. There is a Gallery Remote client available for it that lets you upload new sets of photos on-the-fly, and Gallery is available in over 20 languages.
Blender University. This post collects a whopping 25 tutorials you can use to get started with Blender, one of the most popular free, open source 3D animation and graphics applications, for Windows, the Mac and Linux. You can learn how to create a great looking logo, how to execute special effects, and more. Blender has been used to produce striking full-length animated films and is worth getting to know if you haven't tried it. You can also download a great, free book on Blender here, with step-by-step project instructions.
Fantastic Freeware. Aviary is a truly remarkable suite of free, online graphics applications, and it has won many awards, including a recent Webware 100 award. It isn't open source, but it is freeware, and has become much more than the dedicated image editor that it started out as. You’ll find a vector editor, a color palette editor, a tool for creating visual effects, and more. All of the tools are available for you to use within your browser. Aviary also comes with many tutorials, similar to those found online for Photoshop. You can browse many of them here. Definitely give this suite a try.
On-The-Fly Image Editing. IrfanView is one of my main image editors that I reach for, even though I have Photoshop. It loads in an instant, and has a very rich set of tools, including mutlipage TIF support, support for multiple animated GIFs, and you can choose to use a bunch of useful plug-ins. The application isn't open source. It's freeware, but the developers improve it every year and the plug-in community works like an open source community. It's very fast to launch, does great batch image processing, and you may get things done much faster in it than in more bloated graphics applications.
A Free Book on GIMP? In our post "6 Ways to Get Much More Out of GIMP" we collected a number of excellent resources for the powerful, free, open source GIMP graphics application, available for Windows, the Mac and Linux. You'll find a complete, free online book on GIMP, tips on getting plug-ins and more.
Smarter Flickr Sessions. Are you a Linux user who frequently works with images in Flickr? Flickr can often be very slow, and has very limited uploading tools. Check out Kristin's roundup of top uploading applications for Flickr here.
Flexible Freeware. Paint.net is one of the most beloved freeware offerings for Windows. I know many bloggers and site administrators who swear by it. It shines at image and photo editing, with very flexible pallettes of tools. It supports layers, unlimited undo, special effects, and a growing online community provides tutorials and plug-ins for it.
Need a Desktop Publisher? Scribus is a top, free open source desktop publishing application available for Windows, Mac OS/X and Linux. It's useful for PDF creation, and has most professional publishing features found in proprietary products such as InDesign. Linux.com has a nice step-by-step tutorial up on how to create booklets with Scribus. Lisa Hoover also covered some of the best features in Scribus here.
Draw it for Me. Are you looking for free clip art to incorporate with documents, web pages, and desktop publishing materials? Open Clip Art has an archive of user-contributed art that you can feel comfortable using for free.
For Splashy Web Sites. Along the same lines, if you're looking for good graphical templates for web pages, two good places to start are Open Source Web Designs and Open Designs. These sites house thousands of graphical templates, most of them XHTML/CSS-based, that you can use for free.
Photos Meet Gmail. GPhotoSpace is a Firefox extension that enhances your Gmail account with photo album creation, uploading, and sharing features, as we covered here. It's available for Windows and the Mac. Within Gmail, GPhotoSpace gives you links to choose from for creating albums, sending albums to others, deleting albums, maintaining an album inbox and more. All the images are stored by Google as part of your Gmail account, and I recommend setting up a dedicated Gmail account to use with it. This is a very convenient way to work with photos and e-mail for sharing purposes.
On a Thumbnail Basis. Easy Thumbnails is a freeware application that is used widely to create thumbnail images (the small graphics you see when you, say, do a Google Image search and get a page of various graphics back). However, it is also good for scaling images incrementally up or down in size and you can resize large groups of images in batches with it. For example, you can scale all photos you have in one folder up in size at once. Give it a go, and you're likely to find several uses for it.

Thursday, September 17, 2009

Delete duplicate rows from a list in Excel

A duplicate row (also called a record) in a list is one where all values in the row are an exact match of all the values in another row. To delete duplicate rows, you filter a list for unique rows, delete the original list, and then replace it with the filtered list. The original list must have column headers.
 Caution    Because you are permanently deleting data, it's a good idea to copy the original list to another worksheet or workbook before using the following procedure.
  1. Select all the rows, including the column headers, in the list you want to filter.
    Click the top left cell of the range, and then drag to the bottom right cell.
  2. On the Data menu, point to Filter, and then click Advanced Filter.
  3. In the Advanced Filter dialog box, click Filter the list, in place.
  4. Select the Unique records only check box, and then click OK.The filtered list is displayed and the duplicate rows are hidden.
  5. On the Edit menu, click Office Clipboard.The Clipboard task pane is displayed.
  6. Make sure the filtered list is still selected, and then click Copy. The filtered list is highlighted with bounding outlines and the selection appears as an item at the top of the Clipboard.
  7. On the Data menu, point to Filter, and then click Show All.The original list is re-displayed.
  8. Press the DELETE key.The original list is deleted.
  9. In the Clipboard, click on the filtered list item.The filtered list appears in the same location as the original list.
Or simply: Data>Filter>Advanced Filter.

Unique records only and copy to another location.

Creating a Code Search Engine with PHP and MySQL

I'm just a few days away from launching a comprehensive support website for my book, "Beginning PHP and MySQL 5, Second Edition", and among other features, have built a search engine for sifting through the more than 500 code snippets found throughout the book. This was an interesting exercise because it involves a number of storing a fairly significant amount of text within a MySQL database, using MySQL's full-text search facility, and devising an effective way to extract and display the code in the browser.
In this article I'll offer a simplified version of this search engine, introducing you to some compelling PHP and MySQL features along the way. You might adopt what you learn towards building your own search engine, or towards other applications.

The Database Schema

Just a single table is required for the engine's operation. The table, code, serves as the code repository. Each example is stored along with a suitable title and the chapter number in which it appears. Because the search engine should retrieve examples based on keywords found in the example title or in the code itself, a FULLTEXT index has been added for these columns. Because the table contents will rarely change beyond the occasional bug fix, its backed by the read-optimized MyISAM storage engine. The table follows:
CREATE TABLE code (
 id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
 title VARCHAR(50) NOT NULL,
 chapter TINYINT UNSIGNED NOT NULL,
 code TEXT NOT NULL,
 FULLTEXT (title,code)
) TYPE = MYISAM;

Loading the Table

The downloadable zip file containing all of the book's code should be easily navigable so readers can easily retrieve the desired example. To meet this requirement, the zip file contains a number of directories labeled according to chapter number (1, 2, 3, ... 37), and each script is aptly named with a lowercase title and series of underscores, for example retrieving_array_keys.php. Therefore a script capable of dealing with these two organizational matters is required in order to automate the process of loading the scripts into the database.
You might recognize this task as one well suited for recursion, and indeed it is. The following script does the job nicely:
<?php

mysql_connect("localhost","gilmore","secret");

mysql_select_db("beginningphpandmysqlcom");

// Running on Windows or Linux/Unix?
$delimiter = strstr(PHP_OS, "WIN") ? "\" : "/";

function parseCodeTree($path) {

  global $delimiter;

  if ($dir = opendir($path)) {
 
    while ($item = readdir($dir)) {

      // If $item is a directory, recurse
      if (is_dir($path.$delimiter.$item) && $item != "." && $item != "..") {
   
        //printf("Directory: %s <br />", $item);
        parseCodeTree($path.$delimiter.$item);

      // $item is a file, so insert it into database
      } elseif ($item != "." && $item != "..") {

        // Retrieve the chapter number
        $directory = substr(strrchr($path, "$delimiter"), 1);

        //printf("File: %s <br />", $item);

        // Convert the file name to a readable title
        $scriptTitle = str_replace(".php", "", $item);
        $scriptTitle = str_replace("_", " ", $scriptTitle);
  
        // Retrieve the file contents
        $scriptContents = file_get_contents($path.$delimiter.$item);

        // Insert the file information into database
        $query = "INSERT INTO code VALUES('NULL', '$scriptTitle', '$directory', '$scriptContents')";
        $result = mysql_query($query);

      }
    }
    closedir($dir);
  }
  return 1;
}

parseCodeTree('code');

?>
I've purposefully left two printf() statements in the script so you can view the script's logic. Some sample output follows:
Directory: 4
File: array_key.php
File: is_array.php
Directory: 5
File: multidimensional_array.php
File: retrieving_array_keys.php
File: retrieving_array_values.php
File: slicing_an_array.php

Building the Search Engine

With the code and corresponding metadata inserted into the database, all that's left to do is build the search engine. Believe it or not, this is perhaps the easiest part of the project, thanks to MySQL's fulltext search capabilities. Although I've used the symfony framework to abstract the database interaction, for the purposes of this article I've used POPM (Plain Old PHP and MySQL) to build the search engine. The search form is exceedingly simple, and looks like this:
<form method="POST" action="search.php">
Search the code repository:<br />
<input type="text" id="keyword" name="keyword" /><br />
<input type="submit" value="Search!" />
</form>
The search script (search.php) looks something like this. Provided you've used PHP to interact with MySQL before, there shouldn't be any surprises, except for perhaps the query itself. This query takes advantage of MySQL's fulltext feature to compare the keyword against those columns that have been identified as searchable using MySQL's fulltext conditions. These conditions can produce unexpected results without doing some advance reading, so be sure to peruse the appropriate section of the MySQL documentation before building your own queries.
<?php

  mysql_connect("localhost","gilmore","secret");
  mysql_select_db("beginningphpandmysqlcom");

  $keyword = mysql_real_escape_string($_POST['keyword']);

  // Perform the fulltext search
  $query = "SELECT id, title, chapter, code 
            FROM code WHERE MATCH(title, code) AGAINST ('$keyword')";

  $result = mysql_query($query);

  // If results were found, output them
  if (mysql_num_rows($result) > 0) {

    printf("Results: <br />");

    while ($row = mysql_fetch_array($result)) {

      printf("Chapter %s: <a href='displaycode.php?id=%s'>%s</a>", 
       $row['chapter'], $row['id'], ucfirst($row['title']));

    }

  } else {
    printf("No results found");
  }

?>

Simple Connection to MySQL with PHP

The MySQL database is one of the most popular among PHP developers. It's my database of choice, and has held up remarkably well in multiple e-commerce situations. Therefore, you would be correct in assuming that there are numerous well-documented PHP functions you can use in conjunction with your MySQL databases. However, you only need a few of these functions in order to make a simple connection and select some data:


mysql_connect - opens a connection to the MySQL server; requires a hostname, username and password.



mysql_db_select - selects a database on the MySQL server.


mysql_query - issues the SQL statement.




mysql_fetch_array - puts a SQL statement result row in an array.


mysql_free_result - frees the resources in use by the current connection.


mysql_close - closes the current connection.


For the rest of PHP's MySQL-related functions, get thee to the PHP Manual!


Just for argument's sake, let's pretend that MySQL is already installed on your system, and you have a valid username and password for an existing database. Let's also assume that you've created a table on that database, called COFFEE_INVENTORY. The COFFEE_INVENTORY table has three columns: COFFEE_NAME, ROAST_TYPE and QUANTITY.


The rows in the COFFEE_INVENTORY table could be populated with data such as:


French Roast,dark,18


Kenya,medium,6


Ethiopian Harrar,medium,35


Sumatra,dark,8


Columbian,light,12


Now, let's do some PHP. Before you begin, you must know the name of the server on which the database resides, and have a valid username and password for that server. Then, start your PHP code by creating a connection variable:

";
echo "Coffee Name</TH>Roast Type</TH>Quantity</TH>";


After defining the variables within the while loop, print them in table format:

echo "$coffee_name</TD>$roast_type</TD>$quantity</TD></TR>";


The new while loop now looks like this:

while ($row = mysql_fetch_array($sql_result)) {
$coffee_name = $row["COFFEE_NAME"];
$roast_type = $row["ROAST_TYPE"];
$quantity = $row["QUANTITY"];
echo "$coffee_name</TD>$roast_type</TD>$quantity</TD></TR>";
}


After the while loop, close the HTML table:

echo "</TABLE>";


Finally, you'll want to free up the resources used to perform the query, and close the database connection. Failing to do so could cause memory leaks and other nasty resource-hogging things to occur.

mysql_free_result($sql_result);
mysql_close($connection);
?>


The full script to perform a simple connection and data selection from a MySQL database could look something like this:

";
echo "Coffee Name</TH>Roast Type</TH>Quantity</TH>";

// format results by row
while ($row = mysql_fetch_array($sql_result)) {
$coffee_name = $row["COFFEE_NAME"];
$roast_type = $row["ROAST_TYPE"];
$quantity = $row["QUANTITY"];
echo "$coffee_name</TD>$roast_type</TD>$quantity</TD></TR>";
}

echo "</TABLE>";

// free resources and close connection
mysql_free_result($sql_result);
mysql_close($connection);
?>


Please see the PHP Manual for additional MySQL functions, and try using your own tables and SQL statements instead of the examples above.

PHP: A simple MySQL search

Introduction

One of the most important advantages of creating a database driven sites is the ability to perform search queries on the database. Could you imagine searching WeberDev.com if it was written using plain HTML? Not that it couldn't be done, just we would have to rebuild an index of all the pages every time someone adds an example, article and so on.

Now, performing searches on a database driven site is a totally different story (and thankfully much easier).

Grocery list

In order to understand and work a bit with searches we will need a small MySQL driven site. I will use the structure we built at my "Beginners guide to PHP/MySQL - Creating a simple guest book" article. Actually, we will write a search page for the guest book described in the above tutorial, so go on and take a brief look at the PHP code for the guest book, I'm waiting.

Notice that we have a file named links.x, which holds the links to the guest book pages. We will modify it slightly to include a link to the search page (the third <li> statement).

Links.x:
<p></p>
<ul>
<li><a href="index.php3">Display entries</a>
<li><a href="add.php3">Add new entry</a>
<li><a href="search.php3">Search the guest book</a>
</ul>

Ok, done with that.

Searching the database

To tell the truth, we don�t actually search the database, but rather select records from it that correspond to a string we choose. Lets assume we want to search all the records where the users' name matches the search string:

Search.php3:
<html>
<head><title>Searching the Guest Book</title>
</head>
<body bgcolor=#ffffff>
<h1>Searching the Database</h1>
<form method="post" action="srch.php3">
<table width=90% align=center>
<tr><td>search for:</td><td><input type=text name='search' size=60 maxlength=255></td></tr>
<td></td><td><input type=submit></td></tr>
</table>
</form>
<?php include ('links.x');?>
</body>
</html>

This html is rather simple. Just a small form that sends a search string variable to srch.php3.

Srch.php3:
<?
if ($search) // perform search only if a string was entered.
{
mysql_connect() or die ("Problem connecting to Database");

$query = "select * from visitors WHERE Name='$search'";

$result = mysql_db_query("guest_book", $query);

if (
$result)
{
echo
"Here are the results:<br><br>";
echo
"<table width=90% align=center border=1><tr>
<td align=center bgcolor=#00FFFF>Visit time and date</td>
<td align=center bgcolor=#00FFFF>User Name</td>
<td align=center bgcolor=#00FFFF>Last Name</td>
<td align=center bgcolor=#00FFFF>Email</td>
</tr>"
;

while (
$r = mysql_fetch_array($result)) { // Begin while
$ts = $r["TimeStamp"];
$name = $r["Name"];
$last = $r["Last"];
$email = $r["email"];
$comment = $r["comment"];
echo
"<tr>
<td>$ts</td>
<td>$name</td>
<td>$last</td>
<td>$email</td></tr>
<tr> <td colspan=4 bgcolor=\"#ffffa0\">$comment</td>
</tr>"
;
}
// end while
echo "</table>";
} else { echo
"problems...."; }
} else {
echo
"Search string is empty. <br> Go back and type a string to search";
}
include (
'links.x');
?>

Some explanations. This scripts performs the following tasks:

  1. Checks whether a string was entered.
  2. Retrieves all the records that match the search string.
  3. Prints all the retrieved records in a formatted table.

Clearing all the mumbo jumbo, the actual code that we need to work on is:
$query = "select * from visitors WHERE Name='$search'";

Yes, this line does all the work. We will play with it a bit later.

Ok, this query gets all the records where the Name field is equal to the string search. Please note that an exact match is needed.

Lets assume we want to search for a partial string match (i.e. where the search string appears in the filed but as part of the string and not an exact match). We will have to modify the script as follows:
$srch="%".$search."%";
$query = "select * from visitors WHERE Name LIKE' $srch'";

The LIKE comparison argument will return '1' if the Name field has a partial value of $search. Note that I modified $search and added "%" on both ends. This allows to search for the search to ignore the leading characters and the characters following the search string.

Ok, now lets assume we want to search all the field of the table and not only the Name field. In order to do that we need to choose the records with Name LIKE $srch or Last LIKE $srch etc. The translation to MySQL query is:
$query = "select * from visitors WHERE Name LIKE '$srch' || Last LIKE '$srch' || email LIKE '$srch' || comment LIKE '$srch'";

The complete srch.php3 script top to bottom should look like:
<?
if ($search) // perform search only if a string was entered.
{
mysql_connect() or die ("Problem connecting to DataBase");
$srch="%".$search."%";
$query = "select * from visitors WHERE Name LIKE '$srch' || Last LIKE '$srch' || email LIKE '$srch' || comment LIKE '$srch'";

$result = mysql_db_query("guest_book", $query);

if (
$result)
{
echo
"Here are the results:<br><br>";
echo
"<table width=90% align=center border=1><tr>
<td align=center bgcolor=#00FFFF>Visit time and date</td>
<td align=center bgcolor=#00FFFF>User Name</td>
<td align=center bgcolor=#00FFFF>Last Name</td>
<td align=center bgcolor=#00FFFF>Email</td>
</tr>"
;

while (
$r = mysql_fetch_array($result)) { // Begin while
$ts = $r["TimeStamp"];
$name = $r["Name"];
$last = $r["Last"];
$email = $r["email"];
$comment = $r["comment"];
echo
"<tr>
<td>$ts</td>
<td>$name</td>
<td>$last</td>
<td>$email</td></tr>
<tr> <td colspan=4 bgcolor=\"#ffffa0\">$comment</td>
</tr>"
;
}
// end while
echo "</table>";
} else { echo
"problems...."; }
} else {
echo
"Search string is empty. <br> Go back and type a string to search";
}
include (
'links.x');
?>

Wednesday, September 16, 2009

Gnome hotkeys

GNOME is a desktop environment and an international project that includes creating software development frameworks, selecting application software for the desktop, and working on the programs which manage application launching, file handling, and window and task management. GNOME is part of the GNU Project and can be used with various Unix-like operating systems - most notably those built on top of the Linux kernel and the GNU userland.

General Shortcut Keys
Alt + F1 Opens the Applicantions Menu .
Alt + F2 Displays the Run Application dialog.
Print Screen Takes a screenshot.
Alt + Print Screen Takes a screenshot of the window that has focus.
Ctrl + Alt + right arrow Switches to the workspace to the right of the current workspace.
Ctrl + Alt + left arrow Switches to the workspace to the left of the current workspace.
Ctrl + Alt + up arrow Switches to the workspace above the current workspace.
Ctrl + Alt + down arrow Switches to the workspace below the current workspace.
Ctrl + Alt + d Minimizes all windows, and gives focus to the desktop.
F1 Starts the online help browser, and displays appropriate online Help.

Window Shortcut Keys
Alt + Tab Switches between windows. When you use these shortcut keys, a list of windows that you can select is displayed. Release the keys to select a window.
Alt + Esc Switches between windows in reverse order. Release the keys to select a window.
F10 Opens the first menu on the left side of the menubar.
Alt + spacebar Opens the Window Menu .
Arrow keys Moves the focus between items in a menu.
Return Chooses a menu item.
Esc Closes an open menu.
Ctrl + Alt + right arrow Switches to the workspace to the right of the current workspace.
Ctrl + Alt + left arrow Switches to the workspace to the left of the current workspace.
Ctrl + Alt + up arrow Switches to the workspace above the current workspace.
Ctrl + Alt + down arrow Switches to the workspace below the current workspace.
Ctrl + Alt + d Minimizes all windows, and gives focus to the desktop.

Panel Shortcut Keys
Ctrl + Alt + Tab Switches the focus between the panels and the desktop. When you use these shortcut keys, a list of items that you can select is displayed. Release the keys to select an item.
Ctrl + Alt + Esc Switches the focus between the panels and the desktop. Release the keys to select an item.
Ctrl + F10 Opens the popup menu for the selected panel.
Tab Switches the focus between objects on a panel.
Return Chooses the selected panel object or menu item.
Shift + F10 Opens the popup menu for the selected panel object.
Arrow keys Moves the focus between items in a menu. Moves the focus between interface items in an applet also.
Esc Closes an open menu.
F10 Opens the Applications menu from the Menu Bar , if the Menu Bar is in a panel.

Application Shortcut Keys
Ctrl + N New
Ctrl + X Cut
Ctrl + C Copy
Ctrl + V Paste
Ctrl + Z Undo
Ctrl + S Save
Ctrl + Q Quit

Monday, September 14, 2009

Delete duplicates in a MYSQL database

* Create a new table identical in structure to the first, but with no data.
* Use the query: INSERT INTO `name_of_new_table` SELECT DISTINCT * FROM `name_of_old_table`
* Drop the old table
* Rename the new table to whatever the old table was called.

This has the advantage of being pretty fast, and only requiring 4 queries, no matter how many rows are duplicated. On the other hand though, if there are any database queries on the old table between the drop and the rename, they will fail (since the table won't exist during that period). That being said, the period for which this is a problem should be pretty short.

Thursday, September 10, 2009

Install Drupal 6 on Windows XP

1. Install xampp (e.q. at c:\xampp)
Can be downloaded from http://www.apachefriends.org/en/xampp.html
Reboot Windows.
2. At XAMPP Control Panel
Start Apache and MySql, then click Admin button beside Apache.
Your browser will automatically open http://localhost/. If not, you can open it manually in your browser.
Choose your prefered language.

3. Download Drupal 6.x (from www.drupal.org)
Extract the file to C:\xampp\htdocs
Rename the folder with your sitename (e.q. drupalsite).
4. Go to C:\xampp\htdocs\drupalsite\sites\default
Copy default.settings.php file and paste it in the same folder, then rename to settings.php
5. Create Database
Open your browser and go to http://localhost/phpmyadmin/, then create database and remind that database name (e.q. drupal).

6. Drupal Installation
Open your browser and go to http://localhost/drupal to install drupal:

a. Choose language
choose: Install Drupal in englishb. Verify requirements
If you haven’t done step 4, there will be error message. Do step 4 and click try again.

c. Set up database
Database type : mysqli
Database name : drupal
Database username : root
Database password : (leave it empty)

d. Install site
Installation is in progress.

e. Configure site
Complete these information:
Site name : DrupalSite
Site email address : admin@drupalsite.com
Administrator account
username : admin
email address : admin@drupalsite.com
password : admin
confirm password : admin
Klik Save and continue

f. Finished
There is a warning mesage:
warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your“SMTP” and “smtp_port” setting in php.ini or use ini_set() in C:\xampp\htdocs\drupal\include\mail.inc on line 193.
Unable to send e-mail. Please contact the site administrator if the problem persists.

This error happen because drupal is installed on local machine (http://localhost/) that doesn’t have mailserver.
Click link: your new site to go to your Drupal home page.

How To Create A GDM Theme

GDM is the GNOME Display Manager, a graphical login program, which provides a simpler alternative display manager for the X Window System's XDM. GDM is released under the GNU General Public License (GPL).
The X Window System by default uses the XDM display manager. However, resolving XDM configuration issues typically involves editing a configuration file. GDM allows users to customize or troubleshoot settings without having to resort to a command line. Users can pick their session type on a per-login basis. GDM also features easy customization with themes.

Components of a GDM theme
A GDM Theme is basically composed of:
  • A background image
  • A screenshot
  • Icons and other artwork
  • An xml file, where the actual theme is defined
  • The GdmGreeterTheme.desktop file
Creating your own theme
It's easier to modify an existing theme, rather than doing it from scratch. In general, the first item to be changed is the background image. The background image must be at least as big as the screen resolution. In order to make the theme suitable to other users, it is a good idea to use at least 1600x1200 pixel images, as they look sharp even on high-resolution screens. A small image can also be used, but it will loose quality when expanded. The image must be placed in the theme directory and declared in the xml file as follows:

Next, you will have to reposition your prompts, menus, labels and icons in order to match your background image. You can define images, rectangles and labels with the following tags (respectively):


Using the item tag, you can also specify the location of option buttons, system messages, login screen, etc, by adding id= to the item tag. All the GDM system tags I am aware of are:

Use the pos tag within each item section to define its x,y position and make sure it all looks in harmony with your background image. Finally, the xml file must be declared in the GdmGreeterTheme.desktop file as follows:

Greeter=theme.xml

Capturing your GDM screen
Once your theme is complete, you will need to install the theme in order to obtain a screenshot. Install your new theme in your Login Screen Manager by selecting System > Administration > Login Window > Local(tab) > +Add and select your new theme. Then check the radio button next to it in the list and click the Close button.
I remember taking screenshots of the GDM screen in other distros using the below command, but this command didn't work on my Ubuntu 9.04 system:

chvt 7 ; sleep 5 ; XAUTHORITY=/var/gdm/:0.Xauth DISPLAY=:0.0 import -window root /tmp/gdm-shot.png

An easier way to capture your GDM screen would be to use xnest, this worked perfectly for me. Open a terminal and install xnest with the command:
(assuming you don't already have xnest installed):

sudo apt-get install xnest

Then run xnest with the command:

gdmflexiserver --xnest

This will open a new window and show your GDM login screen. Now just hit the "Print Screen" button on your keyboard and save the screenshot. Open the newly created screenshot in your favorite image editor and shrink the screenshot down to 188x140. Now put the screenshot in your theme directory and make a reference to it in your GdmGreeterTheme.desktop, adding your theme name, description, author name, screenshot and copyright fields as follows:

[GdmGreeterTheme]
Greeter=theme.xml
Name=The name of your theme
Description=The description of your theme
Author=Your name
Screenshot=screenshot.png
Copyright=Copyright information

Conclusion
The final step is to package your new GDM theme with the command:
tar czf MyTheme.tar.gz MyThemeDir
The new theme can bow be installed on any computer from the GDM Configuration Screen.

Sunday, September 6, 2009

Video formats for Linux

Bitrates refer to how many bits per second are used to represent the video portion of the file. These can vary from as low as 300 kbps (kilobits per second) for low quality video, to as high as 8,000 kbps for very high quality video. Just as with sound files, a higher bitrate translates to a better quality video.
The next thing we need to discuss is how the image appears. We have two terms to describe the video image: interlaced and progressive. Interlaced video is a way to make the best use of the limited bandwidth for transmitting video, especially in the older days of analog NTSC broadcasts. The receiver (your TV) "tricks" your eyes by drawing first the odd number lines on the screen 30 times per second (25 times per second in Europe), and alternating the drawing of the even numbered lines on the screen 30 times per second, in an odd — even — odd — even — odd — even pattern. Progressive video draws both the odd and even numbered lines at the same time, instead of alternating them. This makes the picture appear sharper and more vivid.
Next, is resolution. In the analog video days, video was commonly the equivalent of 352 x 240 pixels for NTSC video in North American, and 352 x 288 for PAL/SECAM video elsewhere. Today's digital televisions can display up to 1920 x 1200 pixel pictures. Computer monitors have much higher display resolution than conventional analog televisions. The move to digital televisions has made it feasible to multi-task the family television to double as a large computer monitor. A common resolution for DVD quality video is 720 x 480 for NTSC, and 720 x 576 for PAL/SECAM systems. The resolution for the new high definition television broadcasts are even higher, and provide Blu-Ray quality, able to display a pixel-for-pixel representation of the highest High Definition television specification at 1920 x 1200 pixels.

Formats, or Containers

Theora

We start with the Theora container, because it is open source. And, because this is a Linux publication, we are particularly fond of open source solutions. Developed by the Xiph.Org Foundation as part of the OGG project, it is derived from On2 Technologies' VP3 video codec. It's also named after Theora Jones, Edwin Carter's Controller on the old Max Headroom television show.
Because it is developed and maintained by the Xiph.Org Foundation, it commonly has Vorbis formatted audio streams, placed into an OGG container. Since On2 Technology released the VP3 codec and its source code to the public under an open source and free software license, and disclaimed any rights and patents on the technology in September 2001, it allowed anyone to use Theora and other VP3-derived codecs for any purpose. In 2002, On2 inked an agreement with the Xiph.Org Foundation to make VP3 the basis of a new and free Theora video codec, and declared Theora to be the successor to VP3.
The first stable v1.0 release of Theora was in November 2008. Since it is a relatively new format that has very little commercial support, Theora has struggled to gain acceptance from distributors, especially on the web. Yet, as the only mature and royalty free video codec, Theora is well established as a baseline video format in modern free software, and has become the format of choice for many other organizations (e.g., Wikipedia).
Theora does not make use of hardware acceleration, but because its algorithm is less complex than H.264, which is used by the competing MP4 format, the need for hardware acceleration is not considered to be as relevant.
There are several applications in the PCLinuxOS repository that can play, stream and edit Theora video files. For encoding, VLC and HandBrake are available. Cinelarra can edit Theora video files, while VLC can stream them.

MPEG-1

While development of the MPEG-1 standard began in 1988, it wasn't until 1992 that the final standard was approved and the first MPEG-1 decoder was made available. Compressing video 26:1 and audio 6:1, the MPEG-1 format is designed to compress VHS quality raw digital video and CD audio with a minimum of quality loss.
Today, it is the most widely compatible lossy compression format in the world. MPEG-1 standard is part of the same standard that gives us the MP3 audio format. Fortunately, the MPEG-1 video and Layer I/II audio can be used royalty free and without license fees, since the patents expired in 2003. Only the MPEG-1 Layer 3 Audio format (more commonly known as MP3) is still covered by patents and licensing restrictions.
The "standard" MPEG-1 video bitrate is 1,150 kbps, with audio at 224 kbps and 44.1 kHz sample rate. The video is recorded at 352 x 240 pixel screen size for NTSC, and 352 x 288 pixel screen size for PAL/SECAM systems. One distribution format that makes wide use of the MPEG-1 format is the Video Compact Disc, or VCD. Although it never caught on in the U.S., other parts of the world have seen wide adoption of the VCD, due to its relatively inexpensive production costs, coupled with the VCD's ability to withstand high humidity environments (as present in Southeast Asia) better than VHS tape.
MPEG-1 formatted video files are easily read by most of the video programs in the PCLinuxOS repository.

MPEG-2

The MPEG-2 format was born from the shortcomings of the MPEG-1 format. Specifically, the MPEG-1 format had less efficient audio compression, a lack of flexibility when it came to the packet types it accepted, and it does not support interlaced video. MPEG-2 is also the format of choice for digital televison broadcasts.
Work on the MPEG-2 format began in July, 1990 — before the first draft of MPEG-1 was ever written. It was intended to extend the MPEG-1 format to provide full broadcast quality video at high bitrates, between 3 — 5 Mbits/s, and added support for interlaced video.
MPEG-2 is the designated format for movies and other programs that are distributed on DVD, SuperVCD, and BluRay discs. As a result, the televisions in our living rooms, along with the TV broadcast stations and our DVD players are designed to the MPEG-2 standard.
Because MPEG-2 evolved from the MPEG-1 format, all standards compliant MPEG-2 decoders can also play MPEG-1 video streams. Thus, even though you may not realize it, you can play VCDs in most home DVD players.
Currently, over 640 patents, owned by more than 20 corporations and one university, and the patent pool managed by the MPEG Licensing Authority, burden the MPEG-2 format. In jurisdictions where software patents are upheld and enforced (currently, the U.S. is included in those jurisdictions), use of the MPEG-2 format requires payment of licensing fees to the patent owners. It"s best to check the laws of your jurisdiction, since they vary so widely. For example, software patents are not allowed in India and the Philippines, but they are in Japan and Korea, and to a limited extent, in Europe and Australia. Hence, this is one of the reasons that PCLinuxOS does not come with DVD playback software enabled by default; rather the end user must install the necessary libraries and dependencies themselves, based on the laws of their relevant jurisdiction.

MPEG-4

MPEG-4 represents a patented collection of methods to define compression of video and audio, designating a standard for a group of audio and video codecs. MPEG-4 encompasses many of the features of MPEG-1 and MPEG-2, while adding support for 3-D rendering, Digital Rights Management (DRM), and various types of interactivity.
MPEG-4 files are commonly encoded with codecs like DivX, Xvid, 3ivx, and x264 to name a few, and may be used by BluRay discs. Since most of the features of the MPEG-4 standard are left to the discretion of the individual developers to implement, they are free to choose which parts of the MPEG-4 format to implement. Thus, a "full implementation" of the MPEG-4 format does not exist, and most likely will never exist.
Introduced in late 1998, more than two dozen companies claim ownership of patents related to MPEG-4. The licenses for use of the MPEG-4 format (in jurisdictions where software patents are upheld and enforced) is handled by the MPEG Licensing Authority.
MPEG-4 files can usually be easily viewed on PCLinuxOS, using VLC or MPlayer.

QuickTime

Initially released in December, 1991, the QuickTime format is released under a proprietary license from Apple, beating Microsoft’s Video for Windows to the "market" by nearly a full year. Developed as a multimedia framework by Apple, Inc., it is capable of handling various formats of digital video, media clips, sound, text, animation, music, and interactive panoramic images. The most current stable release is QuckTime 7.6.2, and is available for Mac operating systems, and computers running Windows. Although no formal implementation exists for Linux, there are a number of programs in Linux which can handle (with varying degrees of success), QuickTime video playback. Possibly the best of the Linux programs that can handle playback of most QuickTime files are VLC and MPlayer, both of which are in the PCLinuxOS repository.
In February, 1998 the International Standards Organization approved the QuickTime file format as the basis of the MPEG-4 file format. The benefit is that MOV and MP4 files (containers) are interchangeable on a QuickTime-only environment (meaning running in an "official" QuickTime player, like QuickTime on the Mac OS X or QuickTime for Windows), since both use the same MPEG-4 codecs.

AVI

AVI, more formally known as Audio Video Interleave, was released in November, 1992 by Microsoft as a part of its Video for Windows technology. It is basically a file container the allows synchronized audio and video playback.
Since AVI files do not contain pixel aspect ration information, and many players render AVI files with square pixels, the frame (image) may appear stretched or squeezed horizontally when played back. However, VLC and MPlayer have solved most problems related to the playback of AVI files.
Although being "older" technology, there is a benefit to using AVI files. Because of it being around for so long, coupled with Microsoft’s market penetration, AVI files can frequently be played back on the widest variety of systems and software, second only to MPEG-1. It has gained widespread acceptance and adoption throughout the computer industry, and can be successfully played back, so long as the end user has the proper codec installed to decode the video properly. Additionally, the AVI format is well documented, not only from Microsoft, but also many, many third parties.

Matroska

Matroska files, commonly recognized by either their *.mkv file extension, represent a multimedia container that is an open standard free container format. It can hold an unlimited number of video, audio, picture, or subtitle tracks in a single file. Implementations of the Matroska format consists mostly of open source software.
The word, matroska, is an English word derived from the Russian word matroyshka, the name for the nesting doll, where one egg-shaped doll is found inside another, then another, and so on.
Matroska video files (*.mkv) can be played back on a wide variety of software in PCLinuxOS, including MPlayer, VLC, Avidemux, and MythTV. And, because Matroska is an open standards project, much like Theora, the source code of the libraries are developed under the GNU LGPL. It has gained popularity recently, especially among the warez crowd for ripping and distributing high definition content from HDTV and BluRay discs.

WMV

WMV, or Windows Media Video, is a compressed video file format, made with several different proprietary codecs, made by Microsoft. Originally intended to compete with RealVideo in 2003 as an alternative for streaming video, it has since gained adoption for use with BluRay discs.
The WMV files are often wrapped in the ASF, or Advanced Systems Format. WMV files, themselves, are not encoded. Rather, the ASF wrapper is often responsible for providing the support for digital rights management, or DRM. Based on Windows Media 9, WMV files can also be placed inside either an AVI or Matroska container. In that case, the WMV file claims either the AVI or MKV file extensions.
WMV files can be played on PCLinuxOS, using VLC, MPlayer, or most any other program that uses the FFmpeg implementation of the WMV codecs.

3GP

The 3GP format is actually two similar formats. The first, 3GPP, is designed as a container format for GSM phones (in the U.S., primary GSM wireless carriers are AT&T and T-Mobile). The second, 3GPP2, is designed as a container format for CDMA phones (in the U.S., primary CDMA wireless carriers are Verizon and Sprint). 3GPP files will often carry a 3GP file extension, while 3GPP2 files will often carry a 3G2 file extension.
3GP and 3G2 files store video streams using MPEG-4 Part 2, H.263, or AVC/H.264 codecs. Some cell phones will use the MP4 file extension to represent 3GP video. Both formats were designed to decrease storage and bandwidth requirements to accommodate mobile phones.
Software support under PCLinuxOS is, once again, achieved with VLC and MPlayer. Additionally, 3GP files (and most 3G2 files) can be encoded and decoded with FFmpeg.

FLV

FLV files, also known as Flash Video, are a file container format used primarily to deliver video over the Internet. In fact, it has become the defacto format of choice for such sites as YouTube, Google Video, Yahoo! Video, Metacafe, and many news outlets.
While the FLV format is an open format, the codecs used to produce FLV files are mostly patented. The most common codecs used are the Sorenson Spark (H.263 codec variant) and On2’s VP6. FLV files can also be encoded as H.264 in the more recent releases of Adobe Flash.
Most audio in an FLV file is recorded as MP3, although there are a few proprietary audio codecs used. Uncompressed ADPCM (Audio-Digital Pulse Code Modulation) can also be used to record audio in an FLV file. More recent versions (from Flash 9, upwards) also support the recording of audio in the AAC (Advanced Audio Coding) format.
Under PCLinuxOS, VLC and MPlayer support playback of FLV files. One can also encode FLV files with FFmpeg. Additionally, it’s usually a simple matter, using Avidemux, to convert from the FLV format to another, more universally read format — such as AVI or MPEG-1. You can also use Avidemux to edit FLV files.
And by the way — changing the file extension from FLV to AVI does not make it an AVI file. Rather, it’s just an FLV file with an AVI file extension. Simply changing the file extension does nothing to the file header in the video file, which is what determines they type of video file it really is. I point this out because of a post in the forum some time ago (perhaps a year ago?) that made this erroneous assertion. The poster achieved the results they did merely because the system knew how to handle a file with the AVI file extension, by playing it in VLC or MPlayer. In actuality, the programs are playing the FLV file, not an AVI file — something they already have the capability to do.

Tucan Manager

Tucan is a free and open source application designed for automatic management of downloads and uploads at hosting sites like:
  • http://rapidshare.com/
  • http://megaupload.com/
  • http://gigasize.com/
  • http://mediafire.com/
  • http://4shared.com/
  • http://sendspace.com/
  • http://zshare.net/
  • http://filefactory.com/
  • http://easy-share.com/
  • http://badongo.com/
  • http://depositfiles.com/
  • http://hotfile.com/

Main Features:

  • Written entirely in Python.
  • Graphical User Interface written in PyGTK (GTK+ toolkit).
  • Multiplatform (GNU/Linux, FreeBSD, Microsoft Windows…).
  • Easy to expand with plugins.
  • Lightweight and fast.
  • Management of waits between downloads (anonymous access).
  • Captcha recognition where needed (like anonymous access to megaupload or gigasize).
  • Management of interchangeable links.

Saturday, September 5, 2009

Three Ways To Access Linux Partitions (ext2/ext3) From Windows On Dual-Boot Systems

If you have a dual-boot Windows/Linux system, you probably know this problem: you can access files from your Windows installation while you are in Linux, but not the other way round. This tutorial shows three ways how you can access your Linux partitions (with ext2 or ext3 filesystem) from within Windows: Explore2fs, DiskInternals Linux Reader, and the Ext2 Installable File System For Windows. While the first two provide read-only access, the Ext2 Installable File System For Windows can be used for read and write operations.

I do not issue any guarantee that this will work for you!

1 Explore2fs

In Windows, open a browser and go to http://www.chrysocome.net/explore2fs. Download the latest explore2fs zip file...


... and unpack it. In the new folder, you'll find the explore2fs executable. Double-click on it to start it:


The Explore2fs filebrowser starts; you can now browse your Linux partitions and copy&paste files to your Windows partition:

2 DiskInternals Linux Reader

Go to http://www.diskinternals.com/linux-reader and download and install the DiskInternals Linux Reader.

After the installation, the Linux Reader starts automatically and scans your hard drive for Linux partitions:

Afterwards, you can find your Windows and Linux partitions in the Linux Reader (which looks like the Windows Explorer):

Now you can browse your Linux partitions:

To copy a file/directory from a Linux partition to your Windows partition, right-click on the file/directory and select Save:

Then select the folder on your Windows partition where you want to store the file/directory:

The DiskInternals Linux Reader can be started from the normal start menu:


3 Ext2 Installable File System For Windows

The Ext2 Installable File System For Windows (which supports ext2 and ext3!) can be downloaded from http://www.fs-driver.org/index.html. During the installation you will be asked to assign a drive letter to your Linux partitions (e.g. L:); you don't need to assign a drive letter to your swap partition:

After the installation, you can find your Linux partition(s) in the normal Windows Explorer (under the drive letter that you assigned to it during the installation):

You can now browse and use your Linux partition(s) like a normal Windows partition.

As mentioned in the introduction of this article, the Ext2 Installable File System For Windows supports read and write operations on the Linux partitions. In order to test if the write support really works, we can try to create an empty folder on a Linux partition. Right-click on an empty area on the Linux partition and select New > Folder:

Enter a name for the new folder (e.g. test):

If everything goes well, you should now have a new folder on your Linux partition.

4 Links

Thursday, September 3, 2009

10 Linux file managers

1: Command line

Although the command line isn’t just a file manager, you can’t have a listing of Linux file management tools without including it Without these tools, working on headless servers would be a challenge (unless you’re using remote desktop). And being someone who cut his Linux teeth with the command line, not a day goes by where I do not use it for something. The tools you will use for file management in the command line include cd, mkdir, rm, ls, locate, find, cp, and mv.

2: Dolphin

Dolphin is the default file manager for KDE, which replaced Konqueror upon the arrival of KDE 4. Dolphin is a full-featured file manager and includes the standard features of a file manager and then some. You will also find Network transparency, undo, batch renaming, split views, dockable panels, built-in encryption, zoom drag bar, and much more. Dolphin will never offer the number of features included with Konqueror, which is precisely why the KDE team made the switch. Dolphin focuses on file management and file management alone. Konqueror focuses on everything — file management, browsing, document viewing. The KDE developers thought it best to simplify the task of file management. This was a good call on their part, especially for the new user. As a file manager, Konqueror was just too much.

3: Gnome Commander

Gnome Commander is the GTK+ version of the venerable Midnight Commander file manager. Gnome Commander is a split-pane file manager that offers all of the features of Midnight Commander with the added convenience of a GUI interface. Along with the GUI interface comes the ease of network transparency. With Gnome Commander, you can connect to a remote server with Samba, FTP, Windows Share, WebDAV, Secure WebDAV, and SSH. Gnome Commander also offers Root Mode, keyboard shortcuts, batch renaming, built-in search, help documentation, translations, drag and drop, directory synchronization, and a plug-in system. If you are a fan of Midnight Commander but want something a little less cumbersome than ncurses, Gnome Commander is what you need.

4: Konqueror

In the right hands, Konqueror is the Mac Daddy of file managers. Even though KDE has gone in a different direction by adopting Dolphin as its file manager, you can still use Konqueror as your primary file manager. Konqueror features all aspects of file management as well as using the KIO plug-ins to extend its feature set to include many types of protocols, such as ZIP, tar, smb, ed2k, HTTP, and FTP. With Konqueror, you can browse audio/video CDs and rip them with drag and drop. Konqueror can act as your local file manager or as a remote file manager. It enjoys a universal viewer, which enables you to view nearly any type of file from within one window. With KDE 4, you will notice Dolphin is the default file manager and Konqueror is the default Web browser. This does not mean you’re locked into this behavior. You can use Konqueror as your file manager and use another browser, say Firefox, as your Web browser.

5: Krusader

Krusader is another KDE file manager. It will be right at home on your desktop if you’re familiar with Midnight Commander or Gnome Commander. That doesn’t mean, of course, that you need to know those file managers. Krusader has a very shallow learning curve (as a good file manager should.) Krusader offers a twin view GUI with an added command line entry area at the bottom of the window. Krusader places the focus on the keyboard so you can work efficiently without having to use your mouse. Krusader offers remote synchronization, advanced search, popup panel (serves as a “third hand”), folder history, multiple panel types (view panel, disk usage panel, tree panel, preview panel, etc.), keybindings, and much more.

6: Midnight Commander

Midnight Commander was the first real file manager for the Linux operating system and is a clone of the old DOS Norton Commander file manager. Midnight Commander is an ncurses application, so it runs within a terminal window. Midnight Commander includes native support for archives, rpm and deb files, ability to connect to a remote server, embedded editor with syntax highlighting, issue commands against marked files, and more. Although Midnight Commander is an outstanding file manager and is about as versatile as they come, it has a fairly steep learning curve for what should be a simple task. But when you need a file manager on a headless server, it is worth the time and effort it takes to learn Midnight Commander.

7: Nautilus

Nautilus is the default file manager for the GNOME desktop. It’s one of the most feature-rich of all the graphical file managers to date. Not only does it include the standard features found in modern file managers and an outstanding, well-designed GUI, it offers the ability to extend its usefulness with Nautilus extensions and scripts. You can search with your Add/Remove Software utility (use the search string “nautilus”) and come up with a number of prebuilt extensions you can add to Nautilus. Some of these extensions include:

  • Nautilus Actions — Add your own menu entries using a simple configuration dialog.
  • Naultilus SVN — Add subversion functionality to your file manager.
  • Nautilus-CD — Add CD burning to Nautilus.
  • Nautilus-Dropbox — Add dropbox support to Nautilus.

Nautilus uses spatial navigation (no navigation bar), so navigating through the hierarchy isn’t as simple as you would think. There is no back, forward, or home button. Instead, when you double-click on a file or directory (from within a Nautilus window), a new window will open. This way, the parent window will always be open.

8: PCMan

PCMan is one of the faster and more lightweight of the window managers. It distinguishes itself from other file managers with one feature: tabbed windows. Like everyone’s favorite browser, you can open up multiple tabs and even move files between them. You can also open a terminal to the current working directory or as the root user. PCMan offers built-in volume management, file search, drag and drop, fast startup time, bookmarks support, support for non-UTF-8 encoded filenames, standards compliancy, and an easy to use interface (GTK+ 2).

9: Thunar

Thunar is the default file manager for the Xfce 4 desktop and also ships with the latest Enlightenment (E17). It’s incredibly lightweight, fast, and reliable. Thunar was created with the idea of extensibility in mind , so it was built with the thunarx framework. This allows you to add features like advanced properties, archives, media tags, batch rename, thumbnails, and customizable actions. You can switch the Location Selector between Pathbar and Toolbar style. You can also create customized actions within Thunar, which enables you to create new menu entries that serve specific purposes (such as a right-click menu for printing or renaming).

10: Xfe

Xfe is a simple, lightweight file manager similar to MS-Explorer or Commander. Anyone who appreciates making use of older systems or using a desktop with a minimal footprint will enjoy Xfe. Xfe offers integrated text editor, integrated text, deb, rpm, and image viewer, drag and drop between Xfe and desktop, right mouse popup menus, optional trash can, bookmarks, up to 18 languages, and much more. Xfe requires only the Fox library, so it can run on any Linux/UNIX desktop.

Wednesday, September 2, 2009

AcetoneISO

AcetoneISO, is a feature-rich and complete software application to manage CD/DVD images. Thanks to powerful open source tools such as fuseiso, AcetoneISO will let You mount typical proprietary images formats of the Windows world such as ISO BIN NRG MDF IMG and do plenty of other things.

Features

  • Mount automatically ISO, MDF, NRG, BIN, NRG without the need to insert admin password! Only single-track images are supported for the moment.

  • A nice display which shows current images mounted and possibility to click on it to quickly reopen mounted image
  • Convert 2 ISO all image types:

    *.bin *.mdf *.nrg *.img *.daa *.dmg *.cdi *.b5i *.bwi *.pdi and much more

  • Extract images content to a folder:

    *.bin *.mdf *.nrg *.img *.daa *.dmg *.cdi *.b5i *.bwi *.pdi and much more

  • Play a DVD Movie Image with Kaffeine / VLC / SMplayer with auto-cover download from Amazon

  • Generate an ISO from a Folder or CD/DVD

  • Check MD5 file of an image and/or generate it to a text file

  • Encrypt / Decrypt an image

  • Split / Merge image in X megabyte

  • Compress with High Ratio an image in 7z format

  • Rip a PSX cd to *.bin to make it work with epsxe/psx emulators

  • Restore a lost CUE file of *.bin *.img

  • Convert Mac OS *.dmg to a mountable image

  • El-Torito support to create ISO bootable Cd

  • Mount an image in a specified folder from the user

  • Create a database of images to manage big collections

  • Extract the Boot Image file of a CD/DVD or ISO

  • Backup a CD-Audio to a *.bin image

  • Complete localization for English, Italian, French, Spanish, Polish and much more!


  • Quick and simple utility to Rip a DVD to Xvid AVI

  • Quick and simple utility to convert a generic video (avi, mpeg, mov, wmv, asf) to Xvid AVI

  • Quick and simple utility to convert a FLV video to AVI

  • Utility to download videos from Youtube and Metacafe!

  • Extract Audio from a video file

  • Extract a *.rar archive that has a password

  • Quick and simple utility to convert any video for Sony PSP Playstation Portable