Web Application - iPad development resources

by marc walgren23. April 2013 05:16

We recently developed  a couple of warehouse support applications for a client. Not only was the application used in a regular desktop browser, but the warehouse personnel also accessed the application on an iPad out in the warehouse. The iPads were mounted on forklifts and connect to the internal network.

Several key resources we used include this article from the Safari Developers library:


We also tried these iPad simulators:



We successfully overcame the challenge to balance the size of the controls and positioning on both browsing platforms.


.NET | Development | General

Use equates to fill a Clarion Drop List Control

by marc walgren26. March 2013 05:08

Drop Lists work well with a short list of choices, say 3-10. In the Clarion dictionary offers "Must be in List" on the validation tab. There are two parts to the list "Choices" and "Values". The list elements are entered and must be separated by the Pipe character (|).

The approach I favor is to use equates to build the choices/value lists and reference the equate from the particular control. Updating an equate does not require a full application rebuild (handy when developing a multi-dll app) and adding another value is really quick and easy.

Ok. A trival example. We have a system with a User table and each has a Type. (I these standards for the equates

! Equate Prefix: e_   "Equate"  -- Usually For Displaying
! Equate Prefix: v_   "Value"   -- Usually For "Value" stored In DB, like 1,2,3,ENG,SPA
! Equate Prefix: d_   "Default" -- Usually Default "Value"
! Equate Prefix: l_   "List"    -- Usually for Dropdown List

We define four user types and their associated values: (Notice the values are equated strings)

e_UserType_Standard    Equate('Standard')

v_UserType_Standard    Equate('1')

e_UserType_Manager     Equate('Manager')

v_UserType_Manager     Equate('2')

e_UserType_Admin     Equate('Admin')

v_UserType_Admin     Equate('3')


Let's equate the separator characters too.

e_bar             Equate('|')

e_hash            Equate('#')

e_BarHash         Equate(e_bar & e_hash)

Now build the equate for the drop list

l_UserType_opts     Equate(e_UserType_Standard & e_BarHash & v_UserType_Standard & e_Bar & |

                                        e_UserType_Manager & e_BarHash & v_UserType_Manager & e_Bar & |

                                        e_UserType_Admin & e_BarHash & v_UserType_Admin)


Reference the list equate in the From property of the list control.



Works really well.


Additions to the list are trivial. Add a couple equates and update the list equate and recompile.


Clarion | Development

Paging through a SQL result set

by jim morgan26. January 2013 14:38

For an application to browse a large dataset, you need to set a limit to the number of rows returned. As users page up and down through the results, the application needs to return the next block of results. This can be done with a Select with a Subquery. The Subquery have virtually no performance penalties over a straight query. The advantage is that you can use the TOP function to get the next block in the subquery, but return the results in a different order.

The key concepts here are:

1. Save the identifiers to the first and last row of the block for pagination.

2. To get the last or previous block, toggle the ASC/DESC on each element of the original order by.

3. To get the previous block, toggle the booleans <> in the Where Clause.

Examples of 30 row page blocks sorted by LastName, FirstName and SysID (to force uniqueness)

Last Page

    SELECT TOP (30) LastName, FirstName, SysID
    FROM YourTable
    ORDER BY LastName DESC, FirstName Desc, SysID Desc) A
ORDER BY LastName ASC, FirstName ASC, SysID ASC

First Page

    SELECT TOP (30) LastName, FirstName, SysID
    FROM YourTable
    ORDER BY LastName ASC, FirstName ASC, SysID ASC) A
ORDER BY LastName ASC, FirstName ASC, SysID ASC

Next Page

DECLARE 	@HighLastName varchar(30) = 'MidLN',
    @HighFirstName varchar(30) = 'MidFN',
    @HighSysID int = 1000;
    SELECT TOP (30) LastName, FirstName, SysID
    FROM YourTable
    WHERE LastName > @HighLastName
        OR (LastName = @HighLastName AND FirstName > @HighFirstName)
        OR (LastName = @HighLastName AND FirstName = @HighFirstName AND SysID > @HighSysID)
    ORDER BY LastName ASC, FirstName ASC, SysID ASC) A
ORDER BY LastName ASC, FirstName ASC, SysID ASC

