Thursday, April 21, 2005
Friday, April 15, 2005
So I noticed that the pebble distribution included a J2ME client for moblogging, and I figured it would be a good oppurtunity for me to learn J2ME.
I hacked together an addition to it which would allow me to use my phone's camera whilst composing a new blog entry directly in the app. Got it working perfectly .. on the simulator! Yeah, thats right, I didn't realize that MMAPI was an optional API for MIDP 2.0, and the IBM JVM for my Treo 650 left it out! Doh!
I guess I'll just write something to attach an image from the filesystem instead. Anyone know of any open source file browser widgets for MMAPI?
Friday, April 8, 2005
Creating an extension location works under both the 3.0.x and 3.1.x releases of eclipse, under both linux and windows (and I assume all others). The steps to accomplish this under linux are as follows:
- As root, I install eclipse to /opt/eclipse
- As myuser, I create the directories
- I edit ~/eclipse-config/eclipse/.eclipseextension to contain:
name=My Eclipse Configuration
- As myuser I install plugins/feature to ~/eclipse-config/eclipse (manually or through eclipse update mechanism after step 6 completed)
- As myuser, I start eclipse like "/opt/eclipse/eclipse -data /home/conway/eclipse-config/workspace -vmargs -Xmx512M"
- In Help->Software Updates->Manage Configuration... I "Add an Extension Location" to ~/eclipse-config/eclipse. The setting for this ends up being stored in ~/.eclipse
The thing I really like about this method is that aside from installing the eclipse runtime as root, I never have to do anything else as root again - I can install all my plugins as myself in my home directory, and when it comes time to upgrade eclipse, I don't have to deal with moving my plugins to a new install - I simply install the new eclipse into it own directory, run it, perform step 6, and all my plugins are present (assuming they work across eclipse versions =)
Also, for large multi-feature/multi-plugin extensions like the eclipse WebTools Project, I'll create a new extension location just for that extension so that I can treat it as a single unit for enable/disable/upgrade.
The process under windows is identical except you don't have to worry about user permissions, and you need to choose windows paths that make sense to you. I use c:\devtools\eclipse for my eclipse install and c:\devtools\eclipse-config for all my configuration.
Saturday, April 2, 2005
I have a backing bean which does a DB query to return a list of beans - with an accessor of getBeans(). Each bean is displayed as a row in a h:dataTable, with certain fields being directly editable as h:inputText's - specifically the get/setRuleText() member.
I added a cancel buton (non-immediate) which simply nulls out the underlying member variable for getBeans(), returning null to stay on the same page, and resulting in the list getting regenerated next time getBeans() gets called.
This was working fine, but things went wrong once I added a custom validator. I could no longer cancel if there was an invalid entry. So I figured I could just add the immediate flag and everything would be hunky dory.
With the immediate flag present, the cancel button would work, and trigger my action, but the getRules() method would not get called again for the rest of that lifecycle, and though I wouldn't get validation errors, the data in the view objects was not being refreshed - just showing the pre-cancel data.
However I noticed that if I left and came back to the page, it would then show the correct data. Thus we come to my tip - instead of returning null from the cancel action to stay on the same page, return a string which triggers an explicit navigation rule, and this will cause the view objects to refresh and call the getters as needed.
Not sure if this is a bug or expected behavior - please feel free to enlight this JSF newbie either way =)
First I setup IMAP on my workstation. Since I'm running Fedora Core 2, this was just a matter of installing the dovecot rpm package. In order to get my POP mail delivered to my workstation, I setup fetchmail to run as a daemon to deliver my POP account mail to my local mail queue (Using postfix as my MTA, also installed as a rpm as part of FC2)
Once I'm getting mail delivered to my local workstation, then I simply point my Mail client there using IMAP instead of POP to our standard mail server.
Then I setup stunnel to act as a proxy to my imap mail server. Once configured, stunnel runs as a daemon, listens for connections to the indicated port, and runs ssh to connect to my work gateway to run netcat to connect to my workstations imap server. Once a connection is established, all traffic just gets sent back and forth along this chain of connections, so in effect, even though I connect to port 1234 on my home machine, it transparently ends up as a connection to port 993 on my workstation. Also, thanks to stunnel, connections are created on demand and dropped when client hangs up.
So from any imap client to my home machine, its ssl encrypted courtesy of stunnel serverside ssl. From my home machine to my work gateway machine its ssh encrypted, and from the gateway to my workstation its ssl encrypted thanks to the clientside ssl in stunnel and ssl on the imap server.
If you don't need the extra security for the gateway to workstation leg, you can stop stunnel from being a ssl client by using "client = no" in stunnel.conf, make netcat connect to port 143 instead of 993, and skip making a certificate on your workstation.
First make a certificate on home machine so ssl clients can create an ssl connection to stunnel:
Then make another certificate on work workstation so stunnel can create an ssl connection to dovecot:
poll mail.mywork.com protocol pop3 username "myuser" password "foobar"
cert = /usr/share/ssl/certs/stunnel.pem
client = yes
accept = 1234
exec = /etc/stunnel/imapwork
# For this to work, make sure you have a passphraseless ssh key setup to that you can login to the gateway machine
/usr/bin/ssh myuser@email@example.com /home/myuser/bin/netcat -c -w 10 myworkstation.mywork.com 993