Archive for category Useful Information

Automating your Android phone with Tasker : Part 1

For those of you with an Android phone, you need to get Tasker. If you don’t have it, you’re missing out on a truly great application. It’s described as “Total Automation for Android” by the author, but what does that mean for you? Well it’s simple really, your phone does things, you do things in response to that. Tasker can do most of that for you. Let me put that in a few practical examples.

  • You like to disable your Wifi radio to save power, but you want it running when you’re at home or at work. Tasker can do this for you by looking at what cell towers your connected to. (More on this later, but it’s ridiculously awesome and doesn’t burn battery like using the GPS does)
  • You get home, your phone gets in range of Wifi and connects automatically. Normally, you’d want your ringer on and at max volume. Tasker can detect that you’re connected to your home Wifi network and setup the ringer for you.
  • You get into your car and plug your phone in. Normally, you’d want the wifi turned off, 4G turned on, hotspot enabled, and the car panel application started. Tasker can do all of that for you.
  • When you boot your phone, you need your phone setup a certain way. I like mine with the Display Rotation turned off, brightness on auto, display timeout at 30 seconds, WiMax off, etc. Tasker does all of that for me.
  • The Wifi sticks sometimes, but cycling it fixes the problem. Tasker cycles my Wifi for me every night and I no longer have issues.
  • Because I disable rotation, I lose the ability to view the Gallery and Browser in landscape mode. Tasker enables it for me whenever I start the Gallery and Browser applications and disables it when I exit them. This prevents my phone from entering landscape mode on my home screen (which drives me nuts) but lets me use rotation in the applications that I select.
  • Tasker can also create shortcuts/widgets to tasks, this allows you to perform many steps at once, such as my Wifi cycle task. This is also handy for things like my ringer enable task, which also sets the volume levels after it enables the ringer so my phone is always at the volumes I like.

And that’s just the beginning of what is possible with Tasker.

Part of the problem with Tasker is understanding what everything is. Most people probably haven’t read the Tasker manual (tl;dr), so let’s go over some Tasker terminology.

    • Action – A single thing that you want Tasker to do, like Turning the Wifi Radio on.
    • Task – A collection of actions. Tasks can contain one or many actions. An important thing to remember about Tasks is that you can call one Task from another Task. This will come in handy for repeating common tasks.
    • Profile – Profiles are used to define the states of when to execute tasks. Basically, you “enter” a profile when your phone matches all of the criteria of the profile, and you “exit” a profile when it no longer matches. You are allowed to define a task for entry and exit of profiles. This is how you correlate your tasks to what your phone is doing and teach it how to respond accordingly.

In this first article, I’m going to demonstrate my most common uses for Tasker.

First off, go download Tasker from the Android Market. (More links and a QR code at the bottom of this post)

Now that Tasker is installed, fire it up. It requires no real configuration so no need to worry about that yet. The first thing you want to do is change to the Flat view of your profiles. Contextual is great once you get the hang of Tasker, but for now, we’ll go with Flat. So at the Tasker screen, hit Menu -> View -> Flat.

Creating some tasks

The first thing you’re going to want to do is create some common tasks. These are things that you want to do from many profiles, like set the ringer volume. We’ll start by creating 3 tasks.

      • From the main screen, hit the Lightning Bolt icon (It’s the 4th one on the toolbar).
      • Now hit “New Task”. Name it “Ringer Enable”.
      • Hit the check mark and you’ll be at the Task Edit screen.

In my ringer enable profile, I like to set enable the ringer, and then set all of the volumes in one task. This way, the volume is always right. So first, let’s enable the ringer.

      • Hit the blue “+” button.
      • Go to “Audio”, then “Silent Mode”.
      • Set “Mode” to “Off” and hit the Green check mark.

Now let’s set the volumes.

      • Hit the “+” again, go to “Audio”, then “Alarm Volume”, set it to maximum volume (For me, that’s “7″).
      • Hit the check mark.
      • Now do the same for Notification Volume, Ringer Volume, and System Volume.

In addition to this, I like to add a popup notification.

      • Hit “+” again, go to “Alert”, then “Flash”. In the “Text” field, enter “Audio Mode”.

When you’re done, the task should look something like this.

Ringer Enable in Tasker

You now have a task that will setup your ringer the way you like it and notify you that it’s done. You’ll use this task a lot later.

