RJ's blog - stuff that interests, frustrates and fasinates me RSS 2.0
 Monday, November 10, 2008

From The Birthday Message by General John A. Lejeune, 13th Commandant of the Marine Corps

On November 1st, 1921, John A. Lejeune, 13th Commandant of the Marine Corps, directed that a reminder of the honorable service of the Corps be published by every command, to all Marines throughout the globe, on the birthday of the Corps. Since that day, Marines have continued to distinguish themselves on many battlefields and foreign shores, in war and peace. On this birthday of the Corps, therefore, in compliance with the will of the 13th Commandant, Article 38, United States Marine Corps Manual, Edition of 1921, is republished as follows:

"(1) On November 10, 1775, a Corps of Marines was created by a resolution of the Continental Congress. Since that date many thousand men have borne the name Marine. In memory of them it is fitting that we who are Marines should commemorate the birthday of our Corps by calling to mind the glories of its long and illustrious history.

"(2) The record of our Corps is one which will bear comparison with that of the most famous military organizations in the world's history. During 90 of the 146 years of its existence the Marine Corps has been in action against the Nation's foes. From the Battle of Trenton to the Argonne, Marines have won foremost honors in war, and in the long era of tranquility at home, generation after generation of Marines have grown gray in war in both hemispheres, and in every corner of the seven seas that our country and its citizens might enjoy peace and security.

"(3) In every battle and skirmish since the birth of our Corps, Marines have acquitted themselves with the greatest distinction, winning new honors on each occasion until the term "Marine" has come to signify all that is highest in military efficiency and soldierly virtue.

"(4) This high name of distinction and soldierly repute we who are Marines today have received from those who preceded us in the Corps. With it we also received from them the eternal spirit which has animated our Corps from generation to generation and has been the distinguishing mark of the Marines in every age. So long as that spirit continues to flourish, Marines will be found equal to every emergency in the future as they have been in the past, and the men of our Nation will regard us as worthy successors to the long line of illustrious men who have served as 'Soldiers of the Sea' since the founding of the Corps."

Monday, November 10, 2008 9:12:29 AM (Central Standard Time, UTC-06:00)  #    Comments [0] -
Military
 Thursday, September 25, 2008

Making a Client/Server application using Datasnap is pretty straight forward.  The big change over the old DCom design is the connection from client to server, and the server activation method – simply put there is no auto activation.  You’ll have to start the server before running the client.   The old client side TDComConnection is replaced by a TSQLConnection – yes, that’s the same connection component used from the server (TSqlQuery) to the database.

 

Let’s create the server first. 

1.       Create a new VCL forms application, then add a Server Module (File\New\Other – Delphi Files page) to the application. 

2.       From the Tool Palette \ Datasnap Server – drop a TDSServer, TDSServerClass and TDSTCPServerTransport on the applications main form.

3.       For both the ServerTransport and the ServerClass, set the Server property to the TDSSserver component.

4.       On the ServerClass, add an event in for the OnGetClass method.   In the event itself you need to assign the PersistentClass variable to the ServerModule you created in step one.  You’ll need to add it to the main forms uses clause first.  ie.  PersistentClass := TDSServerModule2;

5.       On your Server Module, drop a TSqlConnection, TSqlQuery and TDatasetProvider component.  Set the SqlConnection.ConnectionName to your database,  SqlQuery.SqlConnection to the SqlConnection, and DatasetProvider.Dataset to the SqlQuery.  Also add the SqlQuery.Sql to query a table in your database.

6.       Build the server

 

 

Now that we’ve got the server created, lets build the client.

1.       Create a new VCL forms application.

2.       Drop a TSqlConnection on to the main client form, set the Driver property to DATASNAP.  Assign params for the following Key|Value combinations:  DriverName | Datasnap,  Hostname | LocalHost,  Port | 211.  Note the Port 211 is the default, however you can reassign the client & server ports to a different value.  Each Datasnap server must use a different port, running a 2nd datasnap server that is using the same port of an existing running one will cause a 'Socket already in use' error message.

3.       Add a TDSProviderConnection to the main form, set the SqlConnection property to the TSqlConnection on the client form, and set the ServerClassName to the object name of the TDSServerModule that you created in step 1 of the server (ie.  TDSServerModule1).

4.       Add a TClientDataset, TDatasource, and TDBGrid.   Set the ClientDataset.RemoveServer to the DSProviderConnection, the Datasource.Dataset to the ClientDataset, and the DBGrid.Datasource to the Datasource.

5.       At this point, if you run the server then edit the ClientDataset.ProviderName property, it should show your DatasetProvider in the drop down list if everything is hooked up properly.  Setting the ClientDataset.Active = True should display the results of your query in the DBGrid.

 

That’s all there is to the basics of how to connect a client application to the server using the Datasnap architecture. 

 

Some good reading on the basics of Datasnap:

Thursday, September 25, 2008 1:29:06 PM (Central Standard Time, UTC-06:00)  #    Comments [0] -
DataSnap | Delphi
 Friday, September 19, 2008

