Home

Twisted Delight

Java, Security and Mac OS X

Stephen de Vries

stephendv photo

View

Advertisement

November 16th, 2007

This may be childsplay for experienced Seam developers, but it took me quite some time to figure out how to use a ManyToMany mapping with a selectManyCheckbox that could be updated in both directions of the relationship. Here is an example Seam application which illustrates how to do this. It was built by starting off with seam-gen and then customising it; so all of the persistence heavy lifting is done by the EntityHome classes which the seam generated classes extend. I highly recommend reading Chapter 11. The Seam Application Framework from the seam reference documentation to get a better understanding of how to use EntityHome - none of the Seam books currently on the market really cover seam-gen in any depth.

The application has email Recipients who can belong to many Profiles. The UI allow you to add profiles to recipients and also to remove or edit recipients from profiles (the JSF EL extensions make this really slick).
Note that I've used a factory method for both Recipient and Profile so that I can reference the Recipient entity as "recipient" instead of "recipientHome.instance" and "profile" instead of "profileHome.instance":
        @Factory("recipient")
	public Recipient initRecipient() {
		return getInstance();
	}


and then:
 <h:selectManyCheckbox value="#{recipient.profiles}">
	<s:selectItems value="#{profileList}" var="profile" label="#{profile.name}" />
	<s:convertEntity />
</h:selectManyCheckbox>

April 4th, 2006

