Demonstration: Manipulating the Clipboard in Delphi

February 28, 2006

Here’s a quick demonstration of how easy programming is in Delphi.

This small app allows you to copy text and past it again right away with it converted to proper case or upper case.  This was written for a ZTree user that had a bunch of files that he wanted t rename to partially uppercase.  There was no way to pick out the part of the name he wanted in upper case. So I wrote this routine to allow him to highlight part of the text, hit copy and then hit paste.  And viola, he it would be fixed.

So in Delphi, how do you access the clip board? Well, it couldn’t be simpler.  Just add the clipbrd unit to your uses statement like this:

[delphi]uses Clipbrd;[/delphi]

Then you can read and write to the clipboard  as text like this:

[delphi]A := Clipboard.AsText;
Clipboard.AsText := A + ‘BC’;[/delphi]

Of course it is best to check that you are dealing with text befor you try to get the information back from the clipboard.  That can be done like this:

[delphi]if (Clipboard.HasFormat(CF_TEXT)) then DoIt;[/delphi]

See! It is THAT straight forward.  If you want to see what  other clipboard formats there are, just highlight CF_TEXT in Delphi and hit F1 and you’ll get a full list.

Value Meaning
CF_TEXT Text with a CR-LF combination at the end of each line. A null character identifies the end of the text.
CF_BITMAP A Windows bitmap graphic.
CF_METAFILEPICT A Windows metafile graphic.
CF_PICTURE An object of type TPicture.
CF_COMPONENT Any persistent object.

So the instructions to create a full app are quite simple:
In Delphi, create a new app. In the Object Inspector, Name the main form frmCBFix, change the Border style to bsToolWindow, and change the form style to fsStayOnTop

Place a TEdit on the form and name it editCorrected text, clearing the default text value.

Add Clipbrd to the uses.

Put a TTimer on the form and double click the timer event in the Object Inspector.

Paste the following code into the unit replacing the automatic generated Timer1Timer procedure:

[delphi]{******************************************************************************
ProperCase
Converts a string to proper case by capitalizing each letter after a space or
punctuation. The only common punctuation not used is the apostrophe/single
quote. This avoids changing don’t to Don’T, but will sentences quoted
inside single quotes will not have their first letter capitalized.
******************************************************************************}
function ProperCase(aSrcStr: String): String;
var
Len, Index: integer;
begin
aSrcStr := Lowercase(aSrcStr);
Len := Length(aSrcStr);
aSrcStr[1] := UpperCase(string(aSrcStr[1]))[1];
for Index := 1 to Len – 1
do begin
if (aSrcStr[Index] in [' ','$','"','(',')','`','!','?','<','!','>','#','=','+',':',',','/','.','&','-','{','}','[',']‘,’|'])
then aSrcStr[Index + 1] := UpperCase(String(aSrcStr[Index + 1]))[1];
end;
Result := aSrcStr;
end;

{******************************************************************************
Timer1Timer
Fires periodically (orignally every 250ms), checks the clip board for text,
if it has changed, convert it to proper case and put the result in the
clipboard and the edit control.
******************************************************************************}
procedure TfrmCBFix.Timer1Timer(Sender: TObject);
begin // Timer1Timer
if Clipboard.HasFormat(CF_TEXT)
then begin
if (editCorrectedText.Text <> Clipboard.AsText)
then begin
editCorrectedText.Text := ProperCase(Clipboard.AsText);
Clipboard.AsText := editCorrectedText.Text;
end;
end;
end; // Timer1Timer [/delphi]
And you’re done!

Here are the files for this project:
http://www.TheCodeCave.com/downloads/delphi/CBFixerUpper.exe
http://www.TheCodeCave.com/downloads/delphi/CBFixerUpper.dpr
http://www.TheCodeCave.com/downloads/delphi/u_CBFix.dfm
http://www.TheCodeCave.com/downloads/delphi/u_CBFix.pas

The WordPress 2.0 theme competition ends today

February 28, 2006

Today is the last day for submissions.  I hope this means there are pleanty of good themes coming out soon.  Now that I know a little about this, I realize that this competition is being done the right way.  In reality, appearance, which to the new WordPress user seems to all there is to themes, is MUCH less important than the underpinnings and design of the theme.  In this competion, prizes are being given for How the theme was written and what features it includes.  In stead of, or perhaps in addition to, the theme appearance.  See here: http://kcyap.com/competition/?p=3

