Blog Posts

July 2011 in Retrospect

July 2011 in Retrospect:  Too busy to write but things are looking promising.

July 2011 in retrospect has been a tough on my blogging efforts.  My latest project has taken up so much time that between it, my day job, and my family, it’s been hard to get time to write.  This post makes number four during this month which is a considerable decline from what I’ve accomplished in the past so I guess I’m not to happy about the blogging results this month.  I never thought I’d be writing in a manner that anyone in the world could see my thoughts but I’ve found the process rewarding and I don’t intend on letting it go.  Some of the difficulty finding writing material stems from the confidential manner of the projects I undertake.  I tend to focus like a laser beam on what I’m trying to accomplish and when I’m putting a lot of effort into developing functionality for an entity that has exposed their core competencies to me the it tends to create a pool of experiences that I’m not comfortable talking about.  I value the trust that other have placed in me so I can’t write about things that they’ve placed in my confidence on the web for anyone to see.

That being said…  I’ve recently had the pleasure of hooking up with some of the brightest and hardest working people I’ve ever enjoyed working with in my life.  They’ve given me a chance to make a difference in in what they do by utilizing my technology and business skills to improve the efficiency of their process by leveraging technology to automating tasks and procedures and streamlining data flow.  I’m enjoying a synergy of the management, business, and technology skills I have in fuller manner then ever before and I appreciate the opportunity to analyse, innovate, and create that they have offered me.  Putting the icing on the cake,  I’ve been able to pull my brother Jeremy from valleyflight.com in on the project and I always enjoy working with him.  He has a depth of technical expertise, is always helpful, and listens to my ideas without telling me that I’m crazy for thinking too big.

Hopefully August will be a better blogging month.  I’ve got a packed schedule and I know that time will be an issue, but having experienced the power of blogging and how it helps shape thoughts and expression, no matter how busy I get I won’t be quitting the blog.  Sometimes I kind of think of this thing as a big public diary… I write about the things that fascinate me and some of the things that I’m doing and I’ll get the chance to go back someday and it will all be here.  I’ll be able to look back at this along with those that I know and love and see the path I’ve taken along with the milestones of yesterday.

July 2011 in retrospect: Here’s to casting a message in a bottle into the sea of information in hopes that someday it will was up on a future shore and I’ll see it and remember where I was when everything changed.

Be blessed,

Joel

 

PHP and curl for remote site data extraction

Sometimes you’ll need to get data from another site on the internet.  In this article we’ll go over a quick and easy how to for using php and curl for remote site data extraction.

To get things started we’ll need to initialize a curl object and set some parameters so it can act as a web browser and log into the targeted remote site.

        // Initialize cURL
        $Curl_Obj = curl_init(); 

        // Enable Posting.
        curl_setopt($Curl_Obj, CURLOPT_POST, 1);

        // Enable Cookies
        curl_setopt ($Curl_Obj, CURLOPT_COOKIEJAR, 'cookie.txt'); 

        // Set the browser you will emulate
        $userAgent = 'Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1';
        curl_setopt($Curl_Obj, CURLOPT_USERAGENT, $userAgent);

        // Don't include the header in the output.
        curl_setopt ($Curl_Obj, CURLOPT_HEADER, 0);

        // Allow referer field when following Location redirects.
        curl_setopt($Curl_Obj, CURLOPT_AUTOREFERER, TRUE);

        // Follow server redirects.
        curl_setopt($Curl_Obj, CURLOPT_FOLLOWLOCATION, 1);

        // Return output as string.
        curl_setopt ($Curl_Obj, CURLOPT_RETURNTRANSFER, 1);

You can find a complete list of php curl options at http://www.php.net/manual/en/function.curl-setopt.php if you need more details.

Now that we’ve got our curl object set up lets post some login credentials to a login script.  To do this we’ll need to get the input ids from the login form and supply them values and setup the post with the curl object.  Then we’ll post the credentials to the script detailed in the action of the login form.  Here’s how we do it:

       // Set up post fields from login form.
       curl_setopt($Curl_Obj, CURLOPT_POSTFIELDS, "UserFieldId=UserName&$PasswordFieldId=$Password&AnotherFieldId=$AnotherValue");

       // Set the url to which the data will be posted.
       curl_setopt ($Curl_Obj, CURLOPT_URL, 'http://yoursite.com/login.asp');

       // Execute the post and get the output.
       $output = curl_exec ($Curl_Obj);

       // Empty the post fields so you don't re-post on the next request.
       curl_setopt($Curl_Obj, CURLOPT_POSTFIELDS, "");

