Saturday 18 December 2010

Me at cricet match


Pic during our first match

Technopark roundabout


A view from the top of tejaswini building

Tuesday 14 December 2010

Block unethickal sites using free Microsoft software

Hi,
Please save our kids and ourselves by installing this free Microsoft software from unethical websites.
See http://explore.live.com/windows-live-family-safety-xp

Monday 13 December 2010

Delete Joomla sample data using SQL

Please take a backup of the database if you have any reusable data in tables.

This is the screen shot after a fresh installation of Joomla.




After executing the following query , the page will look like this.


Remeber if you had entered any additional data other than default , then it may deleted.

Run the following SQL queries.

TRUNCATE TABLE `jos_banner`;
TRUNCATE TABLE `jos_bannerclient`;
TRUNCATE TABLE `jos_bannertrack`;
TRUNCATE TABLE `jos_categories`;
TRUNCATE TABLE `jos_content`;
TRUNCATE TABLE `jos_content_frontpage`;
TRUNCATE TABLE `jos_newsfeeds`;
TRUNCATE TABLE `jos_polls`;
TRUNCATE TABLE `jos_poll_data`;
TRUNCATE TABLE `jos_poll_date`;
TRUNCATE TABLE `jos_sections`;
TRUNCATE TABLE `jos_weblinks`;
TRUNCATE TABLE `jos_contact_details`;
TRUNCATE TABLE `jos_menu`;
INSERT INTO `jos_menu` VALUES (1, 'mainmenu', 'Home', 'home', 'index.php?option=com_content&view=frontpage', 'component', 1, 0, 20, 0, 1, 0, '0000-00-00 00:00:00', 0, 0, 0, 3, 'num_leading_articles=1\nnum_intro_articles=4\nnum_columns=2\nnum_links=4\norderby_pri=\norderby_sec=front\nshow_pagination=2\nshow_pagination_results=1\nshow_feed_link=1\nshow_noauth=\nshow_title=\nlink_titles=\nshow_intro=\nshow_section=\nlink_section=\nshow_category=\nlink_category=\nshow_author=\nshow_create_date=\nshow_modify_date=\nshow_item_navigation=\nshow_readmore=\nshow_vote=\nshow_icons=\nshow_pdf_icon=\nshow_print_icon=\nshow_email_icon=\nshow_hits=\nfeed_summary=\npage_title=\nshow_page_title=1\npageclass_sfx=\nmenu_image=-1\nsecure=0\n\n', 0, 0, 1);
TRUNCATE TABLE `jos_modules`;

INSERT INTO `jos_modules` VALUES (1, 'Main Menu', '', 1, 'left', 0, '0000-00-00 00:00:00', 1, 'mod_mainmenu', 0, 0, 1, 'menutype=mainmenu\nmoduleclass_sfx=_menu\n', 1, 0, '');
INSERT INTO `jos_modules` VALUES (2, 'Login', '', 1, 'login', 0, '0000-00-00 00:00:00', 1, 'mod_login', 0, 0, 1, '', 1, 1, '');
INSERT INTO `jos_modules` VALUES (3, 'Popular','',3,'cpanel',0,'0000-00-00 00:00:00',1,'mod_popular',0,2,1,'',0, 1, '');
INSERT INTO `jos_modules` VALUES (4, 'Recent added Articles','',4,'cpanel',0,'0000-00-00 00:00:00',1,'mod_latest',0,2,1,'ordering=c_dsc\nuser_id=0\ncache=0\n\n',0, 1, '');
INSERT INTO `jos_modules` VALUES (5, 'Menu Stats','',5,'cpanel',0,'0000-00-00 00:00:00',1,'mod_stats',0,2,1,'',0, 1, '');
INSERT INTO `jos_modules` VALUES (6, 'Unread Messages','',1,'header',0,'0000-00-00 00:00:00',1,'mod_unread',0,2,1,'',1, 1, '');
INSERT INTO `jos_modules` VALUES (7, 'Online Users','',2,'header',0,'0000-00-00 00:00:00',1,'mod_online',0,2,1,'',1, 1, '');
INSERT INTO `jos_modules` VALUES (8, 'Toolbar','',1,'toolbar',0,'0000-00-00 00:00:00',1,'mod_toolbar',0,2,1,'',1, 1, '');
INSERT INTO `jos_modules` VALUES (9, 'Quick Icons','',1,'icon',0,'0000-00-00 00:00:00',1,'mod_quickicon',0,2,1,'',1,1, '');
INSERT INTO `jos_modules` VALUES (10, 'Logged in Users','',2,'cpanel',0,'0000-00-00 00:00:00',1,'mod_logged',0,2,1,'',0,1, '');
INSERT INTO `jos_modules` VALUES (11, 'Footer', '', 0, 'footer', 0, '0000-00-00 00:00:00', 1, 'mod_footer', 0, 0, 1, '', 1, 1, '');
INSERT INTO `jos_modules` VALUES (12, 'Admin Menu','', 1,'menu', 0,'0000-00-00 00:00:00', 1,'mod_menu', 0, 2, 1, '', 0, 1, '');
INSERT INTO `jos_modules` VALUES (13, 'Admin SubMenu','', 1,'submenu', 0,'0000-00-00 00:00:00', 1,'mod_submenu', 0, 2, 1, '', 0, 1, '');
INSERT INTO `jos_modules` VALUES (14, 'User Status','', 1,'status', 0,'0000-00-00 00:00:00', 1,'mod_status', 0, 2, 1, '', 0, 1, '');
INSERT INTO `jos_modules` VALUES (15, 'Title','', 1,'title', 0,'0000-00-00 00:00:00', 1,'mod_title', 0, 2, 1, '', 0, 1, '');

