Feeds:
Posts
Comments

InnoDB Support in WAMP

open  [Wamp Installation Dir]\bin\mysql\[mysql vX.X]\my-innodb-heavy-4G.ini

 

Search for

default-storage-engine = MYISAM

and Replace with

default-storage-engine = InnoDB

<html>
<head>
<style type=”text/css”>
/* administrative hover links */

div.view div.views-admin-links {
font-size: xx-small;
margin-right: 1em;
margin-top: 1em;
width: 30px;
}

.main div.view div.views-admin-links {
margin-top: 0;
}

div.view div.views-admin-links ul {
padding-left: 0;
list-style-type:none;
}

div.view div.views-admin-links li a {
color: #ccc;
}

div.view div.views-admin-links li {
padding-bottom: 2px;
z-index: 201;
}

div.view div.views-admin-links-hover a,
div.view div.views-admin-links:hover a {
color: #000;
}

div.view div.views-admin-links-hover,
div.view div.views-admin-links:hover {
background: transparent;;
}

div.view div.views-admin-links a:before {
content: “[";
}

div.view div.views-admin-links a:after {
content: "]“;
}

div.view div.views-hide {
display: none;
}

/** For IE we add the class via js; for other browsers we rely on :hover **/
div.view div.views-hide-hover,
div.view:hover div.views-hide {
display: block;
position: absolute;
z-index: 200;
}

/* don’t do this one in IE */
div.view:hover div.views-hide {
margin-top: -1.5em;
}

/* Remove the border on tbody that system puts in */
.views-view-grid tbody {
border-top: none;
}

/*.view{
float:left;
}*/
.main{
float:left;
width:500px;
height:100px;
}

</style>
</head>
<body>
<div>
<div>
<div>
<ul><li><a href=”[link]“>Edit</a></li>
</ul>
</div>
<div>Text</div>
<div>Footer</div>
</div>
</div>
<div>
<div>
<div>
<ul><li><a href=”[link]“>Edit</a></li>
</ul>
</div>
<div>Text</div>
<div>Footer</div>
</div>
</div>
</body>
</html>

V Host configure

<Directory D:\wamp\www\localdir>
Order Deny,Allow
Allow from all
</Directory>

<Directory D:/wamp/www>
Order Deny,Allow
Allow from all
</Directory>

 

<VirtualHost *:80>
DocumentRoot D:/wamp/www
ServerName localhost
</VirtualHost>
[Server Name]

<VirtualHost *:80>
DocumentRoot D:/wamp/www
ServerName calbl06ba48d
</VirtualHost>
[Machine IP]

<VirtualHost *:80>
DocumentRoot D:/wamp/www
ServerName 10.227.73.71
</VirtualHost>

<VirtualHost *:80>
DocumentRoot D:/wamp/www/dev
ServerName www.localdev.com
</VirtualHost>

Email-ID preg_match

preg_match(“/.*\/\/(.*)@.*$/”,”http://info@abc.com”,$data);
print_r($data);
// O/P : Array ( [0] => http://info@abc.com [1] => info )

preg_match(“/(.*):\/\/(.*)@(.*)\.(.*)$/”,”http://info@abc.com”,$data);
print_r($data);
// O/P : Array ( [0] => http://info@abc.com [1] => http [2] => info [3] => abc [4] => com )

Drupal Date Time Confusion

http://drupal.org/node/291799

In the new system you just need to know the timezone name and either the UTC or local time. We store the UTC time and the timezone name in the database (in two separate fields). We retrieve that data and do:<?php
$date
= the UTC value from the database
$local_zone
= the name of the local timezone
$type
= the type of date value, DATE_DATETIME, DATE_ISO, or DATE_UNIX

$date = date_make_date($date, 'UTC', $type);
date_timezone_set($date, timezone_open($local_zone));

$date now contains the local value of the date.
Output it like:

print date_format_date($date, 'custom', 'm/d/Y H:i');

To convert a local date back to UTC to store it in the database, do:

<?php
$date
= local date value
$local_zone
= the name of the local timezone
$type
= the type of date value, DATE_DATETIME, DATE_ISO, or DATE_UNIX

$date = date_make_date($date, $local_zone, $type);
date_timezone_set($date, timezone_open('UTC'));

$date now contains the UTC value of the date.
Output it like:

print date_format_date($date, 'custom', 'm/d/Y H:i');
?>

Africa/Algiers
Africa/Asmera
Africa/Bangui
Africa/Blantyre
Africa/Brazzaville
Africa/Bujumbura
Africa/Cairo
Africa/Ceuta
Africa/Dar_es_Salaam
Africa/Djibouti
Africa/Douala
Africa/Gaborone
Africa/Harare
Africa/Johannesburg
Africa/Kampala
Africa/Khartoum
Africa/Kigali
Africa/Kinshasa
Africa/Lagos
Africa/Libreville
Africa/Luanda
Africa/Lubumbashi
Africa/Lusaka
Africa/Malabo
Africa/Maputo
Africa/Maseru
Africa/Mbabane
Africa/Mogadishu
Africa/Nairobi
Africa/Ndjamena
Africa/Niamey
Africa/Porto-Novo
Africa/Tripoli
Africa/Tunis
Africa/Windhoek
America/Adak
America/Anchorage
America/Anguilla
America/Antigua
America/Araguaina
America/Aruba
America/Asuncion
America/Atka
America/Barbados
America/Belem
America/Belize
America/Boa_Vista
America/Bogota
America/Boise
America/Buenos_Aires
America/Cambridge_Bay
America/Cancun
America/Caracas
America/Catamarca
America/Cayenne
America/Cayman
America/Chicago
America/Chihuahua
America/Cordoba
America/Costa_Rica
America/Cuiaba
America/Curacao
America/Dawson
America/Dawson_Creek
America/Denver
America/Detroit
America/Dominica
America/Edmonton
America/Eirunepe
America/El_Salvador
America/Ensenada
America/Fort_Wayne
America/Fortaleza
America/Glace_Bay
America/Godthab
America/Goose_Bay
America/Grand_Turk
America/Grenada
America/Guadeloupe
America/Guatemala
America/Guayaquil
America/Guyana
America/Halifax
America/Havana
America/Hermosillo
America/Indiana/Indianapolis
America/Indiana/Knox
America/Indiana/Marengo
America/Indiana/Vevay
America/Indianapolis
America/Inuvik
America/Iqaluit
America/Jamaica
America/Jujuy
America/Juneau
America/Kentucky/Louisville
America/Kentucky/Monticello
America/Knox_IN
America/La_Paz
America/Lima
America/Los_Angeles
America/Louisville
America/Maceio
America/Managua
America/Manaus
America/Martinique
America/Mazatlan
America/Mendoza
America/Menominee
America/Merida
America/Mexico_City
America/Miquelon
America/Monterrey
America/Montevideo
America/Montreal
America/Montserrat
America/Nassau
America/New_York
America/Nipigon
America/Nome
America/Noronha
America/Panama
America/Pangnirtung
America/Paramaribo
America/Phoenix
America/Port-au-Prince
America/Port_of_Spain
America/Porto_Acre
America/Porto_Velho
America/Puerto_Rico
America/Rainy_River
America/Rankin_Inlet
America/Recife
America/Regina
America/Rio_Branco
America/Rosario
America/Santiago
America/Santo_Domingo
America/Sao_Paulo
America/Scoresbysund
America/Shiprock
America/St_Johns
America/St_Kitts
America/St_Lucia
America/St_Thomas
America/St_Vincent
America/Swift_Current
America/Tegucigalpa
America/Thule
America/Thunder_Bay
America/Tijuana
America/Tortola
America/Vancouver
America/Virgin
America/Whitehorse
America/Winnipeg
America/Yakutat
America/Yellowknife
Antarctica/Casey
Antarctica/Davis
Antarctica/DumontDUrville
Antarctica/Mawson
Antarctica/McMurdo
Antarctica/Palmer
Antarctica/South_Pole
Antarctica/Syowa
Antarctica/Vostok
Arctic/Longyearbyen
Asia/Aden
Asia/Almaty
Asia/Amman
Asia/Anadyr
Asia/Aqtau
Asia/Aqtobe
Asia/Ashgabat
Asia/Ashkhabad
Asia/Baghdad
Asia/Bahrain
Asia/Baku
Asia/Bangkok
Asia/Beirut
Asia/Bishkek
Asia/Brunei
Asia/Calcutta
Asia/Chungking
Asia/Colombo
Asia/Dacca
Asia/Damascus
Asia/Dhaka
Asia/Dili
Asia/Dubai
Asia/Dushanbe
Asia/Gaza
Asia/Harbin
Asia/Hong_Kong
Asia/Hovd
Asia/Irkutsk
Asia/Istanbul
Asia/Jakarta
Asia/Jayapura
Asia/Jerusalem
Asia/Kabul
Asia/Kamchatka
Asia/Karachi
Asia/Kashgar
Asia/Katmandu
Asia/Krasnoyarsk
Asia/Kuala_Lumpur
Asia/Kuching
Asia/Kuwait
Asia/Macao
Asia/Magadan
Asia/Manila
Asia/Muscat
Asia/Nicosia
Asia/Novosibirsk
Asia/Omsk
Asia/Phnom_Penh
Asia/Pyongyang
Asia/Qatar
Asia/Rangoon
Asia/Riyadh
Asia/Riyadh87
Asia/Riyadh88
Asia/Riyadh89
Asia/Saigon
Asia/Samarkand
Asia/Seoul
Asia/Shanghai
Asia/Singapore
Asia/Taipei
Asia/Tashkent
Asia/Tbilisi
Asia/Tehran
Asia/Tel_Aviv
Asia/Thimbu
Asia/Thimphu
Asia/Tokyo
Asia/Ujung_Pandang
Asia/Ulaanbaatar
Asia/Ulan_Bator
Asia/Urumqi
Asia/Vientiane
Asia/Vladivostok
Asia/Yakutsk
Asia/Yekaterinburg
Asia/Yerevan
Atlantic/Azores
Atlantic/Bermuda
Atlantic/Canary
Atlantic/Cape_Verde
Atlantic/Faeroe
Atlantic/Jan_Mayen
Atlantic/Madeira
Atlantic/South_Georgia
Atlantic/Stanley
Australia/ACT
Australia/Adelaide
Australia/Brisbane
Australia/Broken_Hill
Australia/Canberra
Australia/Darwin
Australia/Hobart
Australia/LHI
Australia/Lindeman
Australia/Lord_Howe
Australia/Melbourne
Australia/NSW
Australia/North
Australia/Perth
Australia/Queensland
Australia/South
Australia/Sydney
Australia/Tasmania
Australia/Victoria
Australia/West
Australia/Yancowinna
Europe/Amsterdam
Europe/Andorra
Europe/Athens
Europe/Belfast
Europe/Belgrade
Europe/Berlin
Europe/Bratislava
Europe/Brussels
Europe/Bucharest
Europe/Budapest
Europe/Chisinau
Europe/Copenhagen
Europe/Dublin
Europe/Gibraltar
Europe/Helsinki
Europe/Istanbul
Europe/Kaliningrad
Europe/Kiev
Europe/Lisbon
Europe/Ljubljana
Europe/London
Europe/Luxembourg
Europe/Madrid
Europe/Malta
Europe/Minsk
Europe/Monaco
Europe/Moscow
Europe/Nicosia
Europe/Oslo
Europe/Paris
Europe/Prague
Europe/Riga
Europe/Rome
Europe/Samara
Europe/San_Marino
Europe/Sarajevo
Europe/Simferopol
Europe/Skopje
Europe/Sofia
Europe/Stockholm
Europe/Tallinn
Europe/Tirane
Europe/Tiraspol
Europe/Uzhgorod
Europe/Vaduz
Europe/Vatican
Europe/Vienna
Europe/Vilnius
Europe/Warsaw
Europe/Zagreb
Europe/Zaporozhye
Europe/Zurich
Indian/Antananarivo
Indian/Chagos
Indian/Christmas
Indian/Cocos
Indian/Comoro
Indian/Kerguelen
Indian/Mahe
Indian/Maldives
Indian/Mauritius
Indian/Mayotte
Indian/Reunion
Pacific/Apia
Pacific/Auckland
Pacific/Chatham
Pacific/Easter
Pacific/Efate
Pacific/Enderbury
Pacific/Fakaofo
Pacific/Fiji
Pacific/Funafuti
Pacific/Galapagos
Pacific/Gambier
Pacific/Guadalcanal
Pacific/Guam
Pacific/Honolulu
Pacific/Johnston
Pacific/Kiritimati
Pacific/Kosrae
Pacific/Kwajalein
Pacific/Majuro
Pacific/Marquesas
Pacific/Midway
Pacific/Nauru
Pacific/Niue
Pacific/Norfolk
Pacific/Noumea
Pacific/Pago_Pago
Pacific/Palau
Pacific/Pitcairn
Pacific/Ponape
Pacific/Port_Moresby
Pacific/Rarotonga
Pacific/Saipan
Pacific/Samoa
Pacific/Tahiti
Pacific/Tarawa
Pacific/Tongatapu
Pacific/Truk
Pacific/Wake
Pacific/Wallis
Pacific/Yap
Pacific/French_Polynesia-Marquesas_Islands
UTC

Drupal – CSS/JS optimization

function cpaglobal_preprocess_page(&$vars) {
$vars['styles']    = drupal_get_css_custom();
$vars['scripts']    = drupal_get_js_custom();
}

function drupal_get_css_custom($css = NULL) {
$output = ”;
if (!isset($css)) {
$css = drupal_add_css();
}

$url = explode( “/”, $_REQUEST['q'] );
if( $url[0] == ‘ip-review-online’ )
{
$css['all']['theme'][drupal_get_path('theme', 'cpaglobal').'/ipreview.css'] =  1;
$css['all']['theme'][drupal_get_path('theme', 'cpaglobal').'/articles.css'] =  1;
$css['all']['theme'][drupal_get_path('theme', 'cpaglobal').'/dropdown_ipreview.css'] =  1;
}
else
{
$css['all']['theme'][drupal_get_path('theme', 'cpaglobal').'/dropdown.css'] =  1;
}

$no_module_preprocess = ”;
$no_theme_preprocess = ”;

$preprocess_css = (variable_get(‘preprocess_css’, FALSE) && (!defined(‘MAINTENANCE_MODE’) || MAINTENANCE_MODE != ‘update’));
$directory = file_directory_path();
$is_writable = is_dir($directory) && is_writable($directory);

// A dummy query-string is added to filenames, to gain control over
// browser-caching. The string changes on every update or full cache
// flush, forcing browsers to load a new copy of the files, as the
// URL changed.
$query_string = ‘?’. substr(variable_get(‘css_js_query_string’, ’0′), 0, 1);

foreach ($css as $media => $types) {
// If CSS preprocessing is off, we still need to output the styles.
// Additionally, go through any remaining styles if CSS preprocessing is on and output the non-cached ones.
foreach ($types as $type => $files) {
if ($type == ‘module’) {
// Setup theme overrides for module styles.
$theme_styles = array();
foreach (array_keys($css[$media]['theme']) as $theme_style) {
$theme_styles[] = basename($theme_style);
}
}

foreach ($types[$type] as $file => $preprocess) {
// If the theme supplies its own style using the name of the module style, skip its inclusion.
// This includes any RTL styles associated with its main LTR counterpart.
if ($type == ‘module’ && in_array(str_replace(‘-rtl.css’, ‘.css’, basename($file)), $theme_styles)) {
// Unset the file to prevent its inclusion when CSS aggregation is enabled.
unset($types[$type][$file]);
continue;
}
// Only include the stylesheet if it exists.
if (file_exists($file)) {
if (!$preprocess || !($is_writable && $preprocess_css)) {
// If a CSS file is not to be preprocessed and it’s a module CSS file, it needs to *always* appear at the *top*,
// regardless of whether preprocessing is on or off.
if (!$preprocess && $type == ‘module’) {
$no_module_preprocess .= ‘<link type=”text/css” rel=”stylesheet” media=”‘. $media .’” href=”‘. base_path() . $file . $query_string .’” />’.”\n”;
}
// If a CSS file is not to be preprocessed and it’s a theme CSS file, it needs to *always* appear at the *bottom*,
// regardless of whether preprocessing is on or off.
else if (!$preprocess && $type == ‘theme’) {
$no_theme_preprocess .= ‘<link type=”text/css” rel=”stylesheet” media=”‘. $media .’” href=”‘. base_path() . $file . $query_string .’” />’.”\n”;
}
else {
$output .= ‘<link type=”text/css” rel=”stylesheet” media=”‘. $media .’” href=”‘. base_path() . $file . $query_string .’” />’.”\n”;
}
}
}
}

}

if ($is_writable && $preprocess_css) {
$filename = md5(serialize($types) . $query_string) .’.css’;
$preprocess_file = drupal_build_css_cache($types, $filename);
$output .= ‘<link type=”text/css” rel=”stylesheet” media=”‘. $media .’” href=”‘. base_path() . $preprocess_file .’” />’.”\n”;
}
}

return $no_module_preprocess . $output . $no_theme_preprocess;
}

function drupal_get_js_custom($scope = ‘header’, $javascript = NULL) {
if ((!defined(‘MAINTENANCE_MODE’) || MAINTENANCE_MODE != ‘update’) && function_exists(‘locale_update_js_files’)) {
locale_update_js_files();
}

if (!isset($javascript)) {
$javascript = drupal_add_js(NULL, NULL, $scope);
}

if (empty($javascript)) {
return ”;
}

$output = ”;
$preprocessed = ”;
$no_preprocess = array(‘core’ => ”, ‘module’ => ”, ‘theme’ => ”);
$files = array();
$preprocess_js = (variable_get(‘preprocess_js’, FALSE) && (!defined(‘MAINTENANCE_MODE’) || MAINTENANCE_MODE != ‘update’));
$directory = file_directory_path();
$is_writable = is_dir($directory) && is_writable($directory);

// A dummy query-string is added to filenames, to gain control over
// browser-caching. The string changes on every update or full cache
// flush, forcing browsers to load a new copy of the files, as the
// URL changed. Files that should not be cached (see drupal_add_js())
// get time() as query-string instead, to enforce reload on every
// page request.
$query_string = ‘?’. substr(variable_get(‘css_js_query_string’, ’0′), 0, 1);

// For inline Javascript to validate as XHTML, all Javascript containing
// XHTML needs to be wrapped in CDATA. To make that backwards compatible
// with HTML 4, we need to comment out the CDATA-tag.
$embed_prefix = “\n<!–//–><![CDATA[//><!--\n";
$embed_suffix = "\n//--><!]]>\n”;

foreach ($javascript as $type => $data) {

if (!$data) continue;

switch ($type) {
case ‘setting’:
$output .= ‘<script type=”text/javascript”>’ . $embed_prefix . ‘jQuery.extend(Drupal.settings, ‘ . drupal_to_js(call_user_func_array(‘array_merge_recursive’, $data)) . “);” . $embed_suffix . “</script>\n”;
break;
case ‘inline’:
foreach ($data as $info) {
$output .= ‘<script type=”text/javascript”‘ . ($info['defer'] ? ‘ defer=”defer”‘ : ”) . ‘>’ . $embed_prefix . $info['code'] . $embed_suffix . “</script>\n”;
}
break;
default:
// If JS preprocessing is off, we still need to output the scripts.
// Additionally, go through any remaining scripts if JS preprocessing is on and output the non-cached ones.
foreach ($data as $path => $info) {
$path_parts = explode(‘/’, $path);
if (in_array(“wysiwyg”, $path_parts)) $info['preprocess'] = ”;
if (!$info['preprocess'] || !$is_writable || !$preprocess_js) {
$no_preprocess[$type] .= ‘<script type=”text/javascript”‘. ($info['defer'] ? ‘ defer=”defer”‘ : ”) .’ src=”‘. base_path() . $path . ($info['cache'] ? $query_string : ‘?’. time()) .”\”></script>\n”;
}
else {
$files[$path] = $info;
}
}
}
}

// Aggregate any remaining JS files that haven’t already been output.
if ($is_writable && $preprocess_js && count($files) > 0) {
$filename = md5(serialize($files) . $query_string) .’.js’;
$preprocess_file = drupal_build_js_cache($files, $filename);
$preprocessed .= ‘<script type=”text/javascript” src=”‘. base_path() . $preprocess_file .’”></script>’.”\n”;
}

// Keep the order of JS files consistent as some are preprocessed and others are not.
// Make sure any inline or JS setting variables appear last after libraries have loaded.
$output = $preprocessed . implode(”, $no_preprocess) . $output;

return $output;
}

Drupal Customized Search Form

<form action=”<?php print base_path() ?>search/node” method=”post” id=”search-form”>

<input type=”text” value=”" size=”18″ name=”keys”  />
<input type=”submit” value=”>>” name=”op” title=”Search” alt=”Search” />
<input type=”hidden” value=”<?php print drupal_get_token(‘search_form’); ?>” name=”form_token” />
<input type=”hidden” value=”search_form” id=”edit-search-form” name=”form_id” />

</form>

Custom Error Handler

// set to the user defined error handler
$old_error_handler = set_error_handler(“myErrorHandler”);

// error handler function
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
global $user;
print_r($user);
drupal_set_message(‘The Server is Connected with Databse in Read(r+) Mode’);*/
/*switch ($errno) {
case E_USER_ERROR:
echo “<b>My ERROR</b> [$errno] $errstr<br />\n”;
echo “  Fatal error on line $errline in file $errfile”;
echo “, PHP ” . PHP_VERSION . ” (” . PHP_OS . “)<br />\n”;
echo “Aborting…<br />\n”;
exit(1);
break;

case E_USER_WARNING:
echo “<b>My WARNING</b> [$errno] $errstr<br />\n”;
break;

case E_USER_NOTICE:
echo “<b>My NOTICE</b> [$errno] $errstr<br />\n”;
break;

default:
echo “Unknown error type: [$errno] $errstr<br />\n”;
break;
}*/

/* Don’t execute PHP internal error handler */
return true;
}

Error Reporting ON/OFF

OFF :

error_reporting(0);
ini_set(‘display_errors’, 0);

ON :

error_reporting(1);
ini_set(‘display_errors’, 1);

javascript

Restricting Key By Javascript

<!–<script language=”javascript”>
function restrict_keyRestrict(e, validchars)
{
if(e.keyCode){
return false;
}
var key=”, keychar=”;
key = restrict_getKeyCode(e);
if (key == null) return true;
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();
validchars = validchars.toLowerCase();
if (validchars.indexOf(keychar) != -1)
return true;
if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
return true;
//alert(“Plese enter a valid character.”);
return false;
}
function restrict_getKeyCode(e)
{
if (window.event)
return window.event.keyCode;
else if (e)
return e.which;
else
return null;
}
</script>–>

Older Posts »

Follow

Get every new post delivered to your Inbox.