Now create a Task called Ringer Disable, except this time set Silent Mode to “On” and set the Alert to “Silent Mode”. Don’t bother adjusting the volume controls this time. They’re all irrelevant since the ringer is off. Create one last task called “Ringer Vibrate” with Silent Mode set to “Vibrate” and the alert set to “Vibrate Mode”. You now have a base set of tasks to control the sound levels on your phone. For me, this alone was a life saver.

Here is what the other two ringer tasks look like.

Ringer Slient in Tasker

Ringer Vibrate in Tasker

Putting your tasks to work using profiles.

Now that we have some basic tasks in place, let’s put them to work. To do that, let’s create a profile. First off, let’s do a startup profile. In this profile, we’re going to setup the ringer, disable rotation, etc.

      • From the main menu, hit green “+” button on the toolbar.
      • Name the Profile “Startup”.
      • In the dialog box that pops up (First Context), select “Event”
      • Select “System”, then “Device Boot”
      • Hit the green check mark and when the Task Selection dialog pops up, select “New Task”.
      • Name it “Device Bootup”
      • In this task, first add an action to kill display rotation. (Display -> Display Rotation -> Off)
      • Now setup your desired brightness. I like automatic mode so I add an Action for it. (Display -> Auto Brightness -> On)
      • Disable your WiMax (this is handy if you have a phone that has the annoying habit of turning on 4G every time it reboots, thus draining the crap out of your battery for no reason). The action is under Net -> WiMax. Set it to off.

Now it’s time to turn the ringer on. Because we already have a task for it, let’s just call that task instead of repeating the same tasks.

      • Add an action to call the Ringer Enable task. Hit the + button, then select “Task”, then “Perform Task”. Press the magnifying glass that’s about the “Name” field and select your “Ringer Enable” task.

Your phone is now setup to configure itself the way you want it every time you reboot it.

This is what my Device Boot task looks like.

Device Bootup in Tasker

This concludes part one of this article. Next time, I’ll go over executing tasks based on what cell towers you’re near. This is one of my favorite features as it lets me control the behavior of my phone when I’m near home or my office. Used in concert with the “Wifi Connected” state, it allows me shut the Wifi off when I’m not near areas that don’t have it, but turn it on when I get close, and then setup the phone the way I like it for those certain areas. If you have Bluetooth for your car, you can use the “Bluetooth Connected” state to know when you’re in the car and act accordingly.

Enjoy the beginnings of Tasker! Be sure to hit the Tasker site and check out the documentation for more examples, then hit the Tasker Wiki for some really wild examples of what you can do with Tasker. Be forewarned, a lot of the stuff on the Wiki is very advanced, so get some practice under your belt before you dive into the advanced tasks.

Tasker Homepage Link
Tasker Market Link
Tasker Wiki Link
QR Code :
Android Market Link for Tasker

, , ,

No Comments

Linksys E4200 and IPv6

On June 14th, 2011, Linksys released firmware update 1.0.02 (Build 13) for hardware version 1.0 of the Linksys E4200. This firmware contains the long awaited implementation of IPv6 for the E4200!

The good news is, it works! The bad news is, not with Comcast apparently. More on that later. First things first, here’s a screenshot of my current setup.

Linksys E4200 IPv6 Configuration Dialog

 

The first thing you’ll notice is that I had to disable the Automatic mode. That’s the “doesn’t work with Comcast” part. I put it in place, rebooted it a few times, released and renewed my IP, nothing. It could be my modem, but I doubt it. I’m using a DOCSIS 3.0 compliant surfboard which should be IPv6 compliant. Maybe it’s Comcast, but who knows?

In order to get this working, flip the “IPv6 – Automatic” toggle to Disabled, then put the “6rd Tunnel” to Manual Configuration. (The “Automatic Configuration” of the 6rd Tunnel didn’t work either.) Once you’re in Manual mode, you can head on over to tunnelbroker.net and create yourself a login and a new tunnel. (Note : You’ll have to enable ping in order for Tunnel Broker to work. Go to Security -> Firewall and clear the check box next to “Filter Anonymous Internet Requests“. This will allow ICMP requests to come through and Tunnel Broker will allow you to create a tunnel.) Once you have the tunnel created, enter the “Server IPv4 Address” from tunnel broker into the “Border Relay” field on the E4200. Now enter the “Routed /64” from tunnel broker into the “Prefix” on the E4200. (Note : You need to get rid of the “::/64″ off of the end of the field that tunnel broker gives you.) Put “64” into the Prefix Length and “32” into the IPv4 Address Mask and Save Settings.