At this point we’ve obtained the output of the login attempt and we can parse it to see if it was successful using php string manipulation functions.  For the sake of simplicity* I’ll leave that part to you.  Once you’ve insured that you’ve logged in you can proceed to navigate to the next url using the steps below:

       // Set curl object url option.
       curl_setopt ($Curl_Obj, CURLOPT_URL, $Get_This_Url);
       // Execute query and obtain content.
       $output = curl_exec($Curl_Obj);

Finally you’ve downloaded the content from the page that was not accessible prior to your virtual login.  You can parse it with php’s string functions or use xpath to read its content if you’d like.  Don’t forget to close the curl object before you exit your script!!!

// Close curl object.
curl_close ($Curl_Obj);

 

Happy coding and please use responsibly.

– Joel

 

* Here’s a simple string comparison function you can use when using php and curl for remote site data extraction.

function extract_snippet($html, $Start_Term, $End_Term, $PrintOutput = false)

    {
        $start = strpos($html,$Start_Term);
        if (!$start === false)
        {
            $end = strpos($html,$End_Term,$start);
            $T_Sel = $start + strlen($Start_Term);
            $snippet = substr($html,$T_Sel,$end-$T_Sel);
            if ($PrintOutput)
            {
                print "\n<br>$snippet</br>";
            }
            return $snippet;
        }
        return false;
    }

Linux PDF Virtual Printer

Use cups-pdf as a Linux PDF virtual printer

Recently a constituent of mine asked for some help getting her Linux distro to print to PDF.  In her case she was using the photo sharing software Picasa by Google and needed the ability to print her pictures to pdf files.  Unlike open office which will create pdf files Picasa was looking for a linux pdf virtual printer to print to.  After some searching I found that installing cups-pdf would enable linux to print to a virtual cups-pdf printer that appeared as a printer device on the system.  This process worked perfectly with Picasa and quickly generated a pdf on my desktop of any picture I selected to print.

How to install it:

Installing cups-pdf was easy.  In my case I was using Fedora core 12 with its standard repositories as well as the rpm-fusion repositories.  All I had to do was open the package manager, search for cups-pdf, and install it.  Once it was installed I checked to see if the virtual device showed up in the administration-printing menu which it did and I was able to use it with no configuration required.  If you are using a different linux distribution this process should work for you, but you may need to find and install a repository with the cups-pdf.

I hope this helps someone looking for a linux pdf virtual printer.

If you’ve had an experience with this or need help the please comment here and contact me.

– Joel

What modern business applications should offer users.

Modern business applications should offer users the following features…

While developing solutions for various projects that I’ve undertaken I’ve come up with a few ideas on the types of features that I’d like my applications to offer users.  While this list is far from complete I think it would be good to post it for comment.  Bear in mind that when I’m discussing modern business applications I’m discussing thin client web based applications using cloud architecture.

Modern business application features:

  • Remote connectivity to data and functionality.
  • Encapsulation of business logic.
  • Continuous contextual decision support.
  • User specific views of the data and logical processes
  • Security
  • Flexibility
  • Data Importing / Exporting capabilities

Remote connectivity to data and functionality: Traditional business applications ran on workstations and desktop computers.  Data was stored on the computer itself or on a server and was not accessible unless the user was sitting in front of the desktop computer itself or another computer connected to the server.  This in effect chained the user to his or her desktop device.  Modern business applications must utilize web technology and provide device independent services that allow the user to connect to the data and logic of the business through any device that they can be authenticated through that has internet connectivity.

