Monday, May 9, 2011

My skype icon didn't visible

In ubuntu sometimes, the skype icon hide from panel, when you select the option remove from panel, then the solution is:

right click on an empty area in your notification area (top-right bar by the clock) and select "Add to Panel" now scroll down and find "Notification area" then OK.

you should be able to see the green >>running<< skype instance along with all non running duplicates. Right click and close the duplicates.
You can now close the main skype window with the "X" and bring it to the foreground again with the green notifier.

Wednesday, April 6, 2011

Enable clean urls in Ubuntu


  1. Ensure that mod_rewrite is enabled for Apache 2:
     % sudo a2enmod rewrite
  2. Edit Apache 2 configuration to allow Drupal's .htaccess file to be used. In file /etc/apache2/sites-enabled/000-default, inside the tag Directory /var/www/, replace the line
    AllowOverride none
    with
    AllowOverride All
  3. Restart Apache 2:
    % sudo /etc/init.d/apache2 restart

Tuesday, April 5, 2011

Drush installation and configuration steps


Drush configuration steps

1. Download Drush module from http://drupal.org/project/drush and place drush folder into your home directory. E.g: '/home/drush/'

2. In command line, execute following this statement.

PATH="/home/venkat/drush:$PATH" for temporary

3. Add this line PATH=/home/drush:"${PATH}"  in  /home/venkat/.bashrc file

4. Execute following command in command line

$ . .bashrc (including .dots)

Some Drush commands
1. drush cache-clear
2. drush sql-conf
3. drush sql-cli
4. drush dl cck zen
5. drush enable cck , drush pm-enable quiz
6. drush disable cck, drush pm-disable quiz

Here you can find more drush commands http://drush.ws/

Monday, January 10, 2011

Drupal 7 Release Party @ Hyderabad - Sponsored by Azri





This release party was celebrated by Drupal Hyderabad team and sponsored by Azri soultions

see more photos at At my facebook album

Thursday, January 6, 2011

Sunday, January 2, 2011

How to send images as email content but not as an attachment.

Below is the process to send image as email content.

1. Open the image in internet explorer or google chrome browser or any other browser. Dont open in firefox. Also your image need to be in any live website (ex: flickr or photobucket etc..) coz you can't send from your computer.

2. Then right click on the image and select the option copy or copy_image

3. Then paste in your mail body. Thats it.

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