Tuesday, 18 January 2011

Available for Ad-Hoc Development Work

If you need help with any database issues, or are considering having a custom system built, why not get in touch.
You can find my contact details here: Kandy Solutions Ltd

Over the years I have build many database systems, usually using MS SQL Server but also with MS Access.

Sometimes I get called in to troubleshoot an existing system, perhaps deal with a corrupt database. File based systems such as Access, Firefox and Paradox are particularly prone to corruption but often most if not all data can be recovered. SQL Server is much more stable, but can occasionally have serious problems. It may also be a design issue. I have come across clients who no longer have access to the original database developer and have a problem with the system. In one case they could no longer even log on to their SQL Server based system. Using my experience, and some of the tools that accompany SQL Server, such as the Profiler, I was able to diagnose the problem, fix it and get everyone working again within a couple of hours.

Other times I have build major systems for companies. I am able to deal with the whole process, from the initial consultation, through to the design and build, user training, and post installation support.

I try to select the most appropriate solution for a client. For example, for one major international manufacturer, I worked closely with their global IT director, and built a series of integrated Intranet database solutions that linked together their factories around the world. This mean there were no installation requirement on the user's desktops and being web based, was easy to use. It also mean they were operating system independent and have been able to run for a decade now without problems.

I think that more and more companies are looking to make their systems available to users wherever they are. Internet or Intranet solutions that are optimised to run on mobile devises when those are used could well be the way to go. This means the organisation is not tied to one particular devise.

However, for a rich and powerful application, you can't beat a windows desktop system. I have created many of these. In the past I have used Visual Basic and Delphi, these days I use VB.Net. I like to integrate my systems with Microsoft Office, so that users can generate Word and Excel documents automatically for example. It used to be that the problem of deploying a windows application to many users was a problem, and keeping it up to date, since a bespoke system goes through many changes. These days I like to use Microsoft's Click-Once technology when deploying solutions. It means that users are able to receive updates automatically, and that the application does not interfere with any other software on the PC.

Wednesday, 12 January 2011

JAVAC not recognised as an internal or external command

After installing the Java SE Development Kit 6, I created a java application, and when to the command prompt to compile it, I got this error message: 
"JAVAC not recognised as an internal or external command"


I eventually found JAVAC.exe by browsing to this folder:
C:\Program Files\Java\jdk1.6.0_23\bin


There are two ways to avoid the error message:
1) Supply the full path to JAVA.exe when compiling
2) Add an environment variable to this path.


In windows vista this can be found in Control Panel\System\Advanced System Settings
There is a button here for Environment Variables, as shown in the screen shot:




In the system variables, look for one called path and edit it
In the variable value box go to the end, add a semi-colon and the path to the JAVAC folder, eg ; C:\Program Files\Java\jdk1.6.0_23\bin\


Once compiled and executing the class from the command prompt you may still get errors such as this:

Exception in thread "main" java.lang.NoClassDefFoundError: YourAppName(wrong
name: YourAppName)

  1. Two things to bear in mind, when using JAVA to execute the class, do not add the .Class suffix to the class name when executing.
  2. Everything is case sensitive. Make sure the name of the class you enter matches the actual name in case as well as spelling



Offline GMail

Gmail is a great email tool, but what happens when you have no internet connection but still need access to your email and attachment history.

Gmail has an offline mode, it is not enabled by default, but it is easy to setup, and means you can keep working, even when you have no internet connection.

To set this up, log in to your Gmail account, go to Settings, and choose Offline from the menu.
Once you have applied it starts to copy your emails and you will see a progress report like this one:



By default "Enable Offline Mode" is not checked. Simple check this and apply. If you don't change any settings all you email and attachments for the last year will be copied to an offline cache. There will be shortcuts created that allow you to access the offline mode even when your internet connection is down. Obviously you cannot send and receive emails in this mode, but you can do most of the other things you would normally do, such a read, search and sort emails.

Sunday, 9 January 2011

Janus GridEx - Validating New Record Before Saving or Validating Edited Record