Encapsulation of business logic: Traditional business applications such as spreadsheets, word-processors, and email allowed for the transportation and transformation of data, but the use of business logic was largely left to the discretion of the user.  Modern business applications can be designed to encapsulate the steps that must be taken with information and resources to automate processes and insure execution of critical procedures required by users.  By profiling the procedures and steps required for critical processes in the business, developers can create software that encapsulates them and insures that the order of operations is followed, all steps required are taken, all resources required are employed, and follow through is complete.  Outcomes and ownership of inputs from each step can also be tracked to determine each users contribution to the success of the process.  Success ratios for processes can be increased as the mundane oversight of each detail is moved from managers to system applications with the general oversight of larger categories of processes taken on by tech empowered managers.

Continuous contextual decision support: Because of the connectivity offered by todays diverse array of computing devices, from smart phones, laptops, tablet PCs, to thin client enabled desktop PCs.  Users now have the ability to receive data and logic at any point of the business process.  Modern business applications must provide contextual decision support by offering relevant information to the user at the right time with suggestions for its proper use and allow for user feedback into the system.

User specific views of the data and logical processes: Modern business applications must offer users unique views of the data and logical processes that fits their context to the business.  For example a vendor that supplies a business would need access to statistics indicating demand for the particular commodity they offer.  Their view of the data and logic would be an on demand view or automated communication with forecasted consumption data generated by internal business processes that the vendor never sees.  User specific views of the data and logic offer modular controls to the business and protects its core competencies from probing by competition.

Security: Traditional business applications were prone to interruption by natural disasters and other disruptive events such as fires, floods, tornadoes etc.  Modern business applications can offer security to its users by storing data and logic in a cloud environment where information is distributed off site amongst computers in multiple data centers.  This offers a degree of security to the user and provides for a significant reduction in recovery time when the business is impacted by such an event.

Flexibility: Modern business applications created with web based technologies are more flexible than traditional business applications because of the ease in which updates can be rolled out to the user.  In traditional environments users had to undergo an application update procedure before receiving an updated version of a business application that contained the latest data and logic.  Web applications are updated remotely with no effort required by the end user making their innovation, iteration, and revision much more seamless and transparent to end users.

Data Importing / Exporting capabilities: Modern business applications should easily convert data with traditional applications such as spreadsheets and allow the user the comfort of converting data for use outside of the application.  Data transfer methods such as XML are a good standard for data export and can allow for data interchange between disparaging systems and applications.

Comments and discussion are welcome.

A quick php data sanitation guide

PHP data sanitation is the method of testing inputs and output for acceptable ranges of data to insure that a script will produce the desired result.  Data sanitation is sometimes referred to as a sanity check as insane things tend to happen when a script gets values it was never intended to process or renders values to the users browser that breaks the html document or javascript functionality of the page or worse yet cause the page to work in a manner it was never intended to.  PHP data sanitation for data input into scripts when the user is passing values in can be easily accomplished  in three steps and data sanitation for output to the users is even simpler.

Three steps for a php scripts data sanitation on input:

Step 1: Check for the existence of the required inputs from the four types of inputs you can use $_REQUEST[‘var_name’], $_POST[‘var_name’], $_GET[‘var_name’], and $_COOKIE[‘var_name’]. Use the function isset() to determine if the variable is set and doesn’t have a null value.  Use the function isempty() if you’d like to check to do the same type of test while accepting null values.  Tip don’t use $_REQUEST as you cannot validate where the data came from.

Step 2: Check inputs for approved data types. If the type doesn’t match reject the input value as tainted.  Functions for checking data types are as follows:

is_object
is_infinite
is_real
is_int
is_string
is_long
is_scalar
is_nan
is_double
is_uploaded_file
is_array
is_bool 

Step 3: Whitelist the input values by checking them for acceptable values and reject inputs that do not meet your specified input parameters.  Check for acceptable values using character type functions for strings and comparison operators for numeric values.   Ctype functions include:

  • ctype_alnum — Check for alphanumeric character(s)
  • ctype_alpha — Check for alphabetic character(s)
  • ctype_cntrl — Check for control character(s)
  • ctype_digit — Check for numeric character(s)
  • ctype_graph — Check for any printable character(s) except space
  • ctype_lower — Check for lowercase character(s)
  • ctype_print — Check for printable character(s)
  • ctype_punct — Check for any printable character which is not whitespace or an alphanumeric character
  • ctype_space — Check for whitespace character(s)
  • ctype_upper — Check for uppercase character(s)
  • ctype_xdigit — Check for character(s) representing a hexadecimal digit

