Archive for April, 2007

Javascript component library found – Jack Slocum’s Ext

April 30, 2007

In the recent few months I was troubled in thoughts what JavaScript library we should used, now that we are rebuilding our product web UI.

The first limitation is that we will use the corporate common UI library which uses Prototype and Scriptaculous, but some components are missing from these libraries. The common UI library author did try to improve the library by adding more components to it, but they are far from being complete.

My main other options was YUI and Dojo. I followed and liked YUI from its very beginning – it seems like a nicely designed library with a devoted community. Then I attended Alex Russell‘s presentation at the ISOC conference, and I was impressed by the Dojo design concepts he presented, namely events and widgets.

However, I recently read the Ext library by Jack Slocum was released, and that it can work against Prototype, YUI and jQuery. I knew it was started as a grid for YUI which lacked that feature but added it in the recently released 2.2.0 version, but when I took a look at Ext’s component collection, I realized it has exactly all the components we needed for our revised UI:

  • a decent data grid
  • a date selection (calendar) control
  • a good menu component
  • impressive windoids support

There is one problem with Ext – although it is released under an Open Source license (LGPL), they encourage people who use it commercially to be a license. I didn’t see similar requests on YUI and Dojo. I don’t really know how our corporate will handle this license issue, but I think that when coding time approaches, I’ll start the process of using Ext in our product. Meanwhile I’m playing with it so I can show off what it can do to our product.

Advertisements

Annoying meebo message on Firefox close or restart

April 28, 2007

Every once in a while I need to restart Firefox (e.g. to update an extension, or to remove Firefox memory consumption), or I need to restart my machine and close Firefox. Since I always have a meebo tab open, when I close Firefox I get this annoying message from meebo (which uses the onbeforeunload event):

If you leave, your meebo IM sessions will not be preserved!

Today I realized that this message is almost never useful – I never closes the meebo tab by mistake – I only do it when I want to close (or restart) the browser, and then I realized a quick user script can solve the problem. I checked into Meebo code, and so that the string is a member of the meebolang object that holds language-dependent strings. This string (meebolang.navigateAway) is returned in the onbeforeunload event, so to hide it, I can simply change that member.

A few trials taught me that in Firefox, the onbeforeunload event must return undefined (and not null or false) for the warning unload message to disappear. Once that was achieved, implementing the required user script was easy.

VBA Macro Arguments

April 26, 2007

After we started to use Remedy for our customer support, I got annoyed by the way Remedy displays the history of customer cases (Remedy calls them issues), so I wrote a VBA script in Microsoft Word that takes the history generated in Remedy and displays it in a readable format (let me know if you’re interested in this script – it is really great if you are working with Remedy to support customers)

Since I intended this macro to be used by others, and not only by me, I tried to make its installation as simple as possible. I had no choice but asking my users to open the VBA editor and import my Remedy.bas module (I really didn’t want to go into developing a Word add-in with an installation program), and then users would have to add a toolbar button calling the macro. Since this was quite a complex script, it had many internal functions which I didn’t want users to call from a toolbar button – I only wanted them to add one or two buttons that called some of the public functions. To make sure they only use the public functions, I prefixed all the internal functions names with “RAH_” (RAH stands for Remedy Activity History), so they’ll know they shouldn’t look at macros with that name.

Later, I added a new procedure (“Sub” as it is called in VBA) that do some functionality. This function could be called from within other macros, in which case a document argument can be passed, or it could be called from a toolbar button, in which case the active document should be used. I noticed, however, that the Customize dialog didn’t show any macro function or procedure that has an argument, even though this argument was optional, and it was valid to call the function without arguments. This was annoying at first, and to bypass it, I had to create another proxy procedure that simply calls the internal procedure without any parameters, and only this proxy procedure could be added as the action for a new toolbar button.

However, later I realized that this feature of the Customize dialog can be put to good use and solve the internal procedures problem I had – I simply added an optional dummy argument to any internal procedure that didn’t have any argument. On one hand, it didn’t change the meaning of my code, and any code that called this internal procedure didn’t have to change. On the other hand, all these internal procedures don’t appear in the Customize dialog any more, since they now have an argument.

Update: This trick of hiding the internal procedures has one problem. My script uses the Application.OnTime procedure when the Remedy application haven’t finished opening the history window to make the script sleep and then check again one second later. It appears that the Application.OnTime procedure behaves like the Customize dialog, and is only willing to accept a procedure without arguments in its Name argument. If the procedure specified in the Name argument has at least one argument, the OnTime procedure won’t run it. So the macro has to have at least one internal function with no arguments.

One cumbersome way to solve it is to set some global flag before calling Application.OnTime, and then make Application.OnTime call a public procedure which will first check for that flag and if it is set, call the internal procedure and exit, but I’m not sure that the goal of hiding this one internal function worth the effort of making the code less readable.

