Saturday, July 24, 2010

Finally My iPhone 4

After a long month and a half wait I finally have my iPhone 4. It all started back on the first day of pre-orders. I tried and tried to order one online with Apple and AT&T, but was never able to get through. I decided to try a lesser known method and reserved one at Radio Shack, but not just any Radio Shack the only one on Cape Cod; the place I would be on launch day. Fast forward to launch day, I go down to the Radio Shack and they only received four iPhones and I wasn't in the top four on their reserve list. So the waiting game begins. All the Apple stores are not selling to people unless they are on the pre-order/reserve list and I assume at this point the list is getting long. I could order one from Apple, but it is going to take several weeks. AT&T started the first come first serve purchasing, but I totally missed the boat on it. Then on our way to New Jersey I get a call from the Radio Shack on Cape Cod letting me know they have an iPhone 4 for me. Unfortunately, I have to pass, for now, since we are headed in the wrong direction. A week later we are still on the Jersey Shore and I get another call about another iPhone 4 for me. Again I have to pass.

Finally, this morning, a mere two seconds from mentioning the lack of a call, the friendly Rebecca from the Orleans Radio Shack calls and I finally verbally accept the iPhone 4. The only problem is: 1. Orleans is over 2 hours away from my house and 2. Cape Cod traffic is famous for being horrible on the weekends. I take a quick look at Google Maps and decide to wait until later in the day. Finally around 4pm the traffic starts to lighten up and I plan to leave at 5pm. For some reason traffic through the heart of Boston continues to be red and I decide to add an extra 20 miles by taking a loop around the city on RT 128. It ended up taking only 2 hours and 15 minutes, which was about 17 minutes faster than Google Maps predicted. The time would have been better if I didn't run into some rain on the Cape.

I spent about 30 minutes in the store activating it before going over to a local coffee shop to load the iPhone from a back up of my old iPhone. Here is one place where the iPhone shines, within a couple minutes I had loaded from the back up and all of my contacts, apps, music, email settings, ringtones, and almost everything else was automatically setup exactly like my old phone. All the data from the apps was right where I left it in both my gas app to my calorie counting app. Apple has done a great job with the back up process and the virtually seamless transition between devices. I bought a bunch of chocolate goodies and hopped in the car. So far the iPhone 4 has been great, my only complaint is with the included headphones and how difficult it is to put them into the headphone jack. I don't know if the pair I received is defective or not, but it was hard to put them in and also proved even harder taking them out. I might have to stop by the Apple Store next week and get some replacements.

Tuesday, July 20, 2010

ASP.NET and IIS

As part of an upcoming integration project at work it seems that I will need to learn another web application server platform, Microsoft's Internet Information Service (IIS). As part of my setup I need to make sure that IIS is installed and also it supports ASP.net.  Once those steps are complete I can proceed with the integration.  Here is an IIS tutorial for anybody with Windows XP Professional.


  • Install IIS
    • Go to Add/Remove Programs. Start Menu > Control Panel > Add or Remove Programs.
    • Click the Add/Remove Windows Components on the left navigation bar. 
    • Select the Internet Information Services (IIS) optoin and hit Next.

    • This will install IIS, just click complete when it is done.
  • Verify the IIS Install
    • By default a new directory c:\Inetpub\wwwroot will be created.
    • Create a new text file here with the name HelloWorld.html
    • Insert the following into the file and save it:
      <html> <body><h1>Hello World</h1></body></html>
    • Launch the Windows Run dialog either Start > Run... OR WindowsKey-R
    • Type in the command inetmgr and press enter.
    • Navigate to the Default Web Site node in the navigation tree to display the files on the right.

    • Right click on HelloWorld.html and select Browse. This should launch the page in your browser.
  • Configure ASP.NET
    • Go back to the c:\Inetpub\wwwroot directory.
    • Make a copy of HelloWorld.html and call it HelloWorld.aspx
    • Insert the following into the file after the Heading <%   response.write(Request.ServerVariables("SERVER_SOFTWARE")) %>
    • Go back to the inetmgr
    • Navigate to the Default Web Site node again.
    • In the menu choose Action > Properties
    • Go to the ASP.NET tab in the pop up and select a version in the ASP.NET version drop down.
    • Hit OK.
    • Back in the IIS Manager click on the Web Service Extensions node in the navigation tree.
    • Click on the ASP.NET web extension and then hit Allow.
    • Navigate back to the Default Web Site node in the navigation tree.
    • Right click on the HelloWorld.aspx file and choose Browse to launch it in your browser.
    • You should see the Hello World heading along with a print out of the current version of IIS.
