ajax_jones_horse_burger

Waitrose selling horse burgers with beef in !

This is bad, waitrose black beauty burgers now have beef in them !! +10    More »

Parse Web Pages with PHP Simple HTML DOM Parser

Parse Web Pages with PHP Simple HTML DOM Parser via Parse Web Pages with PHP Simple HTML DOM Parser.##   very useful instead of messing around with regex and preg_match ! 00 More »

Using PHP_SELF in the action field of a form

http://www.html-form-guide.com/php-form/php-form-action-self.html a simple example of how to use PHP self in a page   The complete code of “form-action.php” Here is the combined code, that contains both the form and the PHP More »

outputting all array values to file with php – Stack Overflow

I was looking to save get, post or request vars to disk with php and this one liner was the perfect antidote. Nice and simple providing you remember to put the write More »

MySQL GROUP BY Modifiers the one called rollup

what an amazing SQL option, basically adds a group total to any records that you run, and identified by a null so you dont confuse it with returned data   http://dev.mysql.com/doc/refman/5.0/en/group-by-modifiers.html +10 More »

Waitrose selling horse burgers with beef in !

ajax_jones_horse_burger

ajax_jones_horse_burger

This is bad, waitrose black beauty burgers now have beef in them !!

+1
0
  

Parse Web Pages with PHP Simple HTML DOM Parser

Parse Web Pages with PHP Simple HTML DOM Parser

via Parse Web Pages with PHP Simple HTML DOM Parser.##

 

very useful instead of messing around with regex and preg_match !

0
0
  

Using PHP_SELF in the action field of a form

http://www.html-form-guide.com/php-form/php-form-action-self.html

a simple example of how to use PHP self in a page

 

The complete code of “form-action.php”

Here is the combined code, that contains both the form and the PHP script.

