Home Contact Site Map Privacy Policy Rev Search
Volume 1 Issue 9
 

Up
Volume 1 Issue 1
Volume 1 Issue 2
Volume 1 Issue 3
Volume 1 Issue 4
Volume 1 Issue 5
Volume 1 Issue 6
Volume 1 Issue 7
Volume 1 Issue 8
Volume 1 Issue 9
Volume 1 Issue 10
Volume 2 Issue 1
Volume 2 Issue 2
Volume 2 Issue 3
Volume 2 Issue 4
Volume 2 Issue 5
Volume 2 Issue 6
Volume 2 Issue 7
Volume 3 Issue 1
Volume 3 Issue 2
Volume 3 Issue 3
Volume 4 Issue 1
Volume 4 Issue 2
Volume 4 Issue 3
Volume 4 Issue 4


 

 

 S/ENL - The Sprezzatura Electronic Newsletter

(All the RevSoft News That's Fit To Print (And bits that probably aren't as well...))

Contents

Welcome

Ramblings

FEEDBACK

MYKL'S JOKE SECTION

IT'S THAT MAN AGAIN - AARON P KAPLAN

CELEBRITY INTERVIEW - Oystein Reigem

MISCELLANEOUS OI TIPS - ANDREW P MCAULEY

ERIC THE EMU'S AREV SCRIPTS

Peripheral Trivia

19th August 1997

S/ENL Volume 1 Issue 9

Welcome

Just a note of thanks to all of you who emailed us with condolences after the recent tragic death of Princess Diana. Any death diminishes us all in some way and she will be missed by our country. The press are being terribly hypocritical about the whole thing though. Anyhow I won’t go on as I know that it remains a sensitive subject to many.

Stress has been getting to us at Sprezz House, so we've been lightening the day (well that's the excuse) by being terribly literal with each other. Kate is the worst culprit ("Kate, can you update the web page with this link?", "Yes" - long pause. "Ok, Kate, WILL you", "Oh, OK") followed closely by me. I blame my mother - I remember at an early age she insisted I turn off the radio as the song I was listening to was disgusting (Julie Covington singing "Only women bleed"). So if you call I'd suggest asking "May you speak" with whoever it is you want as Kate will probably take "Can" literally... <g>

Got a letter from Susan Lockhart the other day who works at Nasa with AREV. Seems that she is moving to a new job in Miami. She said "Tell everyone hello from sunny, humid, overly-hot, Dante-esqe Florida!". Now it may well be that she meant everyone in the office but hey, as I said we're all in literal mode here... <g>. It was always fun talking to Susan when she was actually at Nasa, there'd be this horrific noise in the background and you'd say "what's that" and she'd say "Oh, it's just another of those shuttles taking off... <g>". Incidentally did you see the video footage of the British guys who saved up to go watch an actual shuttle launch and left the camera pointing at the wrong shuttle until several seconds after take-off when they realised their mistake? Laugh? I nearly found Mr Bean funny.

Excitement mounts with the forthcoming Revelation Software conference. I'm delighted to have been asked to speak on recent network products and recent software releases. Discarded titles include "OpenInsight Works - a needle, flame and spoon", "OpenInsight Works - Elvis seen at local chip shop" etc etc etc. Trouble is, it really does! We have never been so productive with RevSoft product. Thanks to those at Revsoft who keep making our lives easier! We've spent hours trying to work out what'd be a suitable Sprezz giveaway for the delegates. I think the suggestion that a corkscrew was suitable was slanted at my drinking habits personally... We've come up with something though which hopefully will arrive in time for the conference - which, remember is on the 30th September in central London.

The artwork for the Sweatshirts is now with the manufacturers so by next issue those promised should have had them!

Finally a blatant plug for a very helpful travel person! We've been having to get flights to the UK recently and found that by far the cheapest flights and friendliest service came from a lady Marlene Strausberg in New York. If you've got travel requirements give her an email on marlenes@tzell.com or call her on 212 944 2121.

Andrew P McAuley
Publisher

[top]

Ramblings

