21 Dec 2009

Arkle Online Training Videos

Hi,
Follow our blog which shows new features and how to use them.

Please don't update yourself to a new version without checking with the helpdesk first. You may need schema updates to your database before applying an update (and if you update with out them Arkle may fall over and not work).

http://biztechteam.blogspot.com/2010/01/arkle-updates-bug-fixes-and-changes.html

Modifying Payouts (added by John McGuinness 21st-Dec-2009): Available version ePos 2.3.88 or above



Create customers for monitoring (added by John McGuinness 21st-Dec-2009): Available version ePos 2.3.88 or above



Attach bet to customer at scan time (added by John McGuinness 21st-Dec-2009): Available version ePos 2.3.88 or above



Attach bet to customer at edit time (added by John McGuinness 21st-Dec-2009): Available version ePos 2.3.88 or above

16 Dec 2009

SQL Server Transaction Log Full

Sometimes, for whatever reason the transaction log gets full up.
And shrinking via management studio doesn't work;

sp_detach_db [database name]
Then rename or delete the log file

Then
EXEC sp_attach_db @dbname = N'pubs',
@filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',
This will create a new blank log file and get you up and running.

15 Dec 2009

Checking Types in VB.NET

Easiest way I have found to date:


If TypeOf (Me.Button1) Is Button Then
MsgBox("is button", MsgBoxStyle.Information)
End If

26 Nov 2009

GUI Letting Users Know Which control has focus

When a control has focus there is a very subtle change in it's colour, that experienced windows users know.

However we develop software that is often the 1st windows programme the users have experienced.

To help, with this we sometimes set the background colour to yellow on focus and white on no focus. I've also modified the code, to allow you to set it up for making the border colour (color) go yellow on focus, and form colour on lost focus (bit like google chrome text boxes).

Here is some easy code to allow this:


#Region "ChangeColourOnHasFocus"

Private intFocusType As FocusType = FocusType.BackgroundColor
Private Enum FocusType
BackgroundColor = 1
BorderColor = 2
End Enum

Private Sub SetControlBackgroundToWhiteOnLostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim ctl1 As Control
ctl1 = sender
Debug.WriteLine(ctl1.Text)

Dim blChangeColour As Boolean
blChangeColour = Me.needToChangeControlColourOnFocusChange(ctl1)
If blChangeColour Then
Select Case intFocusType
Case FocusType.BackgroundColor
ctl1.BackColor = Color.White
Case FocusType.BorderColor
Dim g As Graphics = Me.CreateGraphics
Dim pen As New Pen(Me.BackColor, 5.0)
g.DrawRectangle(pen, New _
Rectangle(ctl1.Location, ctl1.Size))

End Select

End If