Head over to Status -> Router and at the very bottom, you should see “Tunnel Status:  Connected“. If you don’t, hit the Connect button. One thing, I did have to release and renew my IPv4 address for some reason. Probably because I was fiddling with all of the tunnel configurations, trying to get this thing to work.

Good luck and if anyone has any luck connecting to Comcast in Automatic mode, let me know. I’d love to go native instead of tunneling!

, , , , , , , , , ,

2 Comments

Exact Audio Copy and Nero’s AAC Encoder Part 2 : Update for EAC 1.0b2

The boys at Exact Audio Copy have been putting in some OT and there’s now a new version that does cover art available! Actually, it’s been available for quite a while but I haven’t updated because I was being lazy. :)

In my last article, I spent a lot of time talking about what options I had changed and all of that. In this case, most of my setup options upgraded correctly from my old options so I’m not exactly sure what I’ve changed from the defaults anymore. I’ve taken a screenshot of the relevant dialogs for comparison though. Keep in mind that I run a “Insert, Rip, and Eject” setup so I’ve got everything wired to be pretty much automatic.

Here are the dialogs for the general options. The external compression options that I use have changed quite a bit since the 1.0b2 release, so I’ll go into those more shortly.

EAC options - Extraction
EAC options - General
EAC options - Tools
EAC options - Filename
EAC options - Directories

And now on to the good stuff… the encoder options. EAC 1.0b2 changed all of the tag formats, fortunately it converted all of mine when I upgraded so I didn’t have to go figure them all out again. (Thanks to the EAC developers on that, it would have SUCKED) Here’s a screenshot of the configuration dialog.

Compression options - External Compression

Here are my settings for this dialog so you can copy/paste. :)

Use external program for compression : Checked
Parameter passing scheme : User Defined Encoder
Use file extension : .m4a
Program, including path, used for compression : C:\Windows\System32\cmd.exe
Additional command-line options : /E:ON /C C:\Tools\aacencode.cmd %source% %dest% “%artist%” “%albumtitle%” “%title%” “%year%” “%tracknr%” “%numtracks%” “%genre%” “%comment%” “%cddbid%” “%coverfile%”
Delete WAV after compression : Checked
Use CRC check : Checked
Add ID3 tag : Unchecked
Check for external programs return code : Unchecked

And now for the script that you need to make it work. I keep mine in “C:\Tools\”. If you put yours somewhere else, adjust the paths above accordingly.

@echo off
REM Use with cmd.exe and the command line of
REM /E:ON /C C:\Tools\aacencode.cmd %source% %dest% "%artist%" "%albumtitle%" "%title%" "%year%" "%tracknr%" "%numtracks%" "%genre%" "%comment%" "%cddbid%" "%coverfile%"
 
SET SOURCEFILE=%1
SET DESTFILE=%2
SET ARTIST=%3
SET ALBUMTITLE=%4
SET TRACKTITLE=%5
SET YEAR=%6
SET TRACKNUMBER=%7
SET TOTALTRACKS=%8
SET GENRE=%9
SHIFT
SHIFT
SHIFT
SET COMMENT=%7
SET ISRC=%8
SET COVER=%9
 
C:\Tools\min.exe
C:\Tools\NeroAAC\Win32\neroaacenc.exe -q 1.0 -if %SOURCEFILE% -of %DESTFILE% 
C:\Tools\NeroAAC\Win32\Neroaactag.exe %DESTFILE% -meta:artist=%ARTIST% -meta:album=%ALBUMTITLE% -meta:track=%TRACKNUMBER% -meta:title=%TRACKTITLE% -meta:genre=%GENRE% -meta:year=%YEAR% -meta:isrc=%ISRC% -meta:totaltracks=%TOTALTRACKS% -meta:comment=%COMMENT%
C:\Tools\NeroAAC\Win32\Neroaactag.exe %DESTFILE% -add-cover:front:%COVER%

Here’s the zip archive of my scripts and tools to make all of this work. You’ll still need to download the Nero AAC Encoder yourself. Check the script to see where I put mine and adjust paths accordingly. I have also included a utility called “min.exe” that goes in C:\Tools. This utility minimizes the window so you don’t have to start at the Nero encoder window. Remove it if you don’t like that and you’re rather see the Nero AAC encoder do it’s thing.

AAC Encoder wrapper script

