September 2008


This is from my friend, Chris Weekly.

I think it is necessary for us to be precise when we talk about “security popups” as there are many different kinds.

Some of these are always preventable, some are unavoidable in certain scenarios, all vary according to the browser version and its user config.

Anyway here’s a kickstart:

  1. SSL Certificate Warnings (various) - Triggered on HTTPS URL’s on domains with an expired or self-signed certificate. 
  2. Insecure Content Warnings - Triggered on HTTPS URL’s when the page contents embed references to HTTP resources (images, iFrames, stylesheets or scripts).
    This is preventable by proper JSP/taglib usage. Note it is ok for links to use http:// even in https:// pages as they’re not automatically followed.
  3. HTTPS to HTTP Redirection Warnings - Triggered when an HTTPS request triggers a redirect to an HTTP URL.
    This is unavoidable in some scenarios but should be avoided by design whenever possible.
  4. HTTP/HTTPS Switch Alert - Triggered when simply navigating from HTTP to HTTPS or back.
    This is out of our control, but most browsers don’t have this on by default, and users tend to turn this global setting off after seeing it once or twice (on any site) as it’s so common and harmless.
  5. Content not under this site’s control (New) - Apparently resulting from the recent Microsoft security patch.
    I believe this is triggered by scripts which are not on the same domain as the page requested.
    This is most likely to arise w/ 3rd-party tracking pixel-related scripts.  Needs more investigation.

    Update: I may have made an incorrect assumption that it related to recent MS security updates; it might instead be triggered by attempts of javascript on one domain to interact w/ the page on another domain. Which script and whether this is in fact the root cause of #5 is TBD. 

There are others but I think these are the main ones we’ve been dealing with lately.

Thanks,
Chris

Perforce branching is pretty simple.

Say you want to create a branch called

//depot/fkim/foo

First you would add it to your client.

//depot/fkim/foo/... //fkim/foo/...

Next you would do an integration from where you wanted to cut the branch.

p4 integrate //depot/work/foo/... //depot/fkim/foo/...

Then you would submit the integration and the branch will be created and updated in your client work space.

p4 submit

Windows NTFS has a nice but relatively unknown feature called NTFS junctions.  It is like hard links in Unix except it is only for directories.  Microsoft has a KB article about it which points to several utilities.  However I have been using Mark Russinovich’s junction tool exclusively.

Using Junction

Usage: [-s] <directory or file name>

-s Recurse subdirectories

If you want to create or delete a junction, use Junction like this:

Usage: [-d] <junction directory> [<junction target>]

To delete a junction specify the -d switch and the junction name.

Here is an example of using junction.  Note that the order of arguments is opposite of the Unix ln command.

> junction foo d:\docs\foo

The above example will create a junction called “foo” in the current directory.  This junction will point to d:\docs\foo.

To do the same in Cygwin:

$ junction foo `cygpath -aw /d/docs/foo`

One tip is to use the DOS dir command.  It will display <JUNCTION> instead of <DIR> in directory listings for junctions.

Photo taken by Stephen Laham.

To create a Java method with a generic return type one can write a method like this.

  protected static  T evaluateExpression(String tagName, String attributeName,
      String attributeValue, Class expectedType, Tag tagRef, PageContext pageContext)

You can learn more at this Java Generics FAQ.

I thought this article, Effective Java Collections, was excellent.  Here is the summary of the article.

  1. Use the isEmpty() method of the collection.
  2. Avoid returning null to mean an empty collection.
  3. Create an empty collection using Collections.empty***() methods.
  4. Iterate through collections using the foreach form when possible.
  5. Use the proper collection, Collection, Map, Set, List.
  6. The left side is always an interface!  (So is the return type of methods.)
  7. If you’re explicitly casting, chances are something is wrong. Use generics.