tag:blogger.com,1999:blog-101136752024-03-13T03:50:49.919-04:00Tech StoriesTales from the PC.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.comBlogger124125tag:blogger.com,1999:blog-10113675.post-83611787912228782892020-12-26T13:54:00.002-05:002020-12-26T13:54:36.748-05:00A painless self-hosted Git serviceRemember how a part of my <a href="http://estebanp.blogspot.com/2020/12/a-walk-in-cloud.html" target="_blank">NAS setup</a> was to host my own Git server?<div><br /></div><div>Well that forced me to review options and I stumble into <a href="https://gitea.io/en-us/" target="_blank">Gitea</a>. A extremely sexy GitHub replica with more spices and lighter profile.</div><div><br /></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitQPLqPVqXSIiOcp5Xz6cmSO3wNcH0V_o1nFGZgO-rEym5qKfnQareWNoaZhCrWS0kh7bfd3Bxs0wMhOGHk5hmZScNnTUexzJ-D3r9Er4EltMQxk9bnQSqjXWamy03h95Ry5CoKg/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="569" data-original-width="1234" height="148" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitQPLqPVqXSIiOcp5Xz6cmSO3wNcH0V_o1nFGZgO-rEym5qKfnQareWNoaZhCrWS0kh7bfd3Bxs0wMhOGHk5hmZScNnTUexzJ-D3r9Er4EltMQxk9bnQSqjXWamy03h95Ry5CoKg/" width="320" /></a></div><br /></div><div><br /></div><div>It was a breeze to set it up and it has all the goodies we have grown to love in GitHub. Host it on your own PC, NAS, docker container, whatever, it is just great. We have uploaded our archive repository on it (around 600MB of just code) and it's handling with no issues.</div><div><br /></div><div>You can control organizations, teams, users, private/public profiles, setup the configuration in PostgreSQL, MySQL or MSSQL it is all possible.</div><div><br /></div><div>So, if you want to avoid dependencies on external companies or avoid future charges for it. Browse around on the Gitea site.</div><div><br /></div><div><br /></div><div><br /></div>Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-52958331166149930102020-12-23T21:06:00.002-05:002020-12-26T13:37:20.910-05:00A Walk in the Cloud<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDI2XZ-d0o8_PrzFCletjjYPMbINO2giclYIWHgF81MhY0VFETm4idI0xadgNzmgrGlV7Npk79r6Ur4loq98m2FUn8dBqDsvm8VPHDThObaYLpB0CD03ySiAN3why_-DW-CgN5wg/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="301" data-original-width="352" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDI2XZ-d0o8_PrzFCletjjYPMbINO2giclYIWHgF81MhY0VFETm4idI0xadgNzmgrGlV7Npk79r6Ur4loq98m2FUn8dBqDsvm8VPHDThObaYLpB0CD03ySiAN3why_-DW-CgN5wg/" width="281" /></a></div><br />There will be a moment in your life when you have enough gadgets and computers at home that you will start to worry about what will happen if you lose one of them. Everybody does the IP68 test of throwing the phone to the toilet, so suddenly those photos, contacts and things that you treasure may go to Alice in Borderland and you definitely don't want that.<p></p><p>My phone wasn't IP68 complaint and my scripted backups and online cloud settings were not enough to backup all my data (I hate paying yearly subscriptions.. ok fine, movies are an exception) so I decided to do a Keanu Reaves and do a Walk in the Clouds by setting up my own.</p><p><b>The objective</b></p><p>1. Phones. All contacts, photos and important files to be backed up.</p><p>2. PCs. Backup all virtual machines, databases on a set schedule.</p><p>3. Photos. Terabytes of pictures stored everywhere to be uploaded and kept safely on the NAS.</p><p>4. Clouds. Get out of it. Google Drive, Microsoft One Drive, DropBox. Back up all their data into the NAS and keep it synch so any new stuff added there to be automatically copied back home.</p><p>5. Email. Extract all the emails from my gmail, outlook and other third party mail providers and kept it in a searchable format in case of a problem with any of my accounts.</p><p>6. Git. A git server where all my code will reside.</p><p>7. Space. I need around 8 TBs of space, probably I will just end up using 3/4 but I'm certain that once space is not an issue, things will star to grow, plus the more gadgets we add the more data we collect.</p><p>8. Lots of redundancy. Minimum one, better two disk failure redundancy.</p><p><br /></p><p><b>The Chosen One (</b>Is that you Anakin?)</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBDFAcNzit597SV3I4TNwDI9LuV1yKyCTUNmdukr9WcmlGFYet2uorM85Gdnj2wCubtE5pwwJAIYPvmsdBHxya02yxiMIx4gHVS98ETNfTq3P-rrM9rdDW5PB_6s0w_p-jgeRwJA/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="315" data-original-width="485" height="208" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBDFAcNzit597SV3I4TNwDI9LuV1yKyCTUNmdukr9WcmlGFYet2uorM85Gdnj2wCubtE5pwwJAIYPvmsdBHxya02yxiMIx4gHVS98ETNfTq3P-rrM9rdDW5PB_6s0w_p-jgeRwJA/" width="320" /></a></div><div style="text-align: center;"><i>Synology DS1520+</i></div><p><i></i></p><div class="separator" style="clear: both; text-align: center;"><br /></div><p></p><p>Why this one? well you have plenty of options out there, QNAP, ASUSTOR or built your own NAS but life is short and I wanted the most user friendly software interface to interact with your NAS system out there. I wanted to be up and running in no time with all my data safe and available on the shortest time possible.</p><p>That being said, I needed 2 disk redundancy, we are talking about a RAID 6 (or equivalent), so a 4 bay was a minimum. 5 bay is just a little future proofing on my part.</p><div><b>The Setup</b></div><p>1. 4 X 4TB Ironwolf NAS disks.</p><p>This may imply a juicy 16TB of space but I ended using Synology's homebrew RAID 6 variant called SHR 2. Which combines RAID 6 with the flexibility of adding extra HDDs of mixed capacity and use the additional space once I have all the HDDs of the same size without having to rebuild the array. This means giving up 2 full disks for the sake of redundancy. Long story short, final space available 7.6TB. So that extra slot is key, because later on I can add an extra 4TBs without penalization.</p><p>2. Dual 1Gb lines to my router. The Synology supports link aggregation/bonding so I can have up to 2Gb output in absense of a higher bandwidth wiring around the house and a router that supports it.</p><p>3. 1TB WD NVME module for read-only cache purposes. Useful for small constant files aka photos, which is the bulk of the load of this NAS.</p><p>4. 8 GB RAM, max out which could be an issue but we'll see.</p><p>5. Intel Celeron J4125. Yes, I know. There are Ryzen servers but others specs go up and as such price do to. So far my use cases are not on the range of having to go up in CPU power being mainly a storage solution.</p><p><b>The Result </b></p><p><b></b></p><div class="separator" style="clear: both; text-align: center;"><b><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigDpEOMnxTlWSNMiAvawy0hVlU0wb_Y_Q3hZPgaPar0hkRsdFvBbWpIJZMMzkl_xjS7mOyVJOUnrbc2uO_zcfmcxXAGezYEnMv-qTKFAhtYWTght8kElmPF32hnGzSCrSkvNfSUg/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="319" data-original-width="350" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigDpEOMnxTlWSNMiAvawy0hVlU0wb_Y_Q3hZPgaPar0hkRsdFvBbWpIJZMMzkl_xjS7mOyVJOUnrbc2uO_zcfmcxXAGezYEnMv-qTKFAhtYWTght8kElmPF32hnGzSCrSkvNfSUg/" width="263" /></a></b></div><b><br /><br /></b><p></p><p>This is where the Synology ecosystem shines. </p><p>1. <b>Phones</b>. I was able to setup Synology Moments to backup all our phone photo folders and download almost immediately any new photo that I take. Moments itself is worth a different post due to some extremely good features that I appreciate on handling photos.</p><p>2. <b>Contacts</b>. It was easy to setup a contacts server which synchronizes with any popular android vCard software. It also allowed me to access my Google Drive and Outlook accounts and synchronize with them centralizing all my contacts. It was really a matter of a couple of clicks.</p><p>3. <b>Photo Archives</b>. Drag and drop thousands of photos into the folder structure of the NAS and after being copied, Moments will indexed them and apply some AI magic to have them ready to be seen and share on your phone or any other device.</p><p>4. <b>Email</b>. You can setup a web mail client on your personal cloud and enable pop3/Imap features to access your other email accounts downloading all their content into your inbox without deleting the original email.</p><p>5. <b>Git server</b>. Still having trouble with it. SSH is mandatory and I still need to play a bit more with the popular GUIs like TortoiseGIT, SourceTree, etc. Console is there, but its 2020, why do I want to use the console If I can avoid it.</p><p>6. <b>VM backups, DB backups</b>. Integration with MSSQL a piece of cake. VM Backups, still working on it. I don't use vmware vSphere or Hyper-v (I'm more of a xcp-ng guy (xenserver)) so going slow there.</p><p><b>Conclusion</b></p><p>How on Earth I was surviving without a NAS at home. No idea. I'll keep some of my data on Google, MS just for ease of access but otherwise, I'm walking in My cloud now.</p><p><b><br /></b></p><p><b>WARNING</b></p><p>A NAS is not a backup. You still need to have an additional layer to safe guard your data. </p><p><br /></p>Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-88234187844687403662014-08-10T22:04:00.000-04:002014-08-10T22:04:11.878-04:00Toronto Agile and Software 2014!Don't forget to subscribe to the Toronto Agile Community to receive a notification of the specific dates and subscription to the <a href="http://www.torontoagilecommunity.org/display/PUBLIC/Toronto+Agile+and+Software+2014">Toronto Agile and Software 2014</a> conference to happen in November.<br />
<br />
A must for all Agile practitioners!Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-39353452955958802692014-05-27T18:15:00.000-04:002014-05-27T18:15:29.673-04:00Developer Skill Sprints Webminar is available, join now!Do not miss the oportunity to get some nice tricks with Delphi XE6. Subscribe to the latest <a href="http://forms.embarcadero.com/DeveloperSkillSprintsWebinarSeries?cid=701G0000000tP05">Embarcaderos Webminars</a>. My personal favorite: "Remote Control of a Windows App from a Mobile Device".<br />
<br />
<span style="background-color: #cccccc; font-family: Arial; font-size: 12px; line-height: 18px; text-align: justify;"><br /></span>
<span style="background-color: #cccccc; font-family: Arial; font-size: 12px; line-height: 18px; text-align: justify;"><br /></span>Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-34465140681206246392009-10-03T20:27:00.000-04:002009-10-03T20:47:05.359-04:00Lost your ethernet cards on your VM?This tip may help you.<br /><br />We use virtualization A LOT on our environments, as a symbol of trust to this concept we only have half of our web production servers as real machines, the other half is virtualized.<br /><br />A common issue we found is that after installing SP2 on a Windows 2003 Ent/Standard installation or simply after installing certain security updates on Windows 2003 Ent/Standard R2 installations we lost sometimes the ethernet cards of the Virtual Machines (VM).<br /><br />Well, the solution is quite simple, this problem usually only happens when you have not installed the client VMware tools, after installing them and restarting the Virtual machine you will be back in business.<br /><br />Strange? yup. Drove me nuts a couple of times.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com8tag:blogger.com,1999:blog-10113675.post-61734675680758372462009-09-29T03:01:00.000-04:002009-09-30T13:41:19.788-04:00Squeezing a Cabinet file.As part of our applications automatic update process we transfer a CAB file to the client side that contains the required updates. <br /><br />Lately we've being using certain components that are increasing the "weight" of our applications to the point that it is becoming a bit slow to transfer these cab files. The immediate solution to this situation was to review the compression rate of the CAB files to compensate for the additional weight of the applications. <br /><br />The interesting part of this "simple" procedure was to look at the command line help of the <span class="blsp-spelling-error" id="SPELLING_ERROR_0">makecab</span>.<span class="blsp-spelling-error" id="SPELLING_ERROR_1">exe</span>, around four lines and none of them telling us what we could do to help us on this topic. Nothing that some searching and reading can not fix, so if anyone ever has the need of adjusting its CAB compression ratio here it is the solution:<br /><br />The CAB format allows you to use three compression methods: Deflate, Quantum and <span class="blsp-spelling-error" id="SPELLING_ERROR_2">LZX</span>. Obviously we pick the always effective <span class="blsp-spelling-error" id="SPELLING_ERROR_3">LZX</span> algorithm, which you can enable by using this command:<br /><br /><span class="blsp-spelling-error" id="SPELLING_ERROR_4">MAKECAB</span>.<span class="blsp-spelling-error" id="SPELLING_ERROR_5">exe</span> /D <span class="blsp-spelling-error" id="SPELLING_ERROR_6">CompressionType</span>=<span class="blsp-spelling-error" id="SPELLING_ERROR_7">LZX</span> /D <span class="blsp-spelling-error" id="SPELLING_ERROR_8">CompressionMemory</span>=21 /L ..\Output File1 File2.CAB<br /><br />Where File1 is the file you want to compress and File2.cab is the resulting file. "/L" indicates an output directory. <span class="blsp-spelling-error" id="SPELLING_ERROR_9">CompressionMemory</span> is the level of compression under the algorithm in question, 21 seems to be the highest.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-24884217500516627512009-09-28T00:55:00.001-04:002009-09-28T01:04:30.729-04:00There is a business opportunity EVERYWHERE.It is a matter of "simply" finding them. <br /><br />If there is a need, there is an opportunity. Native cross platform? for me opportunity! 64 bits? semi-opportunity, for some it is very needed, for some others is just a way of showing management that our cool language and IDE supports the latest trends and we are as "fast" as any managed 64 bits and actually "faster" because we are native. (You must understand that's for management, so, save all the technical no no argument, that is why is on quotations.)<br /><br />The latest example of a good opportunity, and someone going after it is <a href="http://www.captcha-bypass.com">this</a> website that <span class=""></span><a href="https://forums.embarcadero.com/profile.jspa?userID=3480">Eko Indriyawan</a> one of our community members post on the Delphi forums.<br /><br />It looks legit and actually from a technical point of view gets me thinking on the implementation they used to build it. I'm pretty sure tons of spamming companies will give it a try. It will mean a quick cash flow for the creators which probably will die soon after, but will get someone making good money for a bit.<br /><br />ahh so nice, the beautiful process of finding opportunities keeps going...Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com5tag:blogger.com,1999:blog-10113675.post-29292519436966627952009-08-31T15:46:00.001-04:002009-08-31T15:48:39.059-04:00DevExpress now officially supporting Delphi 2010.Well, they were quick to deliver and now it is official. DevExpress is supporting Delphi 2010 and it is available for download to all their license holders.<br /><br />The new Express Install, v1.46 includes full support for Delphi 2010 and C++ Builder 2010 to the following VCL components:<br /><br />ExpressQuantumGrid v6<br />ExpressQuantumTreeList v5<br />ExpressVerticalGrid<br />ExpressPivotGrid v2<br />ExpressScheduler v3<br />ExpressBars v6 and Docking Library<br />ExpressNavBar v2<br />ExpressEditors Library<br />ExpressSkins Library<br />ExpressSpreadSheet<br />ExpressLayout Control<br />ExpressPageControl<br />ExpressDBTree<br />ExpressFlowChart<br />ExpressOrgChart<br />ExpressSpellChecker<br />ExpressPrinting System v3<br /><br />Very good news indeed, Enjoy!Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com1tag:blogger.com,1999:blog-10113675.post-81459516805800620112009-05-14T13:04:00.000-04:002009-05-14T13:08:07.552-04:00Follow Delphi Live!If you were one of the unlucky (like me) that could not assist to Delphi Live, follow the instant updates from lots of Delphi developers that are having a great time at it, this is the link at <a href="http://search.twitter.com/search?q=delphilive">Twitter</a>.<br /><br />Nick Hodges is coming up next with an update on the Delphi Roadmap, so, what can be more exciting than that!<br /><br /><br />GOGO Delphi!Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-12222037043815350042009-04-06T20:50:00.000-04:002009-04-06T20:56:12.041-04:00Time for new looks...Well,<br /><br />Lately we've seen a lot of websites changing their look to get into the web 2.0 fashion, and my favorite resource center for all Delphi related data is no exception. The ultra fast and cool, Delphi made FullTextSearch.com (Tamarack) has a new address and look in <a href="http://www.codenewsfast.com/">http://www.codenewsfast.com/</a> under the umbrella of HREF Tools.<br /><br />Congratulations, can't wait to see the benefits of migrating to Delphi 2009 in the months to come!.<br /><br />If you were not using this full text search engine for the Delphi and C++ Builder community and third party newsgroups, it is time you do it. Go and check it out!.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com1tag:blogger.com,1999:blog-10113675.post-89454668599920418822009-03-24T17:41:00.001-04:002009-03-24T17:48:45.939-04:00The future in our fingertips...So, we loved the BlackBerry and what they did with that little ball on their keypad. Then Apple came and show us how amazing it is to use our fingertips on screen touch technology, in the meanwhile Microsoft amazed us with their Microsoft Surface, but what is next?<br /><br />After I saw <a href="http://www.ted.com/index.php/talks/pattie_maes_demos_the_sixth_sense.html">this video</a>, I just laughed and enjoyed the fact that we live in very exciting times, StarTrek, StarWars and more getting closer to our time. Once reality came back to my senses, I went back to my Delphi 2009 and kept working on creating the coolest systems I can, with the language I love.<br /><br />Enjoy these times and enjoy life.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com3tag:blogger.com,1999:blog-10113675.post-51078318435068516982008-09-05T00:37:00.000-04:002008-09-05T00:38:55.811-04:00You gotta love the TIOBE headline for September.Want to find out what it is?<br /><br />Go and check it <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html">out!</a>Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-20922211216711878072008-09-02T22:58:00.000-04:002008-09-02T23:59:05.830-04:00Credit Card number validator for DelphiWe are implementing parts of a global electronic payment solution and one of the mandatory features was to verify credit card numbers. This is done using the <a href="http://en.wikipedia.org/wiki/Luhn_algorithm">Luhn algorithm</a>. I was expecting to find a wide variety of implementations on our sexy Delphi language but to my surprise there were very few hits on my search.<br /><br />So, for others that may needed, I'm including this small routine that validates the credit card number (not the card secure code, nor the expiration date). There are several implementations on the web that based on the card prefix digits you can determine the kind of card you are looking at (VISA, MC, Dinners, etc.) That kind of inferences are not reliable for a global solution so the decision was made to drop that auto detection.<br /><br /><blockquote></blockquote><blockquote></blockquote><blockquote style="font-family: courier new;"><span style="font-size:85%;">function ValidateCreditCardNumber(CreditCardNumber:string):boolean;<br /><br />Const<br /> DigitsAllowed = ['0'..'9'];<br /> MaxCCSize = 19;<br /> MinCCSize = 13;<br /><br /> var<br /> i : integer;<br /> CleanCardNumber: string;<br /> digit: Integer;<br /> CheckSum: Integer; { Holds the value of the operation }<br /> Flag: Boolean; { used to indicate when ready }<br /> Counter: Integer; { index counter }<br /> PartNumber: string; { used to extract each digit of number }<br /> Number: Integer; { used to convert each digit to integer}<br /><br /><br />Begin<br /> CleanCardNumber:='';<br /> digit:=0;<br /><br /> // Remove any non numeric value<br /> for I := 1 to Length(CreditCardNumber) do<br /> Begin<br /> if CreditCardNumber[i] in DigitsAllowed then<br /> CleanCardNumber:= CleanCardNumber + CreditCardNumber[i];<br /> End;<br /><br />// Check for valid card length number<br /> if (Length(CleanCardNumber)<minccsize)>MaxCCSize) then<br /> Begin<br /> Result:= False;<br /> Exit;<br /> End;<br /><br />// get the starting value for our counter<br /> Counter := Length(CleanCardNumber);<br /> CheckSum := 0;<br /> PartNumber := '';<br /> Number := 0;<br /> Flag := false;<br /><br /> while (Counter >= 1) do<br /> begin<br /> // get the current digit<br /> PartNumber := Copy(CleanCardNumber, Counter, 1);<br /> Number := StrToInt(PartNumber); // convert to integer<br /> if (Flag) then // only do every other digit<br /> begin<br /> Number := Number * 2;<br /> if (Number >= 10) then<br /> Number := Number - 9;<br /> end;<br /> CheckSum := CheckSum + Number;<br /><br /> Flag := not (Flag);<br /><br /> Counter := Counter - 1;<br /> end;<br /><br /> result := ((CheckSum mod 10) = 0);<br /><br />End;</span></blockquote><br />This implementation is based on a 1996 VB Code migration from Shawn Wilson.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com3tag:blogger.com,1999:blog-10113675.post-6678390849118736322008-07-17T12:40:00.000-04:002008-07-17T18:39:27.522-04:00Tiburón swimming in Lake Ontario.For the first time, a <span class="blsp-spelling-error" id="SPELLING_ERROR_0">Tiburón</span> was found last night swimming around the North York Public Library and people is wondering if they are coming out from Lake Ontario.<br /><br />But, such a thing seems to be untrue. All points out that our visitor came from Silicon Valley.<br /><br /> Yup!, we had the pleasure to listen to no other than legend <span class="blsp-spelling-error" id="SPELLING_ERROR_1">CodeGear</span> developer David <span class="blsp-spelling-error" id="SPELLING_ERROR_2">Intersimone</span> and Anders <span class="blsp-spelling-error" id="SPELLING_ERROR_3">Ohlsson</span> (<span class="blsp-spelling-error" id="SPELLING_ERROR_4">geesh</span>, hope i got his lastname right). They gave us a good talk about CodeGear, Embarcadero and tour of <span class="blsp-spelling-error" id="SPELLING_ERROR_5">Tiburón</span>, called now <span class="blsp-spelling-corrected" id="SPELLING_ERROR_6">officialy</span> "Delphi 2009".<br /><br /> The highly expected Unicode support is everywhere and it seems that the guys put lots of effort on achieving a high degree of backwards compatibility, which is as usual, a fantastic tradition that thankfully Delphi has never lost.<br /><br />Lots of new classes to help us on this transition, some new enhancements to the <span class="blsp-spelling-error" id="SPELLING_ERROR_7">VCL</span> (some cool new components there) which you probably already saw on all the blog posts that <span class="blsp-spelling-error" id="SPELLING_ERROR_8">CodeGear</span> is generating now.<br /><br />BUT, now lets talk about those hidden gems that we could see while they were demoing stuff, for example, a new little <span class="blsp-spelling-corrected" id="SPELLING_ERROR_9">category</span> to the component tool palette, something called "Ribbon Components", yup, they didn't mention it, they didn't demo them, but it was there. So, no <span class="blsp-spelling-error" id="SPELLING_ERROR_10">NDA</span> violation here, nor there, merely healthy speculation.<br /><br />Also I noticed two more categories, and I am extremely happy about them, because it means that we are finally getting some love on the <span class="blsp-spelling-corrected" id="SPELLING_ERROR_11">middle tier</span> area. It seems to be part of the announced improvements to <span class="blsp-spelling-error" id="SPELLING_ERROR_12">DataSnap</span>, a "Data Snap Client" and "Data Snap Server" categories, instead of the typical single "<span class="blsp-spelling-error" id="SPELLING_ERROR_13">DataSnap</span>" group. What is in there, no idea, but hey, i like the hint.<br /><br /><br />Anyway, it was a great time, a great experience, Delphi is getting better. The guys seemed to be pump about the future, and so are we.<br /><br /><br />Oh, and did I mention that we are hiring? :)<br /><br /><br /><span style="text-decoration: underline;"></span><a id="Bloggers__ct8_Hyperlink1" class="blogname" name="Hyperlink1" title="The Hacker\'s Corner" href="http://blogs.codegear.com/ao/"></a>Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com2tag:blogger.com,1999:blog-10113675.post-71040804906095700062008-04-30T01:12:00.000-04:002008-04-30T01:37:08.243-04:00How to create a Web Server Control in ASP.Net with Delphi 2007We were presented with the challenge of creating our own server controls. After some research on the web, we found very few examples regarding how to do this, even less if they are specifically targeted to Delphi.Net 2007.<br /><br /> So, in order to help the next fellow Delphi developer that is presented with similar situations, it is our objective to publish small articles on every new item that we face in our development process as a contribution to the new Spirit of Delphi that is growing in the community.<br /><br /><span style="font-size:100%;">Special thanks to <span style="font-weight: bold;">Feryal Badili</span> for putting this article together. :)</span><br /><br />Here is the step-by-step instruction on how to create a simple server control in Delphi 2007.<br /><br />Well, there are two ways to create web components in Delphi:<br /><span style="font-weight: bold;">1)</span> You can go to 'File-New-Other-Delphi for .NET Projects' and choose 'Web Control Library'.<br /><span style="font-weight: bold;">2)</span> OR, you can go to 'File-New-Other-Delphi for .NET Projects' and choose 'Package'. Then in project manager panel, right click on 'Contains' folder and select 'Add new-Other-Delphi for .NET Projects-New ASP.NET Files' and select 'Web Custom Control'. You may want to use this approach if you would like to have multiple controls in the same package.<br /><br />The general recommendation is to use the first method to create a web custom control for the first time, it is a lot easier in the long run, believe me.<br /><br />Delphi will generate the source code for a very simple web control. Let's just try to understand it:<br /><br />The default name for the file is 'WebControl1.pas' . It is a Delphi unit file and the unit name is really your namespace. You need to remember that because you're going to need it later when you are using the control in your web page!<br /><br />Under 'Type' section of the code, you will see the following lines:<br /><br /><blockquote><span style="font-family:courier new;">[DefaultProperty('Text'),</span> <!--{0}:MyWebControl1--><span style="font-family:courier new;"> ToolboxData('<{0}:MyWebControl1 runat=server>')]</span> <span style="font-family:courier new;"> MyWebControl1 = class(System.Web.UI.WebControls.WebControl)</span><br /></blockquote><br />Well, what does it mean?<br />Your class MyWebControl1 is derived from System.Web.UI.WebControls.WebControl.<br /><br /> If your control renders a user interface (UI) element or any other visible element on the client, you should derive your control from System.Web.UI.WebControls.WebControl (or a derived class).<br /><br /> If your control renders an element that is not visible in the client browser, such as a hidden element or a meta element, derive your control from System.Web.UI.Control. The WebControl class derives from Control and adds style-related properties such as Font, Forecolor, and BackColor.<br /><br /> In addition, a control that derives from WebControl participates in the themes features of ASP.NET without any extra work on your part. If your control extends the functionality of an existing control, such as the Button, Label, or Image controls, you can derive from that control.<br />If you are going to have multiple visual controls in your server component and you wish to inherit the basic functionality of the parent controls, you need to derive your class from CompositeControl class:<br /><blockquote face="courier new">MyWebControl1 = class(System.Web.UI.WebControls.CompositeControl)</blockquote>To learn more about composite controls, see:<br /><a href="http://msdn2.microsoft.com/en-us/library/3257x3ea%28VS.80%29.aspx">http://msdn2.microsoft.com/en-us/library/3257x3ea(VS.80).aspx</a><br /><br />The code inside brackets that is generated on top of your class definition is attributes that apply to your class. To learn more about these attributes, see the following link:<br /><a href="http://msdn2.microsoft.com/en-us/library/ms178658%28VS.80%29.aspx">http://msdn2.microsoft.com/en-us/library/ms178658(VS.80).aspx</a><br /><br />The code generated by Delphi adds a property called 'Text' to your component . Since this property is published, you will be able to see it in the "IntelliSense" or "Code Completion" and object inspector when you use this component in a web page.<br /><br />As you can see, this property also has some attributes:<br /><span style="font-weight: bold;">Bindable:</span> set it to true if your property can be data bound.<br /><span style="font-weight: bold;">Category:</span> In object inspector, this property will appear under the category(group) that you define.<br /><span style="font-weight: bold;">DefaultValue:</span> Obviously, this is the default value of your property.<br /><br />You need to define these attributes for each and every property that you want to publish for your component. Also pay attention to the field definition for your property.<br /><br />Next step is to add your own child controls and render the server control. In order to do that, you need to implement the following procedures:<br /><br /><blockquote><span style="font-family:courier new;"> procedure CreateChildControls(); override;</span> <span style="font-family:courier new;"> procedure RenderContents(Output: HtmlTextWriter); override;</span><br /></blockquote><br />Here is an example of simple server control that includes only one control (TextBox) and adds one property named 'ShowTime' to the control.<br /><br />You can use this component in both Visual studio or Delphi .NET.<br /><br /><blockquote style="font-family: courier new;"><span style="font-size:85%;">unit WebControl1;<br />// To create a more advanced Web Control that supports live data at<br />// design time, see instructions in the readme file located in the<br />// 'BDS\5.0\Source\DotNet\dbwebcontrols' directory<br />//<br /><br />interface<br /><br />uses<br />system.web,<br />System.Web.UI,<br />System.Web.UI.WebControls,<br />System.ComponentModel,<br />system.Drawing,<br />System.Data,<br />system.security.Permissions;<br /><br />type<br />/// <summary><br />/// Summary description for the component<br />/// </summary><br /><br />[<br /> AspNetHostingPermission(SecurityAction.Demand,<br /> Level = AspNetHostingPermissionLevel.Minimal),<br /> AspNetHostingPermission(SecurityAction.InheritanceDemand,<br /> Level=AspNetHostingPermissionLevel.Minimal),<br /> DefaultProperty('ShowTime'),<br /> ToolboxData('<{0}:OpenItems runat=server><!--{0}:OpenItems-->')<br />]<br />OpenItems = class(System.Web.UI.WebControls.CompositeControl)<br />strict private<br /> IsError : boolean;<br /><br /> msgBox : textBox;<br /> FShowTime: boolean;<br /><br />strict protected<br /> procedure RecreateChildControls(); override;<br />protected<br /> procedure RenderContents(Output: HtmlTextWriter); override;<br /> procedure CreateChildControls(); override;<br />public<br /> constructor Create;<br />published<br /> [Bindable(false),<br /> Category('Behavior'),<br /> DefaultValue(false),<br /> Description('Show the Date and Time')<br /> ]<br /> property ShowTime : boolean read FShowTime write FShowTime;<br />end;<br /><br />implementation<br />uses SysUtils;<br /><br />/// <summary><br />/// Define a public parameterless constructor needed by web controls.<br />/// </summary><br />constructor OpenItems.Create;<br />begin<br />inherited;<br />isError := false;<br />end;<br /><br />procedure OpenItems.RecreateChildControls();<br />begin<br />try<br /> EnsureChildControls();<br />except<br /> IsError := false;<br />end;<br />end;<br /><br />procedure OpenItems.CreateChildControls();<br /><br />begin<br /> try<br /><br /> Controls.Clear();<br /><br /> // Create a text box<br /> msgBox := TextBox.Create;<br /><br /> if ShowTime then<br /> msgBox.Text := DateTimeToStr(Now)<br /> else<br /> msgBox.Text := DateToStr(Now);<br /><br /> msgBox.BorderStyle := System.Web.UI.WebControls.BorderStyle(1); // Sets border style to 'None'<br /> msgBox.ForeColor := System.Drawing.Color.get_Red;<br /> msgBox.Style.Item['position'] := 'reletive';<br /> self.Controls.Add(msgBox);<br /> except<br /> IsError := false;<br /> end;<br /><br />end;<br /><br />/// <summary><br />/// Render this control to the output parameter specified, preserving<br />/// cosmetic attribute output generation inherited from standard<br />/// WebControl.<br />/// </summary><br />///</span><br /></blockquote><span style="font-size:85%;"><br /><blockquote style="font-family: courier new;">{$REGION 'Render override'}<br />procedure OpenItems.RenderContents(Output: HtmlTextWriter);<br />begin<br /><br />if not IsError then<br />begin<br /> // There was no error so far, render all components<br /> try<br /> AddAttributesToRender(output);<br /><br /> Output.AddAttribute(HtmlTextWriterAttribute.Cellpadding,'1', false);<br /><br /> Output.RenderBeginTag(HtmlTextWriterTag.Table);<br /> // The table will be very useful when you have multiple visual controls<br /> // included in your component<br /><br /> Output.RenderBeginTag(HtmlTextWriterTag.Tr);<br /> Output.RenderBeginTag(HtmlTextWriterTag.Td);<br /> msgBox.RenderControl(output);<br /> Output.RenderEndTag(); // end td<br /> Output.RenderEndTag(); // end tr<br /><br /> Output.RenderEndTag();<br /><br /> except<br /> // An error happened, just show a message<br /> Output.Write(' '+ 'Unable to create the components');<br /> end;<br /><br />end else begin<br /> // An error happened, just show a message<br /> Output.Write(' '+ 'Unable to create the components');<br />end;<br /><br />end;<br /><br />{$ENDREGION}<br /><br />end.<br /><br /></blockquote><span style="font-size:100%;"></span><br /></span>Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com4tag:blogger.com,1999:blog-10113675.post-28012119624583705442008-04-22T00:13:00.001-04:002008-04-23T09:41:56.233-04:00Creating extended stored procedures on Delphi.<div style="text-align: justify;">Well, originally we were going to implement a sexy Delphi.Net CLR Based Stored procedure now that we are using MSSQL 2005 and hearing all the good things about this highly publicized feature. Sadly, we hit the wall after initial testings showed us the big amount of limitations on the assemblies that we could use and all the exceptions we must made to make it work on MSSQL 2005. For example:<br /><br />* First, you need to enable CLR on the database. (Thats ok.)<br />* Classes must be public and static. (Makes it harder, but we can manage it)<br />* Avoid namespaces with anything that is not the list of "safe" name spaces approved by Microsoft. (mmm)<br />* "Safe" assembly is simply a way of saying "non-microsoft built" assembly. You have a couple more "modes" on how to install your assembly on MSSQL, but as you can read below (MSSQL Online help), it gets touchy, and probably complicated. (yeah, I tried it, got ugly)<br /><br />“<span style=";font-family:courier new;font-size:85%;" >To create an EXTERNAL_ACCESS or UNSAFE assembly in SQL Server, one of the following two conditions must be met:</span><br /><span style=";font-family:courier new;font-size:85%;" >The assembly is strong name signed or Authenticode signed with a certificate. This strong name (or certificate) is created inside SQL Server as an asymmetric key (or certificate), and has a corresponding login with EXTERNAL ACCESS ASSEMBLY permission (for external access assemblies) or UNSAFE ASSEMBLY permission (for unsafe assemblies).</span><br /><span style=";font-family:courier new;font-size:85%;" >The database owner (DBO) has EXTERNAL ACCESS ASSEMBLY (for EXTERNAL ACCESS assemblies) or UNSAFE ASSEMBLY (for UNSAFE assemblies) permission, and the database has the </span><a id="ctl00_rs1_mainContentContainer_ctl20" href="http://msdn2.microsoft.com/en-us/library/ms187861.aspx"><span style=";font-family:courier new;font-size:85%;" >TRUSTWORTHY Database Property</span></a><span style=";font-family:courier new;font-size:85%;" > set to ON. “</span><br /><br />* MSSQL will complaing about the CodeGear assemblies being unsafe, some tweaking is necessary.<br /><br />* Third party assemblies are not welcome on MSSQL. i.e. RemObjects.<br /><br />Well, in summary, after playing with it, adding our assemblies required a lot of code trimming and removing any namespace that has any reference to anything visual (makes sense) even if it is not being used at all. Finally, the detail that just finish helping us to dropped the idea was that we don't have the source code for those "extra" assemblies (RemObjects) that we required and the amount of trimming just got out of control.<br /><br />With one option out we went back to the drawing board with the plan to extend and update an old implementation of "Old School" extended stored procedures, as soon as I open that old project I realized why I never liked working with it, parsing the parameters, checking their types, defining data columns to return a proper record set was simply a big painful and slow process.<br /><br />Thankfully, I was able to find in the vault of memories a great presentation by Berend de Boer made in Inprise DevCon '99 where he explains the general steps to implement them and even included a great piece of source code of the mighty "TSQLXProc" object that simply takes over the painful implementation and takes it to the Delphi way. After that finding Berend's website was easy.<br /><br />For anyone needing this, check this <a href="http://www.berenddeboer.net/delphi/index.html#xp">link</a>.<br /><br />My Kudos to Berend,</div>Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com2tag:blogger.com,1999:blog-10113675.post-46116366875670317532008-04-21T23:58:00.001-04:002008-04-22T00:04:57.093-04:00EVERY DAY TIPS: Manually deleting a windows serviceThere I was playing with setting up subversion server running as a Windows Service until I made a tragic mistake and I get to the point of needing to remove the service that I just recently installed.<br /><br />Ok, fine, as a good Delphi guy, I went looking for that sexy graphic console (Service Manager) that will give me the all mighty power to delete the service, but, I hit a wall after realizing that such an option was disabled for me.<br /><br />So, after googling a bit I found two nice options.<br /><br />1. If you remember the exact name of the service (not the description), you can use the sc command:<br />C:\>sc delete "service name"<br /><br />If you don't know it, then you can go straight to the registry, find your guy and delete it.<br /><br /><code>HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services<br /><br /><span style="font-family: arial;"></span></code>You indeed will need to restart the computer to see these changes fully reflected.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com1tag:blogger.com,1999:blog-10113675.post-31419345980629210202008-04-14T21:50:00.000-04:002008-04-14T21:53:02.021-04:00Delphi for PHP 2 en EspañolWell, great news for my mother language! We have now <a href="http://blogs.codegear.com/andreanolanusse/2008/04/14/delphi-para-php-2-en-espanol/">Delphi for PHP in Spanish!</a>.<br /><br />Yup, just after the official release we are now getting the news of a translation on the Cervantes language.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-43245507968253897692008-01-01T21:38:00.000-05:002008-01-02T10:36:28.155-05:00Truncating your transaction log.First, HAPPY NEW YEAR GUYS!!<br /><br />Now, some actual blogging...<br /><br />Here I was, trying to restore our metadata only database into a production server, getting constantly an error messaging saying that it was waaay to big for the available space. Well, my concern was that the entire back up of the database was only 6MB, and the database itself only contains tables with very basic data.<br /><br />What is worst, the space available on that production drive was 14GB, so gosh, it simply didn't make any sense. Well, after reviewing the original metadata-only database I realized that our constant adding, updating and deleting of structures made our transaction log simply huge. (40gb)<br /><br />So, after some reading I found this nice recipe to cut down the fat of your log database:<br /><br />First, backup your existing log file by running<br /><pre class="code">BACKUP LOG <databasename> TO DISK = '<backupfile>'</backupfile></databasename></pre><br />Now, shrink the transaction log, executing this<br /><pre class="code">DBCC SHRINKFILE (<filename>, <targetsize>) WITH NO_INFOMSGS<br /><br /></targetsize></filename></pre>File name is the transaction log filename and target size you wanted to be, don't be too demanding on the shrinking, but as a hint, I ended up making mine only 1MB cause we don't need a log on our metadata db. :)<br /><br /><br />Update:<br />My apologies, the database in question is MSSQL 2005. Thanks for the feedback.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com3tag:blogger.com,1999:blog-10113675.post-84961303424427589892007-11-15T23:33:00.000-05:002007-11-15T23:36:03.935-05:00Help Update 1 for Delphi 2007 available.Another great sign of constant improvement of my favorite IDE.<br /><br />If you have not get an information dialog from your installation just go to Programs\Code Gear RAD Studio\Check for updates.<br /><br />You can go <a href="http://dn.codegear.com/article/37134/">here</a> to read the install and Release notes, straight from CodeGear.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-2890465824460963922007-10-23T17:24:00.000-04:002007-10-23T22:23:39.790-04:00Migrating from ADO to dbExpress...I finally started.<br /><br />After holding the migration for a long time I am doing it, the reason? well, CodeGear has a renew effort on working on dbExpress, and its latest version dbExpress 4 is a great example of it, with good performance, great connectivity with WIN32 and .Net, support for BlackFish SQL, code included and completely rewritten in Delphi, and lots of improvements on D2007 to work with it like a new SQL Query Editor.<br /><br />My initial testings always showed a better performance with dbExpress than ADO, now add the fact that ADO is being discontinued by MS in benefit of ADO.Net, the choice was a lot easier.<br /><br />But, what I did to migrate thousands and thousands of components? Well it wasn't easy, there was no way I could do it in the form designer, it will simply take years.<br /><br />So just go, open your Data Module, switch to code view, and Find/Replace the following:<br /><br />1. Replace Connection with SQLConnection.<br />2. Replace TADOQuery for TSQLQuery.<br />3. Replace TADOStoredProc for TSQLStoredProc.<br />4. Replace TADODataSet for TSQLDataSet.<br />5. Parameters for Params.<br />6. CmdStoredProc for ctStoredProc.<br />7. Direction for ParamType.<br />8. pdOutput for ptOutput.<br />9. pdInput for ptInput.<br />10. Add under every dataset that uses SQLConnection, Schema = "dbo" or whatever your schema is.<br />11. Remove every parameter item called "@RETURN_VALUE".<br />12. Replace TDateTimeField for TSQLTimeStampField.<br /><br /><br />Geesh, thats what I remember, I will add more to the list if I hit more rocks on the road.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-24307994318633964712007-09-27T22:40:00.002-04:002007-09-27T22:48:21.405-04:00Consolas fonts.Well, I was reading the <a href="http://www.codegear.com/">CodeGear</a>'s <a href="http://dev.newswhat.com/th/borland.public.delphi.non-technical.html">non-technical newsgroups</a>, and found an interesting conversation regarding what kind of font you use on your development IDE, among the recommendations there was the new <a href="http://en.wikipedia.org/wiki/Consolas">Consolas</a> Font from Microsoft. Well, I surrender to temptation, <a href="http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&displaylang=en">downloaded</a> the font, set it up on my RAD Studio 2007 and expected to see something cool in front of me, but.... nothing happened, tried several times, and nothing happened, the IDE didn't recognize the font, nothing changed.<br /><br />Luckily I did my googling and found out <a href="http://www.microsoft.com/typography/ClearTypePowerToy.mspx">this</a> nice tool, that avoided me the trouble to attempt to configure the font from the <a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q247815">command prompt</a> .<br /><br />Well, I did it, restarted my sexy IDE and yahoooo!! I have a nice sexy font. I must admit I like it, it will take a while to feel fully comfortable with it, but i think is here to stay.<br /><br />Try it! you may like it too.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-45855464657622152582007-08-13T00:29:00.000-04:002007-08-13T00:32:33.685-04:00Restarting your application.We are creating a project to automatically update our different modules. That usually implies an application restart, lots of ideas went around, a service that does that, a batch file, or another program working as a proxy of the original one, but, hey, I found <a href="http://delphi.about.com/cs/adptips2001/a/bltip0601_2.htm">this </a>G R E A T article from Zarko Gajic who is always giving amazing tips with Delphi on how to do it in a VERY easy way.<br /><br /><br />Enjoy!Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-55775557438756256402007-08-04T20:55:00.000-04:002007-08-04T23:16:02.367-04:00The overload directive.Well, it is fairly common to use the Delphi's overload directive to create a method with different sets of parameters in an object.<br /><br />What I wasn't aware is that it actually works on functions or procedures that are not part of an object. That is cool.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com0tag:blogger.com,1999:blog-10113675.post-77826414439750138172007-08-02T03:53:00.000-04:002007-08-02T04:14:30.354-04:00RemObjects and DataSnap.I'm using a mix of Delphi's RemObjects SDK and DataSnap on our middletier, and we have implemented session management on all the services and in all the DataSnap remote modules.<br /><br />Thanks to RO, that can be easily done on the DataSnap modules by turning on the RequiresSession property of the RODataSnapModule. Now the only problem with this is during design time, once it is on you will not be allowed to connect to your DataSnap datasetproviders without first logging in. So, as you can read that is a problem.<br /><br />The solution? We added a command line parameter to our application server that simply controls if we want to require a session or not in our services or datamodules. Once that flag is set, we just use it as an indication while we are creating the service/datamodule.<br /><br />Soon, I will post the results of a LETHAL combination, KbmMW, RO and DataSnap in a single SUPER POWERFUL MIDDLETIER MILKSHAKE.Esteban Pachecohttp://www.blogger.com/profile/13637053045278905458noreply@blogger.com2