Wednesday, July 29, 2009

Zion Lurk 1.0 beta-Hide your secret/important files..




Everyone like to protect their secret/personal/important files in his mobile from others who using our mobile..

Here is the option to protect/hide your file from mobile browser to keep them away from other users.

The key features are

1.'Lock' option is to lock the file(s),use the browse option to browse the files to be locked and use 'Mark' option in the Zion Browser to select files to be locked and then click 'Lock' to lock the file..

2.'Unlock' option is to unlock file(s),the browse option let you see the locked files..there you can unlock the file..

3.'Settings' option is to change your login password.

Default password is:'zionlurk'

Note:Once you installed the application in your mobile,before going to delete the application ensure that you have unlocked all the locked files otherwise those file may become inaccessible even if you reinstall the application.

After installing the application move it in to external memory,because all inatallation will go to internal memory.To hide more files you have to move the application to external memory..

Download Zion Lurk 1.0 Beta


cheap kerala webhosting plans

cellphone application developers

Tuesday, July 28, 2009

windowsXP command manual

To get the whole commands that would be supported by the windowsXp go to
start--> run
in run window type

hh ntcmds.chm

this will open a command manual of chm format.

linux minicom

This is a utility which provide commandline interface to the serial port connected devices.
this is some what similar to the hyperterminal in windows
which also used for modem communications

configure minicom

minicom -s

set device(eg, ttyS0,) set baudrate say (9600 or parity hardware flow control etc).and etc...
save the configuration file

and in the root prompt

enter command

minicom

will connect device which you configured in the minicom.

(router interface with linux mechine is also done using minicom)

Rebuild the Windows boot.ini.

Insert the Microsoft Windows XP CD
Reboot the computer form CD
Setup menu press R to open the recovery console
Enter the Admin password
Type bootcfg /rebuild to start the rebuild process.
The rebuild process will step you through a number of steps depending upon how many operating systems
or u can type /fastdetect to automatically detect the available options.
type exit to reboot the computer.

Monday, July 27, 2009

hacking root shell in linux

Here describes the way you can obtain linux root shell,by changing the init process.
we need to edit the grub(editing grub is described in previous posts) bootup screen using press 'e' place the end of the line as following

init=/bin/sh

enter and press 'b' for boot

after boot you will get a shining root shell "#"!!
in this above procedure we could bypass the init proces to a shell from what it does in normal.
in this point we didn't mount any file system. (manually mount if it required.normally dont need)
for checking the read right permission for the file system use touch utility

touch something

if it is given an error message then you dont have write permission to the file system.

to gain the filesystem read write permission u need to remount it as follows

mount -o remount,rw /

after that you can do anything as root!!!eg. change the root password. placing commands in inittab etc...remember dont press ctrl+D it will kill the shell causing kernel panic.

ls commands in linux

There are list of linux commands which begin with ls
the common nature of the ls commads are listing operation here there are...

ls- list contents (commonly used).

lsof- list the opened files which is used by the running process.

lsusb-list the usb devices connected to the system.

lsmod-list the modules which is loaded in the running kernel.

lspci-list the pci(Peripheral Component Interconnect) devices (use lspci -vvx to get meaning full data othere wise expert can understand it).

lsattr-to list attributes of a file(attributes like immutable field)

lshal-list hal(Hardware Abstraction Layer, HAL which is a piece of software that provides a view of the various hardware attached to a system)devices


cheers.......

Sunday, July 26, 2009

Zion SMS Mania 1.1 beta-Send SMS freely from your mobile...




You can send SMS without any cost you just need the following things..

1.Need way2sms login(for this just login to way2sms(www.way2sms.com) and create an account its totally free).

2.GPRS must be activated in your phone.

3.Cell must be java enabled.

Then you can start sending SMS very easily no need to go to way2sms and waste your time,you can send in just one click..

In this application,in the first two fields you have to enter your way2sms username and password.

Then in the third field you can enter your message(you can also browse for the message in your phone).

