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

http://techblissonline.com/ubuntu-804-set-default-resolution-1024-768-virtual-pc-2007/

Friday, September 3, 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)

Friday, August 27, 2010

Drupal Custom Module Structure

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

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

mymodule.module

Thursday, August 19, 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 : mail@mysite.com, 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.

ping smtp.mysite.com
and/or
ping mail.mysite.com

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'){
switch($op){
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);
}
break;
}
}
}
This will display the login/register screen at the end of post for anonymous user

Thursday, August 12, 2010

Rails number format helper functions

1200.2345.round
o/p: 1200

1200.2345.round_with_precision(2)
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 => ",")
end
end

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.

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

Syntax:
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
[PATH OF PHP] [ARGUMENTS] [PATH OF PHP SCRIPT]

######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 cron.xmlParse.sh
#cd to application-path && sh shell-script-path


Linux Shell Scripting Secrets

Tuesday, August 10, 2010

Very Usefull Ruby on Rails URLs

10 Reasons to learn ruby
http://www.h3rald.com/articles/10-reasons-to-learn-ruby/

Awesome ruby tidbits
http://www.rubyinside.com/interesting-ruby-tidbits-that-dont-warrant-separate-posts-1-600.html

Web based deployment using webistrano
http://blog.innerewut.de/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.
//extract($_POST);
foreach($_POST as $key=>$value)
{
echo $key.'='.$value.'
';
}
echo $_SERVER['HTTP_REFERER'];
/*Output:
key = value
key = value
etc..,
http://from-site-name.com/filename
*/
?>
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..,

Ex: http://formsite-name.com/postinfo.php
##################################################################
form action="http://targetsite.com/getvalues.php" 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"
/form
#####################################################################

When user submits the above form the remote script (i.e mentioned in form action will execute) here it is at http://targetsite.com/getvalues.php
//extract($_POST);
foreach($_POST as $key=>$value)
{
echo $key.'='.$value.'
';
}
echo $_SERVER['HTTP_REFERER'];
/*Output:
name = postedname
address = postedaddress
email = postedemail
http://formsite-name.com/postinfo.php
*/
?>

Tuesday, August 3, 2010

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

Hello,

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 http://www.jonmaddox.com/2006/08/16/automated-php-deployment-with-capistrano/#comment-10668

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.

#!/bin/bash
#
# Configuration
#

# Database connection information
dbname="db_name"
dbhost="localhost" # leave as is unless have specific reason to change
dbuser="db_user"
dbpw="db_pass"

# Dump associated information
dump_directory="/path/to/sql/directory" # path to dump dir NO FILE NAME, note end slash
dump_name="dumpname.sql"
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

endtime=`date`
echo "Backup completed $endtime" >> $logfile

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

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: http://www.foxycart.com/features-of-web-20-seo-ecommerce.htm

Thursday, July 29, 2010

Puzzle




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
http://net.tutsplus.com/tutorials/other/easy-version-control-with-git/


http://drupal.org/node/670460

http://www.mig5.net/content/drupal-deployments-workflows-version-control-drushmake-and-aegir

Drupal Development Best Practices: Tools
http://www.chapterthree.com/blog/matt_cheney/drupal_development_best_practices_tools_part_i

Unit testing
http://www.lullabot.com/articles/introduction-unit-testing

Test driven development in drupal
http://groups.drupal.org/node/9412

http://drupal.org/project/drush_make

http://www.workhabit.com/labs/svn-repository-structure-drupal-projects

Deploy with capistrano
http://data.agaric.com/node/2682








Bookmarks

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
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 | 10.0.0.1
Resetting a forgotten MySQL root password
Tips for a Debian GNU/Linux System Administrator.
Wilderness | drupal.org
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
http://localhost/drupal-moodle/course/10
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

Drupal

Using CVS to maintain a Drupal website | drupal.org
###Overriding themable output | drupal.org
How Drush Make Just Changed My Life | Drupaler | Drupal Blog, Collaborative Drupal Resource
This is a blog post about Drupal.
Drush - Drupal Shell utility | drupal.org
drush.ws | A command line shell and scripting interface for Drupal.
Customizing the login form | drupal.org
Customizing the login, registration and request password full page layout | drupal.org
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.org
Drupal - How to Theme CCK Input forms | Haro Street Media
Hottest 'drupal' Questions - Stack Overflow
Core templates and suggestions | drupal.org
Search config | drupal.org
Custom Search | drupal.org
#################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 | drupal.org
Mastering Drupal
Starting Views 2 Documentation | groups.drupal.org
########15 Userful Views Module for Drupal - Ntt.cc
##########Views help index | Views online help
########Creating a module configuration (settings) page | drupal.org

New Folder

Comparison of Lightbox-type modules | drupal.org
Contributer stella | drupal.org

Latest Headlines

PHP

### 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 SlideShare.net using PHP | The Storyteller

General

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

Jquery

Using jQuery with Other Libraries - jQuery JavaScript Library

Unsorted Bookmarks

http://10.0.0.1:6056/about

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.
http://drupal.org/node/670460
http://drupal.org/project/drush_make


Drush official website: http://drush.ws/

Other drupal useful development tools
http://www.mig5.net/content/drupal-deployments-workflows-version-control-drushmake-and-aegir
http://www.chapterthree.com/blog/matt_cheney/drupal_development_best_practices_tools_part_i

Unit testing
http://www.lullabot.com/articles/introduction-unit-testing

Wednesday, July 28, 2010

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

Artisteer
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: http://www.artisteer.com

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
http://www.devplug.net/

For Joomla
http://www.joomlaplug.com/Documentation/XCloner_Documentation/XCloner_-_Standalone_Backup_and_Restore.html

Wordpress Vs Joomla Vs Drupal

WORDPRESS
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


# DRUPAL
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.


# 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: Drupal.org DrupalModules Best Modules BestRank Noupe Appnovation GUI Designer


Drupal Themes: Drupal.org Theme Garden FreeDrupalThemes ThemeBot Mulpo MogDesign GeekTip

Joomla Modules/Extensions: Joomla.org 10 Best Free Joomla21 AJAXLine evoHosts


Joomla Templates: Joomla.org BestofJoomla TemplateMonster Joomla24 Freetemplates Templates.com

Wordpress Plugins: WordPress.org SiteSketch WPHacks VisionWidgets Sadhas BestWordPressPlugins


WordPress Themes: WordPress.org bestwpthemes PageLines TopWPthemes Themes2WP LeVoltz


Ref: http://www.goodwebpractices.com/other/wordpress-vs-joomla-vs-drupal.html