May 04

Integrating XCache Into PHP5 (Fedora /CentOS & Apache2)

Integrating XCache Into PHP5 (Fedora /CentOS  & Apache2)

This article explains how to integrate XCache into PHP5 on a Fedora 13 or CentOS 5.5 system (with Apache2). From the XCache project page: “XCache is a fast, stable PHP opcode cacher that has been tested and is now running on production servers under high load.” It’s similar to other PHP opcode cachers, such as eAccelerator and APC.

If you see that another PHP opcode cacher such as eAccelerator or APC is installed in phpinfo.php output, then you must remove it before you install Xcache. you need root access for removing this pkgs.

For eAccelerator:
yum remove php-eaccelerator
 
For APC:
yum remove php-pecl-apc
 
Restart Apache afterwards:
/etc/init.d/httpd restart       OR service httpd restart
 

Installing XCache

Unfortunately XCache isn’t available as an rpm package for Fedora /CentOS , therefore we have to build it from the sources. First we install all packages that we need to build XCache:

yum install php-devel
yum groupinstall ‘Development Tools’
yum groupinstall ‘Development Libraries’
 
Next we download and uncompress the latest XCache version:
cd /tmp
wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz
tar xvfz xcache-1.3.0.tar.gz
Then we go to the new XCache source directory…

cd xcache-1.3.0

… and build XCache as follows:

phpize
./configure –enable-xcache
make
make install

Next we copy xcache.ini to the /etc/php.d directory:

cp xcache.ini /etc/php.d

Now we must configure XCache. The configuration options are explained here: http://xcache.lighttpd.net/wiki/XcacheIni. The least you should do is enable extension = xcache.so and disable all zend_extension lines; furthermore, set xcache.size to a size (in MB) > 0 to enable XCache:

vi /etc/php.d/xcache.ini
—————————————–
[xcache-common]
;; install as zend extension (recommended), normally "$extension_dir/xcache.so"
;zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so
; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so
;; For windows users, replace xcache.so with php_xcache.dll
;zend_extension_ts = c:/php/extensions/php_xcache.dll
;; or install as extension, make sure your extension_dir setting is correct
extension = xcache.so
;; or win32:
; extension = php_xcache.dll
[...]
xcache.size = 60M
[...]
---------------------------

That’s it. Restart Apache, and you’re done:

/etc/init.d/httpd restart       OR service httpd restart
 
Afterwards, open phpinfo.php again in a browser: http://localhost/phpinfo.php
 
 

 

 

Apr 19

Upgrade Fireware of Samsung Galaxy Tab 2.2 into 2.3.3

Upgrade Fireware of Samsung Galaxy Tab 2.2 into 2.3.3

Before, make you sure Galaxy Tab Drivers are installed. Either use KIES, Windows Update (Not sure if it will work this way) or download them from SAMSUNG_USB_Driver_for_Mobile_Phones_v1.3.350.0 (SAMSUNG_USB_Driver_for_Mobile_Phones_v1.3.350.0.exe)

You can get all important packages  SamsungGalaxyTab and P1000XXJQ1.rar

Download these files and place them in a folder together on your desktop.

0. Preparing to Flashing the firmware

1. Take the main firmware and unzip the file using winzip or another extraction program. When it unzips you will be left w/ a .tar file. This is the file you will need to flash.

2. Unzip ODIN V1.7. You will have several files in the folder. you will use the file called Odin.exe

3. Unzip the pit file. you will be left w/ a .pit file

4. Unzip the dbdata file and you will be left w/ a file named dbdata.tar.

Take all those files and put them in a folder inside the main folder so they are in one spot and easy to find.

1. Flashing the Firmware

1. Double click ODIN.exe to run the program.

2. Make sure your tab to turned off. Hold the Power and Volume down button at the same time and it will have a android guy in a triangle w/ a shovel and hook it up to your computer. This is the download mode.

3. in the PDA section of odin place the main firmware .tar file in that section.

4. Place the .pit file in the pit section and make sure repartition is selected.

5. Hit start and it will flash the firmware.

2. Second Phase to flashing Firmware

you tab will reboot after the firmware flashes. Shut it down.

1. Place tab in DL mode again and hook it up to your computer. Power button and Volume Down at the same time.

2. Place dbdata.tar into the PDA section in ODIN (DO NOT SELECT REPARTITION)

3. Hit start and it will flash the .tar file.

4. Shut down the tab.

3. Phase Three of Flashing Firmware

We will be placing your tab into recovery mode. In Recovery Mode you will use the volume up and down keys to navigate and home key to select.

1. Hold Power and Volume up together.

2. Release Power after holding it for about 4-5 second and continue to hold the Volume Up button until recovery menu shows up.

3. Select wipe cache (When Done go to next step)

4. Select wipe data/factory reset.

