Wednesday, June 28, 2006

Use Transaction in MIDAS

This is a article I found from Mr. Chen Jiangyong on Use of Transaction with MIDAS:
 
Transaction is very popular used in database programming. It's very easier used in Two-Tier application. How do it in Three-Tier? I have try to use cache-update in remote data modules and use transaction, I test it successfully in Delphi 4. But to do it cost many code and low performance. When Delphi 5 coming, I try to use the same method, but failed. Maybe this is the bug of Delphi 5. I think that many person have the same situation with me. How can use transaction in MIDAS? I try another method, just do it at BeforeUpdateRecord event. For example, when I edit table A, I want to insert a log to another table B. To do this, first:

1) create a remote data module , drop a query to select records from table A, drop a TUpdateSQL for the query, specify the SQL statement of Table A. Drop a TDatasetprovider hook to the query. Drop another query, then in its SQL property write the insert SQL statement to table B.

2) In the BeforeUpdateRecord event, I write this code:

  SetParams(UpdateSQL1, DeltaDS, UpdateKind);   

  UpdateSQL1. ExecSQL(UpdateKind);
  if UpdateKind = ukUpdate then begin
    { Insert a log to Table B}
    // set the params ­
    Query2.ExecSQL;
  end;
  Applied := True;

3) In the client, you should also make some change. When you try to save the changes, use ApplyUpdates(0) instead of ApplyUpdates(-1). For example:

  ClientDataSet1.ApplyUpdates(0)

  This is OK. Delphi does it well. If a error occur when you try to insert a log to Table B, the transaction will rollback, then you can find that Table A's record is not changed at all.
  I have tested it at Delphi 4, It also works very well.

Good Luck.

Monday, June 26, 2006

Creating GUIDs In Delphi

GUID values are unique and can be used to various tasks while programming. Therefore, it's appropriate that you know how to create one. Here Bill Todd of Team B shows to create it via Delphi:
 
 
FROM: Bill Todd \(TeamB\) 
DATE : Thurs, Nov 25 1999 12:00 am
 
You can generate a GUID in code by calling CoCreateGuid as shown below. You
must add the ActiveX unit to your uses clause.


<Code>

procedure
TForm1.Button2Click(Sender: TObject);
var
  G: TGuid;
begin
  CoCreateGuid(G);
end;


<\Code>

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Source:

Click here

Friday, June 23, 2006

Da Predator

ENTER THE PREDATOR:

This is one of the coolest pics I found in the internet:



What inspired me about the "Predator" is his armoury, gadgets and his body kit. Wish I had those! The movie "Predator-1" and "Predator-2" does highlight him as the bad guy who brutually kills all bad guys. However in the movie: "AVP" his role remains more similar to the earlier movies, but later companions a human to demolish the rising alien dominancy.

Wednesday, June 21, 2006

Delphi Ruined him

This is a gr8 quite funny and stressed post from Warren Postma I found while browsing:
 
Periodically I get a notion to explore the wide world of other
development tools out there.   Every time I try, I get frustrated, and I
give up.  Partly I think it's because my brain has locked into Delphi
mode so tightly that I can't think of anything else.  Partly it's
because Delphi has spoiled me rotten, and I'm absolutely floored by the
stuff that I have to deal with when I try to use any other tool.  Now
the reason I'm looking around for a new development tool to learn, is so
I can have a tool for writing cross-platform code, hopefully that will
work on Windows, Mac, and Linux.

Has anyone else been in this spot, and had a look around? What did you
do?  Did you plan to have an affair with another language, and then come
home happily to Delphi, knowing it would still have you back again?

- I tried Java again recently. I was really impressed by NetBeans and
the new "matisse" GUI builder.  I am not at all impressed by Eclipse,
although I like the SWT framework the gui-builders for Eclipse that are
any good are quite expensive, and I don't feel like paying $$$ just to
play around and learn the new tool.

- I tried a few Smalltalks, because as we all know, Smalltalk should
have been a really important and powerful programming languages, but for
some reason, it never achieved success. There's Dolphin, for which a
free version exists, and there's Squeak, which is entirely free. Both
are really interesting to play with, but I must admit my brain is so
wired for the procedural style of coding that I can't bear to write a
for-loop in Smalltalk, or send messages between integers. It just seems
weird and wrong to me.  And closures and stuff.  And I think that at
this point, learning Smalltalk is about as pointless as learning COBOL.

- I'd try a LISP, but I have no idea whether a LISP gui builder RAD tool
even exists. Perhaps LISP programmers can't be bothered to look up from
their latest EMACS macros-that-generate-macros-that-generate-LISP-code,
in order to consider the needs of the GUI-building population.

