Remember to brake your egg at the small end*
June 9, 2008 on 9:53 pm | In Clarion, DotNet | No CommentsSometimes the interoperability between .NET and Win32 could by a pain in the ass. Especially in places you don’t expect it to be. I’ve worked recently on a cryptography algorithm. I had the source code in Clarion and all I had to do was to implement it in C#. No problem I guessed. But… The Clarion algorithm used pointers extensively. I have worked with byte arrays. I read the text as a char array and I copied the bytes into long variables using a binary shift. Lets say we have a
string s = “abcd“;
Its something like this:
If we try to interpret this as a uint variable:
uint ui = (uint)((s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3]);
we will get something like this number 1633837924.
Lets look at this from the other side. Our string goes direct into memory:
Using Win32 compiler we want to read it to a ulong variable x from a px address. In Clarion the code to do this will look like this:
x &ulong
long px
x &= (px)
What do we get in x?
1684234849
Hmm, variable ui in C# and x in Wind32 are not the same. Why? Because Intel is using a small endian way to store the numbers. So it means that the highest byte is saved at the right side and the lowest at the left. Like this (small endian):
and not (big endian)
* In Jonathan Swift’s Gulliver’s Travels the Little Endians broke their eggs at the small end, where the Big Endians broke theirs at the large end. And the ones were not very fond of the others ;-)
Clarion 7 Beta Released
September 9, 2007 on 11:36 pm | In Clarion, DotNet | No Comments
A new version of Clarion RAD is released. It is the last Win32 version of a tool, that my company used (an in a fact still uses) for the last 10 years with great success. The next generation is Clarion.NET based on .NET Framework.
The first taste of the “wind of change” is seen it current beta version. Clarion 7 IDE is based on well known tool form our neighborhood the SharpDevelop IDE. I have my first “Hello world” app in Clarion 7 behind me and… there is really not much to say to .NET developers. It is rather buggy version. There is no application generator. Data dictionary (a kind of O/R Mapper) is read only - when it works, because on my computer it was only reporting errors. I’ll say it again Clarion without:
- app generator
- data dictionary
- template engine
has nothing to offer for .NET developers. I really wait for a RAD tool that will help my with my enterprise-data-driven-text-box-CRUD-based applications development. I wait for Clarion.NET and Clarion 7 is no good source of “first taste”.
![]()
Waiting for Clarion.NET…
July 31, 2007 on 11:12 pm | In Clarion, DotNet | No Comments… and learning Clarion 6. It’s quite interesting to switch from “normal” programming to RAD programming. Learning Clarion teaches you new meaning of the words Rapid Application Development.
Few times I heard this term in while speaking about VS. I think that it is a over interpretation. I’ll make a competition with you. We will write a database driven application simultaneously. You will do it in .NET and I will do it in Clarion (after 3 days of learning ;). Few tables in connection to one another, few browse, few forms. I’m pretty suer that I’ll beat you.
Sure Clarion is no comparison to VS in terms of developer comfort, flexibility, debugging, team work, and so on, and on, and on. But VS is no Comparison to Clarion in terms of Database driven application writing. Trust me.
PS. I’m writing tutorials about that what I’m learning. Here you have on of then. It shows how to style a single cell (or column) in clarion list box (browse) according to some condition.
Originally published at Saturday, December 16, 2006
Clarion date and time in .NET
July 31, 2007 on 11:10 pm | In Clarion, DotNet | No CommentsIn Clarion date is defined as follows:
number of days that have elapsed since December 28, 1800
Why? I think that’s when Seoftvelsocity CTO’s grandgrandma reached Florida but they say its because this date was inherited from Btrieve Record Manager. Well. Cool, but in .NET DateTime looks different. How to get a Clarion Date for a given .NET date?
public static int GetOLDate(DateTime dotNetDate)
{
CultureInfo ci = new CultureInfo("de-DE");
DateTime baseDate = DateTime.Parse("01.01.1801", ci);
System.TimeSpan ts = dotNetDate - baseDate;
int l = ts.Days + 4;
return l;
}
How does Clarion defines time?
Number of hundredths of a second that have elapsed since midnight, plus one.
How to manage this in .NET?
public static int GetOLTime(DateTime now)
{
int l = now.Hour * 360000;
l += now.Minute * 6000;
l += now.Second * 100;
l += now.Millisecond / 10;
return l + 1;
}
And another way around?
public static DateTime GetTime(int clarionTime, DateTime baseDate)
{
int lHours = Convert.ToInt32(clarionTime / 360000);
int lMinutes = Convert.ToInt32((clarionTime - (lHours * 360000)) / 6000);
int lSeconds = Convert.ToInt32((clarionTime - (lHours * 360000) - (lMinutes * 6000)) / 100);
int lMiliseconds = (clarionTime - (lHours * 360000) - (lMinutes * 6000) - (lSeconds * 100)) * 10;
DateTime then = new DateTime(baseDate.Year, baseDate.Month, baseDate.Day, lHours, lMinutes, lSeconds);
return then;
}
Hope it will help!
Originally published at Sunday, November 26, 2006
Clarion.NET close encounters
July 30, 2007 on 8:04 pm | In Clarion, DotNet | 1 CommentI’ve seen Clarion.NET in action. Well actually it was something that WILL by a Clarion.NET. But from the beginning…
There was a Clarion Developers Meeting in Cambridge last week. I was there at 27th and 28th of July 2006. I’ll skip the Clarion “Core” part, because its irrelevant for us (.NET developers). I’ll say only one thing, I thought it’s a common knowledge that when you are making a presentation, you are not supposed to read all that you have on your PowerPoint slides – the attendees are getting the whole ppts, they surely can reed ;)
I was waiting anxious for Clarion.NET presentation. I’m tired of shuffling the data in .NET manually (writing a code to manage the database connectivity, care about the relations to object mapping, and so on). I don’t see the point for developer to worry about database while writing business code (to some degree of course). In my imagination I saw a big future for a tandem: Visual Studio 2005 + Clarion.NET. You make all the boring data centric work in Clarion.NET and when you have something sophisticated to do (e.g. Web Service) you grab VS. What I saw was rather disappointing: actually all there is to Clarion.NET right now is ABC (Clarion intern language) language “compileable” to IL. Sure that’s not trivial to write new .NET language buts not that what’s make a RAD RAD. There was no presentation of application generation and data dictionary – because they are no ready yet. So Clarion.NET right now is noting more than new language for .NET Framework. I can think of a better name right now, it will by ABC.NET. Good news: the whole Clarion.NET with templates and data dictionary should by available this year – so Softvelocity CEO Robert Zaunere. Another good news: according to my CEO they are never showing their products before they are fast ready to ship. I surely hope so!
clarion.jpgLittle technical info about Clarion.NET. The IDE is taken completely from SharpDevelop. The “visual” part of SharpDevelop has not changed a lot. Actually when you create new document in Clarion.NET you get the default SharpDevelop class template. I hope that Clarion.NET will keep the extensible architecture of SharpDevelop and developers will by able to write their plug-ins. The Data Dictionary Designer wont by written in managed code and will by based on ADO.NET (no out of the box support for other O/R mapping). I haven’t seen anything about templates.
So yet a little disappointed, I’m waiting still anxious for Clarion.NET. I hope only that I won’t reach the average age of a “normal” Clarion developer (which is something about 104 years old ;) before I’ll see the Clarion.NET in action!
Originally published at Thursday, August 03, 2006
MVP Website with .NET Remoting
July 29, 2007 on 9:10 pm | In Clarion, DotNet | No CommentsI’ve written a short article about extending the MVP (Model View Presenter) with .NET Remoting. “MVP in ASP.NET with .NET Remoting” is available on CodeProject. This article is a extension of great text “Model View Presenter with ASP.NET” by Billy McCafferty. You are welcome to read and flame!
Originally published at Friday, August 11, 2006.
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^
