Archive for June, 2005

Get the autocomplete back

Wednesday, June 22nd, 2005

On websites such as Yahoo!, login forms use a non standard HTML extension. It is AUTOCOMPLETE="OFF". Microsoft came first with this idea, banking websites have embraced it. Finally, Mozilla Foundation was forced to implement it in an effort to stop banking websites from denying access to Firefox users, qualified as an "insecure browser&quot: :).

You may programmatically re-enable autocomplete using this short script:

for(i=0;i<document.forms.length;i++)void(document.forms[i].setAttribute(’autocomplete’,
‘on’));

To make it easier, just drag this link, Autocomplete ON, to your browser’s shortcut bar.

Thanks to Josef Segur on Opera users’ list.

Even better, you may use Jesse’s bookmarklet: remember password. This is a better version, built specifically for Mozilla/Firefox. To install it, drag it to the same shortcut bar.

so you can’t open attachments from PDF files?

Wednesday, June 22nd, 2005

Problem: You want to open an attachment from a PDF file using a recent version of the Acrobat Reader, but you get a popup saying that your security settings are against you.

Only Google could solve this problem, managing the mess called Adobe online documentation. Adobe’s web site says you must change the security policy. There’s a long talk about how to fix the installer, but I don’t think you want to go that way.

Solution: First log on as an Administrator, because you need access to a protected registry key. That’s HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\7.0\FeatureLockdown\cDefaultLaunchAttachmentPerms. Its default value looks like this:

version:1|.ade:3|.adp:3|.app:3|.asp:3|.bas:3|.bat:3|

.bz:3|.bz2:3|.cer:3|.chm:3|.class:3|.cmd:3|.com:3|.command:3|

.cpl:3|.crt:3|.csh:3|.exe:3|.fxp:3|.gz:3|.hex:3|.hlp:3|

.hqx:3|.hta:3|.inf:3|.ini:3|.ins:3|.isp:3|.its:3|.job:3|

.js:3|.jse:3|.ksh:3|.lnk:3|.lzh:3|.mad:3|.maf:3|.mag:3|

.mam:3|.maq:3|.mar:3|.mas:3|.mat:3|.mau:3|.mav:3|.maw:3|

.mda:3|.mde:3|.mdt:3|.mdw:3|.mdz:3|.msc:3|.msi:3|.msp:3|

.mst:3|.ocx:3|.ops:3|.pcd:3|.pif:3|.prf:3|.prg:3|.pst:3|

.rar:3|.reg:3|.scf:3|.scr:3|.sct:3|.sea:3|.shb:3|.shs:3|

.sit:3|.tar:3|.tgz:3|.tmp:3|.url:3|.vb:3|.vbe:3|.vbs:3|

.vsmacros:3|.vss:3|.vst:3|.vsw:3|.webloc:3|.ws:3|.wsc:3|

.wsf:3|.wsh:3|.zip:3|.zlo:3|.zoo:3|.pdf:2|.fdf:2

The value will be edited in a hex editor provided by Regedit for REG_BINARY values, but you have to pay attention only to the right half of that editor, where the human readable content is placed.

Look for the offending file extension and fix the digit placed after it and after the colon. It should be 2.

PS. Usual disclaimer. Before modifying registry keys (esp. a REG_BINARY value) backup the original values. Be careful, do not open attachments from untrusted sources.

Local versioning on NetBeans

Saturday, June 11th, 2005

Supposing you want to mark the build number on your JAR files. Java packages are frequently versioned by changing the filename, but this is an unconfortable method for the administrators trying to deploy the applications. The recommended way is to rename the storage (be it the rest of the URL or the folder on the local disk) and to specify the implementation version on the MANIFEST.MF file.

NetBeans uses the Ant automating tool, taking it to a higher level, automating even the building of the Ant script.

MANIFEST.MF is dinamically built, in part by the JAR tool provided by Sun and in part by the Ant script. In the root folder of the Netbeans project there is a YourProjectFile/build.xml file (the usual name for default Ant scripts), but it is pretty small to be the one in charge. Opening it, you may see that it is just a wrapper for another XML Ant script, YourProjectFile/nbproject/project.xml. The latter is not editable, but you may override some tasks formally declared in project.xml with that purpose.

I decided to insert two fields in the YourProjectFile/nbproject/project.properties, that is two lines:

minor.number=1

major.number=1

The file is editable and Netbeans won’t overwrite your custom fields.

Then I edited build.xml, overriding the -pre-jar or -post-compile tasks like this:

<target name="-pre-jar">

  <propertyfile file="./nbproject/project.properties">

    <entry key="minor.number" type="int" operation="+" value="1" pattern="0000"/>

    <entry key="major.number" type="int" default="1"/>

  </propertyfile>

  <manifest file="MANIFEST.MF" mode="update">

    <attribute name="Implementation-Version" value="${major.number}.${minor.number}"/>

  </manifest>

</target>

This script will increment the minor build value stored in YourProjectFile/nbproject/project.properties and also in the MANIFEST.MF file. I decided that major versions may be changed by hand.

You may try to go further and fix the template that generates the project.xml file. This is /org/netbeans/modules/java/j2seproject/resources/build-impl.xsl in the file named YourNetbeansFolder/ide5/modules/org-netbeans-modules-java-j2seproject.jar.