<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>ChromiteBlue.com</title>
	<atom:link href="http://chromiteblue.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://chromiteblue.com</link>
	<description></description>
	<pubDate>Thu, 28 Oct 2010 15:51:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Converting upper/lower case on the command line in Linux</title>
		<link>http://chromiteblue.com/archive/coding/converting-upperlower-case-on-the-command-line-in-linux/</link>
		<comments>http://chromiteblue.com/archive/coding/converting-upperlower-case-on-the-command-line-in-linux/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 15:50:09 +0000</pubDate>
		<dc:creator>ChromiteBlue</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Bash]]></category>

		<category><![CDATA[Examples]]></category>

		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://chromiteblue.com/?p=278</guid>
		<description><![CDATA[A quick and simple way to convert upper/lower case on the command line in Linux  is to use the &#8220;tr&#8221; (translate) utility.
To convert uppercase to lowercase:

tr [A-Z] [a-z]

To convert lowercase to uppercase:

tr [a-z] [A-Z]

And in a shell script:

VALUE="A Mixed Case String"
UPPER=`echo $VALUE &#124; tr [a-z] [A-Z]`
LOWER=`echo $VALUE &#124; tr [A-Z] [a-z]`

]]></description>
			<content:encoded><![CDATA[<p>A quick and simple way to convert upper/lower case on the command line in Linux  is to use the &#8220;tr&#8221; (translate) utility.</p>
<p>To convert uppercase to lowercase:</p>
<pre class="console">
tr [A-Z] [a-z]
</pre>
<p>To convert lowercase to uppercase:</p>
<pre class="console">
tr [a-z] [A-Z]
</pre>
<p>And in a shell script:</p>
<pre class="code">
VALUE="A Mixed Case String"
UPPER=`echo $VALUE | tr [a-z] [A-Z]`
LOWER=`echo $VALUE | tr [A-Z] [a-z]`
</pre>
]]></content:encoded>
			<wfw:commentRss>http://chromiteblue.com/archive/coding/converting-upperlower-case-on-the-command-line-in-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Eagle3D update</title>
		<link>http://chromiteblue.com/archive/projects/eagle3d-projects/eagle3d-update/</link>
		<comments>http://chromiteblue.com/archive/projects/eagle3d-projects/eagle3d-update/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 22:14:08 +0000</pubDate>
		<dc:creator>ChromiteBlue</dc:creator>
		
		<category><![CDATA[Eagle3D]]></category>

		<guid isPermaLink="false">http://chromiteblue.com/?p=270</guid>
		<description><![CDATA[I am actively submitting to the Eagle3D project, the components available on this site will be in the stock Eagle3D soon.
]]></description>
			<content:encoded><![CDATA[<p>I am actively submitting to the Eagle3D project, the components available on this site will be in the stock Eagle3D soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://chromiteblue.com/archive/projects/eagle3d-projects/eagle3d-update/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Makefile for NXC code</title>
		<link>http://chromiteblue.com/archive/projects/nxt/a-makefile-for-nxc-code/</link>
		<comments>http://chromiteblue.com/archive/projects/nxt/a-makefile-for-nxc-code/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 20:52:54 +0000</pubDate>
		<dc:creator>ChromiteBlue</dc:creator>
		
		<category><![CDATA[NXT]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[NBC]]></category>

		<category><![CDATA[NXC]]></category>

		<guid isPermaLink="false">http://chromiteblue.com/?p=249</guid>
		<description><![CDATA[
# A Makefile to compile NXC code using NBC
# Copyright (C) 2008 Gary French
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# [...]]]></description>
			<content:encoded><![CDATA[<pre class="code">
# A Makefile to compile NXC code using NBC
# Copyright (C) 2008 Gary French
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#

INCLUDEDIR =../include
NBC=/usr/local/bin/nbc
NBC_FLAGS=-I=$(INCLUDEDIR)
#optional compiler optimizations
# NBC_FLAGS=-I=$(INCLUDEDIR) -Z1
# NBC_FLAGS=-I=$(INCLUDEDIR) -Z2

#this can also be explicitly set
# NXC_FILES := TheProgram.nxc
NXC_FILES := $(shell ls -1 -t -F *.nxc  2>/dev/null | grep '\.nxc')
RXE_FILES := $(NXC_FILES:.nxc=.rxe)

BYTECODE_FILES := $(NXC_FILES:.nxc=.bytecode)
LISTING_FILES := $(NXC_FILES:.nxc=.listing)
SYMTABLE_FILES := $(NXC_FILES:.nxc=.symtable)

#the targets can be called individually, or called from the "all" target
#all: compile bytecode listing symtable
all: compile

compile: $(RXE_FILES)
%.rxe: $(NXC_FILES)
	@echo "compiling $<"
	$(NBC) $(NBC_FLAGS) -O=$@ $<
	@echo

bytecode: $(BYTECODE_FILES)
%.bytecode: $(NXC_FILES)
	@echo "generating bytecode for $<"
	$(NBC) $(NBC_FLAGS) -b -nbc=$@ $<
	@echo

listing: $(LISTING_FILES)
%.listing: $(NXC_FILES)
	@echo "generating code listing for $<"
	$(NBC) $(NBC_FLAGS) -b -L=$@ $<
	@echo

symtable: $(SYMTABLE_FILES)
%.symtable: $(NXC_FILES)
	@echo "generating symbol table for $<"
	$(NBC) $(NBC_FLAGS) -b -Y=$@ $<
	@echo

clean:
	@echo "cleaning up..."
	-rm $(RXE_FILES)
	-rm $(BYTECODE_FILES)
	-rm $(LISTING_FILES)
	-rm $(SYMTABLE_FILES)
	@echo

.PHONY: clean bytecode listing symtable
</pre>
]]></content:encoded>
			<wfw:commentRss>http://chromiteblue.com/archive/projects/nxt/a-makefile-for-nxc-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Compiling and Transfering NXC Code to a NXT-Brick Under Fedora Linux</title>
		<link>http://chromiteblue.com/archive/projects/nxt/compiling-and-transfering-nxc-code-to-a-nxt-brick-under-fedora-linux/</link>
		<comments>http://chromiteblue.com/archive/projects/nxt/compiling-and-transfering-nxc-code-to-a-nxt-brick-under-fedora-linux/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 00:36:43 +0000</pubDate>
		<dc:creator>ChromiteBlue</dc:creator>
		
		<category><![CDATA[NXT]]></category>

		<category><![CDATA[Fedora]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[NXC]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://chromiteblue.com/?p=175</guid>
		<description><![CDATA[you must be able to communicate with the NXT Brick for any of the following to be applicable. there are a few &#8220;how-to&#8221;s available, including this post.
I am using the compiler available at Next Byte Codes &#038; Not eXactly C site. This is a simple package package to &#8220;install&#8221; (simply copying the executable from the [...]]]></description>
			<content:encoded><![CDATA[<p>you must be able to communicate with the NXT Brick for any of the following to be applicable. there are a few &#8220;how-to&#8221;s available, including <a href="http://chromiteblue.com/archive/projects/nxt/setting-up-bluetooth-communication-with-a-nxt-brick-under-fedora-linux/">this</a> post.</p>
<p>I am using the compiler available at <a href="http://bricxcc.sourceforge.net/nbc/">Next Byte Codes &#038; Not eXactly C</a> site. This is a simple package package to &#8220;install&#8221; (simply copying the executable from the tar/gzip to /usr/local/bin did it for me), and is wonderfully documented.</p>
<p>I am using a modified version of a script provided by <a href="http://jan.kollhof.net/">Jan-Klaas Kollhof</a>:</p>
<pre class="code">
#!/bin/sh
set -e

_nbcpath=/PATH/TO/NBC/EXECUTABLE/DIRECTORY

_dirname=`dirname $1`
if [ "${_dirname}" == "." ]; then
	_dirname=$(pwd)
fi
_basename=`basename $1 .nxc`

echo "compiling ${_basename}.rxe from ${_basename}.nxc..."
${_nbcpath}/nbc \
	-O="${_dirname}/${_basename}.rxe" \
	-nbc="${_dirname}/${_basename}.nbc" \
		"${_dirname}/${_basename}.nxc"

echo "sending ${_basename}.rxe to brick..."
cd "${_dirname}"
nxt_push "${_basename}.rxe"
</pre>
<p>as should be apparent, /PATH/TO/NBC/EXECUTABLE/DIRECTORY will need to be altered to suit your environment.</p>
<p>the &#8220;-nbc&#8221; switch will save the generated &#8220;Next Byte Code&#8221; to YOUR_CODE_FILE_NAME.nbc. the resulting file is not only interesting to poke around in, but may help when optimizing for size.</p>
<p>currently, I am having some issues with nxt_python, documented <a href="http://chromiteblue.com/archive/projects/nxt/error-operation-now-in-progress-while-using-nxt_python/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://chromiteblue.com/archive/projects/nxt/compiling-and-transfering-nxc-code-to-a-nxt-brick-under-fedora-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>nxt_pull, a companion program for nxt_push</title>
		<link>http://chromiteblue.com/archive/projects/nxt/nxt_pull-a-companion-program-for-nxt_push/</link>
		<comments>http://chromiteblue.com/archive/projects/nxt/nxt_pull-a-companion-program-for-nxt_push/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 00:25:25 +0000</pubDate>
		<dc:creator>ChromiteBlue</dc:creator>
		
		<category><![CDATA[NXT]]></category>

		<category><![CDATA[Fedora]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://chromiteblue.com/?p=224</guid>
		<description><![CDATA[while working with nxt_python and a few applications written in NXC, I found I had a need to get files from the NXT Brick with a minimum of fuss. The following python script will &#8220;pull&#8221; a single file from the NXT Brick. Wildcard behavior is undefined, and is planned for version 0.2.
example usage:

[gary@motoko]# nxt_pull log.txt

code:

#!/usr/bin/env [...]]]></description>
			<content:encoded><![CDATA[<p>while working with nxt_python and a few applications written in NXC, I found I had a need to get files from the NXT Brick with a minimum of fuss. The following python script will &#8220;pull&#8221; a single file from the NXT Brick. Wildcard behavior is undefined, and is planned for version 0.2.</p>
<p>example usage:</p>
<pre class="console">
[gary@motoko]# nxt_pull log.txt
</pre>
<p>code:</p>
<pre class="code">
#!/usr/bin/env python
#
# nxt_pull:
#   Pull a file to a LEGO Mindstorms NXT brick,
#   based on Douglas P Lau's nxt_filer and nxt_push
#   Copyright (C) 2008 Gary French
#   Version: 0.1
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

import sys
import nxt.locator
from nxt.brick import FileFinder, FileReader, FileWriter

def read_file( b, fname ):
	r = FileReader(b, fname)
	r.__enter__()
	try:
		f = open(fname, 'wb')
		print 'Pulling %s ...' % (fname),
		try:
			size = 0
			for data in r:
				f.write(data)
				size += len(data)
		finally:
			f.close()
			print 'read %d bytes' % size
	finally:
		r.__exit__(None, None, None)

if __name__ == '__main__':
	sock = nxt.locator.find_one_brick()
	#sock = nxt.locator.find_one_brick(host='00:16:53:XX:XX:XX')
	if sock:
		b = sock.connect()
		read_file( b, sys.argv[1] )
		sock.close()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://chromiteblue.com/archive/projects/nxt/nxt_pull-a-companion-program-for-nxt_push/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Error: &#8220;bluetooth.BluetoothError: (115, &#8216;Operation now in progress&#8217;)&#8221; while using nxt_python</title>
		<link>http://chromiteblue.com/archive/projects/nxt/error-operation-now-in-progress-while-using-nxt_python/</link>
		<comments>http://chromiteblue.com/archive/projects/nxt/error-operation-now-in-progress-while-using-nxt_python/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 23:54:28 +0000</pubDate>
		<dc:creator>ChromiteBlue</dc:creator>
		
		<category><![CDATA[NXT]]></category>

		<category><![CDATA[Fedora]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://chromiteblue.com/?p=217</guid>
		<description><![CDATA[currently, to avoid a &#8220;bluetooth.BluetoothError: (115, &#8216;Operation now in progress&#8217;)&#8221; error, I have to:

turn the Brick&#8217;s Bluetooth off
turn off the Brick
restart Bluetooth services
turn on the Brick
turn the Brick&#8217;s Bluetooth on

it acts as if something is not cleaning up after itself properly.
I&#8217;m sure I&#8217;ll figure that one out, but I have more pressing concerns at the [...]]]></description>
			<content:encoded><![CDATA[<p>currently, to avoid a &#8220;bluetooth.BluetoothError: (115, &#8216;Operation now in progress&#8217;)&#8221; error, I have to:
<ol>
<li>turn the Brick&#8217;s Bluetooth off</li>
<li>turn off the Brick</li>
<li>restart Bluetooth services</li>
<li>turn on the Brick</li>
<li>turn the Brick&#8217;s Bluetooth on</li>
</ol>
<p>it acts as if something is not cleaning up after itself properly.<br />
I&#8217;m sure I&#8217;ll figure that one out, but I have more pressing concerns at the moment. if anyone has some insight on this issue I&#8217;d appreciate the comment.</p>
<p>current workaround:
<ul>
<li>use &#8220;hcitool scan&#8221; to find the MAC</li>
<li>modify nxt_push line 49 from:
<pre class="code">sock = nxt.locator.find_one_brick()</pre>
<p>to:</p>
<pre class="code">sock = nxt.locator.find_one_brick(host='00:16:53:XX:XX:XX')</pre>
</li>
</ul>
<p>as one might suspect, this workaround is applicable in any other similar situation.</p>
]]></content:encoded>
			<wfw:commentRss>http://chromiteblue.com/archive/projects/nxt/error-operation-now-in-progress-while-using-nxt_python/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Setting up Bluetooth communication with a NXT Brick under Fedora linux</title>
		<link>http://chromiteblue.com/archive/projects/nxt/setting-up-bluetooth-communication-with-a-nxt-brick-under-fedora-linux/</link>
		<comments>http://chromiteblue.com/archive/projects/nxt/setting-up-bluetooth-communication-with-a-nxt-brick-under-fedora-linux/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 19:26:54 +0000</pubDate>
		<dc:creator>ChromiteBlue</dc:creator>
		
		<category><![CDATA[NXT]]></category>

		<category><![CDATA[Bluetooth]]></category>

		<category><![CDATA[Fedora]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://chromiteblue.com/?p=186</guid>
		<description><![CDATA[it is vital that the following python packages are installed:

NXT Python
PyBlueZ for Bluetooth communication

to test PyBlueZ, the following can be used (code by Albert Huang &#60;albert@csail.mit.edu&#62;)

#!/usr/bin/env python
import bluetooth
print "performing inquiry..."
nearby_devices = bluetooth.discover_devices(lookup_names = True)
print "found %d devices" % len(nearby_devices)
for name, addr in nearby_devices:
    print "  %s - %s" % (addr, name)


as [...]]]></description>
			<content:encoded><![CDATA[<p>it is vital that the following python packages are installed:
<ul>
<li><a href="http://home.comcast.net/~dplau/nxt_python/index.html">NXT Python</a></li>
<li><a href="http://code.google.com/p/pybluez/">PyBlueZ</a> for Bluetooth communication</li>
</ul>
<p>to test PyBlueZ, the following can be used (code by Albert Huang &lt;albert@csail.mit.edu&gt;)</p>
<pre class="code">
#!/usr/bin/env python
import bluetooth
print "performing inquiry..."
nearby_devices = bluetooth.discover_devices(lookup_names = True)
print "found %d devices" % len(nearby_devices)
for name, addr in nearby_devices:
    print "  %s - %s" % (addr, name)
</pre>
</p>
<p>as I do not care for gnome, my default desktop is KDE,<br />
what follows is my procedure for pairing with a NXT Brick.</p>
<pre class="console">
[root@motoko]# /usr/bin/bluetooth-applet &#038;
</pre>
<p>a Bluetooth icon will appear in your system tray,</p>
<p>right-click the Bluetooth icon and click &#8220;Preferences&#8221; from the popup.
<ul>
<li>set the radio button under &#8220;Mode of operation&#8221; to be &#8220;Visible and connectable for other devices&#8221;<br />
(even if it ought to be &#8220;connectible&#8221;)</li>
<li>click &#8220;Close&#8221;</li>
</ul>
<p>on the NXT Brick, from the root menu,
<ul>
<li>select &#8220;Bluetooth&#8221; and press the square button.</li>
<li>select &#8220;Search&#8221; and press the square button.</li>
<li>after it has finished searching, select the name that matches your computer and press the square button.</li>
<li>select &#8220;[1]&#8221; and press the square button.</li>
<li>wait for it to connect.</li>
<li>enter passkey, or press the square button for the &#8220;1234&#8243; default.</li>
<li>Bluetooth icon will begin to blink, click it and enter the passkey in the resulting dialog.</li>
<li>right-click the Bluetooth icon and click &#8220;Preferences&#8221; from the popup.
<ul>
<li>select the NXT Brick in the &#8220;Bonded devices&#8221; box.</li>
<li>Click &#8220;Set Trusted&#8221;</li>
<li>click &#8220;Close&#8221;</li>
</ul>
</ul>
<p>the connection can now be tested with the following python code:</p>
<pre class="code">
#!/usr/bin/env python
import nxt.locator
sock = nxt.locator.find_one_brick()
if sock:
	brick = sock.connect()
	name, host, signal_strength, user_flash = brick.get_device_info()
	print 'NXT brick name: %s' % name
	print 'Host address: %s' % host
	print 'Bluetooth signal strength: %s' % signal_strength
	print 'Free user flash: %s' % user_flash
	sock.close()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://chromiteblue.com/archive/projects/nxt/setting-up-bluetooth-communication-with-a-nxt-brick-under-fedora-linux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>NXT Puzzlebot</title>
		<link>http://chromiteblue.com/archive/projects/nxt/nxt-puzzlebot-01/</link>
		<comments>http://chromiteblue.com/archive/projects/nxt/nxt-puzzlebot-01/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 17:56:32 +0000</pubDate>
		<dc:creator>ChromiteBlue</dc:creator>
		
		<category><![CDATA[NXT]]></category>

		<category><![CDATA[NXC]]></category>

		<guid isPermaLink="false">http://chromiteblue.com/?p=172</guid>
		<description><![CDATA[not much yet, but with two development forks we&#8217;ll probably have something workable soon.
&#160;
&#160;
as of 11/16/2008:
a few test ideas.
&#160;
&#160;
as of 11/22/2008:
some general refinements, and the software to raise and lower the whatever-the-hell-that-is is working.
&#160;
&#160;
PuzzleBot - 2008-11-28
]]></description>
			<content:encoded><![CDATA[<p>not much yet, but with two development forks we&#8217;ll probably have something workable soon.<br />
&nbsp;<br />
&nbsp;<br />
as of 11/16/2008:<br />
a few test ideas.<br /><div class="ngg-galleryoverview" id="ngg-gallery-21"><div id="ngg-image-120" class="ngg-gallery-thumbnail-box ">
	<div class="ngg-gallery-thumbnail"  >
	<a id="thumb120" href="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/HPIM0216.JPG" title="" class="thickbox" rel="puzzlebot" ><img title="HPIM0216.JPG" alt="HPIM0216.JPG" src="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/thumbs/thumbs_HPIM0216.JPG" style="width:100px; height:75px;" /></a>
</div>
</div>
<div id="ngg-image-121" class="ngg-gallery-thumbnail-box ">
	<div class="ngg-gallery-thumbnail"  >
	<a id="thumb121" href="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/HPIM0217.JPG" title="" class="thickbox" rel="puzzlebot" ><img title="HPIM0217.JPG" alt="HPIM0217.JPG" src="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/thumbs/thumbs_HPIM0217.JPG" style="width:100px; height:75px;" /></a>
</div>
</div>
<div id="ngg-image-122" class="ngg-gallery-thumbnail-box ">
	<div class="ngg-gallery-thumbnail"  >
	<a id="thumb122" href="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/HPIM0218.JPG" title="" class="thickbox" rel="puzzlebot" ><img title="HPIM0218.JPG" alt="HPIM0218.JPG" src="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/thumbs/thumbs_HPIM0218.JPG" style="width:100px; height:75px;" /></a>
</div>
</div>
<div id="ngg-image-123" class="ngg-gallery-thumbnail-box ">
	<div class="ngg-gallery-thumbnail"  >
	<a id="thumb123" href="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/HPIM0219.JPG" title="" class="thickbox" rel="puzzlebot" ><img title="HPIM0219.JPG" alt="HPIM0219.JPG" src="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/thumbs/thumbs_HPIM0219.JPG" style="width:100px; height:75px;" /></a>
</div>
</div>
<div id="ngg-image-124" class="ngg-gallery-thumbnail-box ">
	<div class="ngg-gallery-thumbnail"  >
	<a id="thumb124" href="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/HPIM0220.JPG" title="" class="thickbox" rel="puzzlebot" ><img title="HPIM0220.JPG" alt="HPIM0220.JPG" src="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/thumbs/thumbs_HPIM0220.JPG" style="width:100px; height:75px;" /></a>
</div>
</div>
<div id="ngg-image-125" class="ngg-gallery-thumbnail-box ">
	<div class="ngg-gallery-thumbnail"  >
	<a id="thumb125" href="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/HPIM0221.JPG" title="" class="thickbox" rel="puzzlebot" ><img title="HPIM0221.JPG" alt="HPIM0221.JPG" src="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/thumbs/thumbs_HPIM0221.JPG" style="width:100px; height:75px;" /></a>
</div>
</div>
<div id="ngg-image-126" class="ngg-gallery-thumbnail-box ">
	<div class="ngg-gallery-thumbnail"  >
	<a id="thumb126" href="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/HPIM0222.JPG" title="" class="thickbox" rel="puzzlebot" ><img title="HPIM0222.JPG" alt="HPIM0222.JPG" src="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/thumbs/thumbs_HPIM0222.JPG" style="width:100px; height:75px;" /></a>
</div>
</div>
<div id="ngg-image-127" class="ngg-gallery-thumbnail-box ">
	<div class="ngg-gallery-thumbnail"  >
	<a id="thumb127" href="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/HPIM0223.JPG" title="" class="thickbox" rel="puzzlebot" ><img title="HPIM0223.JPG" alt="HPIM0223.JPG" src="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/thumbs/thumbs_HPIM0223.JPG" style="width:100px; height:75px;" /></a>
</div>
</div>
<div id="ngg-image-128" class="ngg-gallery-thumbnail-box ">
	<div class="ngg-gallery-thumbnail"  >
	<a id="thumb128" href="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/HPIM0224.JPG" title="" class="thickbox" rel="puzzlebot" ><img title="HPIM0224.JPG" alt="HPIM0224.JPG" src="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-01/thumbs/thumbs_HPIM0224.JPG" style="width:100px; height:75px;" /></a>
</div>
</div>
</div>
<div class='ngg-clear'></div>
<br />
&nbsp;<br />
&nbsp;<br />
as of 11/22/2008:<br />
some general refinements, and the software to raise and lower the whatever-the-hell-that-is is working.<br /><div class="ngg-galleryoverview" id="ngg-gallery-22"><div id="ngg-image-129" class="ngg-gallery-thumbnail-box ">
	<div class="ngg-gallery-thumbnail"  >
	<a id="thumb129" href="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-02/HPIM0225.JPG" title="" class="thickbox" rel="puzzlebot-02" ><img title="HPIM0225.JPG" alt="HPIM0225.JPG" src="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-02/thumbs/thumbs_HPIM0225.JPG" style="width:100px; height:75px;" /></a>
</div>
</div>
<div id="ngg-image-130" class="ngg-gallery-thumbnail-box ">
	<div class="ngg-gallery-thumbnail"  >
	<a id="thumb130" href="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-02/hanoi-2.jpg" title="" class="thickbox" rel="puzzlebot-02" ><img title="hanoi-2.jpg" alt="hanoi-2.jpg" src="http://chromiteblue.com/wp/wp-content/gallery/nxt/puzzlebot-02/thumbs/thumbs_hanoi-2.jpg" style="width:100px; height:75px;" /></a>
</div>
</div>
</div>
<div class='ngg-clear'></div>
<br />
&nbsp;<br />
&nbsp;<br />
<span class="download"><a href='http://chromiteblue.com/wp/wp-content/uploads/2008/11/im002180.wmv'>PuzzleBot - 2008-11-28</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://chromiteblue.com/archive/projects/nxt/nxt-puzzlebot-01/feed/</wfw:commentRss>
<enclosure url="http://chromiteblue.com/wp/wp-content/uploads/2008/11/im002180.avi" length="4619760" type="video/x-msvideo" />
<enclosure url="http://chromiteblue.com/wp/wp-content/uploads/2008/11/im002180.wmv" length="1937606" type="video/x-ms-wmv" />
		</item>
		<item>
		<title>ISO Date/Time in java</title>
		<link>http://chromiteblue.com/archive/coding/iso-datetime-in-java/</link>
		<comments>http://chromiteblue.com/archive/coding/iso-datetime-in-java/#comments</comments>
		<pubDate>Sat, 14 Jun 2008 06:33:04 +0000</pubDate>
		<dc:creator>ChromiteBlue</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Code]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Reference]]></category>

		<guid isPermaLink="false">http://chromiteblue.com/archive/general/iso-datetime-in-java/</guid>
		<description><![CDATA[took me a while to figure this one out, you&#8217;d think getting a standarized date/time would be a bit simpler&#8230;
put the following in a class

private final static SimpleDateFormat dateFormat;
static {
    //as per ISO 8601
    dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    //make sure the formatter requires an exact string
 [...]]]></description>
			<content:encoded><![CDATA[<p>took me a while to figure this one out, you&#8217;d think getting a standarized date/time would be a bit simpler&#8230;</p>
<p>put the following in a class</p>
<pre class="code">
private final static SimpleDateFormat dateFormat;
static {
    //as per ISO 8601
    dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    //make sure the formatter requires an exact string
    dateFormat.setLenient(false);
    //set "timezone" to Universal Time Coordinates (GMT adjusted by leap seconds)
    dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
}
</pre>
<p>and the following elsewhere in the class:</p>
<pre class="code">
//to create a string
String nowString = dateFormat.format(new Date());
//to parse a proper string to a date
Date nowDate = dateFormat.parse(nowString);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://chromiteblue.com/archive/coding/iso-datetime-in-java/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Java ActionEvents and ActionListeners</title>
		<link>http://chromiteblue.com/archive/coding/java-actionevents-and-actionlisteners/</link>
		<comments>http://chromiteblue.com/archive/coding/java-actionevents-and-actionlisteners/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 20:13:37 +0000</pubDate>
		<dc:creator>ChromiteBlue</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Code]]></category>

		<category><![CDATA[Cross-Platform]]></category>

		<category><![CDATA[Examples]]></category>

		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://chromiteblue.com/archive/coding/java-actionevents-and-actionlisteners/</guid>
		<description><![CDATA[an ActionListener is an interface for receiving action events, a class that should process action events should implement this interface, then be registered with a component.
an ActionListener can be registered with any object capable of it, typically this is an instance of an AbstactButton class like a JButton or JMenuItem.

&#160;
&#160;
this can be done by implementing [...]]]></description>
			<content:encoded><![CDATA[<p>an <i>ActionListener</i> is an interface for receiving action events, a class that should process action events should implement this interface, then be registered with a component.</p>
<p>an <i>ActionListener</i> can be registered with any object capable of it, typically this is an instance of an <i>AbstactButton</i> class like a JButton or JMenuItem.<br />
<span id="more-130"></span><br />
&nbsp;<br />
&nbsp;<br />
this can be done by implementing the ActionListener on the parent of the AbstractButton object:</p>
<pre class="code">
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;

public class ActionListenerTest
        extends JFrame
        implements ActionListener {

    //define the ActionListener subject object
    private JButton button;
    //define the example target value
    private int numberOfClicks;

    public ActionListenerTest() {
        //set the example target value
        this.numberOfClicks = 0;

        //create the ActionListener subject object
        this.button = new JButton("OK");
        //register the ActionListener with the ActionListener subject object
        this.button.addActionListener(this);
        //add the ActionListener subject object to the content pane
        this.getContentPane().add(this.button);
        //"pack the frame for visual appeal
        this.pack();
    }

    //this is the method that the implementation of ActionListener forces us to have,
    //  this will be called by the component when an "Action" is performed
    public void actionPerformed(ActionEvent e) {
        //adjust the example target value
        this.numberOfClicks++;
        //echo the example target value
        System.out.println( "The button has been pressed "+this.numberOfClicks+" times.");
    }

    public static void main(String args[]){
       ActionListenerTest frame = new ActionListenerTest();
       frame.setVisible(true);
    }

}
</pre>
<p>&nbsp;<br />
&nbsp;<br />
this can also be done by implementing the ActionListener on an inner class of the parent of the AbstractButton object:</p>
<pre class="code">
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;

public class ActionListenerTest
        extends JFrame {

    private JButton button;

    public ActionListenerTest() {
        //create the ActionListener subject object
        this.button = new JButton("OK");
        //register the ActionListener with the ActionListener subject object
        this.button.addActionListener(new ActionListenerInnerTest());
        //add the ActionListener subject object to the content pane
        this.getContentPane().add(this.button);
        //"pack the frame for visual appeal
        this.pack();
    }

    private class ActionListenerInnerTest
            implements ActionListener {
        //define the example target value
        private int numberOfClicks = 0;
        public void actionPerformed(ActionEvent e) {
            //adjust the example target value
            this.numberOfClicks++;
            //echo the example target value
            System.out.println( "The button has been pressed "+this.numberOfClicks+" times.");
        }
    }

    public static void main(String args[]){
       ActionListenerTest frame = new ActionListenerTest();
       frame.setVisible(true);
    }

}
</pre>
<p>&nbsp;<br />
&nbsp;<br />
an advantage to the inner class method is that ic can be reused for similar situations:</p>
<pre class="code">
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;

public class ActionListenerTest
        extends JFrame {

    private JButton button1;
    private JButton button2;
    private JButton button3;

    public ActionListenerTest() {
        //define and set a layout for the content
        BoxLayout layout = new BoxLayout(this.getContentPane(),BoxLayout.Y_AXIS);
        this.getContentPane().setLayout(layout);
        //create the ActionListener subject objects
        this.button1 = new JButton("Button 1");
        this.button2 = new JButton("Button 2");
        this.button3 = new JButton("Button 3");
        //register the ActionListener with the ActionListener subject object
        this.button1.addActionListener(new ActionListenerInnerTest());
        this.button2.addActionListener(new ActionListenerInnerTest());
        this.button3.addActionListener(new ActionListenerInnerTest());
        //add the ActionListener subject objects to the content pane
        this.getContentPane().add(this.button1);
        this.getContentPane().add(this.button2);
        this.getContentPane().add(this.button3);
        //"pack the frame for visual appeal
        this.pack();
    }

    private class ActionListenerInnerTest
            implements ActionListener {
        //define the example target value
        private int numberOfClicks = 0;
        private String sourceText = null;
        public void actionPerformed(ActionEvent e) {
            //adjust the example target value
            this.numberOfClicks++;
            //set the source text if needed by casting event source to a JButton
            if( this.sourceText == null ) {
                this.sourceText = ((JButton )e.getSource()).getText();
            }
            //echo the example target value
            System.out.println( "The button: "+this.sourceText+" has been pressed "+this.numberOfClicks+" times.");
        }
    }

    public static void main(String args[]){
       ActionListenerTest frame = new ActionListenerTest();
       frame.setVisible(true);
    }

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://chromiteblue.com/archive/coding/java-actionevents-and-actionlisteners/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

