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 - » 2012 » June
    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 2 comments 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 June 2012 M T W T F S S May Jul 1 2 3 4 5 6 7 8

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

  • Stuart on PHP - » 2012 » May
    marketing of all is word of mouth and having customers going to meetups and saying that they re using our product because it solves their problems is a very important way of finding new customers We re just outside London which is a veritable hive of startup activity these days But looking on Meetup com for existing meetups for Node JS all I could find is this waiting list I did find the London Node User Group via Lanyrd and I plan on trundling over to their next meetup on Wednesday but that was it We seem to have meetups coming out of our ears in London right now on all sorts of technical topics the lack of ones focused on Node really does stand out Thoughts And Conclusions For a product that has had a lot of sustained buzz and which is a good solution for some technical problems the almost complete absence of an ecosystem around Node JS caught me completely by surprise Are we just ahead of the curve and using Node JS very early on in its adoption Are there resources out there that I ve just failed to find Or is Node JS actually just another passing trend which failed to get enough traction I don t know Your thoughts and comments most welcome below 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 42 comments Getting PEAR Working On Windows 7 Posted by Stuart Herbert on May 10th 2012 in 2 Intermediate phix Toolbox So that I don t forget how to do this next time around Worked for me your mileage may vary First step is to get a working install of PHP Download PHP 5 4 latest ZIP file from the PHP Windows website Unpack the ZIP file into c php You should end up with c phpphp exe Copy c phpphp ini development to be c phpphp ini Edit c phpphp ini to suit e g set date timezone Make sure you add c php to your system PATH via Computer s Advanced Properties Environment Variables Reboot this is Windows after all At this point you should be able to open up a Command Prompt and type php v and see the response PHP v5 4 latest appear as expected Now for PEAR itself Open http pear php net go pear phar in a browser save this file into c php In a Command Prompt cd to c php and then run php c phpgo pear phar At the prompt select system A text

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

  • Stuart on PHP - » 2012 » February
    the screen you ll see an explanation of what the error is Sometimes the syntax error will appear to be on the wrong line on the line below where the real problem is SublimeLinter uses the php l command behind the screens PHP s built in linter and is simply reporting back exactly what the PHP runtime thinks is wrong This might puzzle you at first if you re used to IDEs that have their own lint algorithm built in Consulting The PHP Manual Using Goto Documentation The PHP Manual is imho PHP s true killer feature all that detailed documentation and it s all freely available on the web no need to go away and buy books on the language Like many PHP developers I ve always got the PHP Manual open when I m working The Goto Documentation plugin allows me to look up any PHP function from inside ST2 The plugin is available via Package Control and once installed you need to bind it to a key before you can use it This is done by opening the Key Bindings User option on ST2 s Preferences menu and adding a line like the following keys f1 command goto documentation Save the file and you re ready to go To use it just put your text cursor on the PHP function that you want to look up and hit your chosen key combination Goto Documentation will switch to your browser and search the PHP Manual for the function you ve selected Handling Trailing Whitespace Using The TrailingSpaces Plugin I know it s a small thing but trailing whitespace annoys the crap out of me and I ve always been deeply frustrated with how Netbeans never reliably stripped this from files that I created or worked on Thankfully this isn t a problem with ST2 and you can add the TrailingSpaces plugin to strip files in between saving them Testing Using PHPUnit The PHPUnit plugin disclaimer I am the plugin s author allows you to run your unit tests right from inside ST2 You can run the tests for just the file you ve got open or you can run all of your project s unit tests in one go You can also switch back and forwards between your PHP code and your unit test files and you can quickly open your project s phpunit xml file To use the plugin your project needs to have either a phpunit xml file or a phpunit xml dist file This is a simple config file that tells PHPUnit where your tests are which folders to include ignore for code coverage purposes and what reports logs PHPUnit should create once the testing is done If you re using something like Phix you get all of this for free and I believe that Symfony s standard app skeleton also includes a phpunit xml file too The plugin navigates around your project switching from file to file using the following algorithm It takes the full name of your PHP class including the namespace and uses the PSR0 autoloader algorithm to try and find the same class with Test appended on the end If that doesn t work it strips off the namespace and tries again To find the phpunit xml file the plugin finds the test code first and then searches each folder upwards for phpunit xml or phpunit xml dist If that doesn t work it looks in a number of pre determined locations defined in the plugin s settings file and then as a last resort it searches your whole project downwards starting from the top folder When you run your tests the full output from PHPUnit appears in a panel at the bottom of ST2 s window and that includes information on the full command executed and which folder it was executed from To close the panel just hit ESC Alignment Plugin This is a very simple plugin it allows you to select some lines of code and have all of the equals signs line up under each other I find that this can make code and especially array definitions much clearer to read but I know that it isn t for everyone Software Archaeology Using CTags One of the ways that IDEs add a lot of value is that they truly understand the code you re working on and that allows them to offer features like goto source definition et al There s a way you can do this in ST2 by installing the CTags plugin Once you ve installed the CTags plugin before you can use it you need to go to the plugin s website and follow the instructions there to get a suitable ctags command line program installed The plugin is a wrapper around this command s functionality and cannot work without it Then the next step is to build a tags file This is an index of all of your code that the plugin can use to look up classes functions and methods so that you can quickly jump to their definition from anywhere in your project This is done by hitting CTRL T and then CTRL R and then waiting for the finished building message to appear in the status bar After that you can navigate around your code by hitting CTRL T and then CTRL T again This works particularly well for exploring code you haven t seen before something that I demo in the video below One last word of advice CTags understands the syntax of your code but not the strategy It doesn t understand the difference between trunk and branches folders for example or vendor folders If there s code in there CTags by default will index it This might be what you want but if you find that it s picking up duplicates that you re not interested in you ll need to create a CTags sublime settings file in your User package folder to override the ctags command setting and add in some exclusions What Else There s one notable exception that I haven t covered here and that s SublimeCodeIntel This is a plugin that aims to bring Komodo s autocompletion over to ST2 It s a great idea but my own experience with the plugin isn t good I ve seen it installed on two different computers running the same OS and version of ST2 and it work fine on one and not work at all on the other I ve seen it stop working after a new version of the plugin was released I ve learned to live without it But do go try it out because if it works for you you might really like it Are there any other ST2 plugins that you use on a daily basis Mention them in the comments below and I ll check them out 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 111 comments 10 Reasons Why I ve Switched From Netbeans To Sublime Text 2 For PHP Development Posted by Stuart Herbert on February 20th 2012 in Opinion Toolbox I ve recently switched from using Netbeans as my PHP dev tool of choice to Sublime Text 2 Features wise I think Netbeans is great During the years I used it I never felt that there was a feature I needed that was missing at the time But like all the current crop of Java based desktop IDEs it s so damn ugly 1 and slow 2 that I ve had enough I program because it s something that I love doing and anything that gets in the way of that I ve no time for any more So when a work colleague introduced me to Sublime Text 2 I was in the mood to give it a go and 3 months on I haven t opened Netbeans once I ll be the first to say that Sublime Text 2 isn t for everyone It s a beta product which means there are some rough edges mostly in the plugin API I feel but it s more than stable enough for production use It has crashed a couple of times which might put some people off but I don t recall losing any work as a result File management in the project pane still needs work The regular dev builds occasionally break things It isn t a full blown IDE it s more like the spiritual successor to TextMate an editor that I never personally cared for In particular it doesn t support interactive debuggers which means no Xdebug support and there s currently no obvious way for a plugin to add that functionality in 3 Auto completion isn t anything like what you re used to The built in auto completion is based on a mix of static knowledge of languages and fuzzy matching against what you ve recently typed There s no obvious intelligence about the code you re working on nor the parameters for any method or function These are two things that many people will deeply miss 4 It isn t free but you can evaluate it for free with no time limit If you decide to buy it s substantially cheaper than both PhpStorm and Zend Studio and there s no annual subscription element to the licensing You re buying a license to support and encourage an independent developer and to show your appreciation for a very nice piece of software It s a closed source product You can t fix it yourself if it breaks and no one can pick up the reigns if it gets abandoned There seems to be just one guy behind it and if anything happened to him that d probably be the end of the product That said most of the alternatives are also closed source too Given all of that why have I switched Sublime Text 2 is very very fast Sublime Text 2 itself opens instantly Files open instantly provided they re not 100 megabyte test data files In fact everything happens instantly even inside a virtual machine running on a 3 year old laptop There are no pauses for anything to be indexed and I ve never seen CPU usage spike important for us untethered users and our suffering laptop batteries 5 And if a plugin slows things down at all Sublime Text 2 tells you which one is the culprit so that you can go and disable it I d compare the importance of the speed difference to switching from a hard disk to an SSD You don t realise how much you re waiting for your slow Java based IDE until you use something that s properly fast It renders fonts properly Droid Sans Mono and Ubuntu Mono in particular both look gorgeous and even after a long day of use my eyes don t feel like they ve been scratched on the inside by sharpened kitty claws all day long 6 True story one of my colleagues came over to ask what I was using because he thought it looked so nice from a distance When was the last time anyone ever thought that about a desktop Java app All of the searching is based on an extremely powerful fuzzy matching approach Netbeans supports regexes which can be very handy but most of the time when I m looking for something a regex is overkill but a simple string search isn t powerful enough If I ve got both a class called IpcProcess and IpcProcessID in Sublime Text 2 I can find the IpcProcessID class by searching for ipi I just have to type the shortest set of characters that uniquely matches what I m looking for It s much quicker than writing or running a regex and soon becomes second nature There s a goto anything search panel which is lightning quick Combined with the fuzzy matching approach I find this a godsend for working on multiple large code bases where there may be different classes with the same base filename or duplicate installs of a class in vendor folders or where I ve got both trunk and branches checked out for the same project It s a killer feature and one that has changed my workflow for the better especially combined with my next reason The panel s also like using Google Instant you get results as you type giving you the instant feedback you need to refine your fuzzy search There is also a goto symbol search panel and a command palette which allows you to search through the available editor commands to execute Everything can be done from the keyboard Everything can be done from the mouse too but I found that doing everything from the keyboard is both faster and doesn t break the flow of what I m working on This is something I didn t appreciate until after I d switched but it s a fantastic help to me when I ve got another developer sat next to me and we re looking at or for something together Together with the fuzzy matching it s like doing software archaeology with a JCB digger instead of a trowel It does a great job of auto detecting whether a file uses spaces or tabs for indentation and how big the tab stop is There are days when it seems like no two files I open are consistent in how the code is indented and it s rare for anyone to have tagged on a modeline to give any hints With Netbeans which has a rigid config based approach to indentation I end up playing code formatting table tennis with the original author of the file as we always seem to have different indentation settings Sublime Text 2 works out what the existing indentation approach is and just auto configures itself to match It s a great time saver 7 It strips trailing spaces from the ends of lines when I save my files This has been broken in Netbeans for years It s a small thing I know but it really annoys the crap out of me that Netbeans doesn t get this right As a bonus in Sublime Text 2 trailing spaces actually get their own setting in color schemes so you can see exactly where they are In Netbeans they re bloody invisible There s a healthy ecosystem of plugins for it over 200 plugins and counting thanks to Will Bond s Package Control package manager Will is doing a great job of making sure that each plugin is tightly focused on sorting one problem only to keep Sublime Text 2 as flexible and adaptable as possible something to keep in mind if you start writing plugins yourself Creating new plugins is very easy It took me just one evening to add and release the initial PHPUnit plugin and that included the time it took to learn both Python and the plugin API from scratch To make an update to your plugin simply push your changes to your master branch on GitHub It s as close to frictionless as you can get I can own the tool and set it up to suit my approach to programming Because extending the editor is so effortless I can automate anything that I want to suit exactly how I want it done I can create snippets intelligent macros and full blown plugins to suit and I can make them as and when some new need occurs even one off tasks In this it reminds me most of JED which was my text editor of choice back in the 90 s for exactly the same reason It s the same reason folks love Vim Btw Sublime Text 2 has a Vim mode I haven t tried it so I can t vouch for whether it s good enough to tempt Vim users over or not Like Netbeans Sublime Text 2 works on OS X Linux and Windows 8 so I can use it everywhere I used to use Netbeans I reckon it occupies a sweet spot that makes it very well suited to scripting languages and C C development albeit minus support for interactive debuggers At work some of us have taken to it and some of us haven t I m happy to recommend it to anyone who s looking for a change You can take advantage of the open ended free evaluation period and see if it suits you or not It s working for me so far and I probably spend more time using it than any other app on any of my computers If you do like Sublime Text 2 I d love for you to leave a comment below with your own reasons why Footnotes Dear Java the 1990 s called and asked for their crappy non aliased font renderer back I think Windows 3 11 is missing it terribly There was a similar parallel around 20 years At the time Emacs was by far the most fully featured editor but everyone I know chose vi because of how slow and bloaty Emacs was at the time It was so bad we used to say that Emacs stood for Eight megs and constantly swapping this was back in the days of 640K of RAM The lack of debugger support is for me the one feature that I miss every single day There is a plugin that tries to bring Komodo s auto completion to Sublime

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

  • Stuart on PHP - » 2012 » January
    really consider how much it is costing you when you don t use these kinds of tests 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 Be the first to leave a comment Getting Started With ContractLib Posted by Stuart Herbert on January 16th 2012 in 2 Intermediate Examples phix In my last blog post I introduced ContractLib a simple programming by contract library that I ve created for PHP 5 3 onwards And I promised some examples Installing ContractLib ContractLib is available from the Phix project s PEAR channel Installing it is as easy as code lang bash pear channel discover pear phix project org pear install a phix ContractLib code At the time of writing this will install ContractLib 2 1 0 We use semantic versioning so these examples will continue to work with all future releases of ContractLib 2 x Adding ContractLib To Your Project Assuming you re using a PSR 0 compatible autoloader just import the Contract class into your PHP file sourcecode language php use Phix ProjectContractLibContract sourcecode Adding A Pre condition Contract To Your Method Or Function Take a trivial method like this code lang php class ActionToApply public function appendNow params params time code This method works fine until someone passes a non array as the parameter At that point your code stops working not because your code is wrong but because someone used it in the wrong way This is a classic cause of buggy PHP apps Thankfully it s very easy to address using ContractLib If we were certain that the params parameter was always an array then we can keep the method itself extremely simple and clean We can ensure that by adding a pre condition using ContractLib code lang php use Phix ProjectContractLibContract class ActionToApply public function appendNow params Contract Preconditions function use params Contract RequiresValue params is array params params must be an array original method code continues here params time code Now if someone passes in a non array the caller will automatically get an E5xx ContractFailedException which makes it clear that the fault is in the caller s code not your s PHP 5 4 s upcoming support for better type hinting is another way to catch this kind of error but not only does ContractLib work today with PHP 5 3 which means you don t have to wait to migrate to PHP 5 4 but also that you can write tests for anything not just the checking that s built into PHP This means you can make your code much more robust by tightening up on the quality of the parameter passed into your code by other programmers To extend our example we might decide that an empty array is also unacceptable code lang php use Phix ProjectContractLibContract class ActionToApply public function appendNow params Contract Preconditions function use params Contract RequiresValue params is array params params must be an array Contract RequiresValue params count params 0 params cannot be an empty array original method code continues here params time code The point here is that we can go way beyond type hinting checks important as they are and look inside parameters to make sure they are suitable Here s a real example from Phix s CommandLineLib code lang php use Phix ProjectContractLibContract class CommandLineParser public function parseSwitches args argIndex DefinedSwitches expectedOptions catch programming errors Contract Preconditions function use args argIndex expectedOptions Contract RequiresValue args is array args args must be array Contract RequiresValue args count args 0 args cannot be an empty array Contract RequiresValue argIndex is integer argIndex argIndex must be an integer Contract RequiresValue argIndex count args argIndex argIndex cannot be more than 1 beyond 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

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

  • Stuart on PHP - » 2011 » October
    the very best UK tech conferences around If you ve never been to any PHP conference anywhere before I hope these photos manage to show you just a little bit of the cracking atmosphere you re missing out on If you like these photos please do let me know leave a comment on my blog or click through each photo to Flickr and leave a comment there Thanks 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 Be the first to leave a comment PHPNW11 How To Dig Your Own Grave Posted by Stuart Herbert on October 12th 2011 in phpnw Conferences The PHP North West User Group ran it s 4th and largest yet PHP conference PHPNW11 in Manchester last weekend This year s conference line up was particularly strong both with the quality of speaker and the quality of topics but there was one talk in particular that topped them all It all began with Rowan s laptop So Rowan had this laptop but no matter how hard he stared at it it just wasn t going to work with the projector at the conference so his friends rallied round and swaped his laptop for one that would work the audience watches on with growing hilarity as Ben Lorna and Ian try to get Rowan s PDF slides presenting nicely in OSX s Preview only to be thwarted when the remote control for moving from slide to slide doesn t work in the end Rowan press gangs the conference s keynote speaker into being his Speaker Slave TM advancing the slides forward on command throughout the talk Many speakers would have been destroyed by the sequence of problems but Rowan successfully turned them into a great warm up for what was without doubt the funniest talk all day 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 Be the first to leave a comment PHPNW11 Conference Saturday Speakers Photos Posted by Stuart Herbert on October 11th 2011 in phpnw Conferences The PHP North West User Group ran it s 4th and largest yet PHP conference PHPNW11 in Manchester last weekend Once again there were three main tracks to the conference a total of 15 speakers from both near and wide to choose from New this year was the fourth track the Unconference perhaps lightning talks would be a better description tbh organised by Elizabeth Naramore Unfortunately it was too dark in the Unconference to shoot handheld but hopefully Rob Allen snagged some of the speakers from there during the day At times I struggled in the main rooms too with the low light so my apologies to those speakers I didn t snag clean shots of this year These are my photos of all of the speakers from the main tracks on Saturday Derick s talk on building extensions for PHP was so popular that there wasn t room for me to get the door open far enough to snag a shot sorry Rowan s talk deserves its own blog post and photo set coming soon If you like these photos please do leave comments either here on the blog or on Flickr by clicking on the photo 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 Be the first to leave a comment PHPNW11 Conference Tutorial Day Photos Posted by Stuart Herbert on October 10th 2011 in phpnw Conferences The PHP North West User Group ran it s 4th and largest yet PHP conference PHPNW11 in Manchester last weekend New this year was Tutorial Day the opportunity to spend half a day or more in hands on tutorials getting into the nitty gritty of useful subjects such as Zend Framework 2 Security Drupal Web Services and Component Architectures These are my photos from the Tutorial Day 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 Be the first to leave a comment Your Preparation For My PHP Components Session At phpnw11 On Friday Posted by Stuart Herbert on October 4th 2011 in phpnw Conferences Coming to my Friday session Maintainable Applications In PHP Using Components at PHP NorthWest 2011 Conference Great I m looking forward to meeting you And

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

  • Stuart on PHP - » 2011 » September
    gh pages git checkout gh pages git push u origin master git push origin gh pages Now you should receive a notification from GitHub can be sent via email too depending on your notification settings telling you that your page build was successful 2 It might take as long as up to 10 minutes before your pages will appear on http yourusername github com pear repository the first time you push your changes Following pushes should update the pages almost instantly Now on to see if it works as it should if pear channel discover http yourusername github com pear repository does not return any errors everything went fine You might want to check http yourusername github com pear repository using a browser to see if it has been uploaded first you will get a 404 if it is not Creating A PEAR Package Using Phix If you are using Phix to help maintain your project you have an environment which already is configured for generating PEAR packages But first you have to configure Phix so that it will generate the proper package xml file First we edit the project channel value in build properties project channel yourusername github com pear repository Then we go on to the package xml file most of the everyday stuff like adding files etc will be handled by Phix but the descriptions version history and package requirements need to be edited manually See the PEAR package xml documentation for more information Don t forget to bump version info in build properties and change log information in package xml when you are creating a new package version When you have got the package xml and build properties configured properly use the command phing pear package to create a PEAR package which will be placed in dist packagename X Y Z tgz Adding The Package To Your PEAR Channel To add a PEAR package you just use pirum add my pear repository my pear package X Y Z tgz cd my pear repository git commit a m Added my pear package X Y Z git push Then visit yourusername github com pear repository with your browser to see a list of all the uploaded packages Conclusion In the beginning there was only pear php net the only resource for PEAR packages in the world Then other package channels arrived and publishing your own PEAR package channel became really easy with Pirum Now you don t even need your own web server to host it you can host it on GitHub along with the source code for your PEAR package Now if we only can get some kind of PEAR channel aggregator or similar thing to avoid having to use channel discover for every new tool we want to install Footnotes The channel name must match the regular expression a zA Z0 9 a zA Z0 9 a zA Z0 9 You might want to turn off email notifications for successful page builds because the emails can easily pile up if you make many pushes 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 Be the first to leave a comment Real Time Graphing With Graphite Posted by Stuart Herbert on September 21st 2011 in 2 Intermediate Toolbox If you re building a web based app it s always a good idea to build some instrumentation into your app That way you can see how your app is behaving and how your users are interacting with your app over time I m sure everyone who reads my blog is familiar with Google Analytics for tracking page hits But what about what s happening inside your app Right now Do you know Graphite is one way to graph the stats that you add to your app Combine it with say statsd from Etsy and adding any stats you want is easy Read this blog post from Etsy if you want to learn more about measuring your app and how to add support for Statsd to your app Normally you ll probably be interested in looking at graphs that show your stats over a period of hours or days for trend analysis and both Graphite and Statsd are sensibly tuned for that But what if you want to see what s happening now in real time I couldn t find any clear instructions on how to do that elsewhere so here s my take on how to do it I m assuming you re already familiar with installing both Statsd and Graphite and that you ve already had both up and running successfully with their default configurations Making Statsd Forward Data In Real Time By default Etsy s Statsd collects the data sent from your apps and forwards it on to Graphite s data collector known as Carbon every 10 seconds For real time we need the data forwarded on every second To do that edit your Statsd config adding the flushInterval value graphitePort 2003 graphiteHost localhost port 8123 flushInterval 1000 A value of 1000 tells Statsd to forward data on every second Making Graphite Store Data At One Second Resolution Graphite s default sample configuration tells it to store incoming data at 60 second resolution that allows us to look at the total stats recorded minute by minute but we can t drill down to see what happens second by second To do that we have to tell Graphite to store the data on a second by second basis Edit opt graphite conf storage schemas conf and add the following clause

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

  • Stuart on PHP - » 2011 » August
    different file roles that the PEAR installer expects to find when we distribute our component as a PEAR compatible package One of the most important file roles allows you to ship your tests with your package and it s vital that this is something that you get in the habit of doing routinely Test Your Code And Ship Your Tests If you want other developers to re use your code in their projects it is essential that you earn their trust Trust has to be earned over time by establishing a track record of dependability There are many things you need to do to establish such a reputation such as semantic versioning to flag backwards compatibility breaks and writing unit tests to prove that your code works as expected Although the PEAR Installer has long supported shipping unit test code to date the PHP community hasn t really embraced this and it is still very rare for a PEAR package to include unit tests when downloaded This is also compounded by unfortunate legacy choices in some Linux distributions ubuntu bug fedora bug where unit test code currently ends up being installed under the same directory tree as the main code from the PEAR packages something that only really matters since the PHP Community started to adopt PSR 0 as the standard for autoloading What Are PHP Tests PHP tests the test file role supported by the PEAR Installer are executable tests There is currently no formal standard for these tests however PHPUnit has emerged as the community s de facto standard for unit tests and is the approach that the PHP components skeleton supports out of the box to make life much easier for you Just as important as shipping tests is making sure that it is extremely easy for someone who knows nothing about your code to safely and reliably execute any tests that you ship The components skeleton handles much of this for you by including a PHPUnit bootstrap php file and a build xml file with full instructions on how to execute the tests However it is important that you write your tests in a way that doesn t rely on anything that your users won t have installed or configured Where Do Tests Go Inside Your Component s Structure If we look at the CommandLineLibrary component you ll find that the unit test files live in the src tests unit tests folder Important notes The folder structure underneath src tests unit tests exactly matches the folder structure for both PHP scripts and PHP files under the src folder Each unit test script is designed for PSR 0 autoloading just like the PHP scripts that they test Each unit test script ends in the word Test This is a convention that is supported in IDEs such as Netbeans Where Does The PEAR Installer Install The Tests When you use the PEAR installer to install your component pear install phix CommandLineLib all of the test files get installed

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

  • Stuart on PHP - » 2011 » July
    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 Be the first to leave a comment Creating PHP 5 34 Packages On Debian Ubuntu Posted by Stuart Herbert on July 31st 2011 in Toolbox I was just wondering if anyone has published instructions on how to take the latest PHP 5 3 and PHP 5 4 source tarballs and turn them into drop in packages for Debian and Ubuntu a la the DotDeb or Damz s packages 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 Be the first to leave a comment 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

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



  •