5. Select reboot and you are done. You now have Android 2.3.3 Gingerbread.
4. Flashing of OPTIONAL rooted kernel GSM TABS ONLY

This is to be done after all the steps above have been done.

1. unzip the CFroot file and you will have a .tar file.

2. Start the ODIN program

3. put the .tar file in the PDA section in ODIN (DO NOT SELECT REPARTITION)

4. Place your tab into DL Mode and hook it up to your computer

5. Hit start

you will now have a rooted tab and ClockWorkMod recovery installed.

Apr 16

How to set password in usb pendrive without any software?

How to set password in usb pen drive without any software?

!!!!!!!WITHOUT USING ANY SOFTWARE!!!!!!!!!!!

 

Here’s an easy way of doing this.1. Go to the flash drive, and put everything in one folder titled Flash2.
On a computer, open up notepad (Start+R and type in ‘notepad’)
type:(Passwordtxt file)@echo off
setlocal enabledelayedexpansion
title Password
:START
cls
echo Please Enter password…
echo.
set /p pass=Pass:
if /i ‘!pass!’==’ENTERYOURPASSWORDHERE’ goto next
cls
echo !pass! is not the password. Try again.
pause
goto START
:next
if exist D:/Flash (
set Jbe=D
)
if exist E:/Flash (
set Jbe=E
)
if exist F:/Flash (
set Jbe=F
)
if exist G:/Flash (
set Jbe=G
)
if exist H:/Flash (
set Jbe=H
)
if exist I:/Flash (
set Jbe=I
)
if exist J:/Flash (
set Jbe=J
)
if exist K:/Flash (
set Jbe=K
)
if exist L:/Flash (
set Jbe=L
)
if exist M:/Flash (
set Jbe=M
)
%Jbe%:
start explorer.exe Flash || goto ERROR
exit
:ERROR
cls
echo There was an error opening the file. Would you like
echo to try again???
echo.
set /p jam=Yes or No:
if /i ‘%jam%’==’yes’ goto next
if /i ‘%jam%’==’no’ goto seeya
cls
if not defined jam goto ERROR
echo %jam% is an invalid option. Try again.
pause
goto ERROR
:seeya
Cls
echo Well, see ya!
ping -n 2 127.0.0.1>nul
exit

Once you’ve copied and pasted that into notepad, save as Password.bat in your flash drive (don’t put it under any folders)

Then, you go START+R and type in CMD.

Then, type in (THe drive is the letter with the colon that is assigned to your flash drive EX: J:, E:)

YOURDRIVE:
attrib Flash +s +h

EX:
E:
attrib Flash +s +h

Now, you need to put in the password to open your files. I know it’s a long process, but you’ll appreciate this in the long run. I use this for my flash drive, and it works great. If I made an error and it doesn’t work, post that.

Where it says YOURPASSWORDHERE, delete that and type in your password you wish to use to open your flash drive.

Source(s):

Batch files. They’re awesome.

 

Apr 04

Difference between MySQL CE and MySQL Enterprise edition?

Difference between MySQL CE and MySQL Enterprise edition?

Difference between the community edition and the enterprise edition is added support and tools. The server itself is the same, but the enterprise edition gets updated more frequently and it is stable with quick bug fix support.

It would be safe and will not make any problem if the decide to move on to ORACLE in future.

MySQL Enterprise subscriptions include:
* MySQL Enterprise Server which is the most reliable, secure and up-to-date version of the world’s most popular open source database
* The MySQL Enterprise Monitor provides monitoring and automated Ad visors to help you eliminate security vulnerabilities, improve replication, optimize performance, and more
* MySQL Technical Support enables you to get your toughest technical questions answered quickly.
* MySQL Consultative Support, available with MySQL Enterprise Platinum gives you tailored advise from the MySQL Support team on how to properly design and tune your MySQL servers, schema, queries, and replication set-up for better performance.

MySQL Community Server:

* Freely available under the open source GPL license

In a MyISAM table with dynamic (variable length) rows, the index file for the table (tablename.MYI) stores row locations using 32-bit pointers into the data file (tablename.MYD). That means it can address only 4GB of space.

Apr 04

Send Free sms in India via Way2Sms login from Terminal using perl code

Send Free sms in India via Way2Sms login from Terminal using perl code

Prerequisites : WWW:Mechanize and it dependencies and perl. Require way2sms user account .

——————————————ScriptName: perlSMS.pl——————————-

#!/usr/bin/perl

use WWW::Mechanize;
use Compress::Zlib;

my $mech = WWW::Mechanize->new();

my $username = “way2sms login username“; #fill in username here
my $keyword = “password“;  #fill in password here

my ($text,$mobile,$option);
my @mobilenos;
$option = $ARGV[0];

