tag:blogger.com,1999:blog-54005173992122354272024-03-29T10:11:47.327+05:30Inspiration of CuttingEdge TechnologyGayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.comBlogger111125tag:blogger.com,1999:blog-5400517399212235427.post-19103957956404348792018-01-04T14:23:00.001+05:302018-01-04T14:23:04.625+05:30Simple book keeping basicsThere are tons of jargon on accounting. But a lot of them are rubbish that used for categorizing the incomes, expenses and Tax.<br />
<br />
What really matters are Balance Sheet and P&L (profit & loss) statement. If you really knows to read and understand these two then you know the<br />
basic language in business. <br />
<br />
I'll go deeper on these if you guys interest or else please Google and read about these two.<br />
<br />
Let me share a real world example of what I am talking about. Here is the Access Engineering PLC / Annual Report 2015/16<br />
<br />
http://www.accessengsl.com/wp-content/uploads/2016/07/Annual-Report-2015-16.pdf<br />
<br />
Please go to page 149 of the report and you will see the Statement of Profit or Loss.<br />
<br />
And on page 150 of the report you see the Balance sheet (they call it as Statement of Financial Position).<br />
And you can see it is balanced (of cause it is balance sheet)<br />
Total Assets = Total Equity and Liabilities<br />
<br />
Basically these are the things that people are supposed look at before investing on a business.<br />
And I am pretty sure guys like Warren Buffett (https://en.wikipedia.org/wiki/Warren_Buffett) are really using this to make their fortune.Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com20tag:blogger.com,1999:blog-5400517399212235427.post-80472956448175162702017-12-19T10:29:00.004+05:302017-12-19T10:29:46.191+05:30My two cents on new year resolutionWhat is the plan for the new year ?<br />
<br />
<span style="white-space: pre;"> </span>- need to think on what are we trying achieve during next year 2018<br />
<span style="white-space: pre;"> </span>- basically the life goals<br />
<span style="white-space: pre;"> </span>- may be personal or professional<br />
<span style="white-space: pre;"> </span>- and also it should be realistic (not something like going to Mars ;))<br />
<span style="white-space: pre;"> </span><br />
Why we need a plan for the new year ?<br />
<br />
<span style="white-space: pre;"> </span>- basically a goal without a plan is a DREAM<br />
<span style="white-space: pre;"> </span>- And also should be able to measure (what you cannot measure, you cannot manage)<br />
<br />
How to prepare a new Year resolution/plan ?<br />
<br />
<span style="white-space: pre;"> </span>- Leave some buffer time<br />
<span style="white-space: pre;"> </span>- Make changes during the year (life is changing/evolving)<br />
<span style="white-space: pre;"> </span>- Plan is only for you (do not share it)<br />
<span style="white-space: pre;"> </span>- When a milestone is achieved, celebrate<br />
<span style="white-space: pre;"> </span>- Try to stick to the plan - otherwise no point of planingGayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com20tag:blogger.com,1999:blog-5400517399212235427.post-59303867110198479472017-12-19T10:28:00.002+05:302017-12-19T10:28:33.418+05:30Assets and Liabilities as Rich Dad, Poor Dad explainsI was reading "The rich dad poor dad by Robert Kiyosaki" here is a one point that he mentions on that.<br />
<br />
Basically Asset as he says is little bit different than on books. If something puts money in your pocket it is a asset.<br />
And Liabilities are the ones that takes money out of your pocket. OK for example a house or a car may seems like an Asset but it takes<br />
money out of you pocket to maintain them. But if you rent them or make them to make money at the end of the day you can convert it<br />
to a asset.<br />
Basically that what rich people do. They buy assets.<br />
Middle class buy liabilities (thinking those are assets) and stuff (a lot of them that not used or that not needed).<br />
Lower class buy to consume (basic needs like foods).Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com32tag:blogger.com,1999:blog-5400517399212235427.post-25238076166420579262014-01-02T15:30:00.004+05:302014-01-02T15:30:53.844+05:3011 Rules from Bill GatesI watched a youtube video and thought to share with you all.<br />
<br />
Bill Gates recently gave a speech at High School about 11 things they did not and will not learn in school. He talked about how to feel-good. Politically correct teachings have created a generation of kids with no concept of reality and how this concept set them up for failure in the real world.<br />
<br />
<b>Rule 1 : </b>Life is not fair - get used to it!<br />
<br />
<b>Rule 2 : </b>The world doesn't care about your self-esteem. The world will except you to accomplish something BEFORE you feel good about yourself.<br />
<br />
<b>Rule 3 : </b>You will NOT make $60,000 a year right out of high school. You won't be a vice-president with a car, phone until you earn both.<br />
<br />
<b>Rule 4 :</b> If you think your teacher is tough, wait till you get a boss.<br />
<br />
<b>Rule 5 :</b> Flipping burgers is not beneath your dignity. Your Grandparents had a different word for burger flipping: they called in opportunity.<br />
<br />
<b>Rule 6 : </b>If you messed up, it's not your parents' fault, so don't whine about your mistakes, learn from them.<br />
<br />
<b>Rule 7 : </b>Before you were born, your parents weren't boring as they are now. They got that way from paying your bills, cleaning your clothes and listening to you talk about how cool you thought you were. So before you save the rain forest from the parasites of your parents' generation, try delousing the closet in your own room.<br />
<br />
<b>Rule 8 :</b> Your school may have done away with winners and losers, but life HAS NOT. In some schools, they have abolished failing grades and they'll give you as MANY TIMES as you want to get the right answer. This doesn't bear the slightest resemblance to ANYTHING in real life.<br />
<br />
<b>Rule 9 :</b> Life is not divided into semesters. You don't get summers off and very few employees are interested in helping you FIND YOURSELF. Do that on your own time.<br />
<br />
<b>Rule 10: </b>Television is NOT real life people actually have to leave the coffee shop and go to jobs.<br />
<br />
<b>Rule 11:</b> Be nice to nerds. Chances are you'll end up working for one.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/NSaCxGTuBng?feature=player_embedded' frameborder='0'></iframe></div>
<br />Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com2tag:blogger.com,1999:blog-5400517399212235427.post-19641220217288184552013-12-23T15:37:00.000+05:302013-12-23T15:41:29.686+05:30Time Management by Brian TracyWas lucky to have a chance to watch a video done by <a href="http://www.youtube.com/channel/UCc11676iKpKrJMYqNYHqNig" target="_blank">Brian Tracy</a> on Time Management. It was great and thought to do a short note on that. Here is the note and the video.<br />
<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="480" src="//www.youtube.com/embed/IN2fa-WyfNI" width="640"></iframe>
<div>
<br />
Here is the note I took by listening to it.<br />
<br /></div>
<ol>
<li>Goals - what is it you want to accomplish ?
<ol style="list-style-type:lower-latin">
<li>personal/family goals</li>
<li>business/financial goals</li>
<li>self development goals</li>
</ol>
</li>
<li>Plans of Action - put it in writing
</li>
<li>Analysis - Make a list (make the list of day before evening - to do list)
</li>
<li>Set Priorities - what is relevant and irrelevant ? what is the most valuable use of my time ?
</li>
<li>Concentration - Learn how ! - work on single task at time until it is completed
</li>
<li>Deadlines and Rewards - positive logical consequences.
</li>
<li>Time Log - where is all your time going ?
</li>
<li>Procrastination - positive or negative - Do it now! Do it now! Do it now! - get the job done fast
</li>
<li>Delegate - delegate everything you can - Clarity
<ol style="list-style-type:lower-latin">
<li>Think what you want done - write it down</li>
<li>Pick the right person to do it</li>
<li>Crystal clear on what you want done and when you want done</li>
<li>Check, Review, Inspect</li>
</ol>
</li>
<li>Meetings - An essential part of human life
<ol style="list-style-type:lower-latin">
<li>Clear on purpose of the meeting</li>
<li>Agenda </li>
<li>Deal with the most important tasks first</li>
<li>Start and Stop meeting at time</li>
</ol>
</li>
<li>Interruptions - Telephone and walk-in visitors.
<ol style="list-style-type:lower-latin">
<li>Do not be a slave to telephone</li>
<li>Most people are time wasters</li>
</ol>
</li>
<li>Key result areas - what key results have you been hired to accomplish?
</li>
<li>Batching tasks - Group your responsibilities - group your tasks Same pattern ones at a time 0
</li>
<li>Neatness - Clean up your work environment
<ol style="list-style-type:lower-latin">
<li>Throw it away </li>
<li>Refer - if not relevant </li>
<li>Action - put all in action folder</li>
<li>File - file it away</li>
</ol>
</li>
<li>Chunks of time - Allow time for important work - get up early in the morning like 5 am and get 2 uninterrupted hours of time
<ol style="list-style-type:lower-latin">
<li>You cannot do administrative and creative work together</li>
</ol>
</li>
<li>Transition time - Learn more to earn more
<ol style="list-style-type:lower-latin">
<li>spend 1 hour per day on own to learn new things (2 hours better)</li>
<li>Coffee breaks, lunch time, driving time</li>
</ol>
</li>
<li>Telephone - A powerful business tool!
<ol style="list-style-type:lower-latin">
<li>get on and get off fast</li>
<li>Treat as a meeting by wire</li>
</ol>
</li>
<li>Punctuality - Get a reputation for being on time
</li>
<li>Work simplification - systemize the work process. make fewer mistakes. do things together in teams.
</li>
<li>Saying NO - early and often - just say no on irrelevant
</li>
<li>Balance - Improve the quality of your life
<ol style="list-style-type:lower-latin">
<li>Health</li>
<li>Peace of mind</li>
<li>Relationships</li>
</ol>
</li>
</ol>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com6tag:blogger.com,1999:blog-5400517399212235427.post-25777031272918830762013-12-19T11:02:00.001+05:302013-12-19T11:02:21.360+05:30Safari is randomly switching images on ios 5 Developed a Facebook app for mobiles and it was loading a lot of images through several AJAX requests. And was working fine on simulators tried and was given to Client for testing. But suddenly was receiving screenshots of the app that appears sooo wired.<br />
With the details of the versions and devise he was testing I just Googled regarding this and found it is an error or a bug or a mistake or something that happens on Safari on iOS 5.<br />
Best result found on this matter,<br />
<a href="http://tech.vg.no/2011/12/14/safari-on-ios-5-randomly-switches-images/" target="blank">http://tech.vg.no/2011/12/14/safari-on-ios-5-randomly-switches-images/</a><br />
<br />
Successfully tested on latest iOS versions and also on few android devices and they were fine. My suggestion is please update your OS if you still got iOS 5.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoQ0FcaQWqhpB2HWemZL9sRDZmBRc65Xa4NZKzZ_fbMLZGf3Al-HvaqOA-U77JD25XAfTZbdvB6rXEjhqlh988QOTmXs29psCncIS9bwbeOIPFozEgyfmL_JNxgAeMduESPAArzj7jJCA/s1600/ios_5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="143" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoQ0FcaQWqhpB2HWemZL9sRDZmBRc65Xa4NZKzZ_fbMLZGf3Al-HvaqOA-U77JD25XAfTZbdvB6rXEjhqlh988QOTmXs29psCncIS9bwbeOIPFozEgyfmL_JNxgAeMduESPAArzj7jJCA/s320/ios_5.jpg" width="320" /></a></div>
<br />
<br />Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com0tag:blogger.com,1999:blog-5400517399212235427.post-3970989477864690532013-12-18T12:09:00.000+05:302013-12-18T12:10:38.211+05:30Concat columns on GROUP BY in MySQL by Using GROUP_CONCATI was asked to give a report on the Invitations table as follows. What I wanted to give as the result is the invitee details per inviter. So simply I do not want to repeat the "inviter".<br />
<br />
Invitations<br />
invitee_name<span class="Apple-tab-span" style="white-space: pre;"> </span>inviter<span class="Apple-tab-span" style="white-space: pre;"> </span>invitee<br />
gayan<span class="Apple-tab-span" style="white-space: pre;"> </span> 345<span class="Apple-tab-span" style="white-space: pre;"> </span> 4654<br />
kosala<span class="Apple-tab-span" style="white-space: pre;"> </span> 345<span class="Apple-tab-span" style="white-space: pre;"> </span> 7655<br />
chamara<span class="Apple-tab-span" style="white-space: pre;"> </span> 567<span class="Apple-tab-span" style="white-space: pre;"> </span> 7653<br />
nilanka<span class="Apple-tab-span" style="white-space: pre;"> </span> 567<span class="Apple-tab-span" style="white-space: pre;"> </span> 1236<br />
<br />
So basic query for the demanding result is<br />
<br />
"SELECT * FROM Invitations GROUP BY inviter;"<br />
<br />
But then what happens is some results are omitted. So I need to concat the "invitee" and "invitee_name" columns when grouping by 'inviter'.<br />
<br />
For this MySQL simply gives a function as “GROUP_CONCAT”. Details can be seen on<br />
<a href="http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat" target="blank">http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat</a>.<br />
<br />
So for this example what I have to do is<br />
<br />
SELECT GROUP_CONCAT(invitee_name SEPARATOR ' || ') AS inviteeName, inviter, GROUP_CONCAT(invitee SEPARATOR ' || ') AS inviteeID FROM Invitations GROUP BY inviter;<br />
<br />
The result will be as follows.<br />
inviteeName<span class="Apple-tab-span" style="white-space: pre;"> </span> inviter<span class="Apple-tab-span" style="white-space: pre;"> </span> inviteeID<br />
gayan || kosala<span class="Apple-tab-span" style="white-space: pre;"> </span> 345<span class="Apple-tab-span" style="white-space: pre;"> </span> 4654 || 7655<br />
chamara || nilanka<span class="Apple-tab-span" style="white-space: pre;"> </span>567<span class="Apple-tab-span" style="white-space: pre;"> </span> 7653 || 1236<br />
<br />
Currently as I can find this feature is available only on MySQL. This feature saved a lot of my time though it may reduce the performance. There are lot of options in "GROUP_CONCAT" and I have just used the separator since this was a CSV report. It separates by "," as default.<br />
<br />Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com1tag:blogger.com,1999:blog-5400517399212235427.post-54882793390275249682013-03-27T09:52:00.001+05:302013-07-02T13:49:49.852+05:30Google API v3 with PHP using Blogger serviceIt was really hard for me to understand how the Google APIs are working at the first point and took few days for me to figure out. But after a successful working prototype it seems very easy. And also when I am searching for a simple example I was unable to find a good one that I can understand.
<br />
<br />
So let me list down step by step what I have done with URLs and as simple as I can.<br />
<br />
<ol>
<li>Create a Google app</li>
<ol>
<li>location - <a href="https://code.google.com/apis/console">https://code.google.com/apis/console</a></li>
</ol>
<li>Switch on the "Blogger API v3"</li>
<li>Get the latest APIs client library for PHP</li>
<ol>
<li>location - <a href="https://code.google.com/p/google-api-php-client/downloads/list">https://code.google.com/p/google-api-php-client/downloads/list</a></li>
</ol>
<li>Upload the files to your host location on on localhost</li>
<li>Extract the files to folder named "GoogleClientApi"</li>
<li>Create your php file outside of the folder </li>
<li>Copy paste following code into the file and do the changes as needed </li>
<ol>
</ol>
</ol>
By changing the scope and the service object you can access all the services that is given by Google APIs through the PHP API library set given.<br />
If there is anything needed to be clarified please leave a comment.<br />
<br />
<pre><?php
session_start();
require_once dirname(__FILE__).'/GoogleClientApi/src/Google_Client.php';
require_once dirname(__FILE__).'/GoogleClientApi/src/contrib/Google_BloggerService.php';
$scriptUri = "http://".$_SERVER["HTTP_HOST"].$_SERVER['PHP_SELF'];
$client = new Google_Client();
<span style="background-color: whitesmoke; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; text-align: justify; white-space: normal;">$client-></span>setAccessType('online'); // default: offline
$client->setApplicationName('giaws'); //name of the application
$client->setClientId('345345345645.apps.googleusercontent.com'); //insert your client id
$client->setClientSecret('JHJUGHJH6556vhjVHJKds'); //insert your client secret
$client->setRedirectUri($scriptUri); //redirects to same url
$client->setDeveloperKey('jhvjhhj6fvdfvfdv763248732QHGHJBHJ'); // API key (at bottom of page)
$client->setScopes(array('https://www.googleapis.com/auth/blogger')); //since we are going to use blogger services
$blogger = new Google_BloggerService($client);
if (isset($_GET['logout'])) { // logout: destroy token
unset($_SESSION['token']);
die('Logged out.');
}
if (isset($_GET['code'])) { // we received the positive auth callback, get the token and store it in session
$client->authenticate();
$_SESSION['token'] = $client->getAccessToken();
}
if (isset($_SESSION['token'])) { // extract token from session and configure client
$token = $_SESSION['token'];
$client->setAccessToken($token);
}
if (!$client->getAccessToken()) { // auth call to google
$authUrl = $client->createAuthUrl();
header("Location: ".$authUrl);
die;
}
//you can get the data about the blog by getByUrl
$data = $blogger->blogs->getByUrl(array('url'=>'http://puwaruwa.blogspot.com/'));
//creates a post object
$mypost = new Google_Post();
$mypost->setTitle('this is a test 1 title');
$mypost->setContent('this is a test 1 content');
$data = $blogger->posts->insert('546547654776577', $mypost); //post id needs here - put your blogger blog id
var_dump($data);
?>
</pre>
Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com120tag:blogger.com,1999:blog-5400517399212235427.post-86580838365106056992011-04-20T12:12:00.001+05:302011-04-20T12:19:30.704+05:30A solution for PHP fopen from url issue<p>I had to read a web page and grab values and show on my web page by using PHP. The easiest way came to my mind was <a title="fopen" href="http://php.net/manual/en/function.fopen.php" target="_blank">"fopen"</a>. When I develop that on my local machine it worked perfectly but when I put that on live site it was not reading from external URL. If I need to continue on that I have to modify php.ini file to allow access which is not possible on a shared hosting. So it was tie to Google and find a better solution. And I found one and thought to share it with you all.</p><p>This following php code developed by <a href="http://www.webdeveloper.com/forum/member.php?u=85791" target="_blank">knkk</a> and was shared on <a title="web developer" href="http://www.webdeveloper.com/forum/showthread.php?t=230985" target="_blank">http://www.webdeveloper.com/forum/showthread.php?t=230985</a></p><pre class="brush:php">function disguise_curl($url)
{
$curl = curl_init();
// setup headers - used the same headers from Firefox version 2.0.0.6
// below was split up because php.net said the line was too long. :/
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: en-us,en;q=0.5";
$header[] = "Pragma: "; //browsers keep this blank.
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3');
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_REFERER, 'http://www.google.com');
curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($curl, CURLOPT_AUTOREFERER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
$html = curl_exec($curl); //execute the curl command
if (!$html)
{
echo "cURL error number:" .curl_errno($ch);
echo "cURL error:" . curl_error($ch);
exit;
}
curl_close($curl); //close the connection
return $html; //and finally, return $html
}
</pre>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com6tag:blogger.com,1999:blog-5400517399212235427.post-58340473005917766032011-04-20T11:45:00.003+05:302011-04-20T12:11:46.076+05:30Format Javascript<p>I had to analyze and change a JavaScript if it is required, but it was a big huge JavaScript file and all the code was on one line. So it was the time to find a good was to do format the JS.</p><p>I found following site and thought to share it with you all. <a title="Javascript unpacker and beautifier" href="http://jsbeautifier.org/" target="_blank">http://jsbeautifier.org/</a></p>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com3tag:blogger.com,1999:blog-5400517399212235427.post-33692474800060307132011-04-09T09:52:00.000+05:302011-04-09T11:10:16.243+05:30Definer issue on MySQL<p>I had a main issue when I am trying to deploy a PHP, MySQL project by using CPanel. This might be occurred on any hosting provider. The issue is I have stored procedures on MySQL and when deploying it says I cannot deploy procedures which contains ‘DEFINER’ in it.</p><p>So what I did is remove all the ‘DEFINER’ parts on procedures and executed the MySQL dump file. It went alright. But when we connect to PHPMyAdmin via CPanel the logged in user is same as CPanel user. On MySQL if there is no definer on a procedure it generates the currently logged in user.</p><p>Now I have procedures with a CPanel user but my PHP code is connected to that DB by using a MySQL defined user. When I am trying to browse the site it throws an error saying Definer is different. Then I was in the middle of a dead lock.<br />Then what I thought was to execute the create procedures by using PHP. Then definer will be same as PHP connected user to MySQL. So I had to write a PHP code to read the MySQL dump file and build the DB for me.</p><p>It was a success so far. My delimiter used id ‘$$’ and if your one is different please change that on code. And also I had to remove comment lines and ‘DELIMITER’ changing lines (this line gave me an error).</p><p>Please use this for good and if there was any modification you have done to improve this, I hope you will share with us.</p><p>And also if there is any part that you cannot understand, have any issues with please come to me.</p><pre class="brush:php"><br />$mysql_host = 'localhost';<br />$mysql_username = 'root';<br />$mysql_password = '';<br />$mysql_database = 'test';<br /><br />mysql_connect($mysql_host, $mysql_username, $mysql_password) or die('Error connecting ' . mysql_error());<br /><br />mysql_select_db($mysql_database) or die('Error MySQL database ' . mysql_error());<br /><br /> RestoreDumpFile('mySQLdumpfile.sql');<br /><br /> function RestoreDumpFile($filename)<br /> {<br /> $delimiter = ';';<br /> $currentQuery = '';<br /><br /> $lineCollection = file($filename);<br /><br /> foreach ($lineCollection as $line)<br /> {<br /> //in this my current delimiter was ; and then for procs it was $$<br /> if(strpos($line,'DELIMITER') !== false)<br /> {<br /> $delimiter = '$$';<br /> continue;<br /> }<br /><br /> //removed comments and DELIMITER changing lines<br /> if (substr($line, 0, 2) == '--' || $line == '' || substr($line, 0, 2) == '/*' || strrpos($line,'DELIMITER') )<br /> {<br /> continue;<br /> }<br /><br /> //current query generated over line by line<br /> $currentQuery .= $line;<br /><br /> //if delimiter was found then time to execute query<br /> if (substr(trim($line), strlen(trim($line))-strlen($delimiter), strlen($delimiter)) == $delimiter)<br /> {<br /> if($delimiter != ';')<br /> {<br /> $currentQuery = substr($currentQuery, 0, strlen($currentQuery)-(strlen($delimiter)+1));<br /> }<br /><br /> //remove definer<br /> //if definer is there and you do not have super powers it gives an error<br /> if(strpos($currentQuery,'DEFINER') !== false)<br /> {<br /> $firstpart = substr($currentQuery,0,strpos($currentQuery,'DEFINER'));<br /> $secondpart = substr($currentQuery,strpos($currentQuery,'DEFINER'));<br /> $thirdpart = substr($secondpart,strpos($secondpart,' '));<br /><br /> $currentQuery = $firstpart.$thirdpart;<br /> }<br /> echo $currentQuery.'<br />----------------------------------------------------------------------------<br />';<br /><br /> mysql_query($currentQuery) or print('Error on - ' . $currentQuery . ' : ' . mysql_error() . '<br />');<br /> $currentQuery = '';<br /> }<br /> }<br /> }<br /></pre>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com1tag:blogger.com,1999:blog-5400517399212235427.post-25517686969601639222011-01-05T12:59:00.000+05:302011-01-05T12:59:00.660+05:30NASA - 2012: Beginning of the End or Why the World Won't End?There is a big heho going on about the end of earth on 2012. But I like you to quote what NASA says about that. I believe what they say.<br />
<br />
<blockquote>Remember the Y2K scare? It came and went without much of a whimper because of adequate planning and analysis of the situation. Impressive movie special effects aside, Dec. 21, 2012, won't be the end of the world as we know. It will, however, be another winter solstice. <br />
<br />
Much like Y2K, 2012 has been analyzed and the science of the end of the Earth thoroughly studied. Contrary to some of the common beliefs out there, the science behind the end of the world quickly unravels when pinned down to the 2012 timeline. Below, NASA Scientists answer several questions that we're frequently asked regarding 2012.<br />
<br />
Question (Q): Are there any threats to the Earth in 2012? Many Internet websites say the world will end in December 2012.<br />
Answer (A): Nothing bad will happen to the Earth in 2012. Our planet has been getting along just fine for more than 4 billion years, and credible scientists worldwide know of no threat associated with 2012. <br />
<br />
Q: What is the origin of the prediction that the world will end in 2012?<br />
A: The story started with claims that Nibiru, a supposed planet discovered by the Sumerians, is headed toward Earth. This catastrophe was initially predicted for May 2003, but when nothing happened the doomsday date was moved forward to December 2012. Then these two fables were linked to the end of one of the cycles in the ancient Mayan calendar at the winter solstice in 2012 -- hence the predicted doomsday date of December 21, 2012.<br />
<br />
Q: Does the Mayan calendar end in December 2012?<br />
A: Just as the calendar you have on your kitchen wall does not cease to exist after December 31, the Mayan calendar does not cease to exist on December 21, 2012. This date is the end of the Mayan long-count period but then -- just as your calendar begins again on January 1 -- another long-count period begins for the Mayan calendar.<br />
<br />
Q: Could a phenomena occur where planets align in a way that impacts Earth?<br />
A: There are no planetary alignments in the next few decades, Earth will not cross the galactic plane in 2012, and even if these alignments were to occur, their effects on the Earth would be negligible. Each December the Earth and sun align with the approximate center of the Milky Way Galaxy but that is an annual event of no consequence. <br />
<br />
"There apparently is a great deal of interest in celestial bodies, and their locations and trajectories at the end of the calendar year 2012. Now, I for one love a good book or movie as much as the next guy. But the stuff flying around through cyberspace, TV and the movies is not based on science. There is even a fake NASA news release out there..."<br />
- Don Yeomans, NASA senior research scientistQ: Is there a planet or brown dwarf called Nibiru or Planet X or Eris that is approaching the Earth and threatening our planet with widespread destruction?<br />
A: Nibiru and other stories about wayward planets are an Internet hoax. There is no factual basis for these claims. If Nibiru or Planet X were real and headed for an encounter with the Earth in 2012, astronomers would have been tracking it for at least the past decade, and it would be visible by now to the naked eye. Obviously, it does not exist. Eris is real, but it is a dwarf planet similar to Pluto that will remain in the outer solar system; the closest it can come to Earth is about 4 billion miles. <br />
<br />
Q: What is the polar shift theory? Is it true that the earth’s crust does a 180-degree rotation around the core in a matter of days if not hours? <br />
A: A reversal in the rotation of Earth is impossible. There are slow movements of the continents (for example Antarctica was near the equator hundreds of millions of years ago), but that is irrelevant to claims of reversal of the rotational poles. However, many of the disaster websites pull a bait-and-shift to fool people. They claim a relationship between the rotation and the magnetic polarity of Earth, which does change irregularly, with a magnetic reversal taking place every 400,000 years on average. As far as we know, such a magnetic reversal doesn’t cause any harm to life on Earth. A magnetic reversal is very unlikely to happen in the next few millennia, anyway. <br />
<br />
Earth, as seen in the Blue Marble: Next Generation collection of images, showing the color of the planet's surface in high resolution. This image shows South America from September 2004.Q: Is the Earth in danger of being hit by a meteor in 2012?<br />
A: The Earth has always been subject to impacts by comets and asteroids, although big hits are very rare. The last big impact was 65 million years ago, and that led to the extinction of the dinosaurs. Today NASA astronomers are carrying out a survey called the Spaceguard Survey to find any large near-Earth asteroids long before they hit. We have already determined that there are no threatening asteroids as large as the one that killed the dinosaurs. All this work is done openly with the discoveries posted every day on the NASA NEO Program Office website, so you can see for yourself that nothing is predicted to hit in 2012.<br />
<br />
Q: How do NASA scientists feel about claims of pending doomsday?<br />
A: For any claims of disaster or dramatic changes in 2012, where is the science? Where is the evidence? There is none, and for all the fictional assertions, whether they are made in books, movies, documentaries or over the Internet, we cannot change that simple fact. There is no credible evidence for any of the assertions made in support of unusual events taking place in December 2012. <br />
<br />
Q: Is there a danger from giant solar storms predicted for 2012?<br />
A: Solar activity has a regular cycle, with peaks approximately every 11 years. Near these activity peaks, solar flares can cause some interruption of satellite communications, although engineers are learning how to build electronics that are protected against most solar storms. But there is no special risk associated with 2012. The next solar maximum will occur in the 2012-2014 time frame and is predicted to be an average solar cycle, no different than previous cycles throughout history.<br />
</blockquote><br />
From <a href="http://www.nasa.gov/topics/earth/features/2012.html">2012: Beginning of the End or Why the World Won't End?</a>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com2tag:blogger.com,1999:blog-5400517399212235427.post-1551982441730497592010-09-15T11:17:00.002+05:302010-09-29T21:31:26.555+05:30Why Why there is no Trim function on JS<p>It was pretty bad when you find that the JS dos not have a inbuilt function on strings to do Trim. But not to worry. It can be implemented easily.</p><br />
<pre class="brush:javascript">function LTrim(str){
var whitespace = new String(" \t\n\r");
var s = new String(str);
if (whitespace.indexOf(s.charAt(0)) != -1) {
var j=0, i = s.length;
while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
j++;
s = s.substring(j, i);
}
return s;
}
function RTrim(str){
var whitespace = new String(" \t\n\r");
var s = new String(str);
if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
var i = s.length - 1;
while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
i--;
s = s.substring(0, i+1);
}
return s;
}
function Trim(str){
return RTrim(LTrim(str));
}
</pre>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com0tag:blogger.com,1999:blog-5400517399212235427.post-14199655501697414612010-09-02T10:50:00.001+05:302010-09-02T10:50:54.750+05:30Download file by IE error with SSL<p>It took a long time to figure out what was going wrong since on all the other browsers the file was able to download but IE (6,7 & 8) . Tried a lot of things which the forums said but at last at last found the solution.</p><p>Microsoft agrees this as an issue of IE and they have given the patch here. <a href="http://support.microsoft.com/kb/323308">http://support.microsoft.com/kb/323308</a></p><p>And also if a header was added as <span style="font-family: arial, verdant, helvetica, sans-serif; font-size: 13px; border-collapse: collapse;">"CACHE-CONTROL":"NO-CACHE" it will not work on IE even with the fix MS given. It should be changed as "Cache-control:no-store". </span></p>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com2tag:blogger.com,1999:blog-5400517399212235427.post-3872515592572191052010-08-27T15:20:00.001+05:302010-09-04T21:36:03.504+05:30JQuery API control functions<p><img src="http://hoth.entp.com/assets/2010/7/26/jquery_logo_color_onwhite.png" alt="JQuery Logo" width="500" /></p><p>Image from <span style="font-family: arial; font-size: 13px; color: #228822; line-height: 15px;">hoth.entp.com</span></p><p>I was doing JavaScript for few years and it was little bit hard to work with "write less, do more" at first few times. Always it comes to my mind as JavaScript (yes I know it is) so I am trying to apply some functions as document.getElementById. And when I wanted to hide and show elements it was style:none and block.Those look bad(when a better way is there) on jQuery and some of them may not work on jQuery elements. OK I am not here to teach you neither JavaScript nor jQuery. For the people like me it is strongly recommended (by me of course) to take a look at the available and right functions on <a href="http://api.jquery.com/" target="_blank">jQuery API official site</a>.t I just found that and thought to share that. If you got a better place or some useful links please share it.</p>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com0tag:blogger.com,1999:blog-5400517399212235427.post-15134136963586396852010-05-25T11:04:00.002+05:302010-09-29T21:15:30.060+05:30A JavaScript Alert as I wantThere are alerts and confirms on JS as you all know. But its look and feel is same old style. I was curious whether we can change it. Of cause we are normally using a div tag and apply some styles to the background to gray out. Then we can use it as a function and call it whenever we need an alert. Isn’t there a better way to do that? I mean much easier way. So what I have tried to do was override the alert functionality on JS and give a customized method to do the job. So then what happens is we don’t need to change the code on each and every place where it used <span style="color: #666666;">alert(“this is message”);</span>.<br />
<br />
I have found the way to this on <a href="http://slayeroffice.com/code/custom_alert/" linkindex="14">http://slayeroffice.com/code/custom_alert/</a><br />
<br />
This place can be changed so I have pasted the JS code also in here.<br />
<br />
<pre class="brush:jscript" name="code">// constants to define the title of the alert and button text.
var ALERT_TITLE = "Oops!";
var ALERT_BUTTON_TEXT = "Ok";
// over-ride the alert method only if this a newer browser.
// Older browser will see standard alerts
if(document.getElementById) {
window.alert = function(txt) {
createCustomAlert(txt);
}
}
function createCustomAlert(txt) {
// shortcut reference to the document object
d = document;
// if the modalContainer object already exists in the DOM, bail out.
if(d.getElementById("modalContainer")) return;
// create the modalContainer div as a child of the BODY element
mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
mObj.id = "modalContainer";
// make sure its as tall as it needs to be to overlay all the content on the page
mObj.style.height = document.documentElement.scrollHeight + "px";
// create the DIV that will be the alert
alertObj = mObj.appendChild(d.createElement("div"));
alertObj.id = "alertBox";
// MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert
if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
// center the alert box
alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";
// create an H1 element as the title bar
h1 = alertObj.appendChild(d.createElement("h1"));
h1.appendChild(d.createTextNode(ALERT_TITLE));
// create a paragraph element to contain the txt argument
msg = alertObj.appendChild(d.createElement("p"));
msg.innerHTML = txt;
// create an anchor element to use as the confirmation button.
btn = alertObj.appendChild(d.createElement("a"));
btn.id = "closeBtn";
btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
btn.href = "#";
// set up the onclick event to remove the alert when the anchor is clicked
btn.onclick = function() { removeCustomAlert();return false; }
}
// removes the custom alert from the DOM
function removeCustomAlert() {
document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}
</pre><br />
You just have to include this JS code in a shared place over the web site as for example on a master page. And then all the alerts will be modified as shown when you clicked Test the alert button. But there is another trick. The site does not mentioned about the styles used on this alert. So I have grabbed them also by using a Firefox add-on called firebug. So you may need those CSS class too or you can modify them as you want the alerts. <br />
<br />
<pre class="brush:css" name="code">element.style {
display:block;
left:559.5px;
}
#modalContainer > #alertBox {
position:fixed;
}
#alertBox {
background-color:#F2F5F6;
background-image:url("alert.png");
background-position:20px 30px;
background-repeat:no-repeat;
border:2px solid #000000;
margin-top:50px;
min-height:100px;
position:relative;
width:300px;
}
element.style {
height:1556px;
}
#modalContainer {
background-color:transparent;
background-image:url("tp.png");
height:100%;
left:0;
position:absolute;
top:0;
width:100%;
z-index:10000;
}
#alertBox h1 {
background-color:#78919B;
border-bottom:1px solid #000000;
color:#FFFFFF;
font:bold 0.9em verdana,arial;
margin:0;
padding:2px 0 2px 5px;
}
h1, h2 {
border-bottom:1px solid #000000;
font:bold 1.5em verdana;
margin:0;
padding:4px;
}
#alertBox p {
font:0.7em verdana,arial;
height:50px;
margin-left:55px;
padding-left:5px;
}
#alertBox #closeBtn {
background-color:#78919B;
border:2px solid #000000;
color:#FFFFFF;
display:block;
font:0.7em verdana,arial;
margin:5px auto;
padding:3px;
position:relative;
text-align:center;
text-decoration:none;
text-transform:uppercase;
width:70px;
}
</pre>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com1tag:blogger.com,1999:blog-5400517399212235427.post-87562768633859114902010-01-22T17:40:00.002+05:302010-09-29T21:47:24.863+05:30How to call a web method by JavaScriptI didn’t get a time to write something here for a long time. Yes I can say I was busy. (But I was not :)) Anyway I thought to write about something finally and I promise (this is a serious promise) that I will try to do something (do a posting actually) on my blog more frequently.<br />
The ability to call the web methods by JavaScript on .net is very very useful and we can implement the web pages more efficiently by using this. For example we do not need to send whole page and update. Yes this is AJAX (that what I think). <br />
Here is a web method example. It should be on the aspx page code behind and should be a static (shared) method. I have tried to insert the web methods on user controls and was unable to do so (if you know a way please share with us). This is on VB.net. <br />
<pre class="brush:vb"><WebMethod()> _
Public Shared Function GetMyData(ByVal studentID As Integer, ByVal schoolID As Integer) As Student
Dim studentService As New StudentService()
Dim result As Student = studentService.GetStudent(studentID, schoolID)
Return result
End Function
</pre><br />
GetMyData method will create a Student entity based on the IDs passed in and this method can even call to DB to get the data (since this is on server side we can do anything).<br />
Then this method (GetMyData) needs to be executed by JavaScript. Here is the example on how to do that.<br />
<pre class="brush:jscript">this.GetStudent = function(args)
{
PageMethods.GetMyData(_studentID, _ schoolID, _this.UpdateStudentFields, _this.ServiceError);
}
</pre><br />
In here if you have noticed I have send 2 more parameters (_this.UpdateStudentFields, _this.ServiceError) than the web method accepts. (Was not by any mistake:))<br />
_this.UpdateStudentFields – is the JavaScript method name that will execute when we returned from the web method. So basically what happens is Student entity will be passed into this method (UpdateStudentFields) as the result. So then we can do anything by JavaScript by using this result entity. <br />
<pre class="brush:jscript">this. UpdateStudentFields = function(result)
{
if (result.Succeeded)
{
//assign the values to the fields
//studentname = result.Name;
}
}
</pre><br />
_this.ServiceError – this is the javascript method name that executes if there were any exceptions. So then we can do anything even with the error (exception actually). I prefer to show the errors to the end user (swallowing exeptions is not a good practice).<br />
<pre class="brush:jscript">this.ServiceError = function(error)
{
//this will show the error on page
// AddError method should be implimented to do so …
AddError(error.get_message());
}
</pre><br />
Hope this was helpful and if there is any issues or if you know a better way to impliment this please leave a comment.Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com9tag:blogger.com,1999:blog-5400517399212235427.post-66230050701366049302009-04-22T14:09:00.001+05:302010-09-29T21:50:46.736+05:30JavaScript confirmation disables validationI had to do a JavaScript confirmation before I perform the post back on a web form. What I have done is just call button.attributes.add("onClick", -- ) and added the confirmation. <br />
<br />
It worked fine and showed the popup and did the post back if I clicked on the OK button. But if I have implemented some validations on the fields they doesn't fire them if the validation fails. For example if there is a required field validator the post back happens even without the values for that required field. <br />
<br />
what I want is to do the validation and then do the post back. Luckily I've found a solution at <a href="http://forums.asp.net/t/963412.aspx?PageIndex=1">http://forums.asp.net/t/963412.aspx?PageIndex=1</a> by <a href="http://forums.asp.net/members/sukdeb.aspx"> sukdeb</a>. <br />
<br />
<pre class="brush:jscript">function Validate()
{
var yes=confirm("Update this application?");
if(yes)
{
Page_ClientValidate();
return Page_IsValid;
}
return false;
}
</pre><pre class ="brush:html"><asp:button runat="server" text="Button" onclientclick="return Validate()">
</pre>Pasted from <a href="http://forums.asp.net/t/963412.aspx?PageIndex=1">http://forums.asp.net/t/963412.aspx?PageIndex=1</a><asp:button runat="server" text="Button" onclientclick="return Validate()"><http: forums.asp.net="" t="" 963412.aspx?pageindex="1"> <br />
<br />
It worked fine for me. I have added the script as button.attributes.add("onClick", -- ) and it works fine for me even with the "onClick" event.Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com1tag:blogger.com,1999:blog-5400517399212235427.post-39784664345450150822009-03-31T17:03:00.005+05:302010-09-29T22:12:24.186+05:30Sort Fields which contains both Numeric and CharactersIt was a long time since my last post. Finally I got something to write about. Store Procedures … something I hate most of the time. But today I felt good about them because I was able to find a solution for a sorting issue.<br />
The particular column contained data like “98ABC-76543-DEF-12345-GHI<span style="color:red">10</span>” and also “GHJ<span style="color:red">23</span>”. I was supposed to sort this field on Numeric value for the last part in <span style="color:red">red</span>. And for the other parts it should be treated as Numeric for the Numeric parts and as Strings for the others.<br />
So what should I do was to split all parts and sort them separately and get numeric part in <span style="color:red">red</span> and sort.<br />
<br />
But wait a minute do we have to all the things??? I don’t think so... I have found (<a href="http://nullfactory.blogspot.com/">actually one of my friends</a>) an easy way to do that. Here it is.<br />
<br />
<pre class="brush:sql">SELECT [name],
RANK() OVER (ORDER BY
CAST(PARSENAME(modifiedName, 5) AS nvarchar ),
CAST(PARSENAME(modifiedName, 4) AS INT ),
CAST(PARSENAME(modifiedName, 3) AS nvarchar ),
CAST(PARSENAME(modifiedName, 2) AS INT ),
CAST(dbo.fFilterNumeric (PARSENAME(modifiedName, 1)) AS INT )
) AS sorted_name
FROM (SELECT [name],
REPLACE([Name], '-', '.') AS modifiedName
FROM myTestTable) AS myTestTableSorted
</pre><br />
OK the next thing is to explin what I have done here. First PARSENAME gets the string part as for the index from the end of the string. Since the PARSENAME is working only with '.' I had to replace the '-' first. Then for the last part it should be sorted as for the numeric part. For that I have found a function written by IndianScorpion on forums.asp.net to do that. <br />
<br />
<pre class="brush:sql">CREATE FUNCTION [dbo].fFilterNumeric (
@Src NVARCHAR (255))
RETURNS NVARCHAR (255)
AS
BEGIN
declare @Res nvarchar(255)
declare @i int,
@l int,
@c char
select @i=1,
@l=len(@Src)
SET @Res = ''
while @i<=@l
begin
set @c=upper(substring(@Src,@i,1))
IF isnumeric(@c)=1
SET @Res = @Res + @c
set @i=@i+1
end
return(@res)
END
</pre>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com0tag:blogger.com,1999:blog-5400517399212235427.post-30915801529572286312008-11-16T04:50:00.002+05:302008-11-16T04:58:23.609+05:30Show an animated gif onClientClick<span xmlns=''><p style='text-align: justify'>To show an animated gif, something like loading onClientClick is a simple task. You just have to add a JavaScript function on the click event so the JS function will take care until the next page loads from the server. Inside the JS function we just have to hide the excising div and show the div which contains animated loading gif.<br /></p><p style='text-align: justify'> I have done it and it works fine on every other browser except IE. On IE the gif is shown but it is not animated. I have to do some R&D and what I found was IE doesn't do anything like that when it is loading another page (communicating with server) and was commented as a feature limitation of IE. <br /></p><p style='text-align: justify'>But there should be a way to do that, that's what I was thinking and I found a pretty simple way to do that. Here it is and if you have a better way please share it here. <br /></p><p><span style='color:black; font-size:10pt'><span style='font-family:Courier New'><div id="divProgress" runat="server"></span><span style='font-family:Arial'> <br/></span><span style='font-family:Courier New'></div><br /></span></span></p><p><span style='color:black; font-family:Courier New; font-size:10pt'><div id="Div1" runat="server"><br /></span></p><p><span style='color:black; font-family:Courier New; font-size:10pt'>The web form comes here …<br /></span></p><p><span style='color:black; font-family:Courier New; font-size:10pt'></div><br /></span></p><p><br /> </p><p>The JavaScript was like this.<br /></p><p><span style='font-size:10pt'><span style='color:blue; font-family:Courier New'><</span><span style='color:#a31515; font-family:Courier New'>script</span><span style='color:black; font-family:Courier New'> </span><span style='color:red; font-family:Courier New'>type</span><span style='color:blue; font-family:Courier New'>="text/javascript"></span><span style='color:black'><span style='font-family:Arial'> <br/></span><span style='font-family:Courier New'><!--</span><span style='font-family:Arial'> <br/></span><span style='font-family:Courier New'> </span></span><span style='color:blue; font-family:Courier New'>function</span><span style='color:black'><span style='font-family:Courier New'> ShowProgress() {</span><span style='font-family:Arial'> <br/></span><span style='font-family:Courier New'> document.getElementById(</span></span><span style='color:#a31515; font-family:Courier New'>'<%=Div1.ClientID %>'</span><span style='color:black; font-family:Courier New'>).style.display = </span><span style='color:#a31515; font-family:Courier New'>'none'</span><span style='color:black'><span style='font-family:Courier New'>; </span><span style='font-family:Arial'><br/></span><span style='font-family:Courier New'> document.getElementById(</span></span><span style='color:#a31515; font-family:Courier New'>'<%=divProgress.ClientID %>'</span><span style='color:black; font-family:Courier New'>).style.display = </span><span style='color:#a31515; font-family:Courier New'>"block"</span><span style='color:black'><span style='font-family:Courier New'>;</span><span style='font-family:Arial'> <br/></span><span style='font-family:Courier New'> document.getElementById(</span></span><span style='color:#a31515; font-family:Courier New'>'<%=divProgress.ClientID %>'</span><span style='color:black; font-family:Courier New'>).innerHTML = </span><span style='color:#a31515; font-family:Courier New'>'<div align="center"" class="ltGreenBorder"><br /><img alt="Progress" align="top" src="/images/pleasewait.gif" /> </div>'</span><span style='color:black'><span style='font-family:Courier New'>;</span><span style='font-family:Arial'><br /> </span></span></span></p><p><span style='font-size:10pt'><span style='color:black'><span style='font-family:Courier New'> }</span><span style='font-family:Arial'> <br/></span></span><span style='color:green; font-family:Courier New'>//--></span><span style='color:black; font-family:Arial'> <br/></span><span style='font-family:Courier New'><span style='color:blue'></</span><span style='color:#a31515'>script</span><span style='color:blue'>><br /></span></span></span></p><p><br /> </p><p>What I have done is simply updates innerHTML for the loading div. The gif started animating magically. <br /></p><p><span style='color:black; font-family:Courier New; font-size:10pt'><br /> </span> </p></span>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com0tag:blogger.com,1999:blog-5400517399212235427.post-59077935635104647882008-11-04T22:32:00.001+05:302008-11-16T04:58:23.609+05:30Disable Back & RegEx Validation: JS<!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> </w:Compatibility> <w:browserlevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" latentstylecount="156"> </w:LatentStyles> </xml><![endif]--><style> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> <p class="MsoNormal"><b style="">Disable Back on Browser: JavaScript<o:p></o:p></b></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">I know disabling back button of a browser may cause usability issue. I have identified on some occasions we have to do it (what’s if client needs it). I have found some ways to do that but I preferred using a simple JavaScript.</p> <p class="MsoNormal">Here is the code.</p> <p class="MsoNormal"><o:p> </o:p></p><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> </w:Compatibility> <w:browserlevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" latentstylecount="156"> </w:LatentStyles> </xml><![endif]--><style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> </w:Compatibility> <w:browserlevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" latentstylecount="156"> </w:LatentStyles> </xml><![endif]--><style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> <p class="MsoNormal" style=""><span style=";font-family:";font-size:9;color:blue;" ><</span><span style=";font-family:";font-size:9;" >script</span><span style=";font-family:";font-size:9;" > <span style="color:red;">type</span><span style="color:blue;">="text/javascript"</span></span><span style=";font-family:";font-size:9;color:blue;" >></span><span style=";font-family:";font-size:9;" ></span></p> <p class="MsoNormal" style=""><span style=";font-family:";font-size:9;color:blue;" ><</span><span style=";font-family:";font-size:9;" >!--<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style=";font-family:";font-size:9;" ><span style=""> </span>window.history.forward(1);<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style=";font-family:";font-size:9;color:green;" >//--><o:p></o:p></span></p> <p class="MsoNormal"><span style=";font-family:";font-size:9;color:blue;" ><</span><span style=";font-family:";font-size:9;color:blue;" >/</span><span style=";font-family:";font-size:9;" >script</span><span style=";font-family:";font-size:9;color:blue;" >></span><span style="" lang="ES-CO"><o:p></o:p></span></p> <p class="MsoNormal"><span style=";font-family:";font-size:9;color:blue;" ><span style=";font-family:";font-size:9;color:blue;" ></span><span style="" lang="ES-CO"><o:p></o:p></span></span></p> <p class="MsoNormal"><span style=";font-family:";font-size:9;color:blue;" ><span style=";font-family:";font-size:9;color:blue;" ></span><span style="" lang="ES-CO"><o:p></o:p></span></span></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">This should be put on the previous page to the page you wish to disable the back. This code will redirect user to the same page if he click back button. <span style=""> </span></p> <p class="MsoNormal"><o:p> </o:p></p><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> </w:Compatibility> <w:browserlevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" latentstylecount="156"> </w:LatentStyles> </xml><![endif]--><style> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> <p class="MsoNormal"><b style="">Regular expression validation on JavaScript<o:p></o:p></b></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">I know it is very much easy to validate something on JavaScript by using Regular expressions but it is hard for me to remember the syntax to do it. I’m posting this for me to get when it is needed. <span style="font-family:Wingdings;"><span style="">J</span></span></p> <p class="MsoNormal">Here is the Code.</p> <p class="MsoNormal"><o:p> </o:p></p><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> </w:Compatibility> <w:browserlevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" latentstylecount="156"> </w:LatentStyles> </xml><![endif]--><style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> <p class="MsoNormal" style=""><span style=";font-family:";font-size:9;color:blue;" ><</span><span style="font-size: 9pt; font-family: "Courier New"; color: rgb(163, 21, 21);">script</span><span style="font-size: 9pt; font-family: "Courier New";"> <span style="color: red;">type</span><span style="color: blue;">="text/javascript"</span></span><span style=";font-family:";font-size:9;color:blue;" >></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span></span><span style=";font-family:";font-size:9;color:blue;" ><</span><span style="font-size: 9pt; font-family: "Courier New";"><span style=""></span><span style="color: green;">!--<span style=""> </span><o:p></o:p></span></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span><span style="color: blue;">function</span> validateDate(source, clientside_arguments) {<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span>{<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span>clientside_arguments.IsValid = <span style="color: blue;">true</span>;<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span><span style="color: blue;">if</span> (document.getElementById(<span style="color: rgb(163, 21, 21);">'txtDate'</span>).value.length == 0) {<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span>clientside_arguments.IsValid = <span style="color: blue;">false</span>;<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span>}<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span><span style="color: blue;">else</span> {<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span><span style="color: blue;">var</span> dateRegEx = /^(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[13-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/;<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><o:p> </o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span><span style=""> </span><span style="color: blue;">if</span> (document.getElementById(<span style="color: rgb(163, 21, 21);">'txtDate'</span>).value.match(dateRegEx)) {<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span>clientside_arguments.IsValid = <span style="color: blue;">false</span>;<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span>}<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span>}<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span>}<o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New";"><span style=""> </span>}<span style=""> </span><o:p></o:p></span></p> <p class="MsoNormal" style=""><span style="font-size: 9pt; font-family: "Courier New"; color: green;">//--><o:p></o:p></span></p> <p class="MsoNormal"><span style=";font-family:";font-size:9;color:blue;" ><</span><span style="font-size: 9pt; font-family: "Courier New"; color: blue;">/</span><span style="font-size: 9pt; font-family: "Courier New"; color: rgb(163, 21, 21);">script</span><span style=";font-family:";font-size:9;color:blue;" >></span></p> <p class="MsoNormal"><span style=";font-family:";font-size:9;" ><o:p> </o:p></span></p> <p class="MsoNormal"><span style="">This regular expession (Date validation RegEx) is also very good. It simply do all the vaidations needed for dates.<o:p></o:p></span></p> <p class="MsoNormal"><span style="">If there is something that is usefull and if you have good sites that helps on writing JavaScript Please share.<o:p></o:p></span></p> <p class="MsoNormal"><span style=""><o:p></o:p></span></p>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com3tag:blogger.com,1999:blog-5400517399212235427.post-72072583091606682402008-11-01T11:56:00.002+05:302008-11-01T11:59:05.138+05:30Tips and Tricks on Blogging<span xmlns=''><p style='text-align: justify'>Some of my friends who maintain blogs asked me what I am doing to maintain a blog. So I thought of writing a posting will be helpful than answering all the questions individually.<br /></p><p style='text-align: justify'>I will list down almost all the tips and tricks that I can remember so far.<br /></p><ol><li><div style='text-align: justify'><strong>Content</strong>: - When I am reading on how to make a good blog all the guys say that you should give good content (postings). How to write good content is the problem I face. What I am doing is I writing what I feel that hard to find using Google or if I found some new way or if I simply do something then I will write about that. And the main concern is to write more than 200 words on a posting otherwise Google will ignore it. <a href='http://gayanonline.blogspot.com/2007/07/boost-your-blog-traffic.html'>More on boost blog traffic</a>.<br /></div></li><li><div style='text-align: justify'><strong>Customizing the theme</strong>: - A blog theme should be customized. It is like a theory. Otherwise it will look like a same ordinary blog. The user who comes to read your blog should feel that you are out of (extra) ordinary. You can easily find some good themes by just searching on Google. <a href='http://gayanonline.blogspot.com/2007/05/how-make-blog-customized.html'>More on Customizing Blog</a> and <a href='http://gayanonline.blogspot.com/2007/07/some-more-on-blogging.html'>Some More</a>. <br /></div></li><li><div style='text-align: justify'><strong>Analytics tool</strong>: - I use Google analytics and it works fine and gives me a lot of information about the visitors. It is pretty much easy to put that on your blog also. <a href='http://gayanonline.blogspot.com/2007/07/google-analytics_04.html'>More on Google analytics</a>.<br /></div></li><li><div style='text-align: justify'><strong>Google <span style='color:black; font-family:Trebuchet MS; font-size:10pt'>adsense</span></strong>:-I'm not that good on making money online. But I have added the adsense. Anyway I have earned about 150$s so far. What you have to do is just make the background, Text and Links same as the other parts on your blog. <br /></div></li><li><div style='text-align: justify'><strong>Make Labels</strong>:-Categorizing the postings is a good thing. Still I am finding a good way to do that. It makes easy to maintain the posting and to identify on what you should write more. I think I have to make new set of categories and sort all my postings. So far I have 90 posting published on this blog.<br /></div></li><li><div style='text-align: justify'><strong>Write More about Google</strong>:-I don't know why but I just browse through my blog posting and found that I write most of the postings about Google. I have no idea why I am doing it. I think I have to write about JavaScript more because the functions and syntax on JavaScript is hard to find and hard to remember (for me). <br /></div></li><li><div style='text-align: justify'><strong>Subscription</strong>:-Make it easier to subscribe to your blog. I believe the visitors who want to subscribe are most valuable visitors because they will come back again. <a href='http://gayanonline.blogspot.com/2007/07/enter-your-e-mail-address.html'>Make a Subscription available</a>.<br /></div></li><li><div style='text-align: justify'><strong>Networks</strong>:-Registering the blog on networks is a good thing to make sure your blog is reachable. In the left side panel of this blog you can see a lot of links to those sites and if you need them please use them.<br /></div></li><li><div style='text-align: justify'><strong>Google webmaster</strong>: - About 85% of the visitors are coming via Google search to my blog. The best thing to make it listed on Google is to use <a href='http://www.google.com/webmasters/'>Google Webmaster</a>. It will make easier to control how to be paged and also you can give the site map to it. It was hard to find a way for me to get a sitemap for my blog and finally I've found what we (bloggers) have to do is submit the <a href='http://feeds.feedburner.com/InspirationOfCuttingedgeTechnology'>RSS feed URL</a>.<br /></div></li><li><div style='text-align: justify'><strong>Add Some cool features</strong>:-Adding some really cool gadgets make you feel good. What I am doing is testing a lot of them and if I feel it is worth then it will be there appearing on my blog. As you can see I have added a gadget (on right top corner) to direct chat with me. <br /></div></li></ol><p>I think I have listed all the things I am doing on this blog. Please if you have more information or any good blog please share it with me. </p></span>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com1tag:blogger.com,1999:blog-5400517399212235427.post-59393284205117712782008-10-28T00:14:00.000+05:302008-10-28T00:28:44.065+05:30What I visit most of the time<p style="text-align: justify;" class="MsoNormal">I was just thinking about what are the sites I’m visiting most of the time. So I thought to write something about them. I think a person can be understood better by the sites he is reading and visiting most of the time. So I think you can know more about me when I share my favorite list.</p><p style="text-align: justify;" class="MsoNormal"><br /></p><div style="text-align: justify;"> </div><p style="text-align: justify;" class="MsoNormal"><o:p> </o:p></p><div style="text-align: justify;"> </div><ol style="margin-top: 0in; text-align: justify;" start="1" type="1"><li class="MsoNormal"><a href="http://google.com/">Google</a>: The best search engine I have ever used. It helps me a lot on finding almost anything. It helps me a lot. I don’t have to talk about this because anybody who reads this blog knows about Google.</li><li class="MsoNormal"><a href="http://mail.yahoo.com/">Yahoo mail</a>: Yahoo mail is the mail I am using. There are 2 reasons for that. First it is free. Second no storage limit. </li><li class="MsoNormal"><a href="http://www.facebook.com/">FaceBook</a>: Most of the time what I am doing in here is accepting friends and looking at the photos posted by friends. (normally I visit almost all the photos of the friends)</li><li class="MsoNormal"><a href="http://defencewire.blogspot.com/">DefenceWire</a> (blog): This is a blog which posts about the current status of the war in <st1:country-region st="on"><st1:place st="on">Sri Lanka</st1:place></st1:country-region>. There are a lot of comments so the time is spent more on reading comments than reading the postings. (these days it is not updating regularly – but comments are coming)</li><li class="MsoNormal"><a href="http://defencenet.blogspot.com/">DefenceNet</a> (blog): This is almost same as DefenceWire but I prefer on reading both blogs since the comment threads goes on many viewpoints.</li><li class="MsoNormal"><a href="http://defence.lk/">Defence</a> : This is the web site which was maintained by Ministry of Defense <st1:place st="on"><st1:country-region st="on">Sri Lanka</st1:country-region></st1:place>. Worth reading to know about what the government thinks about the war.</li><li class="MsoNormal"><a href="http://www.msdn.com/">MSDN</a>: Since I am a .net developer I have to read about the things to learn and also to implement on .net. I don’t use the search on MSDN (it gives a lot of other things than what I want to know) instead use Google to search on MSDN site.</li><li class="MsoNormal"><a href="http://youtube.com/">YouTube</a>: There is lot of things to watch in here since anybody can upload videos on YouTube. <span style=""> </span>I just have to search what I like to watch and most of the time it’s available on here.</li><li class="MsoNormal"><a href="http://www.google.com/analytics/sign_up.html">Google Analytics</a>: I’m using Google analytics to monitor how this blog goes on. it gives me a lot of features and I can get an idea on how to improve the blog and what should I do to increase the visitors. <a href="http://gayanonline.blogspot.com/2007/07/google-analytics_04.html">More on Google Analytics …</a></li><li class="MsoNormal"><a href="http://www.engadget.com/">Engadget</a>: I love to read about the new gadgets coming. So I think I have found the best site to read about them. </li></ol><div style="text-align: justify;"><br /> </div><p style="text-align: justify;" class="MsoNormal"><o:p> </o:p></p><div style="text-align: justify;"> </div><p style="text-align: justify;" class="MsoNormal">I like to know about the sites you visit most of the time. I think it will help to understand each other.</p>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com5tag:blogger.com,1999:blog-5400517399212235427.post-80581011243998537082008-10-26T12:52:00.003+05:302008-10-28T00:28:36.145+05:30User Controls vs. Custom Controls<span xmlns=""><p><span class="Apple-style-span" style="font-family:Arial;"></span></p><p class="MsoNoSpacing"><span class="apple-style-span"><span lang="EN-US" style="Arial","sans-serif";font-family:";font-size:10.0pt;color:black;">The first thing I have to do in here is to apologise for not posting something on this blog for a long time. Yes it was really a long time without any posting. There were some reasons for that like I had to go abroad (still I am at Canada, and it is a big experience). So I was new in here had lot of work to do. Anyway I hope to post regularly now onwards. </span></span></p> <p class="MsoNoSpacing"><span class="apple-style-span"><span lang="EN-US" style="Arial","sans-serif";font-family:";font-size:10.0pt;color:black;">I have been on 2 projects in here (web applications). On one project it was designed to do by using more “User Controls” and the other one was using “Custom Controls” so first of all I was pretty confused with mixing these two approaches. In my mind I was like in a war to identify what is the better approach and thought to write about those a little.<o:p></o:p></span></span></p><p class="MsoNoSpacing"><span class="Apple-style-span" style="font-size:13px;"></span></p><p class="MsoNoSpacing"><span class="apple-style-span"><b><span lang="EN-US" style="Arial","sans-serif";font-family:";font-size:10.0pt;color:black;">User Controls </span></b></span></p> <p class="MsoNoSpacing"><span class="apple-style-span"><span lang="EN-US" style="Arial","sans-serif";font-family:";font-size:10.0pt;color:black;">Basically a User Control is like a normal </span></span><span class="apple-style-span"><span lang="EN-US" style="Arial","sans-serif";color:#4F6228; mso-thememso-themeshade:128font-family:";font-size:10.0pt;color:accent3;">aspx</span></span><span class="apple-style-span"><span lang="EN-US" style="Arial","sans-serif";font-family:";font-size:10.0pt;color:black;"> page only different I can see is the file extension is as </span></span><span class="apple-style-span"><span lang="EN-US" style="Arial","sans-serif";color:#4F6228; mso-thememso-themeshade:128font-family:";font-size:10.0pt;color:accent3;">ascx</span></span><span class="apple-style-span"><span lang="EN-US" style="Arial","sans-serif";font-family:";font-size:10.0pt;color:black;">. We can make a user control and it has a code behind also. We can just build this as a web page and treat it as a normal web page on aspx. So we can have properties and methods on the code behind and can have all the controls as on aspx and HTML. </span></span></p> <p class="MsoNoSpacing"><span class="apple-style-span"><span lang="EN-US" style="Arial","sans-serif";font-family:";font-size:10.0pt;color:black;">User Controls can be built as a reusable thing for a project and we can insert on several places on a particular project. For example we can build a Form or some contents with styles. Since we can dynamically assign the properties it can used on many places and helps maintains the uniformity. So when an aspx page is built then it will be a collection of user controls and an assignment of properties for them. </span></span></p> <p class="MsoNoSpacing"><span class="apple-style-span"><span lang="EN-US" style="Arial","sans-serif";font-family:";font-size:10.0pt;color:black;">User controls were developed even though it is used only on one place. They were maintained as user controls because we can use them when a change or an enhancement is needed. The other thing is we can just publish the user controls on MOSS. Since the project I was on which had user controls were published on MOSS so we haven`t done any aspx page and all the user controls were either directly published on MOSS or used by another User Control. </span></span></p> <p class="MsoNoSpacing"><span lang="EN-US" style="Arial","sans-serif"font-family:";font-size:10.0pt;">In this URL below you can find more I mean more on how to develop a user control. To understand when and where to use them it is needed to do some hands on experiments.</span></p><p class="MsoNoSpacing"><span lang="EN-US" style="Arial","sans-serif"font-family:";font-size:10.0pt;"><a href="http://msdn.microsoft.com/en-us/library/bb386451.aspx">http://msdn.microsoft.com/en-us/library/bb386451.aspx</a><o:p></o:p></span></p><p class="MsoNoSpacing"></p><p class="MsoNoSpacing"><b><span lang="EN-US" style="Arial","sans-serif"font-family:";font-size:10.0pt;">Custom Controls </span></b></p> <p class="MsoNoSpacing"><span lang="EN-US" style="Arial","sans-serif"font-family:";font-size:10.0pt;">A custom control is basically a class. It derives from Control or WebControl.<span style="mso-spacerun:yes"> </span>So what we are doing is making some control that is reusable on any project. <span style="mso-spacerun:yes"> </span>What usually made are customized Data grids (like editable grids), Date Time pickups, and textbox with AJAX suggestions. Since these are Classes we can use the dlls on anywhere. (Even on another project easily) </span></p> <p class="MsoNoSpacing"><span lang="EN-US" style="Arial","sans-serif"font-family:";font-size:10.0pt;">It can either be inserted on an aspx page directly or on a User Control. What I am thinking is making a lot of complex Custom controls that only can be used on one project is not worthy unless we are reusing it more and more (on same project). And it will be better we can make more generic Custom Controls that enhances the functionality of aspx controls. (It is what happens on most software companies) </span></p> <p class="MsoNoSpacing"><span lang="EN-US" style="Arial","sans-serif"font-family:";font-size:10.0pt;">You can find on how to develop a new custom control and insert it on an aspx (or ascx) by visiting the link below. </span></p> <p class="MsoNoSpacing"><span lang="EN-US" style="Arial","sans-serif"font-family:";font-size:10.0pt;"><a href="http://msdn.microsoft.com/en-us/library/zt27tfhy.aspx">http://msdn.microsoft.com/en-us/library/zt27tfhy.aspx</a><o:p></o:p></span></p><p class="MsoNoSpacing"></p><p class="MsoNoSpacing"><span lang="EN-US" style="Arial","sans-serif"font-family:";font-size:10.0pt;">On the other project we were using the custom controls and they were just put on the aspx pages. The custom controls we were built was a bit complex ones (and used once inside the project and specialized for the same project). <span style="mso-spacerun:yes"> </span>So there were about 2-3 custom controls per page. <span style="mso-spacerun:yes"> </span>I think it will be better if we are using both control types on a web application and the custom controls should be compatible with other projects and user controls may be more specified for a particular project. <span style="mso-spacerun:yes"> </span></span></p> <p class="MsoNoSpacing"><span lang="EN-US" style="Arial","sans-serif"font-family:";font-size:10.0pt;">I know that I don`t have a lot of experience on these so if there is some more information or something need to be changed please let me know.<br /></span></p><p></p><p></p><p></p><p></p></span>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com2tag:blogger.com,1999:blog-5400517399212235427.post-30260753621285107362008-07-16T11:55:00.002+05:302008-07-16T11:58:41.372+05:30How to use Google<span xmlns=''><p>I have seen a lot of my friends are using Google to find out the things. But I felt sometimes that they are not using the proper way to do that. So it takes a lot more time and lot more reading to find actually what we want.<br /></p><p>So I thought to find how to make our search better. I have found 2 sites that tell about that in more detailed.<br /></p><p>First is <a href='http://www.google.com/support/bin/static.py?page=searchguides.html&ctx=basics&hl=en'>Google Search Help Center</a> . It talks about the keywords that we can use with Google. I thing spending some time on this site will save a lot of time.<br /></p><p>Next is <a href='http://www.googleguide.com/'>Google Guide</a>. It tells you a lot more on search. Whether you are an expert or novice it doesn't matter on this site. I think even an expert can learn something in here.<br /></p><p>So I hope after referring these sites your ability on searching on Google will increase. And you will learn what Google can do. (It is lot more than just a search engine)<br /></p><p><br /> </p></span>Gayanhttp://www.blogger.com/profile/01184003702568837266noreply@blogger.com2