Useful Apps for Jailbroken iPhones

A few months back I decided to jailbreak my iPhone.  It is a powerful device and iPhone OS is rather snazzy, but lack of backgrounding non-Apple apps grew to be pretty frustrating. I won’t dive in to how to go about jailbreaking (I used Pwnage Tool to do the deed), since there are tons of tutorials already out there. I do, however, wish to list the apps/tweaks I have found rather useful since opening this up. All of these apps can be installed via an out-of-the-box Cydia which is an app & software repository for jailbroken devices.

Backgrounder

Backgrounder is an extension that lets you run apps in the background. This was originally my only intent with jailbreaking. I often use Pocket Tunes Deluxe to stream local sports stations or Sirius radio, but having to quit the app every time I wanted to reply to an SMS message or check the twitters was pretty annoying.

Cycorder

Since I only an iPhone 3G, not the 3GS, I cannot record video on my device via the camera.  That is, until I installed this nifty app. The quality of the video it records is pretty nice.  Makes me wonder why Apple could not have extended this feature to those of us with our ancient year-old phones.

SBSettings

Invaluable method for quickly toggling all sorts of system properties with a simple screen swipe from anywhere.  Lets you toggle Wifi, 3G, Bluetooth, view/kill processes, see available memory and disk space, etc.   Awesomeness.

Rotation Inhibitor

This lets me toggle auto-rotation from SBSettings. Personally, I find the rotation on this device to be mostly an annoyance. I’m used to the regular keyboard layout, and sometimes when I am ever laying down on my side or walking, the auto-rotation tends to get wonky. Presto, I can now turn it off (which I do.)

ScreenSplitr

ScreenSplitr actually has come in rather handy at work. This app will mirror your device screen onto a tv via a tv-out cable, or to a computer over wifi using an app called DemoGod. This is not really meant for, say, watching video on a big screen, but it is perfect for doing application demos to a larger audience.

SMS Helper

SMS Helper modifies the default SMS app to count characters when composing a new message.  This is very helpful if you would rather not have your text split into multiple messages on the recipient’s end, or for texting to twitter.

Mobile Terminal

Want to drop into a shell on your iPhone? Enter Mobile Terminal. Very useful if you ever need console access, especially considering things like wget, vim, etc have been ported to this platform.

Tags: ,

Getting JBossWS working with JDK 6

See https://jira.jboss.org/jira/browse/JBWS-1439 for more details, but essentially, there are some classpath issues with an out of the box JBoss 4.2.x and jdk6 when trying to use JBossWS (Implementation of JAX-WS stack in JBoss Application Server.)

If you run into these problems, there is a simple fix. Copy the conflicting jars into the endorsed directory:

cp -t $JBOSS_HOME/lib/endorsed $JBOSS_HOME/server/all/lib/jboss-jaxrpc.jar \
  $JBOSS_HOME/server/all/lib/jboss-saaj.jar

Fixing the wsdl soap address brokenness

Another problem you might run into is that the default wsdl generated will end up using whatever hostname JBoss thinks it is. This is not necessarily the hostname that is accessible remotely.

To get around this, modify:

$JBOSS_HOME/server/$instanceName/deploy/jbossws.sar/jbossws.beans/META-INF/jboss-beans.xml

By commenting out the webServiceHost property in WSServerConfig

Tags: , , , ,

Ajax loading, sorting, and paginating of Displaytag tables

In a lot of my Java based web apps, I tend to make use of the wonderful Display Tag Library for rendering display tables.  It is pretty powerful and easy to do sorting, paging, decoration, etc with very little code.  I also tend to make use of jQuery as my preferred javascript library. It makes doing DOM manipulation, ajax operations, styling, etc a breeze.

jQuery’s Ajax/load request allows you load external html from a remote source and inject it into the DOM.  This means you can keep your javascript and my page layout completely separate. Combining the use of displaytag and ajax/load is a snap, and allowing the sorting & pagination to be ajax-driven rather than forcing page reloads is great.

In your jsp that renders the table (assuming you have an appropriately-scoped object called people available):

