Nice New Features in Firefox Beta 3

Posted on May 13, 2008 at 21:44

At any one time during the day, I will have somewhere between 5 and 15 tabs open in my browser. Beyond a desire to stay near the cutting edge of browser technology, I also am constantly on the lookout for the best browser performance. That has led me from IE6 > Firefox 1.5x > IE7 > Firefox 2.0x. Though FF2 seems to be the standard browser for techies nowadays, after experiencing some extremely lousy performance, I switched to Flock. I went to Flock not so much for the social-browser features (some of which are attractive) but because that I had heard that it fixed a number of the many memory leaks that make FF2 stink so badly. It was better, but after a couple of weeks, I was still getting significant performance hits when opening a number of tabs (and I had practically no add-ons installed, so this could not have been to blame as it may have been with FF2). So now I am on Firefox 3 (beta 5). And while it is not perfect, I can definitely see the improvements in performance over FF2 and Flock. In addition to this, I have noticed a number of small features that combine to improve the overall blogging experience (or just make the program look nicer, which also counts for something).

  1. When you have more tabs over than can be contained in one screen, if you hover your mouse over the tab row in the browser header, you can use your scroll wheel to scroll right or left through the tabs.
  2. Redesigned download popup - looks nicer and is more functional (includes search, offers right-click on items, gets rid of the download location box in FF2)
  3. Remember password is no longer a popup. It is now an extension of the header that pops down unobtrusively. Since it is not a popup, it does not hold up your request, and you can wait and see if your username and password combo were correct before choosing to remember them.
  4. Smart Bookmarks - see your most visited webpages, recently bookmarked, or design your own based on browser history. (One thing I would like to know how to do is to define most visited by a time bound, for example: most visited in the last week. I would also like to have most visited domain, since right now most of my Most Visited list is different permutations on reader.google.com)
  5. Smart address bar. When you start typing in a URL, it displays a list based on pattern matching and giving higher weight to sites you have visited in the past. Kind of like intellisense. You no longer have to start entering the url from the beginning in order to have a page from your history show up in the address bar drop down. Now you can just enter any fragment from the url or title, and the potentials will appear.
  6. Resume a download if it gets cut off in the middle
  7. Other cool UI improvements (in addition to redesigned icons and buttons)

These are the one’s that I have noticed so far, but looking at the page on mozilla site, there are lots more where these have come from. Although this is not the perfect browser, it is currently my tool of choice and should be adopted pretty quickly once it comes out of beta.



Detecting Application Idle State in Windows Forms

Posted on February 7, 2008 at 13:44

On a recent project, I had the need to detect whether or not the application is idle, and if so, for how long has the idle state persisted. Idle in my case is defined as no mouse movement or keyboard activity when any of the forms of the application are in focus. If a different program is in focus, I define this as being an application-idle state (for my app), regardless of whether or not there is input activity from keyboard or mouse.

On researching the subject, I found several approaches. The main approach I have seen is to use the static Application.Idle event. This event fires whenever "application finishes processing and is about to enter the idle state" - In other words, whenever the application’s message queue is empty. The problem with this approach is that this event fires a lot, so much that it becomes impractical for tracking idle state the way that I need it (it doesn’t help that any Timer operating to track how long the idle state persists would set off Application.Idle, further complicating the situation).

The other approach that I have seen is to set up some Windows hooks to detect mouse and keyboard activity. I have zero experience operating with the Windows API, so thankfully, I found a post by Johan Danforth that gives some working code for doing exactly what I needed: Detecting Idle Time with Mouse and Keyboard Hooks. I integrated the code with my application and tested it out and it worked great.

There was one problem however: this code detects idle time for all applications. In other words, if your application is open but not in focus and you use your mouse or keyboard, the code changes your application status from Idle to Active. For my purposes (see definition if idle above) this is not good enough. So I inspected different properties of the System,Windows.Forms.Form class to see what could tell me whether or not a given form is active. The first candidates were Focused, TopLevel, TopMost and Visible, but none of these did the job. The property that ended up telling me exactly what I needed to know is ContainsFocus. This is a property of the Control class (from which Form inherits) and it "Gets a value indicating whether the control, or one of its child controls, currently has the input focus". (Focused is not good enough, since it only returns true when the form itself has focus, but returns false when a child control contained within the form has focus).

I also needed to detect whether any of the secondary forms of my application had focus (since I could have more than one window open at a time, only one of which could have focus). Here is the code that I used:

   1:  private bool DoesApplicationHaveFocus() {
   2:      bool hasFocus = false;
   3:      if (ContainsFocus) {
   4:          hasFocus = true;
   5:      } else {
   6:          FormCollection forms = Application.OpenForms;
   7:          foreach (Form f in forms) {
   8:              if (f != null && f.ContainsFocus) {
   9:                  hasFocus = true;
  10:                  break;
  11:              }
  12:          }
  13:      }
  14:      return hasFocus;
  15:  }


