• Home
  • Services
  • Profile
  • Portfolio
  • Contact
  • Links
  • Blog
  • Archives
  • Sitemap
Subscribe: Posts | Comments | E-mail
  • Ajax XMLHttpRequestAsynchronous HTTP Request How To's
  • FreebiesBest Freebies Collection
  • MiscellaneousNews, Announcements & General Stuffs
  • Print & Web DesignPhotoshop, Vector, CSS, XHTML
  • ProgrammingProgramming PHP, ASP, .NET and more

Bali Web Design

404 - Page Not Found

There is known permalink issue after server migration.
Please try to search or navigate from the category instead

Perhaps the links below might help you find what you are after:

Posted on August 18, 2010 - by webmaster

PHP Newbie: Proper handling of Error & Exception in PHP

Featured Programming

Got a question from a friend today who is actually a great desktop programmer and just learn PHP since he believe that the future is in the web (hope you’re right dude). He asked me about how to handling error in PHP. Well i’ll write my answer here so can share with others and got feedback when I was wrong.

In PHP there are few options that you can use to handle errors & exceptions during script executions and as developer you must considering not the easiet but the most flexible approach which will help you when debugging your appllication, the more detail error message provided the faster you can fix it. Flexible means its easy for you to change the application behaviour when unexpected things happened during execution like: display error, logging error or even automatically notice you via email.


Do not use @ error control operator

PHP has magic char @ to use in expression which will ignore any error message that may arised during the expression execution, its bad since you cannot track if some unexpected result returned by the expression.

// error message will be ignored
@include('non_existing_file.php')

Currently the “@” error-control operator prefix will even disable error reporting for critical errors that will terminate script execution. Among other things, this means that if you use “@” to suppress errors from a certain function and either it isn’t available or has been mistyped, the script will die right there with no indication as to why.

Do not use “or die()”

When using “or die()” and error arised the script will stop right there and you will not get any clue except your own message that you provided in die() function. no file, no line, no detail message.

// ' error occured ' with no clue error detail
some_function_call(params_error_trigger) or die('error occured');

Use trigger_error() & set_error_handler()

Benefit of using these combination is that you can get the detail information of the error and with set_error_handler() you can customize the behaviour of your application in handling this error, also if you enabled error logging then you will get this event logged.

// error handling function
function app_error_handler($errno, $errstr, $errfile, $errline) {

if (!(error_reporting() & $errno)) {
// not included in error reporting level
return;
}

switch ($errno) {
case E_USER_ERROR:
// write custom handling for user error level
break;
case E_WARNING
case E_USER_WARNING:
// write custom handling for warning error level
break;
case E_NOTICE
case E_USER_NOTICE:
// write custom handling for notice error level
break;
default:
// write default error level handling
break;
}

if (ini_get("display_errors")) {
// print error
}elseif (ini_get('log_errors')) {
error_log('detail error message');
} else {
// not display nor log
}

return true;
}

set_error_handler('app_error_handler');

// error thrown
some_function_call(params_error_trigger) or trigger_error('yeeehaaa error occured!',E_USER_ERROR);

Use Exception handling & try{} catch() {}

Exception handling is programmer’s’ best friend, its enabled us to create completely custom behaviour for our application to handling unexpected thing that may occured during execution.

try {
// some process
} catch(Exception $e) {
// do exception handling
echo $e->getMessage();
}

We also can get benefit of using exception handling for some error by turn it into exception

set_error_handler('app_error_handler',E_WARNING);
function app_error_handler($errno, $errstr, $errfile, $errline) {
throw new Exception("Error: $errno: $errstr at $errfile line $errline");
}
try {
// some process where error occured
} catch(Exception $e) {
// do exception handling
echo $e->getMessage();
}

References:

  1. PHP Exceptions
  2. PHP set_error_handler()
  3. PHP Error Functions
Posted on August 16, 2010 - by webmaster

Why SEO lost importance

Featured Miscellaneous

Cameron Chapman wrote an interesting post at instantShift today, he explain well about the position of SEO in web development & internet marketing world lately which is getting less & less important.

Social media is a big part of the blame for this situation. People can now ask their friends or complete strangers for recommendations on virtually anything, and get human-filtered results within minutes through Facebook, Twitter, or other social networking sites. Internet users are also becoming more savvy and can cut through search results to find the best content, regardless of optimal placement for the best keywords.

Even in cases where search engines still send significant traffic to a site, search engines are becoming so much more intelligent that it’s getting harder and harder to get good placement unless you’re providing the best content.

