archive-com.com » COM » S » STUARTHERBERT.COM

Total: 477

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Stuart on PHP - » Getting Started With ContractLib
    the end of args Contract RequiresValue expectedOptions count expectedOptions getSwitches 0 expectedOptions must have some switches defined method s code follows on here code In this real life code we start off by checking for basic errors first by making sure we re looking at the right type for each parameter and then we follow up with more specific tests that ensure that we have data that we re happy to work with We ve done these tests at the start of the method so that it isn t cluttered with error checking which makes our code much cleaner that it might otherwise be And because all the tests are in one really easy to spot block anyone reading your code can immediately see what they have to do to meet the contract you ve created Because these tests are just plain old PHP code and don t rely on annotations or any other such nonsense the contracts you create and enforce are limited only by your choices But Aren t All Those Tests Slow They are PHP s getting better and better at this but function method calls have always been painfully slow in PHP I m afraid that if you want robust code you can t have it for free You can in C but that s a topic to discuss over a decent whiskey at a conference I ve done key two things with ContractLib to keep the runtime cost down Contract Preconditions accepts a lambda function as its parameter Your contract s tests go inside this lambda function and Contract Preconditions only calls the lambda function if contracts are enabled By default ContractLib does not enable contracts You have to choose to do so by calling Contract EnforceWrappedContracts This keeps the overhead down to just one method call to Contract Preconditions when contracts are not enabled It isn t as good as having no overhead but it s cheaper than the developer time lost trying to track down bugs in code that always assumes the caller can be trusted to do the right thing every time Any Questions I hope these examples have given you an idea on how to get started with ContractLib If you have any questions or suggestions please let me know and I ll do my best to answer them About The Author Stuart has been writing PHP applications since 2003 and has been contributing to open source software since 1994 He was an early writer for php architect a co author of the Official Zend Certification Study Guide for PHP 4 and a regular speaker at conferences and user groups since 2004 When he s not designing software Stuart loves to explore the world through a camera lens spend time with his beloved guitars and continue his study to T ai Chi Chu an Taijiquan No Comments trq says January 16th 2012 at 9 42 am This idea doesn t seem that far removed from the Opt component I recently wrote

    Original URL path: http://blog.stuartherbert.com/php/2012/01/16/getting-started-with-contractlib/ (2016-05-02)
    Open archived version from archive


  • Stuart on PHP - » Introducing ContractLib
    s out of range data that s missing Post conditions should check the same things They can also be used to check for data that should have been changed but hasn t been changed Aren t Programming Contracts Too Old Fashioned For PHP The concept has been around for decades As a C programmer I first learned about programming contracts in the early 90 s when I was writing code that had to run for months at a time with zero downtime We were debugging and improving code dating back from the 1980 s and introducing programming contracts played an important role in getting to the bottom of many of the bugs that users reported PHP code and other modern languages like Java Ruby Scala etc is fundamentally similar to older languages like C although you may not realise that this is the case It s the same fundamental paradigm data is passed into blocks of software and blocks of software may also pass data out too The advantage we have with PHP is that our programming contracts don t have to be as lengthy as they would for a C program because PHP itself can enforce type checks through type hinting and we don t have to worry about low level details like proper handling of null terminated strings Examples You can take a look at ContractLib s unit tests on GitHub I ll post some detailed examples in my next blog post About The Author Stuart has been writing PHP applications since 2003 and has been contributing to open source software since 1994 He was an early writer for php architect a co author of the Official Zend Certification Study Guide for PHP 4 and a regular speaker at conferences and user groups since 2004 When he s not designing software Stuart loves to explore the world through a camera lens spend time with his beloved guitars and continue his study to T ai Chi Chu an Taijiquan No Comments Peter Meth says January 11th 2012 at 3 08 pm I first learned of Programming by Contract while learning Eiffel in school 10 years ago At the time I loved the concept and I hadn t really seen it practiced much in any other language Recently I ve been hearing lots of people preaching about testing and I was thinking it is a good time to introduce the programming contract concept I guess this means it is here Peter Meth says January 11th 2012 at 3 08 pm I first learned of Programming by Contract while learning Eiffel in school 10 years ago At the time I loved the concept and I hadn t really seen it practiced much in any other language Recently I ve been hearing lots of people preaching about testing and I was thinking it is a good time to introduce the programming contract concept I guess this means it is here Stuart Herbert Blog Introducing ContractLib Programming Contracts PHP Boutique says January 13th

    Original URL path: http://blog.stuartherbert.com/php/2012/01/11/introducing-contractlib/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » Real-Time Graphing With Graphite
    rf opt graphite storage whisper stats Getting Graphite To Draw Real Time Graphs Now all we need to do is to get Graphite showing you all the collected data in real time By default Graphite will happily plot the data onto a graph but will only generate an updated graph every 60 seconds That s perfect for an ops team looking for trends over hours but it isn t real time If you re using Memcache with Graphite you ll need to add this to your opt graphite webapp graphite local settings py file to tell Graphite to only cache data in Memcache for 1 second MEMCACHE DURATION 1 Is it worth caching the data at all at this resolution Honestly I don t know I guess that depends on how many people need to watch the data in real time or not Ideally it would be better if Graphite dynamically set the Memcache timeout based on the data stored in the particular key but for now you need to either stop using Memcache or set the cache duration to 1 second This now gives you graphs with 1 second resolution now we just need to change the Graphite web app s auto refresh feature to load a new graph every second By default it will only generate an updated graph every 60 seconds To change this we have to edit some of the app s Javascript code Open the file opt graphite webapp content js composer widgets js and locate the function toggleAutoRefresh Locate the interval variable inside that function Change its value from 60 to 1 Save the file then refresh your web browser page Et voila If you switch on auto refresh you should now be able to see your app s data being plotted second by second giving you a real time view of what your app is doing About The Author Stuart has been writing PHP applications since 2003 and has been contributing to open source software since 1994 He was an early writer for php architect a co author of the Official Zend Certification Study Guide for PHP 4 and a regular speaker at conferences and user groups since 2004 When he s not designing software Stuart loves to explore the world through a camera lens spend time with his beloved guitars and continue his study to T ai Chi Chu an Taijiquan No Comments Graphs says September 22nd 2011 at 4 01 am An informative hub must say Keep writing Graphs says September 22nd 2011 at 4 01 am An informative hub must say Keep writing Graham says November 24th 2011 at 10 28 pm You don t need to delete the wsp files to get the new retention settings to work you just need to run opt graphite whisper bin whisper resize py on them with the new retention settings and it will resize the databases for you Graham says November 24th 2011 at 10 28 pm You don t need to

    Original URL path: http://blog.stuartherbert.com/php/2011/09/21/real-time-graphing-with-graphite/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » Ade Slade’s DbUnit Talk
    neglected part of unit testing one s code The talk and slides are on Ade s blog About The Author Stuart has been writing PHP applications since 2003 and has been contributing to open source software since 1994 He was an early writer for php architect a co author of the Official Zend Certification Study Guide for PHP 4 and a regular speaker at conferences and user groups since 2004 When he s not designing software Stuart loves to explore the world through a camera lens spend time with his beloved guitars and continue his study to T ai Chi Chu an Taijiquan Comments are closed Latest Photos Categories phpnw 1 Beginner 2 Intermediate 3 Advanced Brighton PHP Conferences Opinion phix PHP In Business PSR Servers and Hosting Storyplayer Talks Toolbox Training Uncategorized Archives February 2016 January 2016 November 2015 October 2015 August 2015 March 2015 January 2014 May 2013 April 2013 March 2013 December 2012 November 2012 October 2012 September 2012 August 2012 July 2012 June 2012 May 2012 February 2012 January 2012 October 2011 September 2011 August 2011 July 2011 April 2011 March 2011 February 2011 October 2010 August 2010 July 2010 February 2010 January 2010 October 2009 September 2009 August 2009 May 2009 April 2009 March 2009 February 2009 January 2009 December 2008 November 2008 October 2008 September 2008 August 2008 June 2008 May 2008 April 2008 March 2008 January 2008 December 2007 November 2007 October 2007 July 2007 April 2007 March 2007 February 2007 January 2007 This Month April 2011 M T W T F S S Mar Jul 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Recent Posts How To Do Positive Code

    Original URL path: http://blog.stuartherbert.com/php/2011/04/15/ade-slades-dbunit-talk/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » #phpsw
    re coming by train How To Get Involved Please join the PHPSW Google Group and say hello Be the first to leave a comment PHP South West phpsw User Group Meeting 7pm Wednesday 9th February 2011 Posted by Stuart Herbert on February 1st 2011 in phpsw February s meeting of the PHP SouthWest User Group will be at The Golden Guinea in Redcliffe Bristol from 7pm on Wednesday 9th February What Is Planned I m speaking at the PHP UK conference later in February and will be practising my talk No guarantees but I think Rob Allen might be practicing his talk too How To Get There We ll be at The Golden Guinea 19 Guinea Street Bristol BS1 6SX It s a short walk from Bristol Temple Meads Railway Station if you re coming by train How To Get Involved Please join the PHPSW Google Group and say hello Be the first to leave a comment PHP South West phpsw User Group Meeting 7pm Tonight Bristol Posted by Stuart Herbert on October 13th 2010 in phpsw Tonight s meeting of the PHP SouthWest User Group will be at The Third Floor Bush House Bristol from 7pm We ll be in the conference room for an hour and then from 8pm downstairs in the bar at the Arnolfini What Is Planned There were quite a few of us at last weekend s excellent PHP North West 2010 conference Tonight we ll discuss the talks we attended and share what we liked and what we learned How To Get There We ll be at Bush House 72 Prince Street Bristol BS1 4QD This Google Map has directions if you re walking from Bristol Temple Meads Railway Station When you get to the entrance for Bush House you ll need to press the bottom buzzer marked The Hub to gain access How To Get Involved Please join the PHPSW Google Group and say hello Be the first to leave a comment PHP SouthWest phpsw User Group First Meeting 7pm 1st September 2010 Posted by Stuart Herbert on August 27th 2010 in phpsw The first meeting of the PHP SouthWest User Group will be at The Third Floor Bush House Bristol from 7pm The room is booked big thanks to Del for that and we have a projector sorted too now we just need our first speakers What Is Planned As this is the very first meeting our agenda is still being pulled together but I m hoping that Bitterman will treat us all to a rehearsal of his upcoming talk for the PHPNW10 conference in Manchester in early October I m looking for backup speakers just in case and of course for anyone who wants to speak at next month s meetup We ll be at The Third Floor until 8pm after which we ll move into one of the local pubs probably the Watershed for the social half of the meet up How To Get There We ll be at Bush

    Original URL path: http://blog.stuartherbert.com/php/category/community/phpsw/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » Flickr: Link Your Photos Back To Your Blog
    must rewrite the description preg match Copyright s flickrPhoto description matches if isset matches 1 description matches 1 else description description Copyright c Stuart Herbert Blog Twitter Facebook n Photography Merthyr Road Daily Desktop Wallpaper 25 9 Twitter nn if count flickrPhoto blogPosts 1 description Want to know more about this photo See this blog entry nn else description Want to know more about this photo See these blog entries nn foreach flickrPhoto blogPosts as postUrl blogPost description blogPost title n description is made now to upload it echo Photo photoId flickrPhoto title n echo URL flickrPhoto url n echo Old flickrPhoto description n echo New description n echo nPushing changes to Flickr f photos setMeta photoId flickrPhoto title description echo donen while nextPost null photoIndex array echo Downloading nextPost rawHtml file get contents nextPost echo donen if rawHtml die Unable to download HTML for URL nextPost n preg match Us rawHtml matches postUrl matches 2 title matches 3 echo Blog post title is titlen echo Blog post url is postUrln preg match Previous Post rawHtml matches if isset matches 1 nextPost matches 1 else nextPost null preg match Us rawHtml matches if isset matches 1 die regex failed againn entryHtml matches 1 preg match all http www flickr com photos stuartherbert 0 9 entryHtml matches blogPosts postUrl url postUrl blogPosts postUrl title title blogPosts postUrl matches matches foreach matches 1 as flickrPhoto parts explode flickrPhoto photoId parts count parts 2 photoInfo f photos getInfo photoId flickrPhotos photoId url flickrPhoto flickrPhotos photoId title photoInfo title flickrPhotos photoId description photoInfo description flickrPhotos photoId blogPosts postUrl blogPosts postUrl note the photos we need to update because we have seen this post photoIndex photoId flickrPhotos photoId echo Photo photoInfo title n updatePhotos photoIndex flickrPhotos blogPosts f echo nn echo Photo scraping complete nn when we get to here we have photos to go and update on flickr code About The Author Stuart has been writing PHP applications since 2003 and has been contributing to open source software since 1994 He was an early writer for php architect a co author of the Official Zend Certification Study Guide for PHP 4 and a regular speaker at conferences and user groups since 2004 When he s not designing software Stuart loves to explore the world through a camera lens spend time with his beloved guitars and continue his study to T ai Chi Chu an Taijiquan One Comment Tweets that mention Stuart Herbert On PHP Flickr Link Your Photos Back To Your Blog Topsy com says February 12th 2011 at 9 30 am This post was mentioned on Twitter by Stuart Herbert Christian Koncilia Raden Andi Ramdani PHP Belarus stuphp and others stuphp said Flickr Link your photos back to your blog http t co 3RRRYPT blog Latest Photos Categories phpnw 1 Beginner 2 Intermediate 3 Advanced Brighton PHP Conferences Opinion phix PHP In Business PSR Servers and Hosting Storyplayer Talks Toolbox Training Uncategorized Archives February 2016 January 2016 November 2015 October 2015 August 2015

    Original URL path: http://blog.stuartherbert.com/php/2011/02/12/flickr-link-your-photos-back-to-your-blog/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » 2 – Intermediate
    the discussions with your customer on something like Basecamp in your head You know that you should be using source control and bug tracking because it is best practice but it just seems like too much of an overhead to bother with when it s just you After all you re working on the customer s server and there s no one else editing the code anyway Some of the folks reading this blog post might be cringing at that but I ve lost count of the number of times I ve come across professional PHP developers who work in exactly this way Is it because they don t know better Maybe Is it because it has worked okay for them up to now For sure But eventually there comes a point where one developer becomes a team of two or more Having a team means that you can go after larger projects but it also means that you have to go after larger projects to pay the team Larger projects mean more complicated requirements multiple phased deliveries and a larger more demanding and probably a more complicated customer holding the pay cheque Running a team of PHP developers like all management activity in all walks of life comes down to three key things direction organisation and supervision Only now it isn t just you and a customer just a list that you can keep in your head Now you need to keep track of a larger list of multiple lists for multiple people to work on that need to be brought together in the end and if anything slips through the cracks it s your reputation on the line Getting the customer to come back for repeat business just got a lot less easy to take for granted Trac and Subversion have been part of our community s toolkit for many years now Used correctly you can get yourself and your customers well organised and grow your reputation when you grow your team If you haven t started using them yet both are open source and well backed with plenty of information freely available around the blogosphere on how to use them Or join me in Manchester in early October where I ll show you how they fit into an overall approach to running your team of PHP developers Be the first to leave a comment Join Me In Manchester In October For Training Posted by Stuart Herbert on September 7th 2009 in 2 Intermediate Conferences News Training October in Manchester is home to the PHPNW09 conference Last year s conference was a great event and this year s promises to be even better And I m not just saying that because I m a conference sponsor this year honest Immediately before the conference I m running a two day tutorial in the fundamentals of setting up and running a team of PHP developers covering Keep your promises to your customers using written specifications Organise your team using Subversion and Trac Control quality using code reviews Deliver to your customers using release management and follow up support arrangements Where to go after the course for additional learning Places are limited to just 25 people and there is an early bird discount for anyone who signs up before 21st September You can find out more on the course website and sign up online Be the first to leave a comment 40 Firefox Extensions Every Web Developer Should Check Out Posted by Stuart Herbert on June 16th 2008 in 1 Beginner 2 Intermediate 3 Advanced Toolbox as recommended by readers of Planet PHP Most Recommendations There were six Firefox extensions that folks repeatedly recommended ColorZilla advanced eyedropper color picker page zoomer and other colorful goodies FireBug live DOM CSS inspector The single greatest web developer add on for Firefox Live HTTP Headers view HTTP headers of a page and whilst browsing Web Developer Toolbar adds a menu and a toolbar with various web developer tools YSlow Yahoo s tool for analysing web pages and telling you why they are slow Requires Firebug Zend Studio Toolbar debugging assistance for Zend Studio 5 5 and earlier Isn t mentioned on the Zend Studio 6 pages so does that mean it is now obsolete and after that there was a lot of variety amongst the other extensions that were recommended Also Recommended Cache Status easy cache status management from the status bar ChatZilla IRC client for Firefox Duplicate Tab clone a tab along with its history Edit Cookies edit your cookies right in Firefox Fasterfox performance and network tweaks for Firefox Firefox Accessibility Extension test your web pages for functional accessibility features based on the iCITA HTML Best Practices FirePHP print to your Firebug console using a simple PHP function call FireShot take screenshots of web pages and a whole lot more Google Toolbar Google s famous in browser search toolbar GreaseMonkey customise the way a web page displays using your own Javascript add ons See also Lifehacker s Top 10 Greasemonkey User Scripts and their Better GMail and Better Flickr add ons to get an idea of just what can be done with Greasemonkey as a Firefox extension tool HTML Validator add HTML validation to your browser IE Tab Windows only open Firefox tabs using IE s rendering engine See also the popular IE View alternative LocationBar2 adds additional features to Firefox s address bar Lorem Ipsum content generator Generate Lorem Ipsum dummy text for when you need to fill a page with content for testing purposes MeasureIt draw out a ruler to get the pixel width and height of any element on the web page NagiosChecker see the status of your services and servers in Firefox s status bar You do monitor your servers right PrefBar power user toolbar for Firefox Regular Expressions Tester testing tool for regular expressions with colour highlighting RefSpoof easy spoofing of the HTTP referrer header ReloadEvery reloads a web page every so many seconds Save Session save

    Original URL path: http://blog.stuartherbert.com/php/category/skill-level/intermediate/page/2/ (2016-05-02)
    Open archived version from archive

  • Stuart on PHP - » Phix 0.16.0 Released
    To update your copy of Phix please run pear upgrade phix phix4componentdev Any problems please let me know About The Author Stuart has been writing PHP applications since 2003 and has been contributing to open source software since 1994 He was an early writer for php architect a co author of the Official Zend Certification Study Guide for PHP 4 and a regular speaker at conferences and user groups since 2004 When he s not designing software Stuart loves to explore the world through a camera lens spend time with his beloved guitars and continue his study to T ai Chi Chu an Taijiquan Add Your Comments To This Article Using The Form Below Your name required Your email address will not be published required Your website Your comment Your comments may not appear until they have been approved by a moderator Latest Photos Categories phpnw 1 Beginner 2 Intermediate 3 Advanced Brighton PHP Conferences Opinion phix PHP In Business PSR Servers and Hosting Storyplayer Talks Toolbox Training Uncategorized Archives February 2016 January 2016 November 2015 October 2015 August 2015 March 2015 January 2014 May 2013 April 2013 March 2013 December 2012 November 2012 October 2012 September 2012 August 2012 July 2012 June 2012 May 2012 February 2012 January 2012 October 2011 September 2011 August 2011 July 2011 April 2011 March 2011 February 2011 October 2010 August 2010 July 2010 February 2010 January 2010 October 2009 September 2009 August 2009 May 2009 April 2009 March 2009 February 2009 January 2009 December 2008 November 2008 October 2008 September 2008 August 2008 June 2008 May 2008 April 2008 March 2008 January 2008 December 2007 November 2007 October 2007 July 2007 April 2007 March 2007 February 2007 January 2007 This Month May 2013 M T W T F S S Apr Jan 1

    Original URL path: http://blog.stuartherbert.com/php/2013/05/23/phix-0-16-0-released/ (2016-05-02)
    Open archived version from archive



  •