Fourth field enter the recipients phone numbers,each number must be seperated by semicolon(eg:9496340837;9995736630).(You can also browse for the txt file that contains the phone numbers,file contains numbers seperated by semicolon,if you save the recipients nos in a txt file you don't need to enter them all the time,you just need to locate the file..)

There is an option to remember your login information so that you don't need to enter them each time you login to this application..
Download Zion SMS Mania 1.1 Beta
webhosting webdevelopment cochin kerala


cellphone apllication development Cochin Kerala

Change the Linux root password from single user mode

Step by step change root password:

1. Boot up your Fedora 10 system, on the boot up splash screen press and hold shift key until you enter the GRUB screen
Press and hold "shift" key here and wait until GRUB boot menu screen appear

2. if you have multiple operating system installed, you may have to select the Fedora 10 by using the 'up' and 'down' key... then hit the 'e' key to enter GRUB editing mode

3. Use the 'up' and 'down' key again, select the 'kernel /vmlinuz-2.6.27.5-117.fc10.i686 ro root=UUID=27f6ac23-638f-439a-8a97-2baaf6a32922 rhgb quiet', and the hit the 'e' key again to edit the grub command line.

4. The below screen appear after you hit the 'e' key, now notice that you mouse cursor at the end of line 'kernel /vmlinuz-2.6.27.5-117.fc10.i686 ro root=UUID=27f6ac23-638f-439a-8a97-2baaf6a32922 rhgb quiet'.

5. Change at the end of the line that say 'rhgb quiet' to 'linux single'

From : kernel /vmlinuz-2.6.27.5-117.fc10.i686 ro root=UUID=27f6ac23-638f-439a-8a97-2baaf6a32922 rhgb quiet

To : kernel /vmlinuz-2.6.27.5-117.fc10.i686 ro root=UUID=27f6ac23-638f-439a-8a97-2baaf6a32922 linux single

hit 'Enter' key after finish enter the 'linux single' at the end of kernel line, as show on GRUB.

6. Hit the 'b' key to boot the selected kernel and start the boot process to Linux single user mode.

7. After you hit the 'b' key, the Fedora 10 should reboot and then enter the single user mode and should give you root shell terminal without prompt any password field or ask for password.

Issue passwd command to change root user password on Fedora 10 after we finish the procedure to enter the Linux single mode as show on step by step example above.
[root@fedora /]# passwd <-- Start type in 'passwd' command and hit Enter key

Changing password for user root.

New UNIX password:

passwd: all authentication tokens updated successfully.

Then reboot the system and start using the new root password for your Fedora 10 system

[root@fedora /]# reboot <-- Type in 'reboot' command and hit Enter key to start reboot Fedora system

website development hosting cochin - Kerala IT solution providers, Kochi

Thursday, July 23, 2009

Booting another bootloader(grub,lilo,ntldr....) from grub

Chainloading an operating system allows grub to boot an opearating system's boot loader. This is commonly used to boot Windows for instance.


eg.
Suppose main grub installed on /dev/sda1 and the second os is installed on /dev/sda2
in /boot/grub/grub.conf or /boot/grub/menu.lst (which is grub configuration file)

add as following


title Linux 2 on /dev/sda2
root (hd0,1)
# or use rootnoverify (hd0,1)
#rootnoverify is same as root but don't attempt to mount the partition.
chainloader +1

.

FIX Master Boot Record

The simplest way to repair or re-create MBR is to run Microsoft's standard utility called FDISK with a parameter /MBR, like

A:\> FDISK.EXE /MBR
FDISK is a standard utility included in MS-DOS, Windows 95, 98, ME.

If you have Windows NT / 2000 / XP, you can boot from startup floppy disks or CD-ROM, choose repair option during setup, and run Recovery Console. When you are logged on, you can run FIXMBR command to fix MBR.

1. First, restart your computer with the Windows XP setup disk in the CD drive. If you don’t have your original disk, borrow one or download a ISO image from a torrent site.

2. When prompted, boot from the CD drive by pressing any key. If Windows loads automatically, you will first have to enter the BIOS setup and change the order of the boot devices to start with the CD drive.

change boot order

3. Once the setup loads, you will see the option to press R to repair a Windows installation.

repair windows

4. Once the Recovery Console loads up, you will have to type in a number that corresponds to your Windows installation. This is normally just 1. Press Enter and then type in the Administrator password.

recovery console

5. Now at the prompt, type in fixmbr. Your damaged MBR will now be replaced with a new master boot record and your computer should now be able to boot properly. Note that you may also want to run the fixboot command to repair the boot sector with a new one.

Wednesday, July 22, 2009

Bluetooth command line operations in linux

Here are the commands one can use to work with bluetooth devices in a linux based pc

hciconfig
- Gives info about the bluetooth hci on your pc
- Ensure the device is up and running and has required scan modes
- hcitool dev should also give some of this info

hcitool inq and hcitool scan
- Gives info about or rather identifies nearby bluetooth devices

hcitool info
- BTAddr refferes bluetooth address.
- Get info about remote bluetooth device

l2ping
- One way to see if we can communicate with a remote bluetooth device

sdptool browse or sdptool records
- Gives info about the services provided by a remote bluetooth device

obexftp –nopath –noconn –uuid none –bluetooth –channel elNo> –put
- Allows one to send file without specifying the pin on the remote device side
- The OPush channel number for device is got from sdptool above

passkey-agent –default
- Pin specified here is what the remote BT device should provide
or its user enter on that device when requested.

obexftp -b -v -p
- Allows one to put a file onto the specified BT device
- obexftp could also be used to get or list the files on the BT device
- also allows one to identify a nearby BT device by just giving -b option

obexpushd
- Allows one to recieve files sent from a bluetooth device.
- Depending on who started it, the recieved files will be stored in the corresponding home directory

Note: The old style pin_handler doesn’t work with latest bluez(is a protocol stack for linux), you require adbus based passkey handler and there is one provided by default by bluez-utils
called passkey-agent

Blogger SEO Tips...Submit sitemaps in Google Webmaster tools

Don't know how many of you use Google webmaster tools...Tweaking your blog or site needs you to use this tool as a way to interact more with the Google web crawler..Just add your site or blog into this tool along with a sitemap. It can help the search engine to figure out the structure of your blog and index it in a better way...

More over the tool can display if there are any crawl errors, any url in your site having crawler access problem, frequency of crawling, number of pages indexed and many more..You can also set the frequency at which you may need your site to be crawled by Google..


Adding your blog and its sitemap..........



1) Just goto the webmaster tools from your google account and add your site.