End Sub
Private Sub SetControlBackgroundToYellowOnFocus(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim ctl1 As Control
ctl1 = sender

Dim blChangeColour As Boolean
blChangeColour = Me.needToChangeControlColourOnFocusChange(ctl1)
If blChangeColour Then
'ctl1.BackColor = Color.Yellow

Select Case intFocusType
Case FocusType.BackgroundColor
ctl1.BackColor = Color.Yellow
Case FocusType.BorderColor
Dim g As Graphics = Me.CreateGraphics
Dim pen As New Pen(Color.Yellow, 5.0)
g.DrawRectangle(pen, New _
Rectangle(ctl1.Location, ctl1.Size))

End Select


End If



End Sub

Function needToChangeControlColourOnFocusChange(ByVal control1 As Control) As Boolean
' Don't change colour if control is not enabled or read only
Dim blSetColour As Boolean = True
If control1.Enabled = False Then
Return False
End If
If TypeOf (control1) Is TextBox Then
Dim txt1 As TextBox
txt1 = control1

If txt1.ReadOnly Then
Return False
End If
End If
Return True
End Function

Sub AddChangeColourOnFocusLostFocusHandlers()
' Can call this on form load on whenever you want to enable the colour changing
For Each control1 As Control In Me.Controls
Me.AddHandlersForLostFocusOnControlAndChildControls(control1)
Next
End Sub

Private Sub AddHandlersForLostFocusOnControlAndChildControls(ByVal control1 As Control)
For Each ctrlChild As Control In control1.Controls
Me.AddHandlersForLostFocusOnControlAndChildControls(ctrlChild)
Next
If TypeOf (control1) Is TextBox Or TypeOf (control1) Is ComboBox Then
AddHandler control1.GotFocus, AddressOf Me.SetControlBackgroundToYellowOnFocus
AddHandler control1.LostFocus, AddressOf Me.SetControlBackgroundToWhiteOnLostFocus
End If
End Sub


#End Region




Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.AddChangeColourOnFocusLostFocusHandlers()
End Sub

26 Oct 2009

SQL Server 2008 & Windows 7

We have just moved Arkle ePos to use SQL Server 2008. No problems at all.
We have also tested on Windows 7 (32 bit) and it works.

7 Oct 2009

Enums / Data Binding

I use enums in my code a lot.
Often I have to set the various enumerations into the text in a text box. This is simple:

Me.ComboBoxGameCode.DataSource = System.Enum.GetValues(GetType(NumbersGameDraw.GameType))

This is nice but not great.
Say we have enums representing multiple words (for example the following)
Paid
NotPaid (we would like NotPaid to display as Not Paid).

So I created enumhelper class to do this:

Public Class EnumHelper
Private Shared Function ChangeHungarianTextToSeperateWords(ByVal originalText As String) As String

Dim strOutput As String = ""
Dim i As Integer = 0
While i < originalText.Length
Dim char1 As Char
char1 = originalText.Substring(i, 1)

If Char.IsUpper(char1) Then
strOutput &= " " & char1
Else
strOutput &= char1
End If
i += 1
End While
Return strOutput.Trim

End Function

Public Shared Function GetEnumSeperateWordsList(ByVal enumType As Type) As ArrayList
Dim x = System.Enum.GetNames(enumType)
Dim y As New ArrayList

For Each item1 As Object In x
'item1 = Me.ChangeHungarianTextToSeperateWords(item1)
y.Add(EnumHelper.ChangeHungarianTextToSeperateWords(item1))
Next
Return y

End Function
End Class

6 Oct 2009

Numeric Up Down and the tab key

When users have to enter data in numerous numeric up down and tab between them, they can't just key the new amount.

Say 1 is in the numeric up down they have just tabbed to and they type 2, it will go to 21 (instead of 2 which they wanted).

So for this I have put a bit of code on the got focus

Private Sub NumericUpDown1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles NumericUpDown1.GotFocus
Me.NumericUpDown1.Select(0, Me.NumericUpDown1.Value.ToString.Length)
End Sub



Private Sub NumericUpDown2_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles NumericUpDown2.GotFocus
Me.NumericUpDown2.Select(0, Me.NumericUpDown1.Value.ToString.Length)
End Sub

This selects the whole value and allows them to type.
Why does the control not just behave like this in the first place?

Also I'm toying with setting background colours to yellow when controls have focus and back to white when they do not, this is much better than the less subtle built in controls.

26 Sept 2009

T-SQL Get dates on a specific day when you don't care about time

Quite often I have to write queries to return rows where something happened on a specific day. But the values in the table could be anytime within that day.

Previous I would pass in a start date, end date to do this, but the query then needs 2 parameters and it looks a bit cumbersome.

I came across this method which I now employ. Don't know if this has much performance impact, but it certainly is quicker to code and takes less parameters from calling application.

Where
(
DateDiff(day, @ReportStartDate,TerminalSession.StartDate) = 0

--StartDate >= @ReportStartDate
--And
--EndDate >= @ReportEndDate
)

22 Sept 2009

Visual Studio Dataset Designer Problem

Just wasted about 5 hours on a really annoying problem.
I have a data access layer project in my solution.

It stopped compiling properly and was giving mutliple defintion errors.
The was one dataset.xsd
but mutliple dataset.designer.vb (e.g. dataset.designer1.vb, dataset.designer2.vb).
Somewhere along the line the .vbproj file must have added another entry.

To solve I copied the XSD file to desktop.
Deleted it from project (through IDE).
Deleted all the .designer files (through explorer).
Readded the XSD to the project and it compiles fine.

Actually thats what I should have done, initially I wasted hours and hours trying other solutions.

9 Sept 2009

Code Rush : Refactor

Had tried this out a few years back, and it ate up my CPU/Memory so unistalled it on the day I installed it.

Just downloaded the latest version available on their website

Structural highlighting is my favourite feature to date (even though it isn't much of a time saver)

Have to say no speed/cpu/memory issues now, and the product is SUPERB.
It is going to save me so much time coding I might cut down to a 6 day working week.

7 Sept 2009

New Blog

Hi folks,
Haven't blogged in quite some time, but have decided to start again.
Some stuff on .NET serialization to follow.