tag:blogger.com,1999:blog-37709332239558132002024-03-13T21:39:18.130+05:30Nag'S TutorialThis blog will help you to find out the solutions for different developer questions of all platforms like PHP, JQuery, Java, Html, CSS, JavaScript and etc.Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-3770933223955813200.post-84915873276386010642013-08-15T23:31:00.000+05:302013-08-15T23:31:55.563+05:30Redirect URL with out changing the url in address bar using htaccess<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" trbidi="on">
<div dir="ltr" trbidi="on">
<div dir="ltr" trbidi="on">
<div dir="ltr" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif;">Hi. This is a small trick to redirect the URL to another url with out changing the address bar url. We should write the below code in htaccess file.</span><br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;">RewriteEngine on
RewriteRule (.*)\.com$ $1.php [PT]
RewriteRule (.*)\.in$ $1.php [PT]
</span></pre>
</div>
</div>
</div>
</div>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">This will show an URL to user in the address bar, but internally it will redirect and execute the code of other URL which we configure here.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">After adding this to .htaccess file. check this. </span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">For example if you want to show url as<br /><br /><b><i>http://www.domainname.com/pages/mypage.com</i></b><br /><br />to user and internally we want to call and execute the code of another page like<br /><br /><b><i>http://www.domainname.com/pages/mypage.php</i></b><br /><br />then use this sample code in your htaccess file. while executing this, the URL will remain same as </span><span style="font-family: Arial, Helvetica, sans-serif;"><i>http://www.domainname.com/pages/mypage.com</i></span><span style="font-family: Arial, Helvetica, sans-serif;"> in address bar, but redirect and executes the content of mypage.php. </span><span style="font-family: Arial, Helvetica, sans-serif;"><br />For applying this transfers only to a folder follow this. Then we should write the below code in htaccess file.</span><br />
<div dir="ltr" trbidi="on">
<div dir="ltr" trbidi="on">
<div dir="ltr" trbidi="on">
<div dir="ltr" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;">RewriteEngine on
RewriteRule ^</span><span style="font-family: Arial, Helvetica, sans-serif; white-space: normal;">pages</span><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;">/(.*)\.com /</span><span style="font-family: Arial, Helvetica, sans-serif; white-space: normal;">pages</span><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;">/$1.php [PT]
RewriteRule ^</span><span style="font-family: Arial, Helvetica, sans-serif; white-space: normal;">pages</span><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;">/(.*)\.in /</span><span style="font-family: Arial, Helvetica, sans-serif; white-space: normal;">pages</span><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;">/$1.php [PT]
</span></pre>
</div>
</div>
</div>
</div>
<br />
You can change the <b>pages </b>to your folder. The above code works only when the user requests a page from <b>pages</b> folder. other wise it will ignore this.<br />
<br />
mypage.com is redirected to the page of mypage.php and will execute the content of the mypage.php when user type this url in address bar<br />
<b style="font-family: Arial, Helvetica, sans-serif;"><i>http://www.domainname.com/pages/mypage.com</i></b><b style="font-family: Arial, Helvetica, sans-serif;"><i>or </i></b><b style="font-family: Arial, Helvetica, sans-serif;"><i><br /></i></b><b style="font-family: Arial, Helvetica, sans-serif;"><i>http://www.domainname.com/pages/mypage.in</i></b><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span><span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;">Thank you</span></span></div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com3tag:blogger.com,1999:blog-3770933223955813200.post-32954022267082165912013-07-29T21:01:00.000+05:302013-07-29T21:05:12.376+05:30How to know if the browser is IE in PHP<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" trbidi="on">
<div dir="ltr" trbidi="on">
<div dir="ltr" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif;">Hi. This is a small code to check the browser is Internet explorer or not using the PHP.</span>
<br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><?php
if(preg_match('/(?i)msie [1-8]/', $_SERVER['HTTP_USER_AGENT']))
{
// The browser is IE
// write your code here
}
</span></code><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;">else
{
// The browser is other than IE
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"> // write your code here</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;">
}
?></span></pre>
</div>
</div>
</div>
</div>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">If you are executing the above code in Internet explorer browser then <i><b>if</b></i> condition will execute. and if you are executing the code in other than Internet explorer then <b><i>else</i></b> condition will be executed.</span><br />
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;">Thank you</span></span></div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com0tag:blogger.com,1999:blog-3770933223955813200.post-24146049311724748022013-07-12T15:00:00.003+05:302013-07-28T22:37:54.742+05:30How to display the previous days date using PHP<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif;">Hi to every one. Today am going to give a small code to show the previous day date using the PHP. </span><span style="font-family: Arial, Helvetica, sans-serif;">Just copy and paste the below code into your editor and change the static number to your number.</span>
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="background-color: white; font-size: 13px;">
</span></span><br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;">date('Y/m/d', strtotime('-N days',strtotime(date('Y/m/d'))));</span></code></pre>
</div>
</div>
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;"><i>date('Y/m/d')</i> will gives current date.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><i><span style="background-color: white;">strtotime(</span><span style="background-color: white;">date('Y/m/d')</span></i><span style="background-color: white;"><i>)</i> will convert the current date to UNIX Timestamp.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Here <i>'-'</i> represents the previous days to show. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Here <i>'N'</i> is the number to show 'Nth' days ago date from the current date.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">'<i>-N days</i>' will gives the previous 'Nth' day date.</span><br />
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;"><i>strtotime('-N days',strtotime(date('Y/m/d'))</i> will gives the UNIX Timestamp string of previous 'Nth' day date.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><i><span style="background-color: white;">date('Y/m/d', strtotime('-N days',strtotime(date('Y/m/d'))</span><wbr style="background-color: white;"></wbr></i><span style="background-color: white;"><i>))</i> will display the UNIX Timestamp to date format of YYYY/MM/DD.</span></span><br />
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;">For example:</span></span><br />
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;">Assume that current date is <b><i>2013/07/12</i></b>. and if we want to display 7 days ago date then write the following code.</span></span><br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><span style="font-family: Arial, Helvetica, sans-serif;"><code style="vertical-align: baseline;"><span style="font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;">date('Y/m/d', strtotime('-7 days',strtotime(date('Y/m/d'))</span>));
</code></span></pre>
</div>
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;">It will show the last 7 days ago date in the format of <b><i>2013/07/05</i></b>.</span></span><br />
<span style="background-color: white; font-size: 13px;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span>
<span style="background-color: white; color: #222222; font-family: arial, helvetica, sans-serif; font-size: 13px;"><br /></span>
</div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com0tag:blogger.com,1999:blog-3770933223955813200.post-49860018047945919592013-06-13T00:08:00.002+05:302013-07-12T14:10:36.824+05:30How to navigate forward and back to the pages using JavaScript<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Follow the steps to navigate forward and back to the pages using JavaScript.</div>
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><html>
<head>
<script language='JavaScript' type='text/javascript'>
function goBack() {
window.history.back();
}
</span></code><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></script>
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></head>
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"><body>
<input type='button' name='back' value='Go Back' title='Click here to go back' onClick='goBack()'>
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></body>
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></html></span></pre>
</div>
When the user click on the button it will go back to last visited page which means previous page.<br />
We can write this code in another way.</div>
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><script language='JavaScript' type='text/javascript'>
function goBack() {
window.history.go(-1);
}
</span></code><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></script></span></pre>
</div>
This script is also works same as the above script. This is the same as the back button functionality of the browser. Here '-1' represents the previous page.<br />
<br />
And we can use this script to load the next URL in in the history list.<br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><html>
<head>
<script language='JavaScript' type='text/javascript'>
function goForward() {
window.history.forward();
}
</span></code><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></script>
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></head>
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"><body>
<input type='button' name='forward' value='Go Forward' title='Click here to go Forward' onClick='goForward()'>
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></body>
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></html></span></pre>
This is the same as the forward button functionality of the browser.<br />
<br />
Thank you...</div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com0tag:blogger.com,1999:blog-3770933223955813200.post-66055623204337549072013-06-12T23:45:00.003+05:302013-06-12T23:47:39.809+05:30How to do HTTP redirect to a URL using JavaScript<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Follow the simple steps to do HTTP redirect to a URL using JavaScript.</div>
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><html>
<head>
<script type='text/javascript'>
forwardUrl(); // calling the function to redirect
function forwardUrl() {
window.location.href = 'http://www.phpboyz.com/page1.php';
}
</span></code><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></script>
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></head>
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"><body></body>
</span><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></html></span></pre>
</div>
Change the URL to your url to forward. And call the function to forward.<br />
<br />
And we can send the parameters along with the url using this script also.</div>
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><script type='text/javascript'>
var value1 = 10;
var value2 = 'testing';
window.location.href = 'http://www.phpboyz.com/page1.php?param1='+value1+'&param2='+value2;
</span></code><span style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;"></script></span></pre>
</div>
This script will forward from current page to requested URL location along with the 2 GET parameters param1 and param2. we can use this 2 parameters where ever we need. <br />
Use $param1 = $_GET['param1'] and $param2 = $_GET['param2'] to get the values in the page1.php.<br />
<br />
Thank you...</div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com0tag:blogger.com,1999:blog-3770933223955813200.post-10290359446876589592013-04-19T23:55:00.001+05:302013-04-19T23:56:50.963+05:30Navigation menu to show current page link as active - jquery<div dir="ltr" style="text-align: left;" trbidi="on">
Hi, now am going to share a small article here, that is how to show current page link as active in navigation menu using JQuery.
<br />
First we need to include JQuery library into the page. <br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head></span></code></pre>
before that we need to maintain the left menu in separate page and include it the required pages.<br />
assume take a left menu page leftmenu.php
<br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><div id="left_menu_div">
<ul>
<li id="menuitem1" title="menu item 1"><a href="http://localhost/activemenu/page1.php">Page One</a></li>
<li id="menuitem2" title="menu item 2"><a href="http://localhost/activemenu/page2.php">Page Two</a></li>
<li id="menuitem3" title="menu item 3"><a href="http://localhost/activemenu/page3.php">Page Three</a></li>
<li id="menuitem4" title="menu item 4"><a href="http://localhost/activemenu/page4.php">Page Four</a></li>
</ul>
</div>
</span></code></pre>
then add your css in the page
<br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><style type="text/css">
#left_menu_div ul
{
list-style-type:none;
font-size:11px;
line-height:23px;
border:0px solid #ccc;
}
#left_menu_div ul li {
margin-bottom:5px;
outline: 0;
padding: 3px 3px 3px 6px;
display: block;
font-weight: bold;
border: 1px solid #1c252b;
border-left:5px solid #ee6e28;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
box-shadow: 1px 1px 1px rgba(0,0,0,0.2); /* CSS3 */
-moz-box-shadow: 1px 1px 1px rgba(0,0,0,0.2); /* Firefox */
-webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.2); /* Safari, Chrome */
background:#2a69bf;
width:180px;
color:white;
}
#left_menu_div ul li a{
text-decoration:none;
font-size:14px;
color:white;
}
.active {
background: #0186ba;
background: -moz-linear-gradient(#04acec, #0186ba);
background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba));
background: -webkit-linear-gradient(#04acec, #0186ba);
background: -o-linear-gradient(#04acec, #0186ba);
background: -ms-linear-gradient(#04acec, #0186ba);
background: linear-gradient(#04acec, #0186ba);
color:red;
border-radius:0px 3px 3px 0px;
padding: 3px 0px 3px 5px;
margin:-4px -4px -4px -7px;
width:180px;
}
</style>
</span></code></pre>
and finally include this jquery code in the leftmenu page<br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><script type="text/javascript">
$(document).ready(function() {
$currenturl = window.location.href;
$("#left_menu_div ul li a").each(function() {
$uurl = $(this).attr('href');
if($(this).attr('href') == $currenturl){
$(this).addClass('active');
}
});
});
</script>
</span></code></pre>
<br />
its over... now you can see the active page link in different than all links.<br />
<br />
Thank you...</div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com1tag:blogger.com,1999:blog-3770933223955813200.post-88229509497479884522013-04-01T00:44:00.000+05:302013-04-01T00:48:59.973+05:30Find the place name using latitude and longitude in PHP with google geocoder<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
We can find the place name using google geocoder by giving the Latitude and Longitude. <br />
<br />
For example we want to get the place name of the<i> latitude:</i> '17.434545' and <i>longitude:</i> '82.124575' we need to pass this values to the google api to get the place details. <br />
<br />
Following code explains how to work with that.<br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;">
function getPlaceName($latitude, $longitude)
{
//This below statement is used to send the data to google maps api and get the place
name in different formats. we need to convert it as required.
$geocode=file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?latlng='
.$latitude.','.$longitude.'&sensor=false');
$output= json_decode($geocode);
//Here "formatted_address" is used to display the address in a user friendly format.
echo $output->results[0]->formatted_address;
}
</span></code></pre>
<br />
We can use this function in PHP. when we execute the above method the following output will be displayed.<br />
<br />
call the function as<br />
<?php getPlaceName(17.434545, 82.124575); ?><br />
<br />
<i><b>Output :</b></i> Andhra Pradesh 533436, India <br />
<br />
Thank you.</div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com16tag:blogger.com,1999:blog-3770933223955813200.post-80501573299564576862013-04-01T00:18:00.002+05:302013-04-01T00:50:57.660+05:30Submit Form data using JQuery<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Using <b><i>$.post()</i></b> method we can post the data to the server and as per the user needs can receive the response from the server.<br />
<br />
<b><i>$.post()</i></b> method takes 4 parameters.<br />
<b>1.</b> <i><b>URL</b></i> : This is the url of a page where we want to send the data to server<br />
<b>2.</b> <i><b>FormData</b></i> : This FormData contains all fields data of the form to post<br />
<b>3.</b> <i><b>Function</b> : </i>This function is used to execute after successful submission of form data, we can receive the response from the server also using this function by taking a parameter.<br />
<b>4.</b> <i><b>JSON</b> :</i> This parameter is optional to Post method. If we want to receive the JSON encoded response to the Jquery then we need to enable this parameter as 'json', other wise ignore it.<br />
<br />
For example take a form like below : (Save this file as textData.php)<br />
<pre style="background-color: #e0e0e0; padding: 15px; vertical-align: baseline;"><code style="vertical-align: baseline;"><span style="color: #222222; font-family: Ubuntu Mono, Ubuntu Beta Mono A, Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace;"><html>
<head>
<title>Test Post</title>
<script type="text/javascript">
//Below JQuery function is used to execute the code when page loads, with out calling any
functions.
$(document).ready(function() {
//This is executed when the user click on submit button, here form id is 'myForm'.
$("#myForm").submit(function() {
//This statement will take the url/page name which is defined in the form of action
// attribute. or we can directly give the url/page name here.
var url = $(this).attr("action");
//This statement is used to collect the form data which is given by user and create
// as a string. example: it will generate as "username=somevalue&password=somevalue".
var dataString = $(this).serialize();
//This statement is the post method it will take 4 parameters the first
//parameter is to where the data need to send, and the second parameter contains the
//data of form, and the third parameter is used to execute when the JQuery successfully
//submitted the formdata and receives the response. and the fourth parameter is optional
//if we want to receive the json data we can use it otherwise ignore it.
$.post(url, dataString, function(o) { alert(o.message); },'json');
return false;
});
});
</script>
<form name="myForm" id="myForm" action="serverPage.php" method="post">
User Name : <input type="text" name="username">
Password : <input type="password" name="password">
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
</span></code></pre>
<br />
In the above statement function(o) means after successful submission of the form data the server page can send return data to JQuery in that case this parameter will take it. Initially this parameter is an array. using the array index value we can access the data of the return parameter.<br />
<br />
For example: We are taking the parameter name as "o". In this example am sending a $response array to JQuery back after getting the data to server. It contains a "message" value. To use this message in JQuery we need to write like <i>o.message </i>in function<i>.</i><br />
<i><br /></i>
When user fill the form data and click on submit it will send the data to "serverPage.php" using JQuery Post method.<br />
serverPage.php:
<br />
<pre style="background-color: #e0e0e0; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; padding: 15px; vertical-align: baseline;"><code style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; vertical-align: baseline;">if(isset($_POST['submit']))
{
$data = array();
$response = array();
//Here verifying the data is given or not by the user, we can write this for required fields
if(isset($_POST['username']) && isset($_POST['password']))
{
$data['username'] = $_POST['username'];
data['password'] = $_POST['password'];
//Here we can perform any Database operations using this parameters and send
// the response as user needs
$response['message'] = "Data received successfully";
echo json_encode($response);
}
else
{
//This will execute if any required fields are not filled by the user,
// write any statements here in failed cases
$response['message'] = "Data not received. Try again!";
echo json_encode($response);
}
}
</code></pre>
After submitting the form JQuery will show a alert message. if the username and password values is given in the form then it will show "Data received successfully" if any one data is not given by user it will show alert as "Data not received".
Thank you.
</div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com0tag:blogger.com,1999:blog-3770933223955813200.post-68708591827089459002012-12-27T22:57:00.004+05:302012-12-27T23:50:03.585+05:30JavaScript Form Validations<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
JavaScript is also used to validate the Form data of HTML pages before sending the data to server.<br />
<br />
JavaScript can be validate any type of data.<br />
(Ex. NULL values, Text, Numeric, Email, Date etc.)<br />
For example take a HTML Form like below : ( Save this file as textData.php)<br />
<pre style="background-color: #e0e0e0; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; padding: 15px; vertical-align: baseline;"><code style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; vertical-align: baseline;"><form name="myForm" action="send_data.php" onsubmit="return validateForm()" method="post">
User Name : <input type="text" name="username">
First Name: <input type="text" name="firstname">
Password : <input type="password" name="password">
Mobile : <input type="text" name="mobile">
Gender : <select name="gender">
<option value="">Select</option>
<option value="male">Male</option>
<option value="female">Female</option>
</select>
Date of Birth (yyyy/mm/dd) : <input type="text" name="dateofbirth">
Email Id : <input type="text" name="emailid">
<input type="submit" name="submit" value="Submit">
</form>
</code></pre>
<b>Note:</b> If you want to validate any data you should write in the below function only as per the above html code. You can change the function names and field names as per your needs.<br />
<pre style="background-color: #e0e0e0; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; padding: 15px; vertical-align: baseline;"><code style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; vertical-align: baseline;">function validateForm()
{
//write below code here if required
return true;
}
</code></pre>
<b>To Test Required Fields :</b><br />
<br />
This script is used to check the username is empty or not, if empty it will promt an alertbox to user with message "User Name Required" and it will focus on the particular username field.<br />
<pre style="background-color: #e0e0e0; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; padding: 15px; vertical-align: baseline;"><code style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; vertical-align: baseline;">if( document.myForm.username.value == null || document.myForm.username.value == "" )
{
alert("User Name Required");
document.myForm.username.focus();
return false;
}
</code></pre>
<b>To Test Text Data or Digits(Numbers) Only:</b><br />
<br />
This script is used to check the field value is text or digits, based on the condition it will prompt an error, other wise ignores.<br />
Here we need to create two expressions based on our requirements to test whether the field value is Text or Number.<br />
<pre style="background-color: #e0e0e0; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; padding: 15px; vertical-align: baseline;"><code style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; vertical-align: baseline;">var numbexp = /^[0-9]+$/;
var charexp = /^[a-zA-Z]+$/;
if( !document.myForm.firstname.value.match(charexp) )
{
alert("Please Enter Text Data Only");
document.myForm.firstname.value = ""; //This is used to remove the data from the field
document.myForm.firstname.focus();
return false;
}
if( !document.myForm.mobile.value.match(numbexp) )
{
alert("Please Enter Numbers Only");
document.myForm.mobile.value = ""; //This is used to remove the data from the field
document.myForm.mobile.focus();
return false;
}
</code></pre>
<b>To Test Email Fields :</b>
<br />
<b>
</b>
This script is used to check the field contains value is valid email or not, it will accept the value only if contains a '@' symbol, a '.' symbol and 2 to 3 charactors after dot symbol. Other wise prompt alert to user.<br />
<pre style="background-color: #e0e0e0; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; padding: 15px; vertical-align: baseline;"><code style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; vertical-align: baseline;">var emailexp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if( !document.myForm.emailid.value.match(emailexp) )
{
alert("Please Enter Valid Email Id");
document.myForm.emailid.value = "";
document.myForm.emailid.focus();
return false;
}
</code></pre>
<b>To Check Length of the Field :</b><br />
This script used to check the length of the field value, if it has more than 10 characters it will show an alert message, other wise it will ignore.<br />
<pre style="background-color: #e0e0e0; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; padding: 15px; vertical-align: baseline;"><code style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; vertical-align: baseline;">if( document.myForm.username.value.length >= 10 )
{
alert("Maximum 10 Characters only");
document.myForm.username.value = "";
document.myForm.username.focus();
return false;
}
</code></pre>
This script is used to validate a value between a given range i.e, minimun and maximum value. Assume username should be Minimum 6 Characters and Maximum 12 Characters
<br />
<pre style="background-color: #e0e0e0; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; padding: 15px; vertical-align: baseline;"><code style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; vertical-align: baseline;">if( document.myForm.username.value.length < 6 || document.myForm.username.value.length >12 )
{
alert("User Name should contain min 6 characters and max 12 characters");
document.myForm.username.value = "";
document.myForm.username.focus();
return false;
}
</code></pre>
<b>To Test Date Format :</b>
<br />
<b>
</b>
<b> </b>This script is used to check the date format according to your needs. using this expression we can validate the date field mostly.
<br />
<pre style="background-color: #e0e0e0; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; padding: 15px; vertical-align: baseline;"><code style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; vertical-align: baseline;">var dateexp = /^[0-9]{4}\/(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])+$/;
if( document.myForm.dateofbirth.value.match(dateexp) )
{
alert("Invalid Date Format... Correct it");
document.myForm.dateofbirth.focus();
return false;
}
</code></pre>
<b>To Test Select Boxes :</b>
<br />
<b>
</b>
<b> </b>This script is used to check the select box is selected or not.
<br />
<pre style="background-color: #e0e0e0; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; padding: 15px; vertical-align: baseline;"><code style="color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; vertical-align: baseline;">if(document.myForm.gender.selectedIndex == 0)
{
alert("Please Select Gender");
document.myForm.gender.focus();
return false;
}
</code></pre>
</div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com0tag:blogger.com,1999:blog-3770933223955813200.post-36743853712695613312012-12-25T00:30:00.001+05:302012-12-27T23:14:49.231+05:30Installing and Configuring PHP and MySql with XAMPP in Windows<div dir="ltr" style="text-align: left;" trbidi="on">
Xampp is a free web server that interprets php and perl programming language. It's mainly used to test the web application during the development.<br />
<br />
<b>Downloading xampp:</b><br />
<b><br /></b>
Go to the official website of xampp "http://www.apachefriends.org/en/xampp-windows.html" and download the xampp installer.<br />
<br />
<b>Installing the xampp:</b><br />
<br />
<ul style="text-align: left;">
<li>Click on the downloaded xampp installer.</li>
<li>A Warning window will opens, click yes</li>
<li>Select a language and click OK</li>
<li>In the xampp installation wizard click next</li>
<li>Click browse, select local disk C or D(Your wish) to install xampp and click OK</li>
<li>Click Next</li>
<li>Check the buttons for install Apache, MySql and Filezilla as service</li>
<li>Click Install</li>
<li>Wait till the installation process is complete then click finish</li>
<li>Wait for these messages which shows "Congratulations! The installation was successful! Start XAMPP Control Panel now?" and click Yes and OK</li>
<li>Then xampp control panel will be opened with running Apache, MySql and FileZilla Services.</li>
</ul>
<br />
If you want to access Xampp control panel manually you can open it from C: or D: Drive >> xampp >> double click on xampp-control file.<br />
<br />
<b>Test the Xampp Installation:</b><br />
<br />
<ul style="text-align: left;">
<li>Open browser and type this url "http://localhost"</li>
<li>Choose a language</li>
<li>After choosing a language, you should get a page which displays with a left menu of xampp</li>
<li>Click on Status on left menu of xampp page to check the status of xampp</li>
</ul>
<br />
<b>Creating a PHP file:</b><br />
<b><br /></b>
Open Notepad and write the below code:<br />
<div style="background-color: #ececec; padding:20px">
<br />
<?php<br />
phpinfo();<br />
?><br />
<br /></div>
Save the above file in the xampp installed directory.<br />
Example: "C:\xampp\htdocs\index.php"<br />
<br />
<b>Executing the PHP file:</b><br />
<b><br /></b>
Open the browser and type the below URL to execute the above saved php file.<br />
"http://localhost/index.php"<br />
<br />
Then the complete information about the installed softwares of xampp will be shown in the html page. here you can check the status of all the things.<br />
<br />
Now you can write and execute any number php files in the htdocs.<br />
<br />
Happy Coading...<br />
<br /></div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com2tag:blogger.com,1999:blog-3770933223955813200.post-42302461846153719412012-12-25T00:01:00.001+05:302012-12-27T23:16:22.566+05:30Installation and Environment Setup for Java<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
Follow the below steps to set up the environment of Java.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Java SE is free software to download from the following URL http://www.oracle.com/technetwork/java/index.html. You can choose a version based on your operating system.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Follow the instructions to run the .exe to install Java on your machine. Once you installed Java on your machine, you should set environment variables to point to correct installation directories.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>Setting up the path for windows 2000/XP/7:</b></div>
<div style="text-align: left;">
<b><br /></b></div>
<div style="text-align: left;">
Assuming you have installed Java in c:\Program Files\Java\jdk directory:</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li>Right-click on 'My Computer' and select 'Properties'.</li>
<li>Click on 'Environment Variables' button under the 'Advanced' tab.</li>
<li>Now alter the 'Path' variable so that it also contains the path to the Java executable.<br />Example: if the path is set to some other path then append the below path to existed path. ";C:\Program Files\java\jdk\bin".</li>
</ul>
<br />
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>Setting up the path for Linux, UNIX, Solaris, FreeBSD:</b></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Environment variable PATH should be set to point to where the java binaries have been installed. Refer to your shell documentation if you have trouble doing this.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Example, if you use bash as your shell, then you would add the following line to the end of your '.bashrc:export PATH=/path/to/java:$PATH'</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>Most Popular Java Editors:</b></div>
<div style="text-align: left;">
<b><br /></b></div>
<div style="text-align: left;">
1. Notepad</div>
<div style="text-align: left;">
2. Netbeans</div>
<div style="text-align: left;">
3. Eclips</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>Creating First Application:</b></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Assume your first application MyApp, will display "Hello World".</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>Source Code:</b></div>
<div style="text-align: left;">
<b><span style="color: #4c1130;"><br /></span></b></div>
<div style="background-color: #ececec; padding:20px">
<div style="text-align: left;">
public class MyApp {</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
public static void main(String args[]) {</div>
<div style="text-align: left;">
System.out.println("Hello World"); //prints Hello World</div>
<div style="text-align: left;">
}</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
}</div>
<div style="text-align: left;">
</div>
</div>
<div style="text-align: left;">
<b>Note:</b> While Compiling and Executing any Java Programs program names are case-sensitive.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>Executing the Java Program:</b></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>Create a source file(creating .java file):</b> Source file contains the required code, written in Java programming language. You can use any text editor to create and edit source files.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>Compile the source file(it will create a .class file): </b>Java programming language compiler (javac) takes your source file and translates its text into instructions that the Java virtual machine can understand. The instructions contained within this file are known as bytecodes.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>Run the program: </b>The Java application launcher tool (java) uses the Java virtual machine to run your application.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>How to Write, Save, Write, Compile and Run a Java Program:</b></div>
<div style="text-align: left;">
<b><br /></b></div>
<div style="text-align: left;">
1. Open Text Editor and write code and save the file as MyApp.java.</div>
<div style="text-align: left;">
2. Open command prompt window and go to the directory where you saved the class. </div>
<div style="text-align: left;">
Example C:\</div>
<div style="text-align: left;">
3. Type 'javac MyApp.java' and press enter to compile your code. If there are no errors in your code the command prompt will take you to the next line.(Assumption: The path variable is set).</div>
<div style="text-align: left;">
4. Now type 'java MyApp' to run your program.</div>
<div style="text-align: left;">
5. You will be able to see 'Hello World' printed on the window.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Now you can write and execute any number of programs.... Enjoy writing.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
</div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com0tag:blogger.com,1999:blog-3770933223955813200.post-42100020995958485132012-12-20T23:04:00.001+05:302012-12-20T23:04:16.702+05:30Sharing a Folder in Linux Ubuntu 12.04<div dir="ltr" style="text-align: left;" trbidi="on">
One of the most common ways to share a folder on Ubuntu system is to configure Samba File Server. These Steps will help to configure Samba server to share files and folders in network.<br />
<br />
1. First install the samba package from terminal by typing the following command<br />
<b>sudo apt-get install samba</b><br />
<br />
after completion of successful installation we can share a folder directly by right click on a folder and select share folder option.<br />
<br />
If you want to provide a secure access to that folder then we need to change the Samba server configuration file.<br />
The Samba configuration file is located in <b>/etc/samba/smb.conf</b>.<br />
Edit the pairs in the [global] section of <b>/etc/samba/smb.conf</b> file:<br />
workgroup = EXAMPLE<br />
...<br />
security = user<br />
Uncomment the security parameter which is commented by default and also change EXAMPLE to match your environment.<br />
<br />
Create a new section at the bottom of the file like this:<br />
<br />
[share]<br />
comment = Ubuntu File Server Share<br />
path = /svr/samba/share<br />
browsable = yes<br />
guest ok = yes<br />
read only = no<br />
create mask = 0755<br />
<br />
<b>comment: </b>a short description of the shared file.<br />
<br />
<b>path: </b>path to the directory to share.<br />
<br />
In this example i use /svr/samba/sharefoldername because, /svr is where site-specific data should be served. Samba shares can be placed anywhere on the filesystem as long as the permissions are correct, but adhering to standards is recommended.<br />
<br />
<b>browsable: </b>enables Windows users to browse the shared directory and files using Windows Explorer.<br />
<br />
<b>guest ok: </b>allow clients to connect to the shared folder without entering a password.<br />
<br />
<b>read only: </b>determines if the share folder is read only or if write privileges are granted. if the value is no then write privileges are allowed, if the value is yes then the privileges are set to read only.<br />
<b><br /></b>
<b>create mask: </b>determines the permissions to new files <b> </b>will have when created.<br />
<br />
Now the Samba Server is configured, then we need to create the directory and change the permissions.<br />
Open Terminal and type the following commands:<br />
<b>sudo mkdir -p /srv/samba/share</b><br />
<b>sudo chown nobody.nogroup /srv/samba/share/</b><br />
<br />
The -p switch tells mkdir to create the entire directory tree if it doesn't exist.<br />
<br />
Finally restart the samba services to enable the new configuration:<br />
<br />
<b>sudo restart smbd</b><br />
<b>sudo restart nmbd</b><br />
<b><br /></b></div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com0tag:blogger.com,1999:blog-3770933223955813200.post-9841187597359439222012-12-20T21:55:00.004+05:302012-12-26T19:26:05.652+05:30Connecting Ubuntu 12.04 via Remote from Windows <div dir="ltr" style="text-align: left;" trbidi="on">
Connecting to the Ubuntu 12.04 Desktop from Windows is a easy way by following below steps. This can be done using XRDP server package installation.<br />
<br />
1. Open the Terminal in Ubuntu system and type the below command<br />
<pre style="background-color: #e0e0e0; border: 0px; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; line-height: 17px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;"><b style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal; white-space: normal;">sudo apt-get install xrdp</b></pre>
2. After completion of the installation process, open the Windows 7 system and Go to Start - and click on Remote Desktop Connection<br />
<br />
3. Enter computer name or hostname or IP address of ubuntu system and click on connect<br />
<br />
3. When prompted, type your Ubuntu Username and Password to connect<br />
<br />
4. Finally the Ubuntu Desktop will appear on your Windows System.<br />
<br />
<b>Note:</b> While connecting to the system if you face any problem then type this below commands and try again<br />
<br />
<pre style="background-color: #e0e0e0; border: 0px; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; line-height: 17px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;"><code style="border: 0px; color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; padding: 0px; vertical-align: baseline;"><b>cd /home/youruser
echo "gnome-session --session=ubuntu-2d" > .xsession
sudo /etc/init.d/xrdp restart</b></code></pre>
Or install gnome session fallback<br />
<br />
<pre style="background-color: #e0e0e0; border: 0px; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; line-height: 17px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;"><b style="background-color: transparent;">sudo apt-get install gnome-session-fallback</b></pre>
</div>
Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com2tag:blogger.com,1999:blog-3770933223955813200.post-30552100177460275332012-12-16T12:57:00.000+05:302012-12-20T22:17:43.473+05:30Steps to install Kannel SMS Gateway with SQLBox<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">Kannel :</span></b></div>
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm;"></span>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm;"><span style="line-height: 0.37cm; text-align: left;">Kannel
is a compact and very powerful open source WAP and SMS gateway,WAP is
used for Push service indications and mobile Internet connectivity.</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">WAP :</span><br /></b></div>
<div style="text-align: justify;">
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm;"><span style="line-height: 0.37cm; text-align: left;">Wireless
Application Protocol is a technical standard for accessing
information over a mobile wireless network. WAP means a protocol that
are used to connect wireless GPRS OR GSM with web browser by sending
encoded message to mobile. By this web browser get the information of
mobile device and start sending messages or emails through network.</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">Steps to install
kannel with sqlbox:</span></b></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">1. To install kannel we need to install this essencial requirements.</span></b></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">Warning : run command with sudo user</span></b></div>
<div style="line-height: 0.37cm; margin-bottom: 0cm;">
</div>
<div style="text-align: justify;">
<span style="background-color: white; font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm;">sudo
apt-get update</span></div>
<span style="background-color: white; font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm; text-align: justify;">sudo apt-get install build-essential</span><br />
<span style="background-color: white; font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm; text-align: justify;">sudo
apt-get install bison</span>
<span style="background-color: white; font-family: Arial, Helvetica, sans-serif;">
</span>
<br />
<div style="text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><span style="background-color: white; line-height: 0.37cm;">sudo apt-get install libmysqld-dev</span></span></div>
<span style="margin-bottom: 0.35cm; text-align: justify;"><span style="background-color: white;">
</span></span>
<br />
<div style="text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><span style="background-color: white; line-height: 0.37cm;">sudo
apt-get install libxml2-dev</span></span></div>
<span style="margin-bottom: 0.35cm; text-align: justify;">
</span>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">2.
Download gateway stable release version 1.4.3.</span></b></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<br /></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<u><span style="margin-bottom: 0.35cm; text-align: justify;">http://www.kannel.org/downloads/1.4.3/<a href="http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz">gateway-1.4.3.tar.gz</a></span></u></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">3.
Extract gateway folder in any directory of your system. </span></b></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<i><span style="margin-bottom: 0.35cm; text-align: justify;">$
tar xfvz gateway-1.4.3.tar.gz</span></i></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">4.
Goto gateway folder.</span></b></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<i><span style="margin-bottom: 0.35cm; text-align: justify;">$
cd gateway-1.4.3/</span></i></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">5. Configure</span></b></div>
<div style="margin-bottom: 0cm; text-align: justify;">
</div>
<div style="text-align: justify;">
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm;"><span style="line-height: 0.37cm; text-align: left;">The
below command makes the shell run the script named ‘ configure ‘
which exists in the current directory. The configure script basically
consists of many lines which are used to check some details about the
machine on which the software is going to be installed. This script
checks for lots of dependencies on your system. wait for the completion of the process.</span></span></div>
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm;">
</span>
<br />
<div style="margin-bottom: 0.35cm; text-align: justify;">
<i><span style="margin-bottom: 0.35cm; text-align: justify;">$
./configure --with-mysql</span></i></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">6. make</span></b></div>
<div style="margin-bottom: 0cm; text-align: justify;">
</div>
<div style="text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><span style="line-height: 0.37cm; text-align: left;">make
command used to perform all necessary </span><span style="line-height: 13.983333587646484px; text-align: left;">re-compilations</span><span style="line-height: 0.37cm; text-align: left;">. You can use make
with any programming language whose compiler can be</span></span></div>
<span style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 0.37cm;"></span></span>
<br />
<div style="text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><span style="line-height: 0.37cm;"><span style="line-height: 0.37cm; text-align: left;">run with a
shell command. make command is used when we want to run any project
which needs compilation of files.</span></span></span></div>
<span style="margin-bottom: 0.35cm; text-align: justify;"><span style="line-height: 0.37cm;">
</span></span>
<br />
<div style="margin-bottom: 0.35cm; text-align: justify;">
<i><span style="margin-bottom: 0.35cm; text-align: justify;">$
make</span></i></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">7. make
install</span></b></div>
<div style="margin-bottom: 0cm; text-align: justify;">
</div>
<div style="text-align: justify;">
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm;"><span style="line-height: 0.37cm; text-align: left;">The
install section happens to be only a part where the executables and
other required files created during the last step (i.e. make) are
copied into the required final directories on your machine. E.g. the
executable that the user runs may be copied to the /usr/local/bin so
that all users are able to run the software. Similarly all the other
files are also copied to the standard directories in Linux. Remember
that when you ran make, all the executables were created in the
temporary directory where you had unzipped your original tarball. So
when you run make install, these executables are copied to the final
directories.</span></span></div>
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm;">
</span>
<br />
<div style="margin-bottom: 0.35cm; text-align: justify;">
<i style="line-height: 0.37cm; text-align: left;"><span style="margin-bottom: 0.35cm; text-align: justify;">$
make install</span></i></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<i><span style="margin-bottom: 0.35cm; text-align: justify;"><br /></span></i></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">8.
Download sqlbox by typing the below command line.</span></b></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;"><br /></span></b></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<i><span style="margin-bottom: 0.35cm; text-align: justify;">$
svn co https://svn.kannel.org/sqlbox/trunk sqlbox</span></i></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<i><span style="margin-bottom: 0.35cm; text-align: justify;"><br /></span></i></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;">9. Extract
sqlbox folder in gateway folder which was downloaded before. Run
below mentioned commands to install sqlbox.</span></b></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br /></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">$cd
sqlbox</span></div>
<div style="line-height: 0.37cm; margin-bottom: 0cm;">
</div>
<div style="text-align: justify;">
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm;">$
./configure</span></div>
<span style="font-family: Arial, Helvetica, sans-serif; line-height: 0.37cm; text-align: justify;">$ make</span><span style="margin-bottom: 0.35cm; text-align: justify;"></span><br />
<span style="margin-bottom: 0.35cm; text-align: justify;">
</span>
<br />
<div style="text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><span style="line-height: 0.37cm;">$ make install</span></span></div>
<span style="margin-bottom: 0.35cm; text-align: justify;">
</span>
<br />
<div style="margin-bottom: 0.35cm; text-align: justify;">
</div>
<div style="text-align: justify;">
<b style="line-height: 0.37cm; text-align: left;"><b style="line-height: 0.37cm;"><span style="margin-bottom: 0.35cm; text-align: justify;">Kannel installation with sqlbox is completed.</span></b></b><b style="line-height: 0.37cm; text-align: left;"></b><br />
<b style="line-height: 0.37cm; text-align: left;">
</b></div>
<br />
<div style="line-height: 0.37cm; margin-bottom: 0.35cm; text-align: justify;">
<b style="line-height: 0.37cm; text-align: left;"><span style="margin-bottom: 0.35cm; text-align: justify;">Now we need to configure both kannel.conf file and sqlbox.conf.</span></b></div>
<div style="line-height: 0.37cm; margin-bottom: 0.35cm; text-align: justify;">
<b style="line-height: 0.37cm; text-align: left;"><span style="margin-bottom: 0.35cm; text-align: justify;">1. Copy this below code and paste in your /etc/kannel/kannel.conf file and change the details according to your needs.</span></b></div>
<div style="line-height: 0.37cm; margin-bottom: 0.35cm; text-align: justify;">
</div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#CORE</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">group
= core</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">admin-port
= 13000</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">smsbox-port
= 13001</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">admin-password
= *****</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">status-password
= *****</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">admin-allow-ip
= "*.*.*.*"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">wdp-interface-name
= "*"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">log-file
= "/var/log/kannel/bearerbox.log"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#store-file
= "/var/log/kannel/kannel.store"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">log-level
= 0</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">box-deny-ip
= "*.*.*.*"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">box-allow-ip
= "*.*.*.*"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">dlr-storage=mysql</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br /></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#SMSBOX
SETUP</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">group
= smsbox</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">bearerbox-host
= localhost</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">sendsms-port
= 13013</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">bearerbox-port
= 13001</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">sendsms-chars
= "0123456789 +-"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">global-sender
= +91number</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">log-file
= "/var/log/kannel/smsbox.log"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">log-level
= 0</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="line-height: 0.37cm; margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 0.37cm;"><span style="margin-bottom: 0.35cm; text-align: justify;">#
SEND-SMS USERS</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">group
= sendsms-user</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">username
= usernameToSendSms</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">password
= passwordToSendSms</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">default-smsc
= SMSC-ID</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">user-allow-ip
="*.*.*.*"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#mysql
connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">group
= mysql-connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">id
= sqlbox-db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">host
= localhost</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">username
= root</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">password
= passwordOfMysql</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">database
= dataBaseName</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">max-connections
= 10</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="line-height: 0.37cm; margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 0.37cm;"><span style="margin-bottom: 0.35cm; text-align: justify;">#
DLR SETUP</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 0.37cm;"><span style="margin-bottom: 0.35cm; text-align: justify;">#mysql
connection</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 0.37cm;"><span style="margin-bottom: 0.35cm; text-align: justify;">group
= mysql-connection</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">id
= mydlr</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">host
= localhost</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">username
= root</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">password
= passwordOfMysql</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">database
= dataBaseName</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">max-connections
= 10</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="line-height: 0.37cm; margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 0.37cm;"><span style="margin-bottom: 0.35cm; text-align: justify;">group
= dlr-db</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">id
= mydlr</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">table=dlr</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">field-smsc=smsc</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">field-timestamp=ts</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">field-destination=destination</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">field-source=source</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">field-service=service</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">field-url=url</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">field-mask=mask</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">field-status=status</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">field-boxc-id=boxc</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<br /></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#
SMSC Fake</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 0.37cm;"><span style="margin-bottom: 0.35cm; text-align: justify;">group
= smsc</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">smsc
= fake</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">port
= 10000</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">connect-allow-ip
= 127.0.0.1</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="line-height: 0.37cm; margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 0.37cm;"><span style="margin-bottom: 0.35cm; text-align: justify;">#
SMS SERVICE black-list</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 0.37cm;"><span style="margin-bottom: 0.35cm; text-align: justify;">#group
= sms-service</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#keyword
= black</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#text
= "You are not allowed to use this service, Go away!"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#catch-all
= true</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="line-height: 0.37cm; margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 0.37cm;"><span style="margin-bottom: 0.35cm; text-align: justify;">#
SMSC SMPP</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 0.37cm;"><span style="margin-bottom: 0.35cm; text-align: justify;">group
= smsc</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">smsc-id
= idForSmsc</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">smsc
= smpp</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">host
= **.**.**.**</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">port
= portnumber</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">receive-port
= 16400</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">smsc-username
= username</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">smsc-password
= password</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">system-type
= type</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">system-id
= id</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">address-range
= ""</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#SMS
SERVICE GET-URL EXAMPLE</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">group
= sms-service</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">keyword
= default</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">send-sender
= true</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">get-url
= "http://localhost/receivesms?phone=%p&text=%a"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#
SMS SERVICE Default</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#
there should be default always</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#group
= sms-service</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#keyword
= default</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#text
= "No service specified. "</span></div>
<b style="line-height: 0.37cm; text-align: justify;"><span style="margin-bottom: 0.35cm; text-align: justify;"><br /></span></b>
<b style="line-height: 0.37cm; text-align: justify;"><span style="margin-bottom: 0.35cm; text-align: justify;">Note: Remove # symbols if you need and change the value for that according to your requirement.</span></b><br />
<div style="line-height: 0.37cm; margin-bottom: 0.35cm; text-align: justify;">
<b><span style="margin-bottom: 0.35cm; text-align: justify;"><br /></span></b>
<b><span style="margin-bottom: 0.35cm; text-align: justify;">2. Copy the below code and paste in /etc/kannel/sqlbox.conf file and change the details according to your requirement.</span></b></div>
<div style="line-height: 0.37cm; margin-bottom: 0.35cm; text-align: justify;">
</div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">SQL
BOX CONFIG</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 100%; text-align: left;"><span style="margin-bottom: 0.35cm; text-align: justify;">group
= sqlbox</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">id
= sqlbox-db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">smsbox-id
= sqlbox</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">global-sender
= ""</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">bearerbox-host
= localhost</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">bearerbox-port
= 13001</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">smsbox-port
= 13002</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">smsbox-port-ssl
= false</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">sql-log-table
= sent_sms</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">sql-insert-table
= send_sms</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#log-file
= "/var/log/kannel/kannel-sqlbox.log"</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#log-level
= 0</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#ssl-client-certkey-file
= ""</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#ssl-server-cert-file
= ""</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#ssl-server-key-file
= ""</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#ssl-trusted-ca-file
= ""</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#
Database connection examples. Please uncomment as needed</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="line-height: 100%; text-align: left;"><span style="margin-bottom: 0.35cm; text-align: justify;">#
Example MYSQL Connection</span></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">group
= mysql-connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">id
= sqlbox-db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">host
= localhost</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">username
= root</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">password
= passwordOfMysql</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">database
= dataBase</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#
Example ORACLE Connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#group
= oracle-connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#id
= sqlbox-db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#username
= myuser</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#password
= mypass</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#tnsname
= //localhost:1521/XE</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#
Example POSTGRESQL Connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#group
= pgsql-connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#id
= sqlbox-db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#id
= sqlbox-db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#username
= myuser</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#password
= mypass</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#database
= kannel</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#host
= localhost</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#
Example SDB Connection with some database URL examples</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#
*** Note: Uncomment only _one_ "url" line ***</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#group
= sdb-connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#id
= sqlbox-db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#url
= mysql:host=localhost:db=kannel:uid=myuser:pwd=mypass</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#url
= sqlite:db=/path/to/kannel.db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#url
= sqlite3:db=/path/to/kannel3.db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#
Example SQLITE 2 Connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#group
= sqlite-connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#id
= sqlbox-db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#database
= /path/to/kannel.db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#max-connections
= 1</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><br />
</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#
Example SQLITE 3 Connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#group
= sqlite3-connection</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#id
= sqlbox-db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#database
= /path/to/kannel.db</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">#max-connections
= 1</span></div>
<b style="font-family: Arial, Helvetica, sans-serif; text-align: justify;"><br /></b>
<b style="font-family: Arial, Helvetica, sans-serif; text-align: justify;">Installation and Configuration is completed now.</b><span style="font-family: Arial, Helvetica, sans-serif; text-align: justify;"> We should run the Bearerbox, Sqlbox and Smsbox to send a sms from the kannel using smpp account.</span><br />
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><b><br /></b></span>
<span style="margin-bottom: 0.35cm; text-align: justify;"><b>Note:</b> Open 3 Termials for 3 boxes individually</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">Starting the Bearerbox: (type this command in terminal as super user)</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">bearerbox -v 0 /etc/kannel/kannel.conf</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">Starting the Sqlbox: (type this command in terminal as super user)</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">sqlbox -v 0 /etc/kannel/sqlbox.conf</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">Stargin the Smsbox: (type this command in terminal as super user)</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">smsbox -v 0 /etc/kannel/kannel.conf</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">if boxes are running properly without any errors then you succefully installed kannel with sqlbox. if you got any errors you can post a comment here....</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><b>Sending first sms:</b></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">Open MySql or PhpMyAdmin and login with your details.</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">Then open the send_sms table and insert a record.</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><b>Note:</b> No need to insert all the fields. Mandatory fields are </span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">1. Sender</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">2. Reciever</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">3. Text (Message)</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">4. SMSC_ID (which is used in kannel.conf file to identify the smsc_id)</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">5. Account (Username of smsc)</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">Then automatically the message goes to the particular number.</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;"><b>If you want to check the status of your messages open browser and type the url in the address bar</b></span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">http://localhost:13000/status?password=status-password</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<span style="margin-bottom: 0.35cm; text-align: justify;">(here status-password is the password which is given in the kannel.conf file)</span></div>
<div style="margin-bottom: 0.35cm; text-align: justify;">
<br /></div>
</div>Find your solutionhttp://www.blogger.com/profile/06980125025647288484noreply@blogger.com18