class A {
public static function get_A() {
return new self();
}
public static function get_me() {
return new static();
}
}
class B extends A {
}
echo get_class(B::get_A()); // out put A
echo get_class(B::get_me()); // out put B
echo get_class(A::get_me()); // out put A
Search This Blog
Thursday, January 12, 2012
Difference of self and static in inheritance, php example
Wednesday, January 4, 2012
Zend Framework db examine SQL query Or Print SQL query
$db->getProfiler()->setEnabled(true);
$db->update($data, array('id = ?' => $Posts->id));
print $db->getProfiler()->getLastQueryProfile()->getQuery();
print_r($db->getProfiler()->getLastQueryProfile()->getQueryParams());
$db->getProfiler()->setEnabled(false);
Thursday, December 8, 2011
How to do a “git export” From Command Line
git archive
git archive master | tar -x -C /somewhere/else
If you want a compressed archive .
git archive master | bzip2 >source-tree.tar.bz2
ZIP archive
git archive --format zip --output /full/path/to/zipfile.zip master
Thursday, December 1, 2011
Setting Up Name Based Virtual Hosting In Ubuntu
1. Append the following line to your /etc/apache2/apache2.conf .
NameVirtualHost 127.0.0.2:80
2 . Create unique files for each of my domains within the /etc/apache2/sites-available/ folder.Create a fie called mysitename.com
<VirtualHost 127.0.0.2:80>
ServerName mysitename.com
ServerAlias www.mysitename.com
ServerAdmin me@ubuntu.com
DocumentRoot /var/www/mysitename/html
</VirtualHost>
3. Enable it by creating a symbolic link from one folder to the next ( etc/apache2/sites-enabled/)
sudo a2ensite mysitename.com ( to diable it anytime sudo a2dissite mysitename.com)
harder way to create the symbolic link
cd /etc/apache2/sites-enabled/
ln -s ../sites-available/mysitename.com .
4. Editing the /etc/hosts by adding the following line
127.0.0.2:80 mysitename.com
5. Restart apache sudo /etc/init.d/apache2 restart
****
To enable mod_rewrite in Ubuntu, you just need to write this command in terminal
NameVirtualHost 127.0.0.2:80
2 . Create unique files for each of my domains within the /etc/apache2/sites-available/ folder.Create a fie called mysitename.com
<VirtualHost 127.0.0.2:80>
ServerName mysitename.com
ServerAlias www.mysitename.com
ServerAdmin me@ubuntu.com
DocumentRoot /var/www/mysitename/html
</VirtualHost>
3. Enable it by creating a symbolic link from one folder to the next ( etc/apache2/sites-enabled/)
sudo a2ensite mysitename.com ( to diable it anytime sudo a2dissite mysitename.com)
harder way to create the symbolic link
cd /etc/apache2/sites-enabled/
ln -s ../sites-available/mysitename.com .
4. Editing the /etc/hosts by adding the following line
127.0.0.2:80 mysitename.com
5. Restart apache sudo /etc/init.d/apache2 restart
****
To enable mod_rewrite in Ubuntu, you just need to write this command in terminal
sudo a2enmod rewriteMonday, November 28, 2011
Tuesday, November 8, 2011
Validate numbers in JavaScript - IsNumeric()
A simple function to find if a positive number
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
Saturday, October 29, 2011
How to create virtual host In XAMPP in windows
1.Create a folder in C:\xampp\htdocs\mysite
2. Edit your hosts file in windows located in C:\WINDOWS\system32\drivers\etc\ and add following line
127.0.0.1 mysite.localhost
Don’t delete the existing “127.0.0.1 localhost” line
3.Open your C:\xampp\apache\conf\extra\httpd-vhosts.conf file and add the following lines
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerName mysite.localhost
DocumentRoot C:\xampp\htdocs\mysite
<DirectoryC:\xampp\htdocs\mysite>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
4. Reboot your computer .You should now be able to access each dev domain by way of:
http://mysite.localhost/
2. Edit your hosts file in windows located in C:\WINDOWS\system32\drivers\etc\ and add following line
127.0.0.1 mysite.localhost
Don’t delete the existing “127.0.0.1 localhost” line
3.Open your C:\xampp\apache\conf\extra\httpd-vhosts.conf file and add the following lines
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerName mysite.localhost
DocumentRoot C:\xampp\htdocs\mysite
<DirectoryC:\xampp\htdocs\mysite>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
4. Reboot your computer .You should now be able to access each dev domain by way of:
http://mysite.localhost/
Wednesday, October 12, 2011
Get phpunit coverage report for a single class
If you want to get the phpunit coverage report for a single class you can use --filter setting with the --coverage
option.
phpunit --coverage-html ./report --filter InsuranceStatusEligibilityFilterTest PluginAllTests.php
Wednesday, October 5, 2011
How to remove or edit external svn repositories
svn gedit svn:externals ./Gedit is the editor that you will see the external repository information, do the nessasary change and save to change the edit external svn repositories
Sunday, September 18, 2011
JQuery Check if element is checked and make it checked
if($('#cbxEmployeeFamily_'+planId).is(':checked')){
$('#cbxEmployeeFamily_'+planId).attr('checked', true);
}
Subscribe to:
Posts (Atom)