- I downloaded MS Visual C# express, but I don't like DotNet, and I'd
rather not learn another Windows-only tool. Delphi does fine for
Windows. I'd really like to learn something that gets me free from
Windows completely.  Maybe DotNet is the way to go, and I should learn
to love C#, and hope that MONO achieves maturity.

- I really like Python, but every single python gui framework seems too
full of accidental complexity, or too ugly, or both. Tcl/Tk is ugly. 
wxWindows is really hard to learn.  QT is licensed in a way that makes
using it on Windows cost a lot of money.  BOA constructor is a neat toy,
but I haven't been able to do anything useful with it yet.

- For confirmed delphi bigots, such as myself, perhaps Lazarus is the
right way to cross-platform myself, but as much progress as Lazarus has
made, it's still not ready for prime time; it lacks packages, and the
LCL/FCL components/code-libraries are rather klunky and limited in
features when compared with the VCL.

So what did YOU do last time you felt like trying another developer
tool? Can you find it in your heart to say anything good about any other
development tool? Or are you a crabby old Delphi guy like me, dyed in
the wool, and unlikely ever to repent?

Warren

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~End of Post~~~~~~~~~~~~~~~~~~~~~~~~~~`
For further reading the entire post, go to:
http://delphi.newswhat.com/geoxml/forumgetthread?groupname=borland.public.delphi.non-technical&messageid=4484a839$1@newsgroups.borland.com&displaymode=all
 
 

Monday, June 12, 2006

Beginning of the end

We Sri Lankan suffer the most when it comes to cost of living. Last Sunday, the Government of Sri Lanka (GOSL)  increased the petrol products. This is a big blow for the consumers, particularly the average middle man who uses kerosene for cookery and other purposes. We had seen price hike of essential commodities, and in some cases with out aware of the public. Further more, the ongoing Lanka IOC and GOSL have been settled for some degree by allowing the Lanka IOC company to determine the fuel prices from July 1st. Think what might happen if Lanka IOC, a private company is given the right to determine the fuel price of Sri Lanka, the circumstances
 
Think of an average man's point of view. He has the burden to settle his Electricity, Water and Telephone bills, plus taxes and have to feed his family and have to look after other expenses as child's education, Travel...etc. How can a man handle with a small income. It's evident that there is hardly no saving for an individual these days, however if Cost of living soars like this, there is nothing but to suicide himself. Suicide is beginning to be a common thing, and in couple of months ago we saw two farmers suicide themselves due to can not sell their paddy for reasonable price.
 
The present government is playing the fiddle with the public. They acknowledged the public who voted them in the presidential election held on January by increasing the Gas price (We felt that this is not the end, but the beginning of the end), then increased essential commodities, yet again increased the fuel and more often which resulted in hike in the private bus transportation, and on last Sunday people didn't expect another fuel hike, but it happened.
 
As I said earlier this is the beginning and not the end of the so called "chintanaya". Tight your seat belts cos there more to come.
 

Thursday, June 01, 2006

Being a Geek!

This is a great description I got from Patti's Blog about "GEEK":

Now, don't stress just yet. I know that the term "GEEK" has been used in the past as an insult or a stereo-type for losers. However, the term "GEEK" has taken on new meaning over the past few years.

A GEEK is anyone who takes pride in what they do... and is actually good at it. GEEK is not to be confused with the term "NERD". Nerds are the people who got wedgies in high school and then would run home crying. A GEEK is someone who got a wedgie in high school, then went home and crashed the "Wedgor's" computer... or would mix a concoction in chemistry class that would give the assailant severe diarrhea for a week.

A GEEK is someone you call when your computer breaks. GEEKS are the people you contact to help you build a web site or save a database. GEEKS run the computer network at your place of work. A GEEK can be found hosting a mass LAN party. GEEKS write programs that balance your checkbook, organize your files and store/retrieve information... and restarts your computer more often so that you don't have to. A GEEK is someone you call when you have any kind of technological question. GEEKS are respected by others and are in high demand. GEEKS know what they are doing. Nerds are clueless little imps that can't tell the difference between Barney the purple dinosaur and Tux the (LINUX) penguin.

GEEK is a rockin' term, and to be a GEEK is a far greater compliment than any other. Because being a GEEK  does not only mean you are good looking... but it also means that you are good at what you do.

All GEEKS should respect one another. These days, the geeks are having their revenge. Rich and successful geeks are everywhere, or at least they appear to be. There is even a Geek Pride Festival, a celebration of all things GEEK. That is why I'm rounding up all of the GEEK .. we need to stand up and shout it…

Source: http://www.geekgirldigest.com/