Monday, December 31, 2012

Wordpress: Dynamically watermark all the uploaded images

I found a nice solution to dynamically watermark all the uploaded images in Wordpress. I'm not going to repost the solution here. Here is the link: http://dolcepixel.com/how-to-watermark-all-your-uploaded-images/. You can also download a zip file that includes the image, php file and htaccess code.

Monday, December 3, 2012

Solution to "MySQL Server has gone away" error

When I was trying to import a large sql file (about 11MB) in phpMyAdmin, I got "Error 2006: MySQL server has gone away".

Solution to the above error in XAMPP is as follows:
  • In xampp\mysql\bin\my.ini file, set
    max_allowed_packet to something like 10M or 20M (larger than the sql file you are trying to import)
  • Save the file and restart Apache and MySQL servers.
That should do it. There is no need to make changes to php.ini in this case.

However, if you need to import even larger file (say 4GB), then you will need to modify both my.ini and php.ini file.

For modifying xampp\mysql\bin\my.ini, follow the steps as above to set
max_allowed_packet = 4GB.

Then modify xampp\php\php.ini, set
post_max_size = 4G
upload_max_filesize = 4G

Save the files and restart Apache and MySQL servers.

Friday, October 12, 2012

Concrete5: ccm-toolbar issue

Issues with ccm-toolbar (the bar that appears in the edit mode with Edit and Dashboard buttons) is mainly due to jQuery conflict when you are using other jQuery plugins.

If you see the ccm-toolbar but if the Edit and Dashboard buttons are not there, you can try moving

<?php
  Loader::element('header_required');
?>

right below the opening of the <head> tag and above all calls to javascript. This usually fixes the issue. You usually do not need to include jQuery as it is included by C5 itself.

If this does not fix your problem, check for CSS that may be conflicting with the toolbar. Also check for your jQuery scripts that dynamically add/modify html tags. I once had his issue where my dynamic jQuery script was faulty.

Friday, August 31, 2012

Concrete 5: How to automatically tag form attachments with a file set?

I found a way to do this as explained in this forum post: http://www.concrete5.org/community/forums/chat/form-attachment/

I have tested this on Concrete 5 version 5.5.1 and this works perfectly.

Thursday, July 26, 2012

CSS: Solution for negative margin-top in Chrome and Safari due to min-height

There are different reasons for negative margins not being translated properly in Chrome and Safari. This is a particular scenario that involves min-height. I had a div whose negative margin-top is not working in Chrome and Safari. Worked in Firefox, Opera and IE 9 but not working in Chrome and Safari. This is what I had:

<div id="top-div">
  <div class="container">
    <img src="image-link" />
  </div>
</div>

<div id="bottom-div">
  <div class="container">
    <p>text text text</p>
  </div>
</div>

The CSS for the above was like this:
#top-div .container {
  min-height:250px;
}

#bottom-div {
  margin-top:-50px;
}

Now the fix. All I had to do was add "height:100%" in "#top-div .container", like this:
#top-div .container {
 min-height:250px;
 height:100%; /* adding this does the trick for Chrome and Safari */
    }

Giving a fixed required height such as "height: 300px" might work as well (can't remember if I tried this), such as:
#top-div .container {
  height:300px;
}

Tuesday, July 3, 2012

Concrete 5: .htaccess redirect - add .html extension

If you want to add .html extension to the end of the URL, try the code below in your .htaccess file. Also make sure Pretty URL is enabled from Dashboard.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f

# Rewrite rule for displaying as directories
#RewriteRule ^(.*)$ index.php/$1 [L] # disable this

# Rewrite rule for appending .html
RewriteRule ^(.*)\/$ $1.html [R]
RewriteRule ^(.*).html$ index.php/$1 [L]

Thursday, June 21, 2012

MySQL Workbench installation error

I tried installing MySQL Workbench 5.2 on Win 7 64-bit machine. I got this error message: The program can't start because MSVCR100.dll is missing from your computer. Try reinstalling the program to fix this problem.

I uninstalled the program. I downloaded and installed Microsoft Visual C++ 2010 Redistributable Package (x86) from this link: http://www.microsoft.com/en-us/download/details.aspx?id=5555. Then I reinstalled MySQL Workbench and it started working!

Just make sure you install MySQL Workbench 5.2 x86 (32-bit) and the Microsoft Visual C++ 2010 Redistributable Package (x86) 32-bit and not x64.

Concrete 5 : Page Not Found error fixed

Error: Page Not Found - No page could be found at this address. 

I have recently encountered this error in Concrete 5 (My C5 version is 5.5.1). The new page I created was like this: http://localhost/rwt/rwt-test

When I click to a link from the front end to go this URL, I get the error "Page Not Found - No page could be found at this address". But if I go this same page through Dashboard's Page Search feature that has the URL something like this: http://localhost/rwt/index.php?cID=241, then there seems no problem- I can comfortably access this page. So why can't I access the page from the first URL above?

I've noticed if you use the site name as part of the page name, your page is not found! I don't know why but once I removed the site name from the page name, ie when I converted my original URL to this: http://localhost/rwt/test, it started working again.

Hope this helps some of you.