2)go to dashboard by clicking the added site name->SiteConfiguration->SiteMaps->submit sitemap->general web sitemap->

If your blog has less than a 100 posting add sitemap as

atom.xml?redirect=false&start-index=1&max-results=100

And if your blog having more than 100 postings you have to add one more site map in addition to the above as..

atom.xml?redirect=false&start-index=101&max-results=100

and if more than 200 you have to change the 'start-index=101 in the above link to start-index=201 and add one more sitemap, ie the 3rd site map is

atom.xml?redirect=false&start-index=201&max-results=100 and so on..


if you are just giving the atom feed link of your blogger as sitemap, Google won't be indexing the inner url's of your blog other than the first blog post url..ie Google web crawler can see only a single url even when your blog is having more than 100 or more blog post url's.. so check it out...

If your sitemap is submitted successfully you will see the number corresponding to your total blog postings as submitted urls.. And note that, the indexed url's depends on the quality of blog postings and is upto Google's strategy of finding quality contents...

Goodluck from pixelshots the photo blog...

courtesey: kerala business website designs hosting plans




Tuesday, July 21, 2009

Change file attribute in Linux

Hi all

Make a file readonly, ie nobody, even root, can make changes to a file:
This can be done by using the "chattr" command and "i" attribute.

[root@odcclient6 Desktop]# chattr +i test.txt

you can view the attribute of the file using this command lsattr.

To remove the attribute use this command "chattr -i"

Cheers...............

Find encoding of given file linux

It is simple to find encoding of a given file in linux
by simply using this command

file filename

eg:


vimal@TECH-10:~$ file vimal
vimal: ASCII text

Mysql Search and Replace

Use this query to search and replace in mysql.

update 'tablename' set field = replace(field,'search_item','replace_item');

Monday, July 20, 2009

linux shell script for find and replace strings in a directory

This is a shell script used to find and replace a string with another.This can be directly executed on shell.