Comparison operator include:

Example Name Result
$a == $b Equal TRUE if $a is equal to $b after type juggling.
$a === $b Identical TRUE if $a is equal to $b, and they are of the same type. (introduced in PHP 4)
$a != $b Not equal TRUE if $a is not equal to $b after type juggling.
$a <> $b Not equal TRUE if $a is not equal to $b after type juggling.
$a !== $b Not identical TRUE if $a is not equal to $b, or they are not of the same type. (introduced in PHP 4)
$a < $b Less than TRUE if $a is strictly less than $b.
$a > $b Greater than TRUE if $a is strictly greater than $b.
$a <= $b Less than or equal to TRUE if $a is less than or equal to $b.
$a >= $b Greater than or equal to TRUE if $a is greater than or equal to $b.

Pulling it all together with some pseudo code:  Encapsulate in function: IF isset(YourPostVar) AND isdigit(YourPostVar) AND YourPostVar >= 0 THEN return YourPostVar Else return false;  As you can see we combined all the stages here to insure that the numeric value we received was set, and was a digit with a value of zero or greater.

Note: When inputing data into databases use the dbms’s escape string functionality to insure that variables are properly escaped.  If the dbms doesn’t have an available escape string you can use addslashes().

Output sanitation is very simple. Always encapsulate output to the user with htmlentites() or htmlspecialchars() when sending data straight from inputs or a database.

Hope this helps.

Joel Caton

The importance of You(ser): You are important – I am important

The importance of You(ser): You are important.

Business got you locked up? :(  Break out with catontech tools!  :)

You are the center of your environment, your team, your family, and your business.  You’ve poured your life’s energy, your dreams, and all of your passion into your business and career and you deserve the best.

As the most important person in your life you deserve business solutions that work for you by:

  • offering you timely information about the important events surrounding and affecting your business.
  • providing easy access to measurements and metrics that indicate the performance or your organization.
  • automating time consuming processes and gives you the freedom to do the important things you do best.
  • freeing you from your desk and allow you to make decisions from anywhere in the world.
  • offering the power to transform and employ the information in your organization without effort or hassle.
  • securing the practices, procedures, and data of your core business against nature, accidents, competitive organizations, and criminals.

Your time is like money in your wallet and you deserve solutions that free you to spend your life pursuing your passions.  You started your business with a dream and you should be free to pursue it without sacrificing the things that are important.

You know the importance of your decisions in your organization and all that you’ve done to create the things around you.  Take a deep breath and think about the things in your environment that are keeping you from meeting your objectives.  Now breathe out and say I am important! I am too important to be tied up with things that keep me from my passions and dreams.  I’m too important to allow my business to tie me up in red tape and processes that keep me from focusing on the things I know are important to my success.  I’m too important to leave my success to chance.  Take a moment and write down the things that are keeping you from meeting your objectives and tying up your time.  Once you’ve reflected on them visit us at http://catontech.com/card.  We’d like to help you.  The conversation won’t cost you anything.  Just fill out the form first so we can focus on the issues and we’ll email you and set up a time to talk.

Click for an hour of consultation - no obligations - just listening and advice.
Joel Caton

 

Browser Compatibility and Acid3

The question:  Can users be persuaded to change browsers?

Recently I asked a question on linkedin about how to encourage users to upgrade or change their browsers.  I got a lot of interesting answers and some good ideas, but nothing that put the issue to rest for me.  I’m still thinking about browser compatibility.  The issue at the heart of this whole deal is the disparaging levels of support that browser producers have for css and HTML.  I believe that the answer to the question can be found by educating the end user so they can make the best choices.

Browser compatibility problems

From a development perspective browser compatibility issues make it harder to write web applications that perform as designed because not every browser is going to function the same.  Some of them don’t recognize all of the css properties and don’t use all of the functionality of html.  This is compounded by the fact that CSS2, CSS3, and html5 are not finished works but have been adopted in part by each of the major browsers to varying extents and in different ways.  The lack of timeliness for the production of standards is a bottle neck the progress of the internet.

A browser compatibility benchmark is needed

