Microsoft Outlook Sync Issues taking up folder size of Server Data

My mailbox gets full frequently despite constant archiving. I check the folder size using my mailbox properties to help me clear the problem areas since it shows the distribution of the data amongst the server folders. Most folders get cleared out, but one area that starts to build up over time in my Server Data’s folder list is the “Sync Issues\Conflicts”, which I could not clear.

Today I finally found the folder in “Go > Folder List > (left navigation panel)”, and managed to clear it out. To go back to the original folders, click “Go > Mail”.

Saving tabs of multiple windows in Chrome

Chrome restores all tabs when it is closed and reopened. This has been very useful for me but I got greedy. I now have multiple windows, with each window on a topic I’m search on. E.g. a window with tabs on different hotels and another window with tabs on day trips.

No perfection, but I found that Ctrl-Shift-D will bookmark all tabs into a bookmark folder, and right-clicking on a bookmark folder allows me to open all bookmarks in a bookmark folder to a new window.

Good enough for me.

Eclipse Launcher stays at splash screen for few minutes

Oddly this only happens once after the computer is restarted each time. Subsequently the loading would be much quicker.

Using the profiler the following stack trace is obtained:


main [RUNNABLE, IN_NATIVE] CPU time: 0:00
java.io.WinNTFileSystem.list(File)
java.io.File.list()
sun.security.provider.SeedGenerator$1.run()
java.security.AccessController.$$YJP$$doPrivileged(PrivilegedAction)
java.security.AccessController.doPrivileged(PrivilegedAction)
sun.security.provider.SeedGenerator.getSystemEntropy()
sun.security.provider.SecureRandom.engineNextBytes(byte[])
java.security.SecureRandom.nextBytes(byte[])
java.security.SecureRandom.next(int)
java.util.Random.nextLong()
java.io.File.generateFile(String, String, File)
java.io.File.createTempFile(String, String, File)
org.eclipse.core.runtime.adaptor.LocationManager.canWrite(File)
org.eclipse.core.runtime.adaptor.LocationManager.computeDefaultConfigurationLocation()
org.eclipse.core.runtime.adaptor.LocationManager.initializeLocations()
org.eclipse.core.runtime.adaptor.EclipseStarter.startup(String[], Runnable)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(String[], Runnable)
sun.reflect.NativeMethodAccessorImpl.invoke0(Method, Object, Object[])
sun.reflect.NativeMethodAccessorImpl.invoke(Object, Object[])
sun.reflect.DelegatingMethodAccessorImpl.invoke(Object, Object[])
java.lang.reflect.Method.invoke(Object, Object[])
org.eclipse.equinox.launcher.Main.invokeFramework(String[], URL[])
org.eclipse.equinox.launcher.Main.basicRun(String[])
org.eclipse.equinox.launcher.Main.run(String[])
org.eclipse.equinox.launcher.Main.main(String[])

The main thread is stuck in a native File.list() method. From the SeedGenerator source code, there is only one location where it calls the File.list() method, and it happens to match the stack trace — inside an anonymous inner class. From there we can see that it is trying to list the temp folder (system property java.io.tmpdir). On Windows, this is the “%USERPROFILE%\Local Settings\Temp” folder.

When I do a directory listing on the folder, I get more than 100,000 temp files. Removing them solves the problem.

From the stack trace Eclipse startup was trying to test whether a folder is writable, by creating a temporary file, which uses a random number generator to generate the filename, in turn using the list of filenames from the TEMP folder as part of the seed. Essentially this problem would surface if you have a TEMP folder with many many files (regardless of size) and perform any of the following:

  • use File.list() on the folder (or any folder with many many files)
  • generate a random number
  • Create a temporary file
  • Starting up Eclipse runtime…

Does Windows cache the directory listing so that it’s faster next time?

Track memory usage in QTP with WMI

I used QTP to simulate a repeating user scenario in order to trace a memory leak with YourKit over time. So I’m using this quick & dirty function to poll the application regularly about it’s raw memory usage.


