12/30/06

I am 68% Masculine

according to a quiz, i am 32% feminine and 68% masculine:
You Are 32% Feminine, 68% Masculine

You are in touch with your masculine side.
You are not overly sensitive and not easily moved.
Occasionally, though, something will get through and touch your heart!

PHP vs. X programming language

soruce: zend.com by: kschroeder

Being a new Zender I’ve spent some time in the recent past looking at people’s opinions about PHP now that it directly affects the work I do. In my research I have found a lot of interesting “opinions” about PHP vs. this that and the other thing, usually in the form of lists. “4 reasons why Java will outlast PHP”, for example.

So, I figured I’d come up with a list of responses to the naysayers concerning PHP.

1) PHP lacks several important features
PHP is specifically web-centric. This means that many of the features that programmers from general purpose programming languages complain about PHP not having are simply not that important in a web based environment. Asynchronous execution using threads, for example, has very little use when a browser makes one request at a time.

2) PHP doesn’t have “real” object oriented programming support.
Knocking PHP because of a lack of OOP support is so “2003”. While the initial implementation of OOP in PHP 4 was not so great, PHP 5 implemented OOP in a manner that brings it very much in line with the other OOP programming languages out there. But the difference is that with PHP you don’t HAVE to use objects. The true definition of flexibility is when you are free to build as the situation warrants.

3) There are no tools for easing debugging/development problems.
Simply not true. For example, Zend developed Zend Studio which has all of the features of a modern IDE; profiling, debugging, etc. There are also several open source applications that aide in this arena. With the Eclipse PHP plugin coming along, this argument loses even more steam.

4) PHP is slow
Can be true, doesn’t have to be. If you take PHP out of the box, throw it on a web server and leave it there you will see lower performance. But if you build an application that understands caching, loads only what it needs and uses a code cache such as Zend Platform or APC you can get extremely fast performance. For example, using a caching mechanism in Zend Platform I recently demonstrated reducing execution time on a certain program from 600ms to 7ms.

5) There are no serious applications written in PHP.
While this is not true (many companies are using PHP in mission critical enterprise applications and there are several large scale applications available for use) the problem is that this statement diverts attention away from what the real question ought to be. The real question is “What is keeping serious applications from being developed in PHP?” The former statement is often used in a context of ridicule, guile or wholesale discrimination and seldom backed by fact.

There are very few reasons that should keep an enterprise level application from being developed in PHP from a functional perspective. In terms of back office integration today’s dependence on XML makes that concern irrelevant. If your concern is that your enterprise runs on Java then Zend’s Java Bridge built into Zend Platform gives you the option of using PHP to build your web based front end to your Java-based enterprise. Even in Microsoft environments PHP has COM and .NET integration points with Microsoft compatible platforms.

When I look at the php.net’s function reference I see 182 individual modules that are supported natively by PHP. There is support for several databases (not just MySQL), LDAP, IMAP, PDF, XML, shared memory, SSL, bindings to several multi-media engines, SOAP, COM, .NET, multiple compression/encryption schemes, JSON, non-blocking IO for both streams and sockets, XSLT, NIS, Shockwave and on and on and on. These are not the hallmarks of an insignificant programming language.

And this is only the beginning. PHP, with the help of Zend, has been given enterprise credibility via partnerships with IBM, Oracle and Microsoft. These are not industry lightweights. And they are companies who recognize that PHP is more than a simple hackers’ language. They see that PHP has the potential for great things in the enterprise space.

I would argue that once most of these points have been fully considered there are few significant barriers to building serious applications in PHP.

If, after reading this, still think that PHP has no place in the enterprise, please email me at kevin@zend.com. Your thoughts and responses are both anticipated and welcome.

Making Tables Read-only in oracle

In Oracle, you can only control read/write capability for an entire tablespace, not for a single table within a tablespace. So, if you want all the tables in a tablespace to be read-only, use the following command:


ALTER TABLESPACE READ ONLY;

To reverse the change and set all the tables in the tablespace back to read-write mode, use this code:


ALTER TABLESPACE READ WRITE;

Despite that limitation, you can simulate a read-only table by simply preventing all table modifications using a trigger. To do that, create a trigger as follows.