TRUNCATE TABLE `jos_modules_menu`;
INSERT INTO `jos_modules_menu` VALUES (1,0);
TRUNCATE TABLE `jos_menu_types`;
INSERT INTO `jos_menu_types` VALUES (1, 'mainmenu', 'Main Menu', 'The main menu for the site');
TRUNCATE TABLE `jos_templates_menu`;

# Dumping data for table `jos_templates_menu`
INSERT INTO `jos_templates_menu` VALUES ('rhuk_milkyway', '0', '0');
INSERT INTO `jos_templates_menu` VALUES ('khepri', '0', '1');

Friday 29 October 2010

drupal view system implementation

http://drupal.org/project/module_template_system

Monday 18 October 2010

http://gftp.seul.org/

gFTP is a free multithreaded file transfer client for *NIX based machines. It has the following features:

* Distributed under the terms of the GNU Public License Agreement
* Written in C and has a text interface and a GTK+ 1.2/2.x interface
* Supports the FTP, FTPS (control connection only), HTTP, HTTPS, SSH and FSP protocols
* FTP and HTTP proxy server support
* Supports FXP file transfers (transferring files between 2 remote servers via FTP)
* Supports UNIX, EPLF, Novell, MacOS, VMS, MVS and NT (DOS) style directory listings
* Bookmarks menu to allow you to quickly connect to remote sites
* Fully Internationalized. The following translations of gFTP that are available: Albanian (sq), Amharic (am), Arabic (ar), Azerbaijan (az), Bangla (bn), Belarusian (be), Bulgarian (bg), Catalan (ca), Chinese (zh_CN,zh_HK,zh_TW), Croatian (hr), Czech (cs), Danish (da), Dutch (nl), Dzongkha (dz), English (en_CA, en_GB, en_US), Finnish (fi), French (fr), Galician (gl), German (de), Greek (el), Gujarati (gu), Hebrew (he), Hungarian (hu), Irish (ga), Italian (it), Kinyarwanda (rw), Korean (ko), Japanese (ja), Latvian (lv), Lithuanian (lt), Macedonian (mk), Malayalam (ml), Malay (ms), Nepali (ne), Norwegian (no), Norwegian bokmål (nb), Occitan (oc), Polish (pl), Portuguese (pt,pt_BR), Punjabi (pa), Romanian (ro), Russian (ru), Serbian (sr,sr@Latn), Slovak (sk), Spanish (es), Swedish (sv), Tamil (ta), Thai (th), Turkish (tr) and Ukrainian (uk) translations available.

Wednesday 6 October 2010

Tuesday 5 October 2010

using compression in linux with command

Using command line is faster than GUI.


compresses file

gzip -c file1 > foo.gz


Gunzip and import to mysql using gzip

gunzip < outputfile.sql.gz | mysql < mysql options>

Sunday 12 September 2010

Send mail with joomla jmail class using gmail smtp account