According to Chapman’s article, the 7 main reasons why SEO is getting less important are:

  1. FacebookNot arguably is one of the biggest internet player with more than 500 millions active users. Facebook has change the behaviour of internet users, rather than finding the information through search engine, they now prefer to find the information through their network on facebook (groups, friends)
  2. Social Networking & Newsmany peoples really active in social networking and news aggregators nowdays (Digg, Reddit, Delicious, Stumbleupon etc.), they exchange/sharing relevance links for specific topics, tagging & rate informations in which will help others to find the relevant info easily and more accurate rather than trying to find that info in search engine
  3. Better search engine alogarithm I personally think that SEO has turn internet world into a “spam” world where people trying to put non relevance info into their sites just to have more presence in search engine. But it was then, now search engine become more intellegent, getting smarter which makes on-site SEO strategies less effective nad getting hard to put the site up in search engine result position.
  4. Blog Roundups & Showcase Blog is getting popular indeed and has completely transformed from personal content into proffesional & community presence, roundups & showcase with selective list about spesific topics helps people to find info in 1 place with many alternative solutions
  5. Twitter no doubt twitter is the one of the biggest reason why SEO lost its importance, twitter has its change the way internet users sharing informations, exchange links, searching for topics, bookmarking favourite info in short and quick way, its become one of the biggest target of internet marketing media
  6. People already have favourite sites most active internet users already have favourite sites for specific topics, bookmarked it and visit it regulary, rather than searching for topics in search engine they prefer to find the info in these website which they already familiar with and trust as a good resources for themselves
  7. More Savvy Searchers yes we’re all more savvy, more familiar and know better how to get less result but more accurate in search engine with long tail and custom keywords
  8. Very active Q & A websites with pro users I add my own reason, even this is related with point 6 but i think more specific these kind of website seems to send SEO into its end. When people use search engine they want to find info & “how to” information, These kind of websites provide them with more accurate info from pros and experienced people whom has struggling with the same thing before and has working solutions for that.

    As developer i really love stackoverflow and its network sites, i can get working solutions faster than when i tried to find the same info in search engine, social network sites or or blog/news aggregator sites since it organized into very specific topics and supported by pros in that topics as well.

Posted on August 16, 2010 - by webmaster

jQuery Mobile Announced : Touch-Optimized Web Framework for Smartphones & Tablets

Featured Miscellaneous

Really interesting post from Dion at Ajaxian i read today explain about the new jQuery mobile project as announced by Jhon resig himself the founding father of jQuery. The jQuery Mobile project is supported by Palm with their webOS platform, Mozilla with Mobile Firefox and Filament group the creator of EnhanceJS

jQuery Mobile: Touch-Optimized Web Framework for Smartphones & Tablets. A unified user interface system across all popular mobile device platforms, built on the rock-solid jQuery and jQuery UI foundation. Its lightweight code is built with progressive enhancement, and has a flexible, easily themeable design.

Great move and cant hardly wait to test it when it become available

Multiple Google Account Signin
by webmaster on August 15, 2010
Install, Configure & Running Memcache in Windows as Service
by webmaster on June 27, 2010
DynamicWP Image Cube Wordpress Plugin
by webmaster on June 14, 2010
New Wordpress 3.0 API menu_page_url
by webmaster on June 12, 2010
Wordpress 3.0 Custom Taxonomy
by webmaster on June 11, 2010
JQuery DataGrid Plugin Compass
by webmaster on June 6, 2010
Upgrading to upcoming CodeIgniter 2.0
by webmaster on June 6, 2010
« Older Entries
Freebies

Social Network Icon Pack

80+ social network icons which consists of 40+ 16 pixel x 16 pixel icons and 40+ 32 pixel by 32 pixel icons all in 32-bit PNG format by komodomedia.

Download it here

Freebies Print & Web Design

Free Icons flavour & twitter icons

Awsome free icons at smashingmagazine available for download, 2 different set of high quality icons in PNG format with different sizes and downlaodable along with PSD & AI (adobe illustrator format) source for free, allow you to make any modifications to the icons to fit your needs.

Flavours Icon Set by Oliver Twardowski, aimed to help [...]

Freebies Print & Web Design

Free Icons flavour & twitter icons

Awsome free icons at smashingmagazine available for download, 2 different set of high quality icons in PNG format with different sizes and downlaodable along with PSD & AI (adobe illustrator format) source for free, allow you to make any modifications to the icons to fit your needs.

Flavours Icon Set by Oliver Twardowski, aimed to help [...]

Freebies Print & Web Design

Gallery a free wordpress theme for portfolio showcase

