Tag: LinkedIn

  • PHP/Apache running on Linux won’t connect to a PostgreSQL server

    PHP/Apache running on Linux won’t connect to a PostgreSQL server

    SELinux will block PHP/Apache from connecting to PostgreSQL (and probably any other DB) by default on some Linux distributions. If you are trying to get PHP to connect to a PostreSQL DB on a linux box for the first time and you are sure your pg_hba.conf on the target box is setup correctly then try this:

    setsebool -P httpd_can_network_connect 1
    

    This should configure SELinux to allow Apache/PHP to connect to other hosts.

  • National Broadband Map Review

    National Broadband Map Review

    The National Telecommunications and Information Administration (NTIA) in collaboration with the FCC has published a series of broadband maps on a new site called National Broadband Map (NBM). These maps show what broadband services are available throughout the United States as well as other interesting broadband data.

    Hit this link and click the “Explorer the Map” option on their main page to see a map of the US with shaded areas where selected broadband services are available. You can click different selections above the map to toggle the various broadband technologies. To see other maps such as advertised versus actual broadband speeds click on the “Show Gallery” option in the lower right hand corner.

    Rochester, NY does pretty well on advertised versus actual although there a few slower than advertised points here and there. Upload performance data is also available. Usually the cable and DSL providers don’t brag much about upload performance likely because in most cases it is lousy compared to download performance. I think upload performance will become more important to the typical internet user than it as in the past now that people are sharing their pictures and video online.

    The NBM site use a variety of open source technologies including:

    • JQuery – My favorite JavaScript library.
    • Modernizr – A JavaScript library to detect browser capabilities.
    • OpenLayers – Provides a JavaScript API to display WFS and WMS GIS layers.
    • GeoServer – A Java based server software that provides WFS and WMS services.

    What is particularly interesting about the site is the developer resources. They provide a series of API’s you can call from your own web applications to use their data. Output formats include XML, JSON, and JSONP implementations. If you want to use the data locally without the APIs you can download it.

    I do have a couple criticisms regarding the maps and ironically, they are bandwidth related. The first is that there are too many tiles returned when viewing the default map of the US. I noticed the map was a little slow to fill in. When I enabled Firebug and clicked on the “Explore the Map” option off the main page, over 500 tiles were pulled down. In fact, Firefox/Firebug became unresponsive. I would expect less than 30 256×256 tiles need to be pulled down for a reasonably sized browser window. I wager there is something goofy going on like a bounding box not set for the area displayed.

    My second criticism is that the site is not using gzip to compress JavaScript files. Modern web applications tend to lay on the JavaScript pretty heavy and this one is no exception. OpenLayers.js is nearly 1MB all by itself. By enabling gzip on sites with large JavaScript files you can significantly improve site performance. This is a good topic for a future post.

    Overall I think the National Broadband Map Site is an excellent resource. It provides very useful data on broadband technologies/speeds, makes this data available via APIs or download, and also demonstrates a variety of open source web application technologies.

    Is it worth the $20 million that contractors were paid to build the map? I would say certainly not at first glance but I would want to hear the whole story before I jump to conclusions. I.e. how much of that $20 million was spent on actual development? I am much more skeptical of the alleged $293 million required to collect the data.

  • Limited screen resolutions running CentOS as a VirtualBox guest

    Limited screen resolutions running CentOS as a VirtualBox guest

    If you are attempting to run a newer version of CentOS as a guest on VirtualBox you need to install the “Guest Additions” on your CentOS VM to enable higher display resolutions. If you don’t, 800×600 and 640×480 will probably be your only options.

    This is in the manual of course but if you were in a bit of rush like myself you may have missed that part. 😉 Once you complete the “Guest Addition” installation process the CentOS guest desktop will dynamically re-size to match your view-port. Installing the Guest Addition will add some other handy features including a shared clipboard and shared folders.

    If you are running an older CentOS guest you may have to manually add additional resolutions to the xorg.conf file.

  • Php-cgi.exe application error on IIS with FastCGI

    Php-cgi.exe application error on IIS with FastCGI

    I recently installed PHP 5.2.14 on a Windows 2003 machine running IIS 6 with FastCGI to do some PHP testing at home. I chose the fast CGI install and added several extensions during the install including Curl and Oracle. When I attempted pull a test page after the install completed, I saw the following php-cgi.exe application error on the Windows server’s desktop:

    The instruction at “0x100f36ec” referenced memory at “0x000c0194”. The memory could not be “read”.

    IIS sent the following error message back to the requesting browser after a couple minutes:

    FastCGI Error
    The FastCGI Handler was unable to process the request.

     

    Error Details:

    * The FastCGI process exited unexpectedly
    * Error Number: -1073741819 (0xc0000005).
    * Error Description: Unknown Error

    HTTP Error 500 – Server Error.
    Internet Information Services (IIS)

    After some trial and error I was able to get my test page to display if I commented the “extension=php_curl.dll” and “extension=php_oci8.dll” lines in my php.ini file:

    ; Local Variables:
    ; tab-width: 4
    ; End:
    [PHP_CURL]
    ;extension=php_curl.dll
    [PHP_GD2]
    extension=php_gd2.dll
    [PHP_MSQL]
    extension=php_msql.dll
    [PHP_MSSQL]
    extension=php_mssql.dll
    [PHP_MYSQL]
    extension=php_mysql.dll
    [PHP_MYSQLI]
    extension=php_mysqli.dll
    [PHP_OCI8]
    ;extension=php_oci8.dll
    [PHP_PDO]
    extension=php_pdo.dll
    [PHP_PGSQL]
    extension=php_pgsql.dll
    [PHP_SHMOP]
    extension=php_shmop.dll
    [PHP_SOAP]
    extension=php_soap.dll
    [PHP_SQLITE]
    extension=php_sqlite.dll
    [PHP_XMLRPC]
    extension=php_xmlrpc.dll
    

    After some more trial error I was unable to get PHP to work without leaving the two lines commented. I tried both the VC6 thread and VC6 non thread safe versions and both exhibited the same behavior. On the PHP download page there is a “Which version do I choose?” section that basically explains that I should be using the VC9 version for IIS. Unfortunately, I only saw the PHP 5.3.3 VC9 download and I wanted to test with PHP 5.2.14.

    I downloaded PHP 5.3.3 anyway and it worked. I guess I will be testing with PHP 5.3.3.

    On a somewhat related note, if you are using FastCGI with IIS, you will probably want the VC9 PHP 3.3.3 non thread safe version. This article explains why.

  • How to get the contents of an Oracle CLOB data field in PHP

    How to get the contents of an Oracle CLOB data field in PHP

    The Oracle “CLOB” (Character Large Object) is a data type used to store up to 4 Gigabytes of text. Retrieving the contents of a CLOB is not as intuitive as you might think.

    Let’s say you have a CLOB field/column named “mychars” in an Oracle DB table named “mytable” along with some other fields. You want to simply echo out the text in the “mychars” field:

    
    

    The above code will give you an error that looks like the following:

    Catchable fatal error: Object of class OCI-Lob could not be converted to string in somefile.php on line 14

    If you try to do a print_r() on the CLOB in an attempt to figure out what you are dealing with you will get something that looks like:

    OCI-Lob Object ( [descriptor] => Resource id #3 )

    This is because a Lob object is returned instead of the contents of the CLOB.

    To get the CLOB contents you will need to call the load() or read() methods on the returned object. The latter will require the length of data to read in bytes but has the advantage of not being limited by the script memory limit:

    load();
                //or
                echo $row['mychars']->read(2000);
            }
        }
    ?>
    
  • How to add a custom context menu to a Spark TextArea in Flex 4

    How to add a custom context menu to a Spark TextArea in Flex 4

    There is a current known issue with adding custom context menus on a RichEditableText Spark component:
    http://bugs.adobe.com/jira/browse/SDK-23926

    This includes the TextArea component. Essentially, any custom context menus will not show up. There is a work around mentioned in the comments for the bug on Adobe’s website but I thought I would re-hash and show an example since this had me a bit stumped.

    The work around is to attach the context menu to the TextArea’s TextDisplay object via the “textDisplay()” accessor method. I have created a simple example with source.

    
    
        
            
        
        
            
        
        
            
        
        
    
    
  • SWFObject flashvars, params, and attributes

    I have been working with SWFObject a bit lately and was a little confused by how the flashvars, params, and attributes arguments for the embedSWF() function differ from each other and what exactly SWFObject did with them. Based on the documentation, I did a little experiment where I used each and then viewed the generated source using the Web Developer Toolbar for Firefox.

    Here is my HTML and SWFObject JavaScript which uses the dynamic publishing method as described in the SWFObject Documentation:

    
    
    
    
    
    
    
    
    Embed Fail

    Here is what the generated source looks like after I load the page in Firefox and SWFObject has done its thing:

    
    
    
    
    
    
    
    
    

    As you can see the attributes are just attributes to the object tag. The parameters show up inside of param tags with one param tag for each param following the object tag. I would be curious to hear if anyone has used the “attributes” and “parameters” arguments when embedding Flash with SWFObject and for what.

    The flashvars argument is the most useful in my case because that is how you can get external data passed into the SWF. I think a lot of folks load in their data into a Flash movie using a separate call to load an XML document. That is the way to go if you are pulling a large amount of data dynamically based on some type of user input.

    If you only have a few name value pairs that are not going to change, passing these in during the embed using flashvars is probably the better option. Assigning these values during the embed will save a second round trip you would normally make to get an XML document.

    So let’s say you decide you want to pass in a couple key-value pairs to a Flash movie using SWFObject. In the code example above there are two key-value pairs we assign to flashvars: “my_flashvar1” and “my_flashvar1”. Now you will want access these two inside your ActionScript code.

    For ActionScript 2 it would look something like this:

    trace(_level0.my_flashvar1);
    trace(_level0.my_flashvar2);
    

    ActionScript 3 requires another line of code to get to the same place:

    var paramList:Object = this.root.loaderInfo.parameters;
    trace(paramList["my_flashvar1"]);
    trace(paramList["my_flashvar2"]);
    

    A word of caution: When you use SWFObject’s embedSWF() function there are quite a few optional parameters. Be sure that you put a “false” in for optional parameters you don’t intend to use before any parameters you ARE going to use. In the embed example below I want to use the flashvars option but I don’t want to use the option to specify an express install file so I put in a false in that spot. Also, just be careful in general because there are a total of 10 different arguments for the embedSWF() function (including all the optional ones) so it is easy to get them in the wrong order and such.

    swfobject.embedSWF("Test.swf", "embedhere", "300", "250", "9.0.0", false, flashvars);
    

    Take a look at the SWFObject documentation for a description of each parameter.

    That’s it!

  • Must-have web application development tools

    Must-have web application development tools

    I have come up with a list of my “must-have” development tools:

    1. Dual Monitors – Developing with two monitors will make you much more productive simply because you spend less time switching between windows all day if nothing else. Monitors are pretty cheap and the productivity gains will more than pay for a dual output video card and second monitor. Even Microsoft says so.
    2. Firebug – If you do any kind of web development you should have Firebug on your tool belt. This Firefox Add-on will tell you exactly what CSS properties are being applied to an HTML element and from where and then allow you to change those properties on the fly in the browser. It also offers JavaScript debugging, a DOM tree inspector, and last but not, least, a “Net” panel that allows you to see all your browser requests, responses, and times.
    3. IE Developer Toolbar – IE’s answer to Firebug. It is not quite as full featured as Firebug in my opinion but it does at least allow you to inspect an element and determine how styles are being applied to it and where. This is quite useful since IE has a different box model than Firefox and you can use all the help you can get when trying to make a site look the same in both browsers.
    4. Charles Web Debugging Proxy Application – Charles acts as an intervening proxy to your web browser that records all the requests and responses. Some of this functionality overlaps with Firebug but Charles goes a bit further by providing request breakpoints, request editing, throttling, and DNS spoofing.
    5. Firefox Web Developer Toolbar – This is another very useful Firefox Add-on that allows you to:
      • Display element attributes in-line with the page you are viewing.
      • View a page’s JavaScript generated HTML.
      • Resize the browser window to preset sizes.
      • Outline different types of elements in the page.
      • Quickly disable, enable, and delete cookies
      • The list goes on…
    6. JQuery – JQuery is a JavaScript library but I also consider it an important tool to make JavaScript programming less painful. It allows you to easily select a DOM element you want to manipulate without typing a whole lot and handles many of the browser idiosyncrasies. Using JQuery’s selectors, you can easily change attributes and chain those changes to together. JQuery also has shortcuts for event handling, effects, AJAX, rich UI components, and anything else that is repetitious, boring, or aggravating to do in plain JavaScript. It takes a little time to learn JQuery but it quickly pays off. While there are many other JavaScript libraries available, I would say JQuery has become the most popular and so does this very scientific poll ;). If JQuery or one of its hundreds of plug-ins don’t do what you need then JQuery will work very well along side some of the other popular JavaScript libraries such as Dojo, Prototype.js, Ext.js, Mootools, and YUI.
    7. Putty – If you need to connect to your web host via Telnet or preferably SSH, Putty is tough to beat for the price.
    8. WinSCP – WinSCP provides SSH file transfer for Windows machines. If you use Windows on your desktop and a Linux host, this is one of the best ways to upload your files.
    9. Notepad++ – If you want a basic, lightweight text editor to do your coding with color syntax highlighting Notepad++ is a great choice. Even if you use a full featured IDE for your development I find it handy to have a good text editor handy. Notepad++ has several plug-ins available as well.
    10. PHPUnit – If you are developing a web application that you think will be around for any length of time then unit testing is a critical time saver. Chances are you already write tests to check if your code is working if you don’t have a user interface built yet so often you are already committing the time to writing tests. Unit tests developed using a unit test framework allow you to make “assertions” regarding the output of each function or small “units” of code. Unit tests stick with your code throughout it’s life cycle and are usually executed before you check-in a new change. When you run your unit tests using the unit test framework’s executable you can generally test just a single class or your entire code base. This will quickly tell you if the code you just wrote is working correctly and if you have inadvertently broke any existing code elsewhere. For current job my team and I code in primarily PHP and JavaScript so we use the PHPUnit and JsUnit frameworks but there are unit testing frameworks available for nearly all popular programming languages including C++, Java, C#, etc.
    11. Selenium – While unit testing covers individual units of code, integration tests cover how everything works together. Selenium accomplishes this by allowing you to build scripts that you can playback to emulate a user’s browser interacting with your application. Like unit tests, you can make assertions that elements in the web interface are working the way they should. This allows you to effectively perform an automated regression test of your application so you can make sure your code changes didn’t break any interactions between the components of the application. Although I personally really like Selenium, there are other good automated test tools such as Watir
    12. Web Application Vulnerability Scanning Software? – This is an area that will strongly depend on your budget. I think vulnerability testing is essential but short of doing a lot manual probing and experimenting, it is going to cost you. Even if you have read the OWASP guide back and forth and are careful to escape all your inputs, I still think it is important to run a test tool against your app before you release it into the wild. Although automated testing won’t reveal all your security issues it will at least reveal some of the more embarrassing ones. If nothing else, it is important that the script kiddies don’t find anything interesting when they do the same. While there are many open source security tools, I am not aware of any that will do automated application security scanning like HP’s WebInspect, IBM’s Rational AppScan, or Acunetix WVS. I found an interesting comparison between the three here. I would be interested in any alternatives if you know of any.
    13. Security Web Sites – The following web sites are good security “tools”:
    14. WebLOAD? – Instead of hoping your web application will hold up to high traffic volumes, wouldn’t you like to really know for sure? A load testing tool is essential to predicting how your application will behave under load and will also help identify bottlenecks in the application that can be optimized. Optimizing your application based on load test data will help to ensure you are focusing your optimization efforts on the real problem areas. In my current position we were using the alleged open source version of WebLOAD, which, worked pretty well. Unfortunately Radview is making new versions, err… I mean, pro, closed source and I am guessing the licensing costs are ridiculous just by the fact that they don’t list the price on their website or provide a shopping cart so you have to contact their sales folks (I am not a big fan of this practice). I am fine with convincing my boss to buy software if need be so long as it doesn’t cost so much he will laugh at me. So… I am in interested to hear about any other load test tools you have experience with.
    15. Subversion – Version control is essential if you are working on a project for any length of time and especially with other people. Subversion is easy to setup and as long as you back up your Subversion server and make frequent commits, your code will be safe and you can always revert to a previous version if you really mess it up. CVS is also an option but I prefer Subversion because it maintains versions across the entire code base instead of just individual files. This allows you to easily revert a bad multi-file commit. There are plenty of clients available for Subversion and many development tools have subversion support built-in or provide plug-in options.

    Well that’s it for this post. I would really like to hear about any other must-have web app dev tools that you think should be on the list.

  • Review: Herbie the Mousebot Kit by Solarbotics

    Review: Herbie the Mousebot Kit by Solarbotics

    img_7866

    I wanted a quick, easy to build robot kit to get back into electronics and robotics. I ask for a Herbie the Mouse Bot for Christmas and sure enough I got one. It was a fun kit to build and went together in a little over an hour.

    You start off with a PC board…
    Herbie the Mousebot by Solarbotics

    … and a handful of components…

    Herbie the Mousebot by Solarbotics

    You break apart the PC board which serves as a PC board and a body for the mouse which, is pretty cool.

    Herbie the Mousebot by Solarbotics

    The PC boards join together via several solder joints. Tape is used to keep everything together until you are done soldering. A smaller board that holds the 9 volt battery connector helps keep the three main sides together. By the time you are done soldering all the joints it is a pretty sturdy little robot.

    Herbie the Mousebot by Solarbotics
    Herbie the Mousebot by Solarbotics
    img_7855

    The whiskers and tail activate a relay when bumped so the mouse will backup to avoid getting stuck. I taped the relay down while I soldered it in.

    img_7859

    Herbie with the photo diode “eyes” installed….

    img_7861

    Herbie just about finished…

    img_7862
    img_7866

    Herbie is an interesting robot because it uses a simple analog IC, the LM386, to do something you might think requires a much more complicated digital circuit or micro-controller/processor:

    http://downloads.solarbotics.net/PDF/Solarbotics_Herbie_the_Mousebot_Instruction.pdf

    img_7868
    Herbie the Mousebot by Solarbotics

    We don’t have much open bare floor in the house and it moves quite fast so it was a bit of a challenge to keep it under control without hitting too much:

    The Herbie Kit is well engineered and fun to assemble. I give it five stars and recommend it as a good first robot kit.

  • Review: Weller WLC100 Soldering Station

    5 out of 5 stars

    Weller WLC100 Soldering Station

    I have started to take a renewed interest in electronics again lately and wanted to get a good soldering station to work with. I have a couple fixed wattage irons I use for my RC plane wiring but I wanted something adjustable with a variety of alternative tips available.

    I ordered a Weller WLC100 and it is working pretty well for me so far. I also ordered some smaller conical and screwdriver tips that make it easier to solder smaller components and connections. One of the reasons I went with the Weller is because it is a relatively well know brand and I know I will be able to find tips for it.

    There are more expensive solder stations that have digital controls and displays but I decided that an analog control was adequate. After using the station for a bit I am pretty happy with the analog control. The amount of heat transferred is so strongly dictated by the conduction of heat between the iron and the component/pad that I don’t know that such temperature precision makes much difference for most hobby uses. If you just tin the tip of your iron with a little bit of solder it will make significantly help with the transfer of heat from your iron to the component/pad you are soldering.

    Weller WLC100 Soldering Station

    The Weller iron is easy to grip with my fingers and doesn’t get too hot to handle at all. I built a Herbie the Mousebot Kit with it using a .062″ screw driver tip. It was nice to work with and did the job well. I would definitely pick up some smaller tips if you are going to be soldering smaller circuit boards. The screwdriver tip that comes with it is pretty nice but a small tip affords more precision.

    I give the Weller WLC100 5 out of 5 stars. It is a good, relatively cheap soldering station with many tips available. Buy one and a couple tips to go with it:

    Conical Tip, .031

    Narrow SD Tip, .062

  • How to use the PHP cURL module to make HTTP requests from PHP

    Some of my previous posts talked about making HTTP/web requests from PHP with a focus on the PECL_HTTP request module:

    The last post mentioned above covered using the built-in file_get_contents() as an alternative if you are unable to install the HTTP PECL extension or need minimal HTTP functionality. This post will look at a third method of making HTTP requests from PHP, using the PHP Client URL Library AKA cURL library. The PHP cURL library essentially uses the cURL library from the cURL command line utility and makes the calls available via PHP functions.

    Installing the PHP cURL library on Ubuntu requires just a couple simple steps:

    • PHP needs to compile in the cURL library but if you are using Ubuntu you can simply execute the following shell command instead of doing a custom PHP build:
      sudo apt-get install php5-curl
      
    • Restart Apache once the library has installed.
    • Call a page with the phpinfo() function and look for a “curl” section. It should be listed there if everything installed correctly:

      curlinfo1

    Once the cURL library is added you can call the curl functions which are documented here. The following simple example makes a call to www.example.com. You will notice that I did not “echo” the return of curl_exec() to display it. This is because by default, the curl_exec() function displays the result and returns a true on success, false on failure.

    
    

    If you want to assign the output to a variable so you can do something with it, you will need to set the CURLOPT_RETURNTRANSFER option:

    
    

    The PHP cURL library has a variety of options you can set using the curl_setopt() function. This includes setting GET and POST requests, setting fields for each, etc.

    That is the five minute version of the PHP cURL library. Another quick way to make an HTTP request is to just make a system call to the “wget” command utility which is included on most *nix systems:

    
    

    This pretty cool but I think I prefer the other methods because they all run under the Apache process. That’s it for this post!

  • How to setup and use the Xdebug Extension for PHP Profiling

    A profiling tool can provide valuable information about bottlenecks in your code. I believe profiling is a critical aspect of optimizing because it will tell you about your real code bottlenecks as opposed to your perceived bottlenecks. This enables you to focus your resources on areas that will provide the most performance benefit for your effort. Most programming languages and environments have one or more profiling tools available and PHP is no exception.

    Xdebug is a PHP extension that provides valuable debugging information such as stack traces, functions traces, profiling, code coverage analysis, etc. There is another PHP tool called DBG that has similar functionality but this post will focus on using Xdebug.

    Setup Xdebug

    Xdebug is a PECL module and can be installed using the PECL installation instructions in one of my previous posts.

    • If you have already setup PEAR you just need to run the following from a shell:
      sudo pecl install xdebug
      

      If everything goes well Xdebug should download, build, and install. You may get a message telling you:

      You should add "extension=xdebug.so" to php.ini

      Go ahead and add the line. On an Ubuntu server you will probably find the php.ini file here: /etc/php5/apache2/php.ini

    • Restart Apache, or whatever web server you are using, so the change will take effect.
      If you are running Apache on Ubuntu it would be:

      sudo /etc/init.d/apache2 restart
      
    • Write a phpinfo.php page with the following code and then point a browser at it. It should show the Xdebug module there in addition to many other things:
      
      

    At this point the Xdebug extension should be installed. For more detailed instructions on a PECL extension install see my post: How to install a PHP PECL extension/module on Ubuntu. Note that there is a problem running the Xdebug extension with Zend Studio since it has it’s own debugger.

    Enable Xdebug profiling

    • By default, profiling is disable in Xdebug. Enable it by adding the following entry to the php.ini file:
      xdebug.profiler_enable=On
      

      On on a linux box there is often a php.d or conf.d folder that holds additional .ini file settings PHP will use. On Ubuntu the path for this folder is “/etc/php5/apache2/conf.d”. To prevent further cluttering my php.ini file with Xdebug settings, I created a xdebug.ini file to store all my Xdebug .ini file settings. This file is located in the “/etc/php5/apache2/conf.d” so it is automatically scanned when Apache is restarted.

      Now you might be tempted to enable the profiler in your script using the ini_set() function which, normally allows you to temporarily set a .ini setting for only the current script execution. Unfortunately this does not work. You must set it in the php.ini or a sub .ini file and restart the web server.

    • Restart your web server (I.e. Apache) once you have “xdebug.profiler_enable” set to “On”.

    By default, Xdebug will write a cachegrind.out file to the /tmp folder. It will be named something like cachegrind.out.22373 where the number at the end is the ID of the process that was profiled. If you are using Windows you will probably need to change the default folder. Also by default, this file will be overwritten by each script execution so you don’t have to worry about it getting too big. The output file behavior is highly customizable and a complete list of Xdebug settings can be found here.

    Call your script and display the analysis

    With Xdebug enabled, pull up the page in your browser that you want to profile. If everything is working OK a cachegrind.out file should show up in the /tmp folder.

    There are a couple programs you can use to open and analyze the cachegrind file:

    WinCacheGrind

    WinCacheGrind is not very featured but it will tell you the main thing you need to know, which is where your PHP application is spending its time. Click on the screen shot below to see the full output of my test script:

    wincachegrind screen shot

    The script makes an external call to example.com using a file_get_contents() function. Based on this analysis I might try caching the call results and only make the call at some interval to keep the cache updated. This would eliminate almost 75% of the application’s overhead and is just one example of an easy-to-fix bottleneck that profiling will help identify.

    KCacheGrind

    KCacheGrind does essentially the same thing as WinCacheGrind but it is geared for the Linux desktop and has quite a few more bells and whistles:

    kcachegrind screen shot

    KCacheGrind includes a map feature that graphically represents the percentages of where the test application spent the time:

    kcachegrind screen shot

    KCacheGrind also includes a graph feature with an export option that displays a tree diagram of the linkage between all the includes and functions:

    kcachegrindexport1.jpg

    That’s it for this post. Have fun profiling!