Monday, November 17, 2008

online to-do lists

I've been keeping my to-do list in a text file on my phone, and that together with my phone's calendar and my email are the things that pretty much run my life. Someday I'm sure that there will be a way to have all of those things integrated the way I want, most likely through an online service. To do so, they'll have to:
  • make it easy to make notes wherever I am, ideally with Jott
  • allow me to attach a "context" (and a time estimate)
  • integrate with a calendar
  • allow for task dependencies
Today I figured it was time again to check around and see if today is that day. It looks like it's not. The dependency feature is the hardest to find, and I'm a bit surprised it's still not very widespread. Here's some of the info I've gleaned from about a dozen sites:

Remember The Milk is integrated with Jott for free, which makes it most attractive for a trial; I'd like to try Hivemind for their dependencies, and I will if I do a paid subscription to Jott (eg. pay-as-you-go, because Jott is critical but I use it rarely).

Thursday, October 30, 2008

integration tests with Wicket and Spring

I had a bear of a time getting my Wicket tests to work with services injected by Spring.

I started with the helpful Wicket-Spring unit-test instructions here; this got me through a basic test. Unfortunately, I must use Spring-managed services from my main AuthenticatedWebSession class since I'm using the standard Wicket "Auth-Roles" security (simply, without Acegi); Wicket has a helpful way to tie with Spring when it comes to the WebPage classes, but this doesn't work for the things I'm using in the main WebApplication or WebSession classes.

I found another project that uses Spring's test class AbstractTransactionalDataSourceSpringContextTests as it's parent class, and this proved to be my salvation. Basically, I extend that class and add the following 2 methods:

protected ConfigurableApplicationContext createApplicationContext(String[] locations) {
context.setServletContext(new org.springframework.mock.web.MockServletContext());
context.setConfigLocations(locations);
context.refresh();
return context;
}

protected String[] getConfigLocations() {
return new String[]{"context/backoffice-webapp.xml"};
}


Then I have to override the "onSetUpBeforeTransaction" method instead of the traditional JUnit "setUp" method:


@Override
protected void onSetUpBeforeTransaction() throws Exception {

super.onSetUpBeforeTransaction();

AuthenticatedWebApplication authenticatedWebApp = new WicketApplication() {
@Override
public void init() {
addComponentInstantiationListener(new SpringComponentInjector(this, TestHomePage.this.applicationContext));
initForAppAndTests(); // this is where I set up my global services, called by WicketApplication.init() as well
}
};
tester = new WicketTester(authenticatedWebApp);
}

That made it all work.

BTW, although I'm using Spring 2.5.5, the latest spring-mock library is only 2.0.8.

Tuesday, October 21, 2008

Google GData APIs

This is just so I can find the Java API for Google GData. (Go ahead: try googling "gdata api" and see if you can find it that way. I dare you.)

http://code.google.com/apis/gdata/javadoc/

Note that it's linked from the "Client Libraries" page.

Update: you can find it easily in a Google search on: "gdata javadoc"

Tuesday, October 7, 2008

Wicket i18n and l10n

I'm playing with text properties in Wicket, and I found this good article on it (up to and including v1.4) by Erik van Oosten. You can see more technical details in Wicket's basic references on i18n and l10n.

What I'd really like is the ability to refer to other properties within a text property, but it doesn't appear to have that. I even tried to put it in, but it assumes you have an object with that name laying around, or at least an accessor ("get...") method with that name (up to the first ".") somewhere in your component hierarchy, so I cannot figure out how to hack that in. Yet.

Wednesday, September 17, 2008

lessons from setting up Google Apps with Single-SignOn

Here are my lessons learned from setting up Google apps with Single-SignOn, where I can manage email and contact settings via an API.

Premier
search for "google apps"; be sure to "compare editions"
  • - provisioning via API
  • - email migration API
  • - contact/doc sharing

Purchase & Configure
  • - free for a month (temporarily?)
  • - they verify you own it (HTML file or CNAME change)
  • - for mail, you set them with the MX records
  • - asynchronous setup steps

Provision New Accounts
search for "google apps apis"; look around for "client libraries" and "sample code"
  • - we really only need the "samples" codebase to show how to use their libraries
  • - peruse the INSTALL and README files
  • - after editing some properties, you can create/delete users; here's a huge test:
  • ant -f appsforyourdomain.xml sample.appsforyourdomain.run
  • - I commented out the call to 'deleteUser' so I could see the effect in the UI

Enable SSO (Single-SignOn)
  • - look at how to enable it in the admin area
  • - read links to SSO docs as you do things; I had to read a ton of things in their proper contexts before it started making sense

SSO Attempts
  • - open source projects: http://code.google.com/apis/apps/open_source_projects.html#sso
  • - Shibboleth: error in IdP, but it worked after tweaking build.xml; unable to install SP, so I stopped http://code.google.com/apis/apps/articles/shibboleth2.0.html
  • - JOSSO: easy to get sample up and running; unclear how to wire to Google, so I stopped
  • - ESOE: didn't even try it
  • - Google has best basic example as Java JSP project in "client libraries" and "sample code": http://code.google.com/p/google-apps-sso-sample/downloads/list
  • - Google instructions, which are awesome (from README in download): http://code.google.com/apis/apps/sso/saml_reference_implementation_web.html

Lessons Learned during SSO Attempts
  • - use this reference for key generation: http://code.google.com/apis/apps/articles/sso-keygen.html
  • - many lessons about keys and certificates: private key vs. public key vs. certificate
  • - keytool stores things in home directory, protected by a password
  • - openssl generates artifacts via stdout or to files you specify
  • - Google tutorial doesn't explain how to change the SP URL (to your google apps domain). I've modified their v1.0.1 JSP code, so in my version you only need to change the domain name in the "saml_demo.jsp" file.
  • - Furthermore, I was able to create a one-step, single link that logs you in automatically. You'll have to contact me directly if you want this.

Thursday, July 3, 2008

executing a command from 'find' results in UNIX

This one greps through all the files from the 'find' for org/apache/regexp:


find . -exec grep "org/apache/regexp" '{}' \; -print