php
if(isset($_POST['submit']))
{
    $name = $_POST['name'];
    echo "User Has submitted the form and entered this name : <b> $name </b>";
    echo "<br>You can use the following form again to enter a new name.";
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
   <input type="text" name="name"><br>
   <input type="submit" name="submit" value="Submit Form"><br>

</form>

+1
0
  

outputting all array values to file with php – Stack Overflow

I was looking to save get, post or request vars to disk with php and this one liner was the perfect antidote. Nice and simple providing you remember to put the write file acces on the log file of course.

It sounds like you need a log to store the $_GET variables being submitted to your script, for debug purposes. I’d do something like this appending values to the end of the file, so the file is not overwritten every request:

file_put_contents('path_to_log.txt', print_r($_GET, true), FILE_APPEND);

 

It sounds like you need a log to store the $_GET variables being submitted to your script, for debug purposes. I’d do something like this appending values to the end of the file, so the file is not overwritten every request:file_put_contents’path_to_log.txt’, print_r$_GET, true, FILE_APPEND;

via outputting all array values to file with php – Stack Overflow.

0
0
  

MySQL GROUP BY Modifiers the one called rollup

what an amazing SQL option, basically adds a group total to any records that you run, and identified by a null so you dont confuse it with returned data

 

http://dev.mysql.com/doc/refman/5.0/en/group-by-modifiers.html

+1
0
  

Apache JMeter – Apache JMeter™

The Apache JMeter™ desktop application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

Another step towards making sure your site is not only working but can handle the user load that you might want to expect. At least run it to make sure you are capable of handling load, push it further and see where your hardware or software fails. A way to make sure you have the right indexes on your MySQL

 

 

via Apache JMeter – Apache JMeter™.

0
0
  

PHPUnit: from zero to hero

PHPUnit testing, you should be doing this, either because you want to do TDD or you want decent CI test units to build your sites and keep up with the regression testing

 

Incomputerprogramming,unittestingisamethodbywhichindividualunitsofsourcecodearetestedtodetermineiftheyarefitforuse.Aunitisthesmallesttestablepartofanapplication.WikipediaWHATISUNITTESTING?

Youhaveapieceofcodethateveryoneistooterrifiedtotouch.Youretooscaredtorefactororchangeapieceofcodebecauseyoucantpredicttheimpactitwillhaveonyourapplication.Releasesareacompletenightmare.Youvehadtoworklateorthroughaweekendtotrackdownabug.HAVEANYOFTHESEEVERAPPLIEDTOYOU?

WRITINGTESTSISHARD,WRITINGGOODTESTSISEVENHARDER

AstudyconductedbyMicrosoftandIBMshowedwritingtestscanadd15%-35%todevelopmenttimebutreducethenumberofbugsby40%-90%!Writingcodethatiseasilytestableencouragesbestpractices,suchasSOLIDprinciples.HavingasetofunittestscanhelpyoumakesureyourdeploymentsarepainlessratherthanpainfulNoneofuswanttobestuckatworkallweekendtryingtoworkoutwhyacodechangehasbrokenthewholeapplication.BUTWORTHWHILE

WHATISPHPUNIT?

PHPUnitisaunittestingframeworkwritteninPHP,createdbySebastianBergman.PartofthexUnitfamilyoftestingframeworks.WhilethereareotherunittestingframeworksforPHP(suchasSimpleTestorAtoum)PHPUnithasbecomethedefactostandard.Majorframeworks,suchasZend,SymfonyandCake,andmanyotherPHPprojectssuchasDoctrinehavetestsuiteswrittenwithPHPUnit.INTRODUCTIONTOPHPUNIT

INSTALLINGPHPUNIT

MinimumrequirementisPHP5.2.7but5.3.Xisrecommended.Ifyouwantcodecoverageanalysis(youdo!)youneedtoinstallthePECLxDebugextension.BestinstalledviathePEARinstallersoyouneedtohaverunthepearinstallation.REQUIREMENTS

IfinstallingviaPEARyouneedtwocommandstogetupandrunning:Fullinstallationinstructions(includingotheroptionalPHPUnitmodules)canbefoundathttp://www.phpunit.de/manual/3.6/en/installation.htmlINSTALLINGVIAPEAR

WRITINGTESTS

Thegeneralaimistomakesureeverypossiblepaththroughyourcodeisexercisedatleastonceinatest.Thismeansyouneedtowriteteststhatexerciseerrorconditionstoo.Ruleofthumb:onetestmethodperexpectedoutcomepermethodtested.Havedescriptivetestmethodnames.Namethetestclassaftertheclassbeingtested.TESTWRITINGBESTPRACTICES

Simplyaddrequire_oncePHPUnit/Autoload.phptoeachtestfile.APHPUnittestisaclassthat(usually)extendsPHPUnit_Framework_TestCase.TheclassnameshouldendwiththewordTest,e.g.FooBarTest.Eachtestclassshouldbeinitsownfilenamedaftertheclass,e.g.FooBarTest.php.Eachtestmethodnamemustbeginwiththewordtest,e.g.testSomethingWorksorhavean@testannotation.Testmethodsmustbepublic.Theclassmustcontainoneormoremethodsthatperformtestsorthetestcasewillfail.Atestmethodmustcontainoneormoreassertions,bemarkedasincompleteorskipped.TESTBASICS

Afixtureinatestissomething(usuallyanobject)thatyouwanttotest.AlsoknownasSystemUnderTest(SUT).PHPUnitwillsetupfixturesforyouifyouaddprotectedmethodssetUpandoptionallytearDowninyourtestclass.Youprovidecodetocreate/destroyfixturesinthesemethods.Thesemethodsarecalledbeforeandaftereachtestmethodsothateachtestrunsonfreshfixtures.setUpBeforeClassandtearDownAfterClassarealsoavailable.Thesearerunonceatthebeginningandendofthetestclass.TESTFIXTURES

AssertionsareusedtotestexpectedbehaviourfromyourSUT.PHPUnitprovidesmanydifferentassertionsforallsortsofneeds,e.g.assertEquals,assertEmpty,assertTrue,assertType,etc.YoucanalsotestoutputusingexpectOutputString.MorecomplicatedassertionscanbeconstructedusingassertThat.Foratesttopassallassertionsmustevaluatetotrue.WRITINGASSERTIONS

PHPUnitsupportsannotationstogiveinstructionstothetestmethodbeingexecuted.Annotationsareincludedinblockcommentsbeforethemethodandalwaysbeginwithan@.Examples:@depends,@expectedException,@dataProvider.Fulldetailsonsupportedannotationsathttp://www.phpunit.de/manual/3.6/en/appendixes.annotations.htmlANNOTATIONS

Adataproviderisamethodthatreturnsanarrayofvaluestouseinatest.PHPUnitwillcalltherelatedtestmethodonceforeachsetofdata,passingthevaluesasargumentstothemethod.Setusingthe@dataProviderannotation.Allowsyoutoeasilyaddextravaluestotestwith.Alsomakestestsshorterandmoreconcisebykeepingvaluestotestwithoutoftestmethods.DATAPROVIDERS

YoucantellPHPUnitthatatestshouldexpectanexception.Thiscanbedoneintwoways:ThroughthemethodsetExpectedException($exception,$message=,$code=null)Through@expectedException,@expectedExceptionMessage,@expectedExceptionCodeannotations.PHPerrorssuchaswarningsareconvertedintoexceptionsbyPHPUnit.Thesecanalsobetestedfor.TESTINGEXCEPTIONS
0
0
  

PHP function to determine whether a number is odd or even? – GIDForums

php

// let’s say you have a number $number = 25;

// to test whether $number is odd you could use the arithmetic

// operator ‘%’ (modulus) like this if( $odd = $number%2 ) { // $odd == 1; the remainder of 25/2 echo ‘ODD Number!’; } else { // $odd == 0; nothing remains if e.g. $number is 48 instead, // as in 48 / 2 echo ‘EVEN Number!’; } ?>

via PHP function to determine whether a number is odd or even? – GIDForums.

+1
0
  

PHP function to determine whether a number is odd or even? – GIDForums

I like this when trying to work out even or odds

 

http://www.gidforums.com/t-3353.html

0
0
  

Where is your favourite pub

Which is your fave pub in NoHo

View Results

Loading ... Loading ...

+1
0