Saturday, May 26, 2012

Hitman blood money, High compressed @ 260 mB

For Best Download....For Hitman lovers..........

Wednesday, April 18, 2012

Resume Template Creative

Google Docs provide templates for almost all the Documents, Presentations.

Creative Resume Template:


Sunday, January 8, 2012

Problem viewing Tamil fonts in chromium on Ubuntu

Problem viewing Tamil fonts in chromium on Ubuntu

Try this fix:
  • Goto the directory /usr/share/fonts/truetype/freefont/
  • Delete both the FreeSerif.ttf and FreeSans.ttf file.
sudo rm -f /usr/share/fonts/truetype/freefont/FreeSerif.ttf
sudo rm -f /usr/share/fonts/truetype/freefont/FreeSans.ttf


Monday, December 12, 2011

Ajax modal windows, the easy way- Drupal Ctools Curtosey

Ajax modal windows, the easy way

Last week I wrote about the awesomeness that is the CTools ajax framework. If you’re anything like me, your mind immediately started racing about all the cool possibilities this opens up. One of those cool possibilities is yet another hidden CTools gem, the modal framework. If you’ve ever used panels, then you’ve seen CTools modals in action. In this post, I’ll show you how to use modals, in the same way that panels does.

First things first…

If you missed my last post, chances are that this one will not make any sense. I highly suggestreading it before continuing with this one.
We will be building a very simple module with two pages. The first simply holds the link to the modal window, the second is the page that will be displayed in the modal. Lets start with some basic code to set up our test module. This is almost identical to the ajax module we built last week. The biggest difference here, is that the class on the link has been changed to ‘ctools-use-modal’ and we are adding the javascript using ctools_modal_add_js().

example.module, part 1
 * Implementation of hook_menu().