Been doing some R&D with the new Delphi 2009 and checking out the new Datasnap architecture, I came across this gem of a problem.  The TDSServerClass CreateInstance calls the TDSServerModule create method, but the TDSServerClass DestroyInstance doesn't call the ServerModule Destroy.  Thus any code put in the destroy isn't called (like closing the database connection), and the ServerModule is a memory leak.  I bumped in to this problem by putting something as trivial as an OutputDebugString into the DestroyInstance event.

Per a comment by Leonel (CodeGear) in the NG's, if there is any code in the TDSServerClass.DestroyInstance, then the intent is that the developer has to free the ServerModule themself.   This violates one of the most basic rules of Delphi, as layed out by Danny Thorpe in his book "Delphi Component Design", that having or not having code in an event by itself alters the component.  The real kicker of this is that the help on the TDSServerClass methods is pretty sparse, and no where does it detail this component changing 'feature'.

The work around to this is either a) don't put any code in the TDSServerClass.DestroyInstances, or if you must then use DSDestroyEventObject.ServerClassInstance to reference the ServerModule and destroy it.

Friday, September 19, 2008 8:25:02 AM (Central Standard Time, UTC-06:00)  #    Comments [0] -
DataSnap | Delphi
 Tuesday, March 04, 2008

Dan and I have been going back and forth all morning regarding the news that Brett is retiring, and I think I finally convinced him that it's the perfect move for Brett to make. 

Yes, it sucks for us fans.  Yes, it is the end of an era.  Yes, Brett will be missed.

But think on this for a minute..   For the past 4 years we've been hearing the news casters, sports commentators and talking heads on the radio saying how Brett doesn't have it any more and how he should retire.  Last season Brett came out looking as good as he ever has, he lead the Pack to a 13-3 season when everyone was expecting them to go 4-12.  They made it to the NFC Championship.   People started saying "he's GOT to come back for another season, if only they get a <some position> they'll win the Superbowl".

Brett pulled a Jerry Seinfeld.  He walked out on top, leaving the audience wanting more.  He pulled a T-Bone (George Castanza) - "All right, that's it for me. You've been great.  Good night everybody!".

The legend will live on for years.. 20 years from now we'll all be reminiscing about the good old days, arguing how the Pack would have won the Superbowl in 2008 if only Brett would have stayed for 1 more year.  We'll be old men in the nursing home, gumming our oatmeal and remembering fondly the Brett Favre era, dreaming about what might have been, what could have been.. if only..

Take care Brett - best of luck to you and the family. You'll be loved, missed, and in our conversations of "the good old days" for decades.

Tuesday, March 04, 2008 10:45:19 AM (Central Standard Time, UTC-06:00)  #    Comments [0] -

 Sunday, February 24, 2008

I've signed up to do another Team in Training event this year, I'll be returning to the Milwaukee Chapter cycling team for another go at Americas Most Beautiful Bike ride.  I've been hemming and hawing about it for a couple weeks now, trying to make up my mind on the committment of it, it does tend to take up a lot of your free time for 4 months. And the commitment to raising the funds can be a bit of a gut check. :)

What finally helped me make my decision was at the bike maintenance seminar the coaches put on, introductions were being made and people were talking about their reasons for doing it. There are some new members for the team, and of them 1 is a survivor (believe that makes 4 for our team), 1 lost a family member to leukemia, and another one has a brother that was diagnosed when he was 9, he's now 13.  That's why we do this, thats what this is all about - making a difference for the survivors and for those that have lost loved ones due to a blood born cancer.  It reminded me of the friends, coworkers and others I talked to last year who had been affected by one of them, and of the things they shared with me.  I recalled the stories I heard at the bike ride last year, the people who were there cheering us on, and knowing that I was helping to make a difference.

The Leukemia and Lymphoma society has made a real difference in the battle against these cancers. 2008 marks their 20th anniverary, in those 20 years 360,000 voluneteers have raised over $850 million to be used for education, research, and helping patients and their families.  In 2007 alone they contributed $66.5 million to support more than 396 researchers in 15 different countries.  And it's all through tax deductible donations from people like you - they receive no federal funding.  They've made real progress, but there is more work to be done.

If you have any questions, please feel free to email me.  If you wish to make an online donation, you can click on the Team in Training image in the top right corner.  On behalf of the Leukemia & Lymphoma Society, I thank you. 

Sunday, February 24, 2008 2:21:30 PM (Central Standard Time, UTC-06:00)  #    Comments [0] -
Random | TeamInTraining
 Sunday, February 10, 2008

Compacting a VirtualPC harddrive seems pretty straight forward the first time you do it.  Make sure the drive isn't in use, open up the VPC console, File | Virtual Disk Wizard | Edit Existing Drive | Select the drive | Compact it.   However after running you will probably find that its either stayed the same or increased in size!

If you read the wizard messages (who really does that though?), you'll see that they state you need to zero out the free space first.  A quick search on MSDN shows a KB article the describes how to Prepare a VPC hard drive.

