The Poetry of Reality is a music video that gathers sentences of 12 scientists and science enthusiasts, including Carl Sagan, Stephen Hawking, Richard Dawkins and Richard Feynman and others. There is real poetry in the real world and science is the poetry of reality.
Source: La reserva.com.
Wednesday, 8 September 2010
Friday, 20 August 2010
Delphi XE preview videos
Here you can see the latest videos from embarcadero talking about the new version of Delphi called Delphi XE.
First preview:
this second preview covers some of the third party tools that will be part of Delphi XE:
- FinalBuilder, used to manage the build process
- The ability to invoke IDE operations (like audits, metrics, code formatting) from the command line, and so invoke them from external tools like FinalBuilder
- The integrated version of profiling tool AQTime
- The logging support provided by CodeSite, a nice tool written by Ray Konopka.
Source:
Thursday, 19 August 2010
TBookMark problem with Delphi 2010 and TList
Going on with the big rewrite of code from Delphi 2007 to 2010 (most of it an adaptation more than a rewrite), but we've found some hidden problems as a result of changes appeared in the new version. One of the flaws was shown while I was working with TBookMark class, trying to position a dataset in a given bookmark. With the help of the Embarcadero Forum, we achieved a solution by using "generics" (I'm preparing a post with generics in Delphi 2010) because the TBookMark is now of type TBytes.
Then, the solution would be something similar to this:
uses
Generics.Collections;
var
bookmarkList: TList<TBookmark>; //The same as TList<SysUtils.TBytes>
//Adding the bookmark
bookmarkList.Add(cds.GetBookmark);
//We don't need the TBookMark cast
procedure TForm1.GotoBkMarksClick(Sender: TObject);
var
Cnt: Integer;
begin
for Cnt := 0 to Pred(BookmarkList.Count) do
begin
if DataSet.BookmarkValid(BookmarkList[Cnt]) then
begin
DataSet.GotoBookmark(BookmarkList[Cnt]);
ShowMessage(DataSet.FieldByName('Id').AsString);
end;
end;
end;
You need to take into account that every project is different and the use of the TBookMark can differ from one project to another.
Wednesday, 18 August 2010
TIniFile looses unicode characters
We've recently started converting code from Delphi 2007 to Delphi 2010 and we noticed that the TInifile looses unicode characters when we try to save an unicode string into the file. The file is UTF-8 encoding and when we try to save characters like 'ó', 'ç', 'á', etc., they don't appear or some unrecognised characters are shown into the ini file instead of the normal ones.
If the file is ANSI encoded and we try yo use the Tinifile, it will work fine with the unicode characters but not if the ini file is converted to UTF-8.
To solve this, we can use the TMemIniFile class. TMemInifile has an overload for the constructor that allows you to pass the encoding used for the file. The code example to solve this is the following:
procedure TForm1.Button1Click(Sender: TObject);
var
inifile : TMemIniFile;
desc : string;
temp : WideString;
begin
inifile := TMemIniFile.Create('C:\fileIni.ini', TEncoding.UTF8);
temp := 'óáç';
desc := string(temp);
inifile.WriteString('Section', desc, 'S');
inifile.UpdateFile;
inifile.Free;
end;Related links:


