watch this  

the official mrchucho blog

Shuffle, WTF?

Posted 2005 Mar 08

My iPod Shuffle is so strange. In shuffle mode, I may go for days without ever hearing a particular song, yet within a matter of hours the same two songs will be repeated… in the same order!

Life is Random? Freaky is more like it.

comments (0)

Growl 0.6 and Firefox Nightly Builds

Posted 2005 Mar 03

My Growl hack extension for Firefox works with nightly builds since they fixed the bug that prevents NSIProcess from passing arguments. Plus, the new version of growlnotify that comes with 0.6 allows for the title, message and icon to be passed-in as arguments. Unfortunately, this fix won’t be generally available until Firefox 1.1.

In the meantime: Download Notifications with Growl

comments (1)

The New Web App

Posted 2005 Mar 01

The Farm has a lengthy, but very interesting overview of innovations in today’s Web Application domain. It touches on everything from XMLHttpRequest to Ajax.

The thing that is most interesting to me is that “HTML as the new API” sure seems to fulfill many of the promises that Java (and applets, in particular) failed to deliver. I’ll re-quote what I think is the heart of the matter with regards to web-based applications:

With web-based software, most users won’t have to think about anything except the applications they use.

It’s easy enough to do - there are so many varied and powerful tools and technologies - there is no reason not to do it (where applicable).

comments (0)

Why Java

Posted 2005 Feb 26

Some recent discussion about Java, .NET and Ruby gave me pause to think about why - even whilst completely enamored with Ruby - I’m fine with being (primarily) a Java developer. I’ll repeat it, because it’s worth repeating: I prefer Ruby or Python (or, heck, even Perl) to Java. I find Java cumbersome and, frankly, generally pretty boring. But, I enjoy being a Java developer. And there’s a reason for that: with Java I can be effective; quickly and comprehensively, effective.

The main reason I find I can be so effective is because there is a lot of quality Java software out there and a lot of it is Open Source. Now, I know that is equally, if not more true for Ruby, Python, PHP, etc. But, in the generally accepted Enterprise Domain, OSS helps set Java apart. I couldn’t imagine developing Enterprise apps without access to the source and community that comes with OSS. Examining, patching, reusing and modifying code from Open Source Java projects is something that I do regularly—this isn’t just for the sake of argument.

If you consider the other big player in Enterprise software development, .NET, I couldn’t imagine developing in that world! It’s Microsoft’s Way or No Way. Last year, Microsoft took a group of developers - myself included - from the company I work for out to lunch. They tried to sell us on giving up Java for .NET. They presented an excellent case. C# is fantastic. Visual Studio is excellent. But it’s all pretty much equivalent to Java/J2EE. It’s a draw, a stalemate… more a matter of preference than anything else. Except for one thing: OSS.

So, why Java? Well, it’s a good mix between Open Source flexibility and Enterprise legitimacy… even if it’s not as cool as Ruby.
<pre><code>
irb(main):001:0> ["Java",".NET"].each do |lang|
irb(main):002:1* puts lang > "Ruby" 
irb(main):003:1> end
false
false
</code>
comments (0)

Vinyl iPod Shuffle Stickers

Posted 2005 Feb 25

ShuffleArt has will have Vinyl stickers for the iPod shuffle. Rock!

comments (0)

Java, LDAP and Active Directory

Posted 2005 Feb 24

Interface a Java application with Active Directory is a common albeit convulted endeavor. After struggling with unhelpful error codes for too long, I’ve decided to post some information that I found invaluable. First, there are a series of posts on the Sun forums that cover most of the topics:

