Php Free Chat

April 19th, 2010 by admin No comments »

phpFreeChat is a free, simple to install, fast, customizable and multi languages chat that uses a simple filesystem for message and nickname storage. It uses AJAX to smoothly refresh (no flicker) and display the chat zone and the nickname zone. It supports multi-rooms (/join), private messages, moderation (/kick, /ban), customized themes based on CSS and plugins systems that allows you to write your own storage routines (ex: Mysql, IRC backends …), and your own chat commands !

Quick Links

Globalize your Web Applications: PHP’s Locale Package

April 18th, 2010 by admin No comments »

Having survived the Great Y2K threat, we are now observing an economy that has become far more globalized than it was in the previous century. The extent of the Internet’s contribution is open to debate, but there is no question that the associated information explosion supported the acceleration of market internationalization that we now take for granted. For many of us, the realization of the extent of countries’ interdependence was driven home by the recent global economic meltdown. So what does all this have to do with us Web developers? It’s a resounding wake up call that we have to think of other nationalities when we develop our websites and applications. In most cases, developing a web app in English alienates much of the world’s population and greatly reduces potential profits! With that in mind, this article is the kickoff for a series that discusses the ramifications of globalization on our websites and applications. Today’s article will deal with locales and their implementation in the PHP language.

The Many Names of Internationalization

Besides the interchangeability of the terms internationalization and globalization, there are a few abbreviations (or numeronyms) that are used to shorten these longish words. A popular abbreviation is i18n where the 18 stands for the number of letters between the first i and last n in internationalization. Another is L10n. In this case, the 10 refers to the number of letters between the first l and the last n in localization. The capital L in L10n also serves to further distinguish it from the lowercase i in i18n. The term globalization, which is favored by companies like Microsoft, IBM, and Sun Microsystems, can likewise be abbreviated to g11n.

The Locale Identifier

In computing, a locale is a set of parameters that defines attributes for a user’s specific geographic location, including the user’s language, country and certain cultural preferences that users want to see reflected in the interface. As such, we’re speaking about a lot more than their language; the locale also affects the formatting of currency, numbers, dates, and time. Typically, different locales are identified by a language identifier and a region identifier.

The two major operating systems both support different locales, albeit using different mechanisms. On UNIX, Linux and other POSIX-type platforms, locale identifiers are defined in the following format: [language[_territory][.codeset][@modifier]]. For example, Australian English using the UTF-8 encoding is en_AU.UTF-8. Contrast that with Windows, which uses a four-digit Locale identifier (LCID), such as 1033 for English (United States) and 1041 for Japanese (Japan). These numbers consist of a language code (lower 10 bits) and culture code (upper bits) and are therefore often written in hexadecimal notation, such as 0x0409 or 0x0411. I personally became acquainted with LCIDs early on in my career as a developer for the Canadian federal government. It is a nation-wide standard that all of our applications must support both English and French users, as Canada is officially a bilingual Nation.

You can use the executable locale to show your current locale on UNIX platforms. For instance, the command locale -a displays all the locales currently installed on the machine. You can control the system locale via various environment variables. These can be defined in your environment to be system-wide, or on a per-session basis:

  • LC_ALL: Overrides all LC_* environment variables with the given value
  • LC_CTYPE: Character classification and case conversion
  • LC_COLLATE: Collation (sort) order
  • LC_TIME: Date and time formats
  • LC_NUMERIC: Non-monetary numeric formats
  • LC_MONETARY: Monetary formats
  • LC_MESSAGES: Formats of informative and diagnostic messages, and of interactive responses
  • LC_PAPER: Paper size
  • LC_NAME: Name formats
  • LC_ADDRESS: Address formats and location information
  • LC_TELEPHONE: Telephone number formats
  • LC_MEASUREMENT: Measurement units (Metric or Other)
  • LC_IDENTIFICATION: Metadata about the locale information
  • LANG: The default value, which is used when either LC_ALL is not set, or an applicable value for LC_* is not set
  • NLSPATH: Delimited list of paths to search for message catalogs
  • TZ: Time zone

Information on the current Locale in Windows is accessible from the Regional Options dialog:

Figure 1

To access the Regional Options dialog, click on START=>Settings=>Control Panel to bring up the Control Panel:

Figure 2

Then click on the Regional Options item to bring up the dialog:

