How to use Jquery Validate plugin to validate for E.164 format phone numbers

$.validator.addMethod(“phone_E164″, function(phone_number, element) {

phone_number = phone_number.replace(/\s+/g, “”);

return this.optional(element) || phone_number.length > 9 && phone_number.match(/^\+[0-9]{1,3}\.[0-9]{4,14}(?:x.+)?$/); }, “Please specify a valid phone number with the format + country code . number” );

$(“#myForm”).validate({ rules: { phone: { required: true, phone_E164: true }, fax: { required: true, phone_E164: true } } });

Thanks to these fine coders:
http://blog.stevenlevithan.com/archives/validate-phone-number
http://docs.jquery.com/Plugins/Validation/CustomMethods/phoneUS

Posted in Just thoughts | Leave a comment

Codeigniter: PHP Fatal error: Allowed memory size of 33554432 bytes exhausted.

Codeigniter has a poorly documented feature which can cause scripts to leak memory. I’m writing this up because although far smarter programmers have addressed it it wasn’t easy to find.

Take a look at the memory usage of this query intensive cron job.

while(….){

echo memory_get_usage();

//rest of script

}

After 8 iterations through the loop here’s what the the memory usage looks like.

2659700
4987624
8156196
10802228
11984060
12720300
16381564
21645700

Running the same 8 iterations after disabling query saving ($this->db->save_queries = false;) looks far more respectable.

2660624
3316268
3316316
3316300
3316312
3316312
3316292
3316304

Posted in Codeigniter | Comments Off

How to write a good Google advert: Don’t dilute your message.

This is related in concept to How to write a good Google advert: Give the searcher what she wants.

One stop shopping is great when you have to drive 30 miles, but your online clients are only 1 click away from your competition.

Adverts with with a tight specific message get clicked more often. Give the searcher what she wants. More signal, less noise. More needle less haystack.

Use your 130 characters* to reinforce the only real promise your ad can make: “I understand what you want.  If you click here you will find what you’re after.” There is not enough space to waste it talking about all the other wonderful things you do. That’s for later.

* A Google text ad is limited to 130 characters. 25 in the headline and 35 in each of the other 3 lines.

Posted in Google Adwords | Comments Off

How to write a good Google advert: Give the searcher what she wants.

(This follows on from How to write a Google advert: Know what the searcher wants.)

Ambush marketing might help you sell more beer to football fans but it doesn’t work nearly as well for Google ads. You see, adverts that match the search term get clicked.

Take a look at what pops up for the search “sliding gate motors cape town“.  Advert 1 below is great. It gives me exactly what I’m after – a sliding gate motor. Look how Google emphasizes the advert by bolding the matching text.

The most relevant advert for 'sliding gate motors cape town'

The most relevant advert for 'sliding gate motors cape town'

Search results from 'sliding gate motors cape town'

Search results from 'sliding gate motors cape town'

Adverts 2,3,4,6,7 and 8 completely ignore the fact that I’m after a motor for my gate and try to divert my attention to their related (but not relevant) products.

This might work well if you’ve got 30 gorgeous young women in orange dresses but it’s not nearly as effective when it’s plain text.

Posted in Google Adwords | Comments Off

How to write a good Google advert: Know what the searcher wants.

Know what the searcher wants.

Give the searcher an advert that says “I understand what you want.  If you click here you will find what you’re after.

If you can’t figure out what the searcher is looking for, you probably shouldn’t advertise on the search term.  For example, someone searching for “air conditioning” could be wanting:

  • to buy an air conditioner for their home;
  • to buy an air conditioner for their car;
  • to buy an air conditioner for their office;
  • to buy an air conditioner for their factory;
  • to buy an air conditioner for their server room;
  • to have an air conditioner repaired;
  • to have an air conditioner serviced;
  • or any of one 10 other things.

Lets look at some examples that pop up if you search for ‘air conditioning‘.

Air conditioner search results

See how hard it is if you don’t know what the searcher’s intention is:

  • Advertiser 1 thinks the searcher has got a broken air conditioner;
  • 2 and 3 are playing it safe with a very general offering;
  • 4 wants you to import air conditioners;
  • 5 is guessing that you’re after a home air conditioner;
  • 6 thinks it’s worth betting you’re after a portable unit;
  • 7 also goes with a very general offer.
Posted in Google Adwords | Comments Off

Affirmative action. Not a zero sum game.

Inspired by: Affirmative Action Around the World: An Empirical Study by Thomas Sowell

In a zero sum game the outcome is always a winner and a loser. Toss a coin – heads you win and I lose.  Flip the affirmative action coin and the outcome is a net negative not zero.

Sowell suggests that it’s because the recipients of the benefits – the previously disadvantaged – develop a sense of entitlement, thus working less, choosing the easier options and generally performing below par while the currently disadvantaged give up, migrate and generally perform below par.

I’ve seen another net negative as a consulting civil engineer in South Africa.

A tender would be let for a public works construction project -  a road, a housing development or something similar.  There are only a finite number of skilled and resourced contractors (horrible white males who should be discriminated against) close enough to make it worth doing. But, it seems like there are more ‘tenderprenuers‘ than you could shake a stick at.

The SA version of affirmative action allowed a 15% pricing preference for the previously disadvantaged contractor/ tendreprenuer. Here’s what usually happened. Lets assume our horrible white male bids $10 000 000 for the project. He loses because the previously disadvantaged tenderpreneur bids $11 500 000 for the job – his 15% pricing preference. But, the budget is finite so the scope of the project has to be reduced.  Instead of building 1000 houses only 850 can get built.

Right, now it’s time to get started.  Where does our tenderprenuer get his (they’re almost inevitably well dressed smart males with expensive mobile phones and nice cars) construction crews, materials, finance and equipment? He subcontracts to our horrible white male for $10 000 000.

So, here’s how the math stacks up:

  • The tenderprenuer gets his $1 500 000 profit for his skin color or tribal affiliation. A winner.
  • Our white male keeps his business running. Another winner.
  • 150 families go homeless. Losers. But, hey, who cares about them until the next election.
Posted in Just thoughts | Comments Off

When you think the wrong thing is scarce

“30 minutes and only if you buy a drink.” I’d just asked for a latte and if there was a internet connection in the coffee shop. The place was nice, cozy, a warm fire and plenty of empty tables.

Today, customers were much scarcer than internet access and the longer I’d sit the more lattes I’d order. You’re going to end up in trouble if you don’t understand what’s scarce (customers) and what’s a commodity (internet access).

Posted in Bad Marketing | Comments Off

Paying for tweets?

(Has this already been done? Edited to add that I took 5 seconds on Google and see that this concept has been raised previously)

Concept: You pick someone who has influence in your market, give them money and they tweet your advertising message to their followers. The tweeter gets paid for results (perhaps someone clicking on the link, retweeting, following etc) or simply for sending the message.

The app facilitates the transaction, and helps advertisers identify people with influence.

It’s self regulating – people would soon stop following those who abused it – their influence would be reduced and they wouldn’t get any advertising requests.

Your thoughts?

Posted in Apps I'd like to build, Just thoughts | Comments Off

Corporates killing communication

(Forgive the alliteration – I’ve been writing Google Adwords all morning).

Spotted on a van: “Graffiti Management“.

How the hell do you “manage” graffiti. You can write it, draw it, paint it, clean it , prevent it or remove it, but you can’t manage it. Why use the wrong word when there is a right word for what you do?

Posted in Just thoughts | Comments Off

SalesRepeater: automatic repeat business

I’m like water when it comes to shopping – I follow the path of least resistance:
  • Time to renew the insurance? Phone me up and ask for my card details and you’ve got a customer for another year.
  • Buying a book: I’d rather go to Amazon than shop around – they’ve got my details already.

I think there must be more people like me: People who’ll buy without hesitating if you ask at the right time and make it easy.

SalesRepeater lets you automate reminder emails to your customers. Setting up an automatic sales reminder is really easy. Type it in and schedule a date for it to be sent. That’s it. When the sending date rolls around the system will email the message to your customer and keep you in the loop.

It’s something I’ve been wanting to build as a web app for a while. I built the original version in Filemaker during my first cold damp Christmas in the UK while pining for the southern hemisphere version: camping in the Drakensberg, but I never marketed it because I got busy with other stuff (Stuff that actually paid the bills).

Start generating repeat sales right away.

Posted in Apps I'd like to build | Comments Off