One of the things that I generally get frustrated with when I have to code in Javascript is the lack of safety that strongly typed languages such as Delphi bring to the table. Most of the tools, while they offer basic language helpers, do not do much about the structure of your javascript application. There is no "code insight" for Javascript function parameters...at least not for MY code.
One of the latest offerings from Microsoft, as presented by Anders Hejlsberg, is TypeScript. It appears to me that TypeScript is a game changer in the world of Javascript development.
TypeScript is an extension to Javascript. Everything you can do in Javascript, you can also do in TypeScript. TypeScript "compiles" to Javascript, so there is no special plugins that need to be deployed. Its all about adding the missing "type" and providing code gen helpers to make your code cleaner and easier to understand. Its all about adding that little bit more information that will make your (Javascript) applications much easier to maintain.
Looking over what TypeScript does, it makes sense. Its simple enough that it shouldn't take long to learn to apply.
If you do any Javascript development, take a look at TypeScript.
Thursday, October 04, 2012
Wednesday, September 05, 2012
Metro Icons for Delphi XE3
In playing around with Delphi XE3 and the new Metro UI wizards, I found I needed a few icons to explore with. After a little searching, I discovered a gem in the free utility MetroStudio.
This application allows you to quickly create Metro-ized icons from either a collection of over 1400 symbols, or even a symbol from a font installed on your machine.
For example, the lightning bolt can be used as a tile:
or as a tool bar image:
I haven't gotten that far into it yet, but another thing I find missing for the FireMonkey version that appears to be an oversight is the lack of a flow layout panel that flows from top to bottom, left to right. The default flow layout panel flows left to right or right to left. Unfortunately this makes laying out a metro style application a manual process, and doesn't easily allow for the addition of dynamic content which would flow appropriately based on screen dimensions.
This application allows you to quickly create Metro-ized icons from either a collection of over 1400 symbols, or even a symbol from a font installed on your machine.
For example, the lightning bolt can be used as a tile:
or as a tool bar image:

Execute
I haven't gotten that far into it yet, but another thing I find missing for the FireMonkey version that appears to be an oversight is the lack of a flow layout panel that flows from top to bottom, left to right. The default flow layout panel flows left to right or right to left. Unfortunately this makes laying out a metro style application a manual process, and doesn't easily allow for the addition of dynamic content which would flow appropriately based on screen dimensions.
Friday, October 15, 2010
Delphi Tip : Avoiding Project101
It is inevitable. In my hurry to test something I created yet another console application and started entering some code. Funny thing how the project numbers keep mounting, and I have no recollection what any of these small test applications do since every default project goes into the same directory.
The solution turned out to be quite simple. Remove the WRITE access to the default project directory for my development user account. Now when I go to save, I am presented by the following dialog:

This gives me one last warning that the project doesn't yet have a home...I can now decide where to place it and what it will be called. Actually, I can't even RUN the application until it has a home...
Granted this means that there will probably be another directory with a hundred ProjectN programs... but I'll know I put them there on purpose.
The solution turned out to be quite simple. Remove the WRITE access to the default project directory for my development user account. Now when I go to save, I am presented by the following dialog:

This gives me one last warning that the project doesn't yet have a home...I can now decide where to place it and what it will be called. Actually, I can't even RUN the application until it has a home...
Granted this means that there will probably be another directory with a hundred ProjectN programs... but I'll know I put them there on purpose.
Friday, December 19, 2008
Delphi Wizard Framework - SetAllowDeletion
In my previous posts about my wizard framework, I discussed some of the original design decisions, as well as how to perform simple forward navigation.
The Delphi Wizard Framework is currently being hosted by google code hosting, which I briefly reviewed in a previous post.
One of the problems that I ran into quickly after starting this system was the issue of displaying a wizard form that doesn't allow user input but is there to show the user that something is being performed, to please wait patiently. The wizard framework as it navigates from one form to another automatically adds the last form displayed to the deleted queue and sends itself a message which will free all the forms in the queue. This works great and performing cleanup, but can cause access violations if someone wants to do something like the following:
Now the intentions here are good, but the second the ProcessMessages is handled by the system the form which is executing this code is going to be freed, which will ultimately generate an exception. The solution to this is to use the framework method SetAllowDeletion to delay the deletion of the current form until later. Using it the correct method of the above routine should look like the following:
The Delphi Wizard Framework is currently being hosted by google code hosting, which I briefly reviewed in a previous post.
One of the problems that I ran into quickly after starting this system was the issue of displaying a wizard form that doesn't allow user input but is there to show the user that something is being performed, to please wait patiently. The wizard framework as it navigates from one form to another automatically adds the last form displayed to the deleted queue and sends itself a message which will free all the forms in the queue. This works great and performing cleanup, but can cause access violations if someone wants to do something like the following:
begin
fWizMgr.NavigateToPage('TStatuspage');
if not Supports(fWizMgr.CurrForm,IWizPerformStatus,StatusForm) then
raise Exception.Create('form does not support IWizPerformStatus');
for ix := 0 to 100 do
begin
StatusForm.DoWork(ix);
StatusForm.ShowProgress(ix);
Application.ProcessMessages;
end;
fWizMgr.NavigateToPage('TResultspage',false);
end;
Now the intentions here are good, but the second the ProcessMessages is handled by the system the form which is executing this code is going to be freed, which will ultimately generate an exception. The solution to this is to use the framework method SetAllowDeletion to delay the deletion of the current form until later. Using it the correct method of the above routine should look like the following:
begin
fWizMgr.SetAllowDeletion(false);
try
fWizMgr.NavigateToPage('TStatuspage');
if not Supports(fWizMgr.CurrForm,IWizPerformStatus,StatusForm) then
raise Exception.Create('form does not support IWizPerformStatus');
for ix := 0 to 100 do
begin
StatusForm.DoWork(ix);
StatusForm.ShowProgress(ix);
Application.ProcessMessages;
end;
fWizMgr.NavigateToPage('TResultspage',false);
finally
fWizMgr.SetAllowDeletion(True);
end;
end;
Subscribe to:
Posts (Atom)