The MAJOR news of this issue is that we have just setup Sprezzatura Inc in the US! We've been thinking about this for quite some time, and decided that now was the time to act! We're VERY pleased to say that Aaron Kaplan is permanently on staff and that we will be expanding organically over the next twelve months! We can now offer training, consultancy and tech support on either a contract basis, or pay per call - all major credit cards accepted (and sorry, no, we don't call Amex or Diners major).

We're setting up in Philadelphia (city of dodgy cream cheese) at offices in Market Street. We're just finalising the details of incorporation and then we'll post details of our 'phone numbers and address on our web site.

In other news, Mike Ruane has left Phoenix Solutions to go it alone. Mike is the author of PSL - distributed on the last Works CD. His company is called Win Win Solutions and their Web Page can we found at www.winwinsol.com .

Incidentally, a big thank you to Mike who points out an error in our Technical Bulletin # 1. We documented position 31 of all controls as being unused, when in fact it is the "Required" indicator. Thanks Mike, a sweatshirt on the way just as soon as we get them!

We've been sending out a teaser doc to a few clients recently showing them screen dumps of the sort of systems Sprezz have been doing of late. You see we genuinely believe that we are producing some of the nicest looking OI software in the world. Seems one of the recipients agreed - they wrote back

"Just wanted to say thanx for the screen shots. I showed it to a couple of our developers and got some raised eyebrows. I assume these are addon tools to OI from Sprezz?"

Now that the UseNet Newsgroup is well and truly established (albeit with a low turnover at the moment), several of you have asked how to actually use it! Rather than reinvent the wheel we'd just like to point you at http://www.webmonkey.com/nl.cgi/webmonkey/web101/ .

Trouble is if they change the subject that won’t be much use!

On that point Cameron Purdy points out that if your provider doesn't get it you can always use DejaNews!

Regards
Andrew McAuley
Publisher

[top]

FEEDBACK

The last Eric the Emu column created one piece of negative feedback, saying that the article was blatantly offensive. We always try to respect the sensibilities of our readers, and whilst not finding it so ourselves we thought we'd better canvass your opinions on this!

Without canvassing at about the same time another of you wrote "Hey, I really enjoyed reading the SENL. I especially like Eric'sadditions and the bit on Delphi with OI Engine."

So let us know what you think! (Just to put our view - we love him...)

Someone going by the name of Slinky had this to say about the last issue

"Have just flicked through the latest SENiLe and I couldn't help noticing APK's gloat about the amount of US crap on our tv screens. It is not, as he imagines, because we all like it but because it is cheap and affordable and the no budget stations we have can get it by the bucket load instead of spending the amount on one decent home grown product.

Just had to mention it!"

Introducing the new concept of "Right of Reply" <g> APK has this to say in response

"Dear Slinky,

While I was being served with some excellent examples of British fare, my goode neighbors to the east are still enamoured by our provincial culture. My friends over at the ER are crackers about many of our offerings and some even get butterflies at the anticipation of current offerings and head to the manor, born anew with excitement at season premiers. Still, one must zig and zag across holleyoaks and Coronation Streets to find an evening where US offerings are not touted with the veracity and brimstone of a new statesman.

Sometimes, the truth hurts.

(Sometimes obscure British TV references are lost on non-British viewers - Ed)

However, for you American readers, be sure to check out

http://www.eskimo.com/~rkj/brit.htm for an open insight into what the partially United Kingdom has on offer.

For those of you that do decide to peruse this site, in all fairness, there is something about British television you should know. They don't work on a 'yearly season' like we do in the US. Many of their shows are limited runs of 6-10 weeks. If the show is successful, it might come back for another run later. That's why it seems that so many of the shows on the list had such limited runs. It's just the way it works and does not imply they were all cancelled quickly.

I try to be fair Slinky, not impartial, but fair. Still, I must add that if people didn't want to watch, they wouldn't be on. So, if you'll excuse me, Nick at Night is showing a marathon of Blansky's Beauties and My Mother The Car and I must set up the VCR."

Bob Watson writes

"I did not receive SENL 8 via compuserve. What’s more its never been reliable anyway. Perhaps you could put it on your web site. Then I'm sure to get it!"

Only too happy to oblige Bob - SENL is now also available for download from our web site just as soon as we publish - check out

www.sprezzatura.com\senl

Someone who shall rename nameless mailed us the following:

"Your TB # v1 looks suspiciously like a document I have in my hand titled' OpenInsight Window (OIWIN) Structure Definition Version 2.0 December 13 1993 Breanna Anderson'.

However, yours is, as always, better.

Where do I send the $80.00?"

Well we deny all knowledge of the other doc - we've never even heard of it! Just the results of a month's hard hacking! But thanks for the praise!

Another query from the 'states

"hi, do you offer general OpenInsight support contracts, or how much per question?"

Well a simple answer - YES! Like lawyers we make money from time so we charge by time. (Unlike lawyers - insert your favourite anti-lawyer joke here) We do offer fixed price contracts to those who really need them (for budgetary purposes) but we always weight them so we don't use more time than you've paid for. You're far better off purchasing chunks of support units! You can get details of our rates at www.Sprezzatura.com\tecsuprt.htm . And the best news? No result no charge!

We're already signing up US clients and with the opening of the US office we expect to be able to offer an even better service.

Richard Bright from New Zealand writes

"BTW the item on Window.Common most interesting - as is all the rest!". Unfortunately no-one has followed up on our request to look closer and let us know the results - perhaps we'll get the time ourselves soon - 2 major client deliverables ship in a couple of weeks... saying that, why I am I sitting typing this when I should be working <g>.

[top]

MYKL'S JOKE SECTION

Three Apple engineers and three Microsoft employees are traveling by train to a conference. At the station, the three Microsoft employees each buy tickets and watch as the three Apple engineers buy only a single ticket.

"How are three people going to travel on only one ticket?' asks a Microsoft employee. "Watch and you'll see," answers the Appleengineer.

They all board the train. The Microsoft employees take their respective seats but all three Apple engineers cram into a restroom and close the door behind them.

Shortly after the train has departed, the conductor comes around collecting tickets. He knocks on the restroom door and says, "ticket, please." The door opens just a crack and a single arm emerges with a ticket in hand. The conductor takes it and moves on.

The Microsoft employees saw this and agreed it was quite a clever idea.

So after the conference, the Microsoft employees decide to copy the Apple engineers on the return trip and save some money (being clever with money, and all that). When they get to the station, they buy a single ticket for the return trip. To their astonishment, the Apple engineers don't buy a ticket at all.

"How are you going to travel without a ticket says one perplexed Microsoft employee.

"Watch and you'll see," answers an Apple engineer.

When they board the train the three Microsoft employees cram into a restroom and the three Apple engineers cram into another one nearby.

The train departs. Shortly afterward, one of the Apple engineers leaves his restroom and walks over to the restroom where the Microsoft employees are hiding.

He knocks on the door and says, "Ticket, please..."

[top]

IT'S THAT MAN AGAIN - AARON P KAPLAN

Notes from back home

Amazingly enough, I actually made it back to Philadelphia. Much to my surprise however, I found that nothing much had changed. There were a few things. The old Sears building, having since been destroyed, now has a new shopping center there. Coming up from the Boulevard it looks so strange to see just the smokestack there and not the rest of the sprawling complex.

The entire Boulevard is under much needed construction so the road has been newly paved and new curbs have been placed. They really did a number at the Levick St. intersection though which I found odd, but I'm sure I'll get used to the new traffic pattern as time goes on.

The house looked almost like I remembered it, except my boarder didn't mow the curb side strip of grass, so it looked like a jungle. Some of the weeds growing there had trunks so my traditional weed wacking of the lawn required a little help from Lewis and Clark.

 

My carpets were a mess, with my cat deciding to fall ill during my basically 18 month absence from his life. However, all is well with him now, considering they ran every test under the sun on him, but he has diabetes so it's needles for him twice a day. And to think, I don't really like cats very much.

On a personal note, I arrived home to find my divorce decree in the mailbox. My ex, in a traditional celebratory note, decided to honor the experience by filing a restraining order keeping me 100 yards away from her home. It's only a problem in that I live 90 feet away from her. And to think, all this because I offered to drive her to work.

So, as we can see, some things change, some things don't. Personal habits are hard to change, life style is possible, marital status is easy, provided you have the right lawyer.

However, it seems the hardest thing to change is the key on an OpenInsight form.

Save-As seems to be one of the more elusive topics and objectives of OpenInsight developers. Many people have implemented various ways to do what should be a simple task, building all sorts of hoops and circles just to accomplish the task.

But, the good folks at Sprezzatura are once again living up to our names by opening up the treasure trove of goodies showing you one of the most elusive tricks in our arsenal; how to implement Save-As logic.

Save-As programs in OpenInsight generally fall over because the nature of OpenInsight's database logic. Many experienced developers, especially those that came from Advanced Revelation, assume that OpenInsight works on a record based structure, just like Advanced Revelation does. Nothing could be further from the truth. Actually, that's not quite true.

If I were to mention that giant grasshoppers have just eaten my trousers or that the hair thieves name in the middle of the night and stole my hair, that would be further from the truth.

OpenInsight forms are implemented on a field by field logic. Each time you read and write a record/row you are actually reading and writing a collection of fields. For all of this to make sense, you have to change the way you look at OpenInsight. I might suggest standing on your hands, closing one eye and peering through the bottom of a Coke bottle. A real Coke bottle though, you know, one of those really old glass ones you need a bottle opener to open and comes in the returnable bottle? Hey, you can still get them, if you know where to look.

I've probably mentioned this before, and I know I'll mention it again, OpenInsight is actually a bundle of two very integrated products. For the purposes of this discussion, we'll call them Presentation Server (PS) and OpenEngine (OE). Just so you know, their real names are Sting and the product formerly known as ARev for OS/2.

OE has one purpose, interpreting opcodes. I won't go into a long boring discussion of what an opcode is, just a short boring discussion. Opcodes are what your source code compiles down to.

OpenEngine then takes those opcodes and executes them, so that X does equal 1 and that you can loop until theCowsComeHome or anything else you might enter into code. This is all it does. It runs all Basic+ scripts processed by the system.

PS is what you see. It's what runs with MS Windows. It paints screens, it process user requests, mouse clicks, windows events and everything else. When you press F9 from a form, PS tells OE to run the save event. OE asks PS for the contents of the form. OE writes the record to the correct spots, optionally clears the form, and returns control back to PS. OE then sits there until it's needed again.

It's obviously more complex than this. The Basic+ programs/scripts OE runs can be split into two primary portions, PS-centric and OE-centric. A PS-Centric script is a script whose primary purpose is operating under PS control. GET_PROPERTY is PS-Centric. An OE-centric script is one whose primary purposes are dealing with the filing system or anything unrelated to the user interface.

CLEAR_TABLE and REDUCE are examples of OE-Centric scripts.

So, what does all this have to do with Save-As logic? PS, unlike OE, treats everything as fields. Each field is mapped to a control. When you read a record, the information is mapped to specific fields, then each control is updated. When you write a record, you update a rowmap from each control then write the record.

In actuality, the rowmap is compared with the rowmap created when the record was read for changes and is then updated. This is why you can't just set @RECORD<34> for hidden information, you must have an invisible field. What our Save-As program does is update this information for you to allow the new row to be properly written.

Submitted for your approval-Exhibit A - for inclusion as a "Save As" menu event.

$insert msg_equates
$insert ps_equates
$insert logical
$insert oiwin_equates
declare function msg, send_event
winId = ctrlEntId[1,'.']
$insert oiwin_comm_init
*Determine the key controls
keyCount = count( keyMap@, @FM) + ( keyMap@ <> NULL$)
keyControls = NULL$
for keyNbr = 1 to keyCount
keyControls := keyMap@<keyNbr,1> : @RM
next keyNbr
keyControls[-1,1] = NULL$
oldKey = get_property( keyControls, 'DEFPROP')
if oldKey[-1,1] = @RM then
oldKey[-1,1] = NULL$
end
convert @RM to '*' in oldKey
locate keyMap@<1,1> in controlMap@ using @fm setting pos else
return 0
end
tableName = controlSemantics@ <pos, CS_TABLE$>
open tableName to hTableName else
return 0
end
 
msgRec = 'Enter the new ID'
msgRec<MTYPE$> = 'R'
newKey = msg( winId, msgRec)
 
read OrigResultRow@ from hTableName, oldKey then
write OrigResultRow@ on hTableName, newKey else null
end
 
unLock hTableName, oldKey else
return 0
end
lock hTableName, newKey else
return 0
end
rowLocks@ = newKey
convert '*' to @FM in newKey
OrigResultRow@ = newKey : @FM : OrigResultRow@
convert @FM to @RM in newKey
properties = str( 'DEFPROP' : @RM, keyCount)
properties[-1,1] = ''
unUsed = set_property( keyControls, properties, newKey)
unUsed = send_event( winId, PSEVENT_WRITE$)
RETURN 0

[top]

CELEBRITY INTERVIEW - Oystein Reigem

> Who are you? (Name, married, single, male, age etc etc)

I'm a guy that couldn't resist the questionnaire that arrived in the mail shouting "Yo dude!" and continued with "Hundreds of people would just love to know!" My name is Oystein (O-with-a-slash-ystein, to be precise) Reigem. I'm 43 years old. I'm living with my wife Elin, my three children (Torstein, boy, 12; Ingrid, girl, 10; Askjell, boy, 3), a cat (unnamed young male) and a Tamagotchi.

> Who do you work for?

I work for the Norwegian Computing Centre for the Humanities (NCCH) at the University of Bergen. The NCCH does research and helps researchers with their computing problems. What we (I and my colleague Per) primarily use RevSoft products for, however, is a database system forinstitutions outside the University - e.g, museums of cultural and social history and institutions with historical photo collections.

> What is your role in the RevSoft community? (Eg, UK Sales Manager for RevSoft, Authorised Trainer, End User etc)

I'm a developer/programmer.

> How long have you been involved with RevSoft?

Since early '92, I think.

> Which products do you use?

Until recently we've used OI 2.61. We switched to OIWG 3.3 in May/June. We will probably skip 3.4 and go directly to 3.5 when that is out.

In the beginning we used Arev, of course, and we still have customers who run Dos versions of our programs. We still support those, but we don't develop in Arev anymore.

> What do you most like about RevSoft products?

Ummm... ehhh... the nice spiral-shaped OpenInsight icon, perhaps? Hahahaha! I like multivalues because one can make simple and compact database structures.

It seems you get much for free so most of the time it's easy to develop something. And also there is a community of developers that care about each other. <sniff>

And I really look forward to a new Java-based product with Unicode.

> What do you most dislike about RevSoft products?

If I got this question a couple of years ago I'd cry "Edit tables! Edit tables! Edit tables!" Now I mostly try to leave them alone.

Even if I love multivalues I hate them too because they make your database structure incompatible with the rest of the world. LH is not very compatible either.

RevSoft products are not as up-to-date as many others. We probably wasted a lot of time trying to make our own Web "interface".

The Reporter never delivered. We couldn't afford to wait so we had to make our own report generator (with OIPI; bless you, Tony Splaver).

RevSoft products are not so well integrated with Windows and compatible with Windows standards.

International characters are a problem. And the delimiters.

> If you HAD to use another database what would it be and why?

I don't know enough about the competition to tell. I've tried Delphi some and liked it a lot, but have no opinions on the choice of engine.

> What are your favourite 3 books and why?

Favourite books I can come up with but why do I need to answer "why"?

These are some of my favourite books and I like them for their inventiveness:

Italo Calvino: "Cosmicomics";

Flann O'Brien: "The Third Policeman"

Mervyn Peake: "Gormenghast".

"Cosmicomics" is a very playful, poetic, entertaining, inventive and surreal book about man, the universe and all questions eternal. It's very good to have in your pocket when you stare into the abyss.

"The Third Policeman" contains shrewd observation of human nature and an hilarious and absurd plot. (E.g, you learn about the "molecular theory" where the molecules of bicycles and their riders on bumpy Irish country roads switch places, making bicycles half human and vice versa.) And it's got a silently deadly ending.

"Gormenghast" is gothic but very different.

While writing I realise there are no women writers among my chosen three. That is totally by accident. So if I could answer again I might very well come up with Astrid Lindgren (e.g "Pippi Longstocking"), Tove Janson (the "Moomin" books) and Ursula LeGuin ("Earthsea") instead.

(Reading over my shoulder my wife snorts and chides me for not haven't read any fiction at all for more than ten years. She is right of course.)

> What are your favourite 3 comic books?

Now I feel very smart making up my own questions and even leaving out the problematic "why".

But to answer the question - Moebius: The "John Difool" series (and everything else by Moebius as well); The Hernandez brothers: "Love and Rockets" (at least the first few albums). "Pixy" by somebody I forgot (Anderson somebody???), but it's still very good - an absurd rollercoaster ride through life and death, and then some.

> What are your favourite 3 CDs/Albums and why?

Again I was tempted to make up my own question, or rather tweak the existing one ("What are your favourite 333 CDs/Albums"), because I have so many records (9.5 meters of vinyl and 3 meters of CDs, I think) that choosing just three is difficult. But I'll try.

I'm not much for nostalgia when it comes to music so I'll skip Beatles, Beefheart, Zappa/Mothers of Invention and soforth in favour of later stuff. Much of what I've listened to lately is "drum'n'bass" - a British invention that's spent a few years underground but now's becoming more popular. (In Britain that is. In the States you haven't even discovered techno yet, even if it was invented in Detroit.)

Drum'n'bass (also sometimes called "jungle") comes in many flavours, and a good example of the "dark" kind is "Torque" by Ed Rush/Trace/Nico/Fierce. This music is very futuristic, relentless and ...eh... dark, but there's definitely a human element to it as well. And it just flows. In my ears, that is. (To you it might just be noise.)

A different example of d'n'b is A Guy Called Gerald's eponymous album. It's a few years old now, but keeps well. It has some very beautiful melodies and bittersweet chord progressions.

Hey, why don't I just rename this question to "What are your favourite 3 drum'n'bass CDs/Albums and why?" and make the last of my favourites Omni Trio's "The Deepest Cut", a collection of singles also a couple of years old. With this album Omni Trio's managed to combine the commercial and experimental in a very satisfying way.

I like drum'n'bass because it's a music with several levels or layers. On the top a fast breakbeat (i.e rhythms with their roots in hip-hop) races and skids along, while underneath there may be all kinds of slow and half-slow tunes, bass-lines, riffs, weird samples that coil and twist and pound. And there may be diva vocals. And rapping. And soundtracks for imaginary films. It's great.

> What are your three favourite films and why?

I've probably used up my allotted kilobytes by now, so I'll try to be brief: "The Fifth Element", "Diva" and "Metropolis". Why? They are epic films with very good visuals and (again) several layers. E.g, "Diva" is at the same time a thriller, a love story, a film about music, etc.

> What event in history would you most like to have been present at?

What's history? Can I choose prehistoric events as well? If so, I'd like to be present at the creation of the universe, a.k.a the Big Bang. Or rather a little bit before to see where everything came from!

> Who is the best president/prime minister we never had and why?

I really don't know but I asked my daughter last night when I put her to bed what she thought. She said *she* would like to be a prime minister. I think I'll decide on her as my candidate.

> And finally Your motto/witty aphorism

None. Which is not very witty, I'm afraid.

> Thanks for your help! We look forward to your response!

Really?

[top]

MISCELLANEOUS OI TIPS - ANDREW P MCAULEY

We recently experienced some VERY weird results whilst testing the new version of SLIST. Row Ids were being returned blank from a readnext loop and strange corruptions were resulting. We eventually tracked it down to doing a readnext with a yield within the loop.

One of our friendly local neighbourhood RevSoft gurus (if you count several thousand miles as local - it's a small world - but I'd hate to have to paint it) came up with the goods as ever. When you yield you have no way of knowing what the system might be up to. So to be safe, save off your select with push.select and restore it afterwards with pop.select. Whilst you're at it, save off @Id, @Dict and @Record as well. We actually found that in practice the error went away just saving off one variable but we'd still recommend the full monty. (Apparently its a very funny film).

Sprezzatura have been increasingly involved in the production of Multimedia CD Rom catalogues using OpenInsight and we've been having to integrate multimedia into the repository. The problem we had was that when we EXECUTEd an AVI, the MPLAYER window opened but the video didn't play until the user clicked the play button.

This was obviously not what we wanted so a quick browse of the MSDN was called for. There we found what we wanted, two underdocumented command line switches for MPLAYER.EXE namely

/play to play the video immediately

/close to close MPLAYER after the video has finished.

So all that is required is to replace the repository entry subkey as follows - instead of

Multim\building.avi

we now use

/play /close Multim\building.avi

note that the switches come BEFORE the file name not after.

While we're doing a "Shrink Wrapped Software 101" we may as well visit the storing of parameter defaults used by your application. In Windows this is normally done with .ini files (check out oinsight.ini for an example of this). Of course in Windows 95 it can be done with ini files but 32 bit apps use the Registry instead. We'll leave that alone for the moment and just get on with discussing ini files!

The Windows API provides two functions to make this possible, GetPrivateProfileString to yes, you've guessed it, get strings out of an application's ini file, and WritePrivateProfileString to put them back. Nice to see that consistency didn't bother the original Windows programmers, I mean, you read and write or get and set but...

Normally when you deal with API calls you need to go to the trouble of declaring them in Sysprocs and running Declare_FCNS, but as those terribly nice RevSoft guys use these functions themselves, the work has been done for you.

GetPrivateProfileString takes six parameters, we'll ignore the names given in Microsoft's Knowledge Base article (Q75639) 'cos they're confusing, so we'll use our own. So the parameters are

lpszSection - the identifying bit in the ini file, say [SPREZZ]

lpszEntry - the value to look for, say "Play video at startup"

lpszDefault - what to set the return buffer to if Windows can't

find the entry

lpszReturnBuffer - what the lpszEntry is set to, say "Yes"

cbReturnBuffer - the length of the return buffer (this sort of stuff

makes me really glad I work with OI, I mean like it can't work it out)

lpszFileName - the name of the ini file, say OINSIGHT.INI, but whatever you do, don't give it a path. If it can't find it in the directory you're in it'll check Windows

Now remember, strings in Windows have to be char zero terminated to save Windows having to keep track of string lengths so we'll have to remember to put them on the end of our strings. Oh yes, and Windows will insist that the Return Buffer is preallocated - wouldn't do for it to do it for you know, it'd make you lazy. So to find out if we're actually meant to play the video at login we'd do the following

Declare Function GetPrivateProfileString
lpszSection = "NBAT" : \00\
lpszEntry
= "Play video at startup" : \00\
lpszDefault
= "Yes" : \00\
lpszReturnBuffer
= Str(\00\, 4) ; * three for "Yes" one for the
* terminating zero
cbReturnBuffer = 4
lpszFilename = "NBAT.INI" : \00\
Valid = GetPrivateProfileString(lpszSection, lpszEntry,
lpszDefault, lpszReturnBuffer,
cbReturnBuffer
, lpszFileName)
/*

And finally some really like gnarly code man, just so I can store nice words in my ini rather than cryptic numbers (sounds like something you use to stop bleeding after shaving)

*/

Video = (Trim(lpszReturnBuffer[1, \00\]) = "Yes")

There now, painless wasn't it? In fact so painless that you'll probably be surprised to find out that WritePrivateProfileString is even easier to use! It only takes four parameters as follows

lpszSection - as above

lpszEntry - as above

lpszBuffer - what to write

lpszFileName - as above

So our code to update the ini would be

lpszSection = "NBAT" : \00\
lpszEntry = "Play video at startup" : \00\
lpszBuffer = If Video Then "Yes" Else "No"
lpszBuffer := \00\
lpszFilename = "NBAT.INI" : \00\
Valid = WritePrivateProfileString(lpszSection, lpszEntry,
lpszBuffer, lpszFileName)

and they told you Windows programming was hard!

RevSoft point out that there is another declaration for GetPrivateProfileString called GetPrivateProfileSection which maps to GetPrivateProfileString but allows a null pointer to be passed:

They've kindly supplied the following to illustrate

---
declare subroutine GetPrivateProfileSection, GetPrivateProfileString
equ INI_FILE$ to "win.ini": \00\
equ PRN_SECTION$ to "devices": \00\
equ DFT_SECTION$ to "windows": \00\
equ DFT_KEY$ to "device" : \00\
equ MAX_SIZE$ to 4096
 
* get list of installed printer types
Models = str(\00\, MAX_SIZE$)
GetPrivateProfileSection(PRN_SECTION$, 0, \00\, Models, len(Models),
INI_FILE$)
convert \0020\ to \2000\ in Models
Models = trimb(Models)
convert \0020\ to \20FE\ in Models
* get the list of installed printers
cModels = count(Models, @fm) + (Models # "")
Printers = ""
for iModel = 1 to cModels
Printer = str(\00\, MAX_SIZE$)
GetPrivateProfileString(PRN_SECTION$, Models<iModel>: \00\, \00\,
Printer, len(Printer), INI_FILE$)
Printer = Printer [1,\00\]
cPrinters = count(Printer, ",")
for iPrinter = 1 to cPrinters
Printers<-1> = Models<iModel>: ",": field(Printer, ",", 1): ",":
field(Printer, ",", iPrinter + 1)
next iPrinter
next iModel
* get the default printer
Default = str(\00\, MAX_SIZE$)
GetPrivateProfileString(DFT_SECTION$, DFT_KEY$, \00\, Default,
len(Default), INI_FILE$)
Default = Default [1, \00\]
---

[top]

ERIC THE EMU'S AREV SCRIPTS

The feathered phagedaena decided this month to put the AREV brick away for a while owing to sickness from a bad case of emu oil which, according to the Eric's doctor http://www.ruprecht.com), was in turn cause by way too much TCL.

Instead, confined to nest, I picked up a good 1200-page trashy novel ("Mastering JavaScript" by Jaworski, published by Sybex). Let's briefly consider the use of JavaScript in HTML pages. Given that the web browser will soon become a common operating environment of choice, and also that browsers are under-utilised in their ability to execute programs via scripts, a digression seems in order.

Firstly JavaScript isn't Java, although there is some resemblance. Java is compiled into pseudo-object (not unlike AREV) and is first downloaded ahead of runtime, executed at "near-executable" speed on the browser. OS-specific functionality is interpreted and compiled "just-in-time" by the Java Virtual machine (which is imbedded in the web browser). JavaScript exists only as text in our web page document, in ASCII form, and is interpreted in the browser in much the same way DOS interprets a batch file. JavaScript doesn't actually exist *at all* in the existential sense, but hey - Albert Camus don't cut code, does he?

For those unfamiliar with HTML, each invisible instruction to the browser appears in angle brackets, in much the same way as printer escape codes are imbedded in a document for printing. These are "tags".

If present JavaScript is text-based code imbedded in your HTML page between the <SCRIPT LANGUAGE="JAVASCRIPT"> tag and the next following

</SCRIPT> tag.
The Hello World program in its hypertext setting looks like this.
mode = 'R'
selection = 0
attr = ''
help = ''
column = 1
type = ''
filename=pop.up(col,row,file,display,format,mode,selection,title,attr,help,colu
n,type)
if filename = '' then return
* check that the file has an associated dictionary
use.dict = 0
open 'DICT.':filename to dicthandle then
use.dict = 1
end else
mtxt = 'The file||':filename:'||has no associated dictionary'
mtxt<-1> = 'Output conversions disabled|Using occupied fields
instead.'
msg(mtxt,'','','')
end
* enable the tagging of fields required in the output
longfieldnums = ''
longfieldnames = ''
longfieldoconvs = ''
if use.dict = 0 then
* construct dummy dictionary
open filename to handle then
perform "SELECT ":filename:" (S)"
if @REC.COUNT >= 1 THEN
maxfieldcount = 0
eof = 0
loop
readnext f.id else eof = 1
while eof = 0
read f.rec from handle, f.id then
fcount = count(f.rec,@fm) + (f.rec <> '')
if fcount > maxfieldcount then maxfieldcount = fcount
end
repeat
for i = 0 to maxfieldcount
longfieldnames<i+1> = 'F':i
longfieldnums<i+1> = i
longfieldoconvs<i+1> = ''
next i
end
end
end else
* dictionary items present
open 'DICT.':filename to handle then
eof = 0
perform "SELECT DICT.":filename:" (S)"
if @REC.COUNT >= 1 THEN
maxfieldcount = 0
counter = 0
loop
readnext d.id else eof = 1
while eof = 0
read d.rec from handle, d.id then
if num(d.rec<2>[1,1]) then
counter += 1
longfieldnums<counter> = d.rec<2>
longfieldnames<counter> = d.id
longfieldoconvs<counter> = d.rec<7>
end
end

repeat
end
end
end
col = 0
row = 0
file = ''
title = 'Select fields to export in HTML format.'
display = longfieldnames
format = '1:45:L::':filename:' Dictionary Fields'
mode = 'R'
selection = 1 ;* allow multiples
attr = ''
help = ''
column = 1
type = ''
shortfields=pop.up(col,row,file,display,format,mode,selection,title,at
tr,help,column,type)
if shortfields = '' then return
convert @vm to @fm in shortfields
fncount = count(shortfields,@FM) + (shortfields<> '')
shortoconvs = ''
shortfieldnums = ''
for j = 1 to fncount
locate shortfields<j> in longfieldnames using @FM setting p then
shortfieldnums<-1> = longfieldnums<p>
shortoconvs<-1> = longfieldoconvs<p>
end
next j
* have user nominate a DOS filename to output to
outfilename = 'C:\test1.htm'
MSG('Specify DOS filename for HTML
output','RC',outfilename,outfilename)
if outfilename = '' then return
PCPERFORM "REM > ":outfilename
* produce the output file
OSOPEN outfilename TO dosfile ELSE RETURN
txt = ''
* set up the HTML file header
txt1='<HTML><HEAD>Arev HTMLIST DEMO - Contents of ':filename
txt1:= ' file.</HEAD><TITLE>Contents of the AREV ':filename:'
file.</TITLE>'
txt1:= '<BODY BGCOLOR="#225599" TEXT="#EEEEEE"><TABLE WIDTH=100%
BORDER="2"'
txt1:= 'BGCOLOR="#007799">'
open filename to handle then
perform "SELECT ":filename:" BY @ID (S)"
if @REC.COUNT >= 1 THEN
eof = 0
loop
readnext f.id else eof = 1
while eof = 0
read f.rec from handle, f.id then
TXT := '<TR>'
SWAP '<' WITH '~' IN f.rec
SWAP '>' WITH '~' IN f.rec
SWAP '"' WITH '~' IN f.rec
SWAP "'" WITH '~' IN f.rec
SWAP @VM WITH '<BR>' IN f.rec
SWAP @SVM WITH ',' IN f.rec
SWAP @TM WITH ' ' IN f.rec
SWAP @STM WITH ' ' IN f.rec
SWAP CHAR(13) WITH '' IN f.rec

SWAP CHAR(10) WITH '~' IN f.rec
fcount = count(f.rec,@fm) + (f.rec <> '')
if fcount > maxfieldcount then maxfieldcount = fcount
for i = 0 to maxfieldcount
locate i in shortfieldnums using @FM setting j then
if i <> 0 then
TXT := '<TD>' : oconv(f.rec<shortfieldnums<j>>,shortoconvs<j>) :
'</TD>'
end else
TXT := '<TD>':f.id:'</TD>'
end
end
next i
TXT := '</TR>'
if len(txt) > 20000 then
l = dir(outfilename)<1>
if l = 0 then txt = txt1:txt
if mod(l,65536) = 21930 then
txt = lastchar:txt
l = l-1
end
for i = 128 to 255
swap char(i) with '' in txt
next i
osbwrite txt to dosfile AT l
flush
lastchar = txt[-1,1]
txt = ''
END
end
repeat
end
end
txt = txt:'</TABLE></BODY>'
* N.B.!!! insert Javascript tags & text here !!!
txt := '</HTML>'
l = dir(outfilename)<1>
if l = 0 then txt = txt1:txt
if mod(l,65536) = 21930 then
txt = lastchar:txt
l = l-1
end
for i = 128 to 255
swap char(i) with '' in txt
next i
osbwrite txt to dosfile AT l
flush
return
*** End of RBASIC code listing ***

The utility could also include some basic Javascript source code to make the reports more dynamic and interactive in nature for users with supportive browsers. The spot is marked. Now it's over to you!

Eric's best web-sites this month include:

A trip back to Trash-80 & Apple 2e heaven in Sumeria with Hammurabi -

http://www.pwainc.com/cgi-bin/ham.cgi?reign=10

And the reason they had to rework www.revelation.com  recently-

http://voyager.cns.ohiou.edu/~jrantane/menu/pig.html

Sure as hell beats VBscript

Eric Emu.

[top]

Peripheral Trivia

As this issue of S/ENL was put to bed we fed the inner man with:

TV :Prisoner Cell Block H (sorry it's on very late at night so it's the only thing we have time for!)

Book:Too many to mention! Six days of vacation, 12 books.

CD:"Rap declares War" - various artists. Tribute to the 70's group War.

WEB:http://www.dejanews.com

[top]

Join us :Send Mail to Admin@Sprezzatura.com with subject SUBSCRIBE SENL
Leave Us:Send Mail to Admin@Sprezzatura.com with subject UNSUBSCRIBE SENL
Change of Address: Leave at the old address & join at the new one
Web Info:http://www.sprezzatura.com/
Tell us what you'd like to see in S/ENL:Ask_Sprezz@sprezzatura.com

S/ENL - (c) Copyright 1998, Sprezzatura Ltd. All rights reserved. REDISTRIBUTION is allowed only with permission. You may circulate copies of S/ENL by manually forwarding it, providing (1) you forward the issue in its entirety, (2) no fee is involved, and (3) you forward no more than three issues to any one individual. After that, please encourage your correspondents to send e-mail to admin@sprezzatura.com with SUBSCRIBE SENL in the subject line to get their own free subscription. Everyone is welcome! Tell your friends about S/ENL.

[top]

Copyright © 2005 The Sprezzatura Group. All rights reserved.