Showing posts with label php programming tips. Show all posts
Showing posts with label php programming tips. Show all posts

Thursday, January 22, 2009

Basics of looping in PHP

Loops are an integral part of PHP, and many other programming languages for that matter, the basics covered here would apply to javascript as well, even the code is very similar. A loop is simply a block of code that executes multiple times, controlled either directly, by explicitly telling the script to execute “X” times, or by using a variable, telling the script to execute “as many times as the exact hour at the time of viewing” for example.

So why do we use loops? There are hundreds and hundreds of reasons, the widest usage is probably to cycle through values of some sort of data. For example, you might be writing a messaging system in PHP, which would allow users of your website to send private messages to each other once they register. You would write a MySQL query which would pull all the user’s letter from the database. To show all the letters you would use a loop to show all the rows of the query (all the separate messages) on a page.

To create a loop you need to add some rules which will dictate how the loop should behave. Usually we need to give three values, the starting value of the counter (which tells the loop how many times it has executed), an ending value (which tells the script to stop looping if it is reached) and an increment, which deals with changing the starting counter value in some way (so that it eventually reaches the end value, hence ending the loop).

Read More..

Tuesday, January 6, 2009

3 Reasons WordPress over Blogger

Their have been a lot of bloggers that started out using blogger as their blog platform. Soon after they got going they found that they were limited in capacity. Most decided they wanted something more and that was found in the WordPress blogging platform. Why WordPress? Well you can read more about the features on the official site WordPress.org but here are three great reasons:

1. Power: Oh more power! The full control you have with WordPress is totally amazing. You can design your own templates, customize existing ones, add third party plugins, and add with little work. Nothing will beat WordPress in terms of control and power.

2. Templates: The large amount of free templates for the WordPress platform is awesome. You can find new templates for free and upload them with no problem at all. Better yet, you can have multiple themes uploaded at once and switch between them with the click of a button.

3. Open Source: WordPress is open source and is constantly being improved by the community. You will never have to pay for the platform software and the updates can be made with ease (automatic).

Read More..

How Can Wordpress Make You Money?

Wordpress is a publishing platform for open source blogs with emphasis on all web standards. It is easily available on internet. You can download Wordpress software and start blogging instantly. One attracting feature of this application is that it is available free of cost.

Wordpress provide you the flexibility that you can write either pages or Post. However, there is a some difference between the two. For example, while writing a blog you write a post which are displayed in reverse chronological order. In contrast to Post, pages are specially designed to collect information from you like your contact no, email-id, name etc. Pages are usually displayed apart from your normal post when someone want to know more about the author of the post.

To put up a blog post, you will need to log on to the software you downloaded. Once youave logged in, you can put up a new post in a couple of different ways. The first is to choose the Post tab and click on aadd new link.a A new window will open to add a new post. If youad prefer, you can also use the Quickpress module from the Dashboard. The third way is to choose the new post link from the Admin bar, and start writing.

There are in general many ways of adding a new post. The first one is that after logging in Wordpress, select the Post tab and click on add new link which will open a new window for adding a new post. Second option is to make use of Quickpress module available on the Dashboard.

Each post should be given a catchy title. You should also spend some time coming up with appropriate tags. Wordpress offers a multitude of categories. Put some effort into this because readers use these to search through posts and organize their reading.

A great trick many Wordpress users like is to schedule their posts. You can set Wordpress to put up a new post at whatever time you like. This is helpful if you write a bunch of posts at once. You donat have to put them all up right away. Stagger them over a day, or even a week. Add some information to your author profile, and you can also check to see if your posts have gone up. User plug-ins allow you to modify the appearance of your page.

Wordpress has an amazing feature. They call it their affiliate marketing program. You can earn money by writing good posts with links to Wordpress affiliates embedded in them. They pay you real money for the sales that come from this.

Get readers to start coming to your blog, and if a lot of people start coming to read your posts with affiliate links, you could start earning money. Many other Wordpress users have used this technique to start a home-based internet business. Itas easy. It can be fun. And if you do it right, it will be lucrative.

Read More...

Friday, December 26, 2008

7 Essential Tips to Avoid Your Mails Reach Customers’/ Subscribers’ Spam Folders

1. A Meaningful Sender name
There is a saying that, There is never a second chance to first impression. People after opening an unknown email wants to see the sender's name first before going through the content. If it is as greek as xxx3434@myisp.com then he will mark it as spam without even thinking for a second. Use a sender name that’s simple, easily recognized, and expected by the subscribers. Make sure that your From email address is recognized as well because some email applications such as AOL display only the sender email address, not the name.

2. Constructive and Informative Subject Name
Don't present yourself stupid even before delivering about your product or information. A message with a vague Subject line like "super offer for you!!!" will absolutely be reported as spam. You can make your email recognizable by including your company or newsletter name in brackets at the beginning of your subject lines, for example "[Taragana]: The best software and technology service provider".

3. Whitelist your domain through the Recipients
This will prevent a user-based filter from flagging your message as spam and either moving it to the spam folder or inserting “[SPAM]” to the message Subject. You can include the instructions on whitelisting your domain or email address in the Email Admin Centre area.

4. Don't Make Your Content Look Like a Typical Spam
Try not to use garish, bold fonts; large, red letters, and the like. A message with a clean, readable design is not likely to be taken for spam. Remember, simplicity is a virtue that never goes unattended.

5. Don’t send mails too often
If the recipients used to receive your newsletter once a week or month, don’t suddenly start emailing every other day.

6. Strictly Maintain Subscriber's Preference
Respect the subscriber’s preferences. If the subscriber opted in to receive your “Tips & News” newsletter, don’t send them e-commerce and promotion messages, unless they clearly requested them. This will by no way be a healthy promotion for your company but you will lose the penny you had.

7. Remind the recipient about subscription
Many subscribers receive dozens of commercial email messages every day and they may forget they signed up for your newsletter. It’s reasonable to add to your Email Admin Center the information about the user’s subscription: subscriber’s email address, opt-in date, and newsletter he/she subscribed to.

Read More...

Thursday, December 25, 2008

Three Important Tips to Write PHP Code Defensively

The phenomenal growth of PHP applications has also led to a mushrooming of increased quantum of malicious activity. It thus becomes imperative that you write secure PHP code to protect your website. Here are some tips for the same.

The three most vulnerable aspects of PHP that can become easily accessible to anyone are XSS (Cross Site Scripting), Global Variables and SQL code.

XSS

The growth of XSS has followed a steady growth in the use of AJAX. Cross Site Scripting, for instance is used when you create a Comment section in your website. If the commentator has to log in to comment, his login information gets stored in a cookie. As the JavaScript code is generally run whenever a person writes the comment, there is a pretty good chance of the contents of the cookie being accessible to a remote server handled by a malicious user.

To counter this, make a habit of including filters whenever you request for random information. Use the die() function to exit from the task whenever the filters detect an unqualified input. The details that are typed are first filtered and then sent to the website’s database. Again the information is filtered before it is output.
//A good filter program that validates data, prevents XSS attack and
//preempts white lists would look like this
echo 'this is what you input';
echo htmlentities($_POST['myInfo']);
?>

Global Variables

The PHP feature “Register Globals” leads to a palpable lacuna in programming safety. Once this feature is activated in PHP configuration file, even a single variable that is to uninitialized, can lead to a great security flaw. For instance
if (is_admin()) ( $authorized=true; )
if ($authorized) ( include "/very/sensitive/data.php"; )
?>

When you run the file, because of non-initialization the user may not be verified, resulting in anyone accessing the administrative control! To counter this, you should disable Register Globals, initialize variables use localized variables and as far as possible within the programs.

SQL Code


The SQL code is vulnerable to malicious users just like XSS feature. To write a secure SQL code you need to remember a couple of things. First avoid using dynamic code and second, if dynamic code in inevitable then do not have direct input into the tables.

For instance, a code like this will take care of the sql security
if ($_POST['submit'] == 'Save') {
if (isset($_POST['acct_num']) &&
isValidAccountNumber($_POST['acc_num'])) {
$link = mysql_connect ('hostname', 'user', 'password')
or die('Could not connect to DB');
...
}
}

Preferably have a database to select user name so that any other entry (like “bingo” or ‘blah blah’) can be swiftly detected. A simple way of preventing SQL security lapse is by typecasting the data so that input is effectively monitored. You can also make use of the versatile “mysql_real_escape_string”. This function can successfully filter symbols and contain SQL security flaws.