Once you’ve got all of this in place, pop in a CD and EAC should automatically go out and get the track information from FreeDB or GD3. If you’re using GD3, it’ll get the cover art too. If you’re using FreeDB, you’ll have an option to search for cover art and you’ll have to go select your own. (I also find cover art on Amazon’s CD store if the EAC search doesn’t get it) Now that your album information is loaded and ready, press F4 to do a gap scan, then press SHIFT-F5 to fire off the rip and compress process.

, , , , , , ,

1 Comment

Exact Audio Copy and Nero’s AAC Encoder

Update 2011/06/11 : I have updated these scripts for EAC 1.0b2, click here for the new article.

Having recently done a significant upgrade to the audio system in my Maxima and finally having an iPod option, I was faced with the dilemma of what format to encode my music in. I’ve got over 600 audio CDs that I’ve purchased over the years and I really wanted to get them into a common format. Seeing as all of my players and streaming devices support it now, AAC was the obvious choice. After several experiments and a lot of ripping, Exact Audio Copy and Nero’s AAC Encoder proved to be the best choice for sound quality when creating AAC files. The problem is that they don’t really work together out of the box…

With the help of my good friend Google, a little scripting, and a lot of patience, I’ve now come up with a way to encode AAC files through EAC in a simple process. Here are the steps I’ve taken to get Nero’s AAC encoder and Exact Audio Copy to play nice together. This also includes tagging the AAC files. :) I’ve attached the script I use to the end of this post.

First things first, grab a copy of Exact Audio Copy and Nero’s AAC Encoder. Install EAC and extract the AAC encoder to the folder of your choice. (For this example, I’ve extracted it to C:\Tools\NeroAAC)

Now it’s time to create a script file to launch NeroAAC. EAC’s “external tools” command line doesn’t allow enough characters to run all of the commands we’re going to run and we’re also passing more than 9 command line parameters so we have to do some shifting and such. Here is the contents of the file I use to execute Nero AAC. I’ve named my file aacencode.cmd and saved it into C:\Tools. If you need to adjust the quality settings of Nero AAC, this is the file where those settings are located. Run the NeroAACEnc utility to see what options are available. This batch file has the quality cranked to maximum. At this level it’s really difficult to tell the resulting AAC files from the original CDs. :)

@echo off
REM Use with cmd.exe and the command line of
REM /E:ON /C C:\Tools\aacencode.cmd %s %d "%a" "%g" "%t" "%y" "%n" "%x" "%m" "%e" "%f"
 
SET SOURCEFILE=%1
SET DESTFILE=%2
SET ARTIST=%3
SET ALBUMTITLE=%4
SET TRACKTITLE=%5
SET YEAR=%6
SET TRACKNUMBER=%7
SET TOTALTRACKS=%8
SET GENRE=%9
SHIFT
SHIFT
SET COMMENT=%8
SET ISRC=%9
 
C:\Tools\NeroAAC\Win32\neroaacenc.exe -q 1.0 -if %SOURCEFILE% -of %DESTFILE% && C:\Tools\NeroAAC\Win32\Neroaactag.exe %DESTFILE% -meta:artist=%ARTIST% -meta:album=%ALBUMTITLE% -meta:track=%TRACKNUMBER% -meta:title=%TRACKTITLE% -meta:genre=%GENRE% -meta:year=%YEAR% -meta:isrc=%ISRC% -meta:totaltracks=%TOTALTRACKS% -meta:comment=%COMMENT%

Now it’s time to configure EAC. Launch EAC and go into the EAC menu in the top left. Go to “Compression Options”, then click the “External Compression” tab. Check the “Use external program for compression” option and select “User Defined Encoder”. In the file extension box, put “.m4a”. In the Program Path, select C:\Windows\System32\cmd.exe. If you’re using a different directory for your windows installation, please adjust accordingly. In the Additional command-line options, use the following
/E:ON /C C:\Tools\aacencode.cmd %s %d "%a" "%g" "%t" "%y" "%n" "%x" "%m" "%e" "%f"
Note : If you’re not using the same script file name or path as me, please adjust accordingly.

Make sure the “Add ID3 tag” is unchecked, the rest of the options are personal preference or irrelevant.
(Just a footnote, all of this configuration was done with EAC 0.99 prebeta 5)

This is what my screen looks like

Now would be a good time to go through the rest of the options in EAC and set up your desired directory structure, file naming conventions, etc. All of this needs to be done before the ripping process begins!

