<?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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ask Owen &#187; coding</title>
	<atom:link href="http://askowen.info/tag/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://askowen.info</link>
	<description>Your friendly neighbourhood geek</description>
	<lastBuildDate>Wed, 16 May 2012 21:58:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How do I use onMouseOver in Javascript?</title>
		<link>http://askowen.info/2008/07/how-do-i-use-onmouseover-in-javascript/</link>
		<comments>http://askowen.info/2008/07/how-do-i-use-onmouseover-in-javascript/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 15:00:33 +0000</pubDate>
		<dc:creator>Owen</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[onMouseOver]]></category>

		<guid isPermaLink="false">http://askowen.info/?p=232</guid>
		<description><![CDATA[I want an image on my website to change when I hover my mouse over it. How do I do this? I got this question from a friend who like to dabble with HTML but isn&#8217;t too much f an expert. He saw this effect on a button on a travel insurance website was trying [...]]]></description>
			<content:encoded><![CDATA[<p class="question">I want an image on my website to change when I hover my mouse over it. How do I do this?</p>
<p><span id="more-232"></span><br />
I got this question from a friend who like to dabble with HTML but isn&#8217;t too much f an expert. He saw this effect on a button on a <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.worldtravelcenter.com%2F&sref=rss">travel insurance</a> website was trying to produce something similar. Well, you cannot implement this with plain HTML, but need to delve into <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FJavaScript&sref=rss">Javascript</a> and use a function called <strong>onMouseOver</strong>. This function is triggered when the mouse runs over a certain element on your page. It also has a corresponding sister function called <strong>onMouseOut</strong> which is called when you move your mouse away from the element in question. It&#8217;s important to use both functions otherwise your image won&#8217;t revert back to the original when the mouse moves away.</p>
<p>So, here&#8217;s the code that lets you do this:<br />
<code>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;script type="text/javascript"&gt;<br />
function mouseOver() {<br />
document.b1.src ="image2.jpg";<br />
}<br />
function mouseOut() {<br />
document.b1.src ="image1.jpg";<br />
}<br />
&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;a href="http://askowen.info" target="_blank" onmouseover="mouseOver()" onmouseout="mouseOut()"&gt;<br />
&lt;img border="0" alt="Ask Owen" src="image1.jpg" name="b1" /&gt;&lt;/a&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</code><br />
And here&#8217;s what it looks like:<br />
<script type="text/javascript" src="http://askowen.info/wp-content/uploads/2008/07/omo.js"></script><br />
<center><img src="http://askowen.info/wp-content/uploads/2008/07/webcam1.jpg" alt="" name="b1" title="webcam1" width="160" height="120" onmouseover="mouseOver()" onmouseout="mouseOut()"/></center></p>
<p>I haven&#8217;t actually linked the image to anything, but you get the idea <img src='http://askowen.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://askowen.info/2008/07/how-do-i-use-onmouseover-in-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How can I upload an automatically resize an image on my website?</title>
		<link>http://askowen.info/2008/06/how-can-i-upload-an-automatically-resize-an-image-on-my-website/</link>
		<comments>http://askowen.info/2008/06/how-can-i-upload-an-automatically-resize-an-image-on-my-website/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 13:59:18 +0000</pubDate>
		<dc:creator>Owen</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[GD library]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://askowen.info/?p=186</guid>
		<description><![CDATA[I often need to upload images to my website, but I&#8217;d like them to be automatically resized when they&#8217;re uploaded. How can I do this?? I got this question from from a colleague of mine who was answering some questions for a client. His client&#8217;s requirements were a bit more complex than just this question, [...]]]></description>
			<content:encoded><![CDATA[<p class="question">I often need to upload images to my website, but I&#8217;d like them to be automatically resized when they&#8217;re uploaded. How can I do this??</p>
<p><span id="more-186"></span><br />
I got this question from from a colleague of mine who was answering some questions for a client. His client&#8217;s requirements were a bit more complex than just this question, but I thought this would be a good one to put up on <a href="http://askowen.info">AskOwen</a> and use it as a tutorial for some interesting PHP techniques. Here&#8217;s some <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPHP&sref=rss">PHP</a> code that will accomplish the request:</p>
<p><code><br />
&lt;?php<br />
// Image uploaded and resizer<br />
// from http://AskOwen.info<br />
?&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;Image Uploader and Resizer&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;?php<br />
if (array_key_exists('btn', $_POST)) {<br />
$uploadedfile = $_FILES['uploadfile']['tmp_name'];<br />
$src = imagecreatefromjpeg($uploadedfile);<br />
list($width,$height)=getimagesize($uploadedfile);<br />
$newwidth=600;<br />
$newheight=($height/$width)*600;<br />
$tmp=imagecreatetruecolor($newwidth,$newheight);<br />
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);<br />
$filename = "images/". $_FILES['uploadfile']['name'];<br />
imagejpeg($tmp,$filename,100);<br />
imagedestroy($src);<br />
imagedestroy($tmp);<br />
}<br />
?&gt;<br />
&lt;form action="upload.php" method="post" enctype="multipart/form-data" &gt;<br />
&lt;input type="file" name="uploadfile"/&gt;<br />
&lt;input id="btn" name="btn" type="submit"/&gt;<br />
&lt;/body&gt;<br />
</code></p>
<p>Here&#8217;s a quick run through the algorithm:</p>
<ol>
<li>Pick up the file that has been uploaded by the form</li>
<li>Get the images width and height</li>
<li>Calculate the correct height to maintain the aspect ratio of the image</li>
<li>Create a memory space for the new image</li>
<li>Use <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fus2.php.net%2Fimagecopyresampled&sref=rss">imagecopyresampled</a>, a PHP function that resizes the image for you, to generate the new image</li>
<li>Write the file to disk</li>
<li>Clean up memory space</li>
</ol>
<p>It&#8217;s quite straight forward once you know that PHP has the graphical functions you need to accomplish this.  It&#8217;s worth nothing that there&#8217;s another PHP function that can resize an image for you also, called <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fus2.php.net%2Fmanual%2Fen%2Ffunction.imagecopyresized.php&sref=rss">imagecopyresized</a>, however this function only uses 255 colours to generate the target image and so doesn&#8217;t maintain the fidelity of the image so well. This may be fine if you have some line art you&#8217;re converting, but if you wanted to resize that beautiful photo you took last time you went on holiday and stayed at one of the <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.destinationvacationhhi.com%2F&sref=rss">Hilton Head rentals</a> you hear so much about, well, you really want as clear an image as possible.</p>
<p>As I said above, this is just the bare bones of an image resizing script, but it illustrates some of the graphical functions that <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fus.php.net%2F&sref=rss">PHP</a> has available (through the <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.boutell.com%2Fgd%2F&sref=rss">GD library</a>) that can help you produce some really useful scripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://askowen.info/2008/06/how-can-i-upload-an-automatically-resize-an-image-on-my-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning ASP.Net</title>
		<link>http://askowen.info/2007/10/learning-aspnet/</link>
		<comments>http://askowen.info/2007/10/learning-aspnet/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 10:11:11 +0000</pubDate>
		<dc:creator>Owen</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[learning]]></category>

		<guid isPermaLink="false">http://askowen.info/?p=29</guid>
		<description><![CDATA[I&#8217;d love to learn how to code in ASP.Net. Where&#8217;s a good place to learn? There are many ways you can learn how to code, but it&#8217;s usually easier for people who have programming in the past. ASP.Net is an interesting language in that there are a number of tools available in the language to [...]]]></description>
			<content:encoded><![CDATA[<p class="question">I&#8217;d love to learn how to code in ASP.Net. Where&#8217;s a good place to learn?</p>
<p><span id="more-29"></span><br />
There are many ways you can learn how to code, but it&#8217;s usually easier for people who have programming in the past. ASP.Net is an interesting language in that there are a number of tools available in the language to help accelerate your development, however, there&#8217;s also a pretty steep learning curve compared to simpler third-generation languages.</p>
<p>If you&#8217;re so inclined, there a number of books you can use to help you can started. Here are some you can get from Amazon:<br />
<SCRIPT charset="utf-8" type="text/javascript" src="http://ws.amazon.co.uk/widgets/q?ServiceVersion=20070822&#038;MarketPlace=GB&#038;ID=V20070822/GB/ughsgreymhone-21/8001/bef11009-8bfb-4af1-9c02-50eb3fb9ec2c"> </SCRIPT> <NOSCRIPT><A href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fws.amazon.co.uk%2Fwidgets%2Fq%3FServiceVersion%3D20070822%26%23038%3BMarketPlace%3DGB%26%23038%3BID%3DV20070822%252FGB%252Fughsgreymhone-21%252F8001%252Fbef11009-8bfb-4af1-9c02-50eb3fb9ec2c%26%23038%3BOperation%3DNoScript&sref=rss">Amazon.co.uk Widgets</A></NOSCRIPT></p>
<p>Another option is to watch videos that walk you through the basics. There are a number of these available online, but there&#8217;s a pretty comprehensive collection <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fwww.asp.net%2Flearn%2Fvideos%2Fdefault.aspx&sref=rss">down at the official ASP.net website</a>. The videos are divided into three sections:</p>
<ul>
<li> Videos for ASP.NET 2.0 Beginners</li>
<li> â€œHow Do I?â€ with ASP.NET</li>
<li> Videos on Migrating to ASP.NET</li>
</ul>
<p>That should be plenty to get you started. Remember, the main thing with code is that the more you practice, the more you learn and the better you get. So don&#8217;t be afraid to try out new things and see how far you can get. If you get stuck, there are plenty of <a href="http://redirectingat.com?id=8352X670472&xs=1&url=http%3A%2F%2Fforums.asp.net%2F&sref=rss">forums</a> you can ask for help.</p>
]]></content:encoded>
			<wfw:commentRss>http://askowen.info/2007/10/learning-aspnet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