SQL> create or replace trigger emp_sal_read_only
2 before insert or update or delete
3 on emp_sal_tbl
4 begin
5 raise_application_error (-20001, 'Table EMP_SAL_TBL is read only,
You cannot make changes to the data.');
6 end;
7 /
Trigger created.

Here's a test command that tries to alter the data, and the resulting output:


SQL> DELETE FROM EMP_SAL_TBL;
DELETE FROM EMP_SAL_TBL
*
ERROR at line 1:
ORA-20001: Table EMP_SAL_TBL is read only, You cannot make changes to the data.
ORA-06512: at "SRIDHAR.EMP_SAL_READ_ONLY", line 2
ORA-04088: error during execution of trigger 'SRIDHAR.EMP_SAL_READ_ONLY'
source: devx.com

12/27/06

Graph Theory

These days , I am working on graph theory. I have borrowed some books from the school's library. It's cool.
I don't have time for Ancient Persian translation.

License

Today I put a license on this blog:
Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 License.

Ancient Persian translation:
الیوم ،تصدیقی بر این وب نوشت نهادم. متن تصدیق را در سایت مربوطه مشاهده توانید نمود.
.

Mr. Saberi and his mobile phone

Finally Mr. Saberi our mathematics teacher , bought a cell phone. A Sony-Ericsson's Walkman. lol. He was the only teacher who hadn't a mobile phone by now.(though the price of mathematics teachers as a private teacher is extremely high, both they may be a little stingy, of course Mr. Saberi was buildin' a house by now and he is not a stingy person) We could grab his number....Dirty sms messages !!! ;)
--------
َAncient Persian translation:
بعد از گذشت ازمنه ای بس دراز، جناب مستطاب حسن صابری نیک ،معلم ریاضیاتمان نیز دورگویی قابل حمل( و در اصطلاح موبایل) مبایعه نمود.یک سونی اریکسون واکمن.او یگانه دبیری بود که تا به امروزچنین وسیله ای از آن خود نداشت.(گویند که معلمان ریاضی در کلاس های خصوصی خود ثمن عظیمی از دانش آموزان طلب می کنند.پس ممکن است کمی گران کیسه و خسییس باشند. علی أی حال آقای صابری تا به حال به ساختن منزلی برای خویش مشغول بود و هرگز انسان لئیمی نیست.) توانستیم رقم او را از گوشه وکنار پیدا کرده و پیام های کوتاه با مضامین نامتعارف برای ایشان بفرستیم.ـ

12/26/06

Christmas, New year and finishing programming

Merry Christmas and happy new year 2007.
I am not a programmer anym0re. It's not so bad. for me, as a programmer.
I am very sad right now. I think that a programmer is a programmer for ever. But i am not a programmer now. I don't study php or program with this lovely language. So i use this blog for my personal notes.
Sorry for programmer readers.

12/20/06

Zend php 5 Certification exam tips-- strings Part II

· str[c]spn (string str2,string str2[,int start[,int length]])

· strspn () matches a string against a white list mask of allowed characters. Returns the length of the initial segment of the string that contains any of the characters specified in the mask.

$string="133445abcdef";

$mask='12345';

echo strspn($string,$mask); // 6

· strcspn() is like strspn but takes a blacklist instead of a white list.

· Both strspn and strcspn accept two optional parameters that define the starting position and the length of the string to examine. i.e.:

$string='1abc234';

$mask='abc';

echo strspn($string,$mask,1,4); //3

In the example above, strspn() will start examining the string from the second character(index 1) and continue for up to four characters.

· mixed str_replace(mixed search, mixed replace , mixed subject [,int &count])

using count:

$a=0; //initialize

str_replace('a','b','a1a1a1',$a);

echo $a; //3

if we wanna search and replace more than one needle at a time, we can pass first two args as arrays.

Example1: echo str-replace(array("hello","world"), array("bonjour","monde"),"hello world");

Example2: echo str_replace(array("hello,world),"bye","hello world");

In the first example the replacements are made based on array indices.

The first element of the search array is replaced by the first element of the replacement array, and the output is bonjour monde. In the second example, only the needle argument is an array resulting Bye Bye.

· Case insensitive str_replace = str_ireplace()

· If we need to replace a portion of a needle of which you already know the starting and ending points:

Mixed substr_replace(mixed string, string replacement, int start[,int length])

Substr_replace Replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement. The result string is returned. If string is and array, then array is returned.

If start is positive, the replacing will begin at the startth offset into string.

If start is negative, begin at the startth char from the end of string.

If length is given and is negative, represents the number of chars from the end of the string at which to stop replacing. If not given, default is strlen($str).

Substr_replace examples:

Substr_replace($var,'abc'0) // all of $var with abc

Substr_replace($var,'abc',0,0 // right at the beginning.

· The combination of substr_replace and strpos is a powerful tool:

$user='danrah@gmail.com';

$name=substr_replace($user,' ', strpos($user,"@");

echo "hello ".$name; // hello danrah

12/19/06

Zend php Certification exam tips-- strings Part I

· There should be no space before the ending statement of heredoc

· The only exception we can't use heredocs is in class properties:

class hello{

public $greeting=<<<>

Hello

STRING;

} //parse error

· We can not escape a brace ({) in double quotes with a backslash. Instead, we should escape the dollar sign inside:

{/$

· strlen() is binary-safe. It means that counts all of the characters regardless of their value.

· \0 is counted once by strlen()

· Strtr() translates certain characters:

Form 1: string strtr(string str,string from, string to)

Form 2: string strtr(string str,array replace_pairs)

In Form1, to and from should be the same size.

· strcmp() and its family are extremely important in exam.

· Substr_compare() :

Int substr_compare(string main_str, string str, int offset[,int length[,bool case_insensitivity]])

Compares main_str from position offset with str up to length chars returns <0>

· Simplest way to search inside a string: strpos and strstr families

· Strstr is important. Read the manual carefully

· Strpos is important too. if needle is not found, strpos will return Boolean false. The important thing about strpos is that we should use === for comparison because if position was 0th char, then == interprets that as false.

· Case insensitive strstr: stristr

· Case insensitive strpos: stripos

· Strpos finds position of last occurrence of a char In a string:

echo strrpos('123123,'123"); //3

12/15/06

Zend Cert Tips --PHP Basics

  • Getting string offsets, {} is a better practice than [] note that indices are started from zero
  • Indirect references to variables(variable variables):

$name="John";

$$name="Registered User";

echo $john; //prints registered user

echo $name; //prints John

Variable variables are a very powerful tool, and should be used with extreme care, not only because they can make your code difficult to understand and document, but also because their improper use can lead to some significant security issues.

Because of the availability of variable variables, it is indeed possible to create variables whose names do not follow the constraints. This is also possible

by defining the name between braces:

$name = '123';

/* 123 is your variable name, this would normally be invalid. */

$$name = '456'; // Again, you assign a value

echo ${’123’}; // Finally, using curly braces you can output ’456’

A technique similar to variable variables can also be used to hold function names

inside a variable:

function myFunc() {

echo ’myFunc!’;

}

$f = ’myFunc’;

$f(); // will call myFunc();

Clearly, this technique should be used with as much care as variable variables,

opportunities for mistakes and security issues it raises are quite significant.

  • In heredoc ending statement, semicolon is optinal but newline is registered and no space should be before this statement:

$string= <<<>

Str

STRING; //no space should be b4 this

  • Using each() to work like foreach

$players=array("Joe","Jack","Bill");

Reset($players);

While(list($key,$val(\)=each($players)){

Echo "#$key=$val \n";

}

  • The third argument of define() sets the case insensitivity of the constant, default 1(insensitive)
  • Valid composite assignment operators:

+= -= %= ^= .= &= |= <<= >>=

  • The match in the switch statement uses == not ===
  • For "for" loop we can supply more than one expression for each of the three args by using commas to delimit them.
  • Using "global" keyword is not recommended because of various reasons such as misbehaving with assigning values by reference, not supporting unset() and so on. We should use $_GLOBALS[] instead


Zend Cert Tips

As I mentioned earlier, I am studying for ZCE exam. I want to digitalize my notes (which are mostly tips) and post them to this blog. So they can be good resources for readers and for me to review them. The notes are from:

1. Manual

2. PHP5 Power Programming

3. Zend PHP5 Certification study guide

4. Zend PHP Certification study guide

5. PHP5 and Mysql Bible

I try to post new tips daily.

The tips are by subject and start from PHP Basics

They conform to Zend PHP5 Certification Exam topics listed at Zend.com

I don’t post something like what is a control structure or how to print something to the page and something like that.

I hope them to be useful for both u and me

;)

Zend PHP 5 Certification Study Guide Review

As i mentioned earlier, I got the book after a long time. I have read two chapters by now. It is a great book, showing the hidden parts of PHP5. But there is a tremendous problem . no Practice tests are given in the book.Instead, There is an online Mock exam which is not suitable for everyone.
The Certification Study Guide for PHP4 had sample tests with a companion:
Zend PHP Certification Sample Exams.
I think Zend wanna spread digital World ;)

12/14/06

Zend PHP 5 Certification Study Guide

Today, I found a pdf version of the Zend PHP5 Certification Study Guide. I am readin' it before my printed version arrives. Cool Book ;)

12/9/06

Something Frustrating about Zend PHP5 Certification

Read This Two Posts from Zend.com forum:
post 1 Study Guide is not useful
Post 2 Yellow Pages Problem
I think that PHP5 Certification is still incomplete.
we should wait ;)

Microsoft and PHP

Making PHP on Windows Work
by Andi Gutmans

Do You PHP ?

Do you php? (by rasmus lerdorf)

Design and Analysis of Distributed Algorithms

Download this book for free:
http://rapidshare.com/files/3693203/0471719978.rar

12/8/06

Mysql Customers

for a list of mysql customers(including google and Yahoo), take a look here:
http://www.mysql.com/customers/

Import MS Access Data to MySQL 5

Introduction


In an era where data becomes volumetric in every business, much attention has been given to proper database management and the ease of data access. Businesses that use MS Access begin to look for an alternative which allows better database performance, higher reliability, higher flexibility, yet inexpensive.


With the numerous choices available in the market, considering you don't want to put too much investment on it, only one, MySQL, stands out from the crowd. MySQL's flexibility allows you to deploy it cross various platforms, it also allows multiple user access concurrently. If you wish, you can still continue to do your data administration through Access as a front end. However, despite the various MySQL's features overtaking Access, whether or not to migrate your data from Access to MySQL still need an in-depth consideration.


In this article, I will discuss whether or not to migrate your MS Access data to MySQL. Then, I will cover about the considerations, planning, and preparations which should made before migrating your data. After all the planning and preparation stages has been finished, I will illustrate to you how the migration can be done with the help of Navicat, a MySQL database administration GUI.



MySQL versus Access


When you start to think of whether to use Access or MySQL, a very first point to think about is that what you need. The features of MS Access and MySQL are almost in two different directions: MS Access can only be deployed in Microsoft Windows while MySQL is cross platform; MS Access is a single-user application while MySQL is a multi-user application. To help you to decide whether or not to keep using MS Access or migrate your data from MS Access to MySQL, we will illustrate some scenarios that you should migrate or should not.



Migrate your MS Access data to MySQL when



  1. You want your data to be deployed with more flexibility. Data in MySQL can be accessible to more users through the web. With MySQL, people can use client programs or other administrative tools to get access to your database by authentication. MySQL can also be integrated with Web Server by web programming languages. This provides a more flexible choice other than MS Access alone. You can get your data from MySQL remotely from anywhere you want disregarding the platform, provided that the database is connected to the Internet and you have to login names for it.

  2. You are not the only person who controls the data. MS Access is a single user program for local use, although it has some sharing features, your data cannot be accessed concurrently in MS Access. MySQL is a multiple-user program, it's suited to the situation where you are not the only person who is controlling the data. MySQL is designed to work well in a networked environment and is capable to serve a number of clients.

  3. You want your data secured and only accessed by authorized people. MS Access data is stored in a local machine, whenever the machine is left unattended, any foreigner may steal your data by copying it to a disk. Although MS Access do allow users to set passwords to a database, it is not a necessity and many people neglect the process. MySQL requires authentication before opening connection to a database, this enhances the security issue. It also allows user privilege settings, this can help database administrator easily manage the actions for each particular user can perform.

  4. Your database is large.

  5. You are not going to use Microsoft Windows anymore. Since MySQL is cross-platform, you can install your MySQL on more than 20 platforms including Linux distributions, Mac OS X, UNIX, and Microsoft Windows.

  6. You want an open source database. MySQL can be obtained for free while MS Access cannot. MySQL is now under the GPL license. You can obtain a free copy of MySQL if you are not using it for commercial purpose. For commercial organization, the license is inexpensive compared to other databases in the market.



Do not migrate your MS Access data to MySQL when:



  1. you want your data be easily portable. Since MS Access is a local based program, you can take your data with your wherever you like by just copying the file onto a disk. The file can be opened with an MS Access program installed in another computer;

  2. you only need single user access to database;

  3. you prioritize the use of MS Access reporting feature more than the database features of MySQL;

  4. you feel very comfortable with the performance of MS Access.



After thorough understanding of the pros and cons of MS Access and MySQL, you should now able to decide whether or not to move your data to MySQL. If you have now confirmed your interest to migrate your data, the following sections will teach you how to do so.



Before Migration


To start using MySQL, a good planning is important as there is some incompatibility between MS Access and MySQL. To transfer the data successfully, there a few points we have consider. One of the important data incompatibilities we must consider is the column type and data format. Although most of the column types in MS Access and MySQL are compatible with each other, the capacity of specific column type may differ. For example, the type varchar in MS Access is not the same with the type varchar in MySQL. MS Access' varchar holds more characters then that in MySQL. In this case, we have to use text in MySQL to hold up characters in MS Access' varchar instead.


A typical example is the Date Format. In MS Access, date is stored as MM-DD-YYYY, whereas in MySQL, the date is stored as YYYY-MM-DD. Care needs to be given to those fields during conversion.


Other points we have to consider are the differences in the built-in functions, user defined functions, and maintenance.



It seems that there is a lot which we must consider for the migration. However, the real story can be simplified with the help of some database administrative tools.



Currently, there are a wide variety of tools available in the market to suit our needs. Here I will look into Navicat which I personally thinks stands out from the crowd.



Transferring your MS Access data to MySQL through Navicat


Navicat (http://www.navicat.com/download.html) supports imports from various file formats such as text, csv, XML, Excel, MS Access, HTML and some others.


Navicat has a function Import Wizard. In the table view, click the icon Import Wizard.



Animated graphical demonstration: http://support.navicat.com/animations/import_access.gif



In step 1 of the Import Wizard, specify the file type you would like to import. In this case, we choose MS Access database .mdb file. Click Next to proceed.



In step 2, choose the location of the access file. Once you have chosen the location of the file, all your tables in your access files will be shown in the table name box. Choose the tables which you would like to import. In this case, there is only one table present.



The import wizard will skip steps 3-5 and jump to Step 6. In this step, you can manually change the data type of the field, the value shown is the automatically generated type detected by the system.



The import wizard will skip Step 7-9 and jumped to Step 10. Choose Append: add records to the destination table and click Execute to start the converting process.



With the help of Navicat, the conversion process becomes unexpectedly easy. You can finish all the configuring process within one minute.



Navicat not only helps import MS Access data onto MySQL but also contains functions which MS Access has and even more.



Conclusion


This article has discussed the advantages and disadvantages of switching MS Access to MySQL. Whether or not to migrate your data will, of course, depend on your own needs.



Free trial version - http://www.navicat.com/download.html



Navicat Animated Demo - http://support.navicat.com/visual_tutorial.php

source: phpbuilder.com

Mysql Syntax

An easy to understand guide to MySQL syntax:
http://www.phpfreaks.com/MySQL_Reference/Syntax/3.php

Google Using Ajax again

after google trends, now google translation is using ajax.

12/7/06

Another SPl Example

Another SPL Example Class:
http://www.phpclasses.org/browse/package/3549.html

12/4/06

SPL Example

SPL Example Code
Download

Microsoft Takes the Windows Vista Road

After five years of hard work and 9 billion dollars worth of investments, Windows Vista fails to provide an answer to a simple question: “Who needs it?”

Ever since 2002, Microsoft has not missed a single chance to tell how revolutionary, how reliable and how special the new Windows would be (dubbed Longhorn up to 2005).

However, under the pressure of time, competition and many other factors, some services have been eliminated; others have been rethought while others have not even been mentioned again.

The final result? An operating system whose hardware requirements are met only by half of the computers currently used in the US (there’s no point mentioning the rest of the world), an OS which brings several significant transformations to what Windows has meant so far.

The first and most talked about change that Windows Vista brings is its new graphic interface, also known as Aero (those inclined toward sarcasm haven’t been able to refrain from commenting that Aero is inspired by Apple).

In order to support Aero, a PC must have at least 1GB of RAM and a video card of 256 MB RAM. Although the new interface is spectacular, it’s hard to believe that there will be a great number of companies or users willing to pay for it.

The interface is not the only major change though that Windows Vista brings.

Windows vista is the first OS designed and created after Bill Gates’s famous e-mail, through which he was asking employees and colleagues to be especially careful about security. Thus the long, 5 year journey began, with this concept of trustworthy computing in mind; this weekend brought it nearer to its end.

Microsoft says Windows Vista is the safest operating system ever. The users’ login system management has been modified almost completely, applications no longer have easy access to Windows’ basic components and these are but few of the changes the Redmond company has made.

Microsoft has wanted to lose its label of unsafe OS so badly, acquired through Windows 95 and Windows 98, that it invested heavily in security, purchasing companies and products and even starting a bit of a conflict with established producers such as McAfee and Symantec.

Nevertheless, from what has been shown so far, Windows Vista doesn’t get rid of the necessity to install an anti-virus, a firewall and even an antispyware program. That all this comes under the name of MicrosoftOneCare is a matter of personal taste, but users should not hold the wrong impression that, once Windows Vista installed, their security problems become history while their PCs become bona fide fortresses before hackers.

Another function that Windows Vista hopes to seduce consumers with is a new search engine that those prone to sarcasm once again say is inspired by Apple. Due to pressure coming from Google, Microsoft has invested enormous sums of money not only in MSN Search, but also in the new Windows Live Search platform, and implicitly, in its sequel.

Despite the effort, the kind of search that Windows Vista is proposing is still inferior to that provided by Google Desktop Search, a free application offered by the Google company.

To conclude, Windows Vista is a sum of useful functions and updates that a 2006 OS would be expected to bring, but it doesn’t provide anything more than what Windows XP itself offers, for example.

The latter’s advantage is precisely the fact that it has been on the market for five years, and that in this time period all programs, both possible and impossible, have been designed and launched, programs which can control virtually any aspect, from graphic interface to an operating system’s security.

As it is, Gartner itself has not given Windows Vista much credit compared to Windows XP. The analysis company estimates that PCs running on Vista will not outnumber those running on XP before 2010.

Has Windows Vista arrived too late for Microsoft? Considering the hardware specs, the market is not prepared yet for such an OS, but analyzing things from the perspective of functions offered by Vista, there isn't a single one customers would crowd stores for.

Maybe it would have been safer for Microsoft to concentrate on a Windows XP SP3 now and launch Windows Vista at a later time. All these options are no longer unavailable unfortunately, and history can’t be changed. Microsoft has taken the Vista road: there’s no turning back and all that’s left for the company is to realize where it’s taking it.

playfuls.com

12/3/06

This is For You ;)

Bye Bye awardspace

I am using award space currently. it is a free hosting service. so, it is not powerful. i want to redirect this address to drahmanzadeh.blogspot.com

ADSL after a long time

ADSL is available now in our region. I went to buy an ADSL line. But they said that we can't provide ADSL for your Phone Number that starts with 3 . I asked why? they answere: because local telephony doesn't let us to start.
Technological Country=Iran
lol


11/29/06

C sharp

i am learning C sharp now. A microsoft Product.
something that i hate.

11/27/06

The Frog

A guy was walking beside a pond when a frog jumped out and told him

that she was really a beautiful princess and if he were to kiss her,

 she would make him VERY happy! He picked up the frog and put it into

 his pocket.

 A few minutes later, the frog poked her head out and said, "Didn't

 you hear me?! I'm a beautiful princess and if you kiss me I will

stay with you and do ANYTHING you want!"

The guy took the frog out and said, "Look, I understand what you are

saying, but I am a computer programmer and right now I don't have

time for a girlfriend,........but a talking FROG is REALLY, REALLY

COOL !"

11/26/06

America's 10 Best Cities To Live In And How They Stack Up For PHP Developers

I love Nashville, TN. Well, ok, I really like it. It's a great town but I'm getting a bit restless. The problem I face is that I never know what the environment for programmers will be in a given city before moving there. So when Terry Chay briefly mentioned indeed.com's salary search tool , it sparked my interest. If I, a PHP programmer, wanted to move to another city in the US, how would I fare salary wise? Since I don't want to list every city in the US, I've selected CNN/Money's Best Places to Live in America as my list of cities to compare.

I've compiled all of this into a nice 1990's looking HTML table, complete with border=1, for your viewing pleasure.

Now I don't pretend that there is anything scientific or even serious about this information. Please don't base your job hunting efforts on the fact that "Cal said I could make X in that city." At best, this should be used as a guide and at worst, it's just entertainment.


RankCity, StateAverage PHP SalaryCost of
Living Index
1Fort Collins, CO$42,00099
2Naperville, IL $64,000115.2 *
3Sugar Land, TX$61,00087.2 *
4Columbia/Ellicott City, MD$71,000 110.3 *
5Cary, NC$59,00097.2 *
6Overland Park, KS$50,00080.5 *
7Scottsdale, AZ$50,000 107.8 *
8Boise, ID$36,00089.7
9Fairfield, CT$66,000163.4 *
10Eden Prairie, MN$53,000113.9 *
* = Index from closest listed city.

Since a lot of people are hung up these days on how things look, here is the chart I generated from indeed.com. If you click on it, it will take you to the live page and you can add your city into the mix and see how you stack up. I did and let just say Nashville is no Columbia, MD.




So it's agreed then, we'll all meet in Columbia, MD. :) We all know that the cost of living varies greatly from region to region. To help adjust for that, I went to bestplaces.net and found the cost of living index for each city or at least the nearest listed city for each city in our list. The COLI uses the US average as 100.

indeed.com also has a forum for php developers where you can join in a discussion on jobs, salary and other fun stuff. Make sure you drop on by and see them.

=C=






Disclaimer: CNN, Money, indeed.com, bestplaces.net and Terry Chay have not authorized or endorsed this article. They hold their own copyrights, trademarks, patents, service marks and coffee cups. I do not pretend to usurp their power in controlling these. I only mention them as way of attribution.

source: Zend.com

Copy Right (C) -> computer ebooks

I have found a site containing ALL of Computer Ebooks From O'rielly, Wrox, Willey, Sams .....
if you want the Address leave me a comment with your email address.
I can't Post it Here.
(C) :)

How to Ask Questions The Smart way?

I suggest you to read this article
helped much for me
http://www.catb.org/~esr/faqs/smart-questions.html
Good Luck

11/19/06

Raul Gonzalez wanted to quit Madrid

Raul Gonzalez threatened to leave Real Madrid after a recent defeat. Club president Ramon Calderon said the captain told him he was "suffering a lot" and "couldn't sleep" following Madrid's 1-0 loss at Getafe on Oct. 14, the club's first league defeat of the season.


"He said if the situation continued he would leave and free the club from paying the salary of his long contract," Calderon told news agency Efe in an interview published on Tuesday. Raul, who last won a trophy with Madrid in 2003, has enjoyed an improvement since that defeat.

Four days later, he scored in Madrid's 4-1 Champions League victory over Steaua Bucharest and added another in Sunday's 2-0 win over FC Barcelona. The 29-year-old striker has had an up-and-down season.

He ended an 11-month goal drought for Madrid and established himself as the Champions League's all-time scoring leader with 54 goals, but was dropped from the Spain team for the first time in 10 years.

Calderon said Madrid would offer to host Spain's European Championship qualifier against Denmark on March 24 on one condition.

"If Raul's not there, we won't lend them the stadium," Calderon said. Madrid is fourth in the Spanish league with 14 points from seven games, two fewer than leader Barcelona.

 

11/17/06

Comments are not Ignored Within Here-doc method in PHP

Consider the following block of code:

 

<?php

echo <<< EXAMPLESTRING

 

my string contents

 

EXAMPLESTRING;

?>

 

The above code prints:

 

My string contents

 

Not consider the following block of code:

 

<?php

echo <<< EXAMPLESTRING

 

//the string contents go here

 

my string contents

 

EXAMPLESTRING;

?>

 

This example prints:

 

//the string contents go here

 

My string contents

 

So we cannot use comments in here doc method.

The amusing part is that Dreamweaver can't understand this rule and shows the comments in here doc like other comments but Zend Studio shows them like other strings in the here doc section.

11/15/06

Dean's take on Microsoft's new Zune

The Microsoft Zune is the newest portable media player on the block,
and the reason for its existence -- beyond Microsoft's envy of Apple's
iPod business -- is sharing.

But a single feature can't overcome the massive momentum behind the iPod.

Microsoft has taken a major step with the Zune, but it's no iPod
killer. Overall, Microsoft has created a good music experience, but
the Zune seems unfinished and consumers are better off waiting for
future versions.

If you buy a Zune now, you're betting that Microsoft will be
competitive with Apple for years to come, since a library of music and
video collections isn't likely to work on both devices. The irony is
that if you bet on Microsoft, you'll be upholding the cause of
competition against the near-monopoly of the Cupertino empire.

Microsoft has tried to distinguish its first model of the Zune family
from Apple's iPod with built-in wireless networking. You can't share
songs wirelessly with Apple's devices. The problem is finding other
Zune owners. For my testing purposes, Microsoft solved that problem by
sending two Zunes, a black version and a brown one.

Sharing a song is easy and it can ``spark a conversation,'' says Zune
product manager Matt Jubelirer. Within a couple minutes of charging my
two Zune players, I was sharing a song. But it's not a lasting
relationship. Each song you share lasts for only three plays or three
days on your friend's Zune.

And if you share a song with a friend, you can never share that same
song with that friend again. To me that is a lame concession to the
music studios, not the rights of users. If you think of all the things
that Microsoft could have done with wireless networking, Zune
disappoints. For instance, you can't surf the Web, or act like a DJ so
your friends can listen simultaneously to the same song you're
playing. And the Zune won't wirelessly synchronize with your PC. It
has to be connected by a USB cable.

The good display adds to the experience. When you play music, the Zune
shows the cover of the album. At $249, the Zune with a 30-gigabyte
hard disk drive (enough for 7,500 songs or 100 hours of video) goes
head-to-head with a 30-gigabyte version of the iPod, but it features a
bigger 3-inch screen (versus vs. 2.5 inches). The Zune also has an FM
radio -- a $50 accessory on the iPod -- which allows you to set the
Zune to your favorite stations.

On the downside, the Zune is heavier and larger than the equivalent
iPod. That's a consequence of Microsoft's choices. Going wireless and
using a bigger color screen adds bulk. Stick it in your pocket and its
5.6-ounces will make your shirt sag.

Microsoft says the battery life is 14 hours with the wireless
networking turned off, and about 13 hours with the wireless on.
Running video, the Zune can last for four hours.

The advantages of Apple's momentum are evident in other ways.
Microsoft's Zune Marketplace has 2 million songs versus Apple's
3.5-million song iTunes Web site. Microsoft is also playing catch-up
with iTunes in providing TV shows, movies, music videos, audio books
and podcasts. And there are only dozens of accessories for the Zune,
compared to 3,000 for the iPod.

To buy songs, you spend points that you must purchase in $5
increments, a system that is similar to the e-commerce model on the
Xbox 360 but annoying compared to the convenience of using your credit
card to buy songs on iTunes for 99 cents. Deceptively, Microsoft sells
its songs for 79 points, but it costs you 99 cents to accumulate that
many points. For unlimited songs, subscriptions cost $15 a month.

Zune represents a sharp departure in Microsoft's music strategy, which
hasn't been working. Microsoft had been cooperating with a variety of
partners with its PlaysForSure music program, where it provided
software to other companies that built music hardware and downloading
services. Microsoft isn't abandoning that program entirely, but Zune
doesn't use it.

Microsoft's Zune has a circular control pad that looks like the iPod's
click wheel. But it isn't touch-sensitive like the iPod wheel is.
Rather, it is a four-way navigation pad that requires the user to
click on the various edges of the wheel to scroll in different
directions. This kind of navigation can be just as fast as an iPod,
and it seems more accurate as well. I was able to navigate while not
even looking at the display.

You can play a slide show of your pictures. As the slide show kicks
in, you turn the Zune sideways so that you can see the show
horizontally. When you click to end the slide show, the screen
automatically shifts back to vertical presentation.

Microsoft concedes that it started work on the Zune just a year ago.
That's why it has an unfinished feel. But the Redmond, Wash., company
contends it will spend hundreds of millions of dollars on Zune over
the coming years. Apple shouldn't be complacent. Microsoft is using
the same gradual takeover game plan as it has with Windows, Office,
Internet Explorer, Windows Media Player and most recently, the Xbox.

If you're feeling charitable toward the world's largest software
company and are worried about the coming hegemony of Apple Computer,
then by all means spend your money on Zune. The rest of us can wait
until Microsoft comes out with versions 2.0 or 3.0

11/10/06

PHP and ASP.NET Go Head-to-Head

One developer's view of the pros and cons of the two most popular means of building web applications

When it comes to Web development these days, you have a lot of options. Many of these methods involve preprocessing—that is, embedding code into HTML pages with special tags that signal to a preprocessor that they contain code, and that it should do something with it. Much like a CGI, this code is then run on the server, and it returns some content, which then assumes part of the shape of the resulting HTML page sent back to the browser. Both the open source scripting language PHP and languages within Microsoft's ASP.NET framework fall into this category; Java Server Pages (JSP) and Perl/Mason operate this way as well.

In this article I'll focus on PHP, the technology Oracle has chosen to incorporate into its products, and ASP.NET. I'll overview the various strengths and weaknesses of each, discussing in particular those areas that will help you make your decision on which to go with for your development project. There are a lot of factors to consider, and different projects may appeal to a different technology. In conclusion you'll find a point-by-point comparison in terms of price, speed and efficiency, security, cross-platform support, and the advantages of an open source solution.

What is ASP.NET?

The latest incarnation of ASP, ASP.NET, is not completely backward-compatible with previous versions of ASP, as it is a complete rewrite of the software. Previous ASP technology actually has a lot more in common with PHP than with ASP.NET, which is a complete framework for building Web applications. One of the principal features of this model is the flexibility to choose your programming language. ASP.NET works with scripted languages such as VBScript, JScript, Perlscript, and Python, as well as compiled languages such as VB, C#, C, COBOL, Smalltalk, and Lisp. The new framework uses the common language runtime (CLR); your language source is compiled into Microsoft Intermediate Language code, which the CLR then executes.

The framework also provides for true object-oriented programming (OOP), and true inheritance, polymorphism, and encapsulation are supported. The .NET class library is organized into inheritable classes based around particular tasks, such as working with XML or image manipulation.

Besides the programming language and the methodology, database access is a significant concern. When you program in ASP.NET, integration with databases can be accomplished through ODBC, which provides a consistent set of calling functions to access your target database.

Strengths and Weaknesses

ASP.NET's strength lies clearly in its clean design and implementation. It is an object-oriented programmer's dream, with language flexibility, and with sophisticated object-oriented features supported. In that sense, it is truly interoperable with your programmers' existing skills.

Another strength of ASP.NET is the development environment. For instance, developers can use WebMatrix, a community-supported tool, Visual Studio .NET, or various Borland tools such as Delphi and C++ Builder. Visual Studio, for instance, allows setting of breakpoints, tracing sections of code, and reviewing the call stack. All in all, it's a sophisticated debugging environment. Plenty of other third-party IDE solutions for ASP.NET are certain to surface as well.

But what you gain in robustness, you pay for in efficiency. ASP.NET is expensive with respect to memory usage and execution time, which is due in large part to a longer code path. For Web-based applications, these limitations can be a serious problem, because on the Web, your application is likely to scale to thousands and thousands of users per second. Memory usage can also become an issue on your Web server.

What is PHP?

PHP is a scripting language based on the model of preprocessing HTML pages. When the PHP preprocessor in your Web server notices a PHP language tag like the following, the PHP engine is invoked to execute that code:

<?php

some code here

?>

PHP will be familiar to any programmers who have worked with imperative programming languages; you'll notice syntactical similarities with Perl, C, and Java. Strictly speaking, Java is an imperative programming language, but it also makes use of object-oriented constructs and concepts. PHP borrows from this structure when it is convenient, but it is not a pure OOP language.

In the discussion of ASP.NET above, I mentioned the ODBC driver, and how applications can be built with database abstraction in mind. In PHP, you can also use ODBC to talk to databases, so you already have a whole list of supported databases to choose from. There are also native drivers for MySQL, Oracle, and Postgres. Furthermore, if you are connecting to Oracle, a special OCI8 library provides more feature-rich access to Oracle, allowing you to use such features as LOB, BLOB, CLOB, and BFILE.

You might ask, at this point, "Why are database-dependent libraries being touted as features of PHP?" Database abstraction, or independence, is a feature if you seek to build an application that works with multiple databases in one application or that can easily be ported to another database—when moving from development to production, for instance. And these are indeed valid concerns and considerations.

But, as Tom Kyte points out in his latest book, Effective Oracle by Design (Oracle Press), database dependence should be your real goal because you maximize your investment in that technology. If you make generic access to Oracle, whether through ODBC or Perl's DBI library, you'll miss out on features other databases don't have. What's more, optimizing queries is different in each database.

Zend Technologies, a commercial software company that contributes significantly to PHP, has created a commercial-development environment called Zend Studio that includes a sophisticated debugger, a profiler, and other features. It has also built the free Zend Optimizer, which, in combination with the Zend Encoder, compiles PHP code to speed performance. Additional commercial products also exist, such as the Zend Performance Suite, which can cache precompiled PHP pages, further speeding overall performance tremendously.

Strengths and Weaknesses

As of beta version 4, PHP 5 still has a few shortcomings, including its lack of exceptions, event-based error-handling instances that interrupt the normal flow of a program, jumping your code to a special error-handling section. Java also provides exceptions for error handling, while C++ provides exception handling via the try, catch, and throw syntax. You can, of course, still manage errors in PHP, but the structure is not standardized, so programmers are left to their own devices on how to implement error handling, leading to less consistency and a tendency to reinvent the wheel.

Another weakness is that PHP's function names are case insensitive. Some programmers might find this feature annoying, though this isn't a serious drawback.

I do have misgivings about PHP's object model, however. PHP wasn't designed to be an object-oriented language. Some of those features were added later, although care was made to keep backward compatibility with PHP 3, so you're left with a bit of both models. In fact, many of these weaknesses are addressed in PHP 5. Keep your ears to the ground.

What PHP lacks in a few areas, it makes up for by leaps and bounds in areas in which it excels. The price is right, so you don't have to worry about licensing issues. It's open source, too, so an entire community will keep a close eye on development, identifying bugs and making sure they get fixed. And if there's a feature you don't like, you can dabble with the code. What's more, PHP works native with Apache: It can be compiled as a module or directly into the Apache binary.

But running on Apache means that, with PHP, you can take advantage of whatever server investments you've already made, because Apache runs on Windows, Linux, Solaris, and various other Unix platforms. Also, going with a web server with Apache's track record means security remains a top priority. And, finally, PHP has a smaller code path, meaning there's less server-side code executed to parse and execute your PHP page, which results in more efficient memory and usage and faster execution.

What's New in PHP 5?

The fourth beta release of PHP 5 came out at the end of December 2003, and the change log makes it obvious that many bugs are being identified and ironed out. Although it's still in beta, it's definitely worth taking a look at for all the new features and advances.

PHP 5's major new achievements come in the area of its exception handling and a new object that introduces features that bring true OOP to PHP. Exception handling was certainly one of the most noticeable missing features in PHP 4, and its addition to PHP 5 is certainly a sign of maturity. Exception handling means you have language defined and standardized ways of handling errors in your software. Just use the try, catch, and throw methods, and your PHP code becomes more robust and clean.

<?php

 

class blue {

 

  function openFile ($inFile) {

    if (file_exists ($inFile)) {

      # code to open the file here

    } else {

      throw new Exception

        ("Cannot open file: $inFile");

    }

  }

}

 

$blueObj = new blue ();

 

try {

  $blueObj->openFile ('/home/shull/file.txt');

 

} catch (Exception $myException) {

  echo $myException->getMessage ();

 

  # rest of exception handling code here

}

 

# rest of blue methods here

 

?>

The new object model has a number of positive impacts on programs written in PHP. In PHP 4, when an object was passed to a function or method, it was passed by value, unless you explicitly told PHP otherwise. This procedure meant that a copy of that object, all the data structures in memory, would have to be copied. This step used memory and made access slow and clunky. In PHP 5, however, objects are always passed by reference.

The new object-oriented features in PHP 5, including constructors and destructors, are noteworthy. As with C++ and Java, they provide a standard way to create the object, allocate memory, and do any necessary setup via a constructor method and perform cleanup with a destructor method.

PHP 5 also introduces more subtle control of methods and variables in your classes. In PHP 4, everything was public: You could access variables from your classes outside the class or in derived classes. In PHP 5, you can still make variables or methods public, but you can also make them private, so they're used only within the class itself. A third option is to make them protected, which means that methods and variables can be viewed within the class or when subclassed.

Furthermore, PHP 5 introduces type hinting, or better type checking. When you pass an object into a routine, PHP can check that it is the right type and give a type-mismatch error if the check fails.

Additional features such as static methods and variables and abstract classes exist, so be sure to check the documentation for details.

Security Comparison

ASP.NET officially requires that you use IIS. Unfortunately, IIS has a long history of vulnerabilities, which makes many administrators reluctant to deploy it to handle their web site. Whether these weaknesses are because of Microsoft's ineptness or because IIS is a real red flag to hackers is irrelevant: Those systems have a history of being hacked and compromised. PHP runs on Apache, too, which is fast and open source and has a good security track record. Also, as I mentioned, Apache runs on many platforms.

If you are considering ASP.NET but you want to use Apache for your front-door to the Internet, you are fortunate to have a few options. First, you can use Apache to relay requests to IIS running internally on another machine. Apache then handles static content and passes aspx content on to the IIS server, which isn't exposed to the internet.

However, if you want to host ASP.NET with Apache, a couple of options are available that may or may not be supported by Microsoft. As a last alternative, there is Ximian's Project Mono, which is working to build an open-source module. Check www.go-mono.com for more information.

Database Coding Examples

Connecting to a database is one of the first things you'll consider doing in PHP or ASP.NET. With ASP.NET, however, it's a little more complicated, because you have the option of any of a number of languages to choose from. Of course, these code samples would have to be embedded into an HTML page, the classes instantiated, and so on. The following information, however, will give you an idea of the coding styles for each.

PHP 5 Connecting to Oracle

Here's a PHP 5 class that provides an Oracle connect-and-disconnect routine to show one way of connecting to Oracle with PHP 5 (other drivers, such as the ODBC driver, and generic database interfaces can be used as well):

class oracle_object {

  protected $theDB;

  protected $user;

  protected $pass;

  protected $db;

 

  function __construct($u, $p, $d) {

    $this->user = $u;

    $this->pass = $p;

    $this->db = $d;

  }

 

  function db_open () {

    $theDB  =  @OCILogon($this->user,  $this->pass,  $this->db);

    db_check_errors($php_errormsg);

  }

 

  function db_close() {

    @OCILogoff($theDB);

    db_check_errors($php_errormsg);

  }

 

  function __destruct () {

    print ("so long...");

  }

 

}

ASP.NET Connecting to Oracle

If you're looking to connect to Oracle with VB.NET (Visual Basic is Microsoft's default .NET programming language), take a look at this sample from MSDN:

Imports System

Imports System.Data

Imports System.Data.OracleClient

Imports Microsoft.VisualBasic

 

Class Sample

 

  Public Shared Sub Main()

 

    Dim oraConn As OracleConnection = New OracleConnection("Data Source=MyOracleServer;Integrated Security=yes;")

 

    Dim oraCMD As OracleCommand = New OracleCommand("SELECT CUSTOMER_ID, NAME FROM DEMO.CUSTOMER", oraConn)

 

    oraConn.Open()

 

    Dim myReader As OracleDataReader = oraCMD.ExecuteReader()

 

    Do While (myReader.Read())

      Console.WriteLine(vbTab & "{0}" & vbTab & "{1}", myReader.GetInt32(0), myReader.GetString(1))

    Loop

 

    myReader.Close()

    oraConn.Close()

  End Sub

End Class

Making the Choice

Without assuming you've already decided to go with PHP, I'll conclude that its strengths far outweigh its weaknesses. (See the summary in Table 1.) It boils down to price, speed and efficiency, security, cross-platform applicability, and open-source opportunity. Its only weakness is its lack of a pure and perfect OOP implementation; however, this is a minor drawback. Though language constructs do help, ultimately, good coding is a matter of practice, execution, good habits, and discipline.

Table 1

 

PHP 4

PHP 5

ASP.NET

Software price

free

free

free

Platform price

free

free

$$

Speed

strong

strong

weak

Efficiency

strong

strong

weak

Security

strong

strong

strong

Platform

strong

strong

weak (IIS only)

Platform

any

any

win32 (IIS only)

Source available

yes

yes

no

Exceptions

no

yes

yes

OOP

weak

strong

strong

Price. Here, we must consider not simply the price tag of the initial investment, which, in the case of PHP, is obviously free, but also the implementation, maintenance, and debugging costs. In the case of PHP, you may invest in the Zend optimization engine. With ASP, however, you're investing from the very beginning, and you're spending for add-on technologies—libraries for doing graphics manipulations, for instance. But, in the long term, PHP isn't going to press you to upgrade and collect more licensing fees. Everyone who has dealt with complex licensing also knows that companies spend time and money just ensuring they are compliant. Furthermore, you have a difference in response when getting bugs fixed. This, of course, translates to time, which translates to cost for overall development.

Speed and efficiency. As I mentioned earlier, ASP.NET is a framework allowing you to use various programming languages. In addition, it is touted as having a great object-oriented model. All this is true, but it becomes a detriment as far as speed is concerned. For all that advantage, there is a lot more code to run through to execute the same ASP page than you have to execute in the PHP engine for an equivalent PHP page. PHP is the quick-and-dirty type of solution, the one to get the job done. And though a lot of robustness has been added to it since its 2.0 and 3.0 days, it still retains that core optimized high-speed approach.

Speed is not the only consideration. Memory usage is also important.

Security. ASP.NET runs on IIS, which has been compromised innumerable times, as evidenced by IT news reports every other week. It has become such a liability, in fact, that in spite of all the marketing dollars spent on it, many IT professionals refuse to have their networks exposed with an IIS Web server. PHP, however, works with Apache, which has a proven track record of speed, reliability, and hardened security. Check www.securityfocus.com for more information.

Cross-platform applicability. ASP.NET runs on IIS and is starting to run on Apache, which can run on a whole host of platforms. PHP has been designed to work with Apache from the beginning, so you have many proven and reliable server platforms to choose from.

Open source opportunity. Open source is not just some philosophical torch idealistic programmers, or companies wanting to save a few bucks on licensing costs, are carrying. When you're dealing with bugs in the software itself, open source can be a serious godsend.

In either case, with PHP or ASP.NET, you have a large user base using the software and possibly encountering bugs. With ASP.NET, those bugs have to go through a bureaucratic process to get acknowledged, fixed, tested, and rolled out in a new patch or release. PHP fixes, however, can get fixed quickly and rereleased. Anyone who has watched open-source development knows new releases and patches often come out in days rather than in weeks or months, as with commercial software. If that's not fast enough, you can always fix a problem yourself if you have to.