Why does php not show errors? – How to display PHP errors when display_errors is disabled

OK, a simple thing I know. But one that always occurs.

When using shared hosting (or even your own dedicated servers), those managing those servers do their utmost to make them secure. Among many things this usually includes turning off ‘display_errors’ in the php.ini file.

However, when you’re trying to develop things it is usefull to display errors and warnings, but if ‘display_errors’ is off, you will be scratching your head wondering what’s going on and whats going wrong!
Continue reading “Why does php not show errors? – How to display PHP errors when display_errors is disabled”

Watch your battery!

Having had the HTC for over a week now, I am beginning to get to grips with how to get he most out of it… especially when it comes to battery life.

  • DO NOT let it run too dry! Seems to have trouble charging (from USB) if you’d managed to let it get too low!
  • Be carefull what apps you install… soem apps seem to drain power wven if not in use!

Continue reading “Watch your battery!”

Beginning your journey in Object-Oriented Programming using PHP

Object-Orientated programming is not a new idea! It’s been around and available for a long time in many languages.

With each new version of PHP, new features appear, while existing features are improved. PHP’s object support has been hugley improved since it’s introduction in PHP3 (yes it has had it all this time!). And so with PHP’s object support maturing, the reasons developers might not take an object orientated approach are getting smaller. More recently PHP5′s take on objects is much more powerfull and usable than it ever has been for PHP users – but still not without it’s faults.

A common problem that experienced (and new) PHP developers have when embarking on their object-orientated (OOP) journey is thet they don’t know WHEN to use it properly! As with all things there is a time and place for everything.

For those who do not know about OOP I am not even going to attempt to explain what it is! But fact you have found this article means you probably do, but incase not Wikipedia has good general background info on OOP.

Continue reading “Beginning your journey in Object-Oriented Programming using PHP”

Tools & Tips…

Well, I’m going to try to divulge more of my development experiance to others. Starting with some ‘Tools & Tips‘.

Let me know if there are any topics/questions from all forms of development PHP, Java, .NET .. and management (people & projects) aspects of the IT world too!

Album Review: Delphic – Acolyte

матрацимаси и столовеDelphic - Acolyte
Delphic Acolyte

On first listen to “Acolyte” it was an amazing journey of indie and dance. A dense but sharply-focussed amalgamation of sparkling synths, dance-friendly rhythms and intelligently constructed vocal melodies and harmonies.

Before I dive in and look at the tracks I will start with an overall view of this fine piece of very well executed music. Delphic have developed a distinct and original sound  that genuinely is a blend of indie and dance. It’s a sound that’s almost ruthlessly efficient and faceless, and almost risks being difficult for some to connect with. There are many real moments of promise here, not least when they let go of their inhibitions with the incredibly layered album closer “Remain”. But for me it is their vocalist that gives the songs urgency and life that lift “Acolyte” to being very good; for every wave of synth, there’s a lyric loaded with warmth and spirit.

Making your website work with Internet Explorer 8 (IE8)

OK probly well known by now. But if you’re site is ‘broken’ in IE8, you could try the following which tells IE8 to work liek IE7.

<meta http-equiv=”X-UA-Compatible” content=”IE=7″ />

It belongs in the document’s HEAD. More importantly it needs to be preferably at the top of the HEAD section before any css, linked files etc.

The rule of thumb is, that the IE 8 meta tag needs to be placed above any linked files.

Review: Michael McIntyre on his 2009 Tour @ Nottingham’s Trent FM Arena on the 26/09/2009.

Michael Mcintyre
Michael Mcintyre

Well, we went and seen Michael McIntyre on his 2009 Tour @ Nottingham’s Trent FM Arena on the 26/09/2009.

It was part of my wifes birthday present as she has always quite liked him I thought it would be a good surprise. I bought the tickets and booked hotel 2 weeks before it, and managed to not tell her untill the night before – I said ‘pack a bag’, still not telling her what for though – infact she never knew right up untill we walked into the Trent FM arena!

Continue reading “Review: Michael McIntyre on his 2009 Tour @ Nottingham’s Trent FM Arena on the 26/09/2009.”

Review: Tom Jones at the LG Arena, Birmingham

Tom Jones - 18/10/2009 @ LG Arena, Birmingham
Tom Jones - 18/10/2009 @ LG Arena, Birmingham

Tom Jones… not my usual taste, but thought it would be a good night so booked tickets to see him on 18/10/2009.

I also learnt that it was the ‘opening’ gig of the new LG Arena.

Continue reading “Review: Tom Jones at the LG Arena, Birmingham”

Cuba! – 27th August 2009 to 11th September 2009

When: 27th Aug 2009 to 11th Sept 2009

Where: Cuba

Resort: Cayo Coco & Havana

Hotel: NH Krystal Laguna & NH Parque Central

Where We Went…

This was our second visit to Cuba; we previously had a holiday here at the same time in 2007.

In 2007 our holiday was purely to Cayo Coco and the NH Krystal Laguna, one of the excursions we took was an overnight trip to see the Tropicana Nightclub – which is still one of the most memorable night I can recall. It included a very rushed but great introduction to Havana and from that we decided that if we ever went back we would spend more time in Havana.

And so we come to 2009! And we found ourselves searching for a good value holiday and all avenues lead to Cuba! – Again! After that was decided – prices coming up for Sharm el Sheikh and so on were about £1000 more than Cuba – we quickly decided we would like to do a 2-center so we could spend time in Havana (there is so much that could be written about Havana but shall try to keep it limited to what we done!).

Continue reading “Cuba! – 27th August 2009 to 11th September 2009”

Irish Vasectomy

After having their 11th child, an Irish couple decided that enough was enough, as they couldn’t afford a larger house. So the husband went to his doctor and told him that he and his wife didn’t want to have any more children.

The doctor told him there was a procedure called a vasectomy that would fix the problem but it was expensive. A less costly alternative was to go home, get a large firecracker, light it, put it in a beer can, then hold the can up to his ear and count to 10.

The husband  said to the doctor, “B’Jayzus, I may not be the smartest guy in the world, but I don’t see how putting a firework in a beer can next to  my ear is going to help me with my problem.”

“Trust me, it  will do the job”, said the doctor.

So the man  went home, lit a firecracker and put it in a beer can. He held the can up to his ear and began to count:

“1, 2, 3, 4,  5,” at which point he paused, and placed the beer can between his legs so he could continue counting on his other hand.

Need help with scrabble/anagrams?

My wife and I regularly play Scrabble like many thousands (millions) of people do…

And if like me you hate getting beat all the time… I have recently created a simple tool that will take your letters and suggest words to you!

The words are based on the TWL06 word-list at moment… but may add additional dictionaries as time goes on.

So go and give my ‘scrabbler’ a go!

BMMs Scrabbler
BMM's Scrabbler

Session Handling in PHP

Traditionally HTTP is a stateless protocol. That is it is made up of requests and responses and there is no notion of a ‘persistent connection’. This means that there is no way to have consistency or personalisation on the web since there is no way of knowing whom the request came from.

There are 2 primary methods – regardless of platform – that are used as a work-around for this.

First is a cookie. A cookie is a text file that lives on the client’s computer that store values set by your application. In general the file can only be access by the website/domain that issued it. The main problem with cookies is that they are un-trusted. A malicious user could modify the data and cause you problems!

The second – and better – solution is sessions. Similar to cookies, but they reside on the server, and cannot be directly modified by the client. When sessions are used, a cookie is still issued, but this simply holds the ‘session id’. This session id is generally sent by any request after it is created by the app including actions such as form submission. This ‘session id’ is a link to either a file or record on the server – depending how they are stored.

Continue reading “Session Handling in PHP”

Need to make PHP ‘stop’… PHP wait timer

AJAX is great… but sometimes it’s too quick if you’re updating… So… How can I make the page wait for a few seconds, then proceed?

Well there are 2 functions PHP has to pause execution. They are:

sleep(NUMBER_OF_SECONDS);

and:

usleep(NUMBER_OF_MS);

One thing you may want to keep in mind is that if you are using a for loop and wish to do this, then you might want to increase the timeout:

set_time_limit(NUMBER_OF_SECONDS);

The Old Golfer

A circus owner runs an ad for a lion tamer and two people show up. One is a good looking, older retired golfer in his late sixties and the other is a gorgeous blond in her mid-twenties.

The circus owner tells them, “I’m not going to sugar coat it. This is one ferocious lion. He ate my last tamer so you two had better be good or you’re history. Here’s your equipment — chair, whip and a gun. Who wants to try out first?”

The girl says, “I’ll go first.”

She walks past the chair, the whip and the gun and steps right into the lion’s cage.

The lion starts to snarl and pant and begins to charge her.

About halfway there, she throws open her coat revealing her beautiful naked body.

The lion stops dead in his tracks, sheepishly crawls up to her and starts licking her feet and ankles.

He continues to lick and kiss her entire body for several minutes and then rests his head at her feet.

The circus owner’s jaw is on the floor. He says, “I’ve never seen a display like that in my life.”

He then turns to the retired golfer and asks, “Can you top that?”

The tough old golfer replies, “No problem, just get that lion out of the way.”

Panda in bar….

A panda walks into a bar and orders some food, after he’s done eating he shoots the bartender and starts leaving.

“Hey, you can’t do that!” said someone else in the bar

“Yes I can, I’m a panda bear it’s what I do, look it up.” says the panda bear.

Later he looks up “panda bear” and sure enough it says

“Panda Bear; Eats shoots and leaves.”