Monday, November 23, 2009

I Want a Dual WAN Router Roundup

I need a comparison review between different brands and models or routers that support multiple WAN interfaces.  So far I can only find individual reviews or about 50 million people telling me to use pfSense.  That's great, but a pfSense computer would be expensive.

Sunday, November 22, 2009

Using s3fs with centos and https

There are several s3fs projects, this is the one I'm using: http://code.google.com/p/s3fs/wiki/FuseOverAmazon

When I tried to connect in Centos to the filesystem while using an https url, I got the message:
ls: reading directory /mnt/s3: Input/output error
And in /var/log/messages:
Nov 22 15:02:57 host s3fs: init $Rev: 177 $
Nov 22 15:03:01 host s3fs: ###problem with the SSL CA cert (path? access rights?)
Nov 22 15:03:01 host s3fs: ###retrying...
Nov 22 15:03:01 host s3fs: ###problem with the SSL CA cert (path? access rights?)
Nov 22 15:03:01 host s3fs: ###retrying...
Nov 22 15:03:01 host s3fs: ###problem with the SSL CA cert (path? access rights?)
Nov 22 15:03:01 host s3fs: ###retrying...
Nov 22 15:03:01 host s3fs: ###giving up
Nov 22 15:03:05 host s3fs: destroy

Based on a message on that google code page, I added the slightly different than suggested function call:
curl_easy_setopt(curl, CURLOPT_CAINFO, "/etc/pki/tls/certs/ca-bundle.crt");
which took care of the errors.  Then it mostly worked.  Although there are still random failures so I'm trying s3backer next.

Friday, November 20, 2009

10.2 Miles


Decent run.

Activity
Route:
--
Elev. Avg:
11 ft
Location:
Alexandria, VA
Elev. Gain:
+0 ft
Date:
11/20/09
Up/Downhill:
[+242/-242]
Time:
04:08 PM
Difficulty:
2.7 / 5.0

Weather:
Mostly Cloudy

55 F temp; 48% humidity

55 F heat index; winds NW 8
Performance
Distance:
10.20 miles

Time:
1:27:31
Speed:
7.0 mph

Pace:
8' 35 /mi

Calories:
1528

Map

Elevation (ft)

Pace (min/mile)

Splits
Mile
Pace (min/mile)
Speed (mph)
Elevation
Gain
actual
+/- avg
actual
+/- avg
1
8' 00
-0' 35
7.5
+0.5
+6 ft
2
8' 20
-0' 15
7.2
+0.2
+14 ft
3
8' 27
-0' 08
7.1
+0.1
-27 ft
4
8' 45
+0' 10
6.8
-0.1
+9 ft
5
8' 41
+0' 06
6.9
-0.1
-7 ft
6
9' 06
+0' 31
6.6
-0.4
-6 ft
7
8' 47
+0' 12
6.8
-0.2
+19 ft
8
8' 38
+0' 03
6.9
-0.1
-6 ft
9
7' 50
-0' 45
7.7
+0.7
-7 ft
10
8' 53
+0' 18
6.8
-0.2
0 ft
end
8' 47
+0' 12
6.8
-0.2
+3 ft
Versus average of 8' 35 min/mile

Posted from bimactive.com

Thursday, November 19, 2009

Using Jackrabbit with Oracle, JNDI, and Tomcat

This took me weeks to figure out completely, but I think this is the simplest possible solution unless you want to just put the connection info in your jackrabbit xml config directly.  I'm using Jackrabbit 1.5 instead of 1.6 because that's the version in Liferay 5.2.3 and I didn't want to upgrade besides getting the latest point release.  I tried the patch at http://wiki.apache.org/jackrabbit/JNDI but had problems since it's for an older Jackrabbit and I wasn't interested in debugging it.  I tried the instructions at http://wiki.apache.org/jackrabbit/UsingJNDIDataSource but they weren't sufficient since Oracle threw a ClassCastException when jackrabbit tried to create blobs using the DBCP pooled database connection classes.  I tried working around those exceptions with overly complicated class reflection code in the OracleFileSystem but that was a waste of time.  Then I looked at the Oracle JDBC driver javadoc and noticed that they have their own DataSource pooling classes that return Oracle Connection objects which should work with Oracle's blob code.