#check for required parameters
if [ ${#1} -gt 0 ] && [ ${#2} -gt 0 ];
then
for f in `find -type f`;
do
if grep -q $1 $f;
then
cp $f $f.bak
echo "The string $1 will be replaced with $2 in $f"
sed s/$1/$2/g < $f.bak > $f
rm $f.bak
fi
done

else
#print usage informamtion
echo usage incorrect.try findscript string1 string2
echo special characters forwarded with slash

Thursday, July 16, 2009

To load modules on startup LINUX

There are so many situations to add our new compiled modules on system startup like to add custom device driver extension for existing modules, etc..
we will make(build or compile) our modules using the help of make utility on linux.
this utility or cammand uses Makefile as its input for compiling or building modules.
after build the modules we will get our executable module as
(make modules install for compiling kernel also install all modules in /lib/modules/uname -r/kernel directory)


modulename.ko

if we want to load module ,
insmod modulename.ko

there are somany issues for this modules are depended on another module.
if say our module modulename.ko is depended on module1.ko and module2.ko
in this case we want to load

insmod module1.ko
insmod module2.ko
insmod modulename.ko


to simplify this task we have a modprob utility
we could set dependency in a file /lib/modules/($SHELL uname -r)/modules.dep
modprobe actually uses insmod to insert module in a running kernel.

the entry in modules.dep is like as follows
/lib/modules/2.6.26-1-686/kernel/mymodule.ko: /lib/modules/2.6.26-1-686/kernel/module1.ko /lib/modules/2.6.26-1-686/kernel/module1.ko

(eg: modulename : (colon) first dependency (space)second dependacy (space) etc....)
syntax is important!!!


use command
modprobe mymodule.ko
it will automatically add module1.ko and module2.ko automatically

lets come to the context if we want to load it on startup we will have to configure modprobe. For that we could use /etc/modprobe.conf or /etc/modules.conf or /etc/modules according to different distributions of linux
/etc/modules.conf uses 2.4 and earlier version now we are popular 2.6 kernel so it is modeprobe.conf(/etc/modprobe.d/)

add a single line to that file will load the module on the startup
just add
at the end of line
mymodule

it is very easy to play with modprobe.conf there is a command line interface also there.

man modprobe ,for more information!

we could set aliases for our modules in this file

hope u get some idea about how load module into running kernel at runtime....

regards

Nat Rule for IPTABLES

Hi all

This is simple script for nat rule in ip tables. Just make changes in the script and run it. After running the script do the following.

service iptables save
service iptables restart

cheers....... :-)


Download -

Note: Make a copy of your current rule [/etc/sysconfig/iptables] before executing this.

Wednesday, July 15, 2009

The Blogger Data API

What is the Blogger Data API?

The Blogger Data API allows client applications to view and update Blogger content in the form of Google Data API feeds. Your client application can use the Data API to create new blog posts, edit or delete existing posts, and query for posts that match particular criteria.



follow the link
http://code.google.com/apis/blogger/

by, kerala webhosting

way2sms API

Send free sms from your application using java api.
You have to create an account in way2sms
Implementaion details are alredy published in codeglobe
Try it at your own risk
Download



source

Find current stack view. Dont be a hacker

this is a simple c code for accessing what is the current stack contain

#include
int main()
{
printf("%8x.%8x.%8x.%8x");
//how much time you reapeat you will get one step below from the current stack pointer and it ends //on the null
}

explanation:
this is known as format string vulnerability
usually printf() function in c require minimum 2 or more arguments ie.format string as well as the value of the variable to be formated.
here used %x is hexadecimal format 08 for 8 places
if we closely look at the implementation of printf, the last argument is put on the stack is address of printf function here no more arguments so it is being a function call it can trace the entire stack.

Yahoo Astrology API Java

Impelmentaion details are in codeglobe.blogspot.com
Download

Tuesday, July 14, 2009

EXTRACT ALL LINK FROM A GIVEN HTML PAGE

This below function accept an html page(as a result of curl_excec()) as input
it will search and retrieve all links from that page and return it
it uses xpath to retrieve the link
try it.....

function get_link($html)
{
$dom = new DOMDocument();
@$dom->loadHTML($html);
$xpath = new DOMXPath($dom);
$hrefs = $xpath->evaluate("/html/body//a");
for ($i = 0; $i < $hrefs->length; $i++) {
$href = $hrefs->item($i);
$url = $href->getAttribute('href');
echo $url."
"
return $url;
}
?>

parsing data from excel xml sheet using DOM

here the excel sheet contains two coulmns
1.url
2.result
parsed the above are saved into corresponding variables,$url,$result

enter data into a excel sheet then save it as excel xml with extension .xml
upload in to the script





if ( $_FILES['file']['tmp_name'] )
{
$dom = DOMDocument::load( $_FILES['file']['tmp_name'] );
$rows = $dom->getElementsByTagName( 'Row' );
$first_row = true;
foreach ($rows as $row)
{
if ( !$first_row )
{
$url = "";
$result = "";

$index = 1;
$cells = $row->getElementsByTagName( 'Cell' );
// echo $cells;
foreach( $cells as $cell )
{
$ind = $cell->getAttribute( 'Index' );
if ( $ind != null ) $index = $ind;
//echo $index;
if ( $index == 1 ) $url = $cell->nodeValue;

if ( $index == 2 ) $result = $cell->nodeValue;
//echo "$cell->nodeValue";
$index += 1;
}

PHP code to check whether a yahoo user is online or not

Hi

Do you want to check whether a yahoo user is avoiding you by setting his status to invisible mode. Please try this code..

< ? php //-------> No spaces in between
$id="sujith.sasi";
$url = 'http://opi.yahoo.com/online?u=';
$data = file_get_contents($url . $id);
if (trim(strtolower(strip_tags($data))) != 'user not specified.') {
echo (strlen($data) == 140) ? 'online' : 'offline'; }
else {
echo trim(strip_tags($data));
} ?>


cheers........ :-) [Remember to remove the spaces b/w the php "
< ? php " tag]

login and get contacts from yahoo mail with php curl

This is the script used to login into yahoo mail in an automated way. This script also fetching the contacts and email addresses from the address book.Very popular php curl library is used in this script.


set_time_limit(0);

if($_POST['login'])
{

$php_userid = $_POST['login'];
$php_password = $_POST['passwd'];


$cookie_file_path = "./cookie.txt"; // Please set your Cookie File path


$fp = fopen($cookie_file_path,'wb');
fclose($fp);
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
$reffer = "http://mail.yahoo.com/";

// log out.
$LOGINURL = "http://us.ard.yahoo.com/SIG=12hoqklmn/M=289534.5473431.6553392.5333790/D=mail/S=150500014:HEADR/Y=YAHOO/EXP=1135053978/A=2378664/R=4/SIG=133erplvs/*http://login.yahoo.com/config/login?logout=1&.done=http://mail.yahoo.com/&.src=ym&.lg=us&.intl=us";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$result = curl_exec ($ch);
curl_close ($ch);

//1. Get first login page to parse hash_u,hash_challenge

$LOGINURL = "http://mail.yahoo.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$loginpage_html = curl_exec ($ch);
curl_close ($ch);

preg_match_all("/name=\".u\" value=\"(.*?)\"/", $loginpage_html, $arr_hash_u);
preg_match_all("/name=\".challenge\" value=\"(.*?)\"/", $loginpage_html, $arr_hash_challenge);

$hash_u = $arr_hash_u[1][0];
$hash_challenge = $arr_hash_challenge[1][0];

// 2- Post Login Data to Page https://login.yahoo.com/config/login?

$LOGINURL = "https://login.yahoo.com/config/login?";
$POSTFIELDS = '.tries=1&.src=ym&.md5=&.hash=&.js=&.last=&promo=&.intl=us&.bypass=&.partner=&.u='.$hash_u.'&.v=0&.challenge='.$hash_challenge.'&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=0&.chkP=Y&.done=http%3A%2F%2Fmail.yahoo.com&login='.$php_userid.'&passwd='.$php_password;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_REFERER, $reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$result = curl_exec ($ch);
curl_close ($ch);

preg_match_all("/replace\(\"(.*?)\"/", $result, $arr_url);
$WelcomeURL = $arr_url[1][0];

// 3- Redirect to Welcome page. (Login Success)

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$WelcomeURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$result = curl_exec ($ch);
curl_close ($ch);
// echo $result;

// 4- Get Address Book.
$addressURL = 'http://address.mail.yahoo.com/?A=B';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$addressURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$result = curl_exec ($ch);
curl_close ($ch);


//print $result;
preg_match_all("/\"\/yab\/us\/Yahoo\.csv\?(.*?)\"/", $result, $arr_address_url);
$randURL = html_entity_decode($arr_address_url[1][0]);
preg_match_all("/id=\"crumb2\" value=\"(.*?)\"/", $result, $arr_crumb);
$hash_crumb = $arr_crumb[1][0];

// 5- show Address Book.
$addressURL = 'http://address.mail.yahoo.com/index.php';

$POSTFIELDS ='.crumb='.$hash_crumb.'&VPC=import_export&submit%5Baction_export_yahoo%5D=Export+Now';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$addressURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$result = curl_exec ($ch);
curl_close ($ch);

//print $result;

} // extra code 2 if

else
{
login_form();
}


////////////////////////////////////////////////////////////////////////////////////////////////
Here login form is the function to generate a html form with username and password
login and passwd are the name of the used text field respectively

Get mobile directories/roots using J2ME

//try this code

Enumeration roots = FileSystemRegistry.listRoots();
while(roots.hasMoreElements()){
//here you can do your actions on the roots-
//use 'roots.nextElement()' to get the root/directory
//for eg you can add these directories into a choice group.
//To get the string value of the diectory use
//'String=roots.nextElement().toString();'
}

java cellphone software developers cochin

website hosting development cochin kerala

change screen resolution of linux pc command line

You can change the screen resolution of u'r linux pc by just input the command "xrandr"

[root@localhost] xrandr
will display the compatible resolutions
u can set a resolution by
[root@localhost] xrandr -s 1024*768

Monday, July 13, 2009

Take Screenshot Using Linux Command

Do you want to take screen shot using command. Then try this command in the console.

command - import

[root@odcclient6 Setup]# import -trim /root/Desktop/test.jpg


Cheers.................... :-)

Random Number generation in PHP

function randomdigit($digits) {
static $startseed = 0;
if (!$startseed) {
$startseed = (double)microtime()*getrandmax();
srand($startseed);
}
$range = 8;
$start = 1;
$i = 1;
while ($i<$digits) {
$range = $range . 9;
$start = $start . 0;
$i++;
}
return (rand()%$range+$start);
}
?>

Zion Ultra..Place your inbox anywhere in yor mobile...




Zion Ultra Beta 2


An application that allow you to place your Inbox anywhere in your mobile phone. Through this cellphone application you can choose where to place your inbox,outbox and which port in which you are sending SMS etc.It also allow you to create txt templates in you mobile and also you can send txt files as SMS. If this application is running on your mobile and other person is sending message throug this application you will receive the SMS in this application instead of the normal inbox(be ensure that both sender and receiver must use the same port-default port is 5000).

cellphone application developers website developers webhosting, Cochin, Kerala

Download Zion Ultra Beta 2

Linux Funny Commands

THE WHATIS COMMAND

If you want to know what is the use of cd command just type in console

[sujith@odcclient6 bin]$ whatis cd
cd (1p) - change the working directory
cd [builtins] (1) - bash built-in commands, see bash(1)

NOTE: Some times you may have to build the database first by running "/usr/sbin/makewhatis".


Here comes the fun :

[sujith@odcclient6 bin]$ cd /usr/bin
[sujith@odcclient6 bin]$ ls | xargs whatis | less

[ls = list directory contents, xargs = build and execute command lines from standard input]

mysql password reset in 10 steps

suppose u forgot the password of u'r mysql server
while u are trying to logged in it will display a message like
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
so here is a solution to change the password of mysql with out loss of u'r data
first you have to stop the mysqld service
1)service mysqld stop

then u have to find out the mysqld path
2) whereis mysqld
it will display the mysqld location in your system
Then u have to run the mysqld with the option --skip-grant-tables

3)/usr/libexec/mysqld --skip-grant-tables

then the mysql will be started
090713 13:15:33 InnoDB: Started; log sequence number 0 11427172
090713 13:15:33 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.0.45' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution

Now u can login to mysql with out using password using a client
4)mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

