tag:blogger.com,1999:blog-5949583834819670132024-03-12T20:57:34.977-07:00Fluffy Bunny FeetFingers Bouncing Furiously: A screen and a keyboard companions for the sleepless soul, writing, etching their story, their wishes and dreams with the hope that someday someone might read these tails and think on the writers wishes ... JMPJ@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.comBlogger105125tag:blogger.com,1999:blog-594958383481967013.post-21594452170614406032018-12-17T05:02:00.004-08:002018-12-18T02:34:24.899-08:00Simple Switch... For a brighter Christmas<h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">It's Christmas!!</span></h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">It's Christmas time and what's Christmas with out Christmas lights?? well it's a dark a gloomy Christmas... </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-Duo0JHvuGw0/XBeR8O5ne0I/AAAAAAAAxCQ/LGuHEerqWfE0zt1fyYFuytej9SPI2i_PwCKgBGAs/s1600/20181211_192405.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><img border="0" data-original-height="900" data-original-width="1600" height="180" src="https://4.bp.blogspot.com/-Duo0JHvuGw0/XBeR8O5ne0I/AAAAAAAAxCQ/LGuHEerqWfE0zt1fyYFuytej9SPI2i_PwCKgBGAs/s320/20181211_192405.jpg" width="320" /></span></a></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">So let's chase the doom and gloom away with tons and tons of little energy efficient LED lights. <br /><br /><b>But wait there's more...</b> why just put up Christmas lights when you can put up Christmas lights and at the same time (or a few minutes later) create a simple program that will allow you to switch on your glorious addition at the push of a button, of course not a boring wall mounted button but a cool button on your cellphone or browser... Which allows you to switch on your awesome lights from anywhere on the planet, anywhere with a network connection that is :)<br /><br /><b>But wait there's still more..</b>. Make it so you can switch on your lights from anywhere in the world, with a bit of added security checks obviously :) </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">A Christmas'sy overview </span></h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">(there's nothing Christmas'sy about the overview but sure helps make it seem that way by saying it's Christmas'sy right?)</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<a href="https://1.bp.blogspot.com/--3LVxR12_bI/XBeWaCV89-I/AAAAAAAAxCo/TwGTFL0lPq04sRnjiNOKQ3D3jPyaGQ3nQCLcBGAs/s1600/diagram.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><img border="0" data-original-height="661" data-original-width="853" height="247" src="https://1.bp.blogspot.com/--3LVxR12_bI/XBeWaCV89-I/AAAAAAAAxCo/TwGTFL0lPq04sRnjiNOKQ3D3jPyaGQ3nQCLcBGAs/s320/diagram.png" width="320" /></span></a><span style="font-family: "arial" , "helvetica" , sans-serif;">Usually when I want to automate something at home the first thing that comes to mind is opening up ports on my router to allow some web traffic through... but that seems a bit lame now given the many mannnny different messaging protocols there are out there (NATS.io one of my favourite).</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br />This time instead of opening up ports and making calls to my network operator to make sure the opening thing on their side I thought I'd use Azure's Service Bus as my messaging framework/ solution. </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">The basic idea it to allow me to send a message to the bus, this message will contain a simple "Switch On" signal, while at home a program running on a raspberry pi will poll the Message Bus for new messages. On receiving the on or off signal the raspberry pi will either turn on or turn off the Christmas lights by triggering a solid state relay.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Setting Up the DATA bus </span></h2>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Before we get to the fun stuff... We'll need to setup a service bus in AZURE, if you already have a subscription this is pretty simple, if you don't well then step one is getting a subscription :) </span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<h2 style="background-color: white; box-sizing: inherit; font-size: 16px; margin-top: 1rem;">
<span style="font-family: "arial" , "helvetica" , sans-serif;">To create a namespace</span></h2>
<ol style="background-color: white; box-sizing: inherit; font-size: 16px; margin: 16px 0px 16px 38px; padding: 0px;">
<li style="box-sizing: inherit; list-style: decimal outside none;"><span style="font-family: "arial" , "helvetica" , sans-serif;">Sign in to the <a data-linktype="external" href="https://portal.azure.com/" style="background-color: transparent; box-sizing: inherit; cursor: pointer; overflow-wrap: break-word; text-decoration-line: none;">Azure portal</a>.</span></li>
<li style="box-sizing: inherit; list-style: decimal outside none;"><span style="font-family: "arial" , "helvetica" , sans-serif;">In the left navigation pane of the portal, click <span style="box-sizing: inherit; font-weight: 600;">+ Create a resource</span>, then click <span style="box-sizing: inherit; font-weight: 600;">Integration</span>, and then click <span style="box-sizing: inherit; font-weight: 600;">Service Bus</span>.</span></li>
<li style="box-sizing: inherit; list-style: decimal outside none;"><span style="font-family: "arial" , "helvetica" , sans-serif;">In the <span style="box-sizing: inherit; font-weight: 600;">Create namespace</span> dialog, enter a namespace name. The system immediately checks to see if the name is available.</span></li>
<li style="box-sizing: inherit; list-style: decimal outside none;"><span style="font-family: "arial" , "helvetica" , sans-serif;">After making sure the namespace name is available, choose the pricing tier (Basic, Standard, or Premium). If you want to use <a data-linktype="relative-path" href="https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-queues-topics-subscriptions#topics-and-subscriptions" style="background-color: transparent; box-sizing: inherit; cursor: pointer; overflow-wrap: break-word; text-decoration-line: none;">topics and subscriptions</a>, make sure to choose either Standard or Premium. Topics/subscriptions are not supported in the Basic pricing tier.</span></li>
<li style="box-sizing: inherit; list-style: decimal outside none;"><span style="font-family: "arial" , "helvetica" , sans-serif;">In the <span style="box-sizing: inherit; font-weight: 600;">Subscription</span> field, choose an Azure subscription in which to create the namespace.</span></li>
<li style="box-sizing: inherit; list-style: decimal outside none;"><span style="font-family: "arial" , "helvetica" , sans-serif;">In the <span style="box-sizing: inherit; font-weight: 600;">Resource group</span> field, choose an existing resource group in which the namespace will live, or create a new one.</span></li>
<li style="box-sizing: inherit; list-style: decimal outside none;"><div style="box-sizing: inherit; margin-top: 1rem;">
<span style="font-family: "arial" , "helvetica" , sans-serif;">In <span style="box-sizing: inherit; font-weight: 600;">Location</span>, choose the country or region in which your namespace should be hosted.</span></div>
<div style="box-sizing: inherit; margin-top: 1rem;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><img alt="Create namespace" data-linktype="relative-path" height="400" src="https://docs.microsoft.com/en-us/azure/includes/media/service-bus-create-namespace-portal/create-namespace.png" style="border: 0px; box-sizing: inherit; display: inline-block; height: auto; max-width: 100%;" width="138" /></span></div>
</li>
<li style="box-sizing: inherit; list-style: decimal outside none;"><span style="font-family: "arial" , "helvetica" , sans-serif;">Click <span style="box-sizing: inherit; font-weight: 600;">Create</span>. The system now creates your namespace and enables it. You might have to wait several minutes as the system provisions resources for your account.</span></li>
</ol>
</div>
<h2 style="background-color: white; box-sizing: inherit; font-size: 1.1875rem; line-height: 1.3; margin-bottom: 18px; margin-top: 30px;">
<span style="font-family: "arial" , "helvetica" , sans-serif;">Obtain the management credentials</span></h2>
<h3 class="heading-with-anchor" id="obtain-the-management-credentials" style="background-color: white; box-sizing: inherit; font-size: 1.1875rem; line-height: 1.3; margin-bottom: 18px; margin-top: 30px;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><a aria-hidden="true" class="docon docon-link heading-anchor" href="https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dotnet-get-started-with-queues#obtain-the-management-credentials" style="-webkit-font-smoothing: antialiased; background-color: transparent; box-sizing: inherit; cursor: pointer; direction: ltr; display: inline-block; font-size: 0.9em; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 400; line-height: 16px; margin: 0px 0px 0px 10px; opacity: 0; overflow-wrap: break-word; speak: none; text-align: center; text-decoration-line: none; vertical-align: middle; visibility: hidden;" tabindex="-1"></a></span></h3>
<div style="background-color: white; box-sizing: inherit; font-size: 16px; margin-top: 1rem;">
<span style="font-family: "arial" , "helvetica" , sans-serif;">Creating a new namespace automatically generates an initial Shared Access Signature (SAS) rule with an associated pair of primary and secondary keys that each grant full control over all aspects of the namespace. See <a data-linktype="relative-path" href="https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-authentication-and-authorization" style="background-color: transparent; box-sizing: inherit; cursor: pointer; overflow-wrap: break-word;">Service Bus authentication and authorization</a>for information about how to create further rules with more constrained rights for regular senders and receivers. To copy the initial rule, follow these steps:</span></div>
<ol style="background-color: white; box-sizing: inherit; font-size: 16px; margin: 16px 0px 16px 38px; padding: 0px;">
<li style="box-sizing: inherit; list-style: decimal outside none;"><span style="font-family: "arial" , "helvetica" , sans-serif;">Click <span style="box-sizing: inherit; font-weight: 600;">All resources</span>, then click the newly created namespace name.</span></li>
<li style="box-sizing: inherit; list-style: decimal outside none;"><span style="font-family: "arial" , "helvetica" , sans-serif;">In the namespace window, click <span style="box-sizing: inherit; font-weight: 600;">Shared access policies</span>.</span></li>
<li style="box-sizing: inherit; list-style: decimal outside none;"><div style="box-sizing: inherit; margin-top: 1rem;">
<span style="font-family: "arial" , "helvetica" , sans-serif;">In the <span style="box-sizing: inherit; font-weight: 600;">Shared access policies</span> screen, click <span style="box-sizing: inherit; font-weight: 600;">RootManageSharedAccessKey</span>.</span></div>
<div style="box-sizing: inherit; margin-top: 1rem;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><img alt="connection-info" data-linktype="relative-path" src="https://docs.microsoft.com/en-us/azure/includes/media/service-bus-create-namespace-portal/connection-info.png" style="border: 0px; box-sizing: inherit; display: inline-block; height: auto; max-width: 100%;" /></span></div>
</li>
<li style="box-sizing: inherit; list-style: decimal outside none;"><div style="box-sizing: inherit; margin-top: 1rem;">
<span style="font-family: "arial" , "helvetica" , sans-serif;">In the <span style="box-sizing: inherit; font-weight: 600;">Policy: RootManageSharedAccessKey</span> window, click the copy button next to <span style="box-sizing: inherit; font-weight: 600;">Primary Connection String</span>, to copy the connection string to your clipboard for later use. Paste this value into Notepad or some other temporary location.</span></div>
<div style="box-sizing: inherit; margin-top: 1rem;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><img alt="connection-string" data-linktype="relative-path" src="https://docs.microsoft.com/en-us/azure/includes/media/service-bus-create-namespace-portal/connection-string.png" style="border: 0px; box-sizing: inherit; display: inline-block; height: auto; max-width: 100%;" /></span></div>
</li>
<li style="box-sizing: inherit; list-style: decimal outside none;"><div style="box-sizing: inherit; margin-top: 1rem;">
<span style="font-family: "arial" , "helvetica" , sans-serif;">Repeat the previous step, copying and pasting the value of <span style="box-sizing: inherit; font-weight: 600;">Primary key</span> to a temporary location for later use.</span></div>
</li>
</ol>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Ok the boring part is done... almost</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Create a Topic And Topic Subscription</span></h2>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Basically messages can be sent to a specific topic, this means that the subscriber of the messages will subscribe to a topic and receive all message for a specific topic, provided you have the correct keys for the topic </span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-Buo6uMbBLyA/XBeZ_7eIa0I/AAAAAAAAxC0/aeLlETIimpAFeVta2-_NmI7JHlnFRSQtACLcBGAs/s1600/topic.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><img border="0" data-original-height="584" data-original-width="1540" height="241" src="https://2.bp.blogspot.com/-Buo6uMbBLyA/XBeZ_7eIa0I/AAAAAAAAxC0/aeLlETIimpAFeVta2-_NmI7JHlnFRSQtACLcBGAs/s640/topic.png" width="640" /></span></a></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Code ... Yuppeee it's time for some code </span></h2>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">The code was written in Go. The two main external libraries required are <a href="http://github.com/stianeikeland/go-rpio">go-rpio</a> and <a href="https://github.com/michaelbironneau/asbclient">asbclient</a>. The first library allows us to control the GPIO pins of the reaspberry pi while the second allows us to connect to Azures Service Bus:) </span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Code is available at <a href="https://github.com/Josempita/simpleSwitch">simpleSwitch on github</a> but I'll explain the main parts below: </span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<h3>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Initialising the Pi</span></h3>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">First step is to define the pins to be used on the raspberry pi, we'll be using two pins only, one for ground and the other as the signal to the solid state relay. </span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<div style="background-color: #1e1e1e; color: #d4d4d4; font-size: 14px; line-height: 19px; white-space: pre;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="color: #569cd6;">var</span> (</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #6a9955;">// Use mcu pin 21 (gpio21) corresponds to physical pin 40 on the pi</span></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">pin</span> = rpio.<span style="color: #dcdcaa;">Pin</span>(<span style="color: #b5cea8;">21</span>)</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">)</span></div>
</div>
</div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<h3>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Connect to Azure</span></h3>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Simply replace namespace , keyname and key value with the values you configured in azure</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<div style="background-color: #1e1e1e; color: #d4d4d4; font-size: 14px; line-height: 19px; white-space: pre;">
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="color: #569cd6;">func</span> <span style="color: #dcdcaa;">PollMessages</span>(messageCh <span style="color: #569cd6;">chan</span> <span style="color: #4ec9b0;">string</span>) {</span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">i</span> := <span style="color: #b5cea8;">0</span></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> log.<span style="color: #dcdcaa;">Printf</span>(<span style="color: #ce9178;">"Send: %d"</span>, i)</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">namespace</span> := <span style="color: #ce9178;">"[Azure Data Service Namespace Here]"</span></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">keyname</span> := <span style="color: #ce9178;">"[Azure data service key Name]"</span></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">keyvalue</span> := <span style="color: #ce9178;">"[Azure data service Key]"</span></span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">client</span> := asbclient.<span style="color: #dcdcaa;">New</span>(asbclient.Topic, namespace, keyname, keyvalue)</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> client.<span style="color: #dcdcaa;">SetSubscription</span>(<span style="color: #ce9178;">"stateSubscription"</span>)</span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #c586c0;">for</span> {</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">msg</span>, <span style="color: #9cdcfe;">err</span> := client.<span style="color: #dcdcaa;">PeekLockMessage</span>(<span style="color: #ce9178;">"state"</span>, <span style="color: #b5cea8;">30</span>)</span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #c586c0;">if</span> err != <span style="color: #569cd6;">nil</span> {</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> log.<span style="color: #dcdcaa;">Printf</span>(<span style="color: #ce9178;">"Peek error: %s"</span>, err)</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> } <span style="color: #c586c0;">else</span> {</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #c586c0;">if</span> msg != <span style="color: #569cd6;">nil</span> {</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">message</span> := <span style="color: #dcdcaa;">string</span>(msg.Body)</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> messageCh <- font="" message=""></-></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> log.<span style="color: #dcdcaa;">Printf</span>(<span style="color: #ce9178;">"Peeked message: '%s'"</span>, message)</span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">err</span> = client.<span style="color: #dcdcaa;">DeleteMessage</span>(msg)</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #c586c0;">if</span> err != <span style="color: #569cd6;">nil</span> {</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> log.<span style="color: #dcdcaa;">Printf</span>(<span style="color: #ce9178;">"Delete error: %s"</span>, err)</span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> }</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> }</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> }</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> time.<span style="color: #dcdcaa;">Sleep</span>(time.Millisecond * <span style="color: #b5cea8;">200</span>)</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> }</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">}</span></div>
</div>
</div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<h3>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Sneaky bits</span></h3>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">I used go's channels to trigger turning on and off the pi's pins. basically the messageCh channel is used to pass on the azure message to the function messageListener, the routine will block until the channel receives a value.</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<div style="background-color: #1e1e1e; color: #d4d4d4; font-size: 14px; line-height: 19px; white-space: pre;">
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="color: #569cd6;">func</span> <span style="color: #dcdcaa;">messageListener</span>(messageCh <span style="color: #569cd6;">chan</span> <span style="color: #4ec9b0;">string</span>) {</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #c586c0;">for</span> {</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #6a9955;">//Block untile message received from channel</span></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">msg</span> := <-messagech font=""></-messagech></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #c586c0;">if</span> msg == <span style="color: #ce9178;">"on"</span> {</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> fmt.<span style="color: #dcdcaa;">Println</span>(<span style="color: #ce9178;">"On State Received"</span>)</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> pin.<span style="color: #dcdcaa;">High</span>()</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> } <span style="color: #c586c0;">else</span> <span style="color: #c586c0;">if</span> msg == <span style="color: #ce9178;">"off"</span> {</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> fmt.<span style="color: #dcdcaa;">Println</span>(<span style="color: #ce9178;">"Off State Received"</span>)</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> pin.<span style="color: #dcdcaa;">Low</span>()</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> }</span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> }</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">}</span></div>
</div>
</div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Connecting things together</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Connecting the Raspberry pi to a solid state relay is pretty simple. Below is the image I took of everything together, sorry no circuit diagram.</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-fREkpbIDmp0/XBeeXnV7gmI/AAAAAAAAxDA/Svtz0JQUYaIIESaqm36v02-DEQjZtT66wCKgBGAs/s1600/20181212_202432.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><img border="0" data-original-height="900" data-original-width="1600" height="180" src="https://4.bp.blogspot.com/-fREkpbIDmp0/XBeeXnV7gmI/AAAAAAAAxDA/Svtz0JQUYaIIESaqm36v02-DEQjZtT66wCKgBGAs/s320/20181212_202432.jpg" width="320" /></span></a></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">A client</span></h2>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">the only bit i haven't included is the bit that sends the message to the bus... here's a snippet used to send.</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<div style="background-color: #1e1e1e; color: #d4d4d4; font-size: 14px; line-height: 19px; white-space: pre;">
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">client</span> := asbclient.<span style="color: #dcdcaa;">New</span>(asbclient.Topic, namespace, keyname, keyvalue)</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> client.<span style="color: #dcdcaa;">SetSubscription</span>(<span style="color: #ce9178;">"stateSubscription"</span>)</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> <span style="color: #9cdcfe;">err</span> := client.<span style="color: #dcdcaa;">Send</span>(<span style="color: #ce9178;">"state"</span>, &asbclient.Message{</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> Body: []<span style="color: #dcdcaa;">byte</span>(message),</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"> })</span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
</div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">There you go!!! my gift to you all :) </span></div>
J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-9992540120563650842018-07-01T04:07:00.000-07:002018-07-19T00:05:03.215-07:00Flatten it... Get an organisation moving as a unit<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-moimsF8Mink/WziyIxTWScI/AAAAAAAAtP8/CM23ITAPJA8VqWSe1WSoo1rdR0Wv002NwCLcBGAs/s1600/1461044826457.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="349" data-original-width="617" height="181" src="https://2.bp.blogspot.com/-moimsF8Mink/WziyIxTWScI/AAAAAAAAtP8/CM23ITAPJA8VqWSe1WSoo1rdR0Wv002NwCLcBGAs/s320/1461044826457.jpg" width="320" /></a></div>
<br />
<br />
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">Us versus them...</span></b><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b><br /></b>
In my post "The self organised team" I wrote about the effects and awesomeness of being part of a self managed team, and how accountability is quickly established by handing over the reigns to those creating the change. Almost two years after that post... damn time flies, our team still retains a level of independence. I'd like to say we have completely changed the minds and practices of all the teams in the organisation but alas that is not the case. Thankfully I believe i have managed to pinpoint why, and what we need to do to move together as unit.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Lets get the obvious reasons out the way first, then I'll offer my two cents on how to jump over these hurdles :)</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">1. Change is scary as ...</span></b><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Having another team try to dictate how you should work is often met with resistance and scepticism. People like coming up with their own master plan to take over the universe. Change or the idea of changing needs to bubble up from within each team and not be hammered down by others. Change wont happen if a team doesn't believe it needs to happen - a comfort zone is a difficult ship to step off of.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b>2. Organisational structures are broken .</b>..</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">I had a meeting with someone from our HR department... sadly the person didn't have a clue who I was, it was a random catch-up meeting. I say sadly not because I think everyone should know Jose Pita (although that would be nice, I think) instead it was sad because it meant the Team who you'd expect to at least know the souls working for the organisation didn't have a clue who it was meeting with. At first this was annoying but while chatting to the HR person an idea sparked in the depths of my brain... The structure is all wrong!</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">When I look at our little dev team (8 developers) it's easy for us to tackle large problems because we simply break the problem up into smaller tasks usually these tasks take about a day to complete. These tasks range from coding some new component to arranging a new server to deploying stuff to new servers etc. the key is that each morning we touch base and see how each task that supposed to make up a greater task has progressed and if there were any issues (agile). Now zoom out a little and an interesting picture emerges. Each developer in our team is a full stack developer - any one of us can pretty much take on any task (UI, back-end, deployment ...) and each of us are capable of working independently as if we were our own team (very scale-able) or our own manager offering a service to the other members in our team. Communication flows naturally from one team member to another, there is no hierarchy blocking the flow of communication. Teams/ individuals with direct access to each other, muito importante. <b>There is no "me versus them" or "us versus them", there is only a collective healthy "US" trying to achieve a goal</b></span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">This got me thinking about what a completely flat organisation might look like, one where there is no gatekeepers blocking access to team resources / people. I'll get back to this...</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">Step back a bit...</span></b><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">One of the issues of being part of a self-organised team is getting the rest of the organisation specifically a disconnected HR department to recognize the role of individuals in a team. This in itself shouldn't be a problem but it is the nature of the beast. When it comes to things like remuneration it is the individual that is looked at not necessarily the team as a single unit. This was us shooting ourselves in the foot I guess. We essentially confused the hell out of HR, and put a substantial blur in their telescopes.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<b><span style="font-family: "arial" , "helvetica" , sans-serif;">Let's flatten it...</span></b><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Okay back to solutions mode. How do we kill two birds with one stone, clear up the blurred HR telescope and change the us versus them into us alone. Time to zoom out again, just like our tiny little dev team (tiny but we do massive things, our ROI is very impressive ;)) is able to split up and rejoin. an organisation should be able to split up its roles, ideally at a moments notice...but baby steps. What I mean is let people do what they are good at, and let them do it for everyone. Imagine stripping out the managers from all teams and placing them into a separate teams, lets call them "enablers", that can serve the needs of a few teams. This is by no means an elite cult that requires secret ceremonies and symbolic tattoos stamped on the members ass, nope this is just another unit or disc that is capable of removing the things stopping dev teams or other teams from achieving their goals.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">This like the other units require members to be elected in. Managers tend to be people people while developers for example are not so much people people. We love to bury our heads into our code and come out for some air and coffee every now and then. The key is not to disconnect the team from the enablers but to give them unlimited access to all enablers... the people that have built up relationships with other teams over time and are able to get these other teams to assist other dev teams. For example, just like people run to IT guys (even dev guys) to fix a printer, teams around the organization should be able to run to the "Enabler" teams to get resources or remove hurdles etc.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Saying all devs are not people people is a bit of lie. Sometimes devs fall off the wagon and decide they would rather coordinate than create (that was a bit cheeky). At this point the creators can elect that such a person be moved into an enabler space, this isn't a promotion our demotion but rather recognition of a persons strengths or preference changing. The same should be allowed the other way around... enablers become creators.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">The key here is to create groups of people moving together to achieve a common goal and not creating a structure of us vs them by placing certain groups further up a hierarchy. It's not difficult to imagine other units, I picture discs of people in my mind, mentioned discs before this is just another word for team, for example sales team, traders, accountants and dare I say a CEO team??... The main differences is the ability awarded to people to move in and out of the different units/ discs, and the access all other teams have to these specialized teams.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b><br /></b>
<b>Recognizing excellence... </b></span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="white-space: pre-wrap;"><span style="font-family: "arial" , "helvetica" , sans-serif;">When it comes to the HR problem of recognizing the excellence of individuals, look no further than the enabler units or the units requesting work from other units, they will be able to judge performance. For example HR wants to decide how Jose did this year, firstly identify which units Jose was part of throughout the year (since he can move around), what those units did for what other units and simply find out if the required service or attention or work was produced. If the tasks fell under control of an entire unit that unit will decide how Jose did. This sets the seen for a performance formula... (more details to follow). Zoom out and a clear picture will be given of Jose's usefulness :) easy peasy... well sort of... the prerequisite to all of this would be to have a framework like agile or something similar to track changes (not micro manage). some Digital tools might also help. It is also essential to establish a "formula" that can be used to determine exactly where an employee stands with regards to remuneration. Bonuses and increases should not be a surprise, knowing exactly what you get for what you do is a simple way to hand back the motivation torch and place choice and control in the employees hands. For instance giving an entire company an increase of 20% sounds like a great idea except that lazy folk will remain lazy and productive folk may actually become less productive (e.g. similar to the observed effects of communism). To motivate people you need to give them control and what better way than to make remuneration and rewards completely transparent by giving employees a formula that will provide them sense of where they are heading at any point in the year. The challenge of course is determining the formula, challenging but not impossible.</span></span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">And Boom people are recognized for what the contribute without quarterly reviews. Employees purpose becomes the organisations purpose, r<b>ank gets thrown out the window</b> and the organisation moves as a unit and not as a bag of cats in bag clawing at each other trying to find a comfy spot:)</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">One problem remains how do you get people to change age old comfortable ways of working? The only way is by example, smaller teams need to be given the freedom to change. Change that motivates people is infectious others will follow :)</span><br />
<br />
<div>
<div>
<br /></div>
</div>
J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-48220798575576384702017-02-05T00:25:00.002-08:002017-07-24T00:45:05.298-07:00Build Monitor 2.0 using ws2812 LED strip<span style="font-family: "arial" , "helvetica" , sans-serif;">As cool as a flashing light is, it just wasn't enough... </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://2.bp.blogspot.com/-gt9tBzk5yNc/WJbglso5KOI/AAAAAAAAfhg/SoHQ9xcj2jY7wf_SfSADhu3uI9bCBeAKgCKgB/s1600/20170205_093324.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://2.bp.blogspot.com/-gt9tBzk5yNc/WJbglso5KOI/AAAAAAAAfhg/SoHQ9xcj2jY7wf_SfSADhu3uI9bCBeAKgCKgB/s320/20170205_093324.jpg" width="320" /></a></div>
<br />
<br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">LED strips are the way of the future... at least when it comes to a funky build monitor. </span><br />
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/G-_cvzywYOs/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/G-_cvzywYOs?feature=player_embedded" width="320"></iframe><span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><a href="http://josemanuelpita.blogspot.co.za/2017/01/build-status-monitor.html">The previous build monitor</a> was built using a solid state relay, pi zero and a 220V LED downlight. Version 2 has stepped up a bit with the addition of a ws2812 led strip. </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">The Go lang code also includes a ws2811 library for controlling the DMA and PWM of the raspberry pi zero.
The library, written in c can be found on <a href="https://github.com/jgarff/rpi_ws281x">github</a>. The library includes a wrapper for python as well as a wrapper for GO, which is the one I was interested in.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b>Challenge 1</b>: The led strip came with a tiny data sheet specifying 14.4Watts per meter. Hmmm doesnt sound too bad at first until you realize that the strips require 5V, and this is a 5 meter strip ... so P= VI therefore A = (14.4 x 5m) / 5v = 14.4A. that's a lot of current being drawn by the LEDS. This meant I would need a pretty good power supply to be able to source all that current. My choice was a meanwell powersupply specifically the LRS-100-5 ie. 100 Watt 5V which should be able to supply at least 20A if required.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<a href="https://2.bp.blogspot.com/-axH-rZdCO6I/WJbglu1wsDI/AAAAAAAAfhg/xCnZ_ggawp0Phxb-LYEuYphjjYbADufxQCKgB/s1600/20170205_093259.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="180" src="https://2.bp.blogspot.com/-axH-rZdCO6I/WJbglu1wsDI/AAAAAAAAfhg/xCnZ_ggawp0Phxb-LYEuYphjjYbADufxQCKgB/s320/20170205_093259.jpg" width="320" /></a><span style="font-family: "arial" , "helvetica" , sans-serif;"><b>Challenge 2</b>: The raspberry pi's GPIO pins work at 3V3 meaning it probably wouldn't be enough to turn on the LED strips ws2811 chips data line... enter the buffer chip <a href="http://www.ti.com/lit/ds/symlink/sn74ls125a.pdf">74ls125AN</a>, (follow the link for the datasheet) a simple buffer that can be used to convert the 3V3 level to 5V. I used to veraboard to connect to the chip... very simple</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Here we go, challenges met now for the setup:</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b>Step 1:</b> Install some dependencies</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">sudo apt-get update</span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">sudo apt-get install build-essential python-dev git scons swig</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">scons will be used to build the library, and python just to do an initial test</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b>Step 2</b>: Get the library onto the PI, so my go stuff is located at /usr/share/go/src/ so to make life simple (this is probably not the best way to do it) I checked out a clone of the git repo into the src folder at /usr/share/go/src/pkg ... git clone https://github.com/jgarff/rpi_ws281x.git</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b>Step 3</b>: Build the library, run the following in the /usr/share/go/src/pkg/rpi_ws281x</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">sudo scons</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b>Step 4: </b>I had some issues with GCC includes and library path so I hacked it a little to save some time... so within the </span><span style="font-family: "arial" , "helvetica" , sans-serif;">/usr/share/go/src/pkg/rpi_ws281x we're going to create some symbolic links to confuse any c madness into think our header files are in the right place:</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">run the following commands to create the links:</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">sudo ln -s /usr/share/go/src/pkg/rpi_ws281x/ws2811.h /usr/local/include/ws2811.h</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">sudo ln -s /usr/share/go/src/pkg/rpi_ws281x/pwm.h /usr/local/include/pwm.h</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">sudo ln -s /usr/share/go/src/pkg/rpi_ws281x/dma.h /usr/local/include/dma.h</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">sudo ln -s /usr/share/go/src/pkg/rpi_ws281x/clk.h /usr/local/include/clk.h</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">sudo ln -s /usr/share/go/src/pkg/rpi_ws281x/gpio.h /usr/local/include/gpio.h</span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">sudo ln -s /usr/share/go/src/pkg/rpi_ws281x/rpihw.h /usr/local/include/rpihw.h</span><br />
<div>
<br /></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b>Step 5:</b> Some code. We're going to use GPIO 18 for the comms to the ws2812 strip.</span></div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-Ha8l8LClDK8/WJbgTx1QmuI/AAAAAAAAfhc/wgleukfplyAhbi5VSICUPel6QVAZ6_PfQCLcB/s1600/Raspberry-Pi-Model-Zero-Mini-PC.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="251" src="https://3.bp.blogspot.com/-Ha8l8LClDK8/WJbgTx1QmuI/AAAAAAAAfhc/wgleukfplyAhbi5VSICUPel6QVAZ6_PfQCLcB/s320/Raspberry-Pi-Model-Zero-Mini-PC.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: "andale mono" , "lucida console" , "monaco" , "fixed" , monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 80%;"> <code style="color: black; word-wrap: normal;">
package main
import(
"fmt"
"log"
"net/http"
"html/template"
"encoding/json"
"github.com/stianeikeland/go-rpio"
"os"
"time"
"rpi_ws281x/golang/ws2811"
"gocron-master/gocron-master"
)
var buildStable bool = true
var alerting bool = false
var (
// Use mcu pin 10, corresponds to physical pin 19 on the pi
pin = rpio.Pin(10)
)
var buildch chan bool
func main() {
if err := ws2811.Init(18, 300, 32); err != nil {
fmt.Println(err)
os.Exit(1)
}
buildch := make(chan bool)
// Open and map memory to access gpio, check for errors
if err := rpio.Open(); err != nil {
fmt.Println(err)
os.Exit(1)
}
// Unmap gpio memory when done
defer rpio.Close()
// Set pin to output mode
pin.Output()
fmt.Println("Initialized")
rainbowCycle()
http.HandleFunc("/", Home)
http.HandleFunc("/alertBuildUnstable", func(w http.ResponseWriter, r *http.Request) {
handleBuildError(w, buildch)
})
http.HandleFunc("/alertTestUnstable", func(w http.ResponseWriter, r *http.Request) {
handleTestError(w, buildch)
})
http.HandleFunc("/alertBuildStable", func(w http.ResponseWriter, r *http.Request) {
handleBuildStable(w, buildch)
})
http.HandleFunc("/alertStop", func(w http.ResponseWriter, r *http.Request) {
handleStop(w, buildch)
})
go scheduleJobs(buildch)
log.Fatal(http.ListenAndServe(":8083", nil))
// remove, clear and next_run
}
func scheduleJobs(buildch chan bool){
//schedule some jobs
// gocron.Every(1).Day().At("18:28").Do(standUp)
gocron.Every(1).Day().At("10:30").Do(standUp, buildch)
gocron.Every(1).Day().At("11:45").Do(standUp, buildch)
gocron.Every(1).Day().At("14:00").Do(standUp, buildch)
// gocron.Every(1).Monday().At("18:30").Do(task)
_, time := gocron.NextRun()
fmt.Println("next run: ")
fmt.Println(time)
// function Start start all the pending jobs
<- gocron.Start()
}
func standUp(buildch chan bool){
if alerting == true {
alerting = false
buildch <- true
}
stripStandUp(getColour(255,255,255))
ws2811.Clear()
if buildStable == true {
go setStripColour(254,0,0)
} else {
alerting = true
go toggleTestAlert(buildch)
}
}
func Home(w http.ResponseWriter, req *http.Request) {
render(w, "/home/pi/gowork/alert/alert.html")
}
func render(w http.ResponseWriter, tmpl string) {
tmpl = fmt.Sprintf("%s", tmpl)
t, err := template.ParseFiles(tmpl)
if err != nil {
log.Print("template parsing error: ", err)
}
err = t.Execute(w, "")
if err != nil {
log.Print("template executing error: ", err)
}
}
func handleBuildError(w http.ResponseWriter, buildch chan bool) {
mapResponse, _ := json.Marshal("unstable")
fmt.Fprintf(w, "%q", string(mapResponse))
time.Sleep(time.Second)
buildStable = false
if alerting == false {
alerting = true
go toggleBuildAlert(buildch)
}
}
func handleTestError(w http.ResponseWriter, buildch chan bool) {
mapResponse, _ := json.Marshal("unstableTest")
fmt.Fprintf(w, "%q", string(mapResponse))
time.Sleep(time.Second)
buildStable = false
if alerting == false {
alerting = true
go toggleTestAlert(buildch)
}
}
func toggleBuildAlert(buildch chan bool){
buildStable = false
ws2811.Clear()
for buildStable == false {
stripStart(getColour(0,255,0))
// pin.Toggle()
// time.Sleep(time.Second / 6)
// use select for non blocking operation
select {
case buildStable = <-buildch:
fmt.Println("build stable? : ", buildStable)
default:
fmt.Println("build unstable!")
}
}
}
func toggleTestAlert(buildch chan bool){
ws2811.Clear()
buildStable = false
for buildStable == false {
stripStart(getColour(165 ,255,0))
// pin.Toggle()
// time.Sleep(time.Second)
// use select for non blocking operation
select {
case buildStable = <-buildch:
fmt.Println("build stable? : ", buildStable)
default:
fmt.Println("build unstable!")
}
}
}
func handleBuildStable(w http.ResponseWriter, buildch chan bool) {
mapResponse, _ := json.Marshal("stable")
time.Sleep(time.Second)
fmt.Fprintf(w, "%q", string(mapResponse))
alerting = false
if buildStable == false {
buildch <- true
setStripColour(254,0,0)
buildStable = true
} else {
//be proud make it blue
setStripColour(0,0,254)
}
}
func handleStop(w http.ResponseWriter, buildch chan bool) {
mapResponse, _ := json.Marshal("stop")
time.Sleep(time.Second)
fmt.Fprintf(w, "%q", string(mapResponse))
if buildStable == false {
buildch <- true
}
time.Sleep(time.Second)
ws2811.Clear()
ws2811.Render()
buildStable = true
alerting = false
}
func stripStart(colour uint32){
for i := 0; i < 150; i++ {
ws2811.SetLed(i, colour)
ws2811.SetLed(299-i, colour)
ws2811.Render()
time.Sleep(time.Second / 60)
}
for i := 149; i>=0 ; i-- {
ws2811.SetLed(i, 0)
ws2811.SetLed(149+(149 - i),0)
ws2811.Render()
time.Sleep(time.Second / 60)
}
}
func stripStandUp(colour uint32){
for j := 0; j < 20 ; j++ {
for i := 0; i < 300; i++ {
ws2811.SetLed(i, colour)
}
ws2811.Render()
time.Sleep(time.Second /2)
for i := 0; i < 300; i++ {
ws2811.SetLed(i, 0)
}
ws2811.Render()
time.Sleep(time.Second /2)
}
}
func wheel(pos int) uint32 {
//Generate rainbow colors across 0-255 positions
var rgb uint32
if pos < 85{
rgb = uint32(pos) * 3
rgb = (rgb << 8) + 255 - uint32(pos)
rgb = (rgb << 8) + 0
return rgb
} else if pos < 170{
pos -= 85
rgb = 255 - uint32(pos) * 3
rgb = (rgb << 8) + 0
rgb = (rgb << 8) + uint32(pos) * 3
return rgb
} else {
pos -= 170
rgb = 0
rgb = (rgb << 8) + uint32(pos) * 3
rgb = (rgb << 8) + 255 - uint32(pos) * 3
return rgb
}
}
func getColour(green uint32, red uint32, blue uint32) uint32{
var rgb uint32
rgb = green
rgb = (rgb << 8) + red
rgb = (rgb << 8) + blue
return rgb
}
func setStripColour(green uint32, red uint32, blue uint32){
for i := 0; i < 300; i++ {
ws2811.SetLed(i, getColour(green, red, blue))
}
ws2811.Render()
}
func rainbowCycle(){
//Draw rainbow that uniformly distributes itself across all pixels.
var j int = 0
//for j := 0; j <= 256 * 1 ; j++ {
for i := 0; i < 300; i++ {
ws2811.SetLed(i, wheel((int(i * 256 / 300) + j) & 255))
ws2811.Render()
time.Sleep(time.Second / 100)
}
//}
setStripColour(0,0,254)
}
</code>
</pre>
<br />
<br />J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com4tag:blogger.com,1999:blog-594958383481967013.post-59754844734942198672017-01-22T06:44:00.001-08:002017-01-26T01:43:41.115-08:00Build Status MonitorFinally got my Raspberry Pi zero from Pimoroni. Was super happy it only took 2 days to be delivered :)<br />
The question of course to follow was: what the hell to do with the thing, I really want to spare it from becoming another media player... so build status monitor it would be :)<br />
<br />
The idea is to hook it up to a build service like hudson, jenkins go-cd etc... by connecting to a rest api when the build breaks this should trigger a light to flash, just enough to irritate us developers into fixing stuff pronto:)<br />
<br />
So... to turn the light on hit the URL http://192.168.43.6:8083/alertBuildUnstable (obviously change the ip to reflect your pi's IP. To turn off hit the URL http://192.168.43.6:8083/alertBuildStable, easy peasy.<br />
<br />
below is the code for the GOlang service, I used a library from https://github.com/stianeikeland/go-rpio works pretty well :)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-KTd0zKKTegs/WITDuyJW72I/AAAAAAAAemM/5pyZ-9IFUZ8-Xi9y_NnpA_NA4Ffdp6S9gCLcB/s1600/20170122_150642.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://2.bp.blogspot.com/-KTd0zKKTegs/WITDuyJW72I/AAAAAAAAemM/5pyZ-9IFUZ8-Xi9y_NnpA_NA4Ffdp6S9gCLcB/s320/20170122_150642.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-vlTEG98wVzU/WITDxXV-cjI/AAAAAAAAemQ/CBeYoFaj2Gg9ub63Ogz4dQrn8QOgjxU7QCLcB/s1600/20170122_150715.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://2.bp.blogspot.com/-vlTEG98wVzU/WITDxXV-cjI/AAAAAAAAemQ/CBeYoFaj2Gg9ub63Ogz4dQrn8QOgjxU7QCLcB/s320/20170122_150715.jpg" width="320" /></a></div>
<br />
<br />
the circuit is simple - the gpio 10 from the pi connects to the dc side of a solid state relay to turn on a 220v led (downlight) on the AC side. there's also a wifi adapter connected to the pi to make coms a little simpler<br />
<br />
here's some images with the light on and then the light off<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-S4uTPga8EyA/WITFEoWGJLI/AAAAAAAAemc/ZnJ_MEfe_XMJKy11oCEdf4denSJalQPUwCLcB/s1600/off.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://2.bp.blogspot.com/-S4uTPga8EyA/WITFEoWGJLI/AAAAAAAAemc/ZnJ_MEfe_XMJKy11oCEdf4denSJalQPUwCLcB/s320/off.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-RNiIclCVm3k/WITFFxLFcqI/AAAAAAAAemg/r6d7uDkXdZ0g8cjuiLOoOv75aDHjKnJnwCLcB/s1600/on.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://2.bp.blogspot.com/-RNiIclCVm3k/WITFFxLFcqI/AAAAAAAAemg/r6d7uDkXdZ0g8cjuiLOoOv75aDHjKnJnwCLcB/s320/on.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The Basic plan ... </div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-wzHcuSN2Uco/WITFIeY1RaI/AAAAAAAAemk/QfDdlN646wE1jqZhKuYHWKPqtVJzlfa7ACLcB/s1600/plan.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://4.bp.blogspot.com/-wzHcuSN2Uco/WITFIeY1RaI/AAAAAAAAemk/QfDdlN646wE1jqZhKuYHWKPqtVJzlfa7ACLcB/s320/plan.jpg" width="180" /></a></div>
<br />
<br />
: here's the go code, also made use of some channel magic<br />
<br />
<br />
<pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: "andale mono" , "lucida console" , "monaco" , "fixed" , monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 60%;"> <code style="color: black; word-wrap: normal;">
package main
import(
"fmt"
"log"
"net/http"
"encoding/json"
"github.com/stianeikeland/go-rpio"
"os"
"time"
)
var buildStable bool = true
var alerting bool = false
var (
// Use mcu pin 10, corresponds to physical pin 19 on the pi
pin = rpio.Pin(10)
)
func main() {
buildch := make(chan bool)
// Open and map memory to access gpio, check for errors
if err := rpio.Open(); err != nil {
fmt.Println(err)
os.Exit(1)
}
// Unmap gpio memory when done
defer rpio.Close()
// Set pin to output mode
pin.Output()
//lets just send a signal to show that the service is up
pin.High()
time.Sleep(time.Second / 2)
pin.Low()
time.Sleep(time.Second / 2)
pin.High()
time.Sleep(time.Second / 2)
pin.Low()
http.HandleFunc("/alertBuildUnstable", func(w http.ResponseWriter, r *http.Request) {
handleBuildError(w, buildch)
})
http.HandleFunc("/alertBuildStable", func(w http.ResponseWriter, r *http.Request) {
handleBuildStable(w, buildch)
})
log.Fatal(http.ListenAndServe(":8083", nil))
}
func handleBuildError(w http.ResponseWriter, buildch chan bool) {
mapResponse, _ := json.Marshal("unstable")
fmt.Fprintf(w, "%q", string(mapResponse))
time.Sleep(time.Second)
buildStable = false
if alerting == false {
alerting = true
go toggleBuildAlert(buildch)
}
}
func toggleBuildAlert(buildch chan bool){
var buildStable bool = false
for buildStable == false {
pin.Toggle()
time.Sleep(time.Second)
// use select for non blocking operation
select {
case buildStable =
fmt.Println("build stable? : ", buildStable)
default:
fmt.Println("build unstable!")
}
}
}
func handleBuildStable(w http.ResponseWriter, buildch chan bool) {
mapResponse, _ := json.Marshal("stable")
time.Sleep(time.Second)
fmt.Fprintf(w, "%q", string(mapResponse))
if buildStable == false {
buildch
pin.Low()
buildStable = true
alerting = false
}
}
</code>
</pre>
J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com1tag:blogger.com,1999:blog-594958383481967013.post-77523285662327525802017-01-08T05:32:00.000-08:002017-01-08T05:32:06.019-08:00Pajero Upgrades Few days ago I noticed the 4x4 engaged indicator on the dash would start flashing without engaging the 4x4 gear...<br />
after inspection I found the culprits to be three connectors next to the gear box. Appeared that my dogs had had a go at chewing the plugs. After a quick fix with some insulation tape the problem went away, however I wasnt too happy about how exposed the plugs were so I decided to do a little upgrade (hopefully not a downgrade) by placing the wires in a waterproof box and joined the cables using terminal block...<br />
<div>
<br /></div>
<div>
First image is of the connectors , </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-DppoTbA9MSI/WHI-t3PumJI/AAAAAAAAelY/HyKmXtiWU1AjY007VIhN8oEPVHwqZeoggCLcB/s1600/20170108_145333.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://4.bp.blogspot.com/-DppoTbA9MSI/WHI-t3PumJI/AAAAAAAAelY/HyKmXtiWU1AjY007VIhN8oEPVHwqZeoggCLcB/s320/20170108_145333.jpg" width="180" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-gazNVcZV5s0/WHI-uDe9DLI/AAAAAAAAelc/285mmAQU0NEs5FSsAYHzdd0mzH1nyfK6QCEw/s1600/20170108_144359.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="180" src="https://4.bp.blogspot.com/-gazNVcZV5s0/WHI-uDe9DLI/AAAAAAAAelc/285mmAQU0NEs5FSsAYHzdd0mzH1nyfK6QCEw/s320/20170108_144359.jpg" width="320" /></a></div>
<div>
second image is the cables in the box</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
And finally, cable tie just there just in case :) </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-GjLA6lmBHOw/WHI-tDeyIkI/AAAAAAAAelU/4LsoEN5Y0TcTJZ3t-TVKeHc2JLKXOBgFACEw/s1600/20170108_145036.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://3.bp.blogspot.com/-GjLA6lmBHOw/WHI-tDeyIkI/AAAAAAAAelU/4LsoEN5Y0TcTJZ3t-TVKeHc2JLKXOBgFACEw/s320/20170108_145036.jpg" width="180" /></a></div>
<div>
<br /></div>
J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-13984619821066355982016-09-11T05:57:00.000-07:002016-09-11T05:57:31.558-07:00The Self Organized Team<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: 0px 0px; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: 'Source Serif Pro', serif; line-height: 3.2rem; margin-bottom: 3.2rem; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-Gb4wUVd-bmo/V9VTWhn4DLI/AAAAAAAAdFY/1IiSIZZkFF0B_CcvvPhas-PJhsKFovCWgCLcB/s1600/Workers.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://4.bp.blogspot.com/-Gb4wUVd-bmo/V9VTWhn4DLI/AAAAAAAAdFY/1IiSIZZkFF0B_CcvvPhas-PJhsKFovCWgCLcB/s1600/Workers.png" /></a></div>
<div style="margin-bottom: 0cm;">
<span style="font-size: 14pt;">"Let's change the way we
work ..." The message seems to find its way through
organizations every so often, bread to please the masses, is usually
the true intention. What follows might be a few cheers here and
there, some name / title changes, but in the end the organizational
engine hasn't been changed or upgraded, it has merely be revved up a
little. The standard engine idle soon resumes.</span></div>
<div style="margin-bottom: 0cm;">
<span style="font-size: 14pt;">So what needs to be done to
change the engine or at least maintain a state of "high revs"?
How about some actual changes, changes by the people for the people:)
?<br /></span></div>
<div style="margin-bottom: 0cm;">
<span style="font-size: 14pt;">How do you get your employees
to develop an interest and passion for the systems they create? The
answer may be simpler than most would care to admit… Hand over
control to those who create the system. Handing over control of a
system to a bunch of eager developers may scare the most seasoned
business manager but the results I have found lead to … so far,
only positive things. </span>
</div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: 0px 0px; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: 'Source Serif Pro', serif; line-height: 3.2rem; margin-bottom: 3.2rem; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap;">
</div>
<div style="margin-bottom: 0cm;">
</div>
<h2>
<span style="border: none; display: inline-block; padding: 0cm;"><b><span style="font-size: 14pt;">Accountability</span></b></span></h2>
<div style="margin-bottom: 0cm;">
<span style="font-size: 14pt;">Accountability is established
almost immediately. Since all decisions are made by those creating
the change, accountability inherently falls on the shoulders of these
individuals, all the individuals, and not on the shoulders of a
single manager as is commonly the case. Having a single point of
blame places others in the team at a distance form any chaos that may
arise.</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: 0px 0px; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: 'Source Serif Pro', serif; line-height: 3.2rem; margin-bottom: 3.2rem; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap;">
</div>
<div style="margin-bottom: 0cm;">
</div>
<h2>
<span style="font-size: 14pt;">Motivation</span></h2>
<span style="font-size: 14pt;">Control introduces </span><span style="border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: none; display: inline-block; font-size: 14pt; padding: 0cm;"><b>Motivation</b></span><span style="font-size: 14pt;">.
Most people know what it is that motivates them, that thing that gets
them out of bed every morning. Often money is the direct motivator
but its is also almost never the only motivator. As a software
developer it is often the challenge of creating something new and
useful that get me going and having control over how I introduce that
into my workload is an easy way to inject motivation. For example,
after being given control of our own processes we found adding an
entire “Innovation week” every second week allowed us to inject
motivation. The innovation week has a single rule: Allow developers
to explore any NEW technology, process, framework etc. that will
improve the system. The key here being “NEW”. This forces
developers to think outside the box, pick up a new skill and have a
bit of official fun (fun for us geeky developers :) ) . The
innovation week helps rejuvenate the mind and get us ready for the
following business week.</span><br /><div style="margin-bottom: 0cm;">
<br /><span style="font-size: 14pt;">There are of course challenges
with moving control from managers to the team . For example, who has
the final say should a difference of opinion arise? A simple answer,
assign a lead at the start of each iteration (yes we practice a form
of agile) the lead is appointed by his peers and the lead will have
the final say should conflict arise.</span><br /><br /></div>
<div style="margin-bottom: 0cm;">
<span style="font-size: 14pt;">Inviting change is always
difficult, it introduces feelings of uncertainty and anxiety however
trying to motivate employees by pretending to change the status quo
by renaming a few old processes will often do the opposite. The idea
of self managed teams is by no means a new concept, almost 50% of
fortune 1000 companies reported using such teams.</span><br /></div>
<div style="margin-bottom: 0cm;">
<span style="font-size: 14pt;">Empowerment is key, a company
with agile adaptive teams will inherently position itself as an
adaptive organisation.</span><br /><br /></div>
<div style="margin-bottom: 0cm;">
<span style="font-size: 14pt;">My favourite example of such
an organisation is Semco. An organisation radically changed by it's
CEO Ricardo Semler. Follow the link below for a summary of Ricardo's
book: <a href="https://www.google.co.za/url?sa=t&rct=j&q=&esrc=s&source=web&cd=5&cad=rja&uact=8&ved=0ahUKEwjCleyoqYfPAhWrJsAKHVATBZgQFgg2MAQ&url=http%3A%2F%2Fwww.altfeldinc.com%2Fpdfs%2FMaverick.pdf&usg=AFQjCNF6Kkf58qUKgmgvArI3t7UsmcLQEA&sig2=Hw1Xfcu5GFurY48_vbkZqQ">Mavrick</a>!</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: 0px 0px; background-repeat: initial; background-size: initial; border: 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.701961); font-family: 'Source Serif Pro', serif; line-height: 3.2rem; margin-bottom: 3.2rem; outline: 0px; padding: 0px; vertical-align: baseline; white-space: pre-wrap;">
</div>
J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-86427974435347141642016-05-26T06:50:00.001-07:002016-05-29T08:40:48.169-07:00Docker private repository journey<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-SSY29NwLuHo/V0b9Z5N29fI/AAAAAAAAbTE/pOXcLyv3NL0MtuPRVImm1PhNpfP8hB2cwCKgB/s1600/docker.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://4.bp.blogspot.com/-SSY29NwLuHo/V0b9Z5N29fI/AAAAAAAAbTE/pOXcLyv3NL0MtuPRVImm1PhNpfP8hB2cwCKgB/s1600/docker.png" /></a></div>
<div class="MsoNormal">
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;">Docker Journey<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 18.0pt; line-height: 115%;">Baby steps to greatness…<o:p></o:p></span><br />
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 18.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<div style="text-align: justify;">
<div style="text-align: left;">
<!--[if !supportLists]--><span style="font-size: 8.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">1.<span style="font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 8.0pt; line-height: 115%;">Install
private Docker repository (Nexus 3)<o:p></o:p></span></div>
</div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<div style="text-align: justify;">
<div style="text-align: left;">
<!--[if !supportLists]--><span style="font-size: 8.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">2.<span style="font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 8.0pt; line-height: 115%;">Create
self signed certificate because our signatures rock<o:p></o:p></span></div>
</div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<div style="text-align: justify;">
<div style="text-align: left;">
<!--[if !supportLists]--><span style="font-size: 8.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">3.<span style="font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 8.0pt; line-height: 115%;">Configure
nexus for https connections (required by Docker)<o:p></o:p></span></div>
</div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<div style="text-align: justify;">
<div style="text-align: left;">
<!--[if !supportLists]--><span style="font-size: 8.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">4.<span style="font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 8.0pt; line-height: 115%;">Export
self signed certificate<o:p></o:p></span></div>
</div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<div style="text-align: justify;">
<div style="text-align: left;">
<!--[if !supportLists]--><span style="font-size: 8.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">5.<span style="font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 8.0pt; line-height: 115%;">Import
and Install certificate on Docker client<o:p></o:p></span></div>
</div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<div style="text-align: justify;">
<div style="text-align: left;">
<!--[if !supportLists]--><span style="font-size: 8.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">6.<span style="font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 8.0pt; line-height: 115%;">Setup
nexus repository<o:p></o:p></span></div>
</div>
</div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<div style="text-align: justify;">
<div style="text-align: left;">
<!--[if !supportLists]--><span style="font-size: 8.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">7.<span style="font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-size: 8.0pt; line-height: 115%;">Push
images to nexus </span><span style="font-family: "wingdings"; font-size: 8.0pt; line-height: 115%;">J</span><span style="font-size: 8.0pt; line-height: 115%;"><o:p></o:p></span></div>
</div>
</div>
<div class="MsoNormal">
<br />
<br />
<br /></div>
<div class="MsoNormal">
…Call JMP if you get stuck :)</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo3; text-indent: -.5in;">
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26pt; line-height: 115%; text-indent: -0.5in;"><span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26pt; line-height: 115%; text-indent: -0.5in;">Nexus
Repository Manager</span><!--[if !supportLists]--></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<a href="https://1.bp.blogspot.com/-JdMY05xJA3s/V0b9bOdODnI/AAAAAAAAbTQ/qcmWwOb721IQ-mGeFmJNOBwjCWrgIxzqwCKgB/s1600/nexus.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://1.bp.blogspot.com/-JdMY05xJA3s/V0b9bOdODnI/AAAAAAAAbTQ/qcmWwOb721IQ-mGeFmJNOBwjCWrgIxzqwCKgB/s1600/nexus.png" /></a><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Download the nexus repository manager for
preferred OS, for this killer tutorial I’ll be deploying to Ubuntu but
deploying to Windows should be similar<o:p></o:p></span><br />
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l2 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 12.0pt; line-height: 115%;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Ubuntu download: <a href="http://www.sonatype.com/oss-thank-you-tar.gz"><span style="background: #EBF0F5;">nexus-3.0.0-03-unix.tar.gz</span></a><o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l2 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 12.0pt; line-height: 115%;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Windows download: <a href="http://www.sonatype.com/oss-thank-you-win64.zip"><span style="background: #EBF0F5;">nexus-3.0.0-03-win64.zip</span></a><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;"><br /></span>
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;"><br /></span>
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Extract the tar file to desired location (in my
case <b>~/alchemy/nexus/)</b> using the
command:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;"> <b>tar –xvzf nexus-3.0.0-03-unix.tar.gz<br /><br /><o:p></o:p></b></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;"><b>Setup the service:</b><o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: .5in;">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Create a symbolic
link to the nexus script in the init.d folder:<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-left: .5in; text-indent: .5in;">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">sudo ln -s
$NEXUS_HOME/bin/nexus /etc/init.d/nexus<o:p></o:p></span></b></div>
<div class="MsoNormal" style="text-indent: .5in;">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;"> <b>cd
/etc/init.d<br />
sudo update-rc.d nexus
defaults<br />
sudo service nexus
start </b></span><b><span style="font-family: "gillsans light" , "sans-serif";">(before running start we need to configure some
https stuffs)</span></b><b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;"><br />
<o:p></o:p></span></b></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo3; text-indent: -.5in;">
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;"><span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><!--[endif]--><span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;">Create a self signed
certificate </span><span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 20.0pt; line-height: 115%;">(because our signatures rock)</span><span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;"><o:p></o:p></span><br />
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 20.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">We’re going to use the keytool application to
generate some dodgy certificates, in order to use the keytool you will need to
install java, this can be done by using the apt-get install openjdk-8-jdk
command if your systems doesn’t already have java <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">To generate the certificate run the following
command, the command will create a keystore.jks file in the same folder from
where you ran the command:<br /><br /><o:p></o:p></span></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">keytool
-genkeypair -keystore keystore.jks -storepass Password1 -keypass Password1
-alias jetty -keyalg RSA -keysize 2048 -validity 5000 -dname "CN=10.9.222.43,
OU=Example, O=Sonatype, L=Unspecified, ST=Unspecified, C=US" -ext
"SAN=DNS:scmbdirectory.com,IP:10.9.222.43" -ext
"BC=ca:true"<br /><br /><o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Copy the certificate created to the folder
/etc/ssl/keystore.jks<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo3; text-indent: -.5in;">
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;">Configure Nexus<br /><br /><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Two configuration changes need to happen to get
nexus to support https (which is required by Docker and is better in general) <o:p></o:p></span></div>
<div class="MsoListParagraph" style="mso-list: l3 level1 lfo4; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 12.0pt; line-height: 115%;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Update
$NEXUS_HOME/etc/org.sonatype.nexus.cfg <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Add ${karaf.etc}/jetty-https.xml to the end of
the nexus-args, don’t forget to separate with a comma ie.<o:p></o:p></span></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">nexus-args=${karaf.etc}/jetty.xml,${karaf.etc}/jetty-http.xml,${karaf.etc}/jetty-requestlog.xml,${karaf.etc}/jetty-https.xml<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Add application-port-ssl=8443 <b><o:p></o:p></b></span></div>
<div class="MsoListParagraph" style="mso-list: l3 level1 lfo4; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 12.0pt; line-height: 115%;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Update jetty-https.xml file<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Update the certificate details under the sslContextFactory
tag to look like the following<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 1pt;">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 10.0pt;"> <b> <new class="org.eclipse.jetty.util.ssl.SslContextFactory" id="sslContextFactory"><o:p></o:p></new></b></span></div>
<div class="MsoNormal" style="margin-bottom: 1pt;">
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b><New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory"></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Set name="KeyStorePath">/etc/ssl/keystore.jks</Set></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Set name="KeyStorePassword">Password1</Set></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Set name="KeyManagerPassword">Password1</Set></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Set name="TrustStorePath">/etc/ssl/keystore.jks</Set></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Set name="TrustStorePassword">Password1</Set></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Set name="EndpointIdentificationAlgorithm"></Set></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Set name="NeedClientAuth"><Property name="jetty.ssl.needClientAuth" default="false"/></Set></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Set name="WantClientAuth"><Property name="jetty.ssl.wantClientAuth" default="false"/></Set></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Set name="ExcludeCipherSuites"></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Array type="String"></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Item>SSL_RSA_WITH_DES_CBC_SHA</Item></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Item>SSL_DHE_RSA_WITH_DES_CBC_SHA</Item></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Item>SSL_DHE_DSS_WITH_DES_CBC_SHA</Item></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Item>SSL_RSA_EXPORT_WITH_RC4_40_MD5</Item></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Item>SSL_RSA_EXPORT_WITH_DES40_CBC_SHA</Item></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Item>SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</Item></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> <Item>SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</Item></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> </Array></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> </Set></b></span></span><br />
<span style="font-family: "gillsans light" , sans-serif;"><span style="font-size: 13.3333px;"><b> </New></b></span></span><b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 10.0pt;"> </span></b></div>
<o:p></o:p><br />
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo3; text-indent: -.5in;">
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;">Export certificate <br /><br /><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">We need to export the certificate to be able to
import it into the ubuntu certificate store, client (unsigned certificates) are
saved as .cert while signed certificates are saved as .crt<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">Run the command below from the machine that will
be pushing or pulling images from Nexus<br /><br /><o:p></o:p></span></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">sudo
keytool -printcert -sslserver nexushost:port –rfc (change nexushost to the ip
or host name of the server and port to the https port of nexus)</span></b><span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
Save the output to the file ~/docker.cert<br />
<br /></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo3; text-indent: -.5in;">
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;">Import and Install
certificate <br /><br /><o:p></o:p></span></div>
<div class="MsoNormal">
Create the directory structure /etc/docker/certs.d/nexushost
</div>
<div class="MsoNormal">
Copy the certificate exported above into the folder you just
created.</div>
<div class="MsoNormal">
Run the following command to import the certificate:</div>
<div class="MsoNormal">
<b>sudo
update-ca-certificates<o:p></o:p></b></div>
<div class="MsoNormal">
You may now start the nexus service using:</div>
<div class="MsoNormal">
<b>Sudo service nexus
start<br /><br /><o:p></o:p></b></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo3; text-indent: -.5in;">
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;">Import and Install
certificate <br /><br /><o:p></o:p></span></div>
<div class="MsoNormal">
Login to the nexus admin page using the url <b><a href="https://nexushome:8443/">https://nexushome:8443</a>
</b>at this point https should be working.</div>
<div class="MsoNormal">
Go to the <a href="https://nexushome:8443/#admin/repository/repositories">https://nexushome:8443/#admin/repository/repositories</a>
to configure a docker repository</div>
<div class="MsoNormal">
There are thre types of docker repositories that can be
created when clicking on the “create new” button:</div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l3 level1 lfo4; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]-->Docker (group) Used to link multiple
repositories</div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l3 level1 lfo4; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]-->Docker (hosted) Used to host your own private
repository</div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l3 level1 lfo4; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal;">
</span></span><!--[endif]-->Docker (proxy) Used to link external Docker
repositories like Docker-Hub</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 16.0pt; line-height: 115%;">Docker
(host)<o:p></o:p></span></b></div>
<div class="MsoNormal">
Configure as below, the https port needs to be unique,
docker uses unique ports to identify repositories.</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-FsEhiqPPS-A/V0b9bRdAc8I/AAAAAAAAbTY/4QZjcrIjjRgtHM2jH5g2Gt5khry5YOMbQCKgB/s1600/dockerHost.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="306" src="https://2.bp.blogspot.com/-FsEhiqPPS-A/V0b9bRdAc8I/AAAAAAAAbTY/4QZjcrIjjRgtHM2jH5g2Gt5khry5YOMbQCKgB/s320/dockerHost.png" width="320" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 16.0pt; line-height: 115%;">Docker
(proxy)<o:p></o:p></span></b></div>
<div class="MsoNormal">
Configure as below, the https port needs to be unique,
docker uses unique ports to identify repositories.</div>
<div class="MsoNormal">
<!--[if gte vml 1]><v:shape
id="Picture_x0020_12" o:spid="_x0000_i1026" type="#_x0000_t75" style='width:415.5pt;
height:581.25pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:\Users\PitaJM\AppData\Local\Temp\msohtmlclip1\01\clip_image007.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-GWUTG-O8_74/V0b9aj3wFaI/AAAAAAAAbTY/Vg-UzHJVhmEEwYHHBzl4Icogyk4Kx2MiACKgB/s1600/dockerProxy.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://1.bp.blogspot.com/-GWUTG-O8_74/V0b9aj3wFaI/AAAAAAAAbTY/Vg-UzHJVhmEEwYHHBzl4Icogyk4Kx2MiACKgB/s320/dockerProxy.png" width="231" /></a></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 16.0pt; line-height: 115%;">Docker
(Group)<o:p></o:p></span></b></div>
<div class="MsoNormal">
Configure as below, remember to add Docker repositories to
the group at the bottom</div>
<div class="MsoNormal">
<!--[if gte vml 1]><v:shape
id="Picture_x0020_15" o:spid="_x0000_i1025" type="#_x0000_t75" style='width:418.5pt;
height:580.5pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:\Users\PitaJM\AppData\Local\Temp\msohtmlclip1\01\clip_image009.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-_ceY01_6cGg/V0b9a6XUpJI/AAAAAAAAbTY/0W5b5D_iZ6AVq7Qb78DLfLUfrAUG_fz8ACKgB/s1600/dockergroup.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://3.bp.blogspot.com/-_ceY01_6cGg/V0b9a6XUpJI/AAAAAAAAbTY/0W5b5D_iZ6AVq7Qb78DLfLUfrAUG_fz8ACKgB/s320/dockergroup.png" width="231" /></a></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo3; text-indent: -.5in;">
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoListParagraph" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo3; text-indent: -.5in;">
<span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;"><span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;"> </span></span><!--[endif]--><span style="font-family: "gill sans mt condensed" , "sans-serif"; font-size: 26.0pt; line-height: 115%;">Push Docker image to nexus<br /><br /><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">This is the part we’ve all been waiting for,
pushing a Docker image you just created to the nexus repo.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">First step will be to tag a build<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">To view which images are available run the
following command:<o:p></o:p></span></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">sudo
docker images<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">result:<o:p></o:p></span></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 8.0pt; line-height: 115%;">REPOSITORY TAG IMAGE ID CREATED SIZE<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , sans-serif; font-size: 8pt; line-height: 115%;">jboss-eap 6.4 175002fddb71 44 hours ago 2.221 GB</span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 8.0pt; line-height: 115%;">alchemy-eap-6.4 1.0 70119eab606c 5 weeks ago 2.724 GB<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "gillsans light" , "sans-serif"; font-size: 8.0pt; line-height: 115%;">ubuntu wily b5e09e0cd052 9
weeks ago 136.1 MB<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">sudo
docker login nexushome:port/jboss-eap:6.4<o:p></o:p></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">sudo
docker tag 175002fddb71 nexushome:port/jboss-eap:6.4<o:p></o:p></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">sudo
docker push nexushome:port/jboss-eap:6.4<o:p></o:p></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;">And
that’s all there is to it </span></b><b><span style="font-family: "wingdings"; font-size: 12.0pt; line-height: 115%;">J</span></b><b><span style="font-family: "gillsans light" , "sans-serif"; font-size: 12.0pt; line-height: 115%;"><o:p></o:p></span></b></div>
<div class="MsoNormal">
<br />
Another useful link: <a href="https://books.sonatype.com/nexus-book/3.0/reference/install.html#service-linux">SonaType nexus manual</a>, <a href="https://support.sonatype.com/hc/en-us/articles/217542177-Using-Self-Signed-Certificates-with-Nexus-Repository-Manager-and-Docker-Daemon">KeyTool usage</a>, <a href="https://docs.docker.com/engine/security/certificates/#understanding-the-configuration">Ubuntu certificate storage</a></div>
<br />
<div class="MsoNormal">
<br /></div>
J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-70458681588114859412015-02-04T04:51:00.002-08:002015-02-04T05:04:09.959-08:00OpenShift versus OpenStack ??<span style="font-family: Arial, Helvetica, sans-serif;">I've been looking at simple ways to scale Jboss recently, and I came across OpenStack as well as OpenShift... </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">took me a post or two before I clicked and figured out what the difference was. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">So for anyone who might be wondering what the difference is and whether the to applications compete against each other ... here it is: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"> Firstly OpenShift and OpenStack do not compete against each other they compliment each other, here is why: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"> Both OpenStack and OpenShift Origin are open source projects, and both provide cloud computing foundations. However, </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="http://ddf912383141a8d7bbe4-e053e711fc85de3290f121ef0f0e3a1f.r87.cf1.rackcdn.com/openstack.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://ddf912383141a8d7bbe4-e053e711fc85de3290f121ef0f0e3a1f.r87.cf1.rackcdn.com/openstack.jpg" height="110" width="320" /></a></div>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">OpenStack provides “Infrastructure-as-a-Service”, or “IaaS”. It provides bootable virtual machines, networking, block storage, object storage, and so forth. Some IaaS service providers based on OpenStack are HP Cloud and Rackspace Cloud. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: left;">
<a href="http://www.opencloudconf.com/images/openshift_logo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.opencloudconf.com/images/openshift_logo.png" height="49" width="320" /></a></div>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: left;">
</div>
<span style="font-family: Arial, Helvetica, sans-serif;">OpenShift hosted service provides “Platform-as-a-Service” or “PaaS”. It provides the necessary parts to quickly deploy and run a LAMP application: the web server, application server, application runtimes and libraries, database service, and so forth. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">OpenShift Origin is the open source project of the software that enables the OpenShift hosted service. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Using OpenShift Origin, you can build your own PaaS.
A PaaS typically runs on top of an IaaS provider. For example, both the OpenShift hosted service and the Heroku hosted service run on top of Amazon’s AWS IaaS service. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">And thats it! pretty much. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> So my intended architecture in nutshell will be OpenStack running on Ubuntu and OpenShift on top of OpenStack and JBOSS running on OpenShift :) </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"> And of course here are a couple of useful links: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">http://www.ubuntu.com/cloud/openstack </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">http://www.jboss.org/openshift </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> https://developers.openshift.com/en/java-overview.html</span>J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-70761240394649318662014-05-23T13:17:00.000-07:002014-05-23T13:18:08.059-07:00Drawing thingy 1.0<span style="font-family: Arial, Helvetica, sans-serif;">Loving Ubuntu and the UDOO so far ... starting messing around with the UDOO about a week ago, initially I had installed the android image from the UDOO website but eventually decided to go with Ubuntu just because of how easy it was to develop android sketches. Today I decided to connect an arduino tft shield to the UDOO, the ITDB02 screen was made to fit thearduino mega as well as DUE, it has a very convinient 3V3 / 5V switch. Remeber to switch to 3V3 on the UDOO since it's basically an arduino due which is 3V3 based. </span><br />
<div>
<span style="background-color: black; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<div>
<span style="font-family: Arial, Helvetica, sans-serif;">Anyway here is the video of the quick project, I call it drawing thingy 1.0. The screen was meant to be used for something else but my daughter wanted to draw on the screen so that's what it ultimately became :) </span></div>
<span style="background-color: black; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<div>
</div>
</div>
<div>
<a href="http://1.bp.blogspot.com/-L4sSBm1tzZ0/U3-smEtV4wI/AAAAAAAAJhE/r-DCCMFJRTY/s1600/20140523_204727.mp4" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-L4sSBm1tzZ0/U3-smEtV4wI/AAAAAAAAJhE/r-DCCMFJRTY/s1600/20140523_204727.mp4" /></a></div>
<div>
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span></div>
<div>
<span style="background-color: white;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></span></div>
J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-86676599562365193622014-05-17T12:31:00.000-07:002014-05-18T22:57:40.720-07:00A post to prove a pointA post to prove a point ... mostly to me.<br />
<br />
Finally decided to get right back into the better, wait, best part of engineering ... experimentation :) And the experiment for today? The UDOO, the development platform that take the very popular Arduino platform and merges it with the potent quad core ARM Freescal Cortex-A9 cpu, that's if you ordered the quad core ... why wouldn't you??<br />
<br />
My original mission was to load the android image but that didn't work out as I had hoped mainly because due to display issues. Second mission was to load the linux image which turned out to be the hassle free mission :) and to prove a point this post was posted from the UDOO whooohooo :) The final mission will be to create a zigbit dongle for a special project on the horizon. Once that mission is completed I'll post the how-to's for me mostly since I'll probably forget everything <br />
in the expected 2 week time frame ... a curse :)<br />
<br />
...check out the <a href="http://www.udoo.org/">UDOO</a> website for os images and other funky projects<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-bO4UmK7Dcaw/U3e4Rxk38LI/AAAAAAAAJcc/53jl0wm5cq4/s1600/20140517_211410.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-bO4UmK7Dcaw/U3e4Rxk38LI/AAAAAAAAJcc/53jl0wm5cq4/s1600/20140517_211410.jpg" height="360" width="640" /></a></div>
<br />J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-19313322618848610332013-12-08T00:32:00.001-08:002013-12-08T00:32:51.650-08:00Scribblings <p dir="ltr">Loads of work to do but sometimes the only thing I really feel the urge to do is grab a piece of paper and scribble a couple of lines... Sometimes the scribbles join forces to make something interesting.<br>
</p>
<div class="separator" style="clear: both; text-align: center;"> <a href="http://lh6.ggpht.com/-WD40wUNDLG4/UqQusQ4IFMI/AAAAAAAAGRM/4bVaqw2z8Ek/s1600/20131207_125911.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"> <img border="0" src="http://lh6.ggpht.com/-WD40wUNDLG4/UqQusQ4IFMI/AAAAAAAAGRM/4bVaqw2z8Ek/s640/20131207_125911.jpg"> </a> </div>J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com1tag:blogger.com,1999:blog-594958383481967013.post-65606189618568450612012-07-26T13:23:00.001-07:002012-07-26T13:24:54.970-07:00Religion ... That thing ...<a href="http://1.bp.blogspot.com/-uX9edFW4JZg/UBGnM-TOoGI/AAAAAAAADWo/57qfjLaJ4nQ/s1600/LightWarrior.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="240" src="http://1.bp.blogspot.com/-uX9edFW4JZg/UBGnM-TOoGI/AAAAAAAADWo/57qfjLaJ4nQ/s320/LightWarrior.jpg" width="320" /></a>That thing, that thing we could probably live without but are too afraid to let go of because it just might be the one thing that will save us from some kind of eternal suffering, that thing that governs our choices by placing fear into our deepest thoughts. That thing, that thing called religion ...J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-19563946981320342292012-07-26T13:12:00.002-07:002012-07-26T13:12:23.087-07:00How Great I Am<iframe width="640" height="360" src="http://www.youtube.com/embed/1lDNlwk6Tc0?feature=player_detailpage" frameborder="0" allowfullscreen></iframe>J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-73286935555444713892012-04-28T03:26:00.003-07:002012-04-28T03:30:45.920-07:00Cosmic<div class="separator" style="clear: both; text-align: left;">
<a href="http://3.bp.blogspot.com/-D62bxqiWeHQ/T5vErAJy47I/AAAAAAAACvg/jrb0IY7EGKk/s1600/DanielSimon_CosmicMotors_Banner_Icetrain_01.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-xs_4BxhTHPk/T5vEOrNub8I/AAAAAAAACuw/HdYYwrfKseQ/s1600/DanielSimon_CosmicMotors_SexyMagrela_01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="297" src="http://3.bp.blogspot.com/-xs_4BxhTHPk/T5vEOrNub8I/AAAAAAAACuw/HdYYwrfKseQ/s400/DanielSimon_CosmicMotors_SexyMagrela_01.jpg" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<a href="http://3.bp.blogspot.com/-D62bxqiWeHQ/T5vErAJy47I/AAAAAAAACvg/jrb0IY7EGKk/s1600/DanielSimon_CosmicMotors_Banner_Icetrain_01.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="156" src="http://3.bp.blogspot.com/-D62bxqiWeHQ/T5vErAJy47I/AAAAAAAACvg/jrb0IY7EGKk/s320/DanielSimon_CosmicMotors_Banner_Icetrain_01.jpg" width="320" /></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Recently came across the brilliant designs of Daniel Simon, concept designer, author and producer, with professional roots as Senior Designer at Bugatti and Volkswagen. Clients include Warner Brothers, Universal, Disney, Lotus, Puma or DKNY.</span><br />
<a href="http://2.bp.blogspot.com/-DKnxnKgIfFY/T5vEXx3zACI/AAAAAAAACvA/aep72H8EqNk/s1600/DanielSimon_Sketchbook_001.jpg" imageanchor="1" style="clear: left; display: inline !important; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" height="212" src="http://2.bp.blogspot.com/-DKnxnKgIfFY/T5vEXx3zACI/AAAAAAAACvA/aep72H8EqNk/s320/DanielSimon_Sketchbook_001.jpg" width="320" /></a><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">Daniel's <a href="http://danielsimon.com/">Cosmic-motors</a> label, definitely my favorite of Daniel's portfolio can only be described as out of this world ... for lack of a better description :) Many of the images contain some kind of retro element begging to tell a story, which kinda teleports my mind back to a time when countries battled to against each other ... not on the battlefield instead on race track. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><br />
<a href="http://3.bp.blogspot.com/-labm1tJi70Y/T5vEimGxoxI/AAAAAAAACvQ/zV_u8V3A3Nk/s1600/bbd1927.jpg" imageanchor="1" style="clear: left; display: inline !important; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" height="144" src="http://3.bp.blogspot.com/-labm1tJi70Y/T5vEimGxoxI/AAAAAAAACvQ/zV_u8V3A3Nk/s320/bbd1927.jpg" width="320" /></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The days when Captain Malcolm Campbell in his "Bluebird" battled it out with Major Henry Seagrave in his "Sunbeam"</span><span style="font-family: Arial, Helvetica, sans-serif;"> to become the holder of the land speed record. His website <a href="http://danielsimon.com/">danielsimon.com </a>is definitely worth checking out.</span>J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-35315380436235442432012-02-10T01:35:00.000-08:002012-02-10T01:36:14.685-08:00"Ahhh Cute" moments ...<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-Cb4qlUEhTfw/TzTkzA10pDI/AAAAAAAABcM/VJJIbxJb1jM/s1600/IMG-20120207-WA0000.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/-Cb4qlUEhTfw/TzTkzA10pDI/AAAAAAAABcM/VJJIbxJb1jM/s320/IMG-20120207-WA0000.jpg" width="320" /></a></div>lately it seams my life is filled with what I like to call "ahhh cute" moments, at the center of these "ahhh cute" moments is definitely my little princess Gabriella, who says and does the cutest things usually right after doing something that makes me wanna beat the cute right out of her ... yes she like millions of other children on the planet has the uncanny ability to push a person to the brink of murder... thank God for the Ahh cute moments, a saving grace :)J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-73834662728053114422012-01-16T05:22:00.000-08:002012-01-16T05:24:37.235-08:00A very little duet ... :)Gabriella and her cousin Nadia with their first collaboration ...<br />
<object style="height: 390px; width: 640px;"><param name="movie" value="https://www.youtube.com/v/picasacid?version=3&feature=player_embedded"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="https://www.youtube.com/v/picasacid?version=3&feature=player_embedded" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="360"></object>J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-87097652665343857392011-12-29T04:31:00.000-08:002011-12-29T04:31:10.494-08:00Time and a LatheTime a lathe and some steal is all you need to re-create you very own Ferrari engine ... a 12-cylinder, fuel-injected engine with a dry-sump. The engine in question is 100cc Flat-12, four-stroke internal combustion engine in a flat configuration, with 24 pistons, all scaled done of-course :)<br />
<iframe allowfullscreen="" frameborder="0" height="360" src="http://www.youtube.com/embed/3YfTtGCsiD8?feature=player_embedded" width="640"></iframe>J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-27327104460734963912011-12-15T09:44:00.000-08:002011-12-15T09:44:15.784-08:00Android for life ... for now :)<a href="http://1.bp.blogspot.com/-GweBfCnvSpI/TuoxpVTIa-I/AAAAAAAAAxo/QdbS73rvLJA/s1600/Sketch14322394.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="191" src="http://1.bp.blogspot.com/-GweBfCnvSpI/TuoxpVTIa-I/AAAAAAAAAxo/QdbS73rvLJA/s320/Sketch14322394.jpg" width="320" /></a>Been playing around with Google's Android and so far I'm loving it, haven't used my laptop at home in weeks, pretty much do all my browsing, emailing and even blogging (this was posted using my phone). Have also extended the list of things I do to drawing/ sketching. Started sketching a few concept cars, here's one I did in a few minutes using Sketchbook Mobile ... don't think it's too bad considering I used my index finger as a stylus :)J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-55126941603756585412011-11-21T12:56:00.000-08:002011-11-23T04:09:19.136-08:0094.7 ... Done for 2011<a href="http://1.bp.blogspot.com/-z04kYa--z_M/TszcmM4WxaI/AAAAAAAAAm0/DLT6fkTEVxI/s1600/2011-11-20%2B14.22.27.jpg" imageanchor="1" style="clear: right; display: inline !important; float: right; margin-bottom: 1em; margin-left: 1em; text-align: center;"><img border="0" height="200" src="http://1.bp.blogspot.com/-z04kYa--z_M/TszcmM4WxaI/AAAAAAAAAm0/DLT6fkTEVxI/s200/2011-11-20%2B14.22.27.jpg" width="150" /></a><a href="http://1.bp.blogspot.com/-p5xG4SHEGRA/Tszcl-mH3vI/AAAAAAAAAmo/adqZ0PNCIJE/s1600/2011-11-20%2B14.23.29.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="200" src="http://1.bp.blogspot.com/-p5xG4SHEGRA/Tszcl-mH3vI/AAAAAAAAAmo/adqZ0PNCIJE/s200/2011-11-20%2B14.23.29.jpg" width="150" /></a>Proud to say that on Sunday (20/11/2011) I completed my 7th 94.7 cycling race,reaching the finish line in pretty much the same time as last year ... without any training what so ever ... yes I've been slacking a bit this year. But that didn't hinder my determination to reach the finish .. about 2 minutes slower than last year by the way, not too bad I think :) why had I chosen to put my legs through the anguish yet again? After yesterday I think I realized it's the thrill of over coming the pain, not with an overdose of pain killers but instead with an instrument far more powerful... the mind :) Hill after evil hill it was my mind that tricked my body into thinking of nothing but the refreshing downhill that was sure to follow. Mind over matter?<br />
I like to think so ;)J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-66432352025381305282011-08-28T01:43:00.000-07:002011-08-30T00:57:44.352-07:00Dance RevolutionHad an awesome weekend at Sun City... well except for the sub zero water temperature which didn't seem to bother Gabriella (My little princess) too much, she turns into a bit of a psycho when it comes to water ... she loves it, freezing or not :) perhaps all the dancing helped keep her and her cousin Nadia warm, I just pray this isn't a preview of things to come, two cousins sneaking off to clubs forcing their dads to follow, shotguns locked and loaded ;) <br />
<br />
<br />
<br />
<center><iframe allowfullscreen="" frameborder="0" height="349" src="http://www.youtube.com/embed/cUtC6HRkz-c?hl=en&fs=1" width="425"></iframe></center>J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-30398479641198422352011-07-31T09:05:00.000-07:002011-08-01T05:26:36.393-07:00Home automation<div class="separator" style="clear: both; text-align: center;"></div><div style="text-align: left;"><a href="http://1.bp.blogspot.com/-J5zoiWTJ-vM/TjV_A0u3sQI/AAAAAAAAAcI/ks4Nt6VJBcg/s1600/big_design.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="228" src="http://1.bp.blogspot.com/-J5zoiWTJ-vM/TjV_A0u3sQI/AAAAAAAAAcI/ks4Nt6VJBcg/s320/big_design.jpg" width="320" /></a></div>The idea of completely automating my house has been etched into my mind since I started building my house ... yes it's still a work in progress although most modules have been completed :)<br />
<div>After playing around with the arduino system the etched idea seems closer to reality. I've started with the basics, switching on a single 220v lamp, the "hello world" of embedded systems. Switching on the lamp with a microcontroller was just way too simple so I took it one step further and added a web server to the arduino so that the lamp could be controlled via a web page ... the world is now open with possibilities and the dream of automating EVERYTHING has become reality, well kind of, it's still a work in progress. Step one will be controlling all lights in the house, step two ... well that'll be a follow up post :) </div><div><br />
</div><div>Check out my super awesome circuit for controlling a lamp via a web page demo ... As a test I got my <a href="http://deliateixeira.com/">cousin</a> in Portugal (I'm in South Africa) to switch on the light, awesome stuff :) </div><br />
<center> <div><object style="height: 390px; width: 640px;"><param name="movie" value="http://www.youtube.com/v/1g5itTS6lbw?version=3"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><embed src="http://www.youtube.com/v/1g5itTS6lbw?version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390"></object></div></center>J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-69319314420107524592011-07-31T04:35:00.000-07:002011-07-31T04:35:32.689-07:00Just a speck in the universeEver had the overwhelming thought of insignificance consume your mind ?? well that's exactly how I'd describe the feeling I had after watching this clip. Besides making you feel super tiny it also makes you feel that if you ever had any dreams of being the extraordinary speck in life, the one known and respected across the cosmos then there's definitely a titanic challenge ahead of you, unless of course earth will suffice ... maybe just for now :)<br />
<div></div><br />
<center><br />
<div><object height="390" width="640"><param name="movie" value="http://www.youtube.com/v/HEheh1BH34Q&hl=en_US&feature=player_embedded&version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/HEheh1BH34Q&hl=en_US&feature=player_embedded&version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390"></embed></object></div></center>J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-88866150304479665072011-07-16T02:13:00.000-07:002011-07-16T09:22:37.824-07:00Creativity and time :)<div class="separator" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" src="http://3.bp.blogspot.com/-naAdFxrWN8k/TiFXSz2jdzI/AAAAAAAAAcE/cvDvdoY8PBM/s1600/bigbangboom.jpg" /></div>A lot of time and a tons of creativity goes a long way in explaining how it all began ...<br />
<br />
"BIG BANG BIG BOOM:<br />
an unscientific point of view on the beginning and evolution of life ... and how it could probably end."<br />
<br />
check out the animation ...<br />
<br />
<br />
<br />
<br />
<center><iframe frameborder="0" height="300" src="http://player.vimeo.com/video/13085676?title=0&byline=0&portrait=0" width="400"></iframe><br />
<br />
<a href="http://vimeo.com/13085676">BIG BANG BIG BOOM - the new wall-painted animation by BLU</a> from <a href="http://vimeo.com/blu">blu</a> on <a href="http://vimeo.com/">Vimeo</a>.</center>J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com1tag:blogger.com,1999:blog-594958383481967013.post-14216738078840091812011-07-09T23:36:00.000-07:002016-05-29T11:33:02.992-07:00Fear not war<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-3E9bUfOjPT0/ThjNWe8nfSI/AAAAAAAAAcA/MkPvHXPVs0U/s1600/sun-tzu-samurai-494x334.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="216" src="https://4.bp.blogspot.com/-3E9bUfOjPT0/ThjNWe8nfSI/AAAAAAAAAcA/MkPvHXPVs0U/s320/sun-tzu-samurai-494x334.jpg" width="320" /></a></div>
Fear not war, but those who would see it rise again.<br />
<br />
Is conflict ever necessary? Ideally we'd all like to think not, we want to believe that when the time comes we'll choose peace, resolution will be found without lifting the sword. Unfortunately it seems the beast in us sometimes feels the need to show itself. Without warning this patron of conflict pushes reason aside and takes the helm. Freedom from rational decision, an overdose of irrational thought consumes the mind and ultimately patrons of conflict we become...<br />
This freedom has its price, once the fog of war settles and ammunition has been spent the beast returns to its lair, no longer interested in leading the fight. Reason takes the helm and is left with devastation ahead; a road not easily travelled but an essential journey never the less.<br />
Once the journey has been made and peace seems certain, a time of reflection soon arrives ... was the beast a necessary evil? Would we have known peace without war?<br />
Though we would not dare see war rise up from the ashes we believed it lay dead under, war like peace like the phoenix will rise again.<br />
<br />
By JoseJ@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0tag:blogger.com,1999:blog-594958383481967013.post-14287928067441474672011-05-14T02:24:00.000-07:002011-05-14T02:24:05.708-07:00reviving the arcade ..<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-uuDz5JR4UYI/TcwsmwL75cI/AAAAAAAAAb0/ZiGUSSMmFPg/s1600/pacman_1.gif" imageanchor="1" style="clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="240" j8="true" src="http://2.bp.blogspot.com/-uuDz5JR4UYI/TcwsmwL75cI/AAAAAAAAAb0/ZiGUSSMmFPg/s320/pacman_1.gif" width="320" /></a></div>Remember when just about every shopping center had an arcade ? It seems the age of the cheaper gaming console has seen an abrupt end to the age of the arcade. The era may have ended but the memories of awesome games like After-Burner, Street-Fighter and even cheesy but ultra addictive games like Pac-Man live on. Well perhaps they don't need to be just memories, enter the Pita brothers latest project ... the game genie. Game genie ?? This is a project I started about a year ago to bring back the affordable arcade machine that would hopefully re-ignite the age of the arcade or at least spark the interest of the nostalgic gamer. The project also served as a training platform to sharpen my welding skills :)<br />
<br />
So what exactly is the game genie ?? <br />
<br />
<div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-guOsjqt1unE/TcwpkozLTYI/AAAAAAAAAbs/Bnhr-r4sML0/s1600/IMG_0435.JPG" imageanchor="1" style="clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" j8="true" src="http://3.bp.blogspot.com/-guOsjqt1unE/TcwpkozLTYI/AAAAAAAAAbs/Bnhr-r4sML0/s320/IMG_0435.JPG" width="240" /></a></div>Well its arcade machine that was built with modularity in mind ... kinda like the way I built my<a href="http://josemanuelpita.blogspot.com/2010/02/modular-design-and-spirals.html"> house</a>. <br />
<div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;">The arcade machine has been built to very easily be transformed to accommodate a standard control panel, steering wheel or even be transformed into a juke box :) The games are easily loaded using a control board designed by us .. sorry a bot of a secret so i won't reveal too much about this board.</div>The game genie also has a LCD monitor instead of the traditional crt monitor which makes the unit way lighter and easier to maintain :) The machine is also made almost completely out of 3mm steel sheeting as well as 5mm angle iron perfect for the slightly violent gamer :)<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"><div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"><a href="http://1.bp.blogspot.com/-f2vwwsa3SOA/TcwuYzvWYwI/AAAAAAAAAb8/PmiIdpAgWZA/s1600/IMG_0425.JPG" imageanchor="1" style="clear: right; cssfloat: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" j8="true" src="http://1.bp.blogspot.com/-f2vwwsa3SOA/TcwuYzvWYwI/AAAAAAAAAb8/PmiIdpAgWZA/s200/IMG_0425.JPG" width="150" /></a><a href="http://2.bp.blogspot.com/-0DPJkDhmP5A/TcwtxyZj1_I/AAAAAAAAAb4/mW9efQqOC6Y/s1600/IMG_0418.JPG" imageanchor="1" style="clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" j8="true" src="http://2.bp.blogspot.com/-0DPJkDhmP5A/TcwtxyZj1_I/AAAAAAAAAb4/mW9efQqOC6Y/s200/IMG_0418.JPG" width="200" /></a>The control panel is not made of steel but pine wood which I stained black and varnished to make it a bit more durable. The buttons used are the traditional very durable arcade buttons designed to take a beating.</div><div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"><div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"><a href="http://4.bp.blogspot.com/-AEVCXab2Jlo/TcwsJeyc7_I/AAAAAAAAAbw/6jLE0kNCIqU/s1600/IMG_0422.JPG" imageanchor="1" style="clear: left; cssfloat: right; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" j8="true" src="http://4.bp.blogspot.com/-AEVCXab2Jlo/TcwsJeyc7_I/AAAAAAAAAbw/6jLE0kNCIqU/s200/IMG_0422.JPG" width="200" /></a>Wiring up the control panel is very simple and basically involves connecting a separate wire to each button the a common wire from one button to the next.</div></div></div><div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"><br />
<div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;">The final test of-course will be to let the machine out into the wild world, after my daughter got a test run that is :) <br />
<br />
</div></div>J@$Ehttp://www.blogger.com/profile/16115502567218392647noreply@blogger.com0