Function GetMemory
	pid = GetWindow().GetROProperty("process id")
	Set wmiService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
	Set resultset = wmiService.ExecQuery("SELECT WorkingSetSize FROM Win32_Process WHERE Handle=" & pid)
	For Each result In resultset
		GetMemory = Int(result.WorkingSetSize)
	Next
End Function

GetWindow() returns a reference to the application window.

It seems even though I SELECT only WorkingSetSize I could get other information such as Handle from the result.

The For Each loop was an easy way out since I didn’t know how to access the first element.

Reference: http://www.learnqtp.com/windows-management-instrumentation-wmi-qtp/

Part III: JFreeChart “Gantt” schedule

I was contemplating whether to manually draw the schedule, to use a JTable, or use JPanels in a GridbagLayout. I did think of JFreeChart, but I’m not sure if there’s a chart suitable, and I was hoping its Gantt chart was up to the job. It was.

The below sample shows it can render multiple “tasks” in the same row, so it satisfies my needs.

TaskSeriesCollection dataset = new TaskSeriesCollection();

TaskSeries unavailable = new TaskSeries("Unavailable");
Task room1 = new Task("Meeting Room 1", 
	new GregorianCalendar(2009, Month.DECEMBER, 1, 7, 00).getTime(), 
	new GregorianCalendar(2009, Month.DECEMBER, 1, 18, 00).getTime());
unavailable.add(room1);

room1.addSubtask(new Task("Meeting 1",
	new GregorianCalendar(2009, Month.DECEMBER, 1, 9, 00).getTime(), 
	new GregorianCalendar(2009, Month.DECEMBER, 1, 16, 00).getTime()));

Task room2 = new Task("Meeting Room 2",
	new GregorianCalendar(2009, Month.DECEMBER, 1, 7, 00).getTime(), 
	new GregorianCalendar(2009, Month.DECEMBER, 1, 18, 00).getTime());
unavailable.add(room2);

room2.addSubtask(new Task("Meeting 2",
	new GregorianCalendar(2009, Month.DECEMBER, 1, 10, 00).getTime(), 
	new GregorianCalendar(2009, Month.DECEMBER, 1, 11, 00).getTime()));

room2.addSubtask(new Task("Meeting 3",
	new GregorianCalendar(2009, Month.DECEMBER, 1, 14, 00).getTime(), 
	new GregorianCalendar(2009, Month.DECEMBER, 1, 15, 00).getTime()));
room2.addSubtask(new Task("Meeting 4",
	new GregorianCalendar(2009, Month.DECEMBER, 1, 16, 00).getTime(), 
	new GregorianCalendar(2009, Month.DECEMBER, 1, 18, 00).getTime()));

dataset.add(unavailable);

JFrame frame = new JFrame("MeetNow!");	
// title, domain axis, range axis, dataset, legend, tooltip, urls
JFreeChart chart = ChartFactory.createGanttChart("", "Room", "Time", dataset, false, true, false);
ChartPanel chartPanel = new ChartPanel(chart);
frame.getContentPane().add(chartPanel, BorderLayout.CENTER);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setBounds(50, 50, 800, 200);
frame.setVisible(true);

The result of the above code is like this.
gantt

Using a set of models I hooked up this UI to the query code. For some chart customization I added the meeting subject onto the bar and tooltip, changed the color and added some controls on the top.
gantt2

See Part II for querying Exchange for the schedule, and Part I for setting up the Web Service.

code stench

Don’t iterate to find an index. Why? You already know the index.

int toFind = ...;
for (int i=0;i

Just use array[toFind].doSomething(). Iterate only when you are matching some other non-index attribute.

The same applies even if you have lists, or if you're looking for toFind-1.

Skype “Call to …, no answer”

I kept getting this error when I tried to call my conference meeting center with Skype. At first I thought it was just not getting through, when I realize it didn’t work with echo123 too. The error message was:

Call to skype test call, no answer

Google tells me the problem was due to my audio settings. In my case the speaker was pointing to the wrong device, and the call went through after changing it. You can get to your audio settings by going to Tools > Options > General > Audio Settings.

The error message should have provided more information e.g. “Call to …, no answer. Please check your audio settings.”.