after that u have to choose the mysql as your database
5)use mysql
in mysql database the user table contains the login details of the user

to see the structure of the table "user" just input
6)desc user

u have to use update command to change the password of a user
7)update user set password=password('test123') where user='root';
this will set the password of root to test123

8)flush privilges
;

kill the mysqld u have started
9)killall -9 mysqld
start mysqld service again

10)service mysqld start

now u can login to the mysql root account using test123 as password

PHP program for trace remote IP address

This program helps you to trace the IP address of u'r visitor
class IPDetails{
var $ip;
var $countryName;
var $countryCode;
var $status;
var $regionCode;
var $regionName;
var $city;
var $zip;
var $latitude;
var $longitude;
var $gmtOffset;
var $dstOffset;

function collectIPDetails($ip){
$proxy = "192.168.0.6:3128";
$addr = "http://www.ipinfodb.com/ip_query.php?ip=$ip&output=xml";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $addr);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPGET,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_TIMEOUT,10);
$pg = curl_exec($ch);
if($pg){
$data = new SimpleXMLElement($pg);
$this->ip = $data->Ip;
$this->countryName = $data->CountryName;
$this->countryCode = $data->CountryCode;
$this->status = $data->Status;
$this->regionCode = $data->RegionCode;
$this->regionName = $data->RegionName;
$this->city = $data->City;
$this->zip = $data->ZipPostalCode;
$this->latitude = $data->Latitude;
$this->longitude = $data->Longitude;
$this->gmtOffset = $data->Gmtoffset;
$this->dstOffset = $data->Dstoffset;
}
}
}
$dt=new IPDetails();
$ip = $_SERVER['REMOTE_ADDR'];
$dt->collectIPDetails($ip);
echo $dt->countryName;
echo $dt->ip;
?>