<s:url id="thisUrl"/>
<display:table class="people" id="peopleTable" name="${people}" requestURI="${thisUrl}" pagesize="5" sort="list">
  <display:column property="name" title="Name" class="name" sortable="true"/>
  <display:column property="birthday" title="Birthday" class="birthday"/>
</display:table>

And in your display page, from which you want to dynamically load this table and inject:

<script type="text/javascript">

  if (!com) var com = {};
  com.mudrick = {

    onPeopleTableLoad: function() {

      // Gets called when the data loads
      $("table#peopleTable th.sortable").each(function() {
        // Iterate over each column header containing the sortable class, so
        // we can setup overriding click handlers to load via ajax, rather than
        // allowing the browser to follow a normal link
        $(this).click(function() {
          // "this" is scoped as the sortable th element
          var link = $(this).find("a").attr("href");
          $("div#peopleData").load(link, {}, com.mudrick.onPeopleTableLoad);
          // Stop event propagation, i.e. tell browser not to follow the clicked link
          return false;
        });
      });

      $("div#peopleData .pagelinks a").each(function() {
        // Iterate over the pagination-generated links to override also
        $(this).click(function() {
          var link = $(this).attr("href");
          $("div#peopleData").load(link, {}, com.mudrick.onPeopleTableLoad);
          return false;
        });
      });
    }
  };

  $(document).ready(function() {
    // Load the initial rendering when the dom is ready.  Assuming you are injecting into a div
    // with id "peopleData" that exists in the page.
    $("div#peopleData").load("/remote/path/to/whatever/generates/table/above", {}, com.mudrick.onPeopleTableLoad);
  });

</script>

Presto! Pagination + sorting in an ajaxy way using displaytag out of the box with some simple jQuery code.

Tags: , , ,

Tracing uncaught exceptions in xcode

One of the annoyances I had with doing iPhone development in Xcode, besides for the fact that it is not eclipse, or that editing multiple source files means having windows strewn about (as opposed to a nice tabbed interface), was that whenever I introduced a bug that caused an Uncaught Exception (i.e. TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION) to be thrown, I’d be lost trying to trace its origin.  Java stacktraces have line numbers and all, which in Eclipse, takes me directly to the offending location.  Easy.

This guy figured out how to get similar behavior in Xcode.

In the event that the referenced blog entry ever goes away… You need to add an objc_exception_throw breakpoint to your global breakpoints.

Why this isn’t configured as such out of the box, I don’t know.

Tags: , , ,

Re-configuring JBoss RewriteValve without restarting

At my company, I often make use of the wonderful Rewrite Valve that comes with JBoss Web.  This is very similar to mod_rewrite that you’d use with Apache Httpd, but instead applicable to your JBoss/Tomcat install.  I find it very handy for rewriting short urls outside of your app’s context root.

For instance, how else would I have http://host/a123 really be processed by http://host/MyApp/Processor.action?id=123?  I won’t get into the specifics of configuring tomcat valves or, in particular, this one, but I will briefly touch on something I previously thought was not possible:  Making changes to a running configuration without incurring the downtime of performing a jboss restart.

Assuming that your rewrite valve is configured in your jboss.web engine’s default hostname (i.e. the valve is configured in /Server/Engine/Host/ in $JBOSS_HOME/server/$INSTANCE/deploy/jboss-web.deployer/server.xml) you’d do the following.  I’m using JBoss 4.2.3GA btw.

$JBOSS_HOME/bin/twiddle.sh -s localhost:$JMX_PORT \
  set 'jboss.web:host=$ENGINE_HOST,name=RewriteValve,type=Valve' configuration \
  "$(cat $JBOSS_HOME/server/$INSTANCE/conf/jboss.web/$ENGINE_HOST/rewrite.properties)"

My variables:

JMX_PORT=1099
INSTANCE=default
ENGINE_HOST=localhost

You should then see the configuration print to STDOUT, and the changes will be active.

It would be great if you could do this from the JMX console.  Unfortunately, browsers hose the newlines in your rewrite rules (pretty important) and there’s a bug in the getter implementation of the RewriteValve that might mess things up.

Tags: