Thursday, January 21, 2010

Moving my Blog!

Things have been VERY busy, here at Intertech (in the best way possible)... and as a result, my blogging had to take a backseat.  In addition, all of the Intertech blogs are being moved to our own server; I'll post that URL shortly.  As things settle down, I expect to get back to writing about the things I love! 

Actually, that isn't completely accurate - I never really stopped!  I've been writing and sharing bite sized bits of information every day on our Twitter account!  If you have an account, you can add @intertechinc or go to http://twitter.intertech.com/  - When you add me, send me a note so I can add you back, and also let me know what kind of technologies you work with: I've created several public lists to help us developers and tech enthusiasts network with one another!  In addition to the usual discussions on new APIs, technologies, and yes... LOST, we'll also be tweeting periodic contests and posting free seminars & specials!  Please tell your friends! :)

Subscribe

Thursday, October 22, 2009

Intertech - Course Planning

I'm putting the finishing touches on the follow-up to my "Access Modifiers" entry, but first wanted to make a quick request for some feedback.  Here at Intertech - http://www.intertech.com/  - we're investigating new topics and technologies that we can add to our training offerings.  Your opinions on this are important, so if you could take a few minutes to fill out a survey by clicking this link: 2010 Intertech Course Planning Survey... I'd really appreciate it!

... and as an extra incentive, you'll receive a coupon for $250 off any Intertech training course in 2010 - just for completing the survey!


Subscribe

Friday, October 9, 2009

Access Modifiers in Java


I've always felt that the standard explanation for Access Modifiers in Java:
  • Public = Accessible to All
  • Protected = Accessible to the Class, any Class in the same Package, and any Subclass
  • Default = Accessible to the Class, and any Class in the same Package
  • Private = Accessible only to the Class itself. 
...wasn't entirely accurate (and admittedly, since most designs stick with basic encapsulation: private fields and public methods, more specific details are often academic).

So to illustrate the complexity, I've created three simple classes.  The first two, "Parent" and "Child" are in the same package.


package com.intertech.examples.java.accessmodifiers;

public class Parent
{
   public void printPublicMessage()
   {
      System.out.println( "printPublicMessage()" );
   }

   protected void printProtectedMessage()
   {
      System.out.println( "printProtectedMessage()" );
   }

   void printPackageMessage()
   {
      System.out.println( "printPackageMessage()" );
   }

   private void printPrivateMessage()
   {
      System.out.println( "printPrivateMessage()" );
   }
}


and ...


package com.intertech.examples.java.accessmodifiers;

public class Child extends Parent
{
   // Does nothing but extend Parent
}


Which methods from "Parent" do you think would be visible to the three objects below (note that this class extends Parent as well, but is in another package). 

package com.intertech.examples.java.accessmodifiers.another;

import com.intertech.examples.java.accessmodifiers.Child;
import com.intertech.examples.java.accessmodifiers.Parent;

public class AnotherChild extends Parent
{
   public static void main( String[] args )
   {
      Parent parent = new Parent();
      /* which "Print" methods from the Parent class would be visible for this Parent object? */

      Child child = new Child();
      /* which "Print" methods from the Parent class would be visible for this Child object? */

      AnotherChild anotherChild = new AnotherChild();
      /* which "Print" methods from the Parent class would be visible for this AnotherChild object? */
   }
}

Try to do this without putting it into an IDE or running the actual code. I'll post the answers next week with some further explanation.  You can find more information on "Complete Java" or other courses taught at Intertech - by visiting our website: http://www.intertech.com/

Thursday, October 1, 2009

Microsoft Security Essentials: Freezing / How to Remove

Microsoft recently announced a free anti-virus application called "Microsoft Security Essentials" - http://www.microsoft.com/security_essentials/

While most of my friends have installed this without issue, I had the complete opposite experience: immediately after the updating of the signature files, my computer froze.

Restart -> Freeze -> Restart -> Freeze -> Restart -> Freeze... grr...

Each time I would do a hard shutdown (by holding in the power button), and restart, I would attempt to remove the software. Unfortunately, my computer would freeze before this was possible. Although the installation does tell you to remove other anti-virus / anti-spyware software, which I did, I believe that my issue was the result of a conflict with a firewall. [Edit - 10/1/09, 3:10 PM - According to this comment and this other comment, it looks like my firewall was the likely culprit]

No big deal, I've had software conflicts before: boot into safe mode and remove the software.

That's when I saw this:


"Can't run the Microsoft Security Essentials setup on a computer running in safe mode." Great. I can't remove the software in normal mode and I can't remove it in safe mode. Now what?!

After a few trial and errors here are the steps I took to be able to uninstall the app...

To be clear, I'm not encouraging people to uninstall or avoid this software; if my computer hadn't exhibited this effect, I would be using it right now! These are just instructions you can use if you are having the same issues I was (i.e after installing MSE your computer freezes. You decide you want to uninstall it, but are unable to do so). For those of you that fit this description, you can follow these steps - at your own risk, of course :)