Previous Page

DECLARE 	@LowLastName varchar(30) = 'MidLN',
    @LowFirstName varchar(30) = 'MidFN',
    @LowSysID int = 1000;
    SELECT TOP (30) LastName, FirstName, SysID
    FROM YourTable
    WHERE LastName < @LowLastName
        OR (LastName = @LowLastName AND FirstName < @LowFirstName)
        OR (LastName = @LowLastName AND FirstName = @LowFirstName AND SysID < @LowSysID)
    ORDER BY LastName DESC, FirstName DESC, SysID DESC) A
ORDER BY LastName ASC, FirstName ASC, SysID ASC

While you could certainly reduce these statements in verboseness, the optimization on the backend is negligible.
This patterns allows for a generic pagination function to be developed with nirtualy no added overhead.


.NET | Development | General | SQL

Time Management and Interruptions

by jim morgan23. January 2013 06:45

I think Chris Parnin did a good job describing the issues in programmer productivity in his blog, "Programmer Interrupted". Interruptions kill concentration.

Pomodoro is interesting way to manage your time. Personally, I don't set a timer. However, the notion of focused activity for about 25 minutes rewarded with a brief break makes sense.

He discusses headphones which I use in noisy environments when I need focused attention. However, normally I have music in the background playing over basic speakers. The music is there as white noise so unusual noises don't distract me. I've always thought the type of music is not important as long as it doesn't generate added interruptions.



Development | General

Use T-SQL ISDATE() function with care

by marc walgren14. January 2013 07:18

I have used the T-SQL function ISDATE() function in many places in my client projects. I came across an interesting behavior that caught me off guard. Try the following T-SQL:

declare @seedDate varchar(20) = '9966'
if isdate(@seedDate) = 1
 Print 'Good Date ' + @seedDate
 Print 'Invalid Date ' + @seedDate

declare @myDate Date
select @myDate = @seedDate
print @myDate


Running this bit of code produces this result:

Good Date 9966

Notice that the "9966" value is implicitly converts to Jan. 1, 1996. This implicit conversion produces a valid date and ISDATE returns 1.

Here is a link to the ISDATE documentation from Microsoft.


Watch out for this situation. Validating with ISDATE without checking the length of the date leaves a hole in the validation.



Development | SQL

Building ASP.NET Custom User Web Control

by marc walgren4. January 2013 01:00

I had an internal project that prompted for a start and end date. I also wanted to "pop-up" a calendar to make the date selection a bit easier. Since there were two date fields to enter and I didn't want to cut and paste code, I created a custom user control. (Thanks to Isaias Formicia-Serna and a CodeProject article from 2004 that got me started). 


Clicking the ellipsis bring up the calendar as pictured above. The custom control (ascx) contains all the markup for the controls. The code behind (ascx.cs) contains the page load, property and event handling code. 

A couple key tidbits.

* To access the particular properties of any control (like a text box) inside the custom control, use a public properties (setter or getter) in the custom control's code behind. 

public partial class CtlCalendar : System.Web.UI.UserControl
    #region public properties
    public string CalendarDate
            return this.tbCtlCalendarDate.Text;
            this.tbCtlCalendarDate.Text = value;


* Remember to "Register"  the custom control (ascx) in the page.

 <%@ Register TagPrefix="fbWebReports" TagName="CtlCalendar" Src="~/CtlCalendar.ascx" %>

Using the custom control is easy. Add markup for the custom control just like any standard control.

<fbWebReports:CtlCalendar ID="fbCalStartDate" runat="server" />


My source code is available for download.

CtlCalendarUserControl.zip (1.63 kb)


.NET | Development

Mitten Software Web Store Goes GOLD!

by marc walgren26. December 2012 11:30

Need a new Super Template? No problem. Find all the Super Templates by clicking on “Store”. Login to your account and use "Easy Update" to get the latest releases at update prices. Checkout and you’re on your way.




Blog | Development

Contact Us  Consulting  Web Development  Data Collection  Flexible Web Lists  Clarion Products  Downloads  How To Order  Site Map  Store  Home
Copyright (c) 1989-2013 Mitten Software Inc., All rights reserved.

Month List