To properly compact a VPC instance, you'll want to follow these steps.  For reference I'm using VirtualPC 2007.

  1. Start the VPC instance and defrag the drive to start off.
  2. Next click on the CD option on the menu for the VPC instance, select Capture ISO image, navigate to the VPC install directory (program files\Microsoft Virtual PC), and in the Virtual Machine Additions folder there is "Virtual Disk Precompactor.iso".  Open that and it should auto run, compacting the drive(s).
  3. When its done, select the CD menu option again and Release (unmount) the ISO.
  4. Shut down the Virtual PC instance.
  5. In the VPC console, File | Virtual PC wizard | Select the drive you just precompacted | Compact it | Replace or Save original as you desire, and let it run.

Pretty easy once you have the steps, and it can make a big difference in the size of the virtual drive if you're using dynamic drives instead of a fixed sized one.

Sunday, February 10, 2008 10:34:40 PM (Central Standard Time, UTC-06:00)  #    Comments [0] -
utilities

I wanted to copy an existing laptop to a VirtualPC instance.  It's old and had a number of issues (RAM, Win2000, CPU speed, 20gig HD, USB 1.0, to name a few), but I still need to use some of the development tools on the laptop.  Instead of going thru the hassle of trying to find all of the license keys for the software on this laptop (not sure if we even could), I thought the easiest route would be to make a VPC instance and use that on my Dell desktop that has plenty of RAM and CPU. 

We use VPC for archiving build configurations at TIP extensively and it works like a charm. When you have a build environment that you need to save in case you need to patch old source code, instead trying to make the old source work in the new enviroment (new IDE version, updated 3rd party controls, etc), just create a VPC image with that build configuration.  Then if you need to patch any code, its a breeze - start the VPC instance and your off working with a known environment.

I've never tried to clone a whole hard drive before. The research I did lead me to believe that Ghost was the way to go.  However I quickly ran into some problems going down that route - first off you can't be using the drive when you ghost it.  I wasn't able to create a boot disk as the laptop doesn't have a floppy drive, and I ran into issues trying to create a bootable USB or CD with Barts Bootable CD with Networking enabled.   After several hours and much frustration, I came across a newsgroup post that lead me down the correct path, once again I was making it harder than it needed to be.  Here's the easy and cheap (ie. Free) steps I used.  I'm not going to detail the steps as the 2 converters really were quite simple to use.

  1. Attach my external 500gig USB drive to the old laptop so I had a place to put the image.
  2. Convert the existing drive to virtual with VMWare Converter (free version worked fine).
  3. Convert the VMWare image to VPC with VMToolkit converter (free).
  4. Copy the image to my desktop system, and use VPC to crete a new virtual machine using the new VHD drive.
  5. Boot up the image and fix the PNP warnings for new hardware that came up.  I know some people run into problems with blue screens of death and have to use their Windows Install disks to repair the image, but I didn't have that problem.  It booted just fine, and after a couple driver changes & reboots I was off and running.

The only real hassle with the process is that the laptop only supported USB 1.0, so copying 20gig took a LOOONG time. I started the process before I went to bed and it was finished when I got up.  I did run into one problem while running VMWare Converter, it gave me a warning that the Registry wasn't large enough and I had to restart the process.  It allowed 45mb, so I bumped it to 120mb just to be sure there was enough space so I didn't have to restart a 2nd time.


The next step is to clean up the new VPC and remove the unused programs, then compress the VHD down from its 20gig size.
Sunday, February 10, 2008 1:49:55 PM (Central Standard Time, UTC-06:00)  #    Comments [0] -
utilities
 Friday, January 25, 2008

A recent article by Symantec warns of a pharming attack (redirecting your web traffic to another, fake website) that went from the "theoretical" to the "It’s being done now" category. For those that have a home network set up and have their own router, you should pay close attention to this. The goal of redirecting your traffic is to allow them to capture your username, password & account information for sensitive accounts (ie. Banks, Paypal, CreditCards, etc). The attack uses security flaws in some routers, or a lack of proper security measures by others, and changes your router settings. The change could occur from either an HTML based email, or by visiting a compromised website. 

Most people don’t change the default password on their routers. I know that by default Linksys routers have no username and a default password of Admin. One of the easiest ways to beefe up security and prevent these sort of attacks is to change these default settings. Assign / Change the username, and change the password. 

  • Username: don’t use the same name as you log into the computer with, use something unique.
  • Password: never use a simple to guess word, like one you would find in a dictionary. Mix letters, numbers and symbols.

The greater the variety, the harder it is to crack. There is a specific model of routers that doesn’t require any username or password to change the router settings, but I haven’t been able to determine that information yet. This would be a huge security risk, so if I find out what it is I’ll pass it along. There are some really good general security suggestions in the Symantec article, well worth reading.

Friday, January 25, 2008 1:58:15 PM (Central Standard Time, UTC-06:00)  #    Comments [0] -
utilities
Fundraising for LLS
TeamInTraining - Contribute Now
Archive
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910


About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Rich Werning
Sign In
All Content © 2010, Rich Werning
My DasBlog theme is modified from 'Business' created by Christoph De Baene (delarou)