Your Browser is Too Modern

Posted on January 3, 2008 at 21:54

What is it with websites in Israel and browsers whose names do not start with the words "Internet Explorer"? Though there is lots of web connectivity and presence, it seems that all of the web developers here were just never told that using Javascript that only works on IE is not a good way to leave your customers happy. Case in point: I just saw the following on the website of a Jerusalem Hotel while browsing with Flock/Firefox:

montefiore

In case you are reading in a text-only browser, It reads (my emphasis):

Error ! The current browser is either too old or too modern (usind DOM document structure).

This is followed by the header of a calendar, with no days showing, set to January 2000.

If it really was still January 2000, maybe I could understand (wait, no I wouldn’t - Netscape was still alive and kicking back then). But in 2008, to consciously choose not to support browsers used by a large percentage, if not majority of potential customers, simply boggles the mind.



Mint Popular Posts Release 1.0

Posted on December 18, 2007 at 20:47

I just posted the files for release 1.0 of the Mint Popular Posts plugin.

I am calling it 1.0 (instead of 0.97 which had been the next sequential release number) since this is adding some nice, shiny functionality (options panel in admin to control caching and external DB, widget-capable) and since the initial release was over a year and a half ago and it is about time that it comes out of “beta”. (And since the version numbers are basically arbitrary, it doesn’t really matter anyways).

Special thanks for Ernie Oporto for his contributions of the bulk of the widget and options code.



Resetting a Lost MySQL Password

Posted on December 13, 2007 at 16:23

I sometimes use a Debian Ubuntu VMWare build to do some LAMP development. Due to my inexperience administering anything having to do with Linux, while trying to reset the root password, I accidentally put in some bad information into the password field (I forgot to use the password() function to generate encrypted password text), and ended up being locked out of the DB. After wading through a dozen different pages giving advice on how to reset a lost MySQL root password, I ended up finding a solution that worked for me:

  1. In terminal window with root access (in my case, using the sudo su command)
  2. # killall mysqld
  3. # mysqld –skip-grant-tables –user=root &
  4. Open new terminal window with root access
  5. # mysql (I am now logged into mysql as root)
  6. mysql> use mysql
  7. mysql> update user set password = password(”NEWPASSWORD”) where user=”root”;
  8. mysql> flush privileges;
  9. mysql> exit;
  10. # killall mysqld
  11. # /etc/init.d/mysql start

Definitely a relief to be able to successfully log back in again (and a good thing that this happened to me on my private test box and not on the public testing server).



New Photo Blog - Israel Photos

Posted on December 3, 2007 at 14:25

For the past three and a half years, my wife and I have been using a pocket-sized point-and-shoot digital camera to try and capture our future memories. Although it has and continues to serve us well, we are very often frustrated with the amount of time it takes to capture a picture, from start to finish. While it is fine for taking shots of landscapes, when taking pictures of little kids, we often have less than a second in which to get what we want on film before the moment is lost (and more often than not, we are not able to capture it in time). So using some gift money we just purchased our new camera, a Nikon D40 (I wanted to get a DSLR, and according to reviews that I read, it is a very goof "beginner" camera for this class of cameras. So far it has lived up to expectations). It takes awesome, crisp pictures, and works fast (instant start-up, up to 2.5 pictures per second).

Of course, with such a fun new toy at my disposal, I can’t help but try out my hand at some amateur photography. And since I just can’t help but do so whenever I inaugurate a new hobby or area of interest, I have created a new blog to share my work: Israel Photos (RSS). The common theme with all of the pictures displayed is that all are taken in Israel (where I live). Beyond that, the subject matter will be quite varied.

I researched some of the different options for photo blogs, and in the end settled on using Wordpress with the YAPB (Yet Another PhotoBlog) plugin. I am used to setting up and customizing Wordpress blogs, and I like how the plugin leverages the strengths of Wordpress while adding the functionality needed to modify the default operation of the software as required. And since this is running off of Wordpress, I could integrate other WP plugins down the line, if necessary. Although I will probably change some of the colors down the line, I am right now using the Grain theme, a theme specifically designed to work with YAPB. Setup for all of these components (including some minor customization of the theme) was very straightforward.

Please let me know what you think - I would appreciate the feedback. (An easy way to see thumbnails of all photos posted so far is through the mosaic page. My favorites to date: Rotting Pomegranate, Purple Flower with Dew and Old Woman Swinging).