Figure 3

Your current locale is selected in the Your Locale (location) dropdown list, on the General tab. Below the Settings for the current user section is a list of installed language packs. Other tabs define Number, Currency, Time, and Date formatting options. The Input Locales tab allows you to change language-related keyboard settings such as those that print non-English characters.

It’s important to know how to configure your workstation’s locale settings because it can be helpful in testing locale-dependent application features. It is also possible to affect an application without altering your global machine settings through programming language features.

Locale Support in Programming Languages

Generally, it is preferable to set application locale attributes directly using language features rather than alter your workstation’s global settings. Here are a couple of points to keep in mind regarding locale support in programming languages:

  • general rule 1: the newer a development language is, the likelier that it offers multilingual and locale support; and that goes double for web languages.
  • general rule 2: no two languages implement locale support in the same way!

For our first look at locale support in programming languages, we’ll be exploring PHP’s I18N libraries. PHP is a scripting language that was originally designed for web development and the creation of dynamic content. In addition to being well suited for multi-national applications, it is also one of the most popular web development languages in use today.

WordPress Toolbar v 2.2 : Custom toolbar url, Support for WPMU and bug fixes

April 17th, 2010 by admin No comments »

WordPress toolbar plugin provide a facebook, digg style toolbar for all outgoing links from your blog posts. The toolbar url defaults to http://yourblog/wp-content/plugins/wordpress-toolbar/toolbar.php. However with version 2.2, blog admin can customize toolbar url to http://yourblog/wordpress-toolbar/ through the admin panel. A lot of other enhancements have been added like cross-plugin compatibility and support for WPMU hosted blogs. Check full feature list below.

What’s New?
Listed below is list of new features and bug fixes released with v 2.2:

  1. Support for customizing toolbar url through admin panel
  2. Support for WPMU hosted blogs
  3. Support for removing “Get this Plugin” widget from the toolbar through admin panel
  4. Security fix for possible XSS attack. Fix done by passing encoded hash string instead of plain text parameters. Also added various security checks on toolbar page to avoid possible XSS attacks.
  5. Bug fix where plugin didn’t work as expected because of cross plugin compatibility issues. Fix done by replacing server side toolbar logic with client side (using jquery) logic.
  6. Bug fix to show sociable share icons and tinyurl share link only for single posts and pages
  7. Bug fix for unrecognizable code in the toolbar when the encoding of hosted blog is different from utf-8. Fix done by using hosted blog settings instead of hardcoded utf-8.

Also core plugin code has been restructured (OOPS oriented now) so that maintainability and support becomes easier and quicker.

Download the plugin

Create a Wishlist

April 17th, 2010 by admin No comments »

I got a question about creating a wishlist from one forum. If you have any idea of that please just reply this post. Here is the question:

Hi all,

I’m trying to create a wishlist for my advertisment site. What I want to do is let the
user browse through and once an article that they want to watch is found then they click a link to add to favorites. Once added they must then be able to view a list of their favorite items.

Basicly a system like eBay.

The only thought I have is to store the products ID in a database when the link is clicked and
then link to this ID in a my watchlist area with products details.

Anybody else got some good ideas?

Matt

How to use locks in PHP cron jobs to avoid cron overlaps

April 17th, 2010 by admin No comments »

Cron jobs are hidden building blocks for most of the websites. They are generally used to process/aggregate data in the background. However as a website starts to grow and there is gigabytes of data to be processed by every cron job, chances are that our cron jobs might overlap and possibly corrupt our data. In this blog post, I will demonstrate how can we avoid such overlaps by using simple locking techniques. I will also discuss a few edge cases we need to consider while using locks to avoid overlap.

Read the rest of the post

Why echo is slow in PHP and how to make it really fast

April 17th, 2010 by admin No comments »

You may have noticed that PHP scripts that echo a lot of content appear to be running with poor performance…

Well, the operative word here is “appear”. It is a common misconception that “echo is the slowest PHP command”! :p

The problem is actually just a bandwidth issue! When you try to pump a lot of content though the Internet, at some point you experience “load time”… and at some point PHP actually experiences “send time”!

You may measure the execution time between the begining and the end of your script, and, on a slow connection, it may show you that it took 500 ms to execute. You may even narrow it down to a single echo statement that takes 480 ms to execute. But that time actually includes wait time where PHP cannot send any more data back to apache!

