Showing entries 1 to 4
Displaying posts with tag: 2005 MySQL User's Conference (reset)
New Function

Here's a quick function you may find useful, it calculates a timespan in hours and quarter hours (4.25, 5.5, 6.75, etc):

DELIMITER $$
        
DROP FUNCTION IF EXISTS `upto`.`hours_and_quarter_hours`$$
CREATE FUNCTION `upto`.`hours_and_quarter_hours`(p_start_time DATETIME, p_end_time DATETIME) RETURNS decimal(5,2)
BEGIN
        
    DECLARE quarter_hours INTEGER;
        
    SET quarter_hours = CEILING((UNIX_TIMESTAMP(p_end_time) - UNIX_TIMESTAMP(p_start_time)) / 900);
        
    RETURN FLOOR(quarter_hours / 4) + (MOD(quarter_hours,4) * .25);
        
END$$
        
DELIMITER ;
A new Machine

In order to better document MySQL on Mac, I have recently acquired a Mac Mini. This brings my collection of desktop machines to three:

The black machine is a Windows box, the white machine runs Linux, and now a Mac Mini.

The new addition closer up:

This is the first Mac I have had regular use of, so I am sure I have some learning to do. For now I just need to get MySQL and the GUI tools installed, then find where they hide the command-line.

Lamenting a Loss of Language

I went to the annual local airshow today, got to see some nice planes, got a great sunburn, and got another reminder that I am slowly losing my second language. From 1996 to 1998 I lived in southern Japan and became a pretty good speaker of Japanese. Not pretty good in the sense that a guy who watches too much Anime considers himself pretty good at Japanese, but pretty good in the sense that I spoke Japanese every day, did spoken translations at meetings, and on more than one occasion would get a good ways into a telephone conversation before the person on the other end of the phone would realize I was not my Japanese roommate. I was almost illiterate when it came to the written word, but at spoken language I was pretty darn good, all I needed was more and more words in my vocabulary (Japanese grammar is a breeze once you know the rules, and there are no exceptions to the rules).

So, I was standing in line to take a look through one …

[Read more]
Cancel the Display of a ContextMenuStrip in VB.NET 2005

I encountered a bug recently in my tool where I could right-click on a listview, even if I was not right-clicking on a listview item, and still use the item related entries of a contextMenuStrip. The problem is that unlike the TreeView, the ListView does not allow you to assign a ContextMenuStrip to individual items, just the control as a whole.

The solution was to use the new Opening event of the ContextMenuStrip:


Private Sub eventMenu_Opening(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) Handles eventMenu.Opening
        If lvwEvents.SelectedItems.Count = 0 Then
            e.Cancel = True
        End If
End Sub

By setting e.Cancel to True, the menu is never shown. I determine whether an item was clicked on by checking the count of selecteditems.

Showing entries 1 to 4