Showing posts with label development. Show all posts
Showing posts with label development. Show all posts

Tuesday, August 12, 2014

How to retrieve an LDAP server's public cert

It's easy with openssl...
openssl s_client -connect <server>:636
...then copy everything between
-----BEGIN CERTIFICATE-----
and
-----END CERTIFICATE-----
(including the delimiters) and paste into a text file.

Friday, December 13, 2013

Retrieving external config properties from JNDI, environment shell, and/or system properties.

I need to deploy multiple instances of the same WAR in a single Tomcat instance. I've been reading external config properties from System properties (e.g. System.getProperty('ext.xyz')). That won't work when deploying multiple WAR instances. So I whipped this up to read from JNDI as well as System properties (and I threw in reading from environment vars as well).

Then in Config.groovy, I use it thus...

This way my config file doesn't care where the external property comes from. In dev, I can define it as a system property. In prod, I can define it as a JNDI env var.
For completeness, here's how I'm defining the context xml in Tomcat.

Thursday, November 28, 2013

Adding parameters to an existing link

I'm working on a project where the user selects a date and then clicks a link.  The date needs to be added as a parameter to the link's url.  The normal way to do this would be with a form.  But each link would then have to be a submit button.  I don't want them to look like submit buttons.  But I also don't want to restyle them to look like links.  So I set out to find a way to dynamically add the date to each link.

Turns out with jquery it's pretty easy.  Check it out...
Update: okay, another easy way to do this would be to leave the links as links but put the parameters, including the date, in a form, then trap the click event on the link and submit the form. But what's cool about that?

Friday, July 6, 2012

Important Programming Topics That Don't Often Come Up in Job Interviews

Been thinking on and off about job interviews lately, and realized there are several important topics that don't seem to come up very often. Thought I'd make a list.

  • Threading
  • Recursion
  • Memory management
  • HTTP lifecycle (requests, sockets, threading, etc.)
  • Framework architecture
  • Time systems (UTC system, time zones, etc.)

Of those, I occasionally get questions on threading, recursion, and memory management. When memory management comes up, it's usually in reference to algorithm performance and memory optimization (e.g. hash vs. red-black, arrays vs. linked lists, etc.). Which is important, but there's a whole lot more to memory management, like garbage collection, memory leaks, etc.

I've been a Java web programmer for 12 years but NEVER been asked to describe how HTTP works. I've never been asked about sockets, request threading models, or even about application vs. session scope. I've also never been asked to describe how Hibernate, Struts, Spring, or any other framework actually works. I have been asked how JSP's work. But I've never been asked about Java servlets, filters, or authentication.

And while every programmer eventually has to deal with time systems and time zones, no one ever asks about them. I'm constantly amazed at the number of devs who think it's a good idea to simply compare timestamps without consideration of time zone, DST, leap year, leap second, etc.

I can certainly see where a junior or even a mid-level developer might not have much depth in any of these areas. For the kind of work they're doing they don't need it. But I think it would still be good to bring these topics up in every interview, if only to learn whether a younger dev might have some hidden talent.

I would expect senior developers to have mastered at least two of these topics, and to be familiar with all of them. No individual will know everything, but I'd hate to hire a senior dev that couldn't at least talk intelligently about each topic. A senior dev doesn't just design, code, and test, but also mentors younger devs. They need more than just "tutorial" knowledge, they need the first principles as well. Or at least know where to find them ;)

Thursday, January 20, 2011

Eclipse Command Shortcut

Wow, long time no post.

Just ran across something very cool in Eclipse: Ctrl+Shift+L pops up a list of editor commands, displaying the shortcut for each. Handy way to recall those hard-to-remember commands (like Shift-Alt-Z).