Sunday, December 20, 2009

Update - Digital Large-Display Thermometer

About a month ago, I changed the batteries for the digital large-display thermometer below. That means I got almost 2 years out of the 3x AA batteries. These were already partially used when I put them in initially.

Monday, February 4, 2008

Using Oracle BPEL PM with a Proxy Server

It's the BPEL blues again. It must just be me. It seems every time I try to do something new with the Oracle BPEL Process Manager I have a problem. I read the documentation (that I can find), follow to the letter (or so I think), and try variations, often involving multiple restarts. All this chews up time, sometimes hours sometimes days. This time it involves a project whereby I have to get some data from a new application we've had developed using Siebel CRM OnDemand, and pass it to an internal reporting system. For those of you new to Siebel CRM OnDemand, it's a bit like Salesforce.com in that you can roll your own CRM system using their web-based development framework. A nifty idea that I think we will see more of in other application areas in the years ahead.

So our Oracle BPEL PM sits on our internal network and needs to talk to OnDemand which is located outside on the Internet. Of course everything that does this from our network has to do so via the proxy server(s). Sounds easy right? We are using Oracle BPEL PM 10.1.3.3 and according to the nearest documentation I could find (OAS Installation Guide 10.1.3.1) :-

7.7 Proxy Settings
If you want the Oracle Application Server instance to use a proxy server, perform the
following steps:
1. Run the following command to shutdown all processes:
C:\> ORACLE_HOME\opmn\bin\opmnctl shutdown
2. To set the proxy server for BPEL, modify the following lines in the ORACLE_
HOME\bpel\bin\obsetenv.bat file:
set PROXY_SET="true"
...
:set_proxy
set OB_JAVA_PROPERTIES="-Dhttp.proxySet=true" "-Dhttp.proxyHost=proxy_server_
hostname" "-Dhttp.proxyPort=proxy_server_port"
"-Dhttp.nonProxyHosts=localhost|non_proxy_host|other_non_proxy_hosts"
:end_set_proxy
3. To set the proxy server for OC4J, modify the following lines for the OC4J module
in the ORACLE_HOME\opmn\config\opmn.xml file:






-Dhttp.proxySet=true -Dhttp.proxyHost=proxy_server_hostname
-Dhttp.proxyPort=proxy_server_port
-Dhttp.nonProxyHosts=localhost|non_proxy_host|other_non_proxy_hosts"/>




So that's it right? Being a Windows user, (sorry all you fans of the 20+year-old-Linux-command-line UI paradigm) I'm used to starting everything from the Start menu, and besides, the Oracle BPEL PM Developers Guide clearly states that to start the BPEL PM in a Windows environment you should "Select Start > All Programs > Oracle -
Oracle_Home > Start SOA suite" (Developer’s Guide 10.1.3.1.0 B28981-03 section 2, table 2-1). Silly me for following this documentation. To get the BPEL PM to actually pick up your changes to the config files in regards to proxy settings, you must ignore this documentation and instead follow the OAS Installation Guide that states to start a middle tier instance you should use the following command line "(Windows) ORACLE_HOME\opmn\bin\opmnctl startall". From my tests - you only have to do this once to pick up the config changes. After that you can continue to start it from the Start menu and it will continue to use the config changes you made earlier.

You can see the settings the server is actually using in a couple of ways.

1. Go into the OAS Enterprise Manager and navigate to Cluster Topology > Application Server: home.yourserver > OC4J: home.yourserver soademo (or your soa home) > Server Properties. At the bottom of the page click Server Properties. Browse through the pages and you will find the http.proxySet parameter (and others if they exist), that are being used by the server.

2. Inside a test BPEL process use Embedded Java to read the system properties and write them to the domain.log so you can view the values after the process has been run. To do this, add an embedded java component and fill it in as follows:-

String vProxySet = System.getProperty("http.proxySet");
String vProxyHost = System.getProperty("http.proxyHost");
// more vars here if you want them...
Logger logger = Logger.getLogger("default.collaxa.cube.engine.deployment");
logger.info("Test environment Var http.proxySet : " + vProxySet);
logger.info("Test environment Var http.proxyHost : " + vProxyHost);
// more log writes here if you want them...

To get this to work you must import the appropriate Java library into the BPEL process. To do this, add the following line in the BPEL source view just before the embedded java component :-



This adds the log4j library, which is what Oracle BPEL PM normally uses for its logging. After deploying and running your test BPEL process, search for and open the domain.log file and you will see your custom log entries near the bottom.

