Erm's I.T. Girl – Zelna Ellis

Don't fear when Zel is near…

From my pen today

No tips and tricks, nor how to’s today. Just some blah, blah, blah from my pen today.
It’s now 20:30 here and I’m sitting outside in the foyer next to the braaivleis fire. Going to braai some boerewors and steak. Pap and sheba is on the stove.
Well I start the fire, and it is going be awhile before I will be able to put the meat on the grill. Luckily it didn’t reach the roof :). You see what I mean:
I start the fire!

Well after a late night dinner I will get back to do some coding. In the meantime I’ll tune the guitar in and just strum some notes haven’t played for awhile, been concentrating on the exams. Just going to chill out for awhile on this lovely Spring evening. There will be very little blog posts if any during October. On Monday is the presentation at UNISA and then the Science exam on the 30th. In November there will be a lot of catching up to do of course.
Well on a closing note Thank You to Dale Chase for allowing me to use his song Coder Girl, the ode to female programmers, in my presentation.

Enjoy!

Advertisements

30 September 2009 Posted by | In My Laboratory, Off The Beat | , , , , , , , , | Leave a comment

VB.NET Add Local User and Group Accounts with Net Command

It can be quite a mission if you need to add a local user and/or group without AD (Active Directory) in VB.NET. There are other ways, e.g. Scripting etc., but this is really easy. The downfall here is that you won’t see any error messages but you can always use WMI to see if a group and/or user exists. The normal rules for the net.exe command count and you can use the parameters you need.

proc.StartInfo.Arguments = "enter the parameters for the command here"
If you do know of a more efficient way to do it, please share it with us.

Note: Usually one will get the username, password, group, etc. from the GUI’s textboxes. Left it out in this example to simplify the code.

Download code (PDF) here.

Imports System
Imports System.Diagnostics

Public Class CheckUser02

     Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
          Try
               Dim proc As New Process
               proc.StartInfo.FileName = "net.exe"
               proc.StartInfo.UseShellExecute = False
               proc.StartInfo.CreateNoWindow = True 'Don’t show command prompt window.

               'Add localgroup named "test" with "The Test Group" as a comment(Description of Group)
               proc.StartInfo.Arguments = "localgroup test /ADD /COMMENT:Test-Group"
               proc.Start()
               proc.Close()
               'Add local user names "test1" where the user password = "12345"
               proc.StartInfo.Arguments = "user test1 12345 /ADD /FULLNAME:TestUser1"
               proc.Start()
               proc.Close()
               'Add local user "test1" to localgroup "test1"
               proc.StartInfo.Arguments = "localgroup test test1 /ADD"
               proc.Start()
               proc.Close()

          Catch ex As Exception
               MsgBox(Err.Description)
          End Try
     End Sub
End Class

29 September 2009 Posted by | .NET & MySQL | , , , , , , , , | 3 Comments

VB.NET & MySQL: Check Status, Start or Stop Windows Service

Well the title says it all. In this example MySQL Server is used to check whether the service exists. If it is disabled it will set the StartupStatus to Manual. Then it will check whether or not the Service is running, and start it if necessary.
You can just replace it with the Windows Service you need to manipulate.

You can download the code in PDF format here.

Note: tsStatus is a ToolStripStatusLabel that is on the form. Tested on Windows XP SP3

Imports System
‘Remember to add references to the following namespaces:
Imports System.ServiceProcess
Imports System.Management