Step #1:
Reboot into Safe Mode. In most versions of windows, this is done by tapping the F8 key during boot-up.
If you are unfamiliar with how to do this for your specific version of Windows, just check google; there are tons of "how to boot into safe mode" websites out there...)

Step #2:
Start up MSCONFIG: go to the Start menu, type "MSCONFIG" in the search box.


Step #3:
Select the "Selective startup" radio button in the "General" tab.


Step #4:
Uncheck "Microsoft Antimalware Service" from the "Microsoft Corporation" in the "Services" tab.
If you are having trouble finding this, you can click the "Service" header and it will sort the list alphabetically.


Step #5:
Uncheck "Microsoft Security Essentials" from "Microsoft Corporation" in the "Startup" tab. Click "OK"


Step #6:
MSCONFIG should ask you if you want to restart (or it may do it automatically after clicking "OK"). Allow it to restart and after windows has finished loading, uninstall Microsoft Security Essentials as you normally would (typically through the Control Panel).


Step #7:
Load MSCONFIG as you did in Step #2, and return the "Startup selection" to "Normal startup." Click OK, and restart your computer.
Good Luck!!!

Subscribe

Wednesday, September 30, 2009

Globalization Answers

Here are the answers to the Internationalization (i18n) quiz from a few entries ago.

1) What are the three elements that make up a Java Locale?
A - Language, Country, and a Variant.

2) What is the ISO standard that defines available "Variants?"
A - While there are ISO standards that are used for the Language and Country code, the Variant is up to the developer.

3) What GUI considerations do you need to make, in regards to localization?
A - Text expansion / contraction / direction. Elements such as table cells can be pushed out in ways not expected or visible when viewing a page in one's native language.

4) What is the difference between "internationalization" and "localization?"
A - Internationalization is the process of extracting hard coded regional specific information (text, date/time stamps, number formatting, etc.) and using various APIs to return localized content at runtime. Localization is the process of creating one or more "resource bundle" with regional specific information. For example, one would internationalize their application to prepare it for serving any number of languages / regions, and would later localize the application for the languages / regions they wish to support (by creating a resource bundle for each region).

5) What is the purpose of a ListResourceBundle?
A - To return any kind of localized object the developer wishes. This is in contrast to creating a property resource bundle which handles localized text.

6) How do you pass parameters to a PropertyResourceBundle?
A - First you put place holders in your property file for where you want the parameters to appear in the text. These place holders are written as zero-indexed integers surrounded by curly braces (i.e. Hello {0}, Today's date is {1}). Next the parameters are substituted with the actual data at runtime by using the MessageFormat class.

7) How do you implement a "locale-agnostic" search or sort algorithm?
A - Use a Java Collator

8) What happens if you have a resource bundle that is more specific than a user's submitted locale (i.e. a user's locale is "en", and your resource bundle is "en_US")?
A - If this is the only resource bundle created for the application, the bundle would not be located. The search pattern for a locale is to find the exact resource bundle submitted, and if nothing is found, it will try to find a more general bundle. Since the language code is the most general locale that can be created, it will attempt to find a resource bundle that matches the application's default locale (or something more general). Finally it will try to find a resource bundle with no locale specified at all.

My next entry will be focused on the topic of Access Modifiers in Java. The basic, and most common usage (private properties and public methods) result in fairly predictable results, but you may be surprised by some of the visibility issues with protected and package modifiers!

Subscribe Share/Save/Bookmark

Wednesday, September 23, 2009

Globalization / i18n Webinar Available Now!

In my last entry, I listed several questions to test your knowledge about Globalization / Internationalization. Before I post the answers to those questions, I'd like to invite you to view my presentation on "Globalizing Your Java Application" - which can be found here: http://www.intertech.com/downloads/o2-i18n/stream/

After you have had a chance to view the presentation, try taking the quiz again and see if any of your responses have changed. I'll post the answers in a few days!

Subscribe Share/Save/Bookmark

Tuesday, September 15, 2009

Resource Bundles

Last week I delivered a presentation on "Globalizing Your Java Application." The purpose of my talk was to define the various processes and APIs that help ease this task - as well as to emphasize the idea that "internationalizing" your software is a good practice... even when you are only required to support one language.

If you missed this presentation, stay tuned - I've just finished recording it and am in the editing process. It will be available on YouTube very shortly... http://youtube.intertech.com/

In the meantime, you can test your knowledge by answering these questions:

1) What are the three elements that make up a Java Locale?
2) What is the ISO standard that defines available "Variants?"
3) What GUI considerations do you need to make, in regards to localization?
4) What is the difference between "internationalization" and "localization?"
5) What is the purpose of a ListResourceBundle?
6) How do you pass parameters to a PropertyResourceBundle?
7) How do you implement a "locale-agnostic" search or sort algorithm?
8) What happens if you have a resource bundle that is more specific than a user's submitted locale (i.e. a user's locale is "en", and your resource bundle is "en_US")

Answers will follow in my next post...
Subscribe Share/Save/Bookmark