Using Substr

PHP has a powerful command called SUBSTR which returns part of a string based on the length parameters you provide. In this article, we will cover how to create an excerpt of a string, like a post, and shorten it using the SUBSTR command.

We have a string called $post with a string of Lorem Ipsum. We will shorten it to 55 characters using SUBSTR and assigning the shortened string to $excerpt.

$post="Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna
aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud
exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea
commodo consequat.";
echo $excerpt;

Syntax: string substr ( string $string , int $start [, int $length ] )

The first parameter is the string.
The second is start position of the string.
The third is the length of the string.

The $excerpt variable now contains 55 characters after using SUBSTR.

Build Linux From Scratch

If you want to learn the internals of Linux, try building a Linux kernel from scratch using LFS, Linux from Scratch. The 300 page instruction will teach you how to create your own distribution. You can customize, compile and build Linux to your own taste. LFS gives you the ability to select which programs you want loaded, what services you want running, what security features you want loaded. LFS is ideal for anyone who wants to delve into the internals of Linux. Download.

Gimp 2.7.0

For those of us who are Gimp fans, the latest version 2.7.0 contains features essential for photographers. The latest Gimp release contains a feature to correct barrel distortion, a feature called “perspective transform, sample colorize” to make your black and white photos stand out, and a few cloning tools for digital retouching.

List of Features:

  • Change the Text Tool to perform text editing on-canvas (GSoC 2008)
  • Add support for tagging GIMP resources such as brushes and allow filtering based on these tags (GSoC 2008)
  • Separate the activies of saving an image and exporting it, there is now an ‘File->Export…’ for example
  • Port file plug-ins to new export API which gets rid of many annoying export dialogs
  • Add a simple parser to size entry widgets, images can be scaled to e.g. “50%” or “2 * 37px + 10in”
  • Arrange layer modes into more logical and useful groups
  • Added support for rotation of brushes
  • Make the Pointer dockable show information about selection position and size
  • Get rid of the Tools dockable and move toolbox configuration to


  • Add status bar feedback for keyboard changes to brush paramaters
  • Add diagonal guides to the Crop Tool
  • New docks are created at the pointer position
  • Add support for printing crop marks for images
  • Move ‘Text along path’ from tool options to text context menu
  • Change default shortcuts for “Shrink Wrap” and “Fit in Window” to Ctrl+R and Ctrl+Shift+R respectively since the previous shortcuts are now used for the save+export feature
  • Make Alt+Click on layers in Layers dockable create a selection from the layer
  • Allow to specify written language in the Text Tool

Do you really need Windows?

Do you really need to run Windows? It’s a question most computer users haven’t really thought about. Most users perform basic functions such as browsing the web, checking email, word processing or running a basic spreadsheet. What most people don’t realize is that these are functions that you can easily perform and run in Linux.

Most users are already familiar with the Firefox browser. If you’re not a Firefox fan, you can use Google Chrome which also available in Linux. If you’re still not happy with either one, you can try Opera, Konqueror, Flock, Galeon, Epiphany and even Lynx, a text-based browser.

There are a number of options in Linux for word processing. Open Office is pretty much standard in most Linux distributions. You can also use KOffice or AbiWord. The same goes for spreadsheets. The choices are many.

One benefit Window users will get from Linux is having a rock stable environment that’s free from viruses. In addition, Linux will cost you $0 dollars. It’s absolutely free. Compare that when buying Windows 7 upgrade or the full version.

When I converted to Linux, there was a transition period where I was running both Windows and Linux on my desktop. I dual booted for several months before moving strictly to Linux. Weaning Windows users might be the ideal approach for the switch.

Linux has come a long way. Linux is grown up. Linux has improve by leaps and bounds. If you’re still on the fence about converting to Linux, well, get off it. Give Linux a try. It’s definitely worth your while.

KDE 4.3

KDE just released version 4.3 which includes over 2000 new enhancements to the K Desktop Environment. The latest version showcases the latest theme called “Air.” Improvements in performance, memory usage and a stack of new widgets are just few available in the latest release. If you haven’t tried KDE in a while, give it a spin. You can install it via Synaptic Package Manager or just type:

#sudo apt-get install kubuntu-desktop

4000 PCs Switch To Linux

Verona University is migrating 4000 PCs over to Ubuntu Linux. Linux Magazine reports the migration as a 3 year project which began in January 2009. Users are switching to Ubuntu Desktop and using Firefox, Thunderbird and OpenOffice. The university also offer educational courses in Ubuntu. And another technical school in Iceland makes a similar move. It goes to show you that migrating over to Linux and open-source is not that difficult. All it takes is courage and commitment. It’s a great move for both schools.

TechRadium Suing Twitter

TechRadium, a Texas firm is suing Twitter over three patents the firm allegedly owns. The firm’s main product is called Iris, a notification system that sends alerts to many devices including mobile phones. TechRadium clients include the US Army, American Red Cross, United Way and several others.

I had a chance to briefly review the Iris system. From what I understand, the Iris system uses a web-based client to send notifications to mobile phones, email addresses, pagers, etc. It sends notifications to members using five different color-coded alert levels based on the severity of the message.

Now, why is Twitter is being sued for a system that anyone can program and develop? That’s a bit of a head scratcher, unless Twitter used the same source code from the Iris system. It will be interesting to see how this suit develops in the future.

Microsoft Sees Linux Threat

Finally, Microsoft is acknowledging that Red Hat and Canonical, the company behind Ubuntu, are a threat to its client business. Microsoft mentioned both Redhat and Canonical in its annual filing to the Securities and Exchange Commission. The Canonical threat is due to the popularity of netbooks powered by Linux.

To those of us who have been using Linux, it’s a well known fact that Microsoft has been attacking Linux for years as attested by the now infamous Halloween documents. The Halloween documents are a series of leaked Microsoft confidential memos pertaining to free software, open-source software and Linux.

Interesting enough, Microsoft does not mention Google Chrome OS which is still a year away from fruition. I imagine, the next time around, Microsoft will shift its focus away from Redhat and Canonical, and towards Google, a much bigger threat with lots of cash and brand to boot.