Once this is done, insert an Audio CD into your drive and when the track list comes up in EAC, click the CD icon on the tool bar to get CD information from FreeDB. Once the tracks are titled to your liking, select all of the tracks (use Edit -> Select All if you’re ripping the whole CD), and press Shift-F5 to extract the tracks and use the selected compression tool. You can also use the menus to do this.

That’s it! EAC should now begin extracting the tracks and firing off NeroAAC after each track. Enjoy the show!

As promised, I’ve attached my batch file so you won’t have to depend on copy/paste. :)
AAC Encoder wrapper script

, , , , , , ,

5 Comments

More Android apps!

Since my last post on my favorite Android apps, I’ve found more that I like and decided to share them. I’ll skip the intro and just get right into the meat of things!

Enjoy the apps and thanks for the suggestions last time!

, , , , , ,

No Comments

My favorite Android apps so far!

I’ve had several friends recently take the Android plunge and ask me what apps that i’m using, so I decided to write them up in a list for everyone to enjoy and comment on. They’re listed in no particular order and I’ve provided a link to them in the doubleTwist app catalog so you can read a description and scan the QR code to install.

If you’re new to Android, this app is the first thing you need to install. With it, you can scan the square bar codes (QR codes) on the app pages and your Android device will fire right into the market and let you install the app. So simple! Check out the description and icon on the following page, then search the Android market on your device and load the one with the same icon. It’s free and it works.

Once you’re ready with that, you’re going to need a good keyboard. I’ve said it before, and i’ll say it again. Swype is the way to go. It’s currently in Beta right now so you won’t be able to get it from the Android market, but trust me when I tell you that it’s worth signing up for the Beta and replacing your old keyboard with the Swype one. Here’s the link to the developer’s site. Give Swype a week as your default input method and you won’t go back.

Now that you’re able to Swype and ready to barcode scan, check out the following links and load some apps!

I hope you enjoy these apps as much as I have. Feel free to comment on them or make recommendations of your own.

Special Thanks to House of The Faculty for providing me with some updates and several of these apps.

, , , , , ,

11 Comments

Woo Hoo! WordPress 3.0 is here!

Check this thing out! Congrats to the WordPress team on making what i’m sure will be another amazing release. Seeing this video reminds me of why I’m using WordPress and why I’ve been using it since the 1.x days. It was great software then, it’s amazing software now, 3.0 looks to raise the bar yet again! (Just when you didn’t think they could get any more features into this thing… SURPRISE!) And now on to the video…

, , ,

No Comments

2 Years of Lifereef

It’s been two years since I set up the 90g tank, complete with Lifereef equipment. I didn’t really know much about Lifereef when I bought the tank, but my interactions with them have been nothing short of fantastic. In the past few years, i’ve had no problems with the system other than my ignorance of the hobby in general. The owner of Lifereef has always been responsive and helpful with every request I made. This is amazing considering I didn’t even buy the stuff from him directly… I got it second hand! I have ordered some additional equipment from Lifereef and everything has always been delivered as promised and the craftsmanship of the product is still fantastic.

Here’s to two years of a successful reef tank, powered by a Lifereef sump, skimmer, and refugium. Everything is still working like a champ, the tank looks great, and I couldn’t be happier with the service. Very nicely done Lifereef.

… Now it’s time to go clean all of the nasty fish poop out of that skimmer. :)

, , , , , ,

No Comments

Adobe Flex, BlazeDS, and TIBCO EMS

I’ve searched high and low and can’t really find a good walk through on how to configure TIBCO EMS and BlazeDS. The documentation can also be a little gray on how to correctly use the JMS adapter so i’ve taken the liberty of putting together this little pictorial on how it’s done.

First things first, get yourself a fresh copy of Eclipse. For this setup, I used Eclipse Ganymede (3.4, J2EE Edition) on Windows. You’ll need the Java stuff in addition to Flex Builder because we’re going to launch our own tomcat inside of Eclipse instead of using BlazeDS Turnkey or any of those. Also, if you want to add in Java remoting later you’ll appreciate having the components already there.

Next, install the Flex plugin for Eclipse and update according. I downloaded and installed the Flex 3.3 SDK and changed my default SDK in the preferences. Once the eclipse platform is installed, updated, and configured the way you like it, let’s make a new project.

Note: Click any one of these images for the full size version.
Step 1 - Create a new Project of type "Other"

Step 1 - Create a new Project of type "Other"

Step 2 - Expand the Server category and then select Server

Step 2 - Expand the Server category and then select Server

Step 3 - Create an Apache Tomcat v6.0 Server on Localhost

Step 3 - Create an Apache Tomcat v6.0 Server on Localhost

Step 4 - Set Installation Directory and JRE, Install if Necessary

Step 4 - Set Installation Directory and JRE, Install if Necessary

Step 5 - No projects yet, just hit Finish

Step 5 - No projects yet, just hit Finish

Step 6 - Create another new project of type "Other"

Step 6 - Create another new project of type "Other"

Step 7 - Now expand the Flex Builder category and select "Flex Project"

Step 7 - Now expand the Flex Builder category and select "Flex Project"

Step 8 - Set it for a J2EE application server and enable the combined Java/Flex project using WTP

Step 8 - Set it for a J2EE application server and enable the combined Java/Flex project using WTP

Step 9 - Connect the project to your Tomcat server and select the blazeds.war that you downloaded from Adobe

Step 9 - Connect the project to your Tomcat server and select the blazeds.war that you downloaded from Adobe

Step 10 - Everything should be good here

Step 10 - Everything should be good here

Step 11 - If everything went well, you should see have the following files available

Step 11 - If everything went well, you should see have the following files available

Step 12 - Open the web.xml, messaging-config.xml, and services-config.xml

Step 12 - Open the web.xml, messaging-config.xml, and services-config.xml