Get your horo scope

It's a small program which can be used for display horoscope in u'r web site or application try this

package sms;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Hashtable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Astrology {

/**
* This method will return your horoscope according to the date passed as argument
* @param date DD-MM-YYYY the date of birth
* @return : string
* @throws Exception Invalid Date format
*/
public static String getYourHoroscope(String date) throws Exception{
Pattern datePattern = Pattern.compile("(\\d{2})-(\\d{2})-(\\d{4})");
Matcher dateMatcher = datePattern.matcher(date);
if(!dateMatcher.matches())
throw new Exception("Invalid date format");
String yourHoroscope="";
Hashtable horoscope=new Hashtable();
horoscope=getHoroscope();
int day=0,month=0;
day=Integer.parseInt(dateMatcher.group(1));
month=Integer.parseInt(dateMatcher.group(2));
System.out.println("month:"+month);
System.out.println("day:"+day);
if(((month==12)&&(day>=21))||((month==1)&&(day<=19))){
yourHoroscope=horoscope.get("capricon");
} else if(((month==1)&&(day>=20))||((month==2)&&(day<=18))){
yourHoroscope=horoscope.get("aquarius");
} else if(((month==2)&&(day>=19))||((month==3)&&(day<=20))){
yourHoroscope=horoscope.get("pisces");
} else if(((month==3)&&(day>=21))||((month==4)&&(day<=19))){
yourHoroscope=horoscope.get("arius");
} else if(((month==4)&&(day>=20))||((month==5)&&(day<=20))){
yourHoroscope=horoscope.get("taurus");
} else if(((month==5)&&(day>=21))||((month==6)&&(day<=21))){
yourHoroscope=horoscope.get("gemini");
} else if(((month==6)&&(day>=22))||((month==7)&&(day<=22))){
yourHoroscope=horoscope.get("cancer");
} else if(((month==7)&&(day>=23))||((month==8)&&(day<=22))){
yourHoroscope=horoscope.get("leo");
} else if(((month==8)&&(day>=23))||((month==9)&&(day<=22))){
yourHoroscope=horoscope.get("virgo");
} else if(((month==9)&&(day>=23))||((month==10)&&(day<=22))){
yourHoroscope=horoscope.get("libra");
} else if(((month==10)&&(day>=23))||((month==11)&&(day<=21))){
yourHoroscope=horoscope.get("scorpio");
} else if(((month==11)&&(day>=22))||((month==12)&&(day<=21))){
yourHoroscope=horoscope.get("sagittarius");
}
return yourHoroscope;
}

/**
* This method used to collect horoscope from the web site
* @return return a hash table
*/
public static Hashtable getHoroscope(){
URL url=null;
Hashtable horoscope=new Hashtable();
try {
url = new URL("http","192.168.0.6",3128,"http://www.sxmsms.com/horoscope.aspx");
HttpURLConnection uc=null;
uc = (HttpURLConnection) url.openConnection();
BufferedReader br=null;
br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
String temp="";
StringBuffer data=new StringBuffer();
while ( (temp = br.readLine()) != null ) {
data.append(temp);
}
String content=data.toString();
int startIndex=0;
int endIndex=0;
if(content.indexOf("
startIndex=content.indexOf("
content=content.substring(startIndex);
endIndex=content.indexOf("
");
content=content.substring(0,endIndex);
content=content.substring(content.indexOf("")+8,content.lastIndexOf("")+4);
}
String []strs=content.split("");
String key="";
String msg="";
for(int i=0;i key=strs[i].substring(0,strs[i].indexOf("
")).toLowerCase();
msg=strs[i].substring(strs[i].indexOf("SMS\">")+5,strs[i].lastIndexOf(""));
horoscope.put(key, msg);
}
} catch (Exception e) {
e.printStackTrace();
}
return horoscope;
}


public static void main(String[] args)throws Exception {
System.out.println(getYourHoroscope("10-09-1983"));
}
}

Command to check whether the sytem is alive or not

FPING

fping is a ping like program which uses the (ICMP) echo request to determine whether an ip is up or not.

fping is different from ping in that you can specify any number of hosts on the command line, or specify a file containing the lists of hosts to ping.

Working
fping will send out a ping packet and move on to the next host in a round-robin fashion.

If a host replies, it is noted and removed from the list of hosts to check. If a host does not respond within a certain time limit and/or retry limit it will be considered unreachable.

Unlike ping, fping is meant to be used in scripts .
Really helpful when we need to set the status of the a particular host in our applications.

Download Link

http://linux.softpedia.com/progDownload/fping-Download-10469.html

download and install the software. Type fping -h will list out the various parameters.

Example shell script

#!/bin/sh
status=`fping 192.168.0.88 | cut -d ' ' -f 1`
if [ $status != "alive" ]
then
echo 'Server Down. Please check the network'
fi


Thursday, July 9, 2009

Configuring IP Phones with Asterisk

The Most cheapest way to talk in between.... Asterisk allows people to communicate using the internet.

First step : Download a Soft Phone ( xlite recommended)

download link : http://www.counterpath.com/x-lite.html&active=4

SIP Client Configuration: (Now I am talking about the SIP clients only)
Now, I will describe how you can register SIP users with asterisk. This includes the configuration of all Asterisk conf files and phone settings.

First, make sure Asterisk is installed. Most of the files to be configuration files are stored in the folder /etc/asterisk.

Example:
All information for SIP users is stored in sip.conf. Dialing Rules are read from extensions.conf. Voicemails are stored in voicemail.conf etc.

However, you do need a username and secret which will allow you to call someone who is registered. To receive a call, you must be a registered user and have an extension.

To Register SIP Users:

All users must be registered in sip.conf or users.conf and all valid extensions must be declared in extensions.conf

Follow these instructions:

-Registering a user in sip.conf or users.conf
-Registering a number in extensions.conf

1.
open the users.conf file in /etc/asterisk folder and enter the following user information

[1000]
username = 1000
disallow = all
allow = ulaw,alaw,gsm,g726,g729
host = dynamic
type=friend
secret = 1000
context = internaldemo
cid_number = 1000
hassip = yes
nat = no
canreinvite = no
dtmfmode = RFC2833
insecure = port

[1000]
This means we are registering user with extension '1000'.

secret - the password of the user '1000'.

host=dynamic
This sets dynamic IP for the host. You may also define this as a static IP

context=internaldemo
This defines the dial context for the user which in this case is internaldemo. In Asterisk, outgoing numbers are divided in groups called contexts in order to separate/define different needs for different user types. For example, a context for local calls, another for within the city, and another for international calls and so on.

The user registration process is now completed on Asterisk. Let us write a dialing rule for the user.

2 .Go to /etc/asterisk and open extensions.conf

Type the following

[
internaldemo]
exten = 123, 1, Dial(SIP/1000)

[
internaldemo]
This registers the context ‘internaldemo

exten => 123,1,Dial(SIP/1000)

when dialing number 123, Asterisk will first Dial the user (1000) xlite through SIP protocol. The command is : exten => number, priority, Dial(protocol/user). The priority determines the sequence in which the extensions will be executed.

We now have a registered SIP user and extension on Asterisk. Follow this same process to register another SIP user and extension in order to place calls.

Start by registering the second user in the same way in /etc/asterisk/users.conf

[1001]
username = 1001
disallow = all
allow = ulaw,alaw
host = dynamic
type=friend
secret = 1001
context = internaldemo
cid_number = 1001
hassip = yes
nat = no
canreinvite = no
dtmfmode = RFC2833
insecure = port

Register the extension (1234) in /etc/asterisk/extensions.conf in the same context
internaldemo.

[internaldemo]
exten = 123, 1, Dial(SIP/1000)
exten = 1234, 1, Dial(SIP/1001)


Now the configuration are ready. Start the asterisk pbx by typing asterisk -gvvvvvvvvvvc in the terminal. if u are already started type module reload in the asterisk CLI.


X-Lite Configuration

Take menu > System Settings > Sip Proxy > Default




Tuesday, July 7, 2009

Asterisk installation

Before we can start, make sure you have the following:
1. Computer with installed Linux OS (Fedora 7)
2. Asterisk's installation packages

1. Download the Asterisk Installation packages
asterisk 1.4.21.2
zaptel 1.4
Libpri 1.4.10.1
asterisk addons 1.4.8
(For Mp3 Support and MySql)

2. Obtain from a SVN server:

Do not forget that you need to have an installed SVN package. Use the following command:

# yum install subversion


2.1 Latest CVS Head Version

To get the latest head version use this command:

# svn checkout http://svn.digium.com/svn/asterisk/trunk asterisk
# svn checkout http://svn.digium.com/svn/zaptel/trunk zaptel
# svn checkout http://svn.digium.com/svn/libpri/trunk libpri


Check for the availability of some other packages:

rpm -q bison
rpm -q bison-devel
rpm -q ncurses
rpm -q ncurses-devel
rpm -q zlib
rpm -q zlib-devel
rpm -q openssl
rpm -q openssl-devel
rpm -q gnutls-devel
rpm -q gcc
rpm -q gcc-c++

If any of those packages are not installed install them by using yum

yum install bison
yum install bison-devel
yum install ncurses
yum install ncurses-devel
yum install zlib
yum install zlib-devel
yum install openssl
yum install openssl-devel
yum install gnutls-devel
yum install gcc
yum install gcc-c++



3. Compiling Asterisk on most Linux distributions

Extract the tar file and go to the folder where you extracted the files.
#cd /usr/src/asterisk


Important: Follow this installation order: libpri, zaptel, asterisk

-Installing libpri
#cd /usr/src/asterisk/libpri
#make clean
#make
#make install


-Installing zaptel
#cd /usr/src/asterisk/zaptel
#make clean

Note: If you are using kernel 2.6 enter the following command '#make linux26', before doing '#make install'.

-Installing asterisk

#cd /usr/src/asterisk/asterisk
#make clean

Note: If you want to use a mp3 files for music-on-hold enter the following command '#make mpg123', before doing '#make install'.

#make install

If this is your first installation perform 'make samples' to install sample configuration files.

Check your asterisk installation by stating your asterisk daemon by typing safe_asterisk and connect to its CLI (Command Line interface) by typing asterisk -gvvvvvvvvvvvr. Now type this command in the asterisk CLI "module reload".

Introducing New Technology -- Asterisk - The Complete PBX in Software

Hello Friends. Let's begin our journey into the world of Asterisk.

Asterisk is a software implementation of a telephone private branch exchange (PBX) originally created in 1999 by Mark Spencer of Digium. Like any PBX, it allows attached telephones to make calls to one another, and to connect to other telephone services including the public switched telephone network (PSTN) and Voice over Internet Protocol (VoIP) services.

Reference (http://en.wikipedia.org/wiki/Asterisk_(PBX))

LinkWithin

Related Posts with Thumbnails