These three are the most significant to create a secure PHP code. Apart from this, you should also ensure that
- The system is well protected
- Files and database are protected.
- Posts are verified
- Input is always validated

Input validation is the key to secure programming. Make a habit of allowing only the right input into your system. A systematic approach to PHP, keeping in mind the pitfalls, can guard the program against most flaws and malicious attacks.

Read More..

Monday, December 22, 2008

5 reasons to open a twitter account for your online business

1. Share with anyone in doubt of what you’re doing.

If you’re like me, and you tell those around you that you’ve decided to take the path of a big web idea, chances are they will laugh at you and think you’ve gone crazy. I’ve had countless co-workers, family members and such tell me I was a ‘dreamer’. As Lance Armstrong said after one win, “I feel sorry for anyone who doesn’t dream”.

A lot of people in this world assume. I believe life hard is because of misinformation. I mean, imagine a perfect world, if all things were accurate and truthful, finding solutions to problems would be as easy as grabbing your left and right sock, or chopsticks. But assumptions people make are not facts, and thus, add to our misinformed world. So to reduce this, you’re now the source, the truth, the authority to what you’re doing. If there are those that want to spite you, it’ll be harder for them to do when they see your app’s twitter.

2. Building your SEO

I’m assuming you will be busy posting your updates, getting the word out like putting your twitter link in your email signatures, making announcements in your social networks about following you, etc. But with all those keywords that are important to you, Twitter’ll be another external link with all of this content all indexed in mighty Google. Your twitter account will have a great pagerank when you start getting active too! Doing it for the SEO alone would be worthwhile!

3. Updated news

When building your web app, it’ll be one less functionality you’ll have to implement: the update section. Just use twitter! and use a plugin like Twitter Tool embedded in your wordpress blog for your main content. 140 characters should be enough to say ‘selection menu on blah page is now fixed, thanks steve‘

4. What are you doing?

These are the words that face you when you login to your twitter. It’s one thing if you’ve logged into your general account and you see this question. It’s another when you’ve logged in to your business’s twitter account and facing you is this question. In that sense, Twitter is like a virtual overbearing Steve Jobs boss! (without the following mental abuse!)

5. Motivate yourself

You’ve got followers now who probably won’t be customers. They’re following you for a different reason. Perhaps they want to see your tenacity and drive and lead by example. Energy flows back and forth and any source for pushing yourself is well worth it.

Read More..

Thursday, December 18, 2008

Linux Vs Bsd

Differences between BSD and Linux

1) BSD license allows users/companies to modify a program’s source code and not to release changes to the public. In other words, BSD licenses allow commercial use and incorporation of a code into proprietary commercial products. This is how Microsoft incorporated BSD networking into their products and how Mac OS X earns money through muscles of FreeBSD.

Linux uses GPL license for most of the time (applications in Linux can also have a BSD license - or any license; it is up to developers how they decide). With a GPL-licensed program anybody can change the source code, but he or she MUST share it with the Open Source community to make sure that everybody will benefit from such a change.

2) BSD has the so-called “core system” (without packages). The core system consists of basic utilities (like ssh, fdisk, various commands like chmod or sysctl, manual pages, etc.) and anything beyond this is strictly seen as an add-on. Linux (not only the kernel, of course) is usually packaged as the whole system where this difference is not seen.

3) On BSD systems, all add-on packages are strictly installed into the /usr/local directory: documents to user/local/share/docs/application_name; themes and other things to /usr/local/share/application_name; binaries to /usr/local/bin/application_name. By application_name we mean a program’s name, so if you install IceWM, for example, its binary will be here: /usr/local/bin/icewm. With Linux, on the other hand, all applications get mostly installed into the /usr/bin directory.

4) BSD systems use the system of “ports”, which are fingerprints of applications in the /usr/ports directory, where a user may “cd” and execute a make command, which will download, via a directive contained in such a fingerprint’s code, the application’s source and the system will compile it as well. “Ports” are actually add-on packages for BSD systems and they are also packaged in packages repository of a concrete BSD system. They can be installed as binaries, too, with use of the “pkg_add” either directly from the Internet or locally. But “ports” have that advantage that if an author of any package makes a new version, a user can immediately get its newest/updated version. Packages released for a particular BSD version (like OpenBSD 4.1) are not updated and users have to wait for a new BSD release (like OpenBSD 4.2).