Feature: Category choices.

February 28, 2006

It would be neat if a browser could only see the categories on a blog that they are interested in.  If the theme could save a cookie with a bitmap of the blogs themes, the user could ignore stuff like  this that they do not care about.  Why would a delphi programmer care about a possible feature I intend to maybe someday include in a theme May or May Not ever get around to writing.

Feature: TRUE blog pages.

February 28, 2006

The theme must be able to support pages with internal HTML.

This should be done in a way that can be made a standard for other themes and this should be relayed to the other people in the competition prior to the theme releases.  This REALLY should be a standard for WordPress in general.

 In order for me to create a new page at www.KnitChat.com that fits in with the current blog, all I need to do is wrap PHP or HTML in these two lines:

<?php require(dirname(__FILE__).’/includes/custompage_top_yar.php’); ?>

<?php require(dirname(__FILE__).’/includes/custompage_btm_yar.php’); ?>

If I do that, then I can put ANYTHING in there.  Under the current WordPress pages lay out, you are restricted to the type of content allowed in WordPress posts.  That’s insufficient if you want to create true webpages like: www.knitchat.com\fleet.php or www.knitchat.com\subscribetome.php or www.knitchat.com\useronline.php

An option would be to allow the theme options tab to do it by itself…

Feature: Sticky category

February 28, 2006

It would be nice if one of the categories in the blog could be marked as a “sticky” category. Then all posts in that category would always appear first.  For example, the Hello World post should be the first one on this blog until it is better established.

 You should be able to choose which category will be sticky.

Display the program that will run when type a name at the cmd prompt

February 28, 2006

You can also find this file here: http://www.the-wildwest.com/Queeg/Batches/SearchPath.bat





:: *************************************************************************
::  SearchPath.Bat                                               10/31/2005
::  Written by Brian Layman (AKA Capt. Queeg)
::  Visit him at http://www.thecodecave.com/
:: 
::  A batch written to display the program that would be run when
::  a filename is typed at the command prompt.  Just a demo for
::  Hartmut at http://www.ztw3.com/forum/forum.cgi
:: 
::  Usage: SearchPath ProgramName[.EXT]
:: 
::  History:
::     10/31/2005 - BL - Created
::     11/01/2005 - BL - Removed Temp File Usage
::     02/28/2006 - BL - Changed my URL
:: 
:: *************************************************************************
@echo Off
:: All this is boiled down to one subroutine that sets a variable of the
:: same name.
call :SearchedFilePath %1

:: If no program is found, say so.
if "%SearchedFilePath%"=="" echo There is no matching program in the search path

:: If a program was found, echo its name.
if NOT "%SearchedFilePath%"=="" echo %SearchedFilePath%

:: Clear out our temp variable
set SearchedFilePath=

:: Quit
GOTO :EOF
:: *************************************************************************
:: *************************************************************************
::  Support procedures
::
::  These routines are called with a CALL directive and the GOTO :EOF
::  terminates that CALL but does not terminate the entire running of the
::  batch file.
:: *************************************************************************

:: *************************************************************************
:SearchedFilePath
::  Returns the full path to a passed file in the searchpath
::
::  Returns blank if not found.
::
:: *************************************************************************
: set SearchedFilePath= 
  :: Set the default value to blank.
  set SearchedFilePath=

  :: If there is no extension handle it
  if "%~x1"=="" Call :SearchWithExtensions %1&GOTO :EOF

  :: There is no extension, is it blank?
  if "%1"=="" GOTO :EOF

  :: So, we have an extension.  That means we can do a simple search.
  :: %~dp$PATH:1 automatically searches the path for us.  It is a
  :: variable set by the Call command.
  set  SearchedFilePath=%~dp$PATH:1%1
  if "%SearchedFilePath%"=="%1" set SearchedFilePath=&GOTO :EOF
  GOTO :EOF
:: *************************************************************************

