Here is the code for Live digital clock.
Just we are going write a function to get the current time and display it in span. We are calling that function for each 1000 milli seconds. so, live clock is working.
var int=self.setInterval("clock()",1000);
function clock(){
var now=new Date();
var time=now.toLocaleTimeString();
document.getElementById("clock").textContent=time;
};
Here is the live Demo
Thanks Christian Whi...
Tuesday, 4 November 2014
Monday, 6 October 2014
Here is the function to tell how many times a search phrase is found in a string.
Note: It's case sensitive.
function howMany(str, term){
return str.match(new RegExp(term, 'g')).length;
};
var text='Visit WHAK.com for WHAKy things!';
var phrase='HAK';
alert(phrase+' is found in\n'+text+'\n'+howMany(text,phrase)+' times.')
Thanks Christian Whi...
Sunday, 24 August 2014
If we want to get rows by filtering given month and year, We can use 2 popular ways.
EXTRACT()
BETWEEN
1. EXTRACT( ):
The EXTRACT() function is used to return a single part of a date/time, such as year, month, day, hour, minute, etc.
SYNTAX:
EXTRACT(unit FROM date)
This function have a following units to use.
MICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR, SECOND_MICROSECOND, MINUTE_MICROSECOND, MINUTE_SECOND, HOUR_MICROSECOND, HOUR_SECOND, HOUR_MINUTE,...
Monday, 18 August 2014
In general we don't like to see our images stretched in view. In this case, If we want to reduce size diagonally, what should we do?
We can do it by changing width property of image.
First We need to get original width of image using javascript's naturalWidth property.
Then Multiply it with 0.5 to get 50% reduced image.
If you want 2x larger image, then multiply it with 2. like this below code,
domElement.width = doemElement.naturalWidth * 0.5;
Then assign resultant...
The Javascript's naturalWidth and naturalHeight properties will return original width and height of an image.
For an example, If we are using an image with 350px original width and 225px original height, It will return the same height and width even we made changes in DOM's height and width property.
The following DEMO will make you understand more what I'm saying.
In this DEMO the original image size of image is 350 x 225 px. We are also changed image width...
Saturday, 9 August 2014
$_GET and $_POST
Both GET and POST create an array.
e.g. array(key=>value, key2=>value2, key3=>value3, ...).
This array holds key/value pairs, where keys are the names of the form controls and values are the input data from the user.
Both GET and POST are treated as $_GET and $_POST. These are superglobals, which means that they are always accessible, regardless of scope - and you can access them from any function, class or file without having...
Thursday, 7 August 2014