5) BSD systems have also their stable version. With FreeBSD, for example, you have a FreeBSD-Release (a version that can be used normally), FreeBSD-Stable (system more profoundly audited for bugs and security holes), and a development version - Current, which is not stable and not recommended for a regular use. Some Linux distributions started to imitate this philosophy, but with BSD systems this way of making distributions has become a rule.

6) Of course, the kernel is absolutely different.

7) BSD has FFS file system; it is the only file system on BSD’s contrary to Linux, where you can use dozens of file systems like ext2, ext3, ReiserFS, XFS, etc.

ReaD More..

Wednesday, December 17, 2008

WordPress Plugin Releases for 12/16

WP-Twitip-ID
This plugin takes the pain out of adding another field to your comment form for users to enter their twitter username to be displayed as a link to follow them via their twitter page.

Media Tags
With this plugin you can now add tags to your media attachments. You can tag Word document, PDF documents basically anything you upload via the standard WordPress Media upload tool.

CrossPress
Automatically, cross-posting to associated site/blog to enabling the post-via-email option with PIN code e.g. multiply.com, livejournal.com, blogspot.

Hackadelic Sliding Notes
Ajax sliders for content fragments. Fancy replacement for foot- and other notes.

GoogleMapper
This plugin allows a WordPress Site Admin to enter locations of stores etc into the db. The user can then search for the closest location.

Facebook Posted Items
This plugin fetches posted items from Facebook and displays them in an unordered list with proper links and comments.

Updated Plugins

Sensitive Tag Cloud
This WordPress plugin provides a configurable tag cloud that shows tags depending of the current context only.

RelatedPosts
This WordPress plugin provides multiple options to show the via tags related posts of a post. It contains a sidebar widget that is only visible when viewing a single post and displays a list of posts that are related with the current post via the tags.

wpSEO
The wpSEO plugin helps you to optimize your blog for SEO (Search Engine Optimization) purposes by eliminating issues with duplicate content and specifying meta tags and page titles for the different pages of your blog. You can also specify your meta tags and page titles manually.

GD Star Rating
GD Star Rating is post, page and comment rating plugin for WordPress. Plugin supports different image sets, rating moderation, vote rules, time restricted voting, templates, trend calculations, has a widgets build in and shortcode support.

Smooth Scrolling Links
This plug in uses the JavaScript provided by Stuart Langridge called Smooth scroll, which effectively adds a special effect to your “self” links. Self links means the links which are targeting to the same page with various locations like top, bottom or specific in page links.

Moodlight
Moodlight allows your visitors to add their mood on posts via comments.

Simple Google Sitemap
Creates an XML Sitemap, containing Homepage, Articles and Pages.

Read More...

Tuesday, December 16, 2008

Use of dynamic languages will rise in 2009

What used to be a programming tool for small jobs is mainstream in Asia as over 88 percent of developers say they use some dynamic language some of the time and over 40 percent use one more than half of the time.

Javascript is by far the most widely used dynamic language, although 45 percent of developers in Asia who use dynamic languages now use PHP in some of their projects.

"Software developers are always looking for ways to shed unneeded complexity and outdated methodologies and move to approaches that make programming simpler and faster especially as more and more development is web-centric," said John Andrews, president and CEO of Evans Data. "The high use of dynamic languages in Asia Pacific is consistent with the high concentration of web application development being conducted in that region."

Other highlights of this survey of over 400 software developers in the Asia-Pacific region include:

* Cloud computing is on the rise, with over one in five Asian developers planning to launch cloud projects within the next 6 months.

* Sixty percent of developers in the Asia region expect their development for mobile devices to increase

* Intel dominates the development market with more than twice as many developers targeting the Intel processors as AMD processors.

Developers predict their use of dynamic languages will remain the same next year as this year, except that Perl is expected to decline and Actionscript, the basis for Flash development, will increase.

Read More..

Sunday, December 14, 2008

The End of Twitter?

If you work in an internet related field (programming, designing, administrating, etc) you’ve probably heard of the “micro-blogging” service Twitter. For those who don’t know what it is, Twitter is a social networking site where users share “Tweets” (140 character messages) with each other and the world at large. As is the case with many new internet technologies however, Twitter has it’s shortfalls, and it might not be long before newer micro-blogging services take over.