Enter the Acid3 test by WaSP.  This tool is a great piece for end user education because it scores the browsers compatibility with web standards in an easy to understand score and offers an interactive model.  Users visiting the url where the test is located watch an animation take place on their screen while a score starting at 0 / 100 increments as the browser is tested.  Links with this graphical tool coupled with the right compelling offer could be used encourage users to seek the best possible browser or at least upgrade their current version.  Wikipedia has a great writeup on the Acid3 test if you’d like a little more information on what it does and how it works.  Testing your browser is as easy as visiting the site.  An example of the test result done on Firefox is listed below.  You may click the image to test your browser.

Firefox 4.01 Acid3 Test Results

 

Why should I bother?

The future of distributed software lies within html, css, and JavaScript.  Browsers are the containers in which these applications run and the environment in which they subsist.  By educating the end user and allowing them to make the best decision you will force browser developers to increase their adoption of existing standards and cause the W3C increase the pace at which it finalizes standards.  Over time barriers caused by browser compatibility issues will dissolve and innovation will occur at a much faster rate and improve the end users online options.  While the education of the market may seem to some to be a distraction from business goals, I believe that over time it will broaden the range and increase the depth of opportunities available via the internet.  Additionally consumers which read your educational material will appreciate the fact that you an innovator that cares about their experience and wants them to have the best.

Innovation Lives!!  Stagnation Dies!!– Joel

 

 

Your business’s great story

The importance of your business’s great story:

Your story is what you do or what your business does.  Through each and every activity that you or your employee’s interact with the members of the communities you do business with you are telling people a story about yourself.  Most of the time our activities reinforce a view that our audience has already predetermined about us.  This can be good or bad depending on the views of the person we are dealing with.  The story we tell with our business is too important to leave to chance.  As mentioned Business Leader as Storyteller I’ve listened to Seth Godin’s All Marketers Are Liars twice in an attempt to determine the best attributes of a good business story and I’m happy to be able to list them here.  Please bear in mind that the attributes listed here are my interpretation of what Seth has to say and are not taken verbatim.

Attributes of a great story.

  • Understanding the world view of your target audience: Before you even begin your story you must first determine who your audience will be.  One method of doing this could be determining your ideal customer is.  To craft a great story that will truly be effective you’ve got to know what predispositions your audience has so you can help them reinforce those thoughts by adopting your story as their own.  By using this approach you are narrowing your focus to a smaller target group, but the idea here is to find people that will want to hear your story and repeat it as their own.  These are the people who will take notice of what you are saying and buy into it to an extent that they interrupt everyone they know to tell them about it.  It’s important to get this part right because if you interrupt everyone with your story you will just come off as annoying and irrelevant.
  • Tell a coherent story that is consistent when told through various channels. When telling the story of “how we do it here” to your target group it is vital that your facts are consistently supportive of the message you are trying to convey.  Disjointed facts and points that seem contradictory will only confuse your audience and cause you to lose their attention.  Delivery of the story must be clear and facts must be presented in a way that reinforces the underlying message you are trying to convey.  The best method to accomplish this is to determine the process flow of every point of communication with your audience and define the type of communication that takes place there.  Points of communication can include customer invoices,  the conversation your associates have with customers when answering the telephone, email, tweets, or blog comments, or the conversation a cashier has with the customer when processing their order.  All these points must be defined and the associates trained on what message is to be conveyed.
  • Giving just enough details. Give the target audience just enough information to engage their imagination.  The art of suggestion works like a connect the dots puzzle.  If you’ve ever looked at a Thomas Kinkade painting then you’ve viewed the type of impressionistic work that we are trying to create.   Mr Kinkade uses shadow and light to create impressions which the viewer turns into a scene.  If we slow down and look at his paintings intently then we understand that we were viewing an impressionistic pattern.  If we are telling our story to the right audience then they will fill in the gaps to complete the picture of their world view.  This is important because of the limited attention span of the average prospect in a media saturated culture and the fact that once the user completes the impressionistic story in their mind it becomes their own story.
  • Don’t harm the target listener: I really wish that I didn’t have to put this in here, but considering the low trust environment here in the United States I felt I had to.  Don’t tell stories that will harm your audience if they choose to believe them.  If you do you will lose in the long term.   Choose a long term strategy that will benefit your target audience and your business will grow virally as the story takes hold and is spread.  The key to a great story is building trust and if you are found to be harming people eventually you will become the next WorldCom or Enron.
  • Be authentic – be real: The best stories are true.  Stories that are not true will make the target audience feel stupid for believing them once the truth comes out.  If you make someone feel dumb they will not support you and once they find out they have been duped they will never repeat your story again.  Stay away from false stories and lies.  Let your competitors be the ones that over promise and under deliver.  Succeed by under promising and over delivering.  Being authentic and real is the only real way to succeed in a low trust environment.
  • Differentiated from competing stories. It is hard to shout above the crowd and in today’s media saturated culture it is foolish to compete with a successful and well established story.  If your competitor is selling on price and doing it well then you would do well to sell on service.  Value is perception and customers buy because of perceived value so the trick is to tell a story of how you are different then the rest and how your difference is valuable.  The “how we do it here” story should be customized to your target groups world view and be so different from the other stories out there that comparison is not possible.  This is how you avoid the devastating effects of price competition and if you do this well your customers will probably enjoy paying a higher price.