The only problem I faced when doing this was getting the ASP.NET version set correctly.  I ended up going to the .NET SDK Download Site and getting the latest version, but in hindsight it may not have been necessary.  The other thing I did as part of this setup was to create a Virtual Directory.  The Virtual Directory allows you to specify a Virtual Path for a directory that contains files you want to serve which aren't necessarily in the same directory as your Default Web Site. It basically lets you add an additional directory to the path in the URL, for example http://localhost/SampleWebSite.

Wednesday, July 14, 2010

iOS 4 on the iPhone 3G

I was going to go through the pain of putting together a video of the horrid performance of iOS 4 on the iPhone 3G, but luckily I found a nice video which sums it up perfectly.  Enjoy, iOS4 on iPhone 3G

Tuesday, July 6, 2010

Five Bars At Last

The saga for setting up my AT&T 3G MicroCell has come to an end.  Today I gave the support line another call and spoke to Adam.  I told him my story and he said they had fixed the activation in the middle of the week and I shouldn't have any problems related to activation after last Thursday.  I also asked him about whether or not activation involves the device because the previous guy told me it did not.  Again he corrected what the other tech had said and told me it would only be activated once the device connected.

I went through the exercise of submitting removing the existing device from my account and re-added it under a different name.  I reset it, but still I just got "Activation Pending". I had read online about problems people were having with their router causing trouble so I connected the MicroCell directly into the cable modem.  I restarted the cable modem and MicroCell and within twenty minutes the 3G light, which had been flashing for days was finally solid.  I ran for my phone and within a few seconds it detected the MicroCell and displayed five bars.  It wasn't long before a text message and email came through from AT&T telling me the MicroCell had been activated. The activation process definitely involved the hardware connection to complete.  Hallelujah!!!!

The battle was still not over, I now had to figure out how to include my Apple AirPort Extreme router in the mix.  I unplugged everything and connected cable modem->router->MicroCell.  Upon restart and lots of waiting, no dice.  I tried an alternate installation suggested in the documentation cable modem->MicroCell->router.  Restarted everything and voila everything worked.

I made my first call and despite having a "Call Failure" message on the first attempted dial I was able to call my dad and had a good test call.  The call quality was better than before, but still sounded a bit choppy at times.  Of course I don't know if that was my end or his end.

So for now I will begin testing this crazy AT&T MicroCell device and will put together a review in the coming weeks.
2 Things I Learned While Setting Up My AT&T 3G MicroCell:
1. The activation process will only be complete once the hardware successfully connects to the AT&T network.  Until that happens you will see Activation Pending when looking online.
2. You may need to tweak the settings on your router to make the MicroCell work.  My current setup of modem->MicroCell->router is considered a last ditch effort by AT&T.  I did find an Apple Support Discussion with possible AirPort Extreme settings changes to make it work in the modem->router->MicroCell setup.

iOS 4 on the iPhone 3G Update

Last week I posted an entry about the slowness of my iPhone 3G after updating to iOS 4.  As with most slowness I was starting to get used to it so it didn't seem so slow, but of course every once in a while I was reminded with an extended wait for a specific app.  So.... last night I decided to attempt a clean restore of iOS 4 to see if the situation improved.  It took about 15 minutes to restore the phone to iOS 4 and then over an hour to reload it from a back up.  Apple really needs to find a way to make syncing between an iPhone and iTunes faster, because it is sooooo slow.  Everybody seems to want over-the-air syncing, but I can't imagine how this would be faster even if slightly more convenient.  Okay enough about syncing, once all was said and done I unplugged the iPhone and tested it out and it was a bit snappier.  Again this morning I used it and I saw some more improvements in performance, but typically performance seemed better after a fresh restart so I am going to hold my final judgement until later in the day.