First, let’s edit web.xml. This file should be okay out of the box. Here’s mine as a reference.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>blaze1</display-name>
 
	<context-param>
		<param-name>flex.class.path</param-name>
		<param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value>
	</context-param>
 
	<!-- Http Flex Session attribute and binding listener support -->
	<listener>
		<listener-class>flex.messaging.HttpFlexSession</listener-class>
	</listener>
 
	<!-- MessageBroker Servlet -->
	<servlet>
		<servlet-name>MessageBrokerServlet</servlet-name>
		<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
		<init-param>
			<param-name>services.configuration.file</param-name>
			<param-value>/WEB-INF/flex/services-config.xml</param-value>
		</init-param>
		<init-param>
			<param-name>flex.write.path</param-name>
			<param-value>/WEB-INF/flex</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>
 
	<servlet-mapping>
		<servlet-name>MessageBrokerServlet</servlet-name>
		<url-pattern>/messagebroker/*</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
 
	<!-- for WebSphere deployment, please uncomment -->
	<!--
		<resource-ref>
		<description>Flex Messaging WorkManager</description>
		<res-ref-name>wm/MessagingWorkManager</res-ref-name>
		<res-type>com.ibm.websphere.asynchbeans.WorkManager</res-type>
		<res-auth>Container</res-auth>
		<res-sharing-scope>Shareable</res-sharing-scope>
	</resource-ref>
	-->
</web-app>

Now let’s edit services-config.xml. Key things to note here is that i’ve disabled the inclusion of the remoting-config.xml and the proxy-config.xml since i’m not using them. I’ve also changed the default AMF channel from “my-amf” to “AmfChannel1″ and updated the endpoint URL. Everything else is pretty much the same.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
 
    <services>
    	<!--
        <service-include file-path="remoting-config.xml" />
        <service-include file-path="proxy-config.xml" />
        -->
        <service-include file-path="messaging-config.xml" />        
    </services>
 
    <security>
        <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
        <!-- Uncomment the correct app server
        <login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss">
		<login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>        
        <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>
        <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
        -->
 
        <!-- 
        <security-constraint id="basic-read-access">
            <auth-method>Basic</auth-method>
            <roles>
                <role>guests</role>
                <role>accountants</role>
                <role>employees</role>
                <role>managers</role>
            </roles>
        </security-constraint>
         -->
    </security>
 
    <channels>
        <channel-definition id="AmfChannel1" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/AmfChannel1" class="flex.messaging.endpoints.AMFEndpoint"/>
        </channel-definition>
    </channels>
 
    <logging>
        <target class="flex.messaging.log.ConsoleTarget" level="Error">
            <properties>
                <prefix>[BlazeDS] </prefix>
                <includeDate>false</includeDate>
                <includeTime>false</includeTime>
                <includeLevel>false</includeLevel>
                <includeCategory>false</includeCategory>
            </properties>
            <filters>
                <pattern>Endpoint.*</pattern>
                <pattern>Service.*</pattern>
                <pattern>Configuration</pattern>
            </filters>
        </target>
    </logging>
 
    <system>
        <redeploy>
            <enabled>false</enabled>
            <!-- 
            <watch-interval>20</watch-interval>
            <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</watch-file>
            <touch-file>{context.root}/WEB-INF/web.xml</touch-file>
             -->
        </redeploy>
    </system>
 
</services-config>

And last but not least, messaging-config.xml. This file is where the JMS connection is made to the TIBCO EMS server. And no, you do not have to put anything in context.xml when you’re doing it this way. :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?xml version="1.0" encoding="UTF-8"?>
<service id="message-service" 
    class="flex.messaging.services.MessageService">
 
    <adapters>
        <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true" />
        <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/>
    </adapters>
 
    <default-channels>
        <channel ref="AmfChannel1"/>
    </default-channels>
 
	<destination id="jmsDest1">
		<properties>
			<jms>
				<!-- topic/queue -->
				<destination-type>topic</destination-type>
				<!-- What type of message we expect -->
				<message-type>javax.jms.TextMessage</message-type>
				<!-- This is the JNDI name of the topic/queue connection factory on the server -->
				<connection-factory>TopicConnectionFactory</connection-factory>
				<!-- This is the JNDI name of the topic/queue on the server -->
				<destination-jndi-name>testTopic</destination-jndi-name>
				<!-- Keep JMS headers when the message is delivered to Flex -->
				<preserve-jms-headers>true</preserve-jms-headers>
				<!-- If we're producing on this destination, what parameters should be used -->				
				<delivery-mode>NON_PERSISTENT</delivery-mode>
				<message-priority>DEFAULT_PRIORITY</message-priority>
				<acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
				<!-- The following lines are for the JNDI connection -->
				<initial-context-environment>
					<property>
						<name>Context.INITIAL_CONTEXT_FACTORY</name>
						<value>com.tibco.tibjms.naming.TibjmsInitialContextFactory</value>             
					</property>
					<property>
						<name>Context.PROVIDER_URL</name>
						<value>tcp://localhost:7222</value>             
					</property>
					<property>
						<name>Context.SECURITY_PRINCIPAL</name>
						<value>admin</value>
					</property>
					<!-- Uncomment if you have a password
					<property>
						<name>Context.SECURITY_CREDENTIALS</name>
						<value>password</value>
					</property>
					-->
				</initial-context-environment>
			</jms>
		</properties>
		<channels>
			<channel ref="AmfChannel1"/>
		</channels>
		<adapter ref="jms"/>
	</destination>
 
</service>

Now we have our Tomcat instance set up, time to import some class libraries.

Step 13 - Right Click the lib directory under WebContent/WEB-INF/lib select Import

Step 13 - Right Click the lib directory under WebContent/WEB-INF/lib select Import

Step 14 - Select General and then File System

Step 14 - Select General and then File System

Step 15 - Select the TIBCO EMS 5.x library directory and select all of the .jar files (There are more than what is pictured here)

Step 15 - Select the TIBCO EMS 5.x library directory and select all of the .jar files (There are more than what is pictured here)

Step 16 - Open up the server view by selecting Window -> Show View -> Other

Step 16 - Open up the server view by selecting Window -> Show View -> Other

Step 17 - Select the Server category and select Servers

Step 17 - Select the Server category and select Servers

Step 18 - Click the Servers tab that appeared at the bottom, highlight the Tomcat Server and click the Debug icon

Step 18 - Click the Servers tab that appeared at the bottom, highlight the Tomcat Server and click the Debug icon

Step 19 - Start the EMS Server instance

Step 19 - Start the EMS Server instance

Step 20 - Create the topic that was referenced in the messaging-config.xml file

Step 20 - Create the topic that was referenced in the messaging-config.xml file

Now jump back into Eclipse and set up the application. I started with a base form, added a text area and called it a day. Here’s the code to add in the message consumer, channel configuration, and event handlers.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
	applicationComplete="messageConsumer.subscribe()">
	<mx:Script>
		<![CDATA[
			// Import the required namespaces
			import mx.messaging.events.MessageEvent;
			import mx.messaging.events.ChannelEvent;
			import mx.messaging.messages.AsyncMessage;
 
			private function incomingMessageHandler(event:MessageEvent):void
			{
				logArea.text += (event.message.body + "\r");
			}
 
			private function connectEventHandler(event:ChannelEvent):void
			{
				logArea.text += (event.channel.endpoint + " is now connected.\r");
			}
 
			private function disconnectEventHandler(event:ChannelEvent):void
			{
				logArea.text += (event.channel.endpoint + " is now disconnected.\r");
			}
		]]>
	</mx:Script>
	<mx:TextArea id="logArea" editable="false" width="95%" height="95%"/>
	<mx:Consumer id="messageConsumer"
		destination="jmsDest1"
		message="incomingMessageHandler(event)"
		channelConnect="connectEventHandler(event)"
		channelDisconnect="disconnectEventHandler(event)">
		<mx:channelSet>
			<mx:ChannelSet>
				<mx:channels>
					<mx:AMFChannel
						url="http://localhost:8080/blaze1/messagebroker/AmfChannel1"/>
				</mx:channels>
			</mx:ChannelSet>
		</mx:channelSet>		
	</mx:Consumer>
</mx:Application>

That should do it for the code work … now for the fun stuff. :)

Step 21 - Fire up the debugger (use the dropdown next to the button)

Step 21 - Fire up the debugger (use the dropdown next to the button)

Step 22 - Select Debug As, then Debug on Server

Step 22 - Select Debug As, then Debug on Server

Step 23 - Select the installed Tomcat image

Step 23 - Select the installed Tomcat image

Step 24 - The project should appear on the right, press Finish

Step 24 - The project should appear on the right, press Finish

Note : The first debug attempt will fail because Eclipse doesn’t correctly deploy the application. What I haven’t figured out is how to correctly associate the project without using the Debug or Run options. If you know a better way, leave a comment. :)
Step 25 - Hit Debug As again and hit the "Flex Application" choice

Step 25 - Hit Debug As again and hit the "Flex Application" choice

Step 26 - If everything worked, you should now be staring at the application and should have a message that the channel has connected.

Step 26 - If everything worked, you should now be staring at the application and should have a message that the channel has connected.

Step 27 - Now send a text message to the JMS topic using your favorite JMS client and enjoy the result!

Step 27 - Now send a text message to the JMS topic using your favorite JMS client and enjoy the result!

That should do it! Enjoy your new found JMS happiness. As a reference, a Channel is what the Flex application uses to communicate with BlazeDS and can be HTTP or AMF. A Destination is where you send the messages to and from. A lot of the examples i’ve found don’t show you how to declare what channel you’re talking to as it’s supposed to be handled automatically, i’ve found this to be unreliable and once I started specifying the channel everything started working flawlessly so i’m staying with it. Also, you can do multiple channels for redundancy and such, but that’s a lesson for another day. ;)

, , , , , , , , , , , ,

2 Comments

Linksys WRT610N and IPv6

Thanks to the shoddy job that Linksys did with the WRT300N, I grudgingly purchased a new Linksys WRT610N. What a pleasant surprise! Finally another decent product from Linksys. Not that i’ve ever expected much from the bargain networking gear, but the WRT300N was very, very bad. Several of the features didn’t work consistently, new firmware was no where in sight, and the 802.11n was abysmal. The WRT300N made me regret ever upgrading from the WRT54GS, which was one of the best routers on the market and still is in the 802.11g game.

Fortunately the new WRT610N solves most of those problems. The simultaneous 2.4/5ghz radios make life really nice and performance is good. I’m now able to run all of my 802.11n gear on 5ghz while 802.11g stays on 2.4ghz. Each radio can also be restricted accordingly. Very handy. Well done Linksys. The updated features of the firmware are always welcome as well. More granular control over the system for those who need it definitely helps. And then there are those surprise features that we get from time to time.

I’ve recently started running IPv6 on my home network for the enhanced features that are offered. Things that were extensions in v4 are part of the standard in v6 and can make life nice, especially in high throughput situations. Imagine my surprise when I was updating my Ubuntu box and noticed that the WINE mirrors’ IP address was a v6 one! So apparently, the WRT610N does IPv6, it just doesn’t tell you! This is some scary stuff folks, imagine that modern operating systems come with IPv6 enabled and people go and buy this router, not knowing that their doors are now open via a whole new protocol. Granted, most home users will never know, but I seriously wonder if the firewall in the 610N has v6 support.

Let’s hope that Linksys is one step ahead of us here or a lot of users are about to get their horizons broadened when the hackers start coming in via IPv6. :(

For those who are unfamiliar with IPv6 and would like to know more, Ars Technica has a nice primer. Read more here.

, , , , , , ,

13 Comments