
<?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>Programming &#8211; Mark&#039;s Website</title>
	<atom:link href="https://kram.nz/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>https://kram.nz</link>
	<description>Solution Architect - Healthcare IT</description>
	<lastBuildDate>Tue, 06 Jun 2023 09:42:17 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>

<image>
	<url>https://kram.nz/wp-content/uploads/2016/04/cropped-M-32x32.png</url>
	<title>Programming &#8211; Mark&#039;s Website</title>
	<link>https://kram.nz</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>NHI Validation</title>
		<link>https://kram.nz/2019/02/nhi-validation/</link>
					<comments>https://kram.nz/2019/02/nhi-validation/#respond</comments>
		
		<dc:creator><![CDATA[M]]></dc:creator>
		<pubDate>Wed, 20 Feb 2019 11:01:10 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Healthcare]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[NHI]]></category>
		<category><![CDATA[NHI Generator]]></category>
		<category><![CDATA[NHI Validator]]></category>
		<guid isPermaLink="false">https://kram.nz/?p=433</guid>

					<description><![CDATA[Here is a National Health Index (NHI) validator and generator that I created. NHIs are healthcare identifiers used in New Zealand[1][2][3]. NHI Validator NHI: Generate NHIs Generate random NHIs Generate The current Id. structure only allows for around 13.8 million NHI's. With a population of around 5 million in 2019 and the possibility of a [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Here is a National Health Index (NHI) validator and generator that I created. NHIs are healthcare identifiers used in New Zealand<a class="reflink" href="#ref-nhi-wiki">[1]</a><a class="reflink" href="#ref-nhi-gov">[2]</a><a class="reflink" href="#ref-nhi-midcentral">[3]</a>.</p>



<form id="nhi-validator"> <fieldset> <legend>NHI Validator</legend> <div><label for="nhinumberfield">NHI:</label> <input id="nhinumberfield" type="text" maxlength="7" placeholder="ABC1234" pattern="[A-HJ-NP-Z]{3}\d{4}" onload="validateNhi(this)" onkeydown="validateNhi(this)" title="Three letters (without I or O) and 4 numbers" required="" autofocus=""> </div><div id="validation-result"></div> </fieldset></form><form id="nhi-generator"> <fieldset> <legend>Generate NHIs</legend> <p>Generate random NHIs</p> <button name="generate-nhi-button" type="button" onclick="generateNhis(this)">Generate</button> <ul id="generated-nhis"></ul> </fieldset></form><script>function generateNhis(){for(var e=document.getElementById("generated-nhis");e.hasChildNodes();){e.removeChild(e.lastChild)}for(var t=0;t<20;t+=1){var n=document.createElement("li"),a=document.createTextNode(generateRandomNhi());n.appendChild(a),e.appendChild(n)}}function generateRandomNhi(){for(var e="",t=0;t<6;t+=1){e+=t<3?randomNhiCharacter():getRandomInteger(0,10)}return e+=generateChecksum(e)}function getRandomInteger(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e))+e}function randomNhiCharacter(){var e=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z"];return e[getRandomInteger(0,e.length)]}function validateNhi(e){setTimeout(function(){e.value=cleanNHI(e.value),7==e.value.length&#038;&#038;validateChecksum(e.value)?(e.setCustomValidity(""),document.getElementById("validation-result").innerHTML="This is a valid NHI!"):(e.setCustomValidity("Invalid NHI"),proposePossibleNhis(e.value))},1)}function proposePossibleNhis(invalidNhi){var ul=document.createElement("ul");if(invalidNhi.length==7){for(var index=0;index<7;index+=1){var alternativeNhi=findValidNhiAt(invalidNhi,index);if(alternativeNhi){var n=document.createElement("li");var a=document.createTextNode(alternativeNhi);n.appendChild(a);ul.appendChild(n)}}}var resultNode=document.getElementById("validation-result");for(;resultNode.hasChildNodes();){resultNode.removeChild(resultNode.lastChild)}var message=document.createElement("p");message.appendChild(document.createTextNode("Could it be one of the following?"));resultNode.appendChild(message);resultNode.appendChild(ul)}function findValidNhiAt(invalidNhi,index){if(index<3){var alphabet=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z"];for(var i=0;i<alphabet.length;i+=1){var proposedNhi=invalidNhi.substr(0,index)+alphabet[i]+invalidNhi.substr(index+1);if(validateChecksum(proposedNhi)){return proposedNhi}}}for(var i=0;i<10;i+=1){var proposedNhi=invalidNhi.substr(0,index)+i+invalidNhi.substr(index+1);if(validateChecksum(proposedNhi)){return proposedNhi}}return null}function cleanNHI(e){return e.toUpperCase().replace("I","").replace("O","").substring(0,7)}function validateChecksum(e){return generateChecksum(e)==valueOf(e.charCodeAt(6))}function generateChecksum(e){for(sum=0,i=0;i<6;i+=1){sum+=valueOf(e.charCodeAt(i))*(7-i)}if(sum%11==0){return "Invalid"}return(11-sum%11)%10}function valueOf(e){return 47<e&#038;&#038;e<58?e-48:64<e&#038;&#038;e<73?e-64:73<e&#038;&#038;e<79?e-65:79<e&#038;&#038;e<91?e-66:void 0}</script><style>#generated-nhis,#validation-result ul{column-count:2;-webkit-column-count:2;-moz-column-count:2;font-family:monospace}#nhinumberfield:focus:required:invalid{background-color:pink;color:white}#nhinumberfield:required:valid{background-color:white;color:black}#nhinumberfield:invalid{border-color:red}#nhinumberfield,#nhinumberfield:valid{border-color:green}</style>



<ul>
<li>NHI's uses the letters A-Z without I or O.</li>



<li>NHI's start with three letters and end with four numbers.</li>



<li>The last digit is a checksum.</li>



<li>NHI's are assigned randomly. I believe hospitals have distinct sets ready to be assigned.</li>



<li>Its possible for somebody to have multiple NHIs (first alphabetically is the primary).</li>
</ul>



<p>The current Id. structure only allows for around 13.8 million NHI's. With a population of around 5 million in 2019 and the possibility of a single person being associated to multiple Id.s, I suspect NHIs in their current form wont be around very long.</p>



<h2 class="wp-block-heading">References</h2>



<p>(last checked 2023-06-06)</p>



<ol><li><a href="https://en.wikipedia.org/wiki/NHI_Number" target="_blank" rel="noopener noreferrer" id="ref-nhi-wiki">https://en.wikipedia.org/wiki/NHI_Number</a></li><li><del><a href="https://www.health.govt.nz/our-work/health-identity/national-nhi-gov" target="_blank" rel="noopener noreferrer" id="ref-nhi-gov">https://www.health.govt.nz/our-work/health-identity/national-health-index</a></del></li><li><a href="http://www.midcentraldhb.govt.nz/PatientsandVisitors/GeneralInformation/Pages/NHI.aspx" target="_blank" rel="noopener noreferrer" id="ref-nhi-midcentral">http://www.midcentraldhb.govt.nz/PatientsandVisitors/GeneralInformation/Pages/NHI.aspx</a></li></ol>



<p>[EDIT]: Thanks to Chris W for pointing out a bug in my previous implementation. If the checksum is a '0' before being subtracted from 11, the NHI number is deemed to be invalid. This is now fixed in the generator.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://kram.nz/2019/02/nhi-validation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Brisbane Webcam</title>
		<link>https://kram.nz/2019/02/brisbane-webcam/</link>
					<comments>https://kram.nz/2019/02/brisbane-webcam/#respond</comments>
		
		<dc:creator><![CDATA[M]]></dc:creator>
		<pubDate>Sun, 17 Feb 2019 06:10:06 +0000</pubDate>
				<category><![CDATA[Photos]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Brisbane]]></category>
		<category><![CDATA[N900]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Timelapse]]></category>
		<category><![CDATA[Webcam]]></category>
		<category><![CDATA[Website]]></category>
		<guid isPermaLink="false">https://kram.nz/?p=543</guid>

					<description><![CDATA[Using an old phone (Nokia N900) I have set up a webcam to take a photo every 5 minutes during the day and upload it to my website. You can see the latest photo on: Webcam I have set my computers desktop background to sync with the latest photo too. So far I have a [&#8230;]]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure><img fetchpriority="high" decoding="async" width="1024" height="569" src="https://kram.nz/wp-content/uploads/2019/02/20181231-134001-Brisbane-1024x569.jpeg" alt="" class="wp-image-552 aligncenter" srcset="https://kram.nz/wp-content/uploads/2019/02/20181231-134001-Brisbane-1024x569.jpeg 1024w, https://kram.nz/wp-content/uploads/2019/02/20181231-134001-Brisbane-300x167.jpeg 300w, https://kram.nz/wp-content/uploads/2019/02/20181231-134001-Brisbane-768x427.jpeg 768w, https://kram.nz/wp-content/uploads/2019/02/20181231-134001-Brisbane-1568x871.jpeg 1568w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Brisbane Webcam</figcaption></figure></div>



<p>Using an old phone (Nokia N900) I have set up a webcam to take a photo every 5 minutes during the day and upload it to my website. You can see the latest photo on: <a href="/webcam/">Webcam</a></p>



<div class="wp-block-image"><img decoding="async" width="640" height="480" src="https://kram.nz/wp-content/uploads/2019/02/BrisbaneWebcam.jpg" alt="" class="wp-image-548 aligncenter" srcset="https://kram.nz/wp-content/uploads/2019/02/BrisbaneWebcam.jpg 640w, https://kram.nz/wp-content/uploads/2019/02/BrisbaneWebcam-300x225.jpg 300w" sizes="(max-width: 640px) 100vw, 640px" /><figcaption>N900 set up as a webcam</figcaption></figure></div>



<p>I have set my computers desktop background to sync with the latest photo too. So far I have a years worth of images and have made a few time-lapses. Here is one over a couple of days:</p>



<div class="wp-block-media-text alignwide"><figure class="wp-block-media-text__media"><video controls src="https://kram.nz/wp-content/uploads/2019/02/timelapse.webm"></video></figure><div class="wp-block-media-text__content">
<p style="text-align:center" class="has-large-font-size">Timelapse from the webcam</p>
</div></div>
]]></content:encoded>
					
					<wfw:commentRss>https://kram.nz/2019/02/brisbane-webcam/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		<enclosure url="https://kram.nz/wp-content/uploads/2019/02/timelapse.webm" length="1903113" type="video/webm" />

			</item>
		<item>
		<title>Apache Log Notifications in Linux</title>
		<link>https://kram.nz/2009/06/apache-log-notifications-in-linux/</link>
					<comments>https://kram.nz/2009/06/apache-log-notifications-in-linux/#respond</comments>
		
		<dc:creator><![CDATA[M]]></dc:creator>
		<pubDate>Sun, 14 Jun 2009 01:51:54 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Logs]]></category>
		<category><![CDATA[Notifications]]></category>
		<category><![CDATA[NotifyOSD]]></category>
		<category><![CDATA[Tail]]></category>
		<guid isPermaLink="false">https://kram.no-ip.com?p=96</guid>

					<description><![CDATA[I have a small personal website, as you can see, that gets the odd visitor now and then. This makes me happy! so I like to know about it. There are plenty of statistic gathering scripts like Google Analytics that generate excellent aggregate data, but for my scale of website I prefer a more fine-grain [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><figure id="attachment_99" aria-describedby="caption-attachment-99" style="width: 329px" class="wp-caption alignright"><img decoding="async" class="size-full wp-image-99" title="ApacheLogNotifier" src="/wp-content/uploads/2009/06/ApacheLogNotification.png" alt="A NotifyOSD notification of log activity" width="329" height="138" srcset="https://kram.nz/wp-content/uploads/2009/06/ApacheLogNotification.png 329w, https://kram.nz/wp-content/uploads/2009/06/ApacheLogNotification-300x125.png 300w" sizes="(max-width: 329px) 100vw, 329px" /><figcaption id="caption-attachment-99" class="wp-caption-text">A NotifyOSD notification of log activity</figcaption></figure></p>
<p>I have a small personal website, as you can see, that gets the odd visitor now and then. This makes me happy! so I like to know about it. There are plenty of statistic gathering scripts like Google Analytics that generate excellent aggregate data, but for my scale of website I prefer a more fine-grain monitoring. I use BBClone for this and it does an awesome job. Other than wishing it had the option for a SQL back-end, I always thought it would be great to have a real time notification of someone paying a visit.</p>
<p>Thus my java ApacheLogNotifier was born!</p>
<p>Using Java and Ubuntus port of NotifyOSD via the notification demon, I have created a small program to poll the tail of my Apache log and notify me whenever there is interesting activity. At the moment I ignoring localhost and bots, so that I can see if an actual person has just come to visit my website. There is a lot of work and refactoring to be done. My initial prototype is just a rushed couple of hours work (thanks to reusing the tail code from <a title="http://www.informit.com/guides/content.aspx?g=java&amp;seqNum=226" target="_blank" rel="noopener noreferrer nofollow" href="http://www.informit.com/guides/content.aspx?g=java&amp;seqNum=226">http://www.informit.com/guides/content.aspx?g=java&amp;seqNum=226</a>).</p>
<p>For more information and to get the code look at <a target="_blank" href="/wiki/index.php/2008:ApacheLogNotifier">the wiki page</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://kram.nz/2009/06/apache-log-notifications-in-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