Friday, July 2, 2010

iPhone 4 Reception Issue Blamed on Software Algorithm Issue

Today Apple posted an open letter on their website stating that the apparent reception issues people are seeing with the "Death Grip" are caused by a bad algorithm they used for setting the number of bars.  I am sure this will fix a majority of the issues people are seeing, but who knows.

Here is the code I recommend for iOS 4.0.1 to fix the bug in the method for returning the number of bars to show.
public int getNumberOfBarsToDisplay(int signalStrengthDecibels)
{
    //if(signalStrengthDecibels < -113)
    //{
    //    return 0;
    //}
    //else if(signalStrengthDecibels < -107)
    //{
    //    return 1;
    //}

    //else if(signalStrengthDecibels < -103)
    //{
    //    return 2;
    //}
    //else if(signalStrengthDecibels < -101)
    //{
     //   return 3;
    //}
    //else if(signalStrengthDecibels < -91)
    //{
    //    return 4;
    //}
    //else
    {
        // Fix bug that was caused by the Death Grip.
        // Always return 5 bars.
        return 5;
    }
}

Here is the source for the decibel breakdown from AppleInsider, here.

Rant Friday

I feel it is my duty to update on the current status of my MicroCell.  Status: Nothing has changed.  My account online continues to say "Activation Pending" and the little green 3G light continues to flash on the device.  I am guessing this will not get fixed by the end of the weekend.  It would be one thing if the device had a subtle design, but instead it is this giant white plastic upside down Y shaped thing.  It doesn't help that it has to sit next to the router and cable modem, which already sit in our kitchen and the 50 feet of cable total that Apple and the modem company thought people would need (we only need about 2 feet).  The worst part is paying $150 for something to get a signal on my phone and now I still have no service, but AT&T has my money.  Ahhhhh!!!

Now onto my friends at Apple.  I am going to write off this antenna thing for the time being as a lot of media hype and besides I don't currently get service in most cases anyway (see above), so it isn't a big deal for me.  However, I do have a new gripe with the fruit company. What is the point of having a store if you can't buy anything?  The two most showcased items in the Apple Store right now are the iPhone 4 and the iPad.  They probably have 30 of each for demonstration purposes, the problem is if you actually want to buy one, well frankly you can't.  Now I understand not being able to keep the iPhone 4 in stock, its only been out for a week, but the iPad as of tomorrow will have been out for three months. Ridiculous!!  Maybe I should sell my AAPL stock now before people realize the number of sales of the iPhone and iPad each day at least in the Apple Store in the Burlington Mall are 0.0.  Maybe they should march the neglected Macintosh computers out into the spotlight and get people to buy some of those instead of just teasing people into liking a smartphone or tablet they can't even buy.  On the bright side maybe those people will be turned on to touch screen smartphones and go buy a Droid X on July 15th, leaving the next shipment of iPhone 4's all to me.  Until then I am sticking it out with this super slow iPhone 3G with iOS 4.

Thursday, July 1, 2010

Getting Flex and JBoss to use SSL

I have spent the last 7 or so hours at work trying to configure our Flex client to connect to our JBoss 4.2.3 server using SSL.

Now that I have figured it out here are the steps to make it work. The assumption is you have JBoss 4.2.3 installed and are able to access a web app on port 8080 over plain old http.

Types of SSL
JBoss supports at least two implementations of SSL:
Java Secure Socket Extension (JSSE) which uses the Java Runtime.
Apache Portable Runtime (APR) which uses OpenSSL.

Based on my version I am going to go out on a limb and say by default JBoss 4.2.3 uses APR out of the box.  You can verify this by looking in the server.xml found in your JBoss installation at /server/default/deploy/jboss-web.deployer/server.xml. At the very top of the file is a Listener tag for the AprLifecycleListener, which by default has the SSLEngine turned on. Below are the instructions for installing using both APR and JSSE.



