Posted by: prajapatinilesh | August 8, 2011

JAIN SONGS LYRICS – tu mane bhagwan ek vardaan aapi de !!

I like this song very much.  so, adding its lyrics here.

[tu mane bhagwan ek vardaan aapi de
jya vase che tu mane tya sthaan aapi de]…(2)

[hu jivu chu ae jagat ma jya nathi jeevan
zindagi nu naam che bas boj ne bandhan]…(2)

[aakhri avtaar nu mandaan bandhi de
jya vase che tu mane tya sthaan aapi de]…(2)

[tu mane bhagwan ek vardan aapi de
jya vase che tu mane tya sthaan aapi de]…(1)

[aa bhoomi ma khoob gaaje paap na padgham
besuri thai jayi amari punya ni sargam]…(2)

[dil rubana taar nu bhangan saandhi de
jya vase che tu mane tya sthaan aapi de]…(2)

[tu mane bhagwan ek vardaan aapi de
jya vase che tu mane tya sthaan aapi de]…(1)

[jo vatan ma jya Lagi che sau kare shoshan
jom a jata koi ahiya na kare poshan]…(2)

[matlabi sansar nu jo daan kaapi de
jya vaseche tu mane tya sthaan aapi de]….(4)

tu mane bhagwan ek vardaan aapi de
[jya vaseche tu mane tya staan aapi de]…(4)
Thanks,
Nilesh Prajapati.
Posted by: prajapatinilesh | January 7, 2011

PHP Date ( Archived date list )

<?php
$stDtTimeVar = ’12/30/2010 09:00 PM’;
$endDtTimeVar = ’12/30/2010 09:00 AM’;
echo ‘start date:– ‘.$stDtTimeVar;
echo “<br /> <br />”;
echo ‘end date:– ‘.$endDtTimeVar;
echo “<br /> <br />”;

if(strtotime($stDtTimeVar) >= strtotime($endDtTimeVar)) {
echo ‘start date is greater.’;
}
else {
echo ‘end date is greater.’;
}

echo “<br /> <br />”;

$url = $_SERVER['PHP_SELF'];
$i=1;
$monthLimit=12;

$currentdate = date(“Y-m”, mktime(0,0,0,date(“m”),1,date(“Y”)));
$currentdate1 = str_replace  ( “-”  , “_”  , $currentdate);

$currentdateDisp=date(“F Y”, mktime(0,0,0,date(“m”),1,date(“Y”)));
echo “<a href=’$url?date=$currentdate1′>”.$currentdateDisp.”</a>”.”<br>”;

while($monthLimit > 0) {

$monthVal = date(“m”)-$i;

$dateDisp = date(“Y-m”, mktime(0,0,0,$monthVal,1,date(“Y”)));
$dateDisp1 = str_replace  ( “-”  , “_”  , $dateDisp);

$dateDisp2 = date(“F Y”, mktime(0,0,0,$monthVal,1,date(“Y”)));
?>
<a href=’<?=$url?>?date=<?=$dateDisp1?>’><?=$dateDisp2?></a><br>
<?php
$monthLimit–;
$i=$i+1;
}
?>

Thanks,

Nilesh Prajapati

Posted by: prajapatinilesh | January 7, 2011

Marge 2 field Sybase query

TableName: ScheduledHomepage
Fields: startDate (datetime) , startHour (time)

select startDate,startHour from ScheduledHomepage
startDate                  startHour
————————– —————
NULL            NULL
May 15 2010 12:00AM         10:00AM
Mar 11 2010 12:00AM          9:00AM

//Trancate time value from full date time value.
select left(startDate,11) as startDate from ScheduledHomepage

startDate
———–
NULL
May 15 2010
Mar 11 2010

//Combine 2 field value
select left(startDate,11) +” “+ convert(varchar(8), startHour) as startDateTime from ScheduledHomepage

startDateTime
——————–

May 15 2010 10:00AM
Mar 11 2010  9:00AM

Other sample examples:

select convert(nvarchar,getdate(),101)
select convert(INT,convert(varchar,getdate(),112))
SELECT LEFT(DateTimeField, 11) FROM Table
SELECT CONVERT(VARCHAR(20), DateTimeField, 101) FROM YourTable