One such new micro-blogging service is identi.ca. Even though identi.ca doesn’t have as many users or features as Twitter (yet!), it does some things Twitter does not.

1) REALLY easy setup.

Identi.ca supports OpenID*. Since I already have an OpenID set up, I used it to register my new Identi.ca account. All I had to do was enter my OpenID, approve identi.ca, and choose a nickname. That’s IT! No adding mundane details like my name or e-mail address… all that was pulled from my OpenID automatically.

Of course, if you don’t have OpenID you can still register at Identi.ca normally, and the process looks simple and easy.

2) IM and Text Message support.

When I first started using twitter, I could “tweet” using an instant messaging program. Unfortunately, this functionality soon disappeared, with little explanation as to where it had gone or when it was coming back. Likewise, one of the strongest features of Twitter is the ability to receive tweets from people you’re following on your cell phone as text messages. In the USA this works fine, but here in Canada Twitter has had to disable the service due to excessive costs from the cell phone companies.

Identi.ca seems to have neatly avoided both problems. As of right now at least they have an IM service that works and they’re using e-mail to SMS for their text messaging. e-Mail to SMS doesn’t cost them anything - the fees are passed on to the user. I looked into it and for me it would be a $5 a month upgrade, or 15 cents per message received. This is a bit of a pain, but at least the option is there.

3) Interfaces with Twitter.

Identi.ca interfaces well with twitter, so if you’re switching over you don’t need to worry about people missing your Tweets. Just add your twitter username and password to Identi.ca, and anything you post to identi.ca is copied to Twitter. Win / Win!

4) Identi.ca is Open Source.

Rather than being a closed platform like Twitter, Identi.ca is built on open source software and works with an open source license. This, combined with support for FOAF files*, Microformats*, and OAuth* means that other webmasters can set up their own micro-blogging systems, and fully integrate back to Identi.ca.

In short, Identi.ca takes sharing what you’re doing right now to a whole new level, and its smart business plan and open licensing agreements mean that it will continue to expand long after Twitter has died. If you’re just thinking about getting into the micro-blogging world, take Identi.ca for a spin. As with Facebook / Myspace, sometimes in the internet world “the second mouse gets the cheese”.

Read More...

10 Advanced PHP Tips To Improve Your Programming

PHP programming has climbed rapidly since its humble beginnings in 1995. Since then, PHP has become the most popular programming language for Web applications. Many popular websites are powered by PHP, and an overwhelming majority of scripts and Web projects are built with the popular language.

Because of PHP’s huge popularity, it has become almost impossible for Web developers not to have at least a working knowledge of PHP. This tutorial is aimed at people who are just past the beginning stages of learning PHP and are ready to roll up their sleeves and get their hands dirty with the language. Listed below are 10 excellent techniques that PHP developers should learn and use every time they program. These tips will speed up proficiency and make the code much more responsive, cleaner and more optimized for performance.

1. Use an SQL Injection Cheat Sheet
2. Know the Difference Between Comparison Operators
3. Shortcut the else
4. Drop those Brackets
5. Favour str_replace() over ereg_replace() and preg_replace()
6. Use Ternary Operators
7. Memcached
8. Use a Framework
9. Use the Suppression Operator Correctly
10. Use isset instead of strlen

Read More...

Friday, December 12, 2008

Open-Source Uru is Coming

As for the announcement itself, I’m elated but not necessarily surprised. Given the pre-announcement, it seemed impossible for it to be truly bad news (i.e. “Uru’s dead, we’re keeping the body. Shoo”). It seemed equally impossible for it to be radically good news (i.e.”Valve has hired us to produce the next few Portal games as well as the rest of the Half Life series, Cyan’s set for life and Uru will return with all the ponies you can imagine”). Given the push for and interest in open-source, it’s good to see Cyan taking the initiative (relatively. Only a few months since it was first talked about often on the forums compared to the years it took for UCC to take hold).

It will not be easy. People will and do have wildly different expectations. Some see it as the paradise they’ve wanted. A place where no one needs to feel sidelined because there will be a place for everyone. Some see it as a failure of their dreams. A place which will likely have no Cyan content, at least for now. Still others see it as just a place to gather and have fun. I think those people will be the ones who see the greatest benefit from this new Uru. It won’t be those who are elated but likely over-estimating Cyan’s open-ness. It won’t be those fearing a shattered community. Those two sides, as well as many others, will likely fight. Particularly if we try to make the Uru we like THE Uru. No, the ones who will have the most fun will be the people who just gather, no matter where they are.

