Delphi for PHP Article 1: A Video Walk Through

Rumors have been flying around for the last month about Borland producing a PHP product. “PHP? Are they nuts?” some said, “Concentrate on what you know! Are you trying to create another Kylix just to have it fade away to nothing?” Needless to say, I was a bit more optimistic than that… I mean come on! RAD PHP development? How cool would that be? PHP has the EXACT same feel as Pacal did back in the late 80s. It’s a baby language just starting to grow up. Even the people in it have the same core “I’m gonna help you because I know later you will help me” attitude that Pascal and Delphi always had.

Plus, since the restructuring of Borland has sifted the chaff from the wheat, CodeGear seems have its act together and the people of CodeGear are really the cream of the crop. (Yes, I know. I just said that they are Cream of Wheat, let it go… just let it go.)

Well, dreams came true when I was invited to be a CodeGear field tester. And last Thursday morning, with the verbiage hot off the presses from the Borland legal department, I was granted a limited exemption from my NDA (Non-disclosure agreement) to pitch a possible Google Summer of Code 2007 joint D4p/WordPress project to Automattic (I’ll let you know later how that turns out…). That NDA exemption also gave me permission to post articles and write reviews of the product. So here we are today!

So, now I can show you tell you all about the cool stuff I’ve been doing and show you movies I’ve made of the product in action.

In my usual fashion, I’ve written a gargantuan article. Instead of posting huge thing, I’m splitting the sections off into separate articles. Today, I just want to give you walk through of the product and show you some of the stuff that makes it unique.

This video uses a pre-release version of Delphi for PHP. Components, look and feel, and features may change before release. THIS VIDEO HAS SOUND.

If you have any problems with the video playback on any browser please let me know and I will try to get it to work.

Sorry for the down time!

The website functioned PERFECTLY as long as you were logged in! HONEST! 

Anyway, Lloyd, Cindy and Joe EVENTUALLY convinced me that they really weren’t insane.  Even my wife told me she got an error on the site, I just thought it was her IE6 gagging on a media file as it is prone to do.

And people think programmers are making it up when they say “Well, it works fine when I do that…”

But hey – what’s 10 hours of down time amoungst friends… Sheesh…

PS. For the record  DO NOT use Anarchy Media Player Plugin 2.0 Beta with version 2.1.2 of WordPress…  Stick with 1.6.5 even though you don’t get buttons on the editor any more.   Or you will get the behaviour I did.  I’ll diagnose it later.

