14 December 2011

Outlook Locks Newly Created Folder / Directory

When saving an attachment in Outlook 2007, you can create a new folder in your filesystem first. However, Outlook locks that folder, so you can't move or rename it. You can unlock that folder by ...

  • Saving the attachment in another folder.
  • Creating another folder (though not a sub-folder of the one you just created).
  • Restarting Outlook.

There's an extra method listed in Folder or drive lock after saving attachment or message: use drag-and-drop.

05 December 2011

Google ChromeFrame incompatible with Oracle Hyperion DRM

If you have installed the Google ChromeFrame add-on for Internet Explorer (MSIE) 7 or 8, you may find that you cannot login to Oracle Hyperion Data Relationship Management (DRM) 11.1.2.1. After MSIE loads the DRM login page, you may see some Javascript errors and when you press the Log on button, nothing happens.

Coincidentally, I started seeing this error message on another web site: ERROR: Possible problem with your *.gwt.xml module file. The compile time user.agent value(ie8) does not match the runtime user.agent value (safari). Expect errors. It seems that Google ChromeFrame add-on, which I installed to improve Javascript performance when I was using IE7, can send the wrong user-agent information to a server (even if the add-on is disabled). I have since upgraded to MSIE8, which is fast enough, so I no longer needed ChromeFrame and I uninstalled it.

Now, I can login to DRM and the GWT error messages no longer appear.

02 December 2011

Specify Rows or Columns for Excel AutoFit

If you use the Excel AutoFit Method to resize cells to display their contents nicely, remember to specify whether to AutoFit rows or columns in Excel, i.e. use Range().Columns.AutoFit or Range().Rows.AutoFit, not just Range().AutoFit. If you don't specify rows or columns, Excel produces Run-time error '1004': AutoFit method of Range class failed.

26 November 2011

Minimal JavaBean introspection example

Just playing with JavaBeans, so here's a small example to create a simple JavaBean, set a property and read it.

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class SimpleBean {

  private final String name = "SimpleBean";
  private int size;
  public int getSize() {
    return size;
  }
  public void setSize(int size) {
    this.size = size;
  }
  public String getName() {
    return name;
  }
  
  public static void main(String[] args) throws IntrospectionException {
    SimpleBean sb = new SimpleBean();
    sb.setSize(59);
    BeanInfo bi = Introspector.getBeanInfo(sb.getClass());
    for (PropertyDescriptor pd : bi.getPropertyDescriptors()) {
      testGetValue(sb, pd);
    }
  }
  
  public static void testGetValue(Object sb, PropertyDescriptor pd) {
    System.out.print(pd.getName() + "=");
    Method getter = pd.getReadMethod();
    Object arg1[] = {};
    try {
      Object value = getter.invoke(sb, arg1);
      System.out.println(value);
    } catch (IllegalArgumentException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (InvocationTargetException e) {
      e.printStackTrace();
    }
  }
}

The output of the program is:

class=class SimpleBean
name=SimpleBean
size=59