Smashingmagazine has released a new free wordpress theme designed by Christopher Wallace named “gallery”, based on the result of smashing community wordpress theme polling.

Gallery is a beautiful, free, gallery-style Thematic child theme for WordPress. It is extremely flexible and can be used as a starting point for design galleries and portfolio.
Gallery is packed with loads [...]

Featured Programming

PHP Newbie: Proper handling of Error & Exception in PHP

Got a question from a friend today who is actually a great desktop programmer and just learn PHP since he believe that the future is in the web (hope you’re right dude). He asked me about how to handling error in PHP. Well i’ll write my answer here so can share with others and got [...]

Featured Programming

Install, Configure & Running Memcache in Windows as Service

Installing memcache server in windows is a little bit complicated compared to how it can be done in *nix since theres not yet available ready to use package for win32.

Luckily i found the compiled memcached for win32 (exe) which was made by jellycan, within this exe file you can install configure and running memcached as a service in your windows environment, here are how i made it

Programming Tutorials

WordPress 3.0 Theme Development: The Comment Form

Otto at ottopress has written a great article about the new handy & standarized tags in wordpress 3.0 to display comment form. Replacing the old messy comment template with versatile costumizable wordpress template tag

Programming Tutorials

PHP Class Create Short URL via TinyURL, Is.gd, Hex.io, Tr.im & Bit.ly API

Short URL is commonly used today for several reasons: avoid url garbling, take smallest space especially for long url which need to be posted at limited space format eg: twitter, also often used to manipulate user for specific purposes eg: hiding orginal url for phising and ads/affiliation links.
There are many websites that provide shortening url [...]

Web 2.0

Beautiful jquery lightbox plugins

When I am re-designing my official website i have googling for thickbox alternatives to used in my portfolio section, thickbox is great but i need a lightbox effect plugins with beautiful predefined styles and compatible with latest jquery 1.3.1 version, and jquery lightbox below match my requirements.

PrettyPhoto jquery lightbox
I have been using prettyphoto since few [...]

Freebies Tutorials Web 2.0

Update: Jquery Image Loader

Follow up the comments from my previous post about animate loading image with jquery which asking about how to populate images from the DOM instead of declare the image within the javascript codes manualy, so i made a little changes into the code since it seems to be easier for you all to adopt this [...]

View The Archives
  • Most Popular Posts

    • { 108 } ResponsesPHP ajax login form using Jquery
    • { 79 } Responsesphp ajax tutorial create ajax based login form using jquery
    • { 71 } ResponsesASP Classic Programming Still Alive
    • { 53 } Responses63+ best practice to optimize PHP code performances
    • { 44 } ResponsesVideobox: Lightbox for videos
  • Latest Posts

    • PHP Newbie: Proper handling of Error & Exception in PHP
    • Why SEO lost importance
    • jQuery Mobile Announced : Touch-Optimized Web Framework for Smartphones & Tablets
    • Multiple Google Account Signin
    • Install, Configure & Running Memcache in Windows as Service
    • DynamicWP Image Cube Wordpress Plugin
    • New Wordpress 3.0 API menu_page_url
    • Wordpress 3.0 Custom Taxonomy
    • JQuery DataGrid Plugin Compass
    • Upgrading to upcoming CodeIgniter 2.0
  • Categories

    • advertorial
    • Ajax XMLHttpRequest
    • Featured
    • Freebies
    • Miscellaneous
    • Print & Web Design
    • Programming
    • Tutorials
    • Web 2.0
  • Featured News

    • PHP Newbie: Proper handling of Error & Exception in PHP by webmaster on August 18, 2010
    • Why SEO lost importance by webmaster on August 16, 2010
    • jQuery Mobile Announced : Touch-Optimized Web Framework for Smartphones & Tablets by webmaster on August 16, 2010
    • Install, Configure & Running Memcache in Windows as Service by webmaster on June 27, 2010
    • Website Optimization Best Practices, speed up your website load by ruby on May 21, 2009
  • Tag Cloud

    • Actionscript advertorial Ajax XMLHttpRequest API best practices CakePHP chat Classic ASP CMS CSS Development facebook firefox Flash flickr Freebies gmail HTML icons Javascript Jobs jQuery jQuery Plugins Library Lightbox memcache Mootools news Personal PHP PHP Frameworks plurk Print & Web Design prism Prototype regex regular expression Scriptaculous SEO Tutorial twitter Web 2.0 Wordpress Works YUI
  • Archives

    • August 2010
    • June 2010
    • May 2010
    • September 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
copyleft 2007 - 2010 Bali Website Design Studio