The biggest hurdle in using Java and LDAP to interface with Active Directory is determining the way AD was configured. For instance, while the examples above indicate you should replace the “unicodePwd” attribute, I kept getting the WILL_NOT_PERFORM error (like I said, unhelpful) until I switched it to “userpassword” and did not encode it.
<pre><code>
        env.put(Context.SECURITY_AUTHENTICATION, "simple");
        env.put(Context.INITIAL_CONTEXT_FACTORY,
                "com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.PROVIDER_URL, ldapURL );
        env.put(Context.SECURITY_PRINCIPAL, adminUser);
        env.put(Context.SECURITY_CREDENTIALS, adminPassword);
        env.put("java.naming.ldap.version","3");
        env.put(Context.REFERRAL, "follow");

        try
        {
         LdapContext ctx = new InitialLdapContext(env,null);

         String USER_TO_CHANGE = "CN=" + userName +
             ",OU=[your org. unit],DC=[your domain],DC=com";
         String NEW_PASSWORD = userPass;

        ModificationItem[] mods = new ModificationItem [ 1 ] ;
        mods [ 0 ] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,
                    new BasicAttribute("userpassword", NEW_PASSWORD));
        ctx.modifyAttributes(USER_TO_CHANGE, mods);

         ctx.close();
        // ...
</code>
In this code the admin account logs in and sets a user’s password. I was unable to get a user to change his or her own password, even though AD was configured to do so… Check the links above for details on how to do that.

It is also worth noting that contrary to many posts SSL is not required to perform these operations.

With regards to Error Messages, there is an art to decoding those… An exception will usually include a message like so:

[LDAP: error code 49 – 80090308: LdapErr: DSID-0C09030F, comment: AcceptSecurityContext error, data 775, vece]

The part we’re after is the “data 775”. That is the hexadecimal error code. So, simply convert it to decimal, then consult the error code list. In this case, the error code is decimal 1909: ERROR_ACCOUNT_LOCKED_OUT. I built a simple lookup table of common error messages, then parse the error message like so:
<pre><code>
String err = e.getMessage(); // where e is the exception
int i = err.indexOf("data ")+5;
int j = err.indexOf(",",i);
System.out.println(err.substring(i,j));
</code>

Like I said, interfacing Java, LDAP and Active Directory to authorize, change passwords, and check group membership tricky—but possible. I hope this guide will help get you started.

comments (2)

Amazon Prime

Posted 2005 Feb 23

Oh, what have I wrought?

I signed up for Amazon Prime. I couldn’t help it! Seriously, I buy a lot from Amazon: books and CDs mostly. Enough that $79 for a year’s worth of free two-day shipping is worth it. It’s nice to be able to just pre-order something and not worry about trying to group stuff together. Also, it’s nice to - finally - be able to pick “Ship Items as they become available”!

Speaking of “Prime”, did anyone watch Robot Chicken? Totally and completely hilarious. My favorite: the Strawman in OZ.

comments (0)

SOA

Posted 2005 Feb 17

Maybe I’m not understanding, but I don’t necessarily see what is so revolutionary about SOA. Bridging disparate apps with formatted data over a simple, standard network protocol is nothing new. This seems like all the hullaballo about info-bus messaging…

Still, I’m glad to see that companies are looking for developers to solve this problem, rather than shrink-wrap solutions. I guess the good thing about SOA is that it encourages companies to embrace heterogeneity and rely on competent developers rather than trying to enforce a “standarized” environment with costly (and usually counter-productive) shrink-wrap software.

comments (0)

Rails and Templating

Posted 2005 Feb 14

There is a good post on Loud Thinking regarding Rails and its lack of a “templating” language.. which was one of my inital - I hate to use the word - complaints.

While I think that Ruby is certainly much better suited for co-existing inside the View than Java, I still think the approach that Tapestry uses (or even JSF) is preferable. It provides a nice decoupling in addition to helping during the prototyping phase. Of course, in most of my projects thus far, I’ve worn both the developer and designer hat—so I can’t speak to 37 signals’ workflow.

I stand by my claim that the less code in the HTML-portion of the View, the better—regardless of how readable the code is.

Update Read below for more thoughts on this—I tried to post this as a response the comments, but the HTML formatting was just too screwy…

When I think templating, I think of Tapestry, so here goes: Let’s say I have a table that I want to populate. During the prototyping phase, I create the HTML for the table in put in some mock-up data:
<pre><code>Employees.html
<table id="employees" jwcid="employees">
    <tr><th>Id</th><th>Name</th><th>Position</th></tr>
    <tr>
        <td>123</td><td>Joe Smith</td><td>Programmer</td>
    </tr>
    <tr>
        <td>456</td><td>Bob Jones</td><td>Designer</td>
    </tr>
</table>
</code>
So far, it’s all HTML - no code. The only thing that stands out is the “jwcid” attribute - that’s what ties the HTML table to the implementation. Now, in Tapestry, there’s a page specification that corresponds to the HTML page:
<pre><code>Employee.page
<component id="employee" type="contrib:Table">
    <binding name="source" expression="employeeList"></binding>
    <binding name="columns" expression="id,name,position"></binding>
</component>
</code>
In the Java code behind the page is a function, “getEmployeeList” that returns a collection of Employee models. The page, in turn, knows to use the id, name and position properties for the columns of the table. That’s it! And, we can leave the mockup data in place—everything between the opening and closing table tags is replaced at run-time.

Of course, this is a high-level explanation, but as you can see: there’s no code in the HTML and the View code itself just returns a List, it’s not concerned with how it is displayed, e.g. table or list or just a bunch of paragraphs! That’s pretty good decoupling! And it’s great during the prototype phase because you can tweak the layout (including mock-up data) outside of the application server and/or using WYSIWYG tool. And, even better, no major modification is necessary when the time comes to “wire” it up.

Lastly, to demonstrate your Rails example:
<pre><code>< % if @user.is_administrator? %>
  # show stuff that's only for administrators
< % end %>
</></></code>
In Tapestry:
<pre><code>.html
<div jwcid="adminStuff">
stuff for admins only
</div>
.page
<component id="adminStuff" type="Conditional">
     <binding name="condition" expression="isAdmin"></binding>
</component></code>
This is different from templating technologies like JSP or Velocity and is probably more akin to Perl’s HTML::Template.
comments (3)

iTunes Applescript - Disable Entire Genre

Posted 2005 Feb 13
I have a bunch of Live music in my iTunes library, but I don’t necessarily want it included in my iPod Shuffle when it Autofills. So, I select “Only update checked songs” in iPod preferences and run this Applescript to disable (i.e. uncheck) all songs in my library matching the selected genre.
<pre><code>
tell application "iTunes" 
    set theGenre to "" 
    display dialog "Enter Genre:" default answer theGenre
    set theGenre to text returned of the result
    copy (a reference to library playlist "Library") to mainLibrary
    repeat with i from 1 to (get index of last track of mainLibrary)
        tell track i of mainLibrary
            ignoring case, punctuation and white space
            if (get genre of it) is equal to theGenre then
                set enabled to false
            end if
            end ignoring
        end tell
    end repeat
    display dialog "Done!" giving up after 3
end tell
</code>
Or download: DisableGenre.zip
comments (0)
atom rss