PHP:

ob_start();
echo $a_lot_of_content;

This will allow PHP to move on and appear to terminate fast. But the truth is, all the content is now in PHP’s output buffer, and although your script is done, PHP is still working in the background to send all that data to your web server (apache for instance).

Follow up:

To verify that the processing time doesn’t vary by employing this trick, you can log actual request processing times in apache.

Now, if you want PHP to really terminate, you need to give Apache a larger buffer in order to absorb the content from PHP. I believe the default Apache buffer is 4096 or 8192 bytes (anyone know how to verify this?).

If your PHP script tries to output 24 KB of data but apache can only buffer 8 KB, then yes PHP will be waiting. However, if you make the Apache cahce, say 32 KB, then PHP will send all its data to Apache and exit in a breeze!

Here is how you can change Apache’s buffer size in apache2.conf :

Code:
<IfModule mpm_prefork_module>
StartServers          5
MinSpareServers       5
MaxSpareServers      15
MaxClients           40
MaxRequestsPerChild  20
SendBufferSize    32768
</IfModule>

The only important line in the SendBufferSize line. The other lines are provided for context so you can find the right place in apache2.conf to add the SendBufferSize line (in case it doesn’t exist already). I don’t have particular recommendations on the other lines at this point.

After restarting apache, look at your logs and execution times again. You will see them drop from 500 ms to 30 ms in the example above. That is, of course, as long as you don’t send more data in PHP than the Apache buffer can absorb.

Now, of course, this will *not* increase the end-to-end transfer time of the page from PHP to browser. However, it will allow PHP to exit faster, which may or may not free up resources on the server… probably depending on the configuration.

I am pretty sure it does free up resources if you use CGI. But if you use mod_php, I don’t know… Anyone?

Then, I guess, the next step would be to push the data out of Apache faster… but I’m not sure there is another buffer that could be augmented in between Apache and the actual Nagle Algorithm that manages the transfer speed.

TYPO3

April 16th, 2010 by admin No comments »

TYPO3 is a free Open Source content management system for enterprise purposes on the web and in intranets. It offers full flexibility and extendability while featuring an accomplished set of ready-made interfaces, functions and modules.

TYPO3 Quick Links

BitsyBox

April 16th, 2010 by admin No comments »

BitsyBox is a hosted content storage platform that offers two products that work in perfect harmony. The first is an easy-to-use web interface that lets site owners edit and update their content. The second is a robust API for developers to quickly access that content from their website or application code.

BitsyBox Main Features

  • Create flexible, custom datastores
  • Data access through a REST API
  • Easy to use interface for editing data
  • Built-in Content Delivery Network (CDN)

Quick Links

Pixelsilk

April 16th, 2010 by admin No comments »

Pixelsilk is a web-based SEO friendly CMS, content management system, built from the ground up with search engine optimization (SEO) requirements at its core. Pixelsilk CMS is easy to use and allows full HTML and URL control.

Pixelsilk’s SEO-Friendly CMS enables the highest level of SEO possible by ensuring the design, code, content and architecture all provide the search spiders with exactly the information they need most. From keyword-rich, relevant content to title, Meta tags, Pixelsilk provides Search Advice (patent pending) directly to the editor while content is being created or modified—not bolted on as an afterthought.

Pixelsilk Main Features

  • Full HTML control
  • Interactivity with social media applications
  • Open architecture and framework
  • Real-time search engine optimization advice
  • Theme and navigation flexibility

Quick Links

CushyCMS

April 14th, 2010 by admin 1 comment »

CushyCMS is a Content Management Systems (CMS) that is truly simple. It’s free for unlimited users, unlimited changes, unlimited pages and unlimited sites.

It’s built from the ground up with ease of use in mind – for both content editors and designers. It’s such a simple CMS that it takes less than 3 minutes for a web designer to implement. No PHP or ASP required for this CMS. If you can add CSS classes to HTML tags then you can implement CushyCMS. It’s also a hosted CMS, so no installation or maintenance is needed either.

Content editors will love managing their content with this system. No training required, it’s just that easy.

And it is, and always will be a free CMS. You can use it for professional use, you can even charge your clients to use it. The only catch is that if you make it your own CMS solution, with your own brand, then you’ll need to pay for the pro plan.

Quick Links