<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thijs Lensselink&#039;s Blog &#187; Delphi</title>
	<atom:link href="http://lenss.nl/tag/delphi/feed/" rel="self" type="application/rss+xml" />
	<link>http://lenss.nl</link>
	<description>Webdevelopment and stuff...</description>
	<lastBuildDate>Thu, 26 Apr 2012 21:48:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Custom attributes in Delphi 2010</title>
		<link>http://lenss.nl/2011/04/custom-attributes-in-delphi-2010/</link>
		<comments>http://lenss.nl/2011/04/custom-attributes-in-delphi-2010/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 20:35:44 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[attributes]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Delphi2010]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[RTTI]]></category>

		<guid isPermaLink="false">http://lenss.nl/?p=1235</guid>
		<description><![CDATA[It was a long time ago i placed a blog entry. Due to work etc i didn&#8217;t had any time for it. But now a new entry from me for the delphi developers under us. Within delphi 2010 the RTTY RTTI system has been completely renewed allowing us delphi developers to do more with RTTY [...]]]></description>
			<content:encoded><![CDATA[<p>It was a long time ago i placed a blog entry. Due to work etc i didn&#8217;t had any time for it. But now a new entry from me for the delphi developers under us.</p>
<p>Within delphi 2010 the <del datetime="2011-05-20T19:01:35+00:00">RTTY</del> RTTI system has been completely renewed allowing us delphi developers to do more with <del datetime="2011-05-20T19:01:35+00:00">RTTY</del> RTTI. One of the things i do with <del datetime="2011-05-20T19:01:35+00:00">RTTY</del> RTTI is JSON serialization which is a new feature within delphi 2010. For a quick sample regarding JSON in delphi 2010 i refer to the following site: <a href="http://blogs.embarcadero.com/adrian/2009/08/19/json-types-for-server-methods-in-datasnap-2010/">http://blogs.embarcadero.com/adrian/2009/08/19/json-types-for-server-methods-in-datasnap-2010/</a></p>
<p>Another new feature in delphi 2010 is custom attributes. With custom attributes you can define some extra information on a property like c#. For example i have a object called foo. This object has a published property called doo. This property i want to give some extra attributes for example a fieldname which will be used in the database for updating.  To define such attribute and use it on top of a property i&#8217;ll describe in the code snippet below.</p>
<pre name="code" class="delphi">
//First define the custom attribute(s) you want to have. Within these attributes you can do several
//things. even validation of the field is possible.
//
type TMyAttribute = class(TCustomAttribute)
private
FFieldName : string;
FFieldWidth : Integer;
public
constructor Create(const FieldName : String; FieldWidth: Integer);
property Fieldname : String read FFieldname write FFieldName;
property FieldWidth : Integer read FFieldWidth write FFieldWidth;
end;
//Now we have a attribute defined we create a object which will use that attribute on a property.
//If you take a look at the property Field you notice it on top of that property there is a [TMyAttribute] tag.
//This is how you add a custom attribute on top of a property.
//I also added a property Data without a custom attribute to show the difference.
//
type TFoo = class(TObject)
private
FField : string;
FData: string;
published
[TMyAttribute('VELD1', 60)]
property Field : String read FField write FField;
property Data : string read FData write FData;
end;
type TRttiTest = class(TObject)
public
procedure rttiDemo;
end;
constructor TMyAttribute.Create(const FieldName : String; fieldWidth : integer);
begin
FFieldName := Fieldname;
FFieldWidth := FieldWidth;
end;
//here we are going use <del datetime="2011-05-20T19:01:35+00:00">RTTY</del> RTTI to go through the properties, check/read the attributes on the property and
//Take some action on it.
//
procedure TRttiTest.rttiDemo;
var
oFoo : TFoo;
oRttiType : TRttiType;
oRttiContext : TRttiContext;
oAttrib : TCustomAttribute;
fFieldName : String;
fFieldWidth : integer;
begin
try
oFoo := TFoo.Create;
oRttiContext := TRttiContext.Create;
oRttiType := oRttiContext.GetType(oFoo.ClassType);
for oAttrib in oRttiType.GetAttributes do
begin
if oAttrib is TMyAttribute then
begin
fFieldName := TMyAttribute(oAttrib).FieldName;
fFieldWidth := TMyAttribute(oAttrib).FieldWidth;
...
end;
end;
finally
FreeAndNil(oFoo);
FreeAndNil(oRttiContext);
end;
end;
</pre>
<p>As you can see custom attributes can be quite handy. I used it within a application that creates and maintains the database behind it based on the object structure. When a new property is being defined the application automatically creates the new field into the database for me when saving the contents of that object. This system gives me more time for development purposes instead of database management etc. Off course this was my choice of using the attributes system.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2011/04/custom-attributes-in-delphi-2010/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Is PHP an Application</title>
		<link>http://lenss.nl/2008/08/is-php-an-application/</link>
		<comments>http://lenss.nl/2008/08/is-php-an-application/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 08:50:58 +0000</pubDate>
		<dc:creator>Thijs Lensselink</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://lenss.nl/blog/?p=103</guid>
		<description><![CDATA[At the office here they are trying to make a portfolio about the stuff we build. The strange thing is they also want to add a list of day to day applications we use. The question came up if we need to add PHP to the list. One of our Delphi/Pascal programmers thought adding the [...]]]></description>
			<content:encoded><![CDATA[<p>At the office here they are trying to make a portfolio about the stuff we build. The strange thing is they also want to add a list of day to day applications we use. The question came up if we need to add PHP to the list. One of our Delphi/Pascal programmers thought adding the Delphi programming language would be good. I argued that Delphi is not an application but a programming language. Turns out we have a different view on this.</p>
<p>While we build almost every web related bit in PHP. i don&#8217;t see it as an application. And application is a layer between the low level computer and the user. The application does what the user wants to preform on the computer. An application can be anything from a simple text editor to a full blown IDE.</p>
<p>And all these applications have one thing in common. They are written in programming languages. Without programming languages there would not be any applications. O well. just my point of view :)</p>
<p>UPDATE*</p>
<p>Ok so i had a good discussion with one of the other Delphi guys. And seems we talk different about the same subject. As i work soly on PHP. PHP is my programming language. And it&#8217;s also the interpeter living on the server. So really it&#8217;s both an application and a programming language. Now i understand what the Delphi guys meant.</p>
]]></content:encoded>
			<wfw:commentRss>http://lenss.nl/2008/08/is-php-an-application/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
