Tuesday 23 October 2012

Add a Shutdown Button to the Windows 8 Start Menu

WTF? why would you need this?

Add a Shutdown Button to the Windows 8 Start Menu:




With Windows 8's radical user interface many familiar windows elements are not present or must be accessed differently. If you're missing the shutdown button and don't want to use the new charms bar you can add back your shutdown button the start menu manually.
Educational weblog WonderHowTo shares that, to make a shutdown button for your start screen, you must first create a desktop shortcut (right-click, new shortcut) and enter this line of code in the location field:
Shutdown.exe —s —a 00
Name the desktop shortcut Shutdown and click Finish. Finally, right-click on that shortcut and choose Properties then Change Icon and from the menu that pops up you will pin the shortcut to your start menu. The video above shows you how to complete each step.
How to Add an Actual Shutdown Button to the Windows 8 Start Screen | WonderHowTo

Wednesday 17 October 2012

CodeSOD: The White Flag

CodeSOD: The White Flag:
Handling dates is hard. Kevin sends us this attempt at building it from scratch, found in a third-party library. It was shaped with a Tab key that wishes nightly for death.

Protected Shared Function dateTimeFromJavaXml(ByVal dt As String) As DateTime  
   Dim datetime1 As DateTime = DateTime.get_Now()  
   If (dt.EndsWith(" GMT-12:00")) Then
       dt = dt.Replace(" GMT-12:00", "-12:00")  
   ElseIf (dt.EndsWith(" GMT-11:00")) Then
       dt = dt.Replace(" GMT-11:00", "-11:00")
       GoTo label1
       If (dt.EndsWith(" WSST")) Then
           dt = dt.Replace(" WSST", "-11:00")
       ElseIf (dt.EndsWith(" SDT")) Then
           dt = dt.Replace(" SDT", "-11:00")
           GoTo label2
           If (dt.EndsWith(" NUST")) Then
               dt = dt.Replace(" NUST", "-11:00")
           ElseIf (dt.EndsWith(" GMT-10:00")) Then
               dt = dt.Replace(" GMT-10:00", "-10:00")
               GoTo label3  
'SNIP: Let's skip ahead, retaining the indenting…      scroll that way ->                                                  ->                       keep going                                               ->                                                                        and going                                                oh, there it is!
                                                                                                                                                                                                                                                                                                                                                               If (Else.EndsWith(" TOST")) Then
                                                                                                                                                                                                                                                                                                                                                                   dt = dt.Replace(" TOST", "+13:00")
                                                                                                                                                                                                                                                                                                                                                               ElseIf (dt.EndsWith(" GMT+14:00")) Then
                                                                                                                                                                                                                                                                                                                                                                   dt = dt.Replace(" GMT+14:00", "+14:00")
                                                                                                                                                                                                                                                                                                                                                                   GoTo label88
                                                                                                                                                                                                                                                                                                                                                                   If (Else.EndsWith(" LINST")) Then
                                                                                                                                                                                                                                                                                                                                                                       dt = dt.Replace(" LINST", "+14:00")
                                                                                                                                                                                                                                                                                                                                                                   Else
                                                                                                                                                                                                                                                                                                                                                                       dt = dt.Substring(0, (dt.LastIndexOf(" ") - 1))
                                                                                                                                                                                                                                                                                                                                                                   End If
                                                                                                                                                                                                                                                                                                                                                               End If  

'SNIP: we'll just skip past the sea of End Ifs and hope to find shore  
End If  
   Try
       label1:
       label2:
       label3:
       label4:
       label5:
       label6:
       label7:
       label8:
       label9:  
'SNIP  
       label88:
         datetime1 = DateTime.Parse(dt)  
   Catch exception As Exception
       exception  
   End Try  
   Return datetime1  
End Function

When you scroll through the code, it waves back and forth across the screen, just like the white flag your brain will wave if you make any attempt to parse its horrors. It should be projected on the wall of a modern art museum, where it can live happily with other simple motifs beaten and stretched beyond comprehension by people who would like to convince you they were attempting something “bold” and “edgy.”