Your business’s story becomes a great story when it becomes the audiences story.

Further reading: The importance of telling the right story the right way.

Your thoughts and comments are most welcome.

Joel Caton

 

Business Leader as Storyteller

I’m still doing research on this business leader as storyteller concept.  I’ve downloaded the audible version of All Marketers Are Liars by Seth Godin and maybe it will shed some light on the subject.

I can remember when I was in Jr high school and later in high school going to the library and reading every Louis L’Amour book I could get my hands on.  I read plenty of other authors as well and spent many of my days escaping from the mundane experience of high school by vicariously enjoying life through the words of a story teller.  For the most part the books were fiction and I knew they were not true but I gleaned plenty of understanding about people, geography, history, and many other subjects from these stories.  I also read some autobiographies and biographies which I thought were interesting.  The manner in which many of these works were written stimulated my imagination and ignited a passion in me to learn more, which was something my high-school teachers could not get me to want to do.

Now don’t get me wrong when I mention story telling as a way of doing business.  I’m not advocating dishonesty here. When I mention story telling I’m talking about what we’ve got to say about ourselves and our experiences.  There’s no doubt about it that the things we think about all day and the stories we tell others are what defines us and if we’re in business it’s what defines our business.  There is an art to explaining things to people and marketing ourselves and I believe that it has a lot to do with our ability to tell stories… authentic stories people will listen to and want to learn more about.

Stories are a great tool for leaders because they:

  • Can encapsulate and drastically simplify very complex concepts and environments in a manner that makes them easy to understand.
  • Can be used as a lenses that the audience uses to interpret the facts and make them relevant.
  • Engage the imagination and the attention of an audience that might not otherwise be receptive.
  • Can be used to engage the emotional side of the audience in situations where facts alone would not or conversely to disengage an audience from an emotional response when the facts would warrant one.

I’m still working on my story and hopefully after listening to this book I’ll have a little more to share.

– Joel

Developments

A quick update on developments lately.

The business card lead conversion project

This project is hardly finished but it’s functional enough that I’m going to start using it.  I’ll be emailing the information for now but my long term plans are to integrate site registration with this process and offer the reports and worksheets on a perpetual basis to the end user.

The Ideal Customer Survey

I’m looking at ways to improve the questionnaire as it currently is written with a focus on business to business and I’d like to add some business to consumer questions or possibly break this into b2b and b2c surveys.

Site Graphics Update:

New graphics are forthcoming as I’m looking to take a more laid back approach with the site.  I’m integrating a nature scene for the background and move the navigation to a floating panel on the right side of the page.  The catontech eye logo is being revamped so it will be more understandable and less weird.

Thanks for the Referrals

A word of thanks to Janet Kelly of Kellybucks and JK Real Estate for the referral to Debbie Carrol her staff at Boaz Tax Sales Properties.  Its great to be able to help friends and Janet you’ve certainly helped me.  Debbie, Wanda, Laura, and Monica are great and I really enjoy helping them out.

Joel