<?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>PC Pro blog &#187; Programming</title>
	<atom:link href="http://www.pcpro.co.uk/blogs/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pcpro.co.uk/blogs</link>
	<description>Blogging in the real world</description>
	<lastBuildDate>Wed, 08 Feb 2012 16:54:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How do we make the public understand programming?</title>
		<link>http://www.pcpro.co.uk/blogs/2011/12/01/how-do-we-make-the-public-understand-programming/</link>
		<comments>http://www.pcpro.co.uk/blogs/2011/12/01/how-do-we-make-the-public-understand-programming/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 14:58:16 +0000</pubDate>
		<dc:creator>Steve Cassidy</dc:creator>
				<category><![CDATA[Real World Computing]]></category>
		<category><![CDATA[BBC]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.pcpro.co.uk/blogs/?p=45646</guid>
		<description><![CDATA[
In response to a recent survey telling us that schools are getting the teaching of Information Technology all wrong by not including &#8220;computer programs&#8221; in the syllabus, the BBC has offered up seven questions about computer programs. I urge you to take the quick quiz and then come back here when you&#8217;re done.
I scored five [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.pcpro.co.uk/blogs/wp-content/uploads/2011/12/Keyboard-fingers.jpg"><img class="aligncenter size-large wp-image-45652" title="Keyboard fingers" src="http://www.pcpro.co.uk/blogs/wp-content/uploads/2011/12/Keyboard-fingers-462x346.jpg" alt="Keyboard fingers" width="462" height="346" /></a></p>
<p>In response to a recent survey telling us that schools are getting the teaching of Information Technology all wrong by not including &#8220;computer programs&#8221; in the syllabus, the BBC has offered up <a title="BBC programming quiz " href="http://www.bbc.co.uk/news/magazine-15952227 " target="_blank">seven questions about computer programs</a>. I urge you to take the quick quiz and then come back here when you&#8217;re done.</p>
<p>I scored five out of seven. I don&#8217;t know the correct HTML for inserting an image, and I couldn&#8217;t work out which subset of acronyms the question with GNU in it was driving at, mainly because the preceding five questions were not about &#8220;computer programs&#8221; at all; they were about the history of the people who happened to be involved in the invention of programming, either as a general concept (Jaquard) or as an incredibly early implementation (Hopper and COBOL).</p>
<p><span id="more-45646"></span>I have to say &#8211; despite having earned a decent living for some time as a COBOL developer &#8211; I didn&#8217;t know Grace Hopper&#8217;s nickname and lucked out on that answer too, so really I should have scored a mere four. Knowing Admiral Hopper&#8217;s nickname wasn&#8217;t necessary to make my programs work or to earn me money, so I was in shameful ignorance, at least if you share the BBC&#8217;s perspective on the matter. To my mind, only two of the seven questions actually addressed the subject of the questionnaire.</p>
<blockquote><p>I don&#8217;t ask that the guy who changes the oil on my Mercedes knows who Emil Jellinek was, because it&#8217;s not a necessary piece of information for him to do a good job</p></blockquote>
<p>As you can probably guess, I regard this questionnaire as a terrible example of precisely the problem that the report is alluding to. Outside of the hallowed halls of hackerdom, almost nobody knows what size or shape the job of programming actually has, or how it should be thought about.</p>
<p>Of course, the &#8220;historian&#8217;s perspective&#8221; is one way to do it, but shouldn&#8217;t be confused with the artisan&#8217;s practical understanding of their tools. I don&#8217;t ask that the guy who changes the oil on my Mercedes knows who Emil Jellinek was, because it&#8217;s not a necessary piece of information for him to do a good job.</p>
<p>So the question rests with us: with the contributors and readers of <em>PC Pro</em>. Starting with readily available equipment (and personally I&#8217;d propose Free Pascal), what would you do to improve the comprehension of &#8220;programming&#8221;  - not only in schools, but in evidently confused and distant institutions such as the BBC?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pcpro.co.uk/blogs/2011/12/01/how-do-we-make-the-public-understand-programming/feed/</wfw:commentRss>
		<slash:comments>58</slash:comments>
		</item>
		<item>
		<title>How to keep the kids entertained during the summer holidays</title>
		<link>http://www.pcpro.co.uk/blogs/2009/07/25/how-to-keep-the-kids-entertained-during-the-summer-holidays/</link>
		<comments>http://www.pcpro.co.uk/blogs/2009/07/25/how-to-keep-the-kids-entertained-during-the-summer-holidays/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 10:07:54 +0000</pubDate>
		<dc:creator>Barry Collins</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[BBC Lincolnshire]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scratch]]></category>

		<guid isPermaLink="false">http://www.pcpro.co.uk/blogs/?p=6457</guid>
		<description><![CDATA[Typically, the heatwave of early summer has disappeared just in time for the school holidays. But if you&#8217;re scratching around for something to do with the kids on a rainy day why not try, well, Scratch.
Scratch is a brilliantly simple programming language designed for kids. Instead of relying on lines of intimidating code, it uses [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.pcpro.co.uk/blogs/wp-content/uploads/2009/07/pc-pro-scratch-game.jpg"><img class="alignleft size-medium wp-image-6460" title="pc-pro-scratch-game" src="http://www.pcpro.co.uk/blogs/wp-content/uploads/2009/07/pc-pro-scratch-game-300x224.jpg" alt="PC Pro Scratch game" width="300" height="224" /></a>Typically, the heatwave of early summer has disappeared just in time for the school holidays. But if you&#8217;re scratching around for something to do with the kids on a rainy day why not try, well, Scratch.</p>
<p>Scratch is a brilliantly simple programming language designed for kids. Instead of relying on lines of intimidating code, it uses a colourful, building-block style interface to introduce children to the basic computational concepts.</p>
<p>We&#8217;ve written a Scratch tutorial as part of our Give Your Kids the IT Edge feature in this month&#8217;s magazine (on sale now). Our tutorial shows you how to make your child the star of their very own computer game, in which they have to try and escape from a crab that keeps nipping at its toes. Your child does everything from programming the movements of the characters, to recording sound effects, to creating the scoreboard. Best of all, the software is completely free &#8211; just download it from the <a title="Scratch" href="http://scratch.mit.edu/" target="_blank"><strong>Scratch website</strong></a>.</p>
<p><span id="more-6457"></span></p>
<p>If you follow the instructions in the magazine, you should end up with something like the game below (click on the image to play):</p>
<p><a href="http://scratch.mit.edu/projects/bazac/621988"><img src="http://scratch.mit.edu/static/projects/bazac/621988_med.png" alt="Scratch Project" width="425" height="319" /></a></p>
<p>You press the arrow keys to move the child, and click on the green flag and red buttton to start and stop the game. If you turn up the volume, you&#8217;ll hear my appalling attempt to record my own sound effects when the crab nips the child (I am available for film work).</p>
<p>Our tutorial is really on a starting point. If you visit the <a title="Scratch" href="http://scratch.mit.edu/channel/recent" target="_blank"><strong>projects page on the Scratch website</strong></a><strong> </strong>you&#8217;ll find hundreds more examples of games and interactive stories that children have created with the software.</p>
<p><a href="http://www.pcpro.co.uk/blogs/wp-content/uploads/2009/07/pc-pro-cover-1791.jpg"><img class="alignright size-medium wp-image-6463" title="pc-pro-cover-1791" src="http://www.pcpro.co.uk/blogs/wp-content/uploads/2009/07/pc-pro-cover-1791-206x300.jpg" alt="PC Pro cover" width="206" height="300" /></a>Adults are even giving it a bash too. William Wright, a DJ with BBC Radio Lincolnshire read our tutorial and used it to design a <a title="BBC Lincolnshire" href="http://www.bbc.co.uk/lincolnshire/content/articles/2009/07/17/look_north_game_feature.shtml" target="_blank"><strong>tongue-in-cheek game starring presenters from his local television show, Look North</strong></a>. I&#8217;ll be on William&#8217;s show on Monday evening to talk about Scratch.</p>
<p>It&#8217;s not only computer games that children can code themselves. In this month&#8217;s magazine we show how children from ages 5 to 15 can create their own blogs, interactive quizzes and even code their own photo gallery in Javascript. I promise it will keep them entertained for hours.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pcpro.co.uk/blogs/2009/07/25/how-to-keep-the-kids-entertained-during-the-summer-holidays/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>When to use Stored Procedures</title>
		<link>http://www.pcpro.co.uk/blogs/2008/05/18/when-to-use-stored-procedures/</link>
		<comments>http://www.pcpro.co.uk/blogs/2008/05/18/when-to-use-stored-procedures/#comments</comments>
		<pubDate>Sun, 18 May 2008 20:35:05 +0000</pubDate>
		<dc:creator>Kevin Partner</dc:creator>
				<category><![CDATA[Real World Computing]]></category>
		<category><![CDATA[kevin partner]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[stored procedures]]></category>

		<guid isPermaLink="false">http://www.pcpro.co.uk/blogs/?p=699</guid>
		<description><![CDATA[Version 5 of MySQL added Stored Procedures and, as is often the case when you&#8217;ve been using earlier versions, I didn&#8217;t notice at all, until a client asked whether the site I&#8217;m building for him should be using this technique for interacting with a database. In this case, the answer is a resounding no since [...]]]></description>
			<content:encoded><![CDATA[<p>Version 5 of MySQL added Stored Procedures and, as is often the case when you&#8217;ve been using earlier versions, I didn&#8217;t notice at all, until a client asked whether the site I&#8217;m building for him should be using this technique for interacting with a database. In this case, the answer is a resounding <strong>no </strong>since it would add an unnecessary level of complexity to a site in which the MySQL queries rarely involve more than one table at a time.</p>
<p>So, when should they be used?</p>
<p><span id="more-699"></span></p>
<p>A Stored Procedure is, as its name suggests, a series of SQL statements saved for use later, sort of like an old fashioned .bat Batch file on steroids. They&#8217;re particularly useful where you have a complex sequence of actions that never changes: you can get it right once and then run it with much lower overheads in future.</p>
<p>I&#8217;ve also heard claims that Stored Procedures improve security against SQL Injection but it&#8217;s hard to see why where dynamic data is concerned and, after all, PHP includes <strong>mysql_real_escape_string</strong> which protects against this form of attack.</p>
<p>So, it seems to me that Stored Procedures would be useful for busy sites with repetitive actions (for example interfacing a shopping cart with a stock management system) but do they have uses for more typical web applications? Or would you suggest that they should be used for every SQL query?</p>
<p>I really don&#8217;t know where the line should be drawn: at the extremes it&#8217;s pretty clear but the line is extremely fuzzy. Any thoughts?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pcpro.co.uk/blogs/2008/05/18/when-to-use-stored-procedures/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>The joy of interfacing</title>
		<link>http://www.pcpro.co.uk/blogs/2008/04/24/the-joy-of-interfacing/</link>
		<comments>http://www.pcpro.co.uk/blogs/2008/04/24/the-joy-of-interfacing/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 17:21:54 +0000</pubDate>
		<dc:creator>David Fearon</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[BBC Micro]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Interfacing]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.pcpro.co.uk/blogs/2008/04/24/the-joy-of-interfacing/</guid>
		<description><![CDATA[
So anyway, get yourself into your time machine and set it for sometime around 1986. Once you get there, pop on your invisibility cloak, find someone who looks spoddy and follow them into the dining room. See that BBC Micro in the corner? Pop over and give the top a quick tug. Chances are it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.pcpro.co.uk/blogs/wp-content/uploads/2008/04/_mg_3579.jpg" alt="Prototype interfacing. Not pretty, but it works." height="302" width="428" /></p>
<p>So anyway, get yourself into your time machine and set it for sometime around 1986. Once you get there, pop on your invisibility cloak, find someone who looks spoddy and follow them into the dining room. See that BBC Micro in the corner? Pop over and give the top a quick tug. Chances are it&#8217;s not screwed down.</p>
<p>That&#8217;s because, in the old days, computers were for hobbyists with soldering irons, and they were forever taking the tops off to install new circuit boards they&#8217;d made.</p>
<p>Doesn&#8217;t happen much anymore, of course &#8211; you might pop the side off once a year to install a new graphics card, but most people wouldn&#8217;t consider actually building new hardware to go inside their computer. And for very good reason: the insides of a modern PC are massively more complex and to build an add-on part yourself that would actually be any use is more or less impossible.</p>
<p>Thing is though, designing and connecting your own hardware to a PC, while unlikely to win you admiring glances from the opposite sex, is bloody good fun. Fact. I&#8217;ve been tinkering with the whole area again for the past year or so &#8211; for reasons I may document at some point &#8211; and it turns out that there&#8217;s a massive array of components that are relatively easy to interface to a PC and do interesting things with.<span id="more-130"></span></p>
<p>So here&#8217;s what I&#8217;ve done: I&#8217;ve interfaced a <a href="http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&amp;nodeId=1335&amp;dDocName=en010532">Microchip MCP3202-C</a> analogue-to-digital converter IC to the parallel port of a PC. And <em>voila</em>, I can use the computer to directly measure any analogue voltage between 0 and 5 volts. In fact I can measure two lots of voltages since the 3202 is a dual-channel device.</p>
<p>Now, the ability to measure some voltage or other doesn&#8217;t sound terrifically interesting <em>per se.</em> But it is! Because there&#8217;s a vast array of sensors and transducers out there, which measure all sorts of fascinating things about the real world like temperature and pressure and position and humidity and <em>everything</em>. And guess what their output is? Yes! Very often these devices produce an analogue voltage, and very often it&#8217;s between 0 and 5V (since 5V is kind of a universal logic voltage).</p>
<p>It&#8217;s certainly not as easy as it used to be to connect your computer to the real world. The BBC Micro, for instance, was specifically designed for interfacing and you didn&#8217;t even need any external circuitry to measure analogue voltages &#8211; you just used the analogue input ports on the back and read the voltage directly from BASIC with the ADVAL statement.</p>
<p>To get my 3202 ADC chip talking to a PC, I first had to add a little bit more buffer circuitry, to get the anaemic voltage levels coming out of its parallel ports to look a bit cleaner. But that&#8217;s only a single logic chip, costing about 20p (the 3202 itself <a href="http://uk.farnell.com/1196794/semiconductors/product.us0?sku=MICROCHIP-MCP3202-CI-P">currently costs £2.25</a> from <a href="http://www.farnell.co.uk/">Farnell</a> if you&#8217;re only buying one or two).</p>
<p>Next, I abandoned Windows and installed <a href="http://fedoraproject.org/">Fedora Linux</a>. Why? Because Linux has the joy of a predictable, stable tool-chain for programming, and it comes with a C compiler and everything you need for programming. It&#8217;s a geek&#8217;s OS and it&#8217;s set up for geeks to tinker with straight away. And if everything you need isn&#8217;t there in your particular installation, chances are all you&#8217;ll need to do is issue a command something like this:</p>
<p style="font-family: courier,sans-serif">sudo apt-get install gcc</p>
<p>And off Linux will go, ferreting out the gcc C compiler and all the necessary extra components. Also, of course, it&#8217;s free. And I wouldn&#8217;t dream of installing Windows on a PC when I didn&#8217;t have the correct license.</p>
<p>With that done, I had to decide on a programming environment. Java is my language of choice &#8211; it&#8217;s the best language on the planet and those people who talk about its nightmarishly complex class libraries are all wrong, honest &#8211; so Sun&#8217;s brilliant (and free) <a href="http://www.netbeans.org/">Netbeans IDE</a> was the only sensible choice.</p>
<p>You may be seeing the problem looming. Java is a high-level language deliberately abstracted from the hardware it runs on, meaning that getting the low-level access I needed to interface with my ADC chip wasn&#8217;t going to happen with Java alone. That meant one thing: JNI, the <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jni/">Java Native Interface</a>, which allows you to write native C code and glue it to a Java method. That means fast, native access to the hardware combined with a lovely high-level language to write the graphical front-end for my app.</p>
<p>Only problem with JNI is that it&#8217;s hideous. I mean truly hideous. It&#8217;s badly implemented and appallingly documented and it took me a week of trial and error actually to mangle my C code for reading the ADC chip into a form that JNI could work with. But eventually I got there.</p>
<p>There&#8217;s nothing quite like getting really deeply into the binary operation of a chip. The 3202 IC uses a simple serial protocol called SPI to communicate with the outside world. So I had to sit down with <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/21034D.pdf">the datasheet</a> in hand and write a routine in C that would directly communicate with the chip in binary, by waggling the voltage level of three of the PC&#8217;s parallel-port pins between 0 and 5V. Fairly amazingly, once I&#8217;d sorted out the JNI thing it worked first time. My Java graphical front-end can get the voltage levels and display them any way I like, and the hardware can manage a sample rate of about 2,000 readings per second, if I happen to want to measure something that fast.</p>
<p>Not as easy as with a BBC Micro then, but here&#8217;s the thing: BBC Micros used to cost about a month&#8217;s wages, so the chances of dedicating one to measuring the temperature in the greenhouse were always going to be pretty slim. A little Mini-ITX motherboard &#8211; which is what I&#8217;m using for my project &#8211; is only about £100. That means you can use one as a hardware appliance and dedicate it to the task of measuring, well, whatever it is you want to measure. And it&#8217;s the matter of an evening or two&#8217;s work to configure a web server and write some code so that you can communicate with it from anywhere and see what it&#8217;s been getting up to.</p>
<p>All a little bit pointless? Well, maybe. Fun? Depends on your proclivities I suppose. But it makes me happy.</p>
<p>So, who wants a feature in PC Pro about how to do it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pcpro.co.uk/blogs/2008/04/24/the-joy-of-interfacing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

