h1

Japanese Language Learning Resources

February 10, 2019
I’ve recently started learning Japanese. These are some of the resources that I’m using.

Rosetta Stone for Japanese

https://amzn.to/2I50JiL
This is the core of my study, but it’s also the most expensive. There are ways that you can get access to it for free. Our local library has a deal where you log into the library web site, link over to Rosetta Stone and then it launches the app on your iPad. The route to the app is a little circuitous, but it’s saves some money. The only disadvantage is that you have to be online to use the app. Not a problem most of the time, but if you’re on a plane without WiFi, it can be annoying.

Drops Japanese

https://languagedrops.com/learn-japanese/
Drops is a visual way of learning vocabulary by dragging words to pictures on iOS or Android. The free version of the app gives you 5 minutes per day. Since I’m using it with a bunch of other things, that’s just fine for me. If you pay for the full version ($159 for life) you get unlimited time each day.

Sticky Study Japanese

http://www.stickystudy.com/japanese.html
I’m a HUGE advocate for flashcards. I made thousands of them when I was in language school and had this method of speed learning small groups of cards and then bringing them back together into larger groups based on how confident I was with the word. Sticky Study does that in digital form. It covers thousands of characters and includes reading writing and hearing. It also shows larger words the characters fit into, phrases and a lot more. I found that I got a lot out of reading the user guide (http://www.stickystudy.com/manuals/japanese/index.html) before I started using the app. It describes their approach to flash cards and a few elements of the user interface that I didn’t grok at first.
StickyStudy is $8.99 to own the full version.

Japanese Pod 101

https://www.japanesepod101.com/
This site is just bursting with quality PDFs, videos, podcasts and other materials. Their YouTube channel (https://www.youtube.com/user/japanesepod101) is awesome. Right now I’m just using all of their free content, but I’m very tempted to move to the paid version. The only problem is that it’s a subscription model and I really prefer just paying all at once and keeping it for life. They have a $4, $10 and $24 a month plan. But for now I’ll just use the free stuff. Two of my favorite videos so far: 1) Learn Kanji in 45 Minutes (https://www.youtube.com/watch?v=mPppVDX_GiY) – gives you an overview of Kanji the radicals and how it’s built. 2) 10-Day Hirigana Challenge (https://www.youtube.com/playlist?list=PLPSfPyOOcp3SxDZf7gkbApq_PrJsGf7Pn) – These videos teach you all of the sounds in the Japanese alphabet and mnemonics to help you remember them. I’ve been watching these videos on the elliptical. Great material.

Learn Japanese: A Complete Phrase Compilation for Traveling to Japan

https://amzn.to/2WOPmil
This is an audiobook that is more focused on Japanese for travel. It’s from the folks at Japanese Pod 101. The difference between this and the other materials is that it dives straight into the vocabulary that you need for getting a table at a restaurant, buying a train ticket, etc. They don’t do enough repetition to make you really learn it, but if you just play the lessons again and again, it works.

DuoLingo for Japanese

https://www.duolingo.com/course/ja/en/Learn-Japanese-Online
I’ve been dabbling with this one. It’s not part of my core materials, but there is some good stuff there.
Have some suggestions of your own? Please comment below.
h1

Not Being Evil (Google and Japan)

March 11, 2011

This post isn’t about Java, or food or an interesting quote. It’s about Google honoring its corporate motto of Don’t Be Evil. Not only are they not being evil, but they’ve done a good thing today.

Within hours of the recent earthquake in Japan they’ve set up a Google Crisis Response for the 2011 Japanese Earthquake and Tsunami.The page has alerts and warnings, bulletin boards, transportation information, power outages information, maps (with KML data links so it can be used in other applications) and a Person Finder where people can post information about people they are looking for or people they have information about.

That’s awesome! Kudos to the folks at Google!

Feel free to leave comments below.

Josh

h1

Definition: Programmer

January 3, 2011

“Programmer – def: an organic machine which converts caffeine into source code”
(on a shirt at CafePress)

h1

Smitty’s Sangria

October 15, 2010

I spent some time living in Spain and tried a bunch of sangrias. Once I returned stateside I missed the sangria on hot afternoons. After trying dozens of recipes I took elements of each and ended up with my own recipe that my friends and family seem to really like. Enjoy!

Ingredients

  • Approximately 1/2 gallon of red wine (Carlos Rossi Sangria base or another Spanish red)
  • 1  to 1 1/2 cup apricot brandy
  • 1/2 to 1 cup triple sec
  • 1 cup orange juice
  • 1 cup apricot nectar
  • 1/2 to 1 cup sprite
  • half an apple
  • half an orange
  • cinnamon

Directions

  1. Combine the liquid ingredients in a large pitcher.
  2. Chop the fruit into bite size pieces and add to pitcher.
  3. Sprinkle cinnamon over the top.
  4. Chill.
  5. Drink. Mmmmmm.
h1

Extracting Integers from Strings

October 7, 2008

The following snippet of source code extracts a single digit from a String and converts it to an int. The String.charAt() method takes a zero-based index of the position of the character to be extracted from the String and the Character.digit() method takes the String from which to extract the digit and the radix.

In the example below I pass 0 to the charAt() method since I want the first character extracted and I pass 10 as the radix since I’m working in base 10.


String myString = "3blindmice";
int digit = Character.digit(myString.charAt(0), 10);
System.out.println("Digit: " + digit);

Output: 3

If the position passed to charAt is not a valid position within the String then a java.lang.StringIndexOutOfBoundsException is thrown.

If the radix is not between Character.MIN_RADIX and Character.MAX_RADIX, -1 is returned.

Comments, alternate solutions and related snippets of code are welcome.

Joshua Smith


References:

API for java.lang.Character.digit(char, int)

API for java.lang.String.charAt(int)

h1

Adding a Java Platform to NetBeans Under Mac OS X

October 13, 2007

This article describes how to add a Java Platform to NetBeans under Mac OS X. This enables you to compile and run your applications under different virtual machines and also to associate Javadocs and source code with a Java platform so that they can be used by NetBeans for code generation and in-context tips and documentation.

These steps assume that you are running NetBeans 6

  1. Select Tools -> Java Platform
  2. Click the Add Platform… button. This will open the Add Java Platform window. Here you will seen all of the Java Platforms that are installed your system.
  3. Drill down until you find the Home folder. Select it and click the Next button.
  4. If you have locally stored copies of source or Javadocs you can associate those with the platform using the Browse buttons. Click the Finish button when you’re done.
  5. Click the Close button.
  6. You can now select this platform for a project by right-clicking a project and selecting Properties. The setting is under the Libraries node.
  7. Finished

Screenshots:

Java Platform ManagerAdd Java PlatformAdd Java Platform 2Project Properties Library

    h1

    Application Monitoring with JConsole

    January 31, 2007

    Introduction

    Hidden in the bin directory of the JDK distribution are some little known, but useful tools. In this article we’ll look at the basics of using jconsole to monitor threads, memory usage and object creation.

    Setting Your App Up to Be Monitored

    If you’re running Java 6, you’re all good to go. The option to allow your application to be monitored is on by default. Skip to the section entitled Launching JConsole and collect 100 points for being on the cutting edge.

    If you’re on Java 1.42 or earlier, do not pass go, or collect $200. Time to upgrade. JConsole requires Java 5 or later.

    If you’re on Java 5, then you need to start the application that you want to monitor while passing an extra flag to the JVM to enable monitoring. For our example we’re going to launch the SwingSet demo that comes with the JDK. If you’re on Windows, Linux or Solaris it’s usually located in %JDK_HOME%/demo/jfc/SwingSet2. If you’re on Mac OS X, it’s usually in /Developer/Examples/Java/JFC/SwingSet2.

    Launching the Application to be Monitored

    If you’re launching the application from the command line, simply add -Dcom.sun.management.jmxremote=true right after the java command. Like this:

    java -Dcom.sun.management.jmxremote=true -jar SwingSet2.jar

    If you’re launching the application from within Eclipse, select Run -> Run…, click on the Arguments tab and specify -Dcom.sun.management.jmxremote=true in the VM arguments field.

    If you’re launching the application from within NetBeans, select the Project, right-click and select Properties, select Run node and specify -Dcom.sun.management.jmxremote=true in the VM Options field.

    Launching JConsole

    JConsole comes with the JDK (not the JRE) and can be found in %JDK_HOME%/bin on Windows, Solaris and Linux and in /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands on Mac OS X. To launch it, open a terminal or command window, change to the directory containing it and execute jconsole. This should open a window that looks like this:

    Jconsole Start

    Click the Connect button to begin monitoring your app. As you can see from the screenshots below you can can view summary information, threads usage, memory usage, current and total classes loaded.

    Jconsole Summary

    Jconsole Threads

    Jconsole Memory

    Jconsole Classes

    The information provided by jconsole is invaluable when tracking down thread creep or memory leaks. It works great to monitor an app while putting it through its paces or when leaving it to run over the weekend to ensure there aren’t any uphill graphs. It’s easy, free and doesn’t require any extra work during application development.

    Joshua Smith

    Technorati Tags: , , , ,

    h1

    Using F-Keys in Mac OS X

    January 31, 2007

    F-Keys are used for special operating system wide functionality in Mac OS X. In this article we’ll discover how to take control of the Mac OS X F-Keys and use them in applications that map keyboard shortcuts to F-Keys.
    By default in Mac OS X the F-Keys provide operating system wide functionality. For instance, F3 and F4 handle volume. F9, F10 and F11 are used for Exposé’s window tricks. That’s nice for being able to get at those features from within any application, but it really messes things up if an application uses F-Keys as a part of their standard keyboard shortcuts. NetBeans is a perfect example. Shift-Command-F4 is the keyboard shortcut for closing all documents, but on Mac OS X, F4 turns down the volume – not the desired output.
    The trick on Mac OS X is that little fn key in the corner of your keyboard and a single setting under System Preferences -> Keyboard & Mouse. By default the F-Keys do Mac OS X things. If you want them to do application specific things you can hold down the fn key and then press the desired F-Key. If you’d like to reverse this behavior, check the box next to “Use the F1-F12 keys to control software features.” With that box checked everything is reversed. The F-Keys will do application specific things and to access the Mac OS X features, you will need to hold down the fn key while you press the desired F-Key. Pick your poison. In either case you have all of the functionality, it’s just a matter of which one you have to hold the extra key for.

    Keyboard And Mouse-1

    Joshua Smith

    Resources

    Amazon Book: Mac OS X for Java Geeks
    Amazon Book: Mac OS X Panther Hacks
    Using NetBeans on Mac OS X
    Marc Liyanage Blog: NetBeans Mac Customization
    Marc Liyanage Blog: More NetBeans on Mac OS X

    Technorati Tags: , ,

    h1

    Not All Assignments are Created Equal

    January 30, 2007

    Many introductory Java books will tell you that the compound assignment operators (e.g. b += 1) are just a shorthand for doing an assignment where something is assigned the result of itself involved in some arithmetic operation (e.g. b = b + 1). In this article we’ll see that the difference between compound operators and their supposed expanded versions can be the difference between running and failing to compile.

    These are supposed to be equivalent right?

    
    byte b1 = 0;
    b1 = b1 + 1;
    
    byte b2 = 0;
    b2 += 1;
    

    Well, that’s what a lot of books will tell you. For many cases they’re very close to equivalent and it’s certainly a fair way to describe them to a junior programmer that is just being exposed to compound operators for the first time. Once you start studying for the Sun Certified Java Programmer (SCJP) test or just dig a little deeper into the language you find that there is a subtle, yet important difference.

    This will not compile:


    byte b1 = 0;
    b1 = b1 + 1;

    Why not? It looks pretty straightforward. The reason lies in how Java handles integer arithmetic. All integral expressions in Java result in at least an int. That means that if the operations involve a long they’ll result in a long, but if they involve ints, shorts or bytes (the integral types that are smaller than a long) they will still result in an int. Since an int does not fit in a byte, it fails at compile time.

    On the other hand, this compiles fine:


    byte b2 = 0;
    b2 += 1;

    So why does that work? Isn’t it pretty much the same thing as the code above that won’t compile? It turns out that Java inserts an implicit cast when the compound operator is used. The compound assignment is actually translated to something like this:


    byte b2 = 0;
    b2 = (byte)(b2 + 1);

    The implicit cast handles the problem of narrowing that comes from assigning an int (32 bits) to a byte (8 bits).

    Joshua Smith

    References


    SCJP Sun Certified Java Programmer Study Guide

    Technorati Tags: ,

    h1

    main() Methods in Java

    January 29, 2007

    Introduction

    The main() method is probably one of the most familar structures in the Java language. It can easily be auto-generated in Eclipse by typing “main” followed by Ctrl-Space and in NetBeans by typing “psvm” followed by a space. It’s the entry point into thousands of applications and while it’s familiar, it also has a few hidden secrets. In this article we’ll look at more than a dozen variations of the main() method. Some will compile and run as expected. Others will not compile at all. Still others will compile and run, but can’t be used as an entry point into an application.

    The Methods

    Look at the methods below. Which ones will not compile? Which ones will compile, but can’t be used as entry points into an application? Which ones compile and act as you would expect a main method to act?

    
    public static void main(String[] args) {
        System.out.println("Main1!");
    }
    
    public static void main(String[] someOtherName) {
        System.out.println("Main2!");
    }
    
    public static void main(String... args) {
        System.out.println("Main3!");
    }
    
    public static void main(String[] args)
      throws Exception {
        System.out.println("Main4!");
    }
    
    static void main(String[] args) {
        System.out.println("Main5!");
    }
    
    public void main(String[] args) {
        System.out.println("Main6!");
    }
    
    public static void main(String args[]) {
        System.out.println("Main7!");
    }
    
    public static void main(String[] args[]) {
        System.out.println("Main8!");
    }
    
    public static void main(String[][] args) {
        System.out.println("Main9!");
    }
    
    public static void main(String args) {
        System.out.println("Main10!");
    }
    
    public static void main(String[] args)
      throws IOException {
        System.out.println("Main11!");
    }
    
    static public void main(String[] args) {
        System.out.println("Main12!");
    }
    
    public strictfp static void main(String[] args) {
        System.out.println("Main13!");
    }
    
    void public static main(String[] args) {
        System.out.println("Main14!");
    }
    
    public static void main(int[] args) {
        System.out.println("Main15!");
    }
    
    public static void main(String[] args) {
        System.out.println("Main16!");
    }
    
    public static void Main(String[] args) {
        System.out.println("Main17!");
    }
        
    

    The Answers

    
        
    /**
     * Fine.
     * 
     * This is the most common form of the main method.
     */
    public static void main(String[] args) {
        System.out.println("Main1!");
    }
    
    /**
     * Fine.
     * 
     * This is the most common form of the main method except
     * that the variable accepting command line arguments has
     * been renamed to someOtherName. The name of the variable
     * is insignificant.
     */
    public static void main(String[] someOtherName) {
        System.out.println("Main2!");
    }
    
    /**
     * Fine.
     * 
     * Varargs form of the main method. New with Java 5.
     */
    public static void main(String... args) {
        System.out.println("Main3!");
    }
    
    /**
     * Fine.
     * 
     * This is the most common form of the main method, except
     * that it throws an exception. This is completely valid.
     */
    public static void main(String[] args)
      throws Exception {
        System.out.println("Main4!");
    }
    
    /**
     * Compiles, but cannot be executed from the command line.
     * 
     * Method must be public.
     * 
     * Since the signature doesn't match it's a completely
     * different method that just happens to be called main.
     * 
     */
    static void main(String[] args) {
        System.out.println("Main5!");
    }
    
    /**
     * Compiles, but cannot be executed from the command line.
     * 
     * Method must be static.
     * 
     * Since the signature doesn't match it's a completely
     * different method that just happens to be called main.
     * 
     */
    public void main(String[] args) {
        System.out.println("Main6!");
    }
    
    /**
     * Fine.
     * 
     * This is the most common form of the main method
     * except that the square
     * brackets for the String array have been put beside
     * the variable. This is valid, but many think, harder
     * to read.
     */
    public static void main(String args[]) {
        System.out.println("Main7!");
    }
    
    /**
     * Although the syntax is strange, this compiles, but
     * cannot be executed from the command line.
     *
     * This is the most common form of the main method, but
     * the square brackets for the args array are beside the
     * type as well as beside the args variable. They should
     * be beside one or the other, not both.
     *
     * While I would have guessed that this would not
     * compile at all, it turns out that this is equivalent
     * to main taking a two-dimensional array as a parameter.
     * String[] args[] is the same as String[][] args or String
     * args[][]. While it's certainly valid for a method to
     * accept a two-dimensional array of Strings, this does
     * not fit the required signature for a main method
     * that is to be invoked from the command line. Attempting
     * to execute this will result in the following error
     * message: Exception in thread "main"
     * java.lang.NoSuchMethodError: main
     *
     */
    public static void main(String[] args[]) {
        System.out.println("Main8!");
    }
    
    /**
     * Compiles, but cannot be executed from the command line.
     *
     * The main() method needs to accept an array of Strings
     * as a parameter. The method below accepts a
     * two-dimensional array of Strings.
     *
     * Since the signature doesn't match it's a completely
     * different method that just happens to be called main.
     *
     */
    public static void main(String[][] args) {
        System.out.println("Main9!");
    }
    
    /**
     * Compiles, but cannot be executed from the command
     * line.
     *
     * The main() method needs to accept an array of Strings
     * as a parameter. The method below accepts a single
     * String called args.
     *
     * Since the signature doesn't match it's a completely
     * different method that just happens to be called main.
     *
     */
    public static void main(String args) {
        System.out.println("Main10!");
    }
    
    /**
     * Fine.
     * 
     * Throwing a checked exception, like IOException,
     * is legal.
     * 
     */
    public static void main(String[] args)
      throws IOException {
        System.out.println("Main11!");
    }
    
    /**
     * Fine.
     * 
     * This is the most common form of the main method except
     * that static and public keywords are reversed. Their
     * order does not matter.
     * 
     */
     static public void main(String[] args) {
        System.out.println("Main12!");
    }
    
    /**
     * Fine.
     * 
     * It's perfectly acceptable to have a strictfp main
     * method.
     * 
     */
    public strictfp static void main(String[] args) {
        System.out.println("Main13!");
    }
    
    /**
     * Does not compile.
     * 
     * The return type (void in this case) must come
     * immediately before the method name.
     * 
     */
     void public static main(String[] args) {
        System.out.println("Main14!");
    }
    
    /**
     * Compiles, but cannot be run from the command line.
     *
     * The main() method must accept an array of Strings,
     * not ints, as a parameter.
     *
     * Since the signature doesn't match it's a completely
     * different method that just happens to be called main.
     *
     */
    public static void main(int[] args) {
        System.out.println("Main15!");
    }
    
    /**
     * Fine.
     * 
     * This is the most common form of the main method
     * except that there aren't any spaces between the
     * type, the square brackets and the variable name.
     * It's still legal.
     *
     */
    public static void main(String[] args) {
        System.out.println("Main16!");
    }
    
    /**
     * Compiles, but cannot be run from the command line.
     *
     * The main() method must be all lower case.
     *
     * Since the signature doesn't match it's a completely
     * different method that just happens to be called main.
     *
     */
    public static void Main(String[] args) {
        System.out.println("Main17!");
    }
    

    So why would you want to know so much about the main() method anyway? Well, besides being essential if you’re taking the Sun Certified Java Programmer (SCJP) exam, there are a few alternate formulations of the method that might come in handy. Plus, with the examples above it mind, I bet you’ll spot a flawed main() method quicker than most if you come across one.

    Joshua Smith


    References


    SCJP Sun Certified Java Programmer Study Guide

    Technorati Tags: ,