function example_menu() {  
  $items = array();
  $items['test'] = array(
    'title' => 'Ajax Test',
    'page callback' => 'example_test_main',
    'access arguments' => array('access content'),
  $items['test/%ctools_js/go'] = array(
    'page callback' => 'example_test_modal_callback',
    'page arguments' => array(1),
    'access arguments' => array('access content'),
  return $items;

 * The main page that holds the link to the modal.
function example_test_main() {
  // Load the modal library and add the modal javascript.

  $output = l('Load modal content', 'test/nojs/go', array(
    'attributes' => array('class' => 'ctools-use-modal')));

  return $output;

All that is left is to define the modal callback. Since we are using the %ctools_js wildcard, this same callback will be responsible for the content in both modal and non-modal states. Remember that the %ctools_js wildcard will be translated to a boolean value in which TRUE signals that we are in a javascript context.

example.module, part 2
function example_test_modal_callback($js = FALSE) {
  $output = t('<p>Lorem ipsum dolor sit amet...</p>');
  $title = t('Modal example');
  if ($js) {
    ctools_modal_render($title, $output);
    // above command will exit().
  else {
    return $output;

The code above is about as simple as it gets with modal windows. It simply outputs some text and a title in a modal window. The modal library provides a nice utility function for this, ctools_modal_render(). The function builds the necessary ajax command object and passes it to the browser using ctools_ajax_render().
But now for something not so trivial. Arguably the best use case for modal windows is for displaying forms. This is where the modal library really excels. In this example, we will show the user login form in a modal. Your first impulse might be to just send the output ofdrupal_get_form() to the modal. While this would display the form in the modal, it would not handle all of the submission and validation properly. Normally Drupal form submissions end in a redirect, which would break our ajax callbacks. Luckily, CTools has an answer for this situation. In the ajax context, we use ctools_modal_form_wrapper() to build the form. The one tricky part here, is that we must evaluate the return value of this function. This function returns an array, that may or may not be populated with ajax commands. If the form submission was not completed for any reason, such as validation errors, then the array will have the commands needed to re-display the form, with errors, in the modal window. If the array is empty, then we can assume that the form was submitted properly. In this case, we add one or more ajax commands to the array to let the user know that the form submitted successfully. In the case of our login form, we do that by redirecting the user to their account page.
One thing I forgot to mention, is that ctools_modal_form_wrapper() expects you to pass in a form_state array. drupal_get_form() allows you to pass in additional arguments after the form id, but the ctools form functions expect all arguments to be passed through the form_state array. In the case of modal forms, the form_state must contain at least an ‘ajax’ and a ‘title’ element.

example.module, part 3
function example_test_modal_callback($js = FALSE) {
  if ($js) {
    $form_state = array(
      'ajax' => TRUE,
      'title' => t('Login'),
    $output = ctools_modal_form_wrapper('user_login', $form_state);
    if (empty($output)) {
      $output[] = ctools_modal_command_loading();
      $output[] = ctools_ajax_command_redirect('user');
  else {
    return drupal_get_form('user_login');

Hopefully, I’ve explained enough so that you can understand what is going on in the above function.

Dialog API

So here is where I will diverge a little bit. While using the CTools modals, I kept wishing that I could use the jQuery UI Dialog widget as the front-end for my modals. So I took the time to build it. Dialog API aims to be functionally equivalent to the modal library, except that it uses jQuery UI. The ajax commands that it exposes are all nearly identical to their modal equivalents, except that the display command allows you to pass an array of options to the Dialog widget. This allows you to control things like height and width from the ajax callback.
And thanks to the insane work of Rob Loach, Dialog API already has a Drupal 7 port. Very exciting stuff.

Ajax without Javascript Ctools Drupal

Ajax without Javascript


Ajax is nothing new. And especially since Drupal’s adoption of jQuery, ajax has certainly become much easier. Generally, ajax requests in Drupal involve
  • PHP code (usually in a module) to generate the necessary markup for the originating page.
  • Javascript code to handle the ajax response.
  • Some form of initialization code, usually in a Drupal behavior, to connect the markup to the behaviors.
  • PHP to generate the response, both for the ajax request and for the non-javascript page. (Oh, and it’s up to you to decide how to tell the difference!)

Let the Chaos begin

There’s nothing inherently wrong with the above method, but there’s definitely room for improvement. With the introduction of CTools (a.k.a Chaos tool suite), ajax development has become much simpler. From the CTools project page on,
"AJAX responder -- tools to make it easier for the server to handle AJAX requests and tell the client what to do with them."
CTools introduces the concept of an ajax command. A command is a javascript function within the Drupal.CTools.AJAX.commands namespace, which can be invoked as an ajax response. The server-side callback returns an object representation of a command, and this object contains everything necessary to run the command on the client-side. The easiest way to explain this is with an example.
We will be building an example module, which I will call “example”. This module will display a page with an ajax link that will reveal more content when clicked.
The first thing that is needed is a hook_menu() implementation to define two new paths. The first is the page that will hold the link, and the second defines the ajax callback. Take note of the %ctools_js in the second entry. This is how we will determine if the call is being made from an ajax call or not. More on that when we get to the callback code.
example.module, part 1
 * Implementation of hook_menu().
function example_menu() {
  $items = array();
  $items['test'] = array(
    'title' => 'Ajax Test',
    'page callback' => 'example_test_main',
    'access arguments' => array('access content'),
  $items['test/%ctools_js/go'] = array(
    'page callback' => 'example_test_ajax_callback',
    'page arguments' => array(1),
    'access arguments' => array('access content'),
  return $items;   
Now for the main page callback. The only output on this page is a link to the second path that we defined. The link has two things to take note of. First, the path of the link is test/nojs/go. The ‘nojs’ portion of the path will be replaced with ‘ajax’ when an ajax call is made. This distinction is how we detect if the callback is being called from an ajax request or not. The second thing to note is that we add a class of ‘ctools-use-ajax’ to the link. This tells the ajax-responder javascript that this link should be processed by the ajax responder. And finally, we must include the ajax-responder javascript.
example.module, part 2
function example_test_main() {
  $output = l('Load more content', 'test/nojs/go', array(
    'attributes' => array('id' => 'test-ajax-link', 'class' => 'ctools-use-ajax')));

  return $output;
Last but not least, the ajax callback. Notice how the function takes a boolean parameter for $js. CTools takes care of turning the strings (‘nojs’ or ‘ajax’) into a boolean, so we have a very clean way to determine how to respond. We will be returning the same content, in both conditions, to maintain accessibility for non-javascript enabled browsers (for progressive enhancement as well as SEO).
example.module, part 3
function example_test_ajax_callback($js = FALSE) {
  $output = t('<p>Lorem ipsum dolor sit amet...</p>');

  if ($js) {

    $commands = array();
    $commands[] = ctools_ajax_command_after('#test-ajax-link', $output);
    $commands[] = ctools_ajax_command_remove('#test-ajax-link');

    // above command will exit().
  else {
    return $output;
In the javascript branch of the conditional, we construct an array of command objects. Luckily for us, CTools offers a complementary php function for each javascript command, so creating the commands array is simple. The particular set of commands that we are using will add the output after the link, then remove the link. You can add as many commands as needed. The last thing to do, is to pass the commands array through ctools_ajax_render, which will output the commands array as JSON and exit. From that point on, the ajax-responder javascript on the first page takes over, and executes the commands in the order they are received.


And that’s it. No javascript, just commands. CTools provides many commands for most of the basic javascript actions, from which you can build compound actions to do almost anything. Obviously, this set of commands cannot possibly cover every possible option, but I’ll leave that for another day. Until then, here is the list of ajax commands provided by CTools.
  • replace (ctools_ajax_command_replace)
    • selector: The CSS selector. This can be any selector jquery uses in $().
    • data: The data to use with the jquery replace() function.
  • prepend (ctools_ajax_command_prepend)
    • selector: The CSS selector. This can be any selector jquery uses in $().
    • data: The data to use with the jquery prepend() function.
  • append (ctools_ajax_command_append)
    • selector: The CSS selector. This can be any selector jquery uses in $().
    • data: The data to use with the jquery append() function.
  • after (ctools_ajax_command_after)
    • selector: The CSS selector. This can be any selector jquery uses in $().
    • data: The data to use with the jquery after() function.
  • before (ctools_ajax_command_before)
    • selector: The CSS selector. This can be any selector jquery uses in $().
    • data: The data to use with the jquery before() function.
  • remove (ctools_ajax_command_remove) * selector: The CSS selector. This can be any selector jquery uses in $().
  • changed (ctools_ajax_command_change)
    • selector: The CSS selector. This selector will have ‘changed’ added as a clas.
    • star: If set, will add a star to this selector. It must be within the ‘selector’ above.
  • alert (ctools_ajax_command_alert)
    • title: The title of the alert.
    • data: The data in the alert.
  • css (ctools_ajax_command_css)
    • selector: The CSS selector to add CSS to.
    • argument: An array of ‘key’: ‘value’ CSS selectors to set.
  • attr (ctools_ajax_command_attr)
    • selector: The CSS selector. This can be any selector jquery uses in $().
    • name: The name or key of the data attached to this selector.
    • value: The value of the data.
  • settings (ctools_ajax_command_settings) * argument: An array of settings to add to Drupal.settings via $.extend
  • data (ctools_ajax_command_data)
    • selector: The CSS selector. This can be any selector jquery uses in $().
    • name: The name or key of the data attached to this selector.
    • value: The value of the data. Not just limited to strings can be any format.
  • redirect (ctools_ajax_command_redirect) * url: The url to be redirected to. This can be an absolute URL or a Drupal path.
  • reload (ctools_ajax_command_reload)
    • submit (ctools_ajax_command_submit)
    • selector: The CSS selector to identify the form for submission. This can be any selector jquery uses in $().

Sunday, October 9, 2011

Metacity - Community Ubuntu Documentation

Metacity - Community Ubuntu Documentation:

Parent: Applications


Metacity was the default GTK2 Window Manager for Ubuntu. Metacity compositing was introduced in Ubuntu 8.10 Jaunty. Some of the most familiar tasks handled by Metacity include window management, keyboard shortcuts, and themes.

Starting Metacity

Metacity is installed and enabled by default. The compositing feature must be enabled after installation. If compositing is enabled two features are evident: shadows will appear around window edges, and when using ALT-Tab to switch windows a thumbnail of each window, rather than a static icon, is seen. Refer to the Configuration section for instructions on how to turn on compositing.
Metacity runs by default unless the user has made a change to the system (for instance, running Compiz). If Metacity was turned off and the user wishes to restart it:
  • Open the Appearance Preferences applet:
    • via the Main Menu - System > Preferences > Appearance, or
    • via terminal - (Applications > Accessories > Terminal or ALT-F2) and enter:
    • Once the Appearance tab is open by either method, select the Visual Effects tab and click on None.
    • Note: Selecting a choice other than None will exit Metacity and start Compiz if hardware permits.
  • With the command below entered in a terminal or in the ALT-F2 Run Command window:
    metacity --replace 

Configuring Metacity

The user's Metacity configuration settings are stored in .xml files in various subfolders of ~/.gconf/apps/metacity. There are five major components, discussed below.

General Settings

The general section contains settings which control the Titlebar fonts, compositing, window focus, and certain mouse click actions. This section also sets the some button layouts and themes, and enables/disables compositing.
There are three ways to change the general settings.

A. The Main Menu:

System > Preferences > Windows

* A GUI Windows Preferences applet will open.

* A few basic options are available for change, such the action to be accomplished when the mouse is double-clicked.

* The Movement Key section allows the user to hold the specified key and use the mouse to drag a window when clicked anywhere on the window. If not enabled, the mouse will only drag the window if held on the titlebar.

System > Preferences > Keyboard Shortcuts

* A GUI Keyboard Shortcuts applet will open.

* Options which can be changed in this area include minimize/maximize key combinations, windows workspace movement, and window switching.

* Changes in the Window Managementsection will update Metacity settings.

* To make a change, select the line and press the desired key combination. No typing is required.

* To remove an entry, highlight the line and press the backspace key.

B. Configuration Editor

This GUI editor is the primary method of investigating and controlling Metacity settings. All existing options are available for editing and new options can be created from within the Configuration Editor.
To open the Configuration Editor, navigate to Applications, System Tools > Configuration Editor or in terminal run:
  • gconf-editor /apps/metacity
  • If you do not see the System Tools menu, enable it by right clicking the Main Menu icon or bar and selecting Edit Menus. Highlight System Tools in the left pane and select Configuration Editor in the right panel. Once enabled, press OK.
  • In the left panel tree view, navigate to /apps/metacity/general. In this section, you will find a variety of selections to modify general windows behavior and set the number of workspaces.
    • In the left section is the tree view (apps/metacity/general).
    • In the upper right section are the names of the settings and their and present values.
    • In the lower right section is an explanation of what the selection controls and information on possible inputs.
  • To make a change:
    • For string entries, either right click the entry in the Name column and select Edit key, or double click the Valuewindow. Type a new value. For some inputs, possible values are listed in the lower right pane.
    • For check box entries, click on the check box to select or deselect the option.
    • To reset the value to the default entry, right click anywhere on the appropriate listing in the right panel and selectUnset Key.

C. Terminal

  • The command takes the form of:
    # gconftool-2 -s --type type keyname 'value'
    • The command always starts with gconftool-2 --set or gconftool-2 -s
    • type is int, bool, float, string, list, or pair. This can also be entered as "-t type".
    • keyname is the path and name of the command. If you have the Configuration Editor open, you can view it in the lower right panel in the Key name: block.
    • value is the entry normally made in the Value block (a string, true or false, or an integer), placed between quotation symbols if there is a space in the input field.
  • Example:
    gconftool-2 -s -t string /apps/metacity/general/titlebar_font 'Sans Bold 10'

Metacity Compositing

Originally available in Compiz but not Metacity, compositing became a part of Metacity with Gnome 2.24 and was incorporated into Ubuntu 8.04 Hardy. Compositing permits advanced visual effects by using buffers and manipulating the images before they appear on the screen. In Metacity, these effects include window shadowing, smoother window movement, and thumbnail views when using ALT-Tab to switch between windows.
  • To turn compositing on, open the Configuration Editor as described previously and go to /apps/metacity/general. Select the compositing_manager or use the terminal:
    gconftool-2 -s --type bool /apps/metacity/general/compositing_manager true   # or metacity -c


The Global keybindings section consists of default and user-configurable keybindings.
  • Some of the default settings include:
    Forward cycle window focus

    Backward cycle focus

    Cycle window focus without a popup window

    Ctrl-Alt-Left Arrow
    Previous workspace

    Ctrl-Alt-Right Arrow
    Next workspace

    Minimize/unminimize all, to show desktop
  • Technique: Before changing a key combination, the user may wish to test the new combination to ensure it is not already assigned to another command or action.
  • The default global keybindings may be changed by the user by clicking on the value and entering a new key or key combination.
  • To reset the global keybinding the to default value, right click anywhere on the applicable line in the right panel and selectUnset Key.
  • Normal values in this section include , , , , F1-F12, letters and Escape. You can view pre-existing values or look in the lower right information section for appropriate entries. Letter entries are case-insensitive.
  • The run_command_N is associated with a key combination in this section. The command actually executed byrun_command_N is determined by entries in the next section (keybinding_commands).


Metacity provides blank command_N entries, with N being a numeral 1 through 12. These can be set by the user. Therun_command_N key combination value in this section is combined with the corresponding global_keybindings command in the previous section to create a customized keyboard shortcut. An example is presented later in this section.
  • If the command in the Value field is not in the user's $PATH, include the full path to the command.
  • The default screenshot application is designated in this section and will be started when the Print Screen key is pressed. metacity.keybinding.gimp.png

Practical Keybinding Example

A user wishes to use the G key combination to start the GNU Image Manipulation Program (Gimp). Refer to the previous screenshots for reference.
  1. Test the G key combination to ensure it is not already assigned.
    • You could also perform a search in the Configuration Editor with: Edit > Find > Search for: G and enableSearch also in key values.
    • Repeat the search for g, G, and g
  2. Open the Configuration Editor from the Main Menu: System Tools > Configuration Editor.
  3. Select a run_command in apps/metacity/global_keybindings. In this example, we choose run_command_2.
    • Currently unassigned key combinations will have a value of disabled.
    • Double click the highlighted entry in the Value column or right click the highlighted entry in the Name column and select Edit Key....
      • Type G in the entry window. Press ENTER to store the value.
      • Letters are NOT case sensitive in key combinations. g is the same as G for the key combination only.
  4. Select apps/metacity/keybinding_commands in the left pane and command_2 in the right pane.
    • Double click the highlighted entry in the Value column or right click the highlighted entry in the Name column and select Edit Key....
    • Enter the run command for the desired action. In this case, gimp
      • Note: For some applications, it may be necessary to include the complete path to the run command of the application.
    • Press ENTER to store the entry.
  5. Test the command by simultaneously pressing G.
  6. Exit the Configuration Editor if you are done.
If you prefer the terminal, or would like a demonstration of it's power, you can do the same thing with:
  1. Open a terminal: Applications > Accessories >Terminal.
  2. Run the following two commands:
    gconftool-2 -s -t string /apps/metacity/global_keybindings/run_command_2 'G' gconftool-2 -s -t string /apps/metacity/keybinding_commands/command_2 'gimp' 


This section assigns key combinations for moving, closing, and sizing windows. Keys can also be assigned to move a window to specific workspaces.
  • Super is the designation for the key often referred to as the Windows key.
  • KP_ refer to keypad keys.
  • Some of these settings may be changed via the System, Preferences, Keyboard Shortcuts applet.


  • metacity.workspace.png
    Names can be assigned to workspaces in the Metacity section above.

    To display workspace names make sureShow workspace names in switcher is selected after the names have been entered in Metacity.

    The graphic to the right displays the lower right portion of a default monitor display with the Preferences of the Workspace Switcher called up with a right mouse click. Note the 4 workspaces have been named Home, Work, VMs and Terminalby Metacity and are displayed in the lower panel.
    Note: The number of workspaces is set in the general section.

Metacity Themes

Themes control window frame options, colors, controls, icons, pointers and more. Ubuntu provides the ability to easily add, remove and customize a wide variety of themes. The default theme of an installation can be changed with just a few clicks of your mouse. Installed themes are normally stored in the /usr/share/themes folder. User installed themes are normally found in the ~/.themes folder.
  • metacity.theme.png

Installing & Selecting Themes

Themes can be installed by a variety of methods.
  • Several themes come pre-installed on an Ubuntu distribution. They are accessed via the Main Menu's System > Preferences > Appearance: Theme tab. The new theme takes effect as soon as it is selected.
  • Synaptic Package Manager (System > Administration > Synaptic Package Manager). In the Quick search window in the upper menu area, search for metacity theme and you will find a variety of themes which you can install. Synaptic will download and install the themes in the correct folder. They can then be selected from the Appearance: Theme tab discussed earlier.
    • Some themes downloaded via Synaptic depend on other themes which may not be installed. If you try to use one of these themes, you will get a message in the Appearance tab telling you what other theme must be installed.
    • Themes installed via Synaptic are removed via Synaptic or via terminal command executed as root.
  • Third Party Themes. Many themes are available from third parties.
    • Themes should be packaged as a tar.gz files.
    • If the installation of a theme is successful you will will be informed. If the theme installation requires other packages to function properly you may be notified during the installation. Failed theme installations will not display in the available themes window; a failure notification may or may not be presented.
    • Once correctly installed, the theme will be available for selection in the Appearance tab.
    • To install a theme:
      • Download the package.
      • Locate the downloaded file and ensure it is in the proper format - .tar.gz
      • Open the Theme tab via the Main Menu (System > Preferences > Appearance).
      • Select Install and navigate to the file location (normally the user's Desktop) to install the theme.
      • The Theme applet will extract the theme and place the theme's folder in the user's ~/.themes folder.
    • Several links to theme collections are provided at the end of this page.

Customizing Themes

Not only can users download or create their own themes, Ubuntu allows users to customize existing themes.
  • To customize a theme, navigate to the Theme tab via Main Menu > System > Preferences > Appearance.
  • Press the Customize tab and select the theme you wish to modify.
    • Make selections from any or all of the available categories: Controls, Colors, Window Border, Icons, and Pointer.
    • The user can combine individual items from different existing themes. Custom themes saved in this manner are placed in the user's .themes folder (~/.themes).
    • Selecting OK after making any change will create a theme named Custom. This or any other theme can be renamed by highlighting it, selecting Save As, and entering a new name.

Creating Themes

Users can create their own themes by customizing existing themes as described earlier or build themes from scratch. There are many sites that describe the process. Here is the the theme tutorial.

Removing Themes

  • System themes (default themes and those installed with Synaptic) can be removed via Synaptic or by removing the individual folder and subfolders from /usr/share/themes.
  • Themes installed by the user may deleted using the Delete key in the Appearance tab or by removing the applicable folder/subfolders from the user's .themes folder (~/.themes)

Metacity & Compiz

Some users seeking advanced effects turn from Metacity to Compiz, while others switch from one to the other depending on what they are doing on their computers. Compiz is installed on the initial Ubuntu installation in Ubuntu 9.04 Jaunty, while Metacitynow includes compositing.
For users who intend to switch to Compiz, or those who plan on using both, there are several applications which can make things simpler. While this page is not devoted to Compiz, Metacity users who occasionally use Compiz will also benefit from installing these applications.
Install fusion-icon and compizconfig-settings-manager via Synaptic or run the following command:
  • sudo apt-get install fusion-icon compizconfig-settings-manager
  • fusion-icon fusion-icon.png This panel applet allows the user to quickly switch between Metacity and Compiz as well as allowing the user to select which window decorator (compiz-decorator or gtk-window-decorator) Compiz employs.
    • Start this applet by running fusion-icon in a terminal or selecting Applications > System Tools > Compiz Fusion Icon. This will start Compiz and place the fusion-icon on the panel for easy access.
    • A right-click on the fusion-icon panel icon allows selection of the GTK Window Decorator, the Window Manager (Metacity or Compiz), reloading the Window Manager, and quick access to the CompizConfig Settings Manager.
  • compizconfig-settings-manager. This GUI application allows access to Compiz's extensive menu.
    • Start this application via System > Preferences > CompizConfig Settings Manager or running ccsm in a terminal.
    • The GTK Window Decorator can be enabled in the Effects, Window Decoration section.
      • The Compiz decorator default setting is /usr/bin/compiz-decorator
      • To use the GTK decorator, change the value to gtk-window-decorator --replace

External Links