jimport('joomla.mail.mail');
$mail = new JMail();
$mail->setsender("useremail");
$mail->addRecipient("destination@email.com");
$mail->setSubject("Here goes the subject");
$mail->setbody("The body of mail");
$mail->addAttachment('c:\\1.pdf');
$mail->useSMTP(true, "smtp.gmail.com", "useremail", "password",'ssl',465);
$mail->send();

Sunday 8 August 2010

Performance comparison test between MySQL and PostgreSql

Step 1)

I have created a table in mysql with following query.

CREATE TABLE `latlong` (
`id` int(10) NOT NULL auto_increment,
`lat` decimal(12,9) NOT NULL,
`lng` decimal(12,9) NOT NULL,
`place_name` varchar(253) NOT NULL,
PRIMARY KEY (`id`),
KEY `lat` (`lat`),
KEY `lng` (`lng`),
KEY `id` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=800001 DEFAULT CHARSET=latin1;


I made the similar structure in PostgreSQL too.

CREATE TABLE latlong
(
id integer NOT NULL,
lat numeric(12,9) NOT NULL,
lng numeric(12,9) NOT NULL,
place_name character varying NOT NULL,
CONSTRAINT latlong_pkey PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE latlong OWNER TO postgres;

-- Index: lat

-- DROP INDEX lat;

CREATE INDEX lat
ON latlong
USING btree
(lat);

-- Index: lng

-- DROP INDEX lng;

CREATE INDEX lng
ON latlong
USING btree
(lng);

Step 2 ) I entered 70 lakhs of random data to the table using a stored procedure.
In that i kept 1 lakh of duplicate data for testing purpose.

After that, i exported the mysql data to csv and imported to Postgresql.

Now both the table has same data and structure.

Then i ran the query on both and the time differences were amazing.

select count(*) from
(select max(id),count(id) from latlong group by lat,lng
having count(id) >1
) as tmp;

The result was 99998 in both tables.

Time taken for the outputs are,

Mysql > 29.297 seconds
PostgreSQL > 7.922 seconds

In the above test, PostgreSQL showed better performance than MySql.

mysql stored procedure example

This is an example script of mysqls stored procedure.
This will insert a large number of records into a table. I prepared this for checking the performance of db.


delimiter //
CREATE PROCEDURE load_part_tab()
begin
declare v int default 0;
declare latv,longv float;

while v < 8000000
do

set latv = FLOOR(7 + (RAND() * 5)) + rand();
set longv = FLOOR(7 + (RAND() * 5)) + rand();

INSERT INTO `sams`.`latlong` (
`id` ,
`lat` ,
`lng` ,
`place_name`
)
VALUES (
'', latv, longv, concat(latv,longv));

set v = v + 1;
end while;
end
//
delimiter ;

Tuesday 4 May 2010

php code for sending email with godaddy using phpmailer

require dirname(__FILE__).'/phpmailer/class.phpmailer.php';
try {
$mail = new PHPMailer(true); //New instance, with exceptions enabled
$body = $content;
$body = preg_replace('/\\\\/','', $body); //Strip backslashes
//$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
$mail->Host = "relay-hosting.secureserver.net"; // sets GMAIL as the SMTP server


$mail->SetFrom('postman@website.com', 'Postman');

$mail->Subject = $subject;

$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($content);

$address = $to;
$mail->AddAddress($address);
if($attachment) {
$mail->AddAttachment($attachment); // attachment
}
$mail->Send();

return true;
} catch (phpmailerException $e) {
//echo $e->errorMessage();
}

Sunday 4 April 2010

get mysql query as html and output to file

MYSQL>> mysql < c:\test.sql -u root database_name -H -e "select * from table ";

Sunday 7 February 2010

take care of php loose comparisons

php has both strict comparison and loose comparison.
see the example.
if("6x"==6)
{
echo "surprice";
}
else
{
echo "i am aware.";
}
in a comparison, if either side has number then both the parameters will be converted to number and will check 6==6, so the output will be "surprice".

In these case, checking with === will work as usual.
eg: if("6x"===6)

Wednesday 27 January 2010

Joomla 1.6 alpha released

joomla 1.6 alpha released.

It reduces the narrow advantage of Drupal over Joomla 1.5.
please check this

Thursday 14 January 2010

Zencart

Zencart is a pretty easy tool for developing an ecommerce website. A medium level programming knowledge is enough to start because it does not have any complex OOP system to follow. Its not extendable but is highly customizable.