Friday, February 5, 2010

Javascript: table cell highlighting on radio button change

Hello,
Below code for making table cell highlight on change of radio-button.

In Head Section:


In Body tag :

Monday, February 1, 2010

Session in Symfony

Hi,
setting of session in symfony --
in action.class.php
session object for the current user is accessed in the action with the getUser() method and is an instance of the sfUser class.
This class contains a parameter holder that allows you to store any user attribute in it.
Ex:
class myModule extends sfActions
{
   public function executeFirst()
   {
    $name = $this->getRequestParameter('name');
    $this->getUser()->setAttribute('name', $name);
   }
   public function executeSecond()
   {
    $ses_name = $this->getUser()->getAttribute('name'); //Retrieve session values
   }
}

attributes are stored in a parameter holder that can be accessed by the getAttributeHolder() method. It allows for easy clean-up of the user attributes with the usual parameter holder methods.

//To remove session variable
$this->getUser()->getAttributeHolder()->remove('name');

//To clear session varaible
$this->getUser()->getAttributeHolder()->clear();

In Template:
The user session attributes are also available in the templates by default via the $sf_user variable, which stores the current sfUser object.

Ex:
$sf_user->getAttribute('name');

Monday, January 25, 2010

KDE Big Font Size problem

Hi friends,

Last few days..i faced problem in KDE font size that comes in menu of system settings.
i can't view any of the setting.
at last, i find the solution and getting relax and good feel.
just follow some steps:
step1: Go to System Setting
step2: select Look & feel->Appearance
step3: select fonts category
step4: set force fonts DPI = 96 DPI

then, Restart the system i got the desired output.

Above issue you can solve via cli:

step 1: go to /home/{User}/.kde/share/config/
step 2: vi kcmfonts
step 3: set forceFontDPI=96
step 4: reboot the system

i hope, above points will help you, if you are in the same boat. :)

Tuesday, March 10, 2009

Sending mail with attachement

sending mail with one or more attachment can be done with the help of Linux command: 'MUTT'
Steps to work with this commands:
Step 1: Install
# yum -y install mutt

Step 2: Run command on your Shell prompt:
mutt -s 'Test mail' -a file1.xls -a file2.xls username@abc.com -c user2@abc.com < file.txt

you will get test mail with sender info options
From : 'root'
To: username@abc.com
CC: user2@abc.com
Subject: Test mail
Mail Format: file.txt

Above command is useful for me in C programming, to attache multiple files.

Sample code of test.c using this commands:

#include "stdio.h"
int main()
{
system("mutt -s 'Test mail' -a file1.xls -a file2.xls username@abc.com -c user2@abc.com < file.txt");
printf("Mail Sent\n");
return 0;
}

Run test.c
# gcc test.c -o test
#./test
output:
Mail Sent

after complete whole process, one thing is remaining i.e. change of from option
it's should be sender mail_id[name].it 's possible with configuration file .muttrc
following steps:
Steps 1: Create .muttrc file in /$HOME/ directory
Strep 2: open file and write ---
set from="User "

Step 3: save .muttrc file and run test.c file again
you will get desired output as you want...
I hope you will enjoy throughout the whole process... :)

Saturday, November 22, 2008

Automatic currency updates via RSS



last day i make php script to get foreign currency exchange updates value...
firstly, i worked on to get US($) to INR conversion....
it's possible for me to get that value via RSS(Really simple syndication).
RSS is a family of web-feed format. it's format are specified using XML language. it's useful to get automatic updates value of any type like..
1. share Maket
2. Temperature value
3. News Headlines
4. Audio/Video
5. foreign currency exchange value... like that..

//source code for the currency-exchange rate of US-INR
// PHP Script

$currency="USD";
if ($currency != '')
{
//This pulls the data from the IMF, which is where sites like xe.com get their information
$er_url = "http://currencysource.com/RSS/".$currency."xml";
$rates = '';
//Try using fopen since it's more supported
if (ini_get('allow_url_fopen'))
{
//file_get_contents() only exists in PHP 4.3.0 and above
$rates = file_get_contents("http://currencysource.com/RSS/USD.xml");
}

//Parse the XML file down to the important stuff and break it up into an array
$rates = substr($rates, strpos($rates, ''), -20);
$rates = explode("\n", $rates);
$rates1=substr($rates[121],7,23);
echo "Update Currency Value: ".$rates1."";
echo $rates[124];
}
?>


// End of the PHP Script

one thing is to be keep in mind i.e. ..in the php.ini (You can locate it in /etc/php.ini in any linux server) that must have "allow_url_fopen" value should be "On".
Use of file_get_contents() function in this script will worked only in php version 4.3.0 or above.

Now...run that script ... and enjoy the output..:)