APR SSL Setup Instructions
Generating a Private Key and Certificate
In order for all this SSL craziness to work you need to generate a private key and a certificate.  These can be generated using the OpenSSL command line tool.  All can be generated locally, but typically the certificate is generated by a Certificate Authority.  The following instructions show you how to create a self signed certificate. The private key and certificate will be kept in the /server/default/conf directory.

1. Open  a command line tool and navigate to /server/default/conf
2. Generate a private key: Execute openssl genrsa -des3 -out server.key 1024
3. Generate a certificate request: openssl req -new -key server.key -out server.csr
4. Generate a self signing certificate: openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
5. Voila you now have a private key and certificate in the conf directory called server.keystore

Configuring JBoss For SSL
The {jboss}/server/default/deploy/jboss-web.deployer/server.xml file now needs to be modified to connect on https.  This requires the addition of a Connector tag in the file specifying the port, keystore location and also the keystore password.  

1. Open {jboss}/server/default/deploy/jboss-web.deployer/server.xml in your favourite text editor.
2. By default the Connector for https is commented out (you can find it by searching for 8443)
3. Add a new Connector to the file:
<Connector port="8443" SSLEnabled="true"
    maxThreads="150" scheme="https" secure="true"
    SSLCertificateFile="${jboss.server.home.dir}/conf/casenet.crt" 
    SSLCertificateKeyFile="${jboss.server.home.dir}/conf/casenet.key"
    clientAuth="false" sslProtocol="TLSv1" />

4. You can modify the port as you like and also update the SSLCertificateFile and SSLCertificateKeyFile as is appropriate.
5. Save the file.


JSSE SSL Setup Instructions
Generating a KeyStore
In order for all this SSL craziness to work you need to generate a keystore for your server.  This keystore is created using the Java keytool executable.  The keystore will be kept in the /server/default/conf directory.

1. Open  a command line tool and navigate to /server/default/conf
2. Execute keytool -genkey -alias tomcat -keyalg RSA -keystore server.keystore
3. Enter '123456' as the password when prompted.
4. You will also be prompted to enter your name, organizational unit, organiation, city, state and country. Enter the appropriate values for you.
5. When prompted to enter the key password just hit enter to make it the same as the keystore password.
6. Voila you now have a key in the conf directory called server.keystore

Configuring JBoss For SSL
The {jboss}/server/default/deploy/jboss-web.deployer/server.xml file now needs to be modified to connect on https.  This requires the addition of a Connector tag in the file specifying the port, keystore location and also the keystore password.  In order to use JSSE we need to override the default protocol with org.apache.coyote.http11.Http11Protocol. This will cause it to override the APR SSL

1. Open {jboss}/server/default/deploy/jboss-web.deployer/server.xml in your favourite text editor.
2. By default the Connector for https is commented out (you can find it by searching for 8443)
3. Add a new Connector to the file:
<Connector port="8443" SSLEnabled="true"
protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" scheme="https" secure="true"
keystoreFile="${jboss.server.home.dir}/conf/server.keystore" keystorePass="123456" clientAuth="false" sslProtocol="TLS" />

4. You can modify the port as you like and also update the keystoreFile and keystorePass as is appropriate.
5. Save the file.




Verify Results for Either SSL
Now that you have created a keystore and also added a new connector you should be able to start up JBoss without errors. To verify you can now go to https://{server name}:{port}/{webapp}. You will be prompted to accept the certificate and once you accept the page should load.

Here are two very helpful sources: Steps for Building A Hello World Web App,  Apache Tomcat SSL How ToJBoss Community SSL Config, and How To Create a Self Signed Certificate

Updating the Flex Client
We use Granite and Gravity for transferring objects between the Flex client and the JBoss server.  All you need to do is update the services-config.xml Granite file.

Locate the channeldefinition tags and update them to use the secure channel classes and also update the URL to include https.
<channel-definition id="myApp-graniteamf" class="mx.messaging.channels.SecureAMFChannel">
<endpoint uri="https://localhost:8443/myApp/graniteamf/amf"
class="flex.messaging.endpoints.SecureAMFEndpoint" />
</channel-definition>