:: *************************************************************************
:SearchWithExtensions
::  Iterates the extensions gathered from the PATHEXT environment
::  and searches until the file is found.
::
::  Returns blank if not found.
::
:: *************************************************************************
    :: Initialize a counter for looking at multiple search results in one line
    set cnt=0

    :SearchLoop
      :: Break out after 20  checks.
      :: If you might have more than 20 extensions, increase this value.
      :: If you could find out how many periods there are in the temp file, you could optimize this.
      if "%cnt%"=="20" GOTO :SearchLoopCleanup
      set /A cnt=%cnt%+1
      :: Continually search the single line file returning each sequential search result and recursively pass it to the
      :: SearchedFilePath routine.  When we ask for a token # that doesn't exist and blank is returned, abort out.
      for /F "tokens=%cnt% delims=.;" %%C in ("%PATHEXT%") do call :SearchedFilePath %1.%%C
      if "%SearchedFilePath%"== "" GOTO :SearchLoop
   
    :SearchLoopCleanup
      :: Clear our Temp variable
      set cnt=
  GOTO :EOF
:: *************************************************************************



 

Borland Dies.

February 27, 2006

By now every Delphi programmer knows about this.  But for all others, here you go:

Borland has release the first version of Delphi, since Delphi 5 in 1999ish, that has been truely worth the upgrade price.  Delphi 2006 (D9) pretty much guarantees the success of the company by being the ONLY compiler fill a niche (Win32 development) that MS’s move to dot .net created.  Only ONE of the new MS compilers will allow you to write a Win32 bit app (VC++ still allows it but VB, VC#, VJ# etc do not  Thanks Liviu! ) Delphi is IT for the next 7-10 years while Win32 apps will still be allowed (basically for the life span of Windows XP and Vista).

Having such a high quality tool that practically guaranteed sales in a totally open vertical market, left Borland’s newest poker-playing-turn-around-guy, Tod Nielsen – the newest in a string of CEOs dedicated to the destruction of Borland – no choice but to kill the company by dropping all code development tools 100 days after he took the job.

“We’re still all about development, but less about the creation of code,” Nielsen said.  – HUH??????

The interesting thing is that the Delphi community user base is SO frustrated with the management decisions of the last 7 years that they have thrown up their arms and said “Fine. Do it. And good riddance.” 

 Read the details:

http://www.eweek.com/article2/0%2C1895%2C1922016%2C00.asp

 

Addendum – I just found out that in the fall of 2005 a Borland stock holder (the largest?) had offered Borland 125 million for their language suites.  Borland turned him down out of hand.  Now a few months later, they’ve begun to think “hmmm, that was a lot of green!  Let’s do it!”  Of course now that they are the ones wanting to make the deal, not the buyers, they’ll be lucky to get 2/3 the original offer.   Which I should be happy with I guess.  It means the people buying the IDE products will have all the more money to invest in them… 

Oh and if you are a news group reader, David “I” has been out on the groups lately trying to restore confidence in the product.

I still can’t beleive they’ve done this after such a succesful production release. But I guess you always clean your car just before you sell it, too.

Why I do what I now do at the office…

February 27, 2006

or ”One way my life changed in  2002″  – Some names have been changed to protect the innocent (and all those that are not me….). That probably wasn’t necesary, but there’s no need for competitors to Google the comany name and find company mission statements… :) So, for those who know the name, I am not working with Petra’s former lead singer Greg X. Volz – any resemblance of names be they fictional or real is purely intentional yet inconsequential.

Company Mission Announcement

Today [as founder, president, co-owner, and name sake of the company], I’d like to announce the creation of a new group within [our company] which is being charged to lead a very important mission. Specifically, the “[Software] SWAT Team” is being reorganized and re-chartered to focus on [Windows product] system installations – their quality and efficiency. I believe improvement in this last area is vital to our company’s future and want to take time in this email to give the entire staff an understanding as to why.
[..]
Our mission as a company is to reduce what it costs to install and support [our Windows POS system]. We’ve done similar things in the past with other products and it is now essential to make this happen with [our Windows product]. Here are some specific points to my vision for the mission:

  • Specifically, I’m calling on our company to cut the amount of time it takes us to install a [site] to ¼ of what it is today. And this needs to be done without reducing the quality we deliver to the customer. If anything, I expect such efforts to increase quality and customer satisfaction.
    We want to make our installations “plug and play” in the field. This means that we are 100% set up before we ship and all of our time at the site is spent training. Installation is done here, not at the site. If we go to the site it should be for training.
  • I envision us establishing proven/standardized ways to set up and install systems. This likely includes documented best practices and tools (like a “wizard”) to automate such setups. Our install team needs better tools and processes.
  • This project will take time and no doubt will be refined for years to come. That said, it is vital that we get about it. I expect us to have made demonstrable improvement by the end of this calendar year.