Public Class MySQLCheck

     Private Sub MySQLCheck_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          Try
               Dim mo As New Management.ManagementObject("Win32_Service.Name=’MySQL’")
               tsStatus.Text = "Busy…"
               ‘Check if MySQL Service is installed. If not it will close the form.
               Try
                    mo.Get()
               Catch ex As Exception
                    MessageBox.Show("Need to install MySQL Server", "MySQL Server Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    Me.Close()
               End Try

               ‘Check if the StartMode = Disabled. If so it will change it to Manual
               If mo("StartMode").ToString = "Disabled" Then
               Dim inParams, outParams As ManagementBaseObject
               Dim result As Integer

               ‘Get an input parameters object for this method
               inParams = mo.GetMethodParameters("ChangeStartMode")
                ‘Set the StartMode to ‘Manual’
               inParams("StartMode") = "Manual"
               outParams = mo.InvokeMethod("ChangeStartMode", inParams, Nothing)
               ‘Check for errors 0 means the request has been accepted.
               result = Convert.ToInt32(outParams("returnValue"))

               ‘Handle errors if any
               If result <> 0 Then
                    Dim myErrMsg As String = ""
                    Select Case result
                         Case 1
                              myErrMsg = "The request is not supported."
                         Case 2
                              myErrMsg = "The user did not have the necessary access."
                         Case 3
                              myErrMsg = "The service cannot be stopped because other services that are running are dependent on it."
                         Case 4
                              myErrMsg = "The requested control code is not valid, or it is unacceptable to the service."
                         Case 5
                              myErrMsg = "The requested control code cannot be sent to the service because the state of the service (Win32_BaseService State property) is equal to 0, 1, or 2."
                         Case 6
                              myErrMsg = "The service has not been started."
                         Case 7
                              myErrMsg = "The service did not respond to the start request in a timely fashion."
                         Case 8
                              myErrMsg = "Interactive process."
                         Case 9
                              myErrMsg = "The directory path to the service executable file was not found."
                         Case 10
                              myErrMsg = "The service is already running."
                         Case 11
                              myErrMsg = "The database to add a new service is locked."
                         Case 12
                              myErrMsg = "A dependency on which this service relies has been removed from the system."
                         Case 13
                              myErrMsg = "The service failed to find the service needed from a dependent service."
                         Case 14
                              myErrMsg = "The service has been disabled from the system."
                         Case 15
                              myErrMsg = " The service does not have the correct authentication to run on the system."
                         Case 16
                              myErrMsg = "This service is being removed from the system."
                         Case 17
                              myErrMsg = "There is no execution thread for the service."
                         Case 18
                              myErrMsg = "There are circular dependencies when starting the service."
                         Case 19
                              myErrMsg = "There is a service running under the same name."
                         Case 20
                              myErrMsg = "There are invalid characters in the name of the service."
                         Case 21
                              myErrMsg = "Invalid parameters have been passed to the service."
                         Case 22
                              myErrMsg = "The account which this service is to run under is either invalid or lacks the permissions to run the service."
                         Case 23
                              myErrMsg = "The service exists in the database of services available from the system."
                         Case 24
                              myErrMsg = "The service is currently paused in the system."

                    End Select
                    Throw New Exception("ChangeStartMode method error code " & result & ControlChars.NewLine & myErrMsg)
               End If
          End If

          ‘Check status of MySQL Server
          ‘If the service is running all is fine
          ‘Else it will wait for the Server to run, or attempt to start the Server
          ‘The status will be updated in the ToolStripStatusLabel tsStatus

          ‘ServiceControllerStatus Meanings
          ‘1 = Stopped – The Service is not running.
          ‘2 = StartPending – The Service is starting.
          ‘3 = StopPending – The Service is stopping.
          ‘4 = Running – The Service is running.
          ‘5 = ContinuePending – The Service continue is pending.
          ‘6 = PausePending – The Service pause is pending.
          ‘7 = Paused – The service is paused.
          Dim sc As New ServiceController("MySQL")
          Select Case sc.Status
               Case 1
                    tsStatus.Text = "MySQL Server is not running, please wait…"
                    sc.Start()
                    tsStatus.Text = "Starting MySQL Server, please wait…"
                    sc.WaitForStatus(ServiceControllerStatus.Running)
                    tsStatus.Text = "Ready"
               Case 2
                    tsStatus.Text = "MySQL Server is starting, please wait…"
                    sc.WaitForStatus(ServiceControllerStatus.Running)
                    tsStatus.Text = "Ready"
               Case 3
                    tsStatus.Text = "MySQL Server is stopping, please wait…"
                    sc.WaitForStatus(ServiceControllerStatus.Stopped)
                    tsStatus.Text = "Starting MySQL Server, please wait…"
                    sc.Start()
                    sc.WaitForStatus(ServiceControllerStatus.Running)
                    tsStatus.Text = "Ready"
               Case 4
                    tsStatus.Text = "Ready"
               Case 5, 6, 7
                    tsStatus.Text = "MySQL Server is stopping, please wait…"
                    sc.Stop()
                    sc.WaitForStatus(ServiceControllerStatus.Stopped)
                    tsStatus.Text = "Starting MySQL Server, please wait…"
                    sc.Start()
                    sc.WaitForStatus(ServiceControllerStatus.Running)
                    tsStatus.Text = "Ready"
          End Select
          Catch ex As Exception
               MessageBox.Show(Err.Description, "MySQL Server Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
               Me.Close()
          End Try
     End Sub
End Class

28 September 2009 Posted by | .NET & MySQL | , , , , , , , , , , , , , , , , | 5 Comments

Googlle – Happy Birthday Google

Google’s 11th birthday

Well maybe some of you have noticed that Google’s logo has two L’s today. The two L’s represent the number 11. It is Google’s 11th birthday today.

Happy Birthday Google!

27 September 2009 Posted by | Technologies | , , , | 4 Comments

Disable “There are unused icons on your desktop” balloon

How many times have you logged in to your Windows XP computer and then you get this annoying popup balloon message:
There are unused icons on your desktop
The desktop cleanup wizard can help you clean up your desktop. Click this balloon to start the wizard.
Unused Icons Balloon

This is how you can disable this notification:

  1. Right-click on anywhere on your desktop and select Properties.
    Select Properties
  2. In the Display Properties dialogue box – click on the Desktop tab, then click on Customize Desktop button at the bottom left of the window.
    Display Properties
  3. In the General tab clear the Run Desktop Cleanup Wizard every 60 days checkbox and Click OK.
    Desktop Items - General
  4. Click Apply and OK to close the Display Properties dialog box.

Watch the clip here.

19 September 2009 Posted by | Windows | , , , | Leave a comment

Read, Edit, Save Open Documents in Microsoft Office

It is possible to open, edit and save the ISO-standard Open Document Format, such as Open Office, Google Docs in Microsoft Office. This is for the users of Microsoft Office Word, Excel and PowerPoint. File extensions include .odt (text/word processing), .ods (spreadsheet), and .odp (presentation).

Note:
It might not have the same formatting as it did in the original application it was created in. This is because of the differences between applications that use the OpenDocument Format.

Method 1 – For MS Office 2007 users
After you installed MS Office 2007 Service Pack 2 you can open, edit and save documents, spreadsheets and presentations straight in the Microsoft Office Suite.

Method 2 – Sun ODF Plugin for Microsoft Office
This plugin works with Microsoft Office 2000, XP(2002), 2003, 2007 SP1 or higher.
Just download and install the Sun ODF Plugin here.

Method 3 – Online Convertors
You can also try out an online convertor such as Media-Convert or Zamzar.

17 September 2009 Posted by | Software | , , , , , | Leave a comment

Seacom Broadband Experience Exhibition – My Opinion

Seacom announced that they are hosting the Broadband Experience exhibition 14-18 October 2009, Nelson Mandela Square – Sandton City.

Honestly folks this is how I feel:
They are taunting us. It’s like an item on display not for sale. What is the point of DATA at The Current Costs? I really do not understand our telecoms.
What is stopping Telkom, Neotel (if available in your area), Vodacom and MTN from just supplying the data at a lower cost?
Is the public going to be raped by first the terms and conditions, and then by the high prices and snail speeds… Even where a pigeon is faster than a computer download?
Until I see and feel the power of Seacom at the right price on my internet connection I do not believe anything.

14 September 2009 Posted by | Technologies | , , , , , , | Leave a comment

Task Manager Menu Bar and Tabs Are Not Visible

When you start Task Manager, the menu bar and tabs may not be visible. The cause can be that Task Manager is running in Tiny Footprint mode.
Task Manager in Tiny Footprint mode

To view Task Manager in normal mode, double-click the top border of the window.
Task Manager in Normal Mode

10 September 2009 Posted by | P.C. Troubleshooting | , | Leave a comment

It is madness

Laugh when you can,
apologize when you should,
let go of what you can’t change and have no regrets

Watch the clip here

8 September 2009 Posted by | Off The Beat | , | Leave a comment