Thanks,

Nilesh Prajapati

Posted by: prajapatinilesh | June 10, 2010

Javascript + Array sort on Key

<HTML>
<HEAD>
<TITLE> array key sort </TITLE>
<script language=”javascript”>
jsArray = new Array();
jsArray['A'] = ‘Test1′;
jsArray['Z'] = ‘Test3′;
jsArray['P'] = ‘Test4′;
jsArray['U'] = ‘Test2′;
jsArray['B'] = ‘Test5′;

array = jsArray;
var keys = new Array();
for(k in array)
{
keys.push(k);
}

keys.sort( function (a, b){return (a > b) – (a < b);} );

for (var i = 0; i < keys.length; i++)
{
alert(keys[i] + ” , ” + array[keys[i]]);
}
</script>
</HEAD>

<BODY>
Javascript + Array sort on Key
</BODY>
</HTML>

SELECT REPLACE(convert(varchar(11), getdate(), 109),’ ‘,’/’)

Posted by: prajapatinilesh | April 6, 2010

.htaccess – some security on site.

File Name:   .htaccess  – put this on root directory of htdocs folder.

#order deny,allow
#deny from all
#allow from 127.0.0.1

#Options +Indexes # enables Directory listing
#Options –Indexes # disables directory listing

#just create an empty directory list
IndexIgnore *

#to skip all gif, zip and txt files from the directory list
#IndexIgnore *.gif *.zip *.txt

#ErrorDocument 404 /notfound.html
ErrorDocument 404 http://localhost/Nilesh/notfound.html

Thanks,  Nilesh

This error comes when you print any thing before php hreader command or sometime single spaces allowed before any file starting place or printing or getting values from $_COOKIE or $_SESSION or set cookie or set session etc…

Example Error Code:
<?php
print “text”;
header(‘Location: http://www.example.com/’);
?>

Solution :

<?php
function JSRedirection($url)
{?>
<script type=”text/javascript”>
<!–
window.location = “<?=$url?>”
//–>
</script>
<?}
print “test”;
JSRedirection(“http://www.example.com/”);

?>

Above is by use of js redirect function. But we can solved it by php functions only.

Example 1:

<?php
header("location: 1.html");
header("location: 2.html"); //replaces 1.html
?>

This redirects to 2.html since the second header replaces the first.

Example 2:

<?php
header("location: 1.html");
echo "send data";
header("location: 2.html"); //1.html already sent
?>

This redirects to 1.html since the header is sent as soon as the echo happens. You also won't see any "headers already sent" errors because the browser follows the redirect before it can display the error.

Example 3:

<?php
ob_start();
header("location: 1.html");
echo "send data";
header("location: 2.html"); //replaces 1.html
ob_end_flush(); //now the headers are sent
?>

Wrapping the previous example in an output buffer actually changes the behavior of the script! This is because headers aren't sent until the output buffer is flushed.

OR

Need to write <?php ob_start(); ?> at first line of html part when you main body is common for all pages.

like:

<?php ob_start(); ?>

<html> ……  <?php include_once “<included part of files >”;  ?>  …… </html>

Thanks,

Nilesh Prajapati.

Posted by: prajapatinilesh | June 25, 2009

Javascript + Array sort on Key

Hi,

Please follow following example to understand the problem.

<script>
function keySort(array, flag) {
var keys = new Array();

for(k in array) {
keys.push(k);
}

keys.sort( function (a, b) {
if (flag && flag != ‘undefined’) {
if(flag == ‘integer’) {
a = parseInt(a);
b = parseInt(b);
}
}
return (a > b) – (a < b);
} );

return keys;
}//End of function keySort

/*jsArray = new Array();
jsArray['A'] = ‘Test1′;
jsArray['Z'] = ‘Test3′;
jsArray['P'] = ‘Test4′;
jsArray['U'] = ‘Test2′;
jsArray['B'] = ‘Test5′;*/

jsArray = new Array();
jsKeyArray = new Array();

jsArray[80] = ‘nil1′;
jsArray[120] = ‘nil2′;
jsArray[160] = ‘nil3′;

for (x in jsArray) {
alert(x + ‘ –> ‘ + jsArray[x]);
}

jsKeyArray = keySort(jsArray);

/*for (x in jsKeyArray) {
alert(x + ‘ –> ‘ + jsKeyArray[x]);
}*/

//It will display wrong result….
for (var i = 0; i < jsKeyArray.length; i++) {
alert(jsKeyArray[i] + ‘ –> ‘ + jsArray[jsKeyArray[i]]);
}

jsKeyArray = keySort(jsArray, ‘integer’);

//correct result….
for (var i = 0; i < jsKeyArray.length; i++) {
alert(jsKeyArray[i] + ‘ (integer) –> ‘ + jsArray[jsKeyArray[i]]);
}

//——————————————————————–

//Value integer sorting…..

function sortASC(a, b){ return (a-b); }
function sortDESC(a, b){ return (b-a); }

integerArray = new Array(1,545,1435,3453,342,441,90);

integerArray.sort( sortASC );
document.write(‘ <br /> Ascending : ‘ + integerArray);

integerArray.sort( sortDESC );
document.write(‘ <br /> Descending : ‘ + integerArray );

</script>

Thanks,

Nilesh Prajapati

Posted by: prajapatinilesh | May 17, 2009

How to refresh the parent window on closing the child window ?

Hi,

Demo Example:

1) parent.php

<html>
<head> <title>Parent Window</title>
<script language=”javascript”>
window.name = ‘parentWindow’;
var newPopupWindow;
function popupLinkOption(url,width,height) {
newPopupWindow=window.open(url,”childWindow”,”height=”+height+”,width=”+width+”,left=100,top=100,resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no,location=no”);
}
</script>
</head>
<body>
Parent File <br />
<a href=”#” onclick=”popupLinkOption(‘child.php’,200,200);”> Popup </a>
<?php
if ($_GET['rId']) {
echo “<br />Rendom Id –>”.$_GET['rId'];
}
?>
</body>
</html>

————————————————————————————————

2) child.php