Read more...

Google Chrome: A Point of Departure

Google (NSDQ: GOOG) Chrome officially got ratcheted up to a 1.0 release earlier today. The feature set may be meager compared to Firefox (e.g.: no plugins, yet), but it's only a starting point. And not just for something to be decked out with plugins, either.

This all started with some thought about the whole concept of "small is beautiful" or "less is more" -- however you want to put it -- in programming. It's a good place to start, but you can't always stay there. Users badger the programmers for this or that pet feature, and before long what started as a lean-and-mean piece of work has become top-heavy and potentially unstable. And soon a competitor comes along, someone who's stuck with the original plan of Keep It Simple, Silly, and you're back to where you started.

Here's where I think open source can be a big help, and I'll start with an open source project that's been constantly accused of succumbing to unneeded bloat: Firefox. It's not hard to expand on the core functionality of Firefox by writing extensions, but throw in too many and problems can arise. The folks at Flock took the Firefox source code and added a whole slew of social-networking extensions that would nominally be accomplished through plugins, but integrated them into the core as cleanly and efficiently as possible. If you want all that stuff, pick Flock; if you want to go with the original, go with Firefox. And any fixes that benefit one can in theory (and, typically, in practice) benefit both.

I'm seeing a similar future for Chrome, too. Rather than have a one-size-fits-all version, the Chrome we're getting now is going to be a point of departure for other projects that see the browser as a malleable vehicle, not a fixed destination. The same could be said of any number of other programs that serve as a major focal point for open source activity: OpenOffice, for instance, already has some of this going on with Symphony.

Read More..

Thursday, December 11, 2008

Tips to Improve Joomla Performance

When you are using the Joomla content management system, the overall site performance could be affected by various factors. Moreover, if you have many site users, the page loading speed could be influenced by the simultaneous number of MySQL database queries.

In order to obtain the best results for the page loading speed (which is a key factor for the search engines rankings) and to maintain the best performance of your Joomla website, there are a few tips that could help you.

Enabling the Cache for Joomla

When you are using the Joomla content management system, the overall site performance could be affected by various factors. Moreover, if you have many site users, the page loading speed could be influenced by the simultaneous number of MySQL database queries. In order to obtain the best results for the page loading speed (which is a key factor for the search engines rankings) and to maintain the best performance of your Joomla website, there are a few tips that could help you.

The
recent studies show that Joomla is twice as fast when used with PHP 5.2.3 in comparison with PHP 4.4, as a consequence the use of the last PHP version (which is definitely improved) will always offer you the optimal Joomla performance.

If you turn on caching on the Cache tab from Joomla Global Configuration in Administration Panel, then static files or a cache of your website will be created. The file caching allows the system to find a certain page directly from hard disk and removes the delay induced by a MySQL query to retrieve the same page in the database. The speed of page loading will also be increased by enabling caching.

On the Cache tab, when enabling caching, you must not modify the default cache folder, but you can set a lower value for the cache time if you update the site contents often and a higher value if the content is changed rarely. There are also many modules from Joomla structure that support caching. It is recommended to enable caching for those modules. There are also components that improve the page caching process, such as Ircmaxell’s Page Cache.This component will have visible effects on page load speed in case of website with high traffic.

Read More..

Tuesday, December 9, 2008

Zend Delivers New PHP Engine for IBM Servers

IBM and Zend last week announced the availability of a new PHP package, called Zend Core for IBM, which brings iSeries shops an inexpensive and easy-to-use tool for building dynamic, database-driven Web applications. While it’s not the first version of the open-source, server-side scripting language for the iSeries, the new PHP implementation brings advantages, such as technical support through the newly announced Zend Network, and the choice of using either DB2/400 or the embedded Cloudscape database.

PHP is one of the most popular languages (possibly the most popular) for creating and maintaining Web sites. According to a PHP usage survey for July, more than 21 million Internet domains are currently running PHP. This is out of a total of 68 million current Internet domains in the known universe, according to the Web site watchers at Netcraft. PHP, which is closely integrated with the Apache Web server and can run as an Apache module, is most commonly deployed with Apache, which powers 70 percent of the world’s Web sites, or about 48 million domains.