With Janus GridEx there are many events which trap edits. Often I want to validate the record before allowing it to be added, or checking that an edited record is valid.

The UpdatingCell even can be good for this, but what if a users adds a new record, and does not edit a cell, leaving it blank, which violates your system rules. In this case it is best to use the AddingRecord event and get the row and check that


Private Sub GridEX1_AddingRecord(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles GridEX1.AddingRecord


        Dim newRow As Janus.Windows.GridEX1.GridEXRow = GridEX1.GetRow()
        If newRow.Cells("my column name").Value.ToString = "" Then
            GridEX1.CancelCurrentEdit() 'If rule is violated you can reject the row using this method
            Exit Sub
        End If
  
End Sub



    Private Sub GridEx1_UpdatingCell(ByVal sender As Object, ByVal e As Janus.Windows.GridEX.UpdatingCellEventArgs) Handles GridEx1.UpdatingCell


        Try
            If e.Column.Key = "My Column Name" Then
                If e.Value.ToString.Trim = "" Then
                    MessageBox.Show("Holiday name should not be blank", "Holidays", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    e.Cancel = True
                End If
            End If


        Catch ex As Exception
           'Error Handling Here
        End Try


    End Sub

Friday, 7 January 2011

Configuring FTP Server on Windows Server 2008

Windows Server 2008 comes with a new FTP server that can be quite simple to set-up, if you use the Wizard. If you try to do it without the wizard, it can be very frustrating.

To start the FTP new site Wizard go to Start\All Programs\Administrative Tools\Internet Information Services (IIS) Manager

Then right-click on the main server node in the tree on the left, select Add FTP Site and the wizard starts. From there it should be very straight forward.

Tuesday, 12 October 2010

Creating Microsoft Outlook 2007 Add-Ins with Visual Studio 2008

From the 2008 version of Visual Studio, VSTO (Visual Studio Tools For Office) was included as started in all versions from Professional upwards. Previously it had been a separate add-in, with limited functionality in the pro version of Visual Studio.

To create an add in for Outlook 2007;
1) Oen visual studio 2008, go to File\New Project
2) From the project tree Choose Visual Basic\Office 2007\Outlook Add In




3)




4) To add an event handler, select Application from the drop down on the left, which lists elements of the class. Then select the event from the event list on the right.

5) Take as an example, ItemSend event

6) Add some code to the item event

7) Run the project in the usual Visual Studio way, Outlook will start, and the add in will be installed, so if you try to send an email message, your event will fire.

8) One great thing here is that you can set breakpoints within the code in Visual Studio, and do the usual debugging, while events are being fired in Outlook. This is an advance over the VBA methods of older versions of Outlook.

9) To remove the add-in from Outlook during the development stage: in Visual Studio Debug: Clean

Thursday, 7 October 2010

Janus GridEx - Adding a button Column

When using a Janus GridEx control it can be useful to have a column with a button in it.


This is an example of how to add a button column to a grid:


            Dim ButtonCol As New Janus.Windows.GridEX.GridEXColumn
            ButtonCol.Key = "Add" 'This is the way to identify the column when it is clicked
            ButtonCol.ButtonText = "Add" 'the caption on the button
            ButtonCol.ButtonDisplayMode = CellButtonDisplayMode.Always 'The button is visible even if the row is not selected
            ButtonCol.ButtonStyle = ButtonStyle.ButtonCell
            ButtonCol.Width = 40
            GridEX1.RootTable.Columns.Add(ButtonCol)




And, how to respond to the button click event:



    Private Sub GridEX1_ColumnButtonClick(ByVal sender As Object, ByVal e As Janus.Windows.GridEX.ColumnActionEventArgs) Handles GridEX1.ColumnButtonClick

        If e.Column.Key = "Add" Then 'Add should be replaced with the key to the button column



'To pick up the value of a specific cell in the current row, for example to get the record ID


 CInt(GridEX1.GetRow(GridEX1.Row).Cells("Id").Text)

'put handling code here
        End If

    End Sub