Update 2: Thinking about it some more, I came to the conclusion that the dummy argument is a nice trick, but is not really needed. Setting the internal procedures as Private also hides them from the Customize dialog. How didn’t I think about it before…?

This, however, doesn’t solve the Application.OnTime problem, as the OnTime procedure cannot call Private procedures, so the procedure it calls must be public with no arguments, so it will appear in the Customize dialog.

Update 3: I found another reason for having non-private functions. My macro tries to hide unimportant parts of the case history, such as “original message” parts and confidentiality signatures. When doing so, it adds a link that when clicked, shows the hidden text. This is done by adding a MACROBUTTON field that calls the appropriate macro. It appears that this macro must also obey the rules of the Customize dialog for the field double-click to work – it has to be non-private, and with no arguments.

Post-Subscription Disorder

April 25, 2007

On regular basis, I add new items to two sites on a regular basis – Bloglines (my RSS feed reader) and del.icio.us (my bookmark keeper).

When I subscribe to a new blog in Bloglines (see below how I do it), Bloglines takes me to my feeds page at Bloglines, and after I add a new URL to del.icio.us (using the Post to del.icio.us bookmarklet), del.icio.us takes me back to the site I just added.

I would like it to be the other way around:

When I subscribe to a site/blog, this is probably after I took a quick glance at it, and decided its interesting, and after I subscribed, I would probably want to continue reading it (or close the window). Besides, my first open tab is the Bloglines tab, and I always keep it open, so I don’t need another Bloglines tab.

On the other hand, when I add a URL to del.icio.us, that’s usually after I’m more or less done with it for now, and wanted to file it for later use. Since I don’t usually have a del.icio.us tab open, I would like to be taken to my del.icio.us main page, where I can do various actions like seeing what other bookmarked pages I have that are related to the new page I just added, or seeing how many other people bookmarked this page, or taking a look at the pages I added recently, to see if any of them might be of interest now, e.g. because I wanted to e-mail it to someone but didn’t do it yet for some reason.

Once I have time, I might look into these sites and see if I can write a user script that can change this annoying post-subscription behavior.

PS 1:

I used to subscribe to new blogs in Bloglines using the Subscribe button in Google Toolbar, but as I’m writing this post, I’ve realized that when I do it, it always opens the subscribe window in a new tab, which is not always what I want. I think I’ll switch to using the RSS icon next to the down arrow of Firefox’s address combo-box, where left click open the subscribe window in the same tab, and middle click opens it in a new tab.

PS 2:

Why Bloglines? I tried Google Reader in its first version, and didn’t really like it, so I reverted back to Bloglines, which I really liked. When the second version of Google Reader was released, and everyone said it’s awesome, I tried to use it, but it remembered all my old subscriptions from my previous trial, and the option to delete them all and start over didn’t really work. While writing this post I tried it again, and this time it worked, so I might give it another try some day. In fact, I do like the frames structure of Bloglines, so Google will have to really impress me for me to make the move.

Email Indexing – Moving Back to X1

April 18, 2007

Ever since I found e-mail indexing, I cannot really live without it. I store almost all my e-mails, and I need to have immediate access to it. If I can’t search my entire corpus of history e-mail and get the results, I feel somewhat crippled.

I guess my first attempt was Google Desktop Search (GDS), and then I found something that annoyed me later in other Google applications (e.g. Picasa), but was best demonstrated in GDS – Google seems to think they know what’s best for you, and let you have very little control of the process. I really didn’t like it. I think, and this is a general note about application design, that you should have an interface that on one hand is as simple as possible so dumb users can use it without much questions, but on the other hand, you should provide as much as possible choice for advanced users to change things to their liking. GDS, for example, didn’t really let me decide what mail folders or files folders I want it to index.

I also didn’t like it that GDS shows results in the browser. I’m only interested in finding e-mails, but when I do find an e-mail, I want it to open in Outlook so I can have all the Outlook behavior I’m used to.

Then I switched to Microsoft’s Windows Desktop Search (WDS), which was nice, but I couldn’t really understand when it is indexing and what. It said it has finished, but still couldn’t find a message that I was looking for. I think GDS had the same problem. I just couldn’t trust it when it said no messages met my search criteria.

And then I found X1 Enterprise Client (XEC) and really liked it – it was fast, reliable and had a nice UI. It also let me fully integrate with Outlook, e.g. open the folder in which a message reside. I’d continue using it but then I installed Office 2007 beta, and XEC didn’t work well with that version of Outlook, so I had to revert to WDS.

Today, doing a regular search (about once in a month or two) to see if XEC already supports Outlook 2007, I found out it probably does support it, so I downloaded and installed it, and once it finishes building its index, I’ll start enjoying it and getting used to be spoiled.

