<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>Code Snippets</title>
	<atom:link href="http://vikku.info/codesnippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://vikku.info/codesnippets</link>
	<description>Jayapal Chandran's  Code Snippets - JavaScript, Ajax, PHP, C 16bit and WIN32 API</description>
	<pubDate>Thu, 02 Feb 2012 16:04:52 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>centring float left elements</title>
		<link>http://vikku.info/codesnippets/html/centring-float-left-elements/</link>
		<comments>http://vikku.info/codesnippets/html/centring-float-left-elements/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 16:04:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://vikku.info/codesnippets/?p=269</guid>
		<description><![CDATA[I wanted to center the divs which are floated left. I searched the web and found this and it is working for me. http://stackoverflow.com/questions/1084666/how-can-i-center-the-contents-of-a-div-that-float-left This is just a copy for my reference even if that content is getting deleted future. Besides, the following is the code which does the exact trick which is referred in [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to center the divs which are floated left.</p>
<p>I searched the web and found this and it is working for me.</p>
<p><a href='http://stackoverflow.com/questions/1084666/how-can-i-center-the-contents-of-a-div-that-float-left'>http://stackoverflow.com/questions/1084666/how-can-i-center-the-contents-of-a-div-that-float-left</a></p>
<p>This is just a copy for my reference even if that content is getting deleted future.</p>
<p>Besides, the following is the code which does the exact trick which is referred in the above stackoverflow url.</p>
<p><a href='http://www.pmob.co.uk/temp/centred-float4.htm'>http://www.pmob.co.uk/temp/centred-float4.htm</a></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;style type=&quot;text/css&quot;&gt;
html,body{
	margin:0;
	padding:30px 10px;
	text-align:center;
}
#outer{
	width:780px;
	margin:auto;
	text-align:left;
	border:1px solid #000;
}
#outer{position:relative}
.navwrap{
	float:right;
	position:relative;
	left:-50%;
	text-align:left;
	margin-bottom:2em;
}
.navwrap ul{
	list-style:none; 
	position:relative;
	left:50%;
	margin:0;
	padding:0;
} 
.navwrap li{
	border:1px solid #eff2df;
	float:left;
	margin:0 10px 0 0;
	background:#809900;
}
.navwrap li.last{margin-right:0}
.navwrap li a{
	float:left;
	border:1px solid #4c7300;
	position:relative;
	left:-2px;
	top:-2px;
	background:#eff2df;
	color:#4c7300;
	text-decoration:none;
	padding:6px 10px;
	font-weight:bold;
}
.navwrap li a:hover{
	background:#809900;
	color:#fff;
}
p{clear:both;padding:10px}
h1{text-align:center;margin:1em 0;}
.clearer{
	height:1px;
	overflow:hidden;
	margin-top:-1px;
	clear:both;
}
&nbsp;
&nbsp;
&nbsp;
&lt;/style&gt;
&lt;!--[if IE ]&gt;
&lt;style type=&quot;text/css&quot;&gt;
.navwrap ul{float:left;} 
&nbsp;
&lt;/style&gt;
&lt;![endif]--&gt;</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;outer&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Centred Widthless floats<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;navwrap&quot;</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Button 1<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Button 2's a bit longer<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>This is Button 3<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>B 4<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Button 5<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
&nbsp;
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;last&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>This is Button 6<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clearer&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!-- ie needs this clearer --&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;navwrap&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Button 1<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
&nbsp;
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Button 2's a bit longer<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;last&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>This is Button 3<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clearer&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!-- ie needs this clearer --&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;navwrap&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
&nbsp;
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;last&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Button 1<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>The above navigation is floated using widthless floats and centred using a technique that moves the right floated parent wrapper 50% back towards the left using relative positioning -50%) and then applying a +50% left shift on the inner element also using relative positioning.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span> The combined effect of this is to center the navigation within our layout<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://vikku.info/codesnippets/html/centring-float-left-elements/feed/</wfw:commentRss>
		</item>
		<item>
		<title>facebook comments set 100% percent width for facebook comments</title>
		<link>http://vikku.info/codesnippets/facebook/facebook-comments-set-100-percent-width-for-facebook-comments/</link>
		<comments>http://vikku.info/codesnippets/facebook/facebook-comments-set-100-percent-width-for-facebook-comments/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 07:16:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://vikku.info/codesnippets/?p=255</guid>
		<description><![CDATA[I wanted to set percentage width for facebook comments plugin. I searched the web and i got the following information from stackoverflow. What i previously had was the following &#60;div id=&#34;fb-root&#34;&#62;&#60;/div&#62; &#60;div class=&#34;fb-comments&#34; data-href=&#34;http://vikku.info/programming/&#34; data-num-posts=&#34;100&#34; data-width=&#34;500&#34;&#62;&#60;/div&#62; &#60;/div&#62; I was trying to set data-num-posts=&#8217;100%&#8217; which was not working. and then change the above to the following [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to set percentage width for facebook comments plugin.</p>
<p>I searched the web and i got the following information from stackoverflow.</p>
<p>What i previously had was the following</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fb-root&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fb-comments&quot;</span> data-<span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://vikku.info/programming/&quot;</span> data-num-posts<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;100&quot;</span> data-<span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;500&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>I was trying to set data-num-posts=&#8217;100%&#8217; which was not working. and then change the above to the following</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fb-root&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fb-comments&quot;</span> data-<span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://vikku.info/programming/&quot;</span> data-num-posts<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;100&quot;</span> data-<span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;500&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width: 100%;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>and then added the following style in the style section</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/* for facebook width 100% */
iframe.fb_ltr { width:90% !important; }</pre></div></div>

<p>That&#8217;s it. It is working. &#8230;</p>
<p style='color:red; font-weight:bold;'>
oh&#8230; after a few days of working with the above i added a like button. the above style affected the like button and i was wondering how to change the width to 100% without affecting the like button.<br />
Then got this from stackoverflow. So i placed only the following and removed the styles specified above.</p>
<p>remove  width=&#8221;100%&#8221; style=&#8221;width: 100%;&#8221; from &lt;fb:comments tag and add only the following in the style. voila it works.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.fb-comments, .fb-comments iframe[style] {width: 100% !important;}</pre></div></div>

<p>the above was used from this url <a href='http://stackoverflow.com/questions/7447483/how-to-make-facebook-comments-widget-a-fluid-width'>http://stackoverflow.com/questions/7447483/how-to-make-facebook-comments-widget-a-fluid-width</a></p>
<p><span style="text-decoration: underline;"><strong>References</strong></span></p>
<p><a href="http://stackoverflow.com/questions/5305685/facebook-comments-plugin">http://stackoverflow.com/questions/5305685/facebook-comments-plugin</a></p>
<p><a href="http://stackoverflow.com/questions/7447483/how-to-make-facebook-comments-widget-a-fluid-width">http://stackoverflow.com/questions/7447483/how-to-make-facebook-comments-widget-a-fluid-width</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vikku.info/codesnippets/facebook/facebook-comments-set-100-percent-width-for-facebook-comments/feed/</wfw:commentRss>
		</item>
		<item>
		<title>how to change or disable connection timeout in filezilla</title>
		<link>http://vikku.info/codesnippets/zcategory/how-to-change-or-disable-connection-timeout-in-filezilla/</link>
		<comments>http://vikku.info/codesnippets/zcategory/how-to-change-or-disable-connection-timeout-in-filezilla/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 07:11:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ZCategory]]></category>

		<guid isPermaLink="false">http://vikku.info/codesnippets/?p=252</guid>
		<description><![CDATA[Sometimes my server takes a long time to connect. When i used filezilla recently to update my files filezilla could not connect to my server. It says connection timed out. and i opened the settings Connection -> Under the Timeout option make it 0 to disable or you can give any number of seconds like [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes my server takes a long time to connect.<br />
When i used filezilla recently to update my files filezilla could not connect to my server.<br />
It says connection timed out.</p>
<p>and i opened the settings<br />
Connection -> Under the Timeout option<br />
make it 0 to disable<br />
or you can give any number of seconds like 30 seconds or 60 seconds.<br />
By default i think filezilla sets 20 seconds.</p>
<p>A screen shot to change the connection timeout in filezilla</p>
<p><img src="http://cdn.lts.cr/files/ebefcccf9fe1296ccb9a/filezilla-connection-timeout.png" alt="Filezilla change connection timeout" /></p>
]]></content:encoded>
			<wfw:commentRss>http://vikku.info/codesnippets/zcategory/how-to-change-or-disable-connection-timeout-in-filezilla/feed/</wfw:commentRss>
		</item>
		<item>
		<title>php set socket time out for fsockopen, set time out for fsockopen</title>
		<link>http://vikku.info/codesnippets/php-socket/php-set-socket-time-out-for-fsockopen-set-time-out-for-fsockopen/</link>
		<comments>http://vikku.info/codesnippets/php-socket/php-set-socket-time-out-for-fsockopen-set-time-out-for-fsockopen/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 11:21:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP Socket]]></category>

		<category><![CDATA[fsockopen-timeout]]></category>

		<category><![CDATA[php-socket-timeout]]></category>

		<category><![CDATA[set_time_out]]></category>

		<guid isPermaLink="false">http://vikku.info/codesnippets/?p=250</guid>
		<description><![CDATA[Sometimes if a target host is unreachable by a socket connection it takes 60 seconds to know that the socket function cannot connect to the destination. This is when i am using fsockopen function to connect to a remote host. So i was wondering there should be a function to timeout according to our preference [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes if a target host is unreachable by a socket connection it takes 60 seconds to know that the socket function cannot connect to the destination. This is when i am using fsockopen function to connect to a remote host. So i was wondering there should be a function to timeout according to our preference and found that stream_set_timeout could do that.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fsockopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;www.example.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">80</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;Unable to open<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;GET / HTTP/1.0<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">stream_set_timeout</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$res</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$info</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stream_get_meta_data</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'timed_out'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">echo</span> <span style="color: #0000ff;">'Connection timed out!'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">echo</span> <span style="color: #000088;">$res</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>where the second parameter of stream_set_timeout is in seconds.</p>
<p>&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://vikku.info/codesnippets/php-socket/php-set-socket-time-out-for-fsockopen-set-time-out-for-fsockopen/feed/</wfw:commentRss>
		</item>
		<item>
		<title>why javascript history.back() toggles between two pages</title>
		<link>http://vikku.info/codesnippets/javascript/why-javascript-historyback-toggles-between-two-pages/</link>
		<comments>http://vikku.info/codesnippets/javascript/why-javascript-historyback-toggles-between-two-pages/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 13:33:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://vikku.info/codesnippets/?p=246</guid>
		<description><![CDATA[I was working in a project where each page had a back button. Because of the designers design the back button was created using anchor tag &#60;a&#62; and as a programmer i thought of using the back button like the following in the anchor tag. &#60;a href='javascript:;' onclick='window.history.back()'&#62;Back&#60;/a&#62; But what had happened when i press [...]]]></description>
			<content:encoded><![CDATA[<p>I was working in a project where each page had a back button. Because of the designers design the back button was created using anchor tag &lt;a&gt; and as a programmer i thought of using the back button like the following in the anchor tag.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href='javascript:;' onclick='window.history.back()'&gt;Back&lt;/a&gt;</pre></div></div>

<p>But what had happened when i press the back button after navigating to various pages was i got locked between the last two navigated pages. It kept toggling between the last visited page and the previous page where as it is supposed to go backward step by step.</p>
<p>So let us say i have navigated from page 1 to 10 and now i am in page 10. When i press the back button in page 10 i came to page 9. But when i pressed the back button in page 9 again it took me to page 10 instead of taking me to page 8. So this keeps happening until i changed the code to the following.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href='javascript:window.history.back();'&gt;Back&lt;/a&gt;</pre></div></div>

<p>After modifying to the above code all went well. The back button press worked normal which took me from page 10 all the way to page 1 when i kept on pressing the back button.</p>
<p>and besides the given code there was a style applied to the anchor tag and that was just float right.</p>
<p>Is this an issue needed attention which is to be posted in a blog? I don&#8217;t think so but thought of talking to the people to see their responses. If people know why this peculiar behaviour then please post a note of a reply or a reference or whatever which could be of assistance to all people. <img src='http://vikku.info/codesnippets/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://vikku.info/codesnippets/javascript/why-javascript-historyback-toggles-between-two-pages/feed/</wfw:commentRss>
		</item>
		<item>
		<title>insert into tablea select fields from tableb for specific values only</title>
		<link>http://vikku.info/codesnippets/mysql/insert-into-tablea-select-fields-from-tableb-for-specific-values-only/</link>
		<comments>http://vikku.info/codesnippets/mysql/insert-into-tablea-select-fields-from-tableb-for-specific-values-only/#comments</comments>
		<pubDate>Fri, 06 May 2011 07:40:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://vikku.info/codesnippets/?p=240</guid>
		<description><![CDATA[While using insert into table select * from table there will be a problem that the total fields should match and the datatype should be same. But if there is table a and table b and you want to import table b&#8217;s few fields into table a then the above will not work and it [...]]]></description>
			<content:encoded><![CDATA[<p>While using insert into table select * from table there will be a problem that the total fields should match and the datatype should be same. But if there is table a and table b and you want to import table b&#8217;s few fields into table a then the above will not work and it will throw an error that total no of fields do not match.</p>
<p>So to import only specific fields then use the following sql in which only the needed fields are specified in the into part and the from part. so insert into table1 column names and select column names form table2.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">INSERT INTO tablename (some_column, somecolumn2)
SELECT othercolumn1, othercolumn2 FROM TABLE name WHERE id=somevalue</pre></div></div>

<p>the where clause is optional. </p>
<p><strong>Reference</strong><br />
<a href="http://stackoverflow.com/questions/4421807/sql-flavours-of-insert-into">http://stackoverflow.com/questions/4421807/sql-flavours-of-insert-into </a><br />
<a href="http://stackoverflow.com/questions/2470924/ignore-some-values-in-insert-into-select-from-sql-stament">http://stackoverflow.com/questions/2470924/ignore-some-values-in-insert-into-select-from-sql-stament</a><br />
Notes to be taken <a href="http://stackoverflow.com/questions/1787634/automatically-match-columns-in-insert-into-select-from">http://stackoverflow.com/questions/1787634/automatically-match-columns-in-insert-into-select-from</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://vikku.info/codesnippets/mysql/insert-into-tablea-select-fields-from-tableb-for-specific-values-only/feed/</wfw:commentRss>
		</item>
		<item>
		<title>US phone number validation by adding hypen automatically using javascript</title>
		<link>http://vikku.info/codesnippets/javascript/us-phone-number-validation-by-adding-hypen-automatically-using-javascript/</link>
		<comments>http://vikku.info/codesnippets/javascript/us-phone-number-validation-by-adding-hypen-automatically-using-javascript/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 13:50:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[javascript validation]]></category>

		<guid isPermaLink="false">http://vikku.info/codesnippets/?p=236</guid>
		<description><![CDATA[The following code will validate the US phone number format. It will not check for open and closing brackets. it will validate the following format xxx-xxx-xxxx. Besides it will not allow any other characters other than numbers and hypen to be typed. if any other character is typed in then it is removed using the [...]]]></description>
			<content:encoded><![CDATA[<p>The following code will validate the US phone number format. It will not check for open and closing brackets. it will validate the following format xxx-xxx-xxxx.</p>
<p>Besides it will not allow any other characters other than numbers and hypen to be typed. if any other character is typed in then it is removed using the regular expression in the script.</p>
<p>This script was created for an instant purpose and i may expand it so that will have full control on the keypress.</p>
<p>I have called a function whichkey to find the keycode which is a cross browser code. Each browser handles event differently so we need to find the char code number using a cross browser function and here that is whichkey.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">function</span> mask<span style="color: #009900;">&#40;</span>e<span style="color: #339933;">,</span>f<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> len <span style="color: #339933;">=</span> f.<span style="color: #660066;">value</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> key <span style="color: #339933;">=</span> whichKey<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>key<span style="color: #339933;">&gt;</span><span style="color: #CC0000;">47</span> <span style="color: #339933;">&amp;&amp;</span> key<span style="color: #339933;">&lt;</span><span style="color: #CC0000;">58</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> len<span style="color: #339933;">==</span><span style="color: #CC0000;">3</span> <span style="color: #009900;">&#41;</span>f.<span style="color: #660066;">value</span><span style="color: #339933;">=</span>f.<span style="color: #660066;">value</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'-'</span>
		<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>len<span style="color: #339933;">==</span><span style="color: #CC0000;">7</span> <span style="color: #009900;">&#41;</span>f.<span style="color: #660066;">value</span><span style="color: #339933;">=</span>f.<span style="color: #660066;">value</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'-'</span>
		<span style="color: #000066; font-weight: bold;">else</span> f.<span style="color: #660066;">value</span><span style="color: #339933;">=</span>f.<span style="color: #660066;">value</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
		f.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> f.<span style="color: #660066;">value</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[^0-9-]/</span><span style="color: #339933;">,</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>
		f.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> f.<span style="color: #660066;">value</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'--'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'-'</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> whichKey<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> code<span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>e<span style="color: #009900;">&#41;</span> <span style="color: #003366; font-weight: bold;">var</span> e <span style="color: #339933;">=</span> window.<span style="color: #660066;">event</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">keyCode</span><span style="color: #009900;">&#41;</span> code <span style="color: #339933;">=</span> e.<span style="color: #660066;">keyCode</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">which</span><span style="color: #009900;">&#41;</span> code <span style="color: #339933;">=</span> e.<span style="color: #660066;">which</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">return</span> code
<span style="color: #006600; font-style: italic;">//	return String.fromCharCode(code);</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;phone&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;phone&quot;</span> </span>
<span style="color: #009900;"><span style="color: #000066;">onkeydown</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mask(event,this)&quot;</span> <span style="color: #000066;">onkeyup</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mask(event,this)&quot;</span> </span>
<span style="color: #009900;"><span style="color: #000066;">maxlength</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;12&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>&#8230;.</p>
<p>with the above code you can add your own code to make it more useful to you. I had made a very simple attempt to do a validation.</p>
]]></content:encoded>
			<wfw:commentRss>http://vikku.info/codesnippets/javascript/us-phone-number-validation-by-adding-hypen-automatically-using-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ajax cross domain xmlhttprequest in firefox</title>
		<link>http://vikku.info/codesnippets/ajax/ajax-cross-domain-xmlhttprequest-in-firefox/</link>
		<comments>http://vikku.info/codesnippets/ajax/ajax-cross-domain-xmlhttprequest-in-firefox/#comments</comments>
		<pubDate>Sat, 27 Nov 2010 23:04:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Ajax]]></category>

		<guid isPermaLink="false">http://vikku.info/codesnippets/?p=227</guid>
		<description><![CDATA[I got this cross domain ajax script some where and found it is working. You can run this file just directly from your desktop. You don&#8217;t have to have the localhost. The code enables a kind of privilege. This worked in firefox and for internet explorer there is another method for their own use. copy [...]]]></description>
			<content:encoded><![CDATA[<p>I got this cross domain ajax script some where and found it is working. You can run this file just directly from your desktop. You don&#8217;t have to have the localhost. The code enables a kind of privilege. This worked in firefox and for internet explorer there is another method for their own use. copy paste the code as html and click the get button.</p>
<p>Besides&#8230; I would like to have objections if any and comments about this article so that i can update. It is not just an article but a public document to which people can provide info to testify this. Just like that. How the following will be in future</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Error: uncaught exception: Permission denied to call method XMLHttpRequest.open</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">var</span> http_request <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">function</span> makeRequest<span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span> parameters<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
    netscape.<span style="color: #660066;">security</span>.<span style="color: #660066;">PrivilegeManager</span>.<span style="color: #660066;">enablePrivilege</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;UniversalBrowserRead&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Permission UniversalBrowserRead denied.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
    http_request <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    http_request <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> XMLHttpRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>http_request.<span style="color: #660066;">overrideMimeType</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      http_request.<span style="color: #660066;">overrideMimeType</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'text/xml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>http_request<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Cannot create XMLHTTP instance'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    http_request.<span style="color: #660066;">onreadystatechange</span> <span style="color: #339933;">=</span> alertContents<span style="color: #339933;">;</span>
    http_request.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'GET'</span><span style="color: #339933;">,</span> url <span style="color: #339933;">+</span> parameters<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    http_request.<span style="color: #660066;">send</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">function</span> alertContents<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>http_request.<span style="color: #660066;">readyState</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>http_request.<span style="color: #000066;">status</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> string <span style="color: #339933;">=</span> http_request.<span style="color: #660066;">responseText</span><span style="color: #339933;">;</span>
      <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'There was a problem with the request.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #003366; font-weight: bold;">function</span> updateweather<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    makeRequest<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'http://www.wunderground.com/auto/rss_full/global/stations/16239.xml'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;GET XML&quot;</span> </span>
<span style="color: #009900;">  <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:updateweather();&quot;</span>&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://vikku.info/codesnippets/ajax/ajax-cross-domain-xmlhttprequest-in-firefox/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Microsoft Windows Network The network is not present or not started</title>
		<link>http://vikku.info/codesnippets/windows-tips/microsoft-windows-network-the-network-is-not-present-or-not-started/</link>
		<comments>http://vikku.info/codesnippets/windows-tips/microsoft-windows-network-the-network-is-not-present-or-not-started/#comments</comments>
		<pubDate>Fri, 26 Nov 2010 14:27:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Windows Tips]]></category>

		<guid isPermaLink="false">http://vikku.info/codesnippets/?p=225</guid>
		<description><![CDATA[Make sure that the cable is not loose. if possible check the network card. and if it is still so then you have to check the network service. Click start -> run -> type services.msc Locate Workstation. Which will be the last in the list of services. Make sure it is running else start the [...]]]></description>
			<content:encoded><![CDATA[<p>Make sure that the cable is not loose. if possible check the network card.<br />
and if it is still so then you have to check the network service.</p>
<p>Click start -> run -> type services.msc</p>
<p>Locate Workstation.</p>
<p>Which will be the last in the list of services.</p>
<p>Make sure it is running else start the service.</p>
<p>I am using kaspersky antivirus. When i close it sometimes it asks whether to close the open network connection and i use to give yes.</p>
<p>It closes gtalk and other open connection which i was not aware.</p>
<p>May be it would have stopped the network service also.</p>
<p>So when i checked using services.msc it has been stopped but not sure whether it is because of anti virus.</p>
<p>Anyway, i started it and i could browse the local area network computers.</p>
]]></content:encoded>
			<wfw:commentRss>http://vikku.info/codesnippets/windows-tips/microsoft-windows-network-the-network-is-not-present-or-not-started/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Matching newline in multiline text without using DOT but with an alternate char class</title>
		<link>http://vikku.info/codesnippets/regular-expression/matching-newline-in-multiline-text-without-using-dot-but-with-an-alternate-char-class/</link>
		<comments>http://vikku.info/codesnippets/regular-expression/matching-newline-in-multiline-text-without-using-dot-but-with-an-alternate-char-class/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 13:32:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Regular Expression]]></category>

		<guid isPermaLink="false">http://vikku.info/codesnippets/?p=219</guid>
		<description><![CDATA[The Character class \w matches any word character, and \W matches anything that isn&#8217;t a word character. So, [\w\W] matches anything, including a newline for example removing c style comments /\*[\w\W]*?\*/ another example is getting all text within a div &#60;div class=&#34;\&#38;quot;validtext_erea\&#38;quot;&#34;&#62;([\w\W]*?)&#38;lt;\/div&#38;gt;&#60;/div&#62; Usually we use it as (.*?) but this matches all characters except newline. [...]]]></description>
			<content:encoded><![CDATA[<p>The Character class \w matches any word character, and \W matches anything that isn&#8217;t a word character.</p>
<p>So, [\w\W] matches anything, including a newline</p>
<p>for example removing c style comments</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/\*[\w\W]*?\*/</pre></div></div>

<p>another example is getting all text within a div</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;\&amp;quot;validtext_erea\&amp;quot;&quot;</span>&gt;</span>([\w\W]*?)<span style="color: #ddbb00;">&amp;lt;</span>\/div<span style="color: #ddbb00;">&amp;gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Usually we use it as (.*?) but this matches all characters except newline.</p>
<p>So the alternate char class w is used to find all chars and non chars.</p>
<p>The question mark is used to include laziness because the * chars is greedy.</p>
<p><strong>Reference</strong><br />
<a href="http://www.adobe.com/devnet/dreamweaver/articles/regular_expressions_pt2.html">http://www.adobe.com/devnet/dreamweaver/articles/regular_expressions_pt2.html</a><br />
<strong>See this for more modifiers</strong><br />
<a href="http://www.regular-expressions.info/modifiers.html">http://www.regular-expressions.info/modifiers.html</a><br />
<strong>For a long time i have been looking for this</strong><br />
<a href="http://www.regular-expressions.info/dot.html">http://www.regular-expressions.info/dot.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vikku.info/codesnippets/regular-expression/matching-newline-in-multiline-text-without-using-dot-but-with-an-alternate-char-class/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

