Archive for March 2010

The plural of “digital cameras” is…

It has been a while since I posted something, and so when I was cleaning up the files from an older computer last night and stumbled on this beauty that I screen captured way back on August 19, 2004, I figured I should share…

Don’t bother going to their web site and checking, Dell fixed it pretty quickly, just in case you were wondering. Oh, and no word yet from E-Tech eStore regarding my appeal.

E-Tech Sony replacement keyboard woes

For many years, I faithfully used a Sony Vaio VGN-FS742/W notebook computer. This computer was an absolute workhorse, and I never had a problem with it, despite using it heavily for software development as well as the usual e-mail and web surfing activities.

After I let my brother and his family use the computer, an unfortunate incident occurred that involved the cosmetic destruction of the B key on the keyboard. The key worked, but the tabs that held the platform that the keycap sits on broke off, so the B key stuck out higher than the rest of the keys on the keyboard. Unsightly, yes, but still functional.

Alas, my brother had to have a functional and flat keyboard, so I began the process of looking to find a replacement keyboard for a computer that was 5+ years old. The Sony part number for this keyboard is 147915321, and it must be the same keyboard on all VGN-FS series Vaio notebooks.

The first thing that I found was that I was more than likely going to have to buy a used keyboard and hope that it worked just fine. So I ordered one from the E-Tech eStore. The keyboard arrived well packaged, and after I installed it, I tested every single key on the keyboard and found that all of the keys worked except for the V key.

At this point, I should have requested an RMA for a refund, but I mistakenly requested a replacement. After sending the first keyboard back and getting the second keyboard, the situation got worse, as on the 2nd keyboard, quite a few more keys were not working. And of course, at this point my return request for a refund was rejected, as E-Tech is claiming that their keyboards are all tested, and that I check my equipment for failure.

So, as a response, I created this little rant video showing that my equipment is fine:

httpv://www.youtube.com/watch?v=A_c1hBj2MG0

As I said in the video, I cannot see how they could have tested the keyboard fully, since my hardware seems to work fine with my old keyboard with the B key tabs broken. I am guessing that their replacement keyboards are all pulls from computers that are dropped off at the computer recycling, and for the particular keyboards that I received, the reason the computer was at the recycling center was that some of the keys stopped working.

By the way, congrats to the Ohio Bobcats.  Big win last night.

UPDATE: I still haven’t heard anything from E-Tech eStore regarding my appeal of their RMA request denial. Thanks to Tai Tran (eBay seller ID ttni) who came through with a perfectly working replacement keyboard.

VB.NET Printing For Dummies

In order to send stuff to the printer in VB.NET, it is not quite as simple as dealing with the Printer object as in VB6. There are a couple of extra steps involved. Here is what I found, along with some helper methods that you might find useful.

On the form you want to print from, pull up the Toolbox and add a PrintDocument, a PrintDialog, and a Button, set the Document property of the PrintDialog to point to the PrintDocument you just created, and in the button’s Click event, insert the following code:

    Private Sub butPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butPrint.Click
 
        If PrintDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
            PrintDocument1.DefaultPageSettings.Landscape = True
            PrintDocument1.Print()
        End If
 
    End Sub
 
    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
 
        PrintTestPage(e.Graphics, PrintDocument1)
 
    End Sub

The Print method call in the button click event then fires the PrintDocument PrintPage event. Notice that I have set the default page settings to landscape. Don’t forget to wire the PrintDialog Document property to your PrintDocument, otherwise if you change the printer to print to in the print dialog, the document will still go to the default printer.

The PrintTestPage method is just something simple that I put together to make sure that the coordinates and justifications are all working fine. Here is that code:

    Sub PrintTestPage(ByVal g As System.Drawing.Graphics, ByVal doc As PrintDocument)
 
        Dim x, y As Integer
 
        For x = 0 To 100 Step 10
            For y = 0 To 100 Step 10
                PrintAtLocationWithColor(g, doc, x.ToString + ", " + y.ToString, x, y, _
                                         If(x = 0, "L", If(x = 100, "R", "C")), If(y = 0, "T", If(y = 100, "B", "C")), _
                                         "Arial", 8, True, Brushes.Red)
            Next
        Next
 
        PrintRectangle(g, doc, 0, 0, 100, 100)
        PrintRectangle(g, doc, 10, 10, 80, 80)
        PrintRectangle(g, doc, 20, 20, 60, 60)
        PrintRectangle(g, doc, 30, 30, 40, 40)
        PrintRectangle(g, doc, 40, 40, 20, 20)
 
    End Sub