This reloadAfterSubmit attribute always confusing with data type. I have seen so many post related to reloadAfterSubmit not working like that in jqGrid forum and stackoverflow posts. Here I gave explanation about reload process in jqGrid.
jqGrid using AJAX to post data to Server Side (add, edit, delete). So, our page will not get refresh.
jqGrid reloadAfterSubmit...
Tuesday, 29 July 2014
Problem
We can't run 2 updaters at the same time so if packagekit is running then you can't run Yast update or zypper.
So, it will through confirm message to stop packageKit process.
PackageKit is blocking software management.
This happens when the updater applet or another software management
application is running.
Ask PackageKit to quit?
if you click on 'Yes', it will try to stop the process of packageKit. If it is still busy, it will again arise the popup with this message.
PackageKit...
Monday, 28 July 2014
Sunday, 27 July 2014
When you get the data from CSV file, It will return return array of each row. To work with this, we need to convert it as 2D array. So, this following code snippet will help you to covert CSV array to 2D array. In this we used PHP's array_combine function.
FUNCTION DEFENITION
function get2DArrayFromCsv($file, $delimiter) {
if (($handle = fopen($file, "r+")) !== FALSE) {
$i = 0;
$data2DArray = array();
while (($lineArray = fgetcsv($handle, 0, $delimiter)) !== FALSE)...
Monday, 21 July 2014
We can do it with table's border-collapse property.
Collapse
In which both the space and the borders between table cells collapse. So, there is only one border and no space between cells.
Just change the table border-collapse style into collapse using this following css
table {
border-collapse: collapse;
}
Now the each cells are independent. So, you can apply border-bottom or border-top style for each td like bellow CSS.
To...
Saturday, 19 July 2014
Here we listed 24 jQuery UI themes... Click on the names to get raw code of themes.
Black tie
Blitzer
Cupertino
Dark Hive
Dot luv
Egg plant
Excite bike
Flick
Hot Sneaks
Humanity
Le frog
Mint Choc
Overcast
Pepper grinder
Redmond
Smoothness
South Street
Start
Sunny
Swanky purse
Trontastic
UI Darkness
UI Lightness
Vader
Click...! Download...!! Enjoy... !!! ...
Thursday, 17 July 2014
This sounds "Language supporting file is missing".
* One get the error message typically if one don't included required language file grid.locale-xx.js (for example grid.locale-en.js).
* You can Include it before jquery.jqGrid.min.js or jquery.jqGrid.src.js. See the example of the usage of jqGrid in Documentation
* If you don't have that file, Click Here to download.
Have any doubt? Feel free to comment here!!!
Related post : jqGrid "reloadGrid" using Local Data...
Wednesday, 16 July 2014
When you get the data from CSV file, It will return return array of each row. If we want this array in JSON as header row as key and cell value as value, We can use PHP's array_combine function.
So, We can use this following function to achieve this task.
FUNCTION DEFENITION
function getJsonFromCsv($file,$delimiter) {
if (($handle = fopen($file, 'r')) === false) {
die('Error opening file');
}
$headers = fgetcsv($handle, 4000, $delimiter);
$csv2json = array();
while...
Saturday, 12 July 2014
In PHP recently I faced this issue. When I tried to use my xml file using php's document load() function.
Problem
$dom = DOMDocument::load('myXml.xml');
It works perfectly. But I throws error
Strict Standards: Non-static method DOMDocument::load() should not be called statically
Solution
The reason why it's happening is because I called a load() method in the DOMDocument class in which is not static.
Instead of calling it with :: We need to call...
Thursday, 3 July 2014
We can do this using Javascript's Date() object. You can use this following function to get between two dates. It will return array. Here we are using isDate() and isValidRange() functions to make sure is the given string is Date and end date is not greater then start date. If the given string is not date, then it will return "error occured!!!... Please Enter Valid Dates" in browser console and it will return empty array.
...
Tuesday, 24 June 2014
To get all dates in given month and year, we need to know how many days in that given month and year.
to do that we are going to use PHP's date() and mktime() functions.
Syntax :
date(format,timestamp)
mktime(hour,minute,second,month,day,year,is_dst);
Function:
the following function will return dates in array format for given month and year in Y-m-d format.
This file contains bidirectional Unicode text that may be...
Monday, 16 June 2014
(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));
$( "a.see_more_link" ).on( "click", function(e) {
e.preventDefault();
alert('hi');
});
Post by சுபா ஆனந்தி...
Saturday, 14 June 2014
வெற்றியை நோக்கி பற !
பறக்க முடியாவிட்டால் ஓடு !
ஓட முடியாவிட்டால் நட !
நடக்கவும் முடியாவிட்டால் ஊர்ந்து செல்.
ஆனால், எப்படியாவது நகர்ந்து கொண்டே இரு.
English Version:
Fly to Victory!
If you can't fly, then run !
If you can't run, then Walk !
If you are unable to walk, then Crawl.
But, Somehow, Keep Moving......
Friday, 13 June 2014
Thursday, 12 June 2014
Wednesday, 11 June 2014
In this post we are going to see how to compare two array elements? and do something, when the element is matched.
This below prototype method will do that trick.
Array.prototype.diff = function(arr2) {
this.sort();
arr2.sort();
for(var i = 0; i < this.length; i += 1) {
if(arr2.indexOf( this[i] ) > -1){
arr2.splice(arr2.indexOf( this[i] ), 1);
}
}
};
from the above code, first we are sorting both arrays. Then, We searching for index of same element...
Wednesday, 4 June 2014

Problem
This issue is arise with only RSS feed not in ATOM feed.
Example
I'm going to show my blogger blog feed as an example in this post.
RSS Feed
This below URL is my blog post feed URL which will return my RSS feed data of posts.
http://cj-ramki.blogspot.in/feeds/posts/default?alt=rss
It creates the JSON data empty blog author name and noreply@blogger.com(author name). I just...
Tuesday, 3 June 2014
To get referrer url, we are going to use $_SERVER variable called HTTP_REFERER.
In some cases we need to check, this page redirected from where? To fill up that "where" we should use $_SERVER[HTTP_REFERER].
NOTE:
If users use a bookmark or directly visit your site by manually typing in the URL, HTTP_REFERER will be empty.
If the users are posting to your page programatically (CURL) then they're not obliged to set the HTTP_REFERER as well.
So,...
To get current full url in php, we can use php's $_SERVER variables.
We are going to use
$_SERVER[REQUEST_SCHEME] - It will print which type scheme (ex.http)
$_SERVER[HTTP_HOST] - Server host name
$_SERVER[REQUEST_URI] - current URI
So, We can combine those three like below,
$URL = $_SERVER[REQUEST_SCHEME].'://'.$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
Simply echo it like this echo $_URL; to test it.
Have...
Monday, 2 June 2014
Sunday, 1 June 2014
NR Narayana Murthy, who steps down as Infosys chairman on August 20, is a
role model for not just what he achieved but also how he did it. Here
are 30 lessons from Murthy, one for each year he spent at company.
1-Seize Your Gandhi Moment
Murthy, a self
proclaimed socialist in the mid '70s was jailed for 72 hours in
Bulgaria. The experience taught him that entrepreneurship and job
creation is the way to alleviate poverty.
2-You might fail, but get started
Learn
from mistakes and move on....
Subscribe to:
Posts (Atom)