Following the technique below you can download the shows you want as soon as they become available - all completely automated!

  1. Download and install Azureus (http://azureus.sf.net)

  2. Download and install the RSS Feed Scanner plugin. The easiest way to do this is from the Plugins -> Installation Wizard -> By List from sourceforge.net menu. Then select RSS Feed Scanner from the list. If this doesn't work for you can download it manually and install it by unzipping the file into the plugins dir, on windows this was: C:\Documents and Settings\Stephen\Application Data\Azureus\plugins\RSSFeedScanner


  3. Go to www.tvrss.net and perform a search for the show you're looking for. You'll need to narrow the search down by specifying the distribution group and perhaps the quality so that you only see 1 torrent for each episode in the list.

    There could be duplicate entries for the same episode, but by specifying the distribution group as EZTV (for example), the list is refined to only 1 torrent per episode.
    When you're happy with the search criteria, copy the location of the "Search-based-RSS Feed" link.

  4. Open the RSS Feed Scanner plugin in Azureus and add a new RSS feed. Give it a name, choose a directory, and paste the URL you copied from the previous step. Uncheck the "Use URL as Referer for Torrents" box and leave the text field blank!" Be sure to enable the RSS feed once you're done.


  5. Now you have an RSS feed, but you'll also need a filter to match on this feed. Add a new filter, provide a name and directory and leave the "Filter" field blank, check the "Filter searches titles" and "Filter searches link" boxes. From the "Feed" list, choose the feed you defined above. The plugin understands the naming conventions for TV shows, so if you specify that the Type is a TV Show you can then specify which series and which episodes you're interested in. Enable the filter and set the Mode to "Pass". You won't be able to test the filter using the Test button, since it's matching on everything.

  6. Check that both your RSS feed and the filter is marked as active and you should start receiving the episodes you specified!

  7. Repeat the above steps for each show you want to download.


Note: We've setup the RSS feed search through tvrss.net to match exactly the shows we're interested in, so we don't need to reduce the selection further in the filter. If you did want to make a further selection from the filter you should set the Filter field to something. For example, I have an RSS feed that displays all the CSI shows (Las vegas, Miami and New York), but the series and episode numbers I'm interested in are different for each of those. So I defined three filters, where each uses a regular expression to match the correct show, e.g.: .*miami.* to match CSI Miami. This shouldn't be necessary for most shows, since you can refine the search enough using the tvrss.net site.

April 2nd, 2006


  1. Download the AIX version: "WebLogic Server 9.1 for IBM AIX (5.2, 5.3, pSeries)" from: http://download2.bea.com/pub/platform/91/server910_generic.jar

  2. Install it with the command:
    sudo java -Dos.name=unix -jar server910_generic.jar 
    (without the os.name set to unix the installer will fail with an error about lack of disk space).

January 14th, 2006

Yes, you can do MIDP development under Mac OS X with NetBeans! NetBeans is a great IDE for Java development, it's just a pity that Sun hasn't released a Mobility Pack for Mac OS X.


But there are other MIDP device emulators, notably the excellent mpowerplayer which is a pure Java implementation and works beautifully on OS X. So all that's needed is to copy over a mobility pack (from linux or windows) and then configure it to use mpowerplayer, instead of the default WTK; here's how to do it:


  1. Download and install the NetBeans IDE for Mac OS X from NetBeans.org, in this example I used 5.0-RC1, and installed it in /Developer/Applications.


    Note: The default font size of NetBeans on a 15 inch powerbook, makes the code look like it was written with a blunt crayon and also wastes valuable screen real-estate. If you'd like a smaller font you can add the following line:

    fontsize 11

    to the startup command in the file:

    /Developer/Applications/NetBeans.app/Contents/Resources/NetBeans/bin/netbeans



  2. Next, download and install mpowerplayer, I unpacked the archive in /usr/local/mpp-sdk. Also ensure that the preverifier tool has execute permissions, in this case:

    chmod 755 /usr/local/mpp-sdk/osx/preverify/preverify

  3. Download and install NetBeans and the mobility pack on a Linux or Windows system.

  4. In the NetBeans installation directory on the Windows/Linux system, copy the folder called "mobility7.2" to the /Developer/Applications/NetBeans.app/Contents/Resources/NetBeans folder on your Mac.

  5. Because of what looks like a bug in NetBeans, I couldn't execute the debugger directly from NetBeans, so as a workaround created a shell script to act as a wrapper. So I created the folder /usr/local/mpp-sdk/scripts and /usr/local/mpp-sdk/scripts/temp, and then created the file /usr/local/mpp-sdk/scripts/nb-debug.sh with the following contents:


    #!/bin/sh
    rm -f /usr/local/mpp-sdk/scripts/temp/*
    FILEBASE=`echo $1|sed s/\.jad//`
    TRANS=$2
    SERVER=$3
    SUSPEND=$4
    ADDRESS=$5

    echo "FILEBASE= $FILEBASE.*">> /usr/local/mpp-sdk/scripts/log
    cp -f $FILEBASE.* /usr/local/mpp-sdk/scripts/temp
    java -Xdebug -Xrunjdwp:transport=$TRANS,server=$SERVER,suspend=$SUSPEND,address=$ADDRESS -jar /usr/local/mpp-sdk/player.jar /usr/local/mpp-sdk/scripts/temp/*.jad


    Remember to give the script execute permissions.

  6. Now we're ready to fire up NetBeans and configure the IDE. Under the Tools -> Java Platform Manager, you should see a section for J2ME (if you don't, then you probably copied the mobility7.2 folder to the wrong location). Choose Add Platform, and the choose Custom Java Micro Edition Platform Emulator, and fill in the following information:


    Platform Home:/usr/local/mpp-sdk
    Platform Name:MPowerPlayer (or whatever you'd like to call it)
    Device Name:MPP (or whatever you'd like to call it)
    Preverify Command:"{platformhome}{/}osx{/}preverify{/}preverify" {classpath|-classpath "{classpath}"} -d "{destdir}" "{srcdir}"
    Execution Command:java -jar {platformhome}{/}player.jar {jadurl}
    Debugger Command:{platformhome}{/}scripts{/}nb-debug.sh {jadfile} {debugtransport} {debugserver} {debugsuspend} {debugaddress}


    Note: Make sure that you entered these values correctly, because it may not be possible to make individual changes later on without entering all the values again. Any edits to these values after this setup is completed, were ignored by NetBeans. I had to remove the mpowerplayer platform and then add it again.


  7. Next, you should add the classes.jar file from: /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Classes to the Bootstrap libraries.
    Note: You should also add a 1.4.2 JDK as a J2SE platform, if you only have a 1.5 JDK listed as a platform.

  8. When starting a new MIDP project, you'll have to change the project properties to use the new MPowerPlayer platform instead of the default WTK (Thanks Rhys).

  9. All done! NetBeans should now be configured to build and debug J2ME projects!


Thanks to Lukas Hasik for this blog entry explaining most of the above procedure.

Debugger attached:


Flow design:

December 8th, 2005

Hippy FreeBSD support for Java is about as good as the Pope’s support for satanic gay marriages. After installing a JDK from ports (which first requires installing linux compat, then a linux jdk, then download some patches from a 3rd party site, then make sure you have 2Gb free and then do make install) Tomcat SSL wasn’t working because the keytool utility was hanging when trying to create a cert.
The solution is to first point some IRQ’s at the PRNG using the rndcontrol utility, e.g.: rndcontrol -s 5 and then rndcontrol -s 10 to get some proper entropy before running keytool.
Powered by LiveJournal.com