The two methods called here, PrintAtLocationWithColor and PrintRectangle, are shown here:

    Sub PrintAtLocationWithColor(ByVal pg As Graphics, ByVal pd As PrintDocument, ByVal s As String, _
                                ByVal xPosition As Single, ByVal yPosition As Single, _
                                ByVal justification As String, ByVal verticalJustification As String, _
                                ByVal fontFace As String, ByVal fontSize As Single, _
                                ByVal fontBold As Boolean, ByVal theColor As Brush)
 
        Dim w, h As Single
        Dim x, y As Single
        Dim f As Font
        Dim sty As FontStyle
 
        sty = FontStyle.Regular
        If fontBold Then sty = sty + FontStyle.Bold
        If fontSize < 1 Then fontSize = 8.0
        f = New Font(fontFace, fontSize, sty)
 
        If pd.DefaultPageSettings.Landscape Then
            x = xPosition / 100 * (pd.DefaultPageSettings.PrintableArea.Height)
            y = yPosition / 100 * (pd.DefaultPageSettings.PrintableArea.Width)
        Else
            x = xPosition / 100 * (pd.DefaultPageSettings.PrintableArea.Width)
            y = yPosition / 100 * (pd.DefaultPageSettings.PrintableArea.Height)
        End If
 
        w = pg.MeasureString(s, f).Width
        h = pg.MeasureString(s, f).Height
 
        If Left(UCase(justification), 1) = "C" Then
            x = x - w / 2
        End If
        If Left(UCase(justification), 1) = "R" Then
            x = x - w
        End If
 
        If Left(UCase(verticalJustification), 1) = "C" Then
            y = y - h / 2
        End If
        If Left(UCase(verticalJustification), 1) = "B" Then
            y = y - h
        End If
 
        pg.DrawString(s, f, theColor, x, y)
 
    End Sub
 
    Sub PrintRectangle(ByVal pg As Graphics, ByVal pd As PrintDocument, ByVal xPosition As Single, ByVal yPosition As Single, _
                                ByVal width As Single, ByVal height As Single)
 
        Dim w, h As Single
        Dim x, y As Single
 
        If pd.DefaultPageSettings.Landscape Then
            x = xPosition / 100 * (pd.DefaultPageSettings.PrintableArea.Height)
            y = yPosition / 100 * (pd.DefaultPageSettings.PrintableArea.Width)
            w = width / 100 * (pd.DefaultPageSettings.PrintableArea.Height)
            h = height / 100 * (pd.DefaultPageSettings.PrintableArea.Width)
        Else
            x = xPosition / 100 * (pd.DefaultPageSettings.PrintableArea.Width)
            y = yPosition / 100 * (pd.DefaultPageSettings.PrintableArea.Height)
            w = width / 100 * (pd.DefaultPageSettings.PrintableArea.Width)
            h = height / 100 * (pd.DefaultPageSettings.PrintableArea.Height)
        End If
 
        pg.DrawRectangle(Pens.Black, x, y, w, h)
 
    End Sub

All of the positioning and size parameters of these methods are percentages across and down the page, which I find much easier to deal with than absolute or printer specific positioning. This makes it dead simple to scale the reports to any page size I want to use.

Documentation overload

Peanut allergies are really only a problem if you can open the package…  Oh wait, now I figured it out…

So I should probably take the jackhammer back to the tool rental place, I guess I won’t be needing it to eat my Kit Kat bar.

Sansa e250 database rebuild

For some reason, my Sandisk Sansa e250 MP3 player was stubbornly refusing to acknowledge the music that I was copying to it. I tried just about everything I could think of short of formatting the device to get it to see my folders in the Music folder. My device has the latest version 1 firmware upgrade, and I have tried to use both MSC and MTP mode to copy folders to the device, all to no avail.

Finally, I found out that I could force the device to do a database rebuild by doing the following steps, which should work on any Sansa e200 series MP3 player with the version 1 firmware:  (WARNING:  Please do not do this if you are worried about making your device inoperable.  There is always a risk that this will happen when you start futzing with the system files.)

  • Go into the Settings screen and scroll to USB mode, and set it to MSC
  • Connect the device to the computer
  • Once the device mounts as a drive on your computer, browse to the device, look for the System folder, and the Data folder in that folder
  • Delete the file called PP5000.DAT
  • Disconnect the device

Once you disconnect, the device will restart, and it should refresh the database. If you prefer MTP mode, make sure to go back into the settings to change it back.

Gmail phishing warning

I think that Google might have the Gmail phishing filter set just a tad too strong. I was in my Gmail account this morning and accidentally clicked on the very first message I got in the account, which is of course the introductory e-mail that describes how to switch your existing e-mail over to Gmail. Here is what I saw: