The ClarionMag Blog

Printer-friendly version

Get automatic notification of new items! RSS feeds are available for:

All blog entries
All new items, including blogs

 

Clarion unit testing framework on Google Code

Direct link

Posted Wednesday, December 30, 2009 by Dave Harms   

In the Dec 18 2009 ClarionLive webinar I mentioned that I'd be releasing the ClarionTest application (formerly called CTest) as open source. You can now find the code repository on Google Code at http://code.google.com/p/clariontest/. There's a downloadable zip, as well as a source code repository which you can get via SVN.

 

ClarionMag supports Wikipedia - maybe you should too

Direct link

Posted Friday, December 04, 2009 by Dave Harms   

I don't know about you, but I use Wikipedia pretty much every day. It's a huge resource, generally fairly accurate, and it's been a boon to my business and to me personally.

Periodically Wikipedia has a fundraising drive. If you'd like to kick in, as ClarionMag just did, go to the Wikipedia home page and follow the donate link.

Wikipedia is run by a non-profit organization, the Wikimedia Foundation. (BTW they've got a bunch of other interesting projects on the go, like a free media repository and a species directory.)

 

Embed series returns next week

Direct link

Posted Wednesday, October 21, 2009 by Dave Harms   

I'd really planned to have Part 2 of the new series on embeds (and why you're probably misusing them) up by now, but a lot of interesting news came out of the Aussie DevCon. In fact I've got one more article on the new template language that I think you'll find quite interesting, even if you're not a template writer.

I do expect to have Part 2 up next week, however.

 

Google. Evil

Direct link

Posted Thursday, October 01, 2009 by Dave Harms   

'Nuff said.

 

STARTing procedures by address

Direct link

Posted Tuesday, September 01, 2009 by Dave Harms   

In the SV newsgroups James Hrubes asked a question about whether it's possible to START a procedure via the procedure's name rather than its label. The short answer is no. Say you have a procedure called BrowseStudents. BrowseStudents is a label, and 'BrowseStudents' is a string, and the Clarion runtime library doesn't provide a way of translating a string to a procedure label.

In response to James' question, Maarten Veenstra posted this little gem from an unknown author. This program illustrates another approach, which is to store the ADDRESS of a procedure and then START the address instead of the label.

But there's a trick. Take a close look at the DynaStart prototype in the MAP:

   Program
include('builtins.clw')
Procs  LONG,DIM(16)

 MAP
  Main
  BrowseStudents
  BrowseTeachers
  BrowseSchools
  BrowseClassRooms
  MODULE('Clarion')
    DynaStart(LONG,LONG),LONG,PROC,NAME('Cla$START')
  END
 END

 CODE

 Procs[1] = address(BrowseStudents)
 Procs[2] = address(BrowseTeachers)
 Procs[3] = address(BrowseSchools)
 Procs[4] = address(BrowseClassRooms)
 MAIN

Main  PROCEDURE
Window WINDOW('Select Procedure'),AT(,,219,69),|
         FONT('MS Sans Serif',8,,FONT:regular,CHARSET:ANSI),|
         CENTER, GRAY
       LIST,AT(93,18,103,10),USE(?List1),VSCROLL,DROP(4),|
         FROM('BrowseStudents|BrowseTeachers|BrowseSchools|BrowseClassRooms')
       PROMPT('Select Procedure:'),AT(23,18),USE(?Prompt1)
       BUTTON('Start Selected Procedure'),AT(60,44,99,14),USE(?StartButton)
     END
     CODE
     OPEN(Window)
     SELECT(?List1,1)
     ACCEPT
     CASE FIELD()
      OF ?StartButton
       CASE EVENT()
       OF EVENT:Accepted
        DynaStart(Procs[CHOICE(?List1)],25000)

       END
     END
     END
 
BrowseStudents PROCEDURE
    CODE
     MESSAGE('Students')

BrowseTeachers PROCEDURE
   CODE
   MESSAGE('Teachers')

BrowseSchools     PROCEDURE
   CODE
   MESSAGE('Schools')


BrowseClassRooms  PROCEDURE
   CODE
   MESSAGE('ClassRooms')

You might think you could use START directly, but you can't. The libsrc\builtins.clw contains the following prototype:

 START(_PROC,UNSIGNED=0),SIGNED,PROC,NAME('Cla$START')  

And _PROC is a procedure prototype:

_PROC(),TYPE

The compiler complains if you attempt to pass an address instead of an actual procedure.

As the unknown author of that example deduced, internally START simply takes the address of a procedure. So the redeclaration of START uses LONG parameters instead, and now you can pass the address of any parameterless procedure. Presumably you could take the same approach with the other two forms of START.

It's a nifty bit of code. So who wrote it?

 

C7 Designer gets C6 compatiblity mode

Direct link

Posted Friday, May 01, 2009 by Dave Harms   

As seen in today's webinar, the next release of C7 will feature a C6 compatibility mode to retain the decidedly non-industry-standard behavior of being able to have controls that are declared inside a container control but display outside the container control. In that compability mode the designer asks if you want to move controls into/out of the parent (i.e. tab) control, as in C6.

Also of note, the Applications Pad is getting more toolbar buttons and is intended to be the primary way developers interact with APP and DCT files.

 

DevCon in 2009?

Direct link

Posted Friday, May 01, 2009 by Dave Harms   

Watching the webinar - Z just said there will definitely be a DevCon in 2009...

Now, he also said that it won't be until after there's a .NET AppGen, which he's previously indicated is 3-6 months away. I'm not sure there's quite enough time in the year for this, as to my mind a DevCon needs a good six months lead time.

UPDATE: Bob F certainly has DevCon on his mind, however. He just mentioned it again...

 

FireFox printing problems, again

Direct link

Posted Thursday, April 30, 2009 by Dave Harms   

I had another report the other day of problems with FireFix printing source code as gibberish. This has come up before in the blog, but I've come across a suggestion that creating a new profile is a cure for certain FireFox printing problems.

 

Hidden Start nixes console/batch windows (updated)

Direct link

Posted Monday, April 13, 2009 by Dave Harms   

Among other things C7 RC2 now has two Run buttons. The prevous Run functionality (which calls MSBuild first to verify all the pieces are there) is now assigned to a "play" button which has a little lightning bolt added. The plain "play" button is now a Run the Startup Project button which calls the solution's EXE without doing any checks first. I'm delighted to report that this means my previous blog post about a simple Clarion app to RUN whatever program was passed to it, along with a Tools menu option to call the app, is now irrelevant.

What I neglected to mention in that blog post is that I also considered creating a batch file to run the solution's EXE directly, but batch files pop up console windows. My Clarion solution using RUN executed the EXE transparently.

But RUN isn't the solution to every problem. For instance, Brahn Patridge discovered some problems with the maximum length of parameters accepted by the template #RUN statement which he circumvented by writing out and executing a batch file. And that resulted in the annoying console window popup. Brahn eventually found a nifty tool called Hidden Start that executes batch files and console apps without displaying a window. Hidden Start is free, although a license is required for commercial distribution. Thanks for the tip, Brahn.

UPDATE: Mark Riffey tells me that AVG flags Hidden Start as a virus. As far as I can tell this is because Hidden Start can be used to run programs without the user receiving any indication that the program is running, not because there's an actual virus. But use appropriate caution.

 

A "run-only" option for the C7 IDE

Direct link

Posted Monday, March 30, 2009 by Dave Harms   

After the latest beta (5225) release several developers asked for a Run button which would simply run the current project instead of building the application first. There is a Start without Debugger option (Ctrl-F5) but in fact this invokes an MSBuild task. Even if the EXE is already built MSBuild will verify that a recompile isn’t needed, and that can take some time on a big multi-DLL solution.

I decided to play around with the Tools menu to see if there was a way to produce a “run only” behavior, and I did find a solution. But SV has now said that a run only button will be in the next build, but in the event that you can’t wait for the next build of C7, here’s what you need to do to add your own “Run only” menu option.

It was Ben Dell who got me started on the Tools menu. He pointed out that it was possible to run customized MSBuild tasks that way. And if you can run an MSBuild task on a project, why not a task to run an EXE?

First, create a new Win32 EXE solution (not an APP - this will be a hand coded program) called, say, Launcher. Launcher.clw contains just this code:

                    PROGRAM

                    MAP
                    END

    CODE
    run(COMMAND())

Compile the code.

Next, in Tools | Options | Tools create a new external tool called something like “Run the current application”.

Set the command to your Launcher.exe

Set the arguments to "${TargetPath}" (the quotes take care of long file names, although they may not be necessary) and the working directory to ${ProjectDir}.

Now when you want to launch a program you just highlight it in the solution explorer and choose the “Run the current application” option from the Tools menu.

 

[Last 25 entries] [Last 50 entries] [All entries]

Printer-friendly version