| Hifni Shahazard...'s profile::: Hifni's Ballroom :::PhotosBlogLists | Help |
"If I have seen further, it is by standing upon the shoulders of giants"I sense that this quote has something very special, something transparent that we could not see nor judge the outcome. "If I have seen further, it is by standing upon the shoulders of giants"Sir Isaac Newton was an English physicist, mathematician, astronomer, alchemist, inventor and natural philosopher who is generally regarded as one of the most influential scientists in history. This quote is from a letter written to fellow scientist, Robert Hooke in February 1675. The phrase is understood to mean that if Newton had been able to discover more about the universe than others, then it was because he was working in the light of discoveries made by fellow scientists, either in his own time or earlier. There is some suggestion that the phrase may also have had a sarcastic undertone - some historians report that Robert Hooke began to disagree with a number of Newton's theories, and Hooke himself was reportedly quite short in height. About Sir Issac Newton: The son of a farming family, Sir Isaac Newton was born in Lincolnshire in England in 1643. He is best known as the scientist who first identified the effects of gravity. A popular story claims that Newton was inspired to formulate his theory of universal gravitation by the fall of an apple from a tree. Cartoons have gone further to suggest the apple actually hit Newton's head, and that its impact somehow made him aware of the force of gravity. However, there is no basis to that interpretation. Unique for time, Newton is also famous for his revolutionary discoveries in mathematics, optics, physics and astronomy. His book Principia, published in 1687, is regarded as the greatest scientific book ever written, and his discoveries have been the basis for much scientific research. To Check other good quotes, go to: BBC's Moving Words 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. GEEK. 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/One Freeking Day!25th of April 2005 could not be forgotten easily, as it almost turned out to be a haunted, freeking day. This day is also significant as this marked the start of the BCS Examinations. The exams are due to begin at 10:00 am, and I prepared myself at 9:00am by having a bath and set off at 9:10am. However, I didn't realise that my watch had stoped at 9:18am. My objective was to get a bus at 9:30am, and realising that my watch shows 9:18 am having 12 minutes left, I sneeked in a bookshop to buy some stationeries. When I came at the bus stop it was still 9:18am..(I still believe that it's correct with out being aware that the battery has dried off in my watch). Coincidently I met a one of my collegues after long time who is also heading for the same destination as I do. Till the bus arrived, we had a small chat, and in the middle I just asked the time and he said that it's 9:45am (Oh god I'm late). We got on a bus went where I reached my destination 15 minutes late. The paper I was ought to sit on 25th was Systems Analysis in the morning and it was easy (realising that something good had happen after being late). I was able to finish the paper 5 minutes earlier, but still requiring some time to verify the DFD's and ERD's I drew when I heard the invigilator screeming "STOP!".... Without having much chance, I gave up. I was confident that I put up a good effort after being late, but still felt that "if i had that 15 minutes time I could have scored more"
Once the System Analysis paper finished, I headed to home (I got a 2 hour break before sitting to the next exam). While going home another nasty thing happened again. Mud water was splashed at me after a damn idiot drew his vehicle over a hole in the road which was filled by mud water. This ment seriousness on me. Earlier I was late and almost screwed up the exam, now a Mud water splash.....oh god what more to come was my next thought. I was filled with anger and went to home. Forgot what happen since now and had a bath and lunch and set off to face the next examination.
I was able to present in my seat 15 minutes earlier and was quite happy that nothing went wrong. However that wasn't the end when systems design paper was given to me. It was bit difficult I suggested. I was really complicated which questions to choose. There was one which had to draw a Sequence Diagram which I could and did it. I had to make a choice between 2 questions where one was to describe the LAN and Client Server and another on RAD Development. I don't know what made me to take on the RAD, but should have taken the Client Server question instead. I realised this after doing the exam and thought "the ghost that haunted me earlier in the morning still is chasing me behind".
However at the end of the day when turned back and looked, I saw there might have bad thing happened, but atleast there were some good thing also happend among. I was happy and continued the confident mode to do the Database Paper tomorrow (26th). There weren't any problem on 26th, nothing bad happened but I was only able to do 3 out of the 4 questions due to time constraints. However teh paper was relatively easy. Now what haunts me is the release of results. Hope it will come out good and hope you all pray for me. Talking about You've got mail? Some FBI agents don't - Tech News & Reviews - MSNBC.comthis was rather funny, which I found out in MSNBC.com: NEW YORK - Budget constraints are forcing some local Federal Bureau of Investigation agents to operate without e-mail accounts, according to the agency's top official in New York. "As ridiculous as this might sound, we have real money issues right now, and the government is reluctant to give all agents and analysts dot-gov accounts," Mark Mershon said when asked about the gap at a New York Daily News editorial board meeting. "We just don't have the money, and that is an endless stream of complaints that come from the field," he said. FBI officials in Washington denied that cost-cutting was putting agents at a disadvantage. Spokeswoman Cathy Milhoan said e-mail addresses are still being assigned, adding that the city bureau's 2,000 employees would all have accounts by the end of the year. Mershon, the assistant director in charge of the agency's New York City office, also said that 100 city agents have been given Internet-ready phones such as BlackBerry devices. Christine Monaco, a spokeswoman for the FBI in New York, said Monday that all FBI agents can communicate with each other via a secure internal e-mail system, and about 75 percent of the New York office's employees have outside e-mail accounts. "The outside e-mail accounts have to be separately funded," she said. Senator Charles Schumer called for better access to technology for agents. "The FBI should have the tools it needs to fight terrorism and crime in the 21st century, most of all in New York City, and one of the most effective means of communications is e-mail and the Internet," he said. "FBI agents not having e-mail or Internet access is much too much a pre-9/11 mentality." You've got mail? Some FBI agents don't - Tech News & Reviews - MSNBC.com Dynamically Running the SQL Codes/*----Dynamically Create your own SQLs and Run it Dynamically---*/ /*-------06th March 2006; Mohammed Hifni Shahzard Nazeer--------*/ DECLARE @q VARCHAR(50) --Assign the SQL to the Variable SET @q = 'USE NORTHWIND Select * from Customers' --Execute the String EXEC(@q)
As simple as that. Cool is it? Regards, Hifni Shahzard Nazeer, M. Best of Cricket in 2005:Best of Cricket in 2005:
Sorry it took a while to publish this as I was continuously involved with a hectic schedule and hardly got a time to write freely.
2005 remarked a great era for cricket. Many milestones were achieved and many extraordinary things happened. Overall it’s been good for cricket and we are happy to see some good cricket matches. I take this opportunity to rate top 5 best things happened in 2005 in my perspective.
This is simply best cricket series I ever had seen. It got all from excitement to thrill to anticipation to disappointment. England had to wait for 18 years to achieve this feat again, and boy the way they did it is awesome. Freddie Flintoff, Kevin Petersen, Simon Jones was at their peak. This is the same time when England found out their new revelation of reverse swing. You can’t take Shane Warne off the screen in any circumstances, I still remember the way he bowled Andrew Strauss by pitching the ball far from the off side and turned and hit the leg stump in that series, and boy it's amazing. Looking forward for Operation "Demolition in Australia", hope England could repeat their heroics in the next ashes in Australia.
Once again it’s an Australia Vs. England show. This time it’s the Shorter version of the game and the finals played for Natwest Series at Lords. The game went to the wire and it was never the end until the last ball has been bowled. Australia was bowled with a highly packed batting line out only managing for mere 196 and England were at one stage were 33 runs with 5 wickets down. It was upto Paul Collingwood and Geraint Jones who had a 116 runs partnership for the 5th wicket, though they weren’t the heros of the particular day was Ashley Giles who snicked a 2 run leg bye off the last ball of the last over.
Frankly, had to wait until the VB Series is on to see this guy. I heard him when Australia toured England, and was starting to make loud echoes of him. What impressed me about him was his never say die attitude. Though he might be a Michael Bevan sought of a guy, he has more than him. His ability to have the big hits on time is quite impressing and he can’t simply stay in a place always in the run. I still remember the way hit that big hit in Telstra dome, and eventually it wasn't decided as six! That was disappointing.
Don’t ever think that your day dreaming. This happened, and every one was shocked to hear this news. It’s like a ant pulling off an elephant. Anyway, Bangladeshi put up a good show, hats off to them, but it’s very disappointing to see good performances by more often. Ashrafull scored an unbeaten century to pull off a shocker.
He is my favorite and he will be. I'll be glued to the TV when he is on song. I like to see every shot he plays. He went on a poor form in 2005, particularly in the Super Series, but he came back strongly with 231 Vs. Australia in Adelaide despite Australia trouncing the West Indies to win the series 3-nil. It’s very sad that even big score scored by a batsmen still ends up in the loosing side. Further, he announced that this would be his final tour to Australia. He still is the best.
Your comments and suggestions are most welcomed.
Regards,
Hifni Shahzard Nazeer, M.
SQL Server ReplicationHi,
After facing this problem and have got screwed, I had no option rather than post it to newsgroup. And thankfully a gentelmen called Paul Bison of the Microsoft SQL Server 2000 Newsgroup had to say this:
Nazeer,
if you're replicating to another computer you'll need to do 2 things:
HTH, My Delphi's FAQDelphi's Common Problem and Solution:
Hi, problems may arise more often when your doing programming, and I've experianced it in my life more often. There are times, when a problem comes and we solve it and after a some days, months or years it may arise again, this where I get screwed. Have to search the posts I've posted to the newsgroups or have to search URL of the article which may turn out to be annoying. What do now, that I create Text File called "FAQ.txt" and write down all solved problems and solutions in it, so if problem arises I don't have to look in to newsgroups nor articles. Searching will be bit difficult......but it's some what easy to me. So far this what I've come across and the solutions have been written down as well. Please do not forget to comment on this.
>>How to Register midas.dll?
Usually if the machine hasn't got midas.dll registered it will give a message saying "error loading midas.dll". To register, place the midas.dll in the application's folder and Go to Run>CMD and type "regsvr32.exe midas.dll". Once the midas.dll has been registered you'll get the Message "Server successfully registered midas.dll" or whatever. >>How to Know the Records have been posted or not in ADO? Refresh is very time consuming in ADO I use the following Utility code to make sure tables get posted.
This code goes in the form's OnCloseQuery method FUNCTION TGenericEdittab.PostAllTablesThisForm : Boolean;
var li:longInt; begin Result := true; Try for li := ComponentCount - 1 downto 0 do begin if ( Components[li] is TDataSource) then begin with (Components[li] as TDataSource ) Do if Dataset <> Nil then begin if Dataset.State in [dsEdit,dsInsert] then dataset.post; end; end; end; Except Result := false; Raise; //raise the error so it gets throug to user end; >>Clientdataset's BeforeUpdateRecord and AfterUpdateRecord. What is this? BeforeUpdateRecord gives you access to the "currently" updated record
and midas gets confused if you insert a new record in DeltaDs parameter. I think Provider.OnUpdateData gives you a chance to see (and manipulate) the whole Delta (DataSet parameter), the way you would like. For example: procedure TMyDataModule1.Provider1UpdateData(Sender: TObject; DataSet:
TCustomClientDataSet); begin with DataSet do begin First; while not Eof do begin if UpdateStatus = usInserted then begin .....//Do what ever you like here end; Next; end; end; Another option is to manually do the updates (write your own INSERT statements) in BeforeUpdateRecord and set Applied to True >>How to Convert the first letter of a string to Uppercase? procedure FirstLetterUppercase(Sender: TObject) ;
var GetString : string; GetLength : Integer; I : Integer; T : String; begin if edit1.SelLength > 0 then GetString:= Edit1.Seltext else GetString:= Edit1.Text; GetLength:= Length(Edit1.Text) ; if GetLength>0 then begin for I:= 0 to GetLength do begin if (GetString[i] = ' ') or (I=0) then begin if GetString[I+1] in ['a'..'z'] then begin T:=GetString[I+1]; T:=UpperCase(T) ; GetString[I+1]:=T[1]; end; end; end; if edit1.Sellength>0 then Edit1.Seltext:=GetString else Edit1.Text:=GetString; end; end; Writting as a Function:
function TForm.FirstLetterToUppercase(Sender: TEdit): String;
var GetString : string; GetLength : Integer; I : Integer; T : String; begin if Sender.SelLength > 0 then GetString:= Sender.SelText else GetString:= Sender.Text; GetLength:= Length(Sender.Text) ; if GetLength>0 then begin for I:= 0 to GetLength do begin if (GetString[i] = ' ') or (I=0) then begin if GetString[I+1] in ['a'..'z'] then begin T:=GetString[I+1]; T:=UpperCase(T) ; GetString[I+1]:=T[1]; end; end; end; if Sender.Sellength>0 then Result :=GetString else Result :=GetString; end; end; >>How to use the GET/SET Methods of a *.ini File?
Sets and gets the ini value for a variable (StringName) in the ini section (IniSection) of the ini file (TheIniFile):
~~~~~~~~~~~~~~~~~~~~~~~~~ Function IniGetStringValue( TheIniFile : String; IniSection : String; StringName : String; DefaultString : String): String; Var TheIni : TIniFile; Begin TheIni := TIniFile.Create(Self) ; Try Result := TheIni.ReadString(IniSection,StringName,DefaultString) ; If Result = '' Then Result := DefaultString; Finally TheIni.Free; End; End; Function IniSetStringValue(
TheIniFile : String; IniSection : String; StringName : String; StringValue : String): Boolean; Var TheIni : TIniFile; Begin TheIni := TIniFile.Create(Self) ; Try Try TheIni.WriteString( IniSection, StringName, StringValue) ; Result := True; Except Result := False; End; Finally TheIni.Free; End; End; ~~~~~~~~~~~~~~~~~~~~~~~~~ >>Can I make Field Entries as well as Field Values to Uppercase in DBGrid?
Yes, you may use the DBGrid's OnGetText/OnSetText events too: procedure yourFieldGetText(Sender: TField; var Text: String; DisplayText:
Boolean); begin Text := UpperCase(VarToStr(Sender.AsString)) end; procedure yourOnFieldSetText(Sender: TField; const Text: String);
begin Sender.Value := UpperCase(Text) end; Or else can fire a event in the DBGrid.OnKeyPress Event as:
an onkeypress event would be easier procedure yourOnKeypress
begin if selectedField = FieldtoUpperCase then // substitute your field name key := UpCase(key) End; >>How to Know the MDAC Version of the computer?
Microsoft Data Access Components - includes ADO, ODBC and OLE DB. If installed, see "C:\Program Files\Common Files\System\ADO\MDACReadMe.txt" for additional info.
>>How to Create Directory?
CreateDir('c:\path');
or else
uses
Dialogs; begin
{$I-} MkDir('c:\windows'); {$I+} if IOResult <> 0 then MessageDlg('Cannot Create Directory/Verzeichnis kann nicht angelegt werden!', mtWarning, [mbOK], 0) else MessageDlg('Directory Created/Neues Verzeichnis angelegt.', mtInformation, [mbOK], 0); end; >>How to Remove a Directory? RemoveDir('c:\path'); or RmDir('c:\path');
>>How to Change a Directory? ChDir('c:\path');
>>How to Get the Current Directory? GetCurrentDir
>>How to Check if a Directory exists? if DirectoryExists('c:\path') then ... >>How to Rename a Directory?
uses
ShellApi; procedure RenameDir(DirFrom, DirTo: string);
var shellinfo: TSHFileOpStruct; begin with shellinfo do begin Wnd := 0; wFunc := FO_RENAME; pFrom := PChar(DirFrom); pTo := PChar(DirTo); fFlags := FOF_FILESONLY or FOF_ALLOWUNDO or FOF_SILENT or FOF_NOCONFIRMATION; end; SHFileOperation(shellinfo); end; procedure TForm1.Button1Click(Sender: TObject); begin RenameDir('C:\Dir1', 'C:\Dir2'); end; >>How to copy/Move/Delete whole Directory? uses
ShellApi; function CopyDir(const fromDir, toDir: string): Boolean;
var fos: TSHFileOpStruct; begin ZeroMemory(@fos, SizeOf(fos)); with fos do begin wFunc := FO_COPY; fFlags := FOF_FILESONLY; pFrom := PChar(fromDir + #0); pTo := PChar(toDir) end; Result := (0 = ShFileOperation(fos)); end; function MoveDir(const fromDir, toDir: string): Boolean; var fos: TSHFileOpStruct; begin ZeroMemory(@fos, SizeOf(fos)); with fos do begin wFunc := FO_MOVE; fFlags := FOF_FILESONLY; pFrom := PChar(fromDir + #0); pTo := PChar(toDir) end; Result := (0 = ShFileOperation(fos)); end; function DelDir(dir: string): Boolean;
var fos: TSHFileOpStruct; begin ZeroMemory(@fos, SizeOf(fos)); with fos do begin wFunc := FO_DELETE; fFlags := FOF_SILENT or FOF_NOCONFIRMATION; pFrom := PChar(dir + #0); end; Result := (0 = ShFileOperation(fos)); end; procedure TForm1.Button1Click(Sender: TObject); begin if cCopyDir('d:\download', 'e:\') = True then ShowMessage('Directory copied.'); end; ------------------------------------------------------------------------------------------------- >>>File Management: Files ------------------------------------------------------------------------------------------------- >>How to Rename a File?
RenameFile('file1.txt', 'file2.xyz');
>>How to Delete a File? DeleteFile('c:\text.txt');
>>How to Move a File? MoveFile('C:\file1.txt','D:\file1.txt');
>>How to Copy a File? CopyFile(Pchar(File1),PChar(File2),bFailIfExists);
or
The CopyFile function copies an existing file to a new file.
CopyFile( lpExistingFileName : PChar, // name of an existing file lpNewFileName : PChar, // name of new file bFailIfExists : Boolean); // operation if file exists bFailIfExists:
Specifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds. } var
fileSource, fileDest: string; begin fileSource := 'C:\SourceFile.txt'; fileDest := 'G:\DestFile.txt'; CopyFile(PChar(fileSource), PChar(fileDest), False); end; or uses
ShellApi; procedure ShellFileOperation(fromFile: string; toFile: string; Flags: Integer);
var shellinfo: TSHFileOpStructA; begin with shellinfo do begin wnd := Application.Handle; wFunc := Flags; pFrom := PChar(fromFile); pTo := PChar(toFile); end; SHFileOperation(shellinfo); end; // Example, Beispiel: procedure TForm1.Button1Click(Sender: TObject);
begin ShellFileOperation('c:\afile.txt', 'd:\afile2.txt', FO_COPY); // To Move a file: FO_MOVE end; >>How to Change a File's Extension?
ChangeFileExt('test.txt', 'xls')
>>How to import data from one Clientdataset to another without deleting or loosing the existing data? assuming: if Cds2 is the Destination then Cds1 will be the source.
Cds2.LoadFromFile('C:\Cds1File.xml');//The problem is only related to
xml format Cds2.LoadFromFile('C:\Cds2File.xml'); Cds2.Data:=Cds2.Data;// This is the workaround to bug QC 617 (Need to // call cds.GetData after loading data from a XML file) Cds1.Data:=Cds1.Data//This is redundant because Cds2.GetData is going to //be called inside AppendData anyway and thus not needed. Cds2.AppendData(Cds1.Data,True); >> How Everytime the user asks for this form, you can simply search the list of existing forms to see if it already exists: for i := 0 to Screen.FormCount - 1 do
begin if Screen.Forms[i] is TMyForm then begin Screen.Forms[i].Restore; // in case minimized Screen.Forms[i].BringToFront. Exit; end; end; // form not found TMyForm.Create(YourMainForm); Reading Fixed Line File in VBHi,
This is how one guy said in the newsgroup for my query about Fixed Line File
Re: How to Read through a Fixed-Length File?
I guess I do not see why you are calling it a fixed-length file if you do not have a constant length of data you can read to process, but basically what you will have to do is read in a block of data and check each byte for equality to the start and end characters. One way to do this is something like this: Private Sub ProcessFile(ByVal fs As IO.FileStream) Dim numRead As Integer Dim buffer(4095) As Byte Do numRead = fs.Read(buffer, 0, buffer.Length) ProcessBuffer(buffer, numRead) Loop While numRead > 0 End Sub Private recordStream As New IO.MemoryStream
Private Sub ProcessBuffer(ByVal buffer() As Byte, ByVal length As Integer) Dim lastStart As Integer = 0 For i As Integer = 0 To length If buffer(i) = 3 Then recordStream.Write(buffer, lastStart + 1, i - lastStart) ProcessRecord(System.Text.Encoding.ASCII.GetString(recordStream.ToArray)) ElseIf buffer(i) = 2 Then recordStream = New IO.MemoryStream lastStart = i + 1 End If Next 'write any remaining bytes to the stream, but do not process yet recordStream.Write(buffer, lastStart + 1, length - lastStart) End Sub Private Sub ProcessRecord(ByVal record As String)
'Split record to fields and add to db here End Sub You could replace System.Text.Encoding.ASCII with whatever encoding you want, but make sure you keep the encoder around like the recordStream, especially if it is a multi-byte encoding like most flavors of Unicode. Reading a Fixed Length File in DelphiThis is what Peter Blow of Borland Delph's Team B had to say:
In article <43951cce$1@newsgroups.borland.com>, Hifni wrote:
> This is a *.tpd file and you can open it with notepad. To note in
> this file is that a Record begins with a character which is like > a small square, and the Record ends with a same character and > it's not in line by line but goes sequencially. This looks like a file of fixed-length records ($84 bytes in size each).
You can map such a file to an array of records, which allows you to let the compiler do the splitting of the data. type
TTPDData = packed record LeadIn: Byte; Unknown: array [1..3] of ansichar; Toc: array [1..1] of ansichar; Trunk1: array [1..3] of ansichar; Trunk2: array [1..3] of ansichar; CallingNo: array [1..6] of ansichar; StMon: array [1..2] of ansichar; StDay: array [1..2] of ansichar; StHour: array [1..2] of ansichar; StMin: array [1..2] of ansichar; StSec: array [1..2] of ansichar; EMon: array [1..2] of ansichar; EDay: array [1..2] of ansichar; EHour: array [1..2] of ansichar; EMin: array [1..2] of ansichar; ESec: array [1..2] of ansichar; CalledNumber: array [1..24] of ansichar; Unknown2: array [1..70] of ansichar; Terminator: byte; end; // total size $84 bytes TRecArray = array of TTPDData; procedure TForm1.Button1Click(Sender: TObject);
procedure ShowRec( const Rec: TTPDData ); var sl:TStringlist; begin sl:= TStringlist.Create; try sl.Add(Rec.Unknown); sl.Add(Rec.Toc); sl.Add(Rec.Trunk1); sl.Add(Rec.Trunk2); sl.Add(Rec.CallingNo); sl.Add(Rec.StMon); sl.Add(Rec.StDay); sl.Add(Rec.StHour); sl.Add(Rec.StMin); sl.Add(Rec.StSec); sl.Add(Rec.EMon); sl.Add(Rec.EDay); sl.Add(Rec.EHour); sl.Add(Rec.EMin); sl.Add(Rec.ESec); sl.Add(Rec.CalledNumber); memo1.lines.add(sl.commatext); finally sl.Free end; { finally } end; var
fs: TFilestream; Recs: TRecArray; Numrecs: Integer; i: Integer; begin fs:= TFilestream.Create('D:\temp\31122003.tpd', fmOpenRead or fmShareDenyWrite); try Numrecs := fs.Size div Sizeof(TTPDData); SetLength(Recs, Numrecs); fs.ReadBuffer(Recs[0], Numrecs * Sizeof(TTPDData)); finally fs.Free; end; for i:= 0 to High(Recs) do ShowRec(Recs[I]); end; --
Peter Below (TeamB) Use the newsgroup archives : http://www.mers.com/searchsite.html http://www.tamaracka.com/search.htm http://groups.google.com http://www.prolix.be Get to know the Object Oriented Principles in DelphiIt took some while to understand to implement Object Oriented principles in realtime. I've learnt the theory which more often comes when learning any IT courses, but stranded and wondering how to implement it. It's bit easy to create ordinary classes, what if we had to add some DB ingredients to our class (I mean Business Logic in our Class) ? This is where I fell off.
We drew Clas Diagrams but was struggling to incorporate DB related objects to a class. Now after getting a glimpse from Wayne Neardy of Team B in Borland Delphi's Newsgroup, I gradually picked up the essense of OOP used in Delphi.
Hifni wrote:
> How can I include DB Controls to a class? Actually what I want to do > is apply all business logic into a class and do all updation to table > within the class. > > Anyone, who uses classes with DB controls such as TTable, TADOTable, > TAdoStoredProcedure...etc...could you provide me a example how you > are writting the code for these kinda classes? Any component you can drop on a form or datamodule in the designer can also be created in code. You need to make sure you have the correct units included in the Uses clause, the online help is generally pretty good at providing this information, you can also drop the desired components on a form and Save once, then look what Delphi has added to the Uses clause for that unit. You can then define components like any other object: TMyClass = class private MyTable: TTable; MyDatabase: TDatabase; public constructor Create; destructor Destroy; override; end; constructor TMyClass.Create; begin MyDatabase := TDatabase.Create(nil); MyDatabase.Database := 'foo'; // etc. end; destructor TMyClass.Destroy; begin MyTable.Free; MyDatabase.Free; end; -- Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com) RADBooks: http://www.logicfundamentals.com/RADBooks.html "The two most abundant elements in the universe are hydrogen and stupidity." - Harlan Ellison. You can also view this in your browser by clicking: http://newsgroups.borland.com/cgi-bin/dnewsweb?cmd=article&group=borland.public.delphi.database.general&item=6588&utag
This has really cleared the fuss in my mind about OOP with DB logic in it. This has turned out to be a stepping stone for me and hope it may be for you as.
Happy Coding!
Hifni Low Cost Air Lines CarrierLaunching of, "HolidayAir" will see Sri Lanka's first ever low cost air line by February next year. Air fares will be much low as $10 for a passage from colombo to Singapore. The company is hoping to expand it's destination to the south Indian regions, Bangkok, Singapore and Dubai initially, but will include other destination later. I think this will create a big impact in the aviation industry of Sri Lanka. If HolidayAir could add the middle eastern destinations to their stop overs, Obviously those who mostly benefit will be the migrant workers of Sri Lanka who travel to Middle east for work. This will save some money for them comparing to the large sum they usually pay for big airlines. Even business will be able to see a big boom, as businessman will be able to travel all round the world for business reasons for cheaper fares. Company also has the intentions go public after 3 years, if success continous all the way. Thoughts..................Why is it so hard to tell the truth ...yet so easy to tell a lie, |
|
|