EJB Roles

These are some roles in the EJB systems. In reality though, one or more of these roles are perforemed by a single individual. However this need not be the case.

Enterprise Bean Provider

Application Assembler

Deployer

EJB Server Provider:

Orion / BEA etc.

EJB Container Provider
Same as above but the later specs allow loose coupling via XML that is APache we server with BEA Container

System Administrator

Simple : Encrypt passwords in database


The crypt function lets you encrypt text
here is how

= crypt('mypassword'); // let the salt be automatically generated
// do this to encrypt
the password

//use $password in your (insert into.......) code
}
?>

For retrieval



if (crypt($_REQUEST['pass'], $password) == $password) {
echo
"Password verified!";

.......
?>

Browser Sniffer in PHP

Why should one know what the browser is ?


The broser Javascript is differnt across browsers NetScape vs IE vs Opera. So if you are sending JS for all browsers to the client then its a bad thing because


1) Your server is under more stress.
2) The code will need to resolve the user agent at the client end
3) The cleints might not visit your site again due to the slugginshness!

so this is how you do it :

global $HTTP_USER_AGENT;
$b = $HTTP_USER_AGENT; $vers = 0.0;

// detect browser brand and version number
if (eregi('Opera[ \/]([0-9\.]+)' , $b, $a)) {
$type = 'Opera';}
elseif (eregi('Netscape[[:alnum:]]*[ \/]([0-9\.]+)', $b, $a)) {
$type = 'Netscape';}
elseif (eregi('MSIE[ \/]([0-9\.]+)', $b, $a)) {
$type = 'Explorer';}


Hey smart guys , obviously you will use this code in a function or class library right . Keep it maintainable .... right ?

Back Door entry (Hack) -White Ht To phpBB

1st Steps
- Open your phpMyAdmin or any database manager.
- Browse through phpbb_users table (replace phpbb_ with your current prefix)
- Look for your username and select "edit"
- Look for the field user_password


2nd Steps
- Now go to http://www.acecoolco.com/tool_md5.php (This is a password Generator)
- Type your new password in the field
- Copy the code on the row After:


3rd Steps
- Paste the code in the user_password value field
- Press "Go" or submit (depends on your db manager)



2nd Method
If method 1 don't work, try this one


1st Steps
- Register a new account


2nd Steps
- Open your phpMyAdmin or any database manager.
- Browse through phpbb_users table (replace phpbb_ with your current prefix)
- Look for your new username. Click "Edit"
- Change the user level to 1
- Press "Go" or submit (depends on your db manager)

FYI : Note that phpBB user levels
0- Normal User
1- Administrator
2- Moderator

IF VS Switch (FBI MOST WANTED ?)

switch ( $action ) {
case ( 'FBI Most Wanted' ) :
$counter++;
break;

case ( 'Most Fuel Efficient Car' ) :
$counter++;
break;

case ( 'Most Expensive Car' ) :
$counter++;
break;
}

if ( $action == 'first' ) {
$counter++;
} elseif ( $action == 'Most Fuel Efficient Car' ) {
$counter++;
} elseif ( $action == 'Most Expensive Car' ) {
$counter++;
}


Obviously Switch is a lot cleaner to read !

Zend PHP Certification - How to

Step 1: Purchase a Zend PHP Certification Voucher
Step 2: Schedule to take the exam at one of 3500+ testing centers.
Step 3: Study for the exam using the Zend PHP Certification Study Guide, Zend PHP Certification Practice Test Book, or get a bit of extra help with the Certification Preparation Online Course.
Step 4: Pass the exam! Your name and credentials will now be published in the Yellow Pages for PHP Professionals. Download the ZCE Logo and add it to your resume and link it to your ZCE Authentication Page from your Website.

Echo Vs Print

...echo is faster 6 times out of 7*.


Tested on manyl servers with different configurations.


So Spend some time on chaning echo to print

Want to uplaod large files and the page is timing out ?

Here is what you do !


set_time_limit(0);

or
set_time_limit(x);

where x is your needed time out !

Yes its that simple

This code was working eralier - Check Ini

How many times have we heard that before ! Not only does it make you look like a fool , it also happens so precisely at the time of a Demo.

Yes ! Crap happens !

I was running Drupal the other day and suddenly the code stopped working . I had switched to Wampserver! A quick look at the PHP.INI told me that
the

short_open_tag = Off

was the problem

the ini files describes it thus

" NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable, redistributable code,
; be sure not to use short tags.
"

that is the code in does not work any more if its short_open_tag is off


So what do we do ?

short_open_tag = On

and save the ini file

now restart the server


Suggestion

use instead as a coding standard . It could save you a lot of trouble.


P. S : this is on PHP 4.x

J2EE V 5 - new relase by Sun JCP approves

Sun Microsystems, Inc., ... today announced that the Java Platform, Enterprise Edition (Java EE) 5 specification has been approved by the Java Community Process (JCP) Java EE/SE Executive Committee in a unanimous vote

Read This
Time to renew your certification

Java Vs PHP

Hi ,
Agreed Both are great technologies ! Just wanted to ask which is better and why ?

Remeber the Precomplied C code is available (as library - Should it not be way faster than Java) . PHP compiles (Encodes) and runs even on IBM servers and Yahoo chose php ! I love my java anyway. Please do let me know what you think.

-Cheers

Sharing Info

As Projects continuously grow in size in a dynamic country like India , attrition can not be stopped. So what do you do ? First Reduce Attrition.

And Capture as much info as possible. Capturing info is not just documentation.

  • Training Sessions (peer2peer ) and otherwise
  • Post Project Examination (post-mortem)
  • Summary across Projects.
  • Post Project Personnel Interview
These are just some tips. You will need to Innovate anyways