Making it Happen

This mission is for the entire company. Indeed I expect it to affect every aspect of our organization. But to lead this effort, we’re reorganizing and re-chartering our “[Software] SWAT team”. Brian Layman and [Greg X. Volz] will constitute this team and will take charge of the mission for achieving our objectives. Together they will answer to [Steve Taylor] as part of the deployment group. Here is some background on these key players in our mission to improve:

  • Brian Layman has been a programmer with our product development team since he joined us in 1998. For the past six months, Brian has helped in the [company's] telephone support department. This mixed background gives Brian a unique perspective on the challenges and solutions in improving our installation and support techniques for [our software].
  • [Greg X. Volz] started with [us] in 1996. He first served as part of our [DOS product] installation and support team and later was promoted to coordinate our original [Windows Software] beta support team. Since the merger of [Windows Software] support with the main telephone support group, [he] has served with [Steve Taylor] as part of the [Software] SWAT team working as an interface between support and deployment.

Again, this team will have the chief responsibility of delivering this mission — but they will need the help and cooperation from many departments to be successful. This includes QA, Telephone Support, Marketing, and R&D. Our existing installation team in particular has already played a big role in taming the new beast of [Windows Software] installation. [Others] have already made important strides to get us to the level we are at today. I expect these folks will play a major part in our future improvements.

Official Job Title 2005-Present

February 27, 2006

Names changed to protect the innocent (and all those not me)

 

Process Automation and Production Test Engineer

______________________________________________________________________________________

Basic Function/General Description

Develop tools for the Configuration, Shipping, Installation, and Support of the company’s products.  The tools will provide consistency while reducing labor content.

Responsibilities:

• Develop and maintain the images for the various servers and clients and supply to Shipping and Service with written instruction.  
• Attend design and review meetings for new stages and products.
• Maintain the System Control Diagrams for the Installation and Support Departments. 
• Develop and maintain the tools to configure the current software releases.

o These tools will aid in the configuration of new sites, legacy conversions and add-on modules.
o Evaluate the feedback from the Support staff on existing tools the need for tools to be developed.
o Emphasize the standardization of site configuration and only automate the configurations we support.
o Write Help documents for the tools developed to assure consistent application

• Assist in escalated Support issues, as required, when the cause is a hardware image, internal tools or documentation setup issue.  This escalation should result in a corrective action for the tools or documentation.
• Develop and maintain a system testing process and tools to be administrated by the Shipping department.

Skills:

• Experience with the following programming languages: Delphi, Visual Basic, Turbo Pascal
• Knowledge of the Windows XP Registry structure and Windows XP Pro deployment tools.
• Advanced DOS Batch programming experience
• Experience with DOS & Windows TCP/IP networking and related hardware
• Proficiency in SQL and Relational Database concepts.

Education:

Computer degree or equivalent work experience.

Experience/Pre-Requisite:

Knowledge of our current products, legacy products and the POS industry

   
Position Reports to:  Director of Operations

Nothing in this job description restricts the right of management to assign or re-assign duties and responsibilities to this job at any time.

Hmmm….

February 27, 2006

I need to change this theme some… Since it doesn’t show the categories each post is in, it is even more confusing then it ought to be….

Next Page »

Who is Brian Layman

I am a WordPress expert living in North East Ohio. I am part of the ever expanding Open Source Internet workforce. I am able to stay at home, with my wife and four home schooled kids, while working as the Senior Developer for b5media - a blogging network that has hosted over 300+

I co-host the NEO WordPress Monthly meetup. I am the board chair of our local church. I host and have provided development services for clients such TV personalities Rhett and Link as well as corporations such as Borland International.

In my spare time I try to sneak out, canoe, mountain bike and camp as often as I can. Sometimes I also defend the earth against zombies and aliens, but usually not during the camping trips.

Services Provided

In providing hosting, email, theme and plugin development to my clients, I function as a single point of contact answering to the needs of their expanding sites.

My service portfolio includes but is not limited to WordPress hosting, optimization, theme development and custom plugin creation. Community creation via vBulletin, Ning and BuddyPress and bbpress

I also am well experienced in site conversion, transition and merges. To clarify this, website technologies change and giving up your data is not an option. I have transitioned literally hundreds of sites from one platform to another.

viagra 50 mg indian version of viagra cialis cheapest viagra india online viagra cost comparison viagra for sale without prescription generic tadalafil online buy viagra in korea indian levitra discount cialis online viagra prescription over the counter vardenafil cialis otc cialis no rx cialis 30 mg viagra ranbaxy buy levitra in uk cialis low price tadalafil tablets 10mg cheap viagra fast shipping cheap generic levitra cialis discount cialis 5mg viagra discount prices buy levitra without prescription vardenafil online generic levitra canada viagra professional price cheapest sildenafil citrate indian version of cialis viagra lowest price viagra online prescriptions tadalafil 10mg levitra over the counter levitra prescriptions online buy viagra without a prescription liquid tadalafil citrate buy viagra prescription online tadalafil 20mg india india viagra generic sildenafil citrate for sale vardenafil hcl 10mg cialis discount coupon buy levitra australia viagra over the counter in canada liquid sildenafil tadalafil price comparison viagra cost in india cialis mail order sildenafil sales buy vardenafil cialis offer cheap vardenafil generic cialis no prescription viagra tabs generic indian names viagra price canada vardenafil hcl 20 mg generic viagra without prescription viagra by scilla biotechnologies buy generic cialis free viagra viagra over the counter viagra pills kamagra 100 mg cialis from india tadalafil australia tadalafil 20mg tablets tadalafil soft tabs sildenafil pills viagra no prescription required generic viagra paypal tadalafil online indian viagra cost tadalafil online pharmacy generic soft viagra sildenafil soft tablets viagra generic names buy viagra in ireland levitra without prescription levitra online purchase cialis pill indian tadalafil levitra 5mg cialis cost per pill tadalafil oral jelly sildenafil no prescription vardenafil price generic cialis 10mg cheap cialis no prescription order sildenafil citrate indian generic viagra blue viagra buy cialis usa apcalis 20mg tablets viagra overnight delivery sildenafil india purchase viagra without a prescription viagra prescriptions order viagra without prescription viagra with no prescription levitra for sale purchase viagra canada discount levitra viagra 200mg cheap viagra 100mg cialis overnight delivery buy sildenafil online viagra made in india cialis tabs 10mg viagra indian pharmacy viagra for sale in ireland viagra uk prices buy viagra in europe generic cialis india levitra online viagra for sale india buy viagra in dublin generic cialis soft tabs viagra 50mg cost generic sildenafil 100mg tadalafil generic viagra super active 100 mg kamagra 100mg sildenafil 100 mg tablets cialis no prescription viagra low price online cialis suhagra tablets buy cialis daily use tadalafil sample cialis prices viagra prescription online buy cialis pill kamagra from india cialis online levitra mg vigora india vardenafil 10 mg sildenafil citrate 100mg buy viagra in india buy cialis professional viagra in india buy viagra in singapore generic revatio viagra substitutes sildenafil canada viagra no script cheap kamagra viagra retail price cheap lovegra order viagra uk buy cialis in mexico viagra prescription price purchase cialis online without prescription online cialis prescription ranbaxy caverta buy viagra in hong kong sildenafil price cialis mastercard buy viagra in england viagra mail order canada cialis tablets for sale order cialis cialis soft tabs generic levitra india tadalafil prices cheap sildenafil citrate tablets cialis online prescriptions cialis 5 mg daily levitra prices prescriptions viagra viagra over the counter alternative cialis 20 mg tablets cialis generic india cialis prescribing cialis 20mg daily sildenafil 50 mg viagra drug prices tadalafil generic india cialis sale viagra prices buy viagra 50 mg levitra pharmacy buy viagra generic viagra prescription drug cialis daily cost vardenafil uk viagra soft tabs online buy viagra super active cialis 10mg price 25mg viagra silagra 100mg online viagra prescriptions cialis prescription cheap cialis india revatio 20 mg indian equivalent of viagra tadalafil india viagra capsules cheapest viagra buy cialis without prescription tadalafil overnight cheap tadalafil online purchase viagra online no prescription