The problem I found in both WDS and XEC is that in doesn’t store search history (at least not that I found) so if you search for a ticket number, and then for something else, and you would like to get that number you just searched for, it won’t let you. I hope it will be added some time soon. in XEC it is a little more problematic, since because it is so fast, it can allow itself to do “find as you type”, but that means you don’t have a specific event of submitting a search in which the term you searched for should enter the history list. Nevertheless, I’m sure its developer can find a way to solve it if they really want to.

Visual Studio /VERBOSE linker option cause fake errors

April 16, 2007

I’m porting one of our projects to be compiled with Visual Studio 2003 instead of Visual C++ 6, and while doing this, I noticed that the linker has a “Show Progress” option.

I set this option to make sure I see all problems during the build. After handling all the warnings I has during the migration from VC++ 6 (due to stricter language enforcement), I ended with 6 strange errors, that didn’t really looked like errors, and disappeared when I did another build.

The first looked like this:

__thiscall std::length_error::length_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)” (??0length_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z) from …

What I suspect happened is that the verbose output had something to say about the library class used, and when the library class ends with error (length_error or _com_error), it probably matches the pattern that Visual Studio use to search for errors in the output, so Visual Studio thinks it is an error and add it to the build error count and to the Task List. Microsoft should have built a better solution that either talks directly with the compiler/linker to find out what errors it had, or has a better parser so such output will not be identified as an error.

My workaround was to set the Show Progress property to a lower degree of verbosity (/VERBOSE:LIB)

(BTW, for some reason, the MSDN documentation, also in the Visual Studio 2005 (8) documentation, explains how to set this option by going to the Command Line property page and type the setting in the Additional Options box, and not using the “Show Progress” Property of the General property page, like it does, for instance, for the Version property. Maybe it is because the “Show Progress” property allows you only to set full verbosity (/VERBOSE) or library search verbosity (/VERBOSE:LIB) but on the command line you can set more options and even then one /VERBOSE option, e.g. /VERBOSE:LIB /VERBOSE:REF. However, I think they should have mentioned the “Show Progress” property as well.)

location.replace and Back button bug in IE

April 12, 2007

In our web application, after the user logs on, we display a “Please wait…” screen and then the user is taken to the main screen, using a “location.replace(URL)” function call.

Yesterday, due to another problem, we noticed that when the user clicks the Back button on Internet Explorer (6 & 7), he is taken to the “Please wait” screen, and then back to the main window, instead of being taken to the login screen, since the “location.replace()” method promises according to all the documentation we found not to put the current page in the browser history object, so pressing the browser Back button should take you to the previous page.

Both my colleague and I put up a clean sample HTML files to test it, but where in my test page the problem didn’t re-occur, it did with my colleague HTML files. A little search for differences showed that I wrote a simple HTML page from scratch:

<html>
  <body>
    <form>
      <input type=button value=click onclick=”location.replace(‘b.htm’)”>
    </form>
  </body>
</html>

But my colleague used a template to create her HTML file, so her files looked like:

<html>
  <head>
    <meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
    <title>EXAMPLE</title>
  </head>
  <body>
    <form>
      <input type=button value=click onclick=”location.replace(‘b.htm’)”>
    </form>
  </body>
</html>

Checking it further, we found out that when you use location.replace (and also window.open with the last parameter set to true) and the page you switch to has a Content-Type http-equiv <meta> tag that has a charset setting in its content attribute, Internet Explorer for some reason adds the current page to the history object, so pressing the Back button will take you to that page.

Note that for the bug to happen the new page to which you replace need to have this <meta> tag, and the current page content has no affect. Also, you must set the charset in that page – setting a content type without a charset (e.g. “text/html;”) doesn’t cause the problem. Finally, setting the content type using a real HTTP response header and not using an http-equiv <meta> tag also doesn’t cause the problem.

The fix was simple as the page we were opening was actually a frameset, so the charset setting in it could be safely removed.

This is indeed an interesting bug, to which I found no reference on the web.

Muting PowerPoint music

April 10, 2007

Here is a quick tip:

When a friend sends you a pps file which by default starts slide-showing the presentation in PowerPoint (Ehud Kenan complained about such attachments in his Hebrew blog, and I commented on how this can be easily avoided).

Often, these presentations has an accompanied background music, which can be rather annoying, especially if you have other people sitting near you.

I often thought Microsoft should have added a mute button to slide shows of such presentations, but until they do, I found out that the easiest solution to silent these slide shows (other then temporarily muting the computer or turning the speakers off) is simply to Alt-Tab to another application and then back to PowerPoint. These makes PowerPoint stop playing the music, until the presentation’s slide show is started again.