<html>
<head> <title>Child Window</title>
<script language=”javascript”>
function refreshParent() {
//here window.opener is the parent window from which child window opened.
parentURL = window.opener.location.href;
if (parentURL && parentURL != ‘undefined’) {
//alert(window.opener.location.href + ‘ — ‘ + window.opener.location);
//alert(window.opener.name);
parentURLArr = parentURL.split(‘#’);

//find last characters from the string means # as we have href=’#’ in parent window link
//newStr = parentURL.substring(0, parentURL.length-1);
//alert(newStr);

parentURLArr1 = parentURLArr[0].split(‘?rId=’);
//alert(parentURLArr1[0]);

qStr = ‘?rId=’+Math.random(); //random Id added here becuase it will not take page from the browser cache.. sometimes required for some browser.

window.opener.location.href = parentURLArr1[0] + qStr;

//window.opener.location.href = window.opener.location.href; //this also used to refresh the parent window.
//window.opener.location.reload(); //this also we can add to reload the parent window.
//window.opener.close(); //parent open closing
}
}

function closeChild() {
window.close();
}
</script>
</head>
<body onunload=”refreshParent();” >
Child File <br />
<a href=”#” onclick=”closeChild();”> Close Child</a>
</body>
</html>

This is just demo with alert and other things. so, can check in your local pc.. and you can modified code as per your requirements. :)

Run parent.php file to check this exmple.

Thanks,

Nilesh Prajapati.

Posted by: prajapatinilesh | May 11, 2009

Javascript function to get particular querystring value from URL.

Hi,

function getQueryStrVal(url,name) {
name = name.replace(/[\[]/,”\\\[").replace(/[\]]/,”\\\]”);
var regexS = “[\\?&]“+name+”=([^&#]*)”;
var regex = new RegExp( regexS );
var results = null;
if (url && url != ‘undefined’) {
results = regex.exec( url );
}
else {
results = regex.exec( window.location.href );
}
if( results == null )
return “”;
else
return results[1];
}

How to use:

here url is your js variable in which your whole url is defined.

if(url.indexOf(‘prefixVal’) != -1) {

prefixVal = getQueryStrVal(url, ‘prefixVal’);

alert(prefixVal);

}

Thanks,

Nilesh prajapati.

Older Posts »

Categories

Follow

Get every new post delivered to your Inbox.