Thursday, January 17, 2008

An Accurate PIC-based Large-display Thermometer


I've been on my annual long holiday (4 weeks!) and have had time to catch up on a few things.
I finally got around to re-doing the digital thermometer I built during last years holiday. I've been using it on and off - literally, because the batteries had a short life. It's weird because the seven segment LCD and driver chip it's based on, draws very little current (less than 10uA), so I always suspected the PICAXE 08M chip that I use for the microcontroller. After some investigation it turned out there were a number of things I could do to significantly reduce the power draw.

Firstly I built the circuit to run off a 9V battery so I used a 78L05 regulator - bad move, even when bypassed it draws about 1.2mA! So I changed to 3x 1.5volt AA cells (~4.5v) and removed the regulator altogether. Then I discovered the Dallas DS18B20 digital temperature sensor can draw a fair amount, so I connected it to a port on the PICAXE and I now software-control the power to it. I switch it off when not in use. I also tied all unused port pins to either vss or vdd, saving a few more microamps. I now had the current draw down to about 70uA (0.07mA) during times when there was no temperature reading occurring. The next thing I found was that the PIC chip (the PICAXE 08M is actually a PIC 12F683) will draw ~50uA less when the brown-out detector is disabled during sleep.

Woohoo, I now have my thermometer drawing a total of 12.7uA (yes microamps), for about 15 of every 17 seconds. The other 2 seconds it draws ~1mA. This 2 seconds is where the micro wakes up (kicked by the Watchdog timer), turns on the DS18B20, reads the temperature then turns off the DS18B20, updates the LCD, then goes back to sleep for ~15 seconds. One problem with getting to here was that although with the PICAXE 08M you can disable the brown out detector (disableBOD command) - that only works with firmware version 9.2 or better. My 08M's are all the original ones with 9.0 firmware - doh!

So I re-programmed the whole thing using PIC assembler! This was a whole other little journey that took the best part of a week given that I was kinda relearning PIC assembler along the way. A couple of times I referred to this tutorial, which I found useful. Although the data tables on tutorial 10 got me into trouble. When the table was located across address 0xFFH - the ADDWF instruction only handles 8-bit numbers, so the jump-to address "rolled over" and the PCL went back to 0x00h! Took a few hours and a good PIC simulator to find out what was going on.

The 7 segment LCD display is an old surplus part I had from when I worked for a fuel dispenser manufacturer some years ago (it's known as an FRS1320PH). The driver chip for it is a Motorola MC145453 LCD Driver with Serial Interface. The micro is a PIC 12F683 (it's only a tiny 8 pin package). Temperature sensor is a Dallas DS18B20 which uses the 1-wire protocol. Speaking of 1-wire I also found the code here useful for saving some time and getting the 1-wire stuff to work properly in PIC assembler (I already had all this working in PICAXE basic).

About Time

Apparently it's about time I got a blog, so here it is. I probably won't add much to it as I generally think there's already enough crap online. It's worse than free to air television and that's pretty bad.

Speaking of time I saw an ad today (don't I everyday?) for Newscientist magazine's latest issue due on the newstands tomorrow. It contains an article discussing that time may be an illusion. This got me thinking and more often these days I turn to the 'Net to see what's out there on the topic. I found this interesting blog entry and felt the need to comment. Which in turn led me to start this blog dammit.

After some thought/meditation on this, my thoughts are that time probably isn't an illusion per se, but certainly something weird is going on. I suspect that past/present/future possibly do exist all at once but only if viewed from another dimension (meaning?), or perhaps "outside of" our universe - if there is such a place (for another discussion).

My interest in all this was sparked today by my reading of The Invisible Century by Richard Panek (a Christmas gift). Not a bad read if your into science history with some coincidences thrown in for good measure.

I've often thought about time. It can be considered in some ways our enemy, but it can also be on our side. I remember my physics teacher at High School saying on the subject "time is because things happen". He was referring to physical events of course. I immediately thought - if *all* motion in the universe stopped, would time cease to exist?! According to the blog I referred to earlier space-time exists only because both space and time exist so if everything stopped moving would space-time (i.e our universe) cease to exist? If that's the case then our universe depend on motion for its very existence. Yet for motion to exist there has to be space and time because motion is distance (space) travelled over time (i.e v=d/t). Hmm this is awfully circular. If time is illusory then it follows that motion is also, and so is the space-time that underpins our universe! Hmmm