Visual Programming

Visual programming includes DTS, all GUI and form builders, SQL query (also called query by example or QBE).

It is faster and easier, especially for forms and SQL queries with lots of joins.

1) Code off the screen holds hard to find bugs.
2) Exact positioning is a productivity killer (automatic layout tends to make a mess)

PDAs and the like

The PDA application is for keeping track of notes, phone numbers/addresses, appointments, acts as a calculator, plays games, sends and receives messages and lets you read while standing in line. I’ve experience using a motorola cell phone, a Palm IIIx, and MS Outlook.

Personal Assistents in general: They all need to synchronize to a PC, because entering the data with anything but a full sized keyboard is crazy.

PDA: Great for reading long and short texts. Palm IIIx couldn’t use as a phone. Not too bad as a calculator, but not as good as a real calculator. Usable, but not comfortable as a note taking device. Can send and receive email, but by the time the synch is done, you alread have read the email on your PC! Likewise, when sending mail, by the time you synch, you could have typed the email 10 times. Reminders kill batteries and are a nuesance. Games are okay. Real pain is losing all you data every few months when your batteries die. Synch saves most of the data but not all of it. With a lot of work you can interactively browse the web, with a bit less work you can send faxes. Doing extras eventually requires bringing along a bag of accessories that are about 5 times heavier and bulkier than the Palm IIIx itself (modem, keyboard, etc) Very fragile screen! Don’t drop it!

Cell phone: Best place for keeping phone numbers. Barely usable as a calculator. Email & web is something of a joke, at least on my old Motorola. Reading anything beyond a few news articles is painful. Searching the web is almost possible using numeric google, but sometimes google make really bad guesses about what you are searching for in WAP-space. My phone didn’t have any games worth playing. Seems pretty sturdy, but I haven’t dropped it very many times.

MS-Outlook: Why bother put notes here? Use MS Word. Appointments are good for reminders. Good for email, but email doesn’t have good search capabilities. Not best place for contact info because it isn’t portable and gee wiz, you can use internet phone books to find numbers and addresses & you don’t have to do the data entry. On the otherhand, if you can synch to a PDA, do your data entry in MS-Outlook. Sort of portable if your company has a web-interface set up for Outlook.

W3 Standards

If you want to use XML & XHTML forms you will need to know:

The XML standard– XML repurposes & cleans up HTML so it can be use for arbitrary knowledge domains. No prerequisites, but to use it well, you need to set up DTDs & Schemas.
XML Schema standard– Defines what a document should look like and what the data types are.
The XSLT standard– Allows you to transform XML into different XML or into non-XML like fixed width files or HTML. Requires knowing the XPath standard
XPath standard– This is like SQL WHERE clauses, except for the data is in XML. Takes getting used to because unlike SQL WHERE clauses, the data being queried is heirarchial.
The XHTML standard– This is the set of rules to be applied to a HTML standard document so that it is tidy enough to be used as XML. It requires knowing HTML4.01
HTML4.01– This standard is huge– 380+ pages.

XSL Pains

Usually you want to format either the text inside of a set of elements or the value of an attribute in a set of elements (usually a repeating element). This poses two problems, what is the best way to identify the the set of elements and what indicates which values you want.

  1. To get the data, try : value-of select="." or try value-of select="text()" or for an attribute you use value-of select="@attributename"
    I haven’t figured out how to get the data inside an attribute value that was indicated by the XPath expression (the way value-of select=”.” works)

  2. To point at the data you want use an XPath express. First try just the bare tag name template match="myTag"
    If that doesn’t work, try absolute naming template match="/root/row/myTag"
    If that doesn’t work try relative naming, template match="row/myTag"
    If that doesn’t work try wildcard naming, template match="row/*"

  3. For some reason, I can’t get /@* to work. (Gee that expression kinda looks like a comic book curseword)

SQL Server & XML Forms

If you are in a hurry and can’t build heavyweight rich user interface forms, (like VB6.0 forms) then you can uses a combination of XSL, XHMTL, and update grams.

Tricky parts:

  1. Set up the virtual directories per BOL. Try :

    .../myVirtualDirectory?sql=SELECT * FROM myTable&root=sometagname

    If your leave out the root part, you won’t get a valid XML document back.

  2. To get the xml back transformed, you have to put it in a ‘updategram’ with the following in the root tag:

    xmlns:sql='urn:schemas-microsoft-com:xml-sql'
    sql:xsl='myStyleSheet.xsl'

  3. You have to put call your update grams like this:
    myupdategram.xml?contenttype=text/html
    If you don’t the browser ignores the META tag & treats the document as XML.

  4. The XML document you get back from a successful update is blank. If not, you get a processing instruction- which is hard to transform into a pretty XHTML document. This kind of match will show the error message, but not clean it up.

    <xsl:template match='processing-instruction()'>
    <xsl:value-of select="."/>

More Thoughts on Using XML

One use for XML is for config files– but they are plaintext and thus a bad place to put passwords. The XML file can be encrypted, but I have discovered, config files are useful because they are easy to edit (as compared to registry, which has the world’s scaries warnings, or DB which require a SQL statement to update). Encrypting the file makes them a real pain to edit. Create two config files, encrypt the one with passwords, put everything else into the other config file.

XML Things I’ve learned

  1. If you are using an XML api, no problem, you’re XML documents will be valid.
  2. If you are using string concatenation, you’ll hit these problems: XML data needs to be escaped for the & MS Access has a XML import which works nicely, but it will look like the ‘tables’ it finds in your XML file are not available for import because they are greyed out. This is actually means they are available for import, but you have to import all of them or none of them and you can’t pick and choose
  3. MS Excel will open XML files, but it picks rather awful column names, made up of the full path (\\root\myxml\mytag) MS Access will use just the tag name for a column name. Access preserves the white space from CDATA stuff.
  4. Creating a fixed width XML layout requires: a two line header, a one line footer and alternating columns holding constants that could be tricky for the other programmer to fill in. Also, one must assume that the other programmer is using unescaped ASCII. For example:
    (This looks weird because I’m too lazy to manually escape my greater thans and less thans for blogger to display them correctly)

    ^?xml version=”1.0″^
    ^table^
    ^row^^col1^^![[CDATA ]]^^/col1^^col2^^![[CDATA ]]^^/col2^^/row^
    ^row^^col1^^![[CDATA ]]^^/col1^^col2^^![[CDATA ]]^^/col2^^/row^
    ^/table^

    From this we can see that the XML file can be created by concatinating

    tag + data + tag + data, etc.

    The programmer creating the interface file need not give up the beloved fixed with layout and need only include some cryptic & variable separators inbetween the data.

Using Jbuilder to Make a Swing GUI

Here are some random observations:

Applicable to All Java Forms

  1. Rename your objects, not doing so makes the code unreadable and you will need to be able to read the code.
  2. A typical pattern is to have an Border layout, with the title or button in the north, a status bar, instructions or buttons in the south and a nested panel in the center that holds the fields with labels.
  3. Add borders to your components while designing
  4. Start with absolute positioning and convert it to GridBag.
  5. Keep a big reference manual handy for looking up specifics, like which events you need to hook to get a pop up to show.
  6. Applets don’t resize, their size is set by the APPLET tag. Resizing is a key feature of a Java Swing form, it allows you to put the same form on monitors of different resolutions. Get around this limitation by creating a launch button in the applet, and on the click event handler, open a new frame. Put all the UI into that new frame.

Jbuilder Specific

  1. You will have to edit the source code from time to time, JBuilder can’t always guess which panel you want a control to go to.
  2. Sometimes, Jbuilder fails to add a panel to the UI, but leaves the code. You have to do a panelX.add(myNestedPanel) command to get it back on the designer.
  3. For an applet I was working on I had to manually add my menu bar to the code with this.setJMenuBar(myMenuBar)

Beating my head against CVS

CVSNT – seems like it needs to be configured, no UI to do so.
winCVS – This is a user interface? More like a bunch of unintelligible menu selections

pushOK plug in for VB6.0 — Ah, this is more like it. However, you have to hack a .ini file & register a MS dll in the Visual Studio folders to get the SCC plug in to show up. The plug in showed up right away in the Visual Interdev environment. Still, it failed to reload one of my projects after I put into a repository. So far it looks like it would be good for putting code into and getting it out of the repository, for other tasks, looks like I still need to learn to use winCVS or the like.

Getting MS Explorer to Swing

I want to write an application that uses the Swing library and runs on any MS Explorer machine, without the client installing extra software or changing evironment variables, or spending a day dowloanding.

Here is what I’ve learned:

1) People complain about Swing, for being big & slow, but it has more features & better looks than VB forms. The other UI for java include: HTML, AWT, commercial & free non-Sun component libraries, & command line. For my main goal right now (showing off), these other options don’t measure up.
2) Mozilla 1.0 requires a manual file copy to get the Java plug-in to work
3) MSIE can do Swing if you unjar the file swingall.jar, but loading it from local on a fast machine takes a while. Also, you get a lot of security access errors as the swing form tries to figure out what kind of machine it is one (for plugable look and feel)
4) JBuilder has to be set to build for all VMs to get an applet that MSIE can open.
5) MSIE doesn’t seem to be able to open a jar archive without special software, although for some reason creating a CLASSPATH environment variable pointing to the swingall.jar file seems to work. (So a jar is OK if it local, bad if you download it? I don’t understand.)
6) Using jarg on javaswing reduces it from 2.2MB to 1.6MB, which is not much of an improvement & the applet gets a little broken in the shrinking process.
7) Putting java files into a jar is easier if you don’t use a manifest file & just use : jar cvf newjar.jar *
You execute this command in the root of all your classes & packages that you want in the jar.
8) Packages and jars are headaches, don’t try to include them in your build process if you are still learning. The errors caused by package and jar problems look a lot like other problems (namely they all give Class not found errors)
9) MSIE (using VM5) sometimes crashes the entire computer, I’m not sure if it was Swing related.
10) Command line programs should be run using lots of 1 line .bat files. Some applications have such complicated switch syntax it is like writting a mini program.
11) Downloading a .jar application and running it is fairly easy, two files often will suffice (the jar file & a batch file with
ava -jar myapp.jar
12)