I did this with version 10.2.0.4 of the Oracle JDBC driver (ojdbc14.jar).
  1. Patch Jackrabbit. 
    1. Download the source, open jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionFactory.java
      Change

      if (user == null && password == null) {
      To

      if ((user == null && password == null) || (user.length() == 0 && password.length() == 0)) {

      The goal is to rely on the JNDI Resource to define the username and password instead of expecting them in jackrabbit's repository.xml.  This breaks the (useless) case where you actually want to use both a blank username and password for your database connection.  So don't do that.  Otherwise it should still work with both non-JNDI style and JNDI datasources.
    2. Run "mvn install" or "mvn package" in the root jackrabbit source directory.  For me, it didn't matter which command I used since Liferay doesn't get built with maven so I had to manually copy the modified jackrabbit jars to the lib/portal folder regardless.  If you're using maven on your project, do "mvn install" and skip the next step
    3. If you're not using maven, find the new jackrabbit jars you built and copy them to your project (jackrabbit-core-1.5.7.jar / jackrabbit-core.jar is the only one we changed, but I grabbed all the ones already in Liferay for good measure)
  2. Define your DataSource in the tomcat config (I mostly stole this part from Gregg Lagnese, of MicroDeveloper, Inc ).  The key here is to use Oracle's DataSource and Factory classes to avoid the ClassCastException I mentioned in the introduction paragraph above.
    1. Either in tomcat's server.xml or your application's context.xml add a resource

      <Resource name="jdbc/JackrabbitPool"
        auth="Container"
        type="oracle.jdbc.pool.OracleDataSource"
        driverClassName="oracle.jdbc.OracleDriver"
        factory="oracle.jdbc.pool.OracleDataSourceFactory"
        url="jdbc:oracle:thin:<schema>/<password>@<server>:<port>:<instance>"  />
      Attempts to put the username and password as separate attributes from the url (aka the standard way of doing it) failed.  It has to be in the url to work.
    2. Liferay specific note: I had to specify separate resources for Jackrabbit and Liferay since Liferay had problems with the Oracle DataSource class.  That wasn't a big deal to me since I'd rather have my database connection info appear twice in context.xml instead of appearing once in context.xml, again five or six times in repository-ext.xml, and then in repository.xml and workspace.xml once Liferay is deployed.
  3. Edit repository.xml (Liferay people edit ext-impl/src/com/liferay/portal/jcr/jackrabbit/dependencies/repository-ext.xml)
    1. Set the driver classes to javax.naming.InitialContext
    2. Set the urls to "java:comp/env/jdbc/JackrabbitPool"
    3. Use the Oracle specific classes:
      org.apache.jackrabbit.core.fs.db.OracleFileSystem
      org.apache.jackrabbit.core.persistence.db.OraclePersistenceManager
    4. Save/deploy.  If you're using Liferay don't forget to delete tomcat\data\jackrabbit so your old version of repository.xml doesn't linger and make you think it's working when it isn't.
That's it.  Let me know if you tried it and how it went.  This should also work for JBoss application server and probably all of the other J2EE servers that either fork or use Tomcat.

Monday, November 16, 2009

Cygwin Awk Error

If you run awk and get the message "ntvdm encountered an error", see this post

The blog said to remove c:\cygwin\bin\awk.exe and create the file c:\cygwin\bin\awk.bat with the contents:
c:\cygwin\bin\gawk.exe %*
 And the error is gone.

Thursday, November 12, 2009

Upgrading Eclipse

I avoid upgrading Eclipse as much as possible because I hate losing my third party plugins (subversion really should be part of the default package now).  What a pain in the butt upgrades are.  It should take two seconds, not twenty minutes.

Monday, November 02, 2009

Windows 7 Random Wake Ups

What a pain in the butt to have your computer randomly turn on in the middle of the night.  I though that this might be a solution, but it didn't work.  I find that my computer only wakes itself up when I hibernated it but didn't shut it down.  Very strange and annoying.  At least it boots somewhat fast if you choose shut down instead of hibernate.