Monday, December 20, 2010

Where should find the trash files in ubuntu

The deleted files can be found in the hidden directory ~/.local/share/Trash

Thursday, September 9, 2010

Set ubuntu screen resolution

Thursday, September 2, 2010

Problem with [[!CDATA ]]

Sometimes when you load the xml file, you didn't get the data between the tags [[!CDATA ]]. This is the character data and you can't get with simplexml_load_file library. In that case use that function as below, so that it will escape the CDATA from url.
$xml = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA)

Thursday, August 26, 2010

Drupal Custom Module Structure

The module should place at sites/all/modules/custom

Ex: mymodule //contain module meta data
-mymodule.module //contain actual logic
images (folder)


Wednesday, August 18, 2010

Send mails from your domain

Your hosting provided need to create one mail server for your domain then only mails sent from your domain name like from :, otherwise some default mail server details displayed in mails header information.

To check is mail server set for your domain then run below commands at dos prompt.


Tuesday, August 17, 2010

Display login/register form below the post content in Drupal

Hi there,
In drupal, When we enabled the comments for blog content type and only registered users can post the comments. If user not logged in then they will see Login or register to post contents at bottom of the post. These links were redirected to a next page to login/register but it is better to display below the post, For this use below code.

function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL){
if($node->type == 'blog'){
case 'view':
global $user;
if($user->uid == 0){ //If not logged in
$node->content['show_login'] = array('#value' => drupal_get_form('user_login_block'),
'#weight' => 99);
This will display the login/register screen at the end of post for anonymous user

Thursday, August 12, 2010

Rails number format helper functions

o/p: 1200

o/p: 1200.23

Currency format in rails

number_to_currency is the helper method provided by rails action view helpers. The options were
:precision - Sets the level of precision (defaults to 2).
:unit - Sets the denomination of the currency (defaults to "$").
:separator - Sets the separator between the units (defaults to ".").
:delimiter - Sets the thousands delimiter (defaults to ",").
:format - Sets the format of the output string (defaults to "%u%n").

Using this method, we could write something like this:

<%=h number_to_currency @transaction.value, :unit => 'Rs', :separator => ",", :delimiter => "." %>

This would work fine, but here we breaking the DRY (Don't Repeat Yourself) rule, because I would need to set the same parameters in every place I was displaying currency values in my entire site. A better solution would be to have a helper method which I could use in every where in my application. So I came up with the solution below, which consists in writing my own helper method in app/helpers/application_helper.rb:

module ApplicationHelper
def real_currency(number)
number_to_currency(number,:delimiter => ".", :unit => "Rs ",:separator => ",")

Now, I can use <%=h real_currency @transaction.value %> every where in my templates.

Wednesday, August 11, 2010

about drupal teaser

A "teaser" is essentially a snippet of text designed to tell the user the content of a post without reading the entire post. Since most writers have embraced the common journalistic style of explaining the nature of an article in the first paragraph, teasers work well for most articles.

Here's what happens:

1) A node contains an entire article.

2) Drupal's "teaser" function, "node_teaser," strips the first x number of words from the article and makes it available as content. The exact length is determined by the values the admin sets in Drupal's settings page.

3) So, you list a bunch of articles on a page. You want the articles to display only a snippet of text from the full article, so that you can fit a bunch of articles on a page without requiring the user to page down through tons of text. If the user likes the "teaser" content of the article, they will click on the article's title and see the full content of the article on its own page. In a sense, teasers function like summaries of an article, except that the software decides where to cut off the text. If you want to determine where a teaser article ends, you can insert the comment tag to instruct Drupal exactly where to fashion the break between full text and teaser text.

Tuesday, August 10, 2010

Cross domain data exchange

You can use XML language to transfer large data from one domain to other. Suppose domain-x wants to send data from its database to domain-y. Then domain-x will generate xml file for the database and send it to the domain-y via post method for security purpose. Upon receipt of xml file from domain-x, the domain-y will store that xml file in one folder and create one new row in received_xml table, and call a xmlparser script through cron job to extract information from the xml files and store in database and then move that parsed xml file to some other folder(named like parsed) and remove the record from receive_xml table.

For parsing there are so many free scripts available in php,ruby etc., xmltoarray is one of the technique.

Cron job commands to run shell script, ruby script and php script

Cron job commands to run different Scripts

Time to run - Command
[ Minute - Hour - Day - Month - Weekday ] - Command

Times pattern
* * * * * => Execute every minute
0 * * * * => Execute every Hour
0 0 * * * => Execute every mid-night
0 0 0 * * => Execute every Month
0 0 0 0 * => Execute every Weekday
*/5 * * * * => Execute every 2 minutes
0 */2 * * * => Execute two Hours

Commands can be broken down as

######Run PHP Script#########
/usr/local/bin/php -q /home/tom/public_html/cron/maintenance.php

######Run Ruby Script#########
#Ruby cron job setting. Ruby will run cron jobs through script runner.
/usr/local/bin/ruby /home/inkkdds1/inkakinada/script/runner /home/inkkdds1/inkakinada/app/cron_job_database.rb
#ruby-path script-runner-path ruby-file-path

######Run Shell Script#########
cd /home/devinka/public_html/spocosy/ && sh
#cd to application-path && sh shell-script-path

Linux Shell Scripting Secrets

Monday, August 9, 2010

Very Usefull Ruby on Rails URLs

10 Reasons to learn ruby

Awesome ruby tidbits

Web based deployment using webistrano

Thursday, August 5, 2010

URL push and URL pull to send / retrieve information between cross domains

Hello friend,
Today I have done a small but very useful functionality i.e URL push and URL pull means you can send information to remote url and retieve information from other url. Getting information is easy and i think all developers know it, but sending information is little tricky when we don't know how the post variable names.
Below is the code to track the post parameter names and values in targetsite.
foreach($_POST as $key=>$value)
echo $key.'='.$value.'
key = value
key = value
So here in foreach loop you will get the post param names and values. So you can store in db with table structure as id autoincrement, key, value, referrer,posted_on. OR use xml file to store the information in structured way like valuevalueetc..,

form action="" method="post"
Name:input type="text" name="name"
Address:input type="text" name="address"
Email:input type="text" name="email"
input type="submit" value="Submit"

When user submits the above form the remote script (i.e mentioned in form action will execute) here it is at
foreach($_POST as $key=>$value)
echo $key.'='.$value.'
name = postedname
address = postedaddress
email = postedemail

Tuesday, August 3, 2010

Don't do more work than you have to - Use auto deploy tools


Human beings can't remember everything but machines can. Everyday you work on a project and changed many files and altered database tables but forgot some things to update in live server while depoloying code. Use some third party tools to deploy your php applications without missing small change or db updates. There are many such tools available, capistrano is one of the famous tool for automate the deployment process. Many people think it is only for RoR applications deployment but it is for all. You can find more info for how to auto deploy php applications with capistrano from here

Friday, July 30, 2010

Auto update Database from one server to another or developement database to live database

The below shell script will take the database backup and uploaded to the svn server. Call this script through cron job so that it will auto execute and send the dbbackup to the svn repo where ever you want. From svn you should auto deploy code to the sever, so run the cron tab in the target server and execute a script which empty the current database and update with this new one. Mostly usefull in while working with drupal, In drupal many things are stored in database instead of files, so that while you developing application, database also updated daily for each module addtion and upgradation etc., So developement database and live database are varies frequently. You can update the files easily using svn but can't update db because we don't know the every change in db while working. In this situation use the below shell script it will update the live database with your development database.

# Configuration

# Database connection information
dbhost="localhost" # leave as is unless have specific reason to change

# Dump associated information
dump_directory="/path/to/sql/directory" # path to dump dir NO FILE NAME, note end slash
logfile=$dump_directory"dumpandcommitt.txt" # name of log file to use

# dump db and log on screen and in log file
cd $dump_directory
mysqldump --user=$dbuser --password=$dbpw --add-drop-table $dbname > $dump_name
echo " Dumped drupal database, using user:$dbuser; database:$dbname host:$dbhost"
echo " Dumped drupal database, using user:$dbuser; database:$dbname host:$dbhost" >> $logfile

# commit the newly dumped db - note you'll need to svn add to repository first before this will work
svn commit -m "auto committed db"
echo " Committed new db"
echo " Committed new db" >> $logfile

echo "Backup completed $endtime" >> $logfile

Save the above script as
In terminal call as
$ ./

Change mysql table storage engine

Using sql query:
ALTER TABLE products ENGINE = innodb

Using phpmyadmin (GUI) select the table and then do as below images

About Foxycart

Foxycart is a third party service which offer ecommerce solution for your products by just creating account in foxycart and small configurations. After that we should integrate simple form in our own application and submit product details to the foxycart. Then it will take care of the checkout and payment process and send back the transaction details as xml datafeed. And logged all errors and complete information, so that we can see them through foxycart admin section by login and can maintain multiple stores.
Features list:

Thursday, July 29, 2010


Can you find how many faces are there in this tree.

Detect website virus using firefug

Hi Friends,

If your website get attacked with virus, then you can detect it using the firefox's firebug addon. The common virus attack on websites are adding some unnecessary scripts or iframes within your source code. You can open the site and open the firebug and click on net tab. It will show the un related code in red color with border as show in the below image

Useful URLs for Drupal

Easy Version Control with Git

Drupal Development Best Practices: Tools

Unit testing

Test driven development in drupal

Deploy with capistrano


Bookmarks Menu

Recently Bookmarked
Recent Tags

Get Bookmark Add-ons

Ubuntu and Free Software links

Information and resources about Ubuntu, Debian and Free Software in general

Ubuntu Wiki (community-edited website)
Make a Support Request to the Ubuntu Community
Debian (Ubuntu is based on Debian)

Mozilla Firefox

Help and Tutorials
Customize Firefox
Get Involved
About Us

jCarousel Lite
jCarousel Lite is a jQuery plugin that carries you on a carousel ride filled with images and HTML content. Put simply, you can navigate images and/or HTML in a carousel style widget. It is super light weight, at about 2 KB in size, yet very flexible and customizable to fit most of our needs.
nyroModal :: jQuery Plugin
jQuery UI - Dialog Demos & Documentation
jQuery UI is the official jQuery user interface library. It provides interactions, widgets, effects, and theming for creating Rich Internet Applications.
[SOLVED] strip out image attributes using preg_replace
[SOLVED] strip out image attributes using preg_replace
Home |
Resetting a forgotten MySQL root password
Tips for a Debian GNU/Linux System Administrator.
Wilderness |
odd behavior when checking if radio button selected in jQuery - Stack Overflow
How to disable directory browsing , APACHE
Blue Flame | Drupal Themes by TopNotchThemes
Page overview with mission statement and three column layout, also content top regionAn alternate page layout, with single left sidebarLower regions, comments, and footer menu and messageHeader showing secondary links, as well as alternate layout with
Drupal Commans
Modules | Drupal Moodle Integration Demo
Using Rss
Overview of Google Reader and RSS

Bookmarks Toolbar

Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar

Most Visited
Getting Started


Using CVS to maintain a Drupal website |
###Overriding themable output |
How Drush Make Just Changed My Life | Drupaler | Drupal Blog, Collaborative Drupal Resource
This is a blog post about Drupal.
Drush - Drupal Shell utility | | A command line shell and scripting interface for Drupal.
Customizing the login form |
Customizing the login, registration and request password full page layout |
Modifying Forms in Drupal 5 and 6 | Lullabot
How to theme a Drupal form | Open Data
####AJAX-ifying Drupal Node Forms | Stella's Website
####Features |
Drupal - How to Theme CCK Input forms | Haro Street Media
Hottest 'drupal' Questions - Stack Overflow
Core templates and suggestions |
Search config |
Custom Search |
#################Drupal Tutorial: Form Overrides and Element-Specific Validations | CHROMATIC
This step by step illustrated Drupal tutorial will teach you how to create custom form overrides and element-specific validations with Drupal 6.
###Custom role-dependent User Profies
####### Different Signups for Different Roles Auto Assign Role |
Mastering Drupal
Starting Views 2 Documentation |
########15 Userful Views Module for Drupal -
##########Views help index | Views online help
########Creating a module configuration (settings) page |

New Folder

Comparison of Lightbox-type modules |
Contributer stella |

Latest Headlines


### Use the YouTube API with PHP
The YouTube video sharing site allows Web application developers to access public content through its REST-based developer API. The SimpleXML extension in PHP is ideal for processing the XML feeds generated by this API and using them to build customized PHP applications. This article introduces the YouTube Data API, demonstrates how you can use it to browse user-generated video content; access video metadata, comments and responses; and perform keyword searches.
How-To: Fix SimpleXML CDATA problem in php - Tech Thought
Developer's Guide: Data API Protocol – API Query Parameters - YouTube APIs and Tools - Google Code
Sky is not the limit...
Hacking using PHP | The Storyteller


HowTo: Make Ubuntu A Perfect Mac File Server And Time Machine Volume [Update6] › Kremalicious
For quite some time I use my Ubuntu machine as a file and backup server for all Macs in my network which is perfectly accessible from the Finder in Mac OS X. There are some instructions available in the web for this task but all failed in my case so I wrote my own tutorial [...]
Ubuntu's two big advantages over Windows and Mac | ZDNet
There are two very important areas where Ubuntu Linux has significant advantages over both Windows 7 and Mac OS X. See what they are and join the disc
Useful Links | Stella's Website
### SlideShare » Developer Documentation


Using jQuery with Other Libraries - jQuery JavaScript Library

Unsorted Bookmarks

Using Drush to synchronize and deployment drupal sites

Hi Friends,

We can deploy drupal site with different stages like development, testing and production using drush (Drupal shell) and synchronize remote application with local development version.

Ex: drush sql-sync @dev @prod
The above command will Copy the DB defined in sites/dev to the DB in sites/prod.

More info.

Drush official website:

Other drupal useful development tools

Unit testing

Tuesday, July 27, 2010

Artister - An automated web design tool for joomla, drupal and wordpress theming

It is the first and only tool for web design automation that creates fantastic eye appealing websites templates and themes for joomla, wordpress and drupal.

With Artisteer YOU immediately become a Web design expert, editing and slicing graphics, coding XHTML and CSS, and creating Web Design Templates, Joomla templates, Drupal themes,
Wordpress themes, DotNetNuke skins, and Blogger templates all in minutes, without Photoshop or Dreamweaver, and no technical skills.

Official website:

Xcloner - For backup and restore Joomla, Drupal, Wordpress and All PHP/Mysql Websites

Hellow friends,

Xcloner is a tool to backup and restore feature for Joomla, Dupal, Wordpress and all PHP/Mysql Projects. You should should like xcloner for wordpress etc., in google for more info.

For Wordpress

For Joomla

Wordpress Vs Joomla Vs Drupal

It is just for blogging systems and few cms pages manage through WYSIWYG Editor without more complex form fields integration.

Wordpress Pros
* Simple to use - No need for modifications
* Excellent for blogging or sharing thoughts in a sequential manner
* Even the most elderly of users can get the hang of it quickly

Wordpress Cons

* Not developer friendly
* The community seems to like to complain
* Upgrades bring more bugs than fixes sometimes

It is for developers and can hand-code the content of your pages than use a WYSIWYG Editor, or if you enjoy tweaking the code that makes up the framework of a website, then Drupal is probably for you.

Drupal Pros

* Extremely developer friendly. If I loved code more I would almost always pick this system.
* Strong community to help discern the dozens (hundreds) of functions and tags available.
* Can be used to create some really awesome websites that can outperform a majority of other sites out there.

Drupal Cons

* Not very designer and user-friendly. It's hard for someone with little code knowledge to make the leaps required to do the very cool things that Drupal is becoming known for.
* Theming of Drupal has been a huge case of fail (until recently). Probably because it has been developers, not designers, that are making the themes.
* Getting a Drupal website published could cost you more time, and thus more money, than Wordpress or Joomla.

It is userfriendly for all type of people i.e designers, developers and admins. Where as it is not so powerful as compare to Drupal.

Joomla Pros

* Friendly for all types of users - Designers, Developers and Administrators
* Huge community is awesome for assisting with creation of websites
* Has been rapidly growing and improving itself for the past three years

Joomla Cons

* Still not user-friendly enough for everyone to understand
* Not quite as powerful as Drupal, and can be a bit confusing for some to jump into
* Recently rebuilt the entire system from ground-up, and so there are still many out there sticking to the old versions (1.0.x)

Drupal Modules: DrupalModules Best Modules BestRank Noupe Appnovation GUI Designer

Drupal Themes: Theme Garden FreeDrupalThemes ThemeBot Mulpo MogDesign GeekTip

Joomla Modules/Extensions: 10 Best Free Joomla21 AJAXLine evoHosts

Joomla Templates: BestofJoomla TemplateMonster Joomla24 Freetemplates

Wordpress Plugins: SiteSketch WPHacks VisionWidgets Sadhas BestWordPressPlugins

WordPress Themes: bestwpthemes PageLines TopWPthemes Themes2WP LeVoltz