if ( $option == “-f”) {
# reading file and collecting the nos

#my $smslistfile = $ARGV[1]; # I am using following file format for storing all mobile no. per line one mobile no.
my $smslistfile = “/root/abc”;
$text = “this is test mail using perl script-Any Message”;
open(FILE,$smslistfile) or die “Can not open file\n”;
@mobilenos = <FILE>;
close FILE;
}
else{
my $morenos = $ARGV[0];
if (length($morenos) > 10) {
# splitting nos with comma seperated in the first arg
@mobilenos = split(‘,’,$morenos);
}
else {
# for single phone no
@mobilenos = $morenos;
}
# collecting message to send
$text = $ARGV[1];
}

$deb = 1;

print “Total Character of message is “.length($text).”\n” if($deb);

$text = $text.”\n\n\n\n\n” if(length($text) < 135);

$mech->get(“http://wwwl.way2sms.com/content/index.html”);
unless($mech->success())
{
exit;
}
$dest = $mech->response->content;

print “Fetching…\n” if($deb);

if($mech->response->header(“Content-Encoding”) eq “gzip”)
{
$dest = Compress::Zlib::memGunzip($dest);
$mech->update_html($dest);
}

# Commented the below line from version 1b. Uncomment it for version 1a.
#$dest =~ s/<form name=”loginForm”/<form action=’..\/auth.cl’ name=”loginForm”/ig;

# Added the below updated line to replace the above line in the version 1b.
$dest =~ s/<form name=”loginForm”/<form action=’..\/Login1.action’ name=”loginForm”/ig;

$mech->update_html($dest);
$mech->form_with_fields((“username”,”password”));
$mech->field(“username”,$username);
$mech->field(“password”,$keyword);

print “Loggin…\n” if($deb);

$mech->submit_form();

$dest= $mech->response->content;

if($mech->response->header(“Content-Encoding”) eq “gzip”)
{
$dest = Compress::Zlib::memGunzip($dest);
$mech->update_html($dest);
}
foreach $mobile (@mobilenos){
# for loop begins
chomp($mobile);
print “\nMessage sending to “.($mobile).”\n”;
$mech->get(“http://wwwl.way2sms.com//jsp/InstantSMS.jsp?val=0″);
$dest= $mech->response->content;
if($mech->response->header(“Content-Encoding”) eq “gzip”)
{
$dest = Compress::Zlib::memGunzip($dest);
$mech->update_html($dest);
}
print “Sending … \n” if($deb);
$mech->form_with_fields((“MobNo”,”textArea”));
$mech->field(“MobNo”,$mobile);
$mech->field(“textArea”,$text);
$mech->submit_form();
if($mech->success())
{
print “Done \n” if($deb);
}
else
{
print “Failed \n” if($deb);
exit;
}
$dest =  $mech->response->content;
if($mech->response->header(“Content-Encoding”) eq “gzip”)
{
$dest = Compress::Zlib::memGunzip($dest);
#print $dest if($deb);
}
if($dest =~ m/successfully/sig)
{
print “Message sent successfully \n” if($deb);
}
# foreach loop ends
}
print “Message sent to all the numbers\n Bye.\n”;
exit;
#EOF
——————————End ————————————

Go to Linux Command prompt and type following command

#perl perlSMS.pl       (here you need to enter absolute path of perl script)

Total Character of message is 53
Fetching…
Loggin…
Message sending to <yourNumber>
Sending …
DoneMessage sent successfully
Message sent to all the numbers
Bye.

Its working very nicely.

Mar 29

Sending mail with Perl mail script

Sending mail with Perl mail script

How can I send an email with perl?

ANS:   With the help of sendmail you can send an email from your web based feedback form. You will need to indicate the path to the mail program, Sendmail. Usually the path to Sendmail is /usr/sbin/sendmail. Here is sample script that can send an email to your account or to end user. Make sure you setup

$to='MAIL ADDRESS TO SEND TO';
$from= 'EMAIL@MYOMAIN.COM';
$subject='YOUR SUBJECT';

Here is sample script to sending an email using perl

———————————–sendmail.pl—————————

#!/usr/bin/perl
print “Content-type: text/html\n\n”;
$title=’Perl Mail demo-Testing’;
$to=’MAIL ADDRESS TO SEND TO’;
$from= ‘webmaster@YOURDOMAIN.COM’;
$subject=’YOUR TEST Script’;
open(MAIL, “|/usr/sbin/sendmail -t”);

## Mail Header
print MAIL “To: $to\n”;
print MAIL “From: $from\n”;
print MAIL “Subject: $subject\n\n”;
## Mail Body
print MAIL “This is a test message Using perl and Sendmail! \n”;

close(MAIL);

print “<html><head><title>$title</title></head>\n<body>\n\n”;

## HTML content sent, let use know we sent an email
print ”
<h1>$title</h1>

A message has been sent from $from to $to

</body></html>”;
————————————————————————————-

Note::- Please start sendmail service before using this script.

Caution: Notice that the subject line in the above script ends with two \n (new line) characters. These characters are required to separate the email header from the email body with a blank line. Do not remove them.

Upload script Upload script to your web hosting cgi-bin directory. Then test is by typing url. For example http://mydomain.com/cgi-bin/sendmail.pl.

Mar 09

How to install Zend Framework on shared hosting server ?

How to install Zend Framework on shared hosting server

 

I’ve tried install Zend Framework on shared hosting server. Following are steps.

1. Upload Zend framework into your hosting server (path : root/library/Zend)

2. Look for your DOCUMENT_ROOT path

view source

echo phpinfo();

You will get DOCUMENT_ROOT path  (in this case we suppose it is /home/XYZ/html)

take a note your DOCUMENT_ROOT

3.Create or update your php5.ini or php.ini file. (If you are using php5, you need to use php5.ini file)

put this line, (If you already have, add this line end of the current set, connected with ‘:’)

include_path = [DOCUMENT_ROOT]/Zend Path

include_path = /home/XYZ/html/library

We’ve done install Zend Framework on shared hosting server.

Now for testing whether the zend installed well or not, let’s print out the zend frame work version.

require_once 'Zend/Version.php';
echo 'Your Zend Framework version = ' . Zend_Version::VERSION;

Can you see your zend version? then your zend has been installed successfully!

Your Zend Framework version = 1.11.1

Mar 07

How to install Sun Java JDK in CentOS 6, OpenSUSE and Debian/Ubuntu

How to install Sun Java JDK in CentOS 6, OpenSUSE and Debian/Ubuntu

Some times some application needs only Sun Java, It will refuse to work in other version (eg. OpenJDK).

CentOS, Debian/Ubuntu method

But by default OpenJDK based java was installed in my system.

[root@server2 sandbox]# java -version
 java version “1.6.0_17″
 OpenJDK Runtime Environment (IcedTea6 1.7.9) (rhel-1.36.b17.el6_0-x86_64)
 OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

 

Step 1: Download JDK from http://www.java.com. I got JDK version 7 in rpm format.

root@server2 sandbox$ ls *.rpm
jdk-7-linux-x64.rpm

Step 2: Install the RPM.

[root@server2 sandbox]# rpm -i jdk-7-linux-x64.rpm
 Unpacking JAR files…
 rt.jar…
 jsse.jar…
 charsets.jar…
 tools.jar…
 localedata.jar…

By default Java will be installed to /usr/java/jdk1.7.0/

Step 3:  Add this new java to the alternatives configuration & Update the java alternatives

[root@server2 sandbox]# alternatives - -install /usr/bin/java java /usr/java/jdk1.7.0/bin/java 2
[root@server2 sandbox]# alternatives – -config java

There are 3 programs which provide ‘java’.

Selection Command
———————————————–
*+ 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
3 /usr/java/jdk1.7.0/bin/java

Enter to keep the current selection[+], or type selection number: 3

Step 4: Now verify the java version

[root@server2 sandbox]# java -version
java version “1.7.0″
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

OpenSUSE way is here

# rpm -i jdk-7-linux-i586.rpm
Unpacking JAR files…
rt.jar…
jsse.jar…
charsets.jar…
tools.jar…
localedata.jar…
plugin.jar…
javaws.jar…
deploy.jar…

# update-alternatives – -install /usr/bin/java java /usr/java/jdk1.7.0/bin/java 2
# update-alternatives – -config java

There are 3 alternatives which provide `java’.
Selection    Alternative
———————————————–
*+        1    /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
2    /usr/lib/jvm/jre-1.5.0-gcj/bin/java
3    /usr/java/jdk1.7.0/bin/java
Press enter to keep the default[*], or type selection number: 3
Using ‘/usr/java/jdk1.7.0/bin/java’ to provide ‘java’.
# java -version
java version “1.7.0″

Congrats! you have made it.

Mar 05

string shortening

$str = “Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum”; $str = trim($str); $maxlength = 50;

echo $excludeval = (strlen($str)>$maxlength) ?  (( $str[$maxlength] === ‘ ‘)? substr($str,0,$maxlength): substr( $str,0,strrpos( substr($str,0,$maxlength), ‘ ‘) ) ) : $str;

echo $includeval = (strlen($str)>$maxlength) ?  (( $str[$maxlength] === ‘ ‘)? substr($str,0,$maxlength): substr( $str,0,  $maxlength + strpos( substr($str,$maxlength), ‘ ‘) ) ) : $str;

 

Out put is :

Lorem Ipsum is simply dummy text of the printing
Lorem Ipsum is simply dummy text of the printing and

Feb 29

How to find Framework on window OS?

How to find Framework on window OS?

Use following command

>cmd /c dir/b/ad “%systemroot%\Microsoft.NET\Framework”&pause

Older posts «