Read More...

Monday, December 8, 2008

The Pros and Cons of Using Joomla!

For those of you who have not heard of Joomla!, it is a content management system that allows one to build a complex web portal without the need of advanced web programming knowledge. You download it, install it, add a template then enrich the CMS with extensions. This way you can transform your site into a webshop, link directory, photo gallery and pretty much anything you set your mind to. But like any other CMS, Joomla! is not perfect.

Read More...

Data Services Made Easy for Adobe Flex Applications

The approach discussed here provides a more intuitive solution to generate ActionScript classes on the Flex side that are direct counterparts of the enterprise object classes in the back-end server. This way the Flex environment just becomes an extension of the back-end server and the Flex UI gets access to back-end objects. The infrastructure to make remote calls to the back-end server is taken care of by the framework that marshals objects to the back-end to make service calls and un-marshals the results to ActionScript objects transparently so the developer can concentrate just on the UI logic.

Adobe provides Flex Data Services (FDS) that also provides a robust data services solution but costs a huge license fee and ties to proprietary Adobe technology. The new approach discussed here provides a clean, efficient way for back-end integration based on open source technologies like e4x and XML. This approach is suitable for any project implementing Flex for UI with J2EE/Web Services at the back-end. Moreover, this approach doesn't need to be deployed on the server side, which makes it a better solution than FDS while programming the UI for already-deployed production applications.

Read More...

How To: Integrating Amazon CDN in 4 Simple Steps

4 Steps to Integrate Amazon CloudFront

We aren't going to focus on the exact coding required to integrate with CloudFront -- Amazon does a fine job of this themselves. What we want is to explain the steps you would take and point out things that you need to be aware of before taking the next step of actually getting started.

Here are the steps at a glance:
Get and set up Amazon S3 and CloudFront accounts
Create your Amazon S3 bucket
Create your distribution and get domain name
Decide what you want to use CloudFront for and create the appropriate links

Step 1: Setting Up your Amazon S3 and CloudFront Accounts


To access any web service AWS offers, you must first create an AWS account. This account is required to use any of the AWS products. Signing up provides you with a couple of access key identifiers (Access Key ID and Secret Access Key) which are required to sign up for S3 and CloudFront.

The Access Key ID is used to identify yourself as the true sender of requests and the Secret Access Key is a secure key that only you see. Because the Access Key is not a secure key, you create a digital signature using your secret key that helps confirm you are the true requester.

You will need to place these keys somewhere in code files to be used when coding to talk to the web services for either S3 or CloudFront.

Once you have the AWS account, you can then sign up for both Amazon S3 and CloudFront.

You need to sign up for Amazon S3 because this is where you will store your objects for CloudFront to access (your Origin Server).

Step 2: Creating your Amazon S3 Bucket

Now you are getting into the coding aspect of setting up this service. You can develop your applications in any number of programming languages and access the Amazon Web Services. Amazon provides a number of language specific toolkits to help you work with their web services -- so you aren't starting from scratch. Toolkits for PHP, Java, C# and Perl are available for helping you integrate S3 web service requests.

Read More..

Friday, December 5, 2008

Five good programming habits in PHP

Just like any language, developers can write code in PHP that ranges in quality from truly awful to very good. Learn good programming habits that can help you bridge the productivity gap.

Depending on whom you ask, the difference between a good developer and an excellent developer, in terms of productivity, is a factor of 10 to 20. An excellent developer is more productive because of his experience and good habits. When poor programming habits sneak into your code, they're a drain on productivity. This article demonstrates some good programming habits that can make you a better programmer.

In addition to enabling you to build code more productively, these habits can help you build code sustainable for an application's lifetime. Any code you write is likely to spend most of its lifetime in maintenance; application maintenance is a large expense. Establishing good coding habits will enhance design factors like modularity, and your code will be easier to understand and, thus, easier and cheaper to maintain.

Bad coding habits seem to accompany defects in code and can cause code to be difficult to change without introducing new defects. The following five good habits, when applied to your PHP code, will help you avoid these pitfalls:

1. Use good naming.
2. Take smaller bites.
3. Document your code.
4. Handle error conditions.
5. Never, ever, copy and paste.

Read More...