Tag: development

Pesky Directory Alphabet Filters Made Easy (PHP)

I have built quite a few directory systems in my years as a web developer and one thing that has always annoyed me is building letter filters to return results depending on the first letter of a title.

Normally I would waste a lot of time actually typing out the entire alphabet string:

$alphabet = 'abcdefghijklmnopqrstuvwxyz';

which can take a lot of time (Go on try it, I’ll bet no matter how fast you can type, typing out the alphabet quickly will be tricky!) then looping through the string like so:

for($i = 0; $i < strlen($alphabet); $i++)
{
  echo substr($alphabet, $i, 1);
} 

However there are 2 other much simpler methods:

Method 1 – Loop through the ASCII numbers

for($i = 65; $i <= 90; $i++)
{
  echo chr($i);
}

or my new personal favourite using PHP’s range() function:

Method 2 – Using range()

foreach(range('A', 'Z') as $i)
{
  echo $i;
}

Then all you have to do is add in any code to make sure you set the right CSS selectors and highlight which letter you are currently viewing and add the ability to filter by first letter to your list function.

Simple.

What does the offshoring backlash tell us?

Quote

After 2 years of excuses, laziness, constant turnover (complete waste of training time when the guy/girl buggers off and leaves you with a new muppet), terrible or copied-from-Google code, never-ending bugs, headaches, baffling phone calls where no-one understood each other, emails that promised to “do the needful” but went ignored, applications that just didn’t work, MILLIONS of dollars, and much, much more……. we had enough, and told the Indian coding behemoth we’d had enough and brought our dev team back in house.

Saying that things go more smoothly is a massive understatement. Don’t know why we bothered. Oh yes, some spreadsheet said it would be cheaper.

When writing software the developer needs to be in constant communication with both the project manager and the author. Out-sourcing your coding just doesn’t work. In my experience a programmer often has a completely different take on how to solve a problem to most other people, they will often find the simplest and most efficient way of producing software, which while it sounds good is often not the best method.

Any well rounded developer knows that sometimes the specs given to them can be illogical or not well thought through by an author or project manager that doesn’t fully understand the coding process. This means that the full team building a particular piece of software need to be flexible to some degree and this cannot be acheived when outsourcing.

It doesn’t even have to be incomplete specs that will upset the process, clients love to change their minds, especially when they see a prototype of their software. Things I hear all to regularly are ‘can we move that to there’, ‘what if we swapped this round’ or the dreaded ‘Oh, actually I don’t need that bit any more…’

So on paper it may look like it is a lot cheaper to outsource, but in the long run the lack of communication, understanding and flexibility will have you wishing you had seen sense when that email from an asian coding beast offering you the chance to slash your development costs drops into your inbox.

Survey: Programmers shunning Vista for Mac OS and Linux

“Developers,” a VP at Electronic Arts once told me, explaining why there were so many me-too Windows applications, “will walk through the desert in their socks to get to an installed base.”

True enough. But it doesn’t quite explain the results of a survey issued last week by Evans Data Corp. The headline was that most developers are still not targeting Windows Vista when they write new apps. Only 8% of the 380 developers surveyed were writing for Vista; 49% were still targeting Windows XP.

I welcome any increase in development of non Windows Software, even if it is mainly an increase for a Macs (which I dislike only slightly less than Windowz).

As a Linux user and LAMP developer I have been very happy to see an increase in software dedicated to the linux environment. Up until the last few years Linux desktop users have had to put up with ported versions of windows software that often requires quite an advanced knowledge of wine to get working, but now dedicated LInux software is emergine that not only competes with Windows based software, now quite often outperforms it on both a funcationality and an efficiency front.

I still think Macs are far to slow to be any real competition to windows though…