The Code Cave’s 1 year Blogaversary: Confessions of a Code Monkey

     (#)
    (oo)
   (—–)
    >0<

It was one year ago, Feb 28, 2006 to completely precise, that TheCodeCave.com first came on line.  A week later I had a fairly functional website, running WordPress with a theme I was satisfied with and a bunch of great ideas. 

This site was mostly meant for my own convenience as a place where I could put Delphi and PHP code fragments  that I knew I could find later.  I have used it for that again and again and again.  It is a MUCH better resource than Microsoft Outlook’s sent folder.  Plus, now that someone named Meagan works at the office, every time I simply type ME in the To: address of an email, I send stuff to her instead of my home account.  (Sorry, Meagan, for all of those meaningless code fragments in your email account.)

Anyway,  my wife first suggested the name The Code Cave.  Since I liked caving and coding, it made sense to her.  Since it had multiple meanings, I, of course loved, it.  (A code cave, you know, is empty space in an executiple where all sorts of neat treasures can be hidden.)  So it worked.  

A year later, the site has a google rank of 357,000, which is not to shabby in my book.  Especially since I had a couple dry spells of 1 post per month.  I’ve just gotten my first Adsense check deposited and that pays for next year of hosting in full.  So, the site is self sufficient.   I’ve also been told that I’ve helped loads of people (Sweet).  And my life is enriched by coming to know loads of new people I’ve met through the site.

Not a bad year…   Her sites have done well too.  She hosts KnitChat.com of course (where I’d been doing php and WordPress for a whole year before TheCodeCave. came around), and Loom Out Loud, and now  a new knitting magazine site: Loom Knitter’s Circle.

 I plan to do a number of “Posts that never made it” posts, the first one of which was the Delphi source code for turning any 1and1 account into a Dyn DNS server posted yesterday.  I had a whole series of web automation posts planned, but I never put them up.  I hope to get a number of them up. I’ve found that when I stop using this site a repository, and start using it as a blog, I get less code up here and less posts up here. So, the posts will get up here when they get up here.

So, for an old Borland Turbo Prolog/Turbo C/Turbo Pascal coder, my venture into the web has been a good experience…  And I can’t wait to tell you all some of the good stuff that I’ve got going on right now…  I’m juggling a few nifty things right now and hopefully I’ll have some good news to share as a result. I’m smilin’ just thinkin’ about it.

code monkey – noun –

Download link

1. A person only capable of grinding out code, but unable to perform the higher-primate tasks of software architecture, analysis, and design. Mildly insulting. Often applied to the most junior people on a programming team. 2. Anyone who writes code for a living; a programmer. 3. A self-deprecating way of denying responsibility for a management decision, or of complaining about having to live with such decisions. As in “Don’t ask me why we need to write a compiler in COBOL, I’m just a code monkey.”      — The Jargon File

Delphi Demo: DynDNS through your WebHost’s CPanel (e.g. 1and1.com)

aka Dynaminc DNS with 1and1.com

aka How to automate a Web Session with Delphi

 Here’s a program I’ve been beta testing for a few months.  I use it on a subdomain of TheCodeCave.com to allow me to always reach my home.  I use Road Runner Cable from Time Warner and have a dynamic IP address.  That means that my IP can change at any point in time.  And it does!

I used to use the site Dyn.EE to provide a link to my house.   I always liked them because their client is written in Delphi.  However, now that I have TheCodeCave.com and a gazillion subdomains hanging off of it (MyIP.TheCodeCave.com, Webmail.TheCodeCave.com, Rot13.TheCodeCave.com and the list goes on) I thought I would also make an url that connected to my house.

 This was tedious but quite duable to do once.  You just go into the 1and1.com control panel, create the domain, wait for it to become functional, and then modify the DNS settings and override the A record.  Simple right? Well mostly, it is just point and click at what seems logical.

 However, that’s a pain to do on a regular basis because well…

  1. The UI is slow.  The control panel takes for ever to get through.
  2. You have to first look up your own IP address first.  I usually would call my wife and have her send me an email and I’d grab it from the email header and then fix the DNS.  What a pain.
  3. Why suffer through minutes of clicking a few times a year when several hours of programming can get your around it?

So, I give you : The Code Cave’s Dynamic DNS Updater.

The Code Cave's DDNS Updater!

 The usage is simple. 

  1. Create a subdomain on your site and twiddle your thumbs til it becomes active sometime in the next hour or two.
  2. Enter that domain in the first field.  NOTE: If you put your main URL, your main URL will no longer point at your website.  Be careful!  You want this to be something like:  subdomain.example.com
  3. Enter the main password for your account.  This is sent over HTTPS to 1and1.com and not to me.  Have no fear. 😉  But it will appear in the debugging section if you check that “Show IE Data Sent” box.
  4. Click the Update 1and1.com Domain button and watch it work.

Your change should be available almost immediately, however, when debugging this program I sent the change a few (dozen) times and it eventually refused to allow any more updates to go through for another 24 hours.  It’s been fine ever since.  I’ve since changed the program so that does not try to update the DNS if the URL is already correctly set. 

I’ve additionally made the program so that it takes the three fields mentioned above as  parameters.  You can put this into Windows XP’s scheduler and every 15 minutes, it will check the current IP and update as needed.  Or just put it in your startup folder.  This of course means your password will be put into your scheduler, but you have the source code, you can add encryption if that is a concern on your PC.

So, an easy way to do it would be to create a short cut in the startup folder to the program with the parameters like this:

tcc_DDNSUpdater URL PASSWORD DOMAINID

That will look something like this:

tcc_DDNSUpdater dyn.sample.com My1PaSsWoRd  12323213

 The quickest way to get your domain ID is to run the program manually once and just click the Update 1and1.com Domain button.  Then you can see the domain ID below.

 The program follows this procedure recreating the required browsing session (so it is only as fast as your connection to 1and1.com).

  1. Go to MyIP.TheCodeCave.com and get the current IP address (This is a constant in the code and you can change it easily).
  2. Use a socket to retrieve the IP address for the URL you are looking up.
  3. If the two match, terminate the application.
  4. Navigate to Admin.1and1.com and get a session ID needed to establish the secure login.
  5. Login using HTTPS, the domain to update as the user name, and the provided password.
  6. If a Domain ID has not been provided, navigate to the list of domains and retrieve the ID of the domain (The subdomain HAS to be amoung the first 50 domains, alphabetically, on your account.)
  7. Navigate to the DNS update page for that domain (a requirement of the 1and1 Control Panel software)
  8. Submit the DNS record change.

Simple as that!

The full delphi source is available in the Zip file.  The usual “If this crashes your site and costs you $30,000 dollars, why the heck did you run non-standard like this and risk a business site on it!  I’m not responsible for your site’s safety you are.  So consider the very real risk that things can go wrong with demo stuff downloaded off the Internet and err on the side of safety.” warning message applies.

You can download the file here: TCC_DDNSUpdater_Main.zip (link)

 I’ll post details of the code later.

I created this app using a Websession logger that might be of use to you.  I use it in my automation processes at work and also us it to create forum submission links that I could not have book marked on the web in any other fashion.

Enjoy!

TheCodeCave.com Joins Delph Feeds

There’s been a lot happening in Borland lately, specificaly in CodeGear territory.  These are exciting times.  I’ve got a whole lot of stuff that I want to tell you about.  However, first I’d like to introduce you to a site that you may not have heard of: Delphi Feeds.

Delphi feeds is a sort of one-stop-shop for Delphi related projects.  With some new and exciting projects coming out, your gonna be able to keep up to date there.  TheCodeCave ‘s Delphi category has now been added as of the feeds available on that site. 

 So, what that means is we might be getting a little more traffic here.  Also you’ll probably see some re-posts of my favorite Delphi projects I’ve shown here.  Perhaps I’ll update them to run in BDS 2006, Spacely or Highlander. 

What in the world is Spacely and Highlander?  Well, I can’t divulge too many details, but those familiar with the Codegear road maps know that Spacely is the version of Delphi due out at the end of March.  Spacely is the name used while it is in the testing phase. Spacely is an ONLY Delphi 2007 release.  Highlander on the other hand is a the BDS 2006 successor with the full trimmings.  You can find all these details and more by doing a little Googling and by visiting Delphi feeds.

I’ll have a detailed post about the Delphi for PHP release coming up shortly… This product has me the most excited.  It will revolutionize php development.  Please stay tuned…

How do you switch from XP to a Vista computer?

Here’s an interesting tool I found:  the Windows Easy Transfer Companion.

 Apparently “Windows Easy Transfer Companion enables you to automatically transfer your most important programs from your Windows XP-based PC to your new Windows Vista-based PC. This way you can become productive on your new PC as soon as possible. Easy Transfer Companion is designed to be used in addition to Windows Easy Transfer—which transfers your data and settings.”

Basicaly it will use the network to transfer a good portion of your registry from one machine to another.  The really funny thing is that it doesn’t seem to care one jot about whether you have the rights to transfer that software…  That kind-of flies in the face of Microsofts rigid activation policy. 

Anyway, here’s the official word: 

Windows Easy Transfer Companion enables you to automatically transfer your most important programs from your Windows XP-based PC to your new Windows Vista-based PC. The software will move more than 100 of the most popular programs, as well as many others that you may have installed. You have complete control over selecting which programs to transfer, so only the programs you care about will move. The software will alert you if some programs may not be able to transfer, or may not transfer with high confidence. Most security software is not able to transfer due to technical reasons.

Easy Transfer Companion is designed to be used in addition to Windows Easy Transfer—which is part of Windows Vista and automatically transfers your data and settings. Connecting your two computers can be done with either an Easy Transfer Cable (available online, from retailers, and from PC manufacturers), or a home or small business network. If using an Easy Transfer Cable, you must first install Windows Easy Transfer on your Windows XP-based PC. By using Easy Transfer and Easy Transfer Companion you will be able to quickly and easily setup your new PC with all the data, settings, and programs that matter to you, so you can be productive on your new PC right away.

Easy Transfer Companion only transfers programs from a Windows XP-based PC to a Windows Vista-based PC. Easy Transfer Companion is currently in Beta, and only available for the US market.

Giving coffee to Goldfish…

Goldfish from PatrickSwayze.org is getting a large Café Voltaire from my local coffee Arabica Coffee House, or equal funds towards an other beverage that might be more to taste. ;).


The cozy café down the street...
Thanks Goldfish!
Now go check your paypal account! 😉

Goldfish gave me some patient assistance with the RegEx statements required for the EasyWPUpdate script. Without that help, the script would have been weeks away from completion! So, I am going to do my duty and giving thanks, by taking Goldfish out for a drink.

I came across Goldfish and several other helpful characters on the #sed IRC channel on the IRC Freenode network. Now, I’ll admit, that the first thing that comes to mind when I think “IRC” is “IRC?!?!? That SOOOOOOO nineties!”

It was back in the early ninenties that my wife and I spent a lot of time on IRC. We were mostly in the #adoption channel, looking for clues to help find her birth parents (which we did and they are now a very important part of our life). Heck, I used to join the IRC channels back on ARPANet. Anyway I hadn’t touched IRC since then… until three weeks ago.

That’s when Goldfish helped me with the SED stuff. The next night, Goldfish helped bunches more even though I was brain dead from a weary week. There were several other people on the channel who gave me assistence as well. Prec was GREAT and gave me a review of the script and caught some errors with my “Strip CR/LF” routine I’d posted on the website. They suggested that I bounce over to the #bash channel and once there lhunath, jp-_ and the rest of that crew on FreeNode #bash gave great line by line suggestions.

I then had a problem with getting System Shock2 ( a game from the late nineties) working on Windows XP and getting multiplayer going, but then I joined the #SS2 IRC channel and again, there were helpful people there with solutions. So, frankly, I’m once again an IRC fan. All thanks to the Goldfish!

