Kategorien: Programming, Delphi, HeidiSQL, PHP, Typo3
Just found by accident: When editing a .pas unit, Shift + Ctrl + [ArrowUp or ArrowDown] jumps from procedure declaration to implementation. Very nice if you have large units with several thousands of lines and numerous procedures and functions.
Link: ftp://ftp-developpez.com/sjrd/tutoriels/delphi-generics/delphi-generics.pdf
Just found a wonderful and deep look into generics, anonymous routines and routine references here . Written by Sébastien Doeraene.
Generics were introduced in Delphi 2009, and I'm a big fan of them, as they help me do less type casting on TObjectList's items for example.
Want to know how sorting a TObjectList<TWhatever> works? Here's how it works:
type
TDBObject = class
Name: String;
end;
TDBObjectList = TObjectList<TDBObject>;
TDBObjectComparer = class(TComparer<TDBObject>)
function Compare(const Left, Right: TDBObject): Integer; override;
end;
procedure TMainform.btnOkClick(Sender: TObject);
var
o: TDBObject;
begin
Result := TDBObjectList.Create(TDBObjectComparer.Create);
o := TDBObject.Create;
o.Name := 'foo';
Result.Add(o);
o := TDBObject.Create;
o.Name := 'bar';
Result.Add(o);
end;
function TDBObjectComparer.Compare(const Left, Right: TDBObject): Integer;
begin
Result := CompareText(Left.Name, Right.Name);
end;
Link: http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/4/1/
On the root or first level page you probably want to hide a so called breadcrumb menu, as it would be a single word, identically with the page title, looking like a repetition of the page title. All "deeper" page levels should indeed include the complete path.
There is a HMENU.minItems property which looked pretty like what I needed. But that created a dummy item with three dots for missing level items, not what I wanted. So, the trick is to use a conditional block, where the first one is executed on page level 0 and 1, and the second one for all deeper levels:
[treeLevel = 0,1]
# No breadcrumb on root or first level pages
mainPage.10.marks {
BREADCRUMB = TEXT
BREADCRUMB.value =
}
[else]
mainPage.10.marks {
BREADCRUMB = HMENU
BREADCRUMB {
wrap = <p>|</p>
special = rootline
# No item at all for the root page, so we start at level 1
special.range = 1|-1
1 = TMENU
1.NO = 1
1.NO.allWrap = | »
1.CUR = 1
1.CUR.doNotLinkIt = 1
}
}
[end]
Link: http://www.typo3-jack.net/typo3-dev-lists-netfielders-de/3076-typo3-dev-typolink-anchor.html
getTypoLink() doesn't allow you to pass an anchor parameter. So, in order to add an anchor to such a link you just have to add the anchor part to the id parameter:
$this->cObj->getTypoLink('Link Label', '123#myanchor');
$this->cObj->pi_linkToPage('Link Label', '123#myanchor');
$this->cObj->getTypoLink_URL('123#myanchor');
By the way, ever saw what the harmless function class.tslib_content.php:typoLink() does? Have a look just for fun, it's a 300 liner! Feels like Typo3 has a damned considerable amount of workarounds for various special cases and requirements.
Link: http://www.soft-gems.net/index.php?option=com_content&task=view&id=56&Itemid=1
Mike has just set up a bugtracker at Google Code for his popular VirtualTree component for Delphi. So, finally, all interested developers can actively participate in enhancing and extending this thing.
HeidiSQL makes extensive use of VirtualTree - as replacement for the normal TTree's and TListView's we had in old days. VirtualTree can display tree-like structures as well as lists, in all colors and flavours you can imagine:

Much more: it minimizes CPU and memory usage by strictly following the virtual paradigm (= just process visible nodes, nothing more, the rest is processed when the users scrolls to it). That means you can create millions of nodes in milliseconds. It has support for drag'n drop, custom cell editors (similar to plugins), images in column headers and cells, tons of useful events, and numerous other things you won't like to miss once you get used to them.
Link: http://www.heidisql.com/
Phew... fixed it by upgrading the old virtual server system to a newer, slightly more speedy one. Networking on the old virtual machine was still broken today, and Parallels seem to have bigger problems finding the error cause. So I decided not to sit and wait here and ordered the mentioned upgrade, which then was a blank new virtual machine with nearly the same specs but on a different hardware. They mounted the old virtual harddisk into the new system so I could easily copy old config files and programs from O:\ to C:\ . Nameservers updated to the new IP address and tataaa - at 8:30pm the first visitors since 36 hours were back.
Btw, having a downtime on that domain also meant there was a one-minute-waiter for each HeidiSQL user at startup on earth which had updatechecks switched on ... ehm ![]()
Link: http://www.heidisql.com/
The container of the virtual machine seems to be broken since 9:30 this morning and causes random network problems. Hopefully HostEurope can fix that soon, otherwise I have to reinstall the complete system.
Imagine some ordinal type and a set enumeration of it in Delphi:
Code:
type | |
TLocation = (locHere, locThere, locElsewhere); | |
TLocations = Set of TLocation; | |
... | |
var locs: TLocations; | |
... | |
begin | |
Include(locs, locHere); | |
end; |
Now, imagine you have several loops and points where any TLocation is added to or substracted from locs. At a later point in your application you need the number of elements in locs. Although that seems totally trivial that is not implemented in Delphi's compiler. The only SET related procedures in Delphi's compiler are Include, Exclude and In - there is no Count method for SETs. Well, you can help out and write your own one, as I discovered here:
Code:
function CountSetItems(SetValue: Integer): Byte; | |
var | |
Mask: Integer; | |
begin | |
Mask := $80000000; | |
Result := 0; | |
while Mask <> 0 do begin | |
if SetValue and Mask <> 0 then | |
inc(Result); | |
Mask := Mask shr 1; | |
end; | |
end; |
