Navigation

step by step themeing for create content type story

In this example, i am going to theme the content type story

1. open template.php,
2. find function called
phptemplate_preprocess_page
3. add below code in that


function phptemplate_preprocess_page(&$vars) {
$vars['tabs2'] = menu_secondary_local_tasks();

// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}
if ($vars['node']->type == "story" && ( arg(2)=='edit' || arg(1) =='add')) {
$vars['template_files'][] = 'page-node-add-story';
}
}

vitual host config in WAM

please use the below URL,

for configure the WAMP virtual host

http://cesaric.com/?p=255

Expect function in shell expect bash example, expect sample

expect shell sample


#!/bin/bash
PASS="password123"
VAR=$(expect -c "
spawn scp sample.pl hostname:/desctination
expect {
password: { send \"$PASS\r\"; exp_continue }
:~$ { send \"ls\r\"; }
}
exit
")

Create Spread Sheet


#!/usr/bin/perl
use strict;
use warnings;
use Spreadsheet::WriteExcel;

# Create a new workbook called simple.xls and add a worksheet.
my $workbook = Spreadsheet::WriteExcel->new('simple.xls');
my $worksheet = $workbook->add_worksheet('Weekly Report');

# The general syntax is write($row, $column, $token).
# Note that row and column are zero indexed.

# Write some text. in write function First Argument for ROW, Second Argument for COLUMN, Third Argument for Title/Text to display
$worksheet->write(0, 0, 'Date');
$worksheet->write(0, 1, 'Time');

PERL, Get current date and time

PERL, Get current date and time


#!/usr/bin/perl
use strict;
use warnings;
use POSIX qw(strftime);
my $get_cur_ts = time;
my $now_string = strftime "%a %b %e %d %m %Y %H:%M:%S %Y", localtime;
print $now_string."\n";

PERL:


#!/usr/bin/perl
use strict;
use warnings;
use POSIX qw(strftime);
my $get_cur_ts = time;
my $prev_ts = 1317489940;
my $cur_dt=strftime("%m/%d/%y %H:%M",localtime($get_cur_ts));-------->Get current timestamp and passing timstamp into strftime function to get current date and time

PERL connect mysql DB

Make sure, you have installed DBI package,
if u r not installed please install then try the following code,

in windows, To install DBI, try with cpan tool,

#!/usr/local/bin/perl

use DBI;

# set the data source name
# format: dbi:db type:db name:host:port
# mysql's default port is 3306
# if you are running mysql on another host or port,
# you must change it
my $dsn = 'dbi:mysql:mydb:localhost:3306';

# set the user and password
my $user = 'root';
my $pass = '';

# now connect and get a database handle
my $dbh = DBI->connect($dsn, $user, $pass)

Regular Expressions step by step tutor

The following tutorial i got from sitepoint email,

please sign up now, and get updated technical stuff ,

SitePoint

please subscribe: techtimes@sitepoint.com

Regular Expressions

^[A-Za-z0-9-_.+%]+@[A-Za-z0-9-.]+\.[A-Za-z]{2,4}$

It makes all the sense of ancient Egyptian hieroglyphics to you, although those little pictures at least look like they have meaning. But this… this looks like gibberish. What does it mean? It means oleomarg32@hotmail.com, Fiery.Rebel@veneuser.info, robustlamp+selfmag@gmail.ca,

include PHP script in PERL application

working in windows environment,

System configuration Winxp, Wamp in local disk E,

Strawberry PERL package installed in local disk c,

how to include PHP script in PERL.

What package i should install to call php script in perl.

Answer:

Everywhere running CLI is similar, type full path to executable binary of applpication and specify arguments separated by space.

system("E:/wamp/php/bin/php.exe", "d:/script/to/run.php", "argumentPasssedToPhpScript");

Syndicate content