A simpler way to send Text or HTML emails with attachments in PHP

Geekology previously posted an article on sending emails with attachments using PHP’s mail() function.

However, some readers experienced problems with getting the linebreaks and spacing exactly right on certain platforms (sending multipart emails using the mail() function in PHP is unfortunately a very precise exercise).

This post details a simpler method of creating and sending Text / HTML email messages with attachments in PHP using an adapted version of the Email Library that is included in the CodeIgniter PHP Framework.

Using the geekMail PHP class:

First, you’ll need to download the latest version of the geekMail PHP class here.

After including the class file in your project, use a PHP script like the following to build and send your multipart email messages:

Read more…

Left 4 Dead 2: Trailers, Videos and Screenshots

left-4-dead-2-xbox-coverLeft 4 Dead 2 is the much-awaited zombie-killing sequel by Valve, the makers of Half-Life, Portal, Team Fortress and Counter-Strike. The game features new survivors (Nick, Ellis, Rochelle and Coach), zombies, weapons and items, as well as more co-operative campaigns, versus campaigns, and maps for survival mode.

Left 4 Dead 2’s AI Director 2.0 drives its unique gameplay by customizing enemy population, effects, music, level layout, world objects, weather, and lighting based upon the players’ performance and different times of day.

In addition to the machine guns, pistols, shotguns and sniper rifles from the original, the new game features new melee weapons such as the axe, chainsaw, frying pan, and baseball bat.

Left 4 Dead 2 is expected to be released in November of 2009.

Videos

Trailer:

Read more…

Why are we charged R4850 / $643 / £387 per megabyte for Text Message (SMS) services?

Short URL to this article: http://geekology.co.za/smscost

How Text Messages work

With 35% of all mobile phone users worldwide being active text messaging users (as of 2003), it is the most widely used mobile data service on the planet (according to Wikipedia).

When a text message is sent, it travels wirelessly from a mobile handset to the closest available cellphone tower. From there it’s transferred via wired connections to the destination tower, then transmitted wirelessly from the destination tower to another mobile handset. Text messages (being only 160 characters in length) are so small that the costs associated with the use of the radio spectrum as well as the wired connections should be infinitesimal.

Additionally, text messages don’t use a dedicated channel while being transmitted to cellphone towers. They piggyback on the ‘control channel‘, a range that’s reserved for initiating phone calls and other handset-to-tower and tower-to-handset communication (the use of this channel is why text messages have a length limit: 160 characters is the maximum size of a ‘control message).

This channel is always open and always active between handsets and towers; when mobile devices send text messages they’re simply slotted into any openings available.

Calculating the real cost of a Text Message

A text message can be up to 160 characters (the actual size of messages transmitted over cellphone towers’ control channels are 140 bytes – 160 7-bit characters), and 160 characters equal 160 bytes, one byte per character.

In computer science, the common-use values of bytes, kilobytes, megabytes, gigabytes and terabytes are calculated as follows:

  • 1024 bytes = 1 kilobyte (kibibyte) (KB)
  • 1024 kilobytes = 1 megabyte (mebibyte) (MB)
  • 1024 megabytes = 1 gigabyte (gibibyte) (GB)
  • 1024 gigabytes = 1 terabyte (tebibyte) (TB)

To calculate how much an SMS costs in terms of megabytes, you need to divide a single full-length message’s cost by 160 to get the cost per byte, multiply the answer by 1024 to get the cost per kilobyte, and multiply it by 1024 again to get the cost per megabyte.

So, assuming that a message is exactly 160 characters long and the carrier charges R0.74 for it (South African Rands, a rough average of the cost on the South African cellphone networks):

  • R0.74 / 160 = R0.004625 per byte
  • R0.004625 * 1024 = R4.736 per kilobyte
  • R4.736 * 1024 = ~ R4850 per megabyte

Paying R4850 per megabyte for any kind of data, even in South Africa with its ridiculous bandwidth pricing, is ludicrous.

Putting Text Message costs in perspective

Read more…

Mass Effect 2 Trailers, Videos, and Screenshots

mass-effect-2-xbox-coverMass Effect 2 is the much-anticipated sequel to the original Xbox 360 game by Bioware, publishers of Mass Effect, Star Wars: Knights of the Old Republic, Neverwinter Nights, Baldur’s Gate, and MDK.

In Mass Effect 1, explorers on Mars in the year 2148 discovered the remains of an ancient space-faring civilization. In the decades that followed, these mysterious artifacts revealed startling new technologies, enabling travel to the furthest stars. The basis for this incredible technology was a force that controlled the very fabric of space and time, “Mass Effect”.

The first game told the story of Commander Shepard, the first human accepted into the ranks of the Spectres, an inter-species group of special operatives functioning outside of the law in order to enforce it. Shepard uncovered evidence of a plot by a rogue taurian Spectre, Saren, to assist the Reapers (an ancient race of machine intelligences) in returning to this universe to feed on its living creatures. Putting a stop to the Reapers’ plan and eliminating Saren earned humanity a seat on the Citidel Council, the galactic government.

Beginning soon after the events in Mass Effect 1, the sequel has Commander Shepard scouring the galaxy looking to recruit its most powerful mystics, geniuses, and convicts as a new threat is causing human colonies to be wiped from existence.

Mass Effect 2 is expected to be released in January of 2010.

Videos

Trailer

Read more…

Mac OS X 10.6 (Snow Leopard)

Snow Leopard is version 10.6 of the Macintosh operating system and the successor to Leopard (version 10.5). Apple calls Snow Leopard a “minor” update to OS X, but even so it features loads of tweaks and new features (see below).

I purchased my copy of Snow Leopard last week and got around to installing it this weekend. Because the new operating system includes several changes that might make older applications not work as expected, I recommend that you use SnowChecker, a free application available here, to check your installed applications’ compatibility before performing the upgrade.

mac-osx-snow-leopard-00The installation took about an hour and performed a seamless upgrade from Leopard to Snow Leopard, keeping all my applications and settings intact (just as you’d expect from Mac OS X), even my custom-compiled versions of PHP and MySQL.

Read more…

Call of Duty: Modern Warfare 2 Trailers, Videos and Screenshots

call-of-duty-modern-warfare-xbox-coverCall of Duty: Modern Warfare 2 is the second chapter in the Modern Warfare series by Infinity Ward and continues the gripping and heart-racing first-person shooter action as players face off against a new threat dedicated to bringing the world to the brink of collapse.

Playing as Sgt. Gary “Roach” Sanderson, your international squad of elite soldiers battle through harrowing combat scenarios that range from snowy mountaintops in Siberia to the crowded streets of Rio de Janiero, Brazil and beyond, facing a terrorist force hellbent on redefining the boundary lines of today’s modern warfare.

Players can face the threat alone or with other players in cooperative SpecOps mode. For even more intense combat, they can take up arms against online foes in enhanced deathmatch warfare on a host of Modern Warfare 2 maps.

Call of Duty: Modern Warfare 2 will be released in three editions:

  • The Normal Edition: Includes the COD: MW2 game and is available at the lowest price.
  • The Hardened Edition: Includes the COD: MW2 game in a Steelbook case, a hardbound art book, and a voucher to download a HD version of the original Call of Duty game. This edition is more expensive than the Normal Edition.
  • The Prestige Edition: Includes the COD: MW2 game in a Steelbook case, a hardbound art book, a voucher to download a HD version of the original Call of Duty game, and fully-functional, wearable night vision goggles and stand. This is the most expensive edition.

The night vision goggles are fully functional, branded with the game and Infinity Ward’s logos, designed to look like the NVGs in-game, and can see in absolute darkness up to 50 feet in either black & white or night vision green.

Call of Duty: Modern Warfare 2 is expected to be released in November of 2009.

Videos

Trailer 1:

Read more…

10 Cost-Effective web development tips by Drew McLellan

The following is a presentation on 10 Cost-Effective Web Development Tips by Drew McLellan.

His tips include:

  • Write a comprehensive specification for your project
  • Evaluate possible existing solutions
  • Consider the cost of your design choices
  • Make sure your design covers all states the user encounters
  • Design for reusability
  • Remember: broadband is not a silver bullet
  • Prepare your design files ready to send across to your developer
  • Build your site for cheap maintenance
  • Build your site for low cost quality assurance
  • Build on the shoulders of giants by using existing APIs and outsourcing as much as possible

Afrigator