Sunday, December 29, 2013
Monday, December 16, 2013
Fix Cannot modify header information - headers already sent error
- Remove any blank line present. There should not be any line gaps between the code of lines.
Labels:
PHP
Saturday, October 26, 2013
Monday, October 21, 2013
PHP abstract classes
- Abstract classes cannot be instantiated
- A class must be declared as abstract if any of its method is abstract
- Methods defined as abstract must only declare its signature
- When inheriting from abstract class the child must define all the abstract methods with the same visibility or lower
- The type and arguments must match the signature
Labels:
PHP
Installing Zend Framework 2 Skeleton Application in Ubuntu
- Go to
https://github.com/zendframework/ZendSkeletonApplicationand click the “Zip” button - This will download a file with a name like
ZendSkeletonApplication-master.zip - Unzip this file into the directory and rename it to something like 'skeleton'
- Navigate into this folder and run the
composer.pharas described below - This installs ZF2 in the vendor/zendframework/zendframework folder
cd skeleton
php composer.phar self-update
php composer.phar install
Labels:
Zend
Friday, October 11, 2013
Enabling clean url via .htaccess in drupal 7
Sometimes due to server settings the clean url test may fail. To fix this make sure to add the below lines in .htacess file in the drupal root folder.
# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ /client/delacon/devel/index.php [L]
Labels:
Drupal
Thursday, October 3, 2013
Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed'
You have to cast the XML data to a string because internally they are all SimpleXMLElement
$event['mov'][$y]['name'] = (string)$child->name;
$event['mov'][$y]['movie_id'] = (string)$child->venues->venue->attributes()->id;
$event['mov'][$y]['description'] = (string)$child->description;
Labels:
Codeigniter,
PHP
Wednesday, September 25, 2013
Generate a create table script for an existing table in phpmyadmin
show create table tablename
Labels:
Phpmyadmin
Monday, September 16, 2013
Diff files and directories in linux/ubuntu
diff -bur folder1/ folder2/
This will output a recursive diff that ignore spaces, with a unified context.
Labels:
Ubuntu
Wednesday, August 21, 2013
Moving files from local server to production server in magento
- Change the values in
core_config_datatable fromhttp://localhost/project_name/tohttp://project_name/for bothweb/unsecure/base_urlandweb/secure/base_url - Update the
/app/etc/local.xmlfile as below:
// {write these values without quotes}
Labels:
Magento
Monday, August 5, 2013
How to make a custom email template from the webform form component fields in drupal 7
Example: In the email settings in webform, in the email template enter the below code.
Dear %value[first_name], // where first_name is the field key of the component
Thank you for subscribing our newsletter. Your email address has been added to our mailing list.
The details of your submissions are:
%email_values
Labels:
Drupal
Monday, July 15, 2013
Not able to create directory in ubuntu due to file permissions
- Check if logged in as admin or user and not as guest
- Only after logging in as root user, you will be able to use sudo and nautilus to change the file permissions
Labels:
Ubuntu
Wednesday, June 12, 2013
Enable .htaccess file - to fix zend controller path not being recognized
To make .htaccess files work as expected, you need to edit this file:
/etc/apache2/sites-available/default
Look for a section that looks like this:
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
You need to modify the line containing AllowOverride None to read AllowOverride All. This tells Apache that it's okay to allow .htaccess files to over-ride previous directives. You must reload Apache before this change will have an effect:
sudo /etc/init.d/apache2 reload
Labels:
Apache Server,
Zend
Thursday, June 6, 2013
Fix localhost error prompting for phtml file download in ubuntu
Ignore the 1st two lines if apache and php is already installed and working fine.
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
Labels:
Apache Server,
Phpmyadmin,
Ubuntu
Wednesday, May 29, 2013
Find if variable exists or defined in javascript
For example
if(typeof selected_val === 'undefined')
{
alert('Variable selected_val does not exist');
}
Labels:
Javascript
Changing password in phpmyadmin ubuntu 12.04
In the ubuntu console type the following one by one
sudo /etc/init.d/mysql stop
sudo mysqld_safe --skip-grant-tables &
mysql -u root
use mysql;
update user set password=PASSWORD("mynewpassword") where User='root';
flush privileges;
quit
Labels:
Phpmyadmin
Reset Mozilla Firefox
- Under the main menu click on Help -> Troubleshooting Information
- At the right side there will be a box to reset firefox
- Click on 'Reset Firefox...' button
- Firefox will now be restored to its default initial state
Labels:
Browsers
Monday, May 20, 2013
Set path to run java code in windows xp command line
Type the following code in the console
set path=%path%;C:\j2sdk1.4.2_04\bin;.;
where C:\j2sdk1.4.2_04\bin - represents the javac directory and the ending dot represents the current directory where file is stored.
Labels:
Java
Parse error in codeigniter on wamp
Change the value of the following line in \application\config\config.php from FALSE to TRUE.
$config['rewrite_short_tags'] = TRUE;
And in the wamp php.ini file
short_open_tag = On
This can be found under the heading
;;;;;;;;;;;;;;;;;;;;
; Language Options ;
;;;;;;;;;;;;;;;;;;;;
Labels:
Codeigniter,
Wamp Server
Tuesday, April 30, 2013
Jquery text repeat when used with on click and append
For example:
click here:
If you click on the text, the click will trigger on the inner div and bubble up to the outer div, the function will be executed 2 times.
To avoid this use stopPropagation()
click here:
Labels:
Jquery
Saturday, March 30, 2013
Remove extra space in dreamweaver
- Open the file
- Click CTRL + F
- Tick "Use regular expression"
- Type the following in "Find"
- Type the following in "Replace"
- Press "Replace All"
[\r\n]{2,}
\n
Labels:
dreamweaver,
IDE
Monday, March 25, 2013
Add Scrolbar only if content present
If you have an element whose content has to scroll only when it exceeds a particular width/height you can do so by assigning an id or class with the following css properties so that the scrollbar will appear only if the height exceeds the threshold value.
.noscroll {
width:150px;
height:150px;
overflow: auto;
}
Labels:
CSS
Tuesday, March 5, 2013
Check the executable version in ubuntu linux
Enter the following command in the terminal
file [file_name]
Labels:
Ubuntu
Thursday, February 28, 2013
Find local ip address in ubuntu
- Click on connections icon and select Connection Information
- The ip address will be displayed there
Labels:
Ubuntu
Saturday, February 16, 2013
Disable Windows Update
- Click on Start
- Search for Windows Update(You can type this in the Search programs and files field)
- Click on Change settings
- Select 'Never check for updates'
- Click Ok
Labels:
Windows
Disable Java Auto Uploader
- Navigate to where Java is installed
Example:C:\Program Files (x86)\Java\jre[version]\bin\javacpl.exe - Then scroll down till you see:
javacpl.exe - Right click on it, and click Properties
- Click on the Compatability Tab
- Check the Run this Program as an Administrator
- Click Apply, then click Ok
- Now double click javacpl.exe
- Click on Yes
- Under Update tab, uncheck 'Check for updates automatically'
- Click on Apply and then Ok
Friday, January 25, 2013
Reinstall custom module in magento
- Delete the appropriate table name in core_resource db table
- Delete the module table
Labels:
Magento
Wednesday, January 23, 2013
Add a glow around textarea on focus in html forms
In the css file, add the following lines:
textarea{border: 1px solid #ccc;}
textarea:focus{box-shadow: 0 0 8px rgba(82,168,236,.5); border: 1px solid rgba(82, 168, 236, .75);}
Couldn't resolve host 'magento-community'
Use this in front of the extension key name:
http://connect20.magentocommerce.com/community/
Example:
http://connect20.magentocommerce.com/community/banner
Labels:
Magento
Wednesday, January 16, 2013
Writing to downloadable file in PHP
$text_to_write = 'Example text to be written to file';
$fwrt = fopen($path.'file.txt', 'w');
fwrite($fwrt,$text_to_write);
fclose($fwrt);
header('Content-type: text/plain');
header('Content-Disposition: attachment; filename="example.txt"');
readfile($path.'file.txt');
exit(); // if this line is not included entire page code will also be written into the file
Labels:
PHP
Subscribe to:
Posts (Atom)