<?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>Academe Computing</title>
	<atom:link href="http://academe.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://academe.co.uk</link>
	<description>Academe Computing - Web applications our speciality</description>
	<lastBuildDate>Mon, 06 Feb 2012 17:57:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>SugarCRM: Permissions issue importing updated records</title>
		<link>http://academe.co.uk/2012/02/sugarcrm-permissions-issue-importing-updated-records/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sugarcrm-permissions-issue-importing-updated-records</link>
		<comments>http://academe.co.uk/2012/02/sugarcrm-permissions-issue-importing-updated-records/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 17:56:58 +0000</pubDate>
		<dc:creator>acadadmin</dc:creator>
				<category><![CDATA[Data Migration]]></category>
		<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false">http://academe.co.uk/?p=208</guid>
		<description><![CDATA[I got this error while importing updated email addresses for existing contact records: The record could not be updated due to a permissions issue This happened for just ten records out of three thousand, and I was logged in as an administrator, so there should not have been any real privilege issues. The answer was [...]]]></description>
			<content:encoded><![CDATA[<p>I got this error while importing updated email addresses for existing contact records:</p>
<blockquote><p>The record could not be updated due to a permissions issue</p></blockquote>
<p>This happened for just ten records out of three thousand, and I was logged in as an administrator, so there should not have been any <em>real</em> privilege issues.</p>
<p>The answer was that the records being updated had been deleted in the CRM. SugarCRM was attempting to create new contact records with the IDs supplied, but the old deleted records were still there in the database, preventing the new records from being created.</p>
<p>&nbsp;</p>
<p><strong>The record could not be updated due to a permissions issue</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://academe.co.uk/2012/02/sugarcrm-permissions-issue-importing-updated-records/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SugarCRM: Importing multiple contact emails</title>
		<link>http://academe.co.uk/2012/02/sugarcrm-importing-multiple-contact-emails/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sugarcrm-importing-multiple-contact-emails</link>
		<comments>http://academe.co.uk/2012/02/sugarcrm-importing-multiple-contact-emails/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 17:48:22 +0000</pubDate>
		<dc:creator>acadadmin</dc:creator>
				<category><![CDATA[Data Migration]]></category>
		<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false">http://academe.co.uk/?p=205</guid>
		<description><![CDATA[When importing contacts from CSV data, you may want to import more than one email into a contact. The default SugarCRM CE supports the import of two email addresses: a primary email address and one tertiary email address. More can be added manually later. The primary email address is imported from column &#8220;Email Address&#8221; and [...]]]></description>
			<content:encoded><![CDATA[<p>When importing contacts from CSV data, you may want to import more than one email into a contact. The default SugarCRM CE supports the import of two email addresses: a primary email address and one tertiary email address. More can be added manually later.</p>
<p>The primary email address is imported from column &#8220;Email Address&#8221; and the tertiary email address is imported from column &#8220;Other Email&#8221;. The &#8220;Email Address&#8221; will be marked as the primary in SugarCRM.</p>
<p>It is important to note that when importing email addresses into existing contact records, i.e. when updating contacts with new emails, all existing emails are deleted from the contact records. So a contact may start with five email addresses, but importing one email address will replace all five and not simply add to the list. This is not ideal behaviour, and is something I would <em>hope</em> to see improved in future versions of SugarCRM.</p>
]]></content:encoded>
			<wfw:commentRss>http://academe.co.uk/2012/02/sugarcrm-importing-multiple-contact-emails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert GoToMeeting video files to another format</title>
		<link>http://academe.co.uk/2012/01/convert-gotomeeting-video-files-to-another-format/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=convert-gotomeeting-video-files-to-another-format</link>
		<comments>http://academe.co.uk/2012/01/convert-gotomeeting-video-files-to-another-format/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 10:36:59 +0000</pubDate>
		<dc:creator>acadadmin</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[Media]]></category>

		<guid isPermaLink="false">http://academe.co.uk/?p=193</guid>
		<description><![CDATA[Video files downloaded from GoToMeeting, GoToWebinar or similar services use a special codec in order to play them. On the plus side, the videos are well compressed and optimised for this kind of use, but on the downside, the codec is not a &#8220;standard Windows&#8221; codec that can be used by other players such as [...]]]></description>
			<content:encoded><![CDATA[<p>Video files downloaded from GoToMeeting, GoToWebinar or similar services use a special codec in order to play them. On the plus side, the videos are well compressed and optimised for this kind of use, but on the downside, the codec is not a &#8220;standard Windows&#8221; codec that can be used by other players such as Windows Media Player or VLC. This is a big problem when publishing the videos on a website, as it requires users to download and install proprietary software on their machine to play it. That is not a reasonable expectation for end users.</p>
<p>The videos can be converted to other formats, and the instructions for doing so are nicely documented here:</p>
<p><a href="http://www.any-video-converter.com/convert-g2m3-g2m4-codec-video-to-wmv-avi-mp4-flv.php" target="_blank">http://www.any-video-converter.com/convert-g2m3-g2m4-codec-video-to-wmv-avi-mp4-flv.php</a></p>
<p>Some things to note &#8211; because it does feel like some of those steps are a bit clunky &#8211; is the following:</p>
<ul>
<li>You <em>really do</em> have to copy the encoder, codec and video file to the root C:\ drive. It simply does not work in a sub-directory.</li>
<li>You <em>really cannot see</em> the progress. The conversion runs in the background, and the only way to know it is finished is to check when g2mtranscoder is finished running in the background.</li>
<li>The converted file is copied over the top of your original file, so make sure you are always dealing with a copy. The timestamp of the file will change when this happens, so that is a potential indicator that the process has finished.</li>
<li>Conversion time: for an hour-long video could take hours, or could take 30 seconds. I have seen the full range and have no idea what makes them so different. Perhaps there are different internal formats, <em>some</em> of which take a lot of effort for the machine to convert.</li>
<li>Remove all spaces from the file name. You would think you could just put the file name in quotes, but that simply does not work.</li>
<li>Sometimes the conversion does not work, so just check the log file to see why. Haha! What am I thinking? This process has been designed to be as hard to run as possible, so the proprietary software can be installed on as many machines as possible. When that kind of thing appears to be happening, I start to question what else that software does once installed.</li>
<li>Finally &#8211; and this one gets me every time &#8211; since the process is messing around with files on the C:\ root folder, it needs administration privileges. So <strong>make sure you run the command prompt &#8220;As Administrator&#8221;</strong>. This can&#8217;t be stressed enough. You get no errors, no warnings &#8211; simply an unconverted file.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://academe.co.uk/2012/01/convert-gotomeeting-video-files-to-another-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recovering Windows Password &#8211; Sticky Keys Technique</title>
		<link>http://academe.co.uk/2012/01/recovering-windows-password-sticky-keys-technique/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=recovering-windows-password-sticky-keys-technique</link>
		<comments>http://academe.co.uk/2012/01/recovering-windows-password-sticky-keys-technique/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 22:34:31 +0000</pubDate>
		<dc:creator>acadadmin</dc:creator>
				<category><![CDATA[PC Repair]]></category>

		<guid isPermaLink="false">http://academe.co.uk/?p=187</guid>
		<description><![CDATA[The &#8220;sticky keys&#8221; technique for resetting the password on a Windows system is described in many places around the web, but all tend to over-complicate the steps. I&#8217;m describing it here for my own reference, so I have a reminder of how it works. The technique basically provides access to a command prompt from the [...]]]></description>
			<content:encoded><![CDATA[<p>The &#8220;sticky keys&#8221; technique for resetting the password on a Windows system is described in many places around the web, but all tend to over-complicate the steps. I&#8217;m describing it here for my own reference, so I have a reminder of how it works.</p>
<p>The technique basically provides access to a command prompt from the Windows login page &#8211; the page right at the start with an icon for each user. This page appears to run with administrator privileges, so the command prompt can be used to reset any password of any user without knowing any further details.</p>
<p>The command prompt is invoked by moving cmd.exe into the place of the command that handles the &#8220;sticky keys&#8221; functionality in the login page.</p>
<p>The steps are:</p>
<ol>
<li>Rename c:\windows\system32\sethc.exe out of the way (to sethc-bak.exe for example).</li>
<li>Copy c:\windows\system32\cmd.exe to c:\windows\system32\sethc.exe</li>
<li>Boot up the PC to the account selection screen.</li>
<li>Press the shift key five times. This will bring up a command prompt window.</li>
<li>Reset the password at the command prompt: <strong>net user <em>your_user_name new_password</em></strong></li>
<li>Log in using the new password.</li>
<li>Remove c:\windows\system32\sethc.exe and restore the saved sethc-bak.exe</li>
</ol>
<p>The first step involves getting to the file system on the machine. If you just have one machine and Windows 7 install disks handy, then you can boot up the recovery console to a command prompt and rename the files from there.</p>
<p>You may not be able to do step 7 until after a reboot. You may not be able to remove sethd.exe while Windows is running, but you should be able to rename it to sethd-delete.exe or similar to make room to restore the original file.</p>
<p>When I&#8217;m recovering the passwords for a laptop, however, I find it easier to just slip the hard drive out and pop it into another machine by USB and rename and copy the files from Windows Explorer. One of these USB-to-SATA docking stations comes in very handy for doing that:</p>
<p><img class="alignnone size-medium wp-image-188" title="SATDOCK22U3S.Alarge" src="http://academe.co.uk/content/blogs.dir/1/files/2012/01/SATDOCK22U3S.Alarge-300x240.jpg" alt="" width="300" height="240" /></p>
<h2>Update</h2>
<p>Since posting this, I was given a Windows Vista machine to repair, with which to reset the password. I was unable to rename the files on removing the hard drive and mounting it on my Windows 7 laptop. Windows simply would not let be change anything in the <em>C:\Windows</em> folder, complaining about a security issue each time I tried.</p>
<p>In this instance it was necessary to enter the recovery console command prompt, which is pretty much a hidden feature.</p>
<p>To do this, boot from a Windows 7 CDROM then select &#8220;Repair Computer&#8221;. Once booted, you will be given the option  to restore from a previously saved version of Windows. Select that option. Ignore all the errors it gives you about no saved versions being available, but continue until you are able to &#8220;Cancel&#8221; the process. Once you hit Cancel, you will be presented with this menu:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-202" title="recovery-console-menu" src="http://academe.co.uk/content/blogs.dir/1/files/2012/01/recovery-console-menu.gif" alt="" width="485" height="362" /></p>
<p>Right at the bottom of the menu is the option to enter the command prompt, and that is where you can rename the system files to turn on the sticky keys hack.</p>
]]></content:encoded>
			<wfw:commentRss>http://academe.co.uk/2012/01/recovering-windows-password-sticky-keys-technique/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New WooCommerce site now live</title>
		<link>http://academe.co.uk/2012/01/new-woocommerce-site-now-live/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=new-woocommerce-site-now-live</link>
		<comments>http://academe.co.uk/2012/01/new-woocommerce-site-now-live/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 22:47:57 +0000</pubDate>
		<dc:creator>acadadmin</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://academe.co.uk/?p=178</guid>
		<description><![CDATA[The www.relaxtimeout.com website was launched over Christmas. It is my first foray into WooCommerce, the free WordPress e-commerce plugin from WooThemes. Although this free shop is designed to hook you into purchasing themes and plugins, it really is a complete product just as it is, and functions well out of the box. I wanted to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.relaxtimeout.com/"><img class="alignright  wp-image-183" title="Relax Timeout - About The CD - Relax Timeout" src="http://academe.co.uk/content/blogs.dir/1/files/2012/01/Relax-Timeout-About-The-CD-Relax-Timeout-161x300.png" alt="" width="161" height="300" /></a>The <a title="Relax Timeout" href="http://www.relaxtimeout.com/" target="_blank">www.relaxtimeout.com</a> website was launched over Christmas. It is my first foray into <a title="WooCommerce from WooThemes" href="http://www.woothemes.com/woocommerce/" target="_blank">WooCommerce</a>, the free WordPress e-commerce plugin from WooThemes.</p>
<p>Although this free shop is designed to hook you into purchasing themes and plugins, it really is a complete product just as it is, and functions well out of the box.</p>
<p>I wanted to offer downloadable MP3s as products on the shop, and hit a few snags with the download functionality. With a bit of work I managed to get that working, and fed it back to the WooCommerce developers, expecting some kind of argument about whether any fixes were needed. Within two days the fixes were all incorporated into WooCommerce (on github) along with a few additional suggestions, and will be in the next release. Now <em>that</em> is a product that is really going places <img src='http://academe.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>For those interested in the technical details, the issue concerned downloading large files using the <a title="mod_xsendfile project page" href="https://tn123.org/mod_xsendfile/" target="_blank">mod_xsendfile</a> module for Apache. First I needed to install the module onto the web server, which was a cinch using yum and <a href="http://pkgs.org/centos-4-rhel-4/rpmforge-x86_64/mod_xsendfile-0.9-1.el4.rf.x86_64.rpm.html" target="_blank">rpmforge</a>.</p>
<p>Now, what mod_xsendfile is supposed to do, is inspect outgoing pages and look for the X_SendFile header in the outgoing HTTP page. If it sees it, then it dumps the rest of the page, looks for a file that the X_SendFile header points at, then streams it out. It does this without tying up database connections, PHP processes, eating into memory etc.</p>
<p>Where it was failing for me, was a security feature of Apache. WooCommerce was passing full path of the file for streaming to mod_xsendfile, but the module was then treating that full path as an error, because some parts of the path sit outside the webs root. Now, it should not behave like this, as the file is still under the web root, and so the web process has full access to the file, but it simply wasn&#8217;t having it. I suspect the real problem lies in Apache, or assumptions that the module was making, but I couldn&#8217;t see a solution there.</p>
<p>The working fix was to ensure mod_xsendfile was passed only a <em>relative</em> path to the file for streaming, relative to the website entry point (index.php). This worked fine for me, and this is the fix that WooCommerce incorporated.</p>
<p>That aside, the one niggle I have for WooCommerce is its complexity. Now, I know e-commerce is not going to be simple to implement, but I was hoping for a theme that could easily be modified. This is probably more a reflection of the structure of WordPress, but it seems that the WordPress theme has lots of functionality absolutely necessary for proper formatting of the shop components, so the two are very closely coupled. It means the whole site &#8211; the shop area at least &#8211; must use a WooCommerce-enabled theme, and those themes are not easy to mound into your own style.</p>
<p>What I think would have worked better, for a developer at least, is to limit the commerce theme elements to standalone templates that insert shop elements into any theme of your choice. You can kind of run it like this now, but an awful lot of the shop functionality is missing if you don&#8217;t run it under an enabled theme with a tonne of functionality in it. I&#8217;m sure this situation will improve over time, having seen the rapid pace of development of this plugin.</p>
<p>The <em>Relax Timeout</em> site has been designed to sell just one relaxation CD, so does not have a large inventory at present, but it is still going to be a great test-bed to see how easy it is going to be to customise WooCommerce.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://academe.co.uk/2012/01/new-woocommerce-site-now-live/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kinamu Reporter &#8211; set datatypes for exporting</title>
		<link>http://academe.co.uk/2012/01/kinamu-reporter-set-datatypes-for-exporting/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=kinamu-reporter-set-datatypes-for-exporting</link>
		<comments>http://academe.co.uk/2012/01/kinamu-reporter-set-datatypes-for-exporting/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 15:03:16 +0000</pubDate>
		<dc:creator>acadadmin</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false">http://academe.co.uk/?p=174</guid>
		<description><![CDATA[Kinamu Reporter is a reporting tool for Sugar CRM. It supports basic reports and allows the data to be exported to Excel. The problem I was having was that some values stored in Sugar come out as numbers (integers). That was fine until the report was exported to Excel. Once Excel got the numbers, it [...]]]></description>
			<content:encoded><![CDATA[<p>Kinamu Reporter is a reporting tool for Sugar CRM. It supports basic reports and allows the data to be exported to Excel.</p>
<p>The problem I was having was that some values stored in Sugar come out as numbers (integers). That was fine until the report was exported to Excel. Once Excel got the numbers, it automatically added two decimal places and commas. So the year 2012 was being displayed in Excel like this:</p>
<pre>  2,012.00</pre>
<p>&nbsp;</p>
<p>That does not exactly look like a year!</p>
<p>The solution is to tell Kinamu what datatype the column should be exported as. The export process then handles it nicely by telling Excel which values should be treated as string and not reformated. The &#8220;custom function&#8221; column in Kinamu Reporter allows me to do this.</p>
<p>To take a numeric value, but output it to Excel as a string, just enter this into the &#8220;custom function&#8221; column in the report editor:</p>
<pre>  CAST($ AS CHAR)</pre>
<p>&nbsp;</p>
<p>That&#8217;s it. The output value will be cast to a string, exported into the CSV as a quoted string, and then interpreted as a string by Excel, avoiding some of the reformating issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://academe.co.uk/2012/01/kinamu-reporter-set-datatypes-for-exporting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Virgin Broadband MySQL Connection Proxy</title>
		<link>http://academe.co.uk/2011/12/virgin-broadband-mysql-connection-proxy/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=virgin-broadband-mysql-connection-proxy</link>
		<comments>http://academe.co.uk/2011/12/virgin-broadband-mysql-connection-proxy/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 00:28:35 +0000</pubDate>
		<dc:creator>acadadmin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://academe.co.uk/?p=153</guid>
		<description><![CDATA[This one had me scratching my head for a while. I was attempting to access a MySQL database through my home broadband service. The MySQL database had a control panel where remote IP addresses that can access it could be entered. My broadband IP address was there, but I still could not connect to the [...]]]></description>
			<content:encoded><![CDATA[<p>This one had me scratching my head for a while.</p>
<p>I was attempting to access a MySQL database through my home broadband service. The MySQL database had a control panel where remote IP addresses that can access it could be entered. My broadband IP address was there, but I still could not connect to the database.</p>
<p>Checking the error message the database threw back on each connection attempt, it listed a Virgin domain which I did not recognise. Normally the domain that points to a broadband connection includes the IP address in the name, but this one did not.</p>
<p>So pinging that domain, I realise it is *not* my broadband IP address. I add that IP to the list of allowable IPs that can connect to the database, and it immediately lets me in. Very strange.</p>
<p>So what appears to be happening is that when I connect my laptop at home directly to a MySQL database, over the standard port 3306, some kind of proxy at Virgin is catching the connection and making it appear to the end machine like I am in a completely different IP network. I have no idea why they would do this, or how often that IP is going to change.</p>
<p>&#8212;&#8212;</p>
<p>I&#8217;ve noticed there are quite a few recent reports of MySQL connections mysteriously being dropped when using Virgin Cable. I wonder if this proxy has something to do with it?</p>
]]></content:encoded>
			<wfw:commentRss>http://academe.co.uk/2011/12/virgin-broadband-mysql-connection-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jasper Reports overview</title>
		<link>http://academe.co.uk/2011/12/jasper-reports-overview/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jasper-reports-overview</link>
		<comments>http://academe.co.uk/2011/12/jasper-reports-overview/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 15:30:11 +0000</pubDate>
		<dc:creator>acadadmin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://academe.co.uk/?p=149</guid>
		<description><![CDATA[Having scratched my head over how all the parts fit together in a new Jasper reporting system for SugarCRM, I finally came across this article: http://jasperforge.org/uploads/publish/ireportwebsite/IR%20Website/ir_getting_started.html The first couple of paragraphs explained what all the parts are, in a way that the deliverer of the system simply could not. Jasper Reports is the central report [...]]]></description>
			<content:encoded><![CDATA[<p>Having scratched my head over how all the parts fit together in a new Jasper reporting system for SugarCRM, I finally came across this article:</p>
<p>http://jasperforge.org/uploads/publish/ireportwebsite/IR%20Website/ir_getting_started.html</p>
<p>The first couple of paragraphs explained what all the parts are, in a way that the deliverer of the system simply could not.</p>
<p><em>Jasper Reports</em> is the central report generating engine. It is designed to be embedded inside an application.</p>
<p>If you don&#8217;t have a Java application to embed <em>Jasper Reports</em> in, then you can use Jasper Server to provide a wrapper for you. This wrapper provides the framework to run the report in, and a repository for any resources the report may need (database connection details, images, etc).</p>
<p>Jasper Reports provides a web front end for end users, and also provides an API for web applications. One web application is SugarCRM, and the <em>Zucker4Jasper</em> plugin provides that bridge.</p>
<p>Finally you will want to create reports. <em>iReport</em> is the Java application for doing this. It looks very comprehensive, even if a bit kludgey to use (I find I can never seem to get to the window I want by following the same navigation path twice &#8211; context seems to keep jumping all over the place). It is just something to learn.</p>
]]></content:encoded>
			<wfw:commentRss>http://academe.co.uk/2011/12/jasper-reports-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>git mv &#8220;permission denied&#8221;</title>
		<link>http://academe.co.uk/2011/12/git-mv-permission-denied/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=git-mv-permission-denied</link>
		<comments>http://academe.co.uk/2011/12/git-mv-permission-denied/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 11:30:45 +0000</pubDate>
		<dc:creator>acadadmin</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://academe.co.uk/?p=143</guid>
		<description><![CDATA[Running git command line under Windows 7, I was finding that &#8220;git mv&#8221; to move a directory to a new location was not working. Some folders would move, and some would not, giving me this error instead: $ cd foo $ git mv my_folder new_parent_folder/ fatal: renaming 'foo/my_folder' failed: Permission denied &#160; I noticed that [...]]]></description>
			<content:encoded><![CDATA[<p>Running git command line under Windows 7, I was finding that &#8220;git mv&#8221; to move a directory to a new location was not working. Some folders would move, and some would not, giving me this error instead:</p>
<pre class="brush:shell">$ cd foo
$ git mv my_folder new_parent_folder/
fatal: renaming 'foo/my_folder' failed: Permission denied</pre>
<p>&nbsp;</p>
<p>I noticed that the folders which would not move were folders where I had already changed a file and committed to git and even pushed back up to the repository server (gitgub). It turned out that <em>something</em> had a lock on the folders that I was trying to move. Closing the git bash shell made no difference. Closing all editors and Explorer sessions made no difference.</p>
<p>The only thing that fixed this was to kill the Explorer process from the Windows process manager. Luckily in Windows 7 this is fairly easy, and it can be restarted without losing open applications and working files. But why is it necessary to do this, and is there something less severe that can be done to release those locks? No idea yet, but I&#8217;ll keep looking and am open to suggestions. I have a workaround in the meantime, even if it does involve giving Windows a kick in the teeth to get it to behave.</p>
<p><span id="more-143"></span>Just as an aside, whenever I am moving anything into a new folder, I always put the &#8216;/&#8217; on the end of the destination folder. This avoids accidentally renaming the files if the destination folder is misspelled or happens not to be a folder after all. This has saved my bacon a number of times.</p>
]]></content:encoded>
			<wfw:commentRss>http://academe.co.uk/2011/12/git-mv-permission-denied/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL &#8211; finding counts of data by columns</title>
		<link>http://academe.co.uk/2011/08/mysql-finding-counts-of-data-by-columns/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-finding-counts-of-data-by-columns</link>
		<comments>http://academe.co.uk/2011/08/mysql-finding-counts-of-data-by-columns/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 11:46:04 +0000</pubDate>
		<dc:creator>acadadmin</dc:creator>
				<category><![CDATA[Data Migration]]></category>

		<guid isPermaLink="false">http://academe.co.uk/?p=126</guid>
		<description><![CDATA[Okay, the title may not be clear, but this is basically what I was trying to do, and I present here the script that achieved it. During a data migration of a legacy Access database (actually, nine Access databases) to Sugar CRM, I wanted to be able to find any data that was missing. Looking [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, the title may not be clear, but this is basically what I was trying to do, and I present here the script that achieved it.</p>
<p>During a data migration of a legacy Access database (actually, nine Access databases) to Sugar CRM, I wanted to be able to find any data that was missing. Looking at the numbers of rows migrated is only half the story.</p>
<p>Because the source data was spread over so many different databases, there was a complex set of mapping rules, to map the old database columns onto the new database. This was not a simple column to column mapping &#8211; some recoreds split out into multiple records. Some columns became flags in other tables or reference links between two tables. Due to this complexity, some source tables did not get mapped properly, so some columns were not complete. This left me with, for example, all the postal codes from databases 1 to 5, but no postal codes from databases 6 to 9. Trying to find these was proving a pain.</p>
<p>The script I came up with in the end, with some help from the fine people at <a href="http://stackoverflow.com/questions/7217869/counting-non-empty-values-in-each-column-of-a-table">Stack Overflow</a>, can be downloaded below. It is a PHP5 script, is not complicated and hopefully not obscure in any way.</p>
<p>The script will loop through each table, then look through each column in each table and report the number of rows for which that column contains some data. The output is a simple HTML table for each MySQL table.</p>
<p>I hope it is useful. Have fun with it!</p>
<pre class="brush:php">&lt;?php

// Author: Jason Judge &lt;jason.judge@academe.co.uk&gt;
// Date: August 2011
// Script: PHP5 with PDO.
// Purpose: to list the counts of non-NULL and non-empty string columns
// on a list of tables. It basically tells us how much data there is in
// each column. If the primary key column is included, then that tells us
// the total number of rows in that table, for comparison.
// Licence: GPL2.0

class table {

    // DB login criteria.
    public $db_host = 'localhost';
    public $db_name = 'database-name';
    public $db_user = 'user-name';
    public $db_pass = 'user-password';

    // A list of all the tables that we would like to look through.
    // These are the main tables in a SugarCRM migration.
    public $all_tables = array(
        'accounts',
        'accounts_cstm',
        'contacts',
        'contacts_cstm',
        'sw_airports',
        'sw_airports_cstm',
        'sw_bookings',
        'sw_bookings_cstm',
        'sw_expedition',
        'sw_expedition_cstm',
    );

    // Any columns we are not interested in.
    // These will be excluded across all the tables.
    public $skip_columns = array(
        //'id',
        //'id_c',
        'date_entered',
        'date_modified',
        'modified_user_id',
        'created_by',
        'assigned_user_id',
    );

    function main() {
        // Connect to database
        $db = new PDO('mysql:host='.$this-&gt;db_host.';dbname='.$this-&gt;db_name.';charset=UTF8', $this-&gt;db_user, $this-&gt;db_pass);
        $db-&gt;setAttribute(PDO::ATTR_EMULATE_PREPARES, false);

        echo '&lt;html&gt;&lt;body&gt;';

        // Loop for each table.
        foreach($this-&gt;all_tables as $table) {
            echo "&lt;h1&gt;Table: $table&lt;/h1&gt;";

            // Get the list of columns in the table.
            $sql = 'SELECT column_name FROM information_schema.columns where TABLE_NAME = :table';

            $stmt = $db-&gt;prepare($sql);
            if (!$stmt) print_r($db-&gt;errorInfo());

            $stmt-&gt;bindParam(':table', $table, PDO::PARAM_STR);
            $stmt-&gt;execute();

            // Fetch the column names into an array.
            // PDO may have a short-cut for this, but I'm new to PDO.
            $columns = array();
            while ($row = $stmt-&gt;fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT)) {
                $columns[] = ($row['column_name']);
            }

            echo '&lt;table&gt;';

            // Loop for each column in the table.
            foreach($columns as $column) {
                // Skip any columns in our skip-list.
                if (in_array($column, $this-&gt;skip_columns)) continue;

                // Write out a table row for each column.
                echo '&lt;tr&gt;';

                    // Fetch the count of rows that match our not-empty criteria in
                    // the table.
                    $sql = 'SELECT COUNT(*) AS not_empty FROM ' . $table
                        . ' WHERE ' . $column . ' IS NOT NULL AND ' . $column . ' &lt;&gt; \'\'';

                    $stmt = $db-&gt;prepare($sql);
                    if (!$stmt) print_r($db-&gt;errorInfo());

                    $stmt-&gt;execute();

                    $row = $stmt-&gt;fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT);

                    // Display the table cells: teh column name and the number of not-empty rows.
                    echo "&lt;td&gt;$column&lt;/td&gt;";
                    echo "&lt;td&gt;" . $row['not_empty'] . '&lt;/td&gt;';

                echo '&lt;/tr&gt;';
            }
            echo '&lt;/table&gt;';
        }

        echo '&lt;/body&gt;&lt;/html&gt;';
    }

}

$table = new table();
$table-&gt;main();</pre>
]]></content:encoded>
			<wfw:commentRss>http://academe.co.uk/2011/08/mysql-finding-counts-of-data-by-columns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