Hey – if you’ve had someone help you lately (not me someone else) consider doing the same… A virtual cup of coffee, a McDonald’s icecream cone, any in expensive little gift can help turn someone’s day around. Give it some thought!

Oh, my gosh…

These people must be absolutely insane! I’ve jump off bridges, rafted advanced white water, free climbed 500ft in the air, gone bumsliding through rivers that have carved gouges into rock so that you just let the river push you where you will. That’s all trusting nature. Nature is dangerous in predictable ways… This is trusting something man made and makes my skin crawl…


Download link 
(DivX is required)

Been really busy lately

I’m still at at work after 15 hours for the third day this week.

So I’ve been scarce lately.

I’m still trying to get time to post something about the 2.1 release and mention the fixes I put into my script…

But I obviously haven’t yet. I typed a reply two or three times to someone in the code cave’s forums (which I haven’t yet announced either) and managed each time to be pulled away onto something and ended up closing the browser…

Plus I had to take my dog in for surgery… Plus the refinance of the house is happening this week….

I’ll catch up one of these days.

RE: the script, I did fix some stuff and put it out in time for the 2.1 release. So, I got the important part done. I just need to write it up…

Hmmm also need to turn in an expense report and pay the garbage bill so they’ll pick up next week… And my nephew’s birthay is Saturday… Oh dagnabbit, it’s 30 minutes till Friday and I haven’t started Sunday school preparations… Hmmm and I’ve got to get the Goldfish some coffee…. At least that I can do tonight…