Vinyl iPod Shuffle Stickers
Posted 2005 Feb 25ShuffleArt has will have Vinyl stickers for the iPod shuffle. Rock!
ShuffleArt has will have Vinyl stickers for the iPod shuffle. Rock!
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:
<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:
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:[LDAP: error code 49 – 80090308: LdapErr: DSID-0C09030F, comment: AcceptSecurityContext error, data 775, vece]
<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.
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.
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.
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 <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.
<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
I think 43 Things users are missing out on its real, untapped potential: Crime. I see the list forming like this:
My 4 thingsIt’s a great way to assemble a posse: 12 other people want to Rob a Bank, 8 other people want to form a posse, 1 other person wants to Drive the Getaway car.
Stay Tuned—this could be big.
Reason has a terrific interview with Neal Stephenson. Interviews with Neal are always entertaining and this one is no exception.
As a testament to how enjoyable Stephenson’s writing is, I actually found myself missing his characters (Jack, Eliza, etc.) after finishing “The Confusion”. Of course, I need a little break before starting “System of the World”...
To want this shirt.
Howard once again explains why Tapestry is best for Getting Things Done.