Use ffmpeg to convert your videos

ffmpeg -i products_video.mp4 -c:v h264 -an products_video_h264.mp4 # Convert to MP4 ffmpeg -i products_video.mp4 -c:v libtheora -an products_video_libtheora.ogv # Convert to OGV ffmpeg -i products_video.mp4 -c:v libvpx -an products_video_libvpx.webm # Convert to Webm ffmpeg -i products_video.mp4 -c:v h264 -an -filter:v scale=720:-1 products_video_h264_720.mp4 # Convert to MP4
Tuesday, February 21, 2017
Posted by Anjana Jayaweera

Add Compression (Gzip) and caching methods for htaccess

  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/opentype

# For Olders Browsers Which Can't Handle Compression
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html


ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"


Sunday, January 8, 2017
Posted by Anjana Jayaweera

Error connecting external SMTP server

Here I am with some quick solution, if you are sending email connecting to external smtp server like you may have to consider to check 2 options.

1. Check smtp ports are open or make sure its not block:
Open your WHM and go to "ConfigServer Security & Firewall" and Edit the configuration file for the csf firewall and lfd or click on "Firewall Configuration" locate SMTP_PORTS and make sure porst are open (Ex: 25,465,587)

2. Check smtp allowed users are added in the list or Always allow the following comma separated users and groups to bypass SMTP_BLOCK
Open your WHM and go to "ConfigServer Security & Firewall" and Edit the configuration file for the csf firewall and lfd or click on "Firewall Configuration" locate SMTP_ALLOWUSER and add the cpanel username (Ex: cpanel, )

Save the changes & you restart both csf and lfd.

In anyway if this one helps you, please make a comment & share in your post

Thank you.

This is really strange, new problem rise everyday and we have to find solution, codes are also same like life now.

“Password not accepted from server: 535 Incorrect authentication data” when sending with GMail and phpMailer

using CentOs 6 Login to CPanel > Tweak Settings > All> "Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)" <== disable it.


Thursday, July 28, 2016
Posted by Safras Ahamed

Flash Nexus 5 Manually

  • fastboot erase boot
  • fastboot erase cache
  • fastboot erase recovery
  • fastboot erase system
  • fastboot flash bootloader "name-of-bootloader.img"
  • fastboot reboot-bootloader
  • fastboot flash radio "name-of-radio.img" (if present)
  • fastboot reboot-bootloader
  • fastboot flash system system.img
  • fastboot flash boot boot.img
  • fastboot flash recovery recovery.img
  • fastboot flash cache cache.img
  • fastboot flash vendor vendor.img (Nexus 9 only)
  • fastboot erase userdata
  • fastboot flash userdata userdata.img
  • fastboot reboot

Source :
Tuesday, July 5, 2016
Posted by Anjana Jayaweera

Fatal error: Uncaught exception 'ImapMailboxException' with message 'Connection error: Can not authenticate to IMAP server

I am using php to connect and download mail from and also to send email using this was working without any problem, sudenly this stop working and started to give error messages as bellow.

Fatal error: Uncaught exception 'ImapMailboxException' with message 'Connection error: Can not authenticate to IMAP server: [ALERT] Please log in via your web browser:' in /xxxxxx/classes/ImapMailbox.php:51 Stack trace: #0 /home/xxxx/public_html/_backoffice/mailpilot/classes/ImapMailbox.php(42): ImapMailbox->initImapStream() #1 /xxxxxx/classes/ImapMailbox.php(114): ImapMailbox->getImapStream() #2 /xxxxxx/mail.v3.php(28): ImapMailbox->searchMailbox('ALL') #3 {main} thrown in/xxxxx/classes/ImapMailbox.php on line 51

Was looking for a solution two weeks and finally google contacted me with an answer, here is what you have to do.

It seems this error is related to the access to "Less secure apps" disabled for the user you're trying to connect via IMAP. Please follow these steps to solve this issue:

 1. In your Admin Console, follow the steps available at this support article under the section "Enabling less secure apps to access accounts".

2. Log in as the affected user and follow the steps to "Allow less secure apps to access your account" as described at this support article

 Thanks Saf
Saturday, July 2, 2016
Posted by Safras Ahamed

How to Install Zurb Foundation 5

Think most of the people having difficulties to install Zurb Foundation 5. Ruby Error messages, "compass watch" not working etc. etc. I had the same issue last night but solved it myself.

This is a small guide, how to Install Zurb Foundation 5 properly in Windows 7.

1. Install Git

As per Zurb Foundation docs, the 1st thing is you have to install Git.

When installing, choose the  2nd option. (Run Git from Windows command prompt)

Then, manually set configure the Windows Path as follows. (System->Advanced System Settings->Environment Variables)

C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd

This will not harm anything in your system, so no need to worry.

2. Install Ruby

2nd thing as per the Zurb Foundation Docs.
Choose this version rather than the 2.00 or 2.00 64bit version. And if you installed any other Ruby version, uninstall it. (But remember the gems you have installed before)

Next Next Finish :)

3. NodeJs

Pretty straightforward.

4. Restart PC

Path to npm will set when you install NodeJs.

5. Install Bower

Go to the command prompt and type "npm install -g bower"

6. Uninstall/ Install Foundation

If you uninstall ruby, the foundation gem also gone. But to make sure, try below.

gem uninstall foundation
gem uninstall zurb-foundation

If it said 0 gem uninstalled, then your foundation gem gone. What we have to do here is to install the new foundation as per the docs.

gem install foundation

7. Install Compass

Dont forget to Install Compass too. :)

gem install compass

8. Create Foundation 5 Project

YOUR_PATH> foundation new MY_PROJECT

9. Watch Sass Changes

YOUR_PATH> compass watch

10. Finish

Enjoy Foundation 5. :)
Monday, November 25, 2013
Posted by Anjana Jayaweera

How to submit a form using jQuery, AJAX and PHP

We can submit a form via jQuery, AJAX and PHP from two methods.
1. Data String

Here, Im using the 1st method and it is the easiest.

// link jquery main

$(function() {

// Your Button ID

$("#submit").click(function() {
      /* field names */
      var fld1 = $("#fld1").val();
      var fld2 = $("#fld2").val();
      var fld3 = $("#fld3").attr('checked');
      var fld4 = $("fld4 :selected").val(); 

      var dataString = 'fld1=' + fld1 + '&fld2=' + fld2 + '&fld3=' + fld3 + '&fld4=' + fld4 ;
      //alert (dataString);return false;
          type: "POST",
          url: "./form-submit.php",
          data: dataString,
          success: function(html) {
             var trimmed = trim(html); 
             if(trimmed == 'success') {
                /* Do what you want to do when its success */
            } else {
                /* Error Message */
        return false; 

Here I used a very simple method to post data into PHP. Now lets look at the "form-submit" file

$fld1 = $_REQUEST['fld1'];
$fld2 = $_REQUEST['fld2'];
$fld3 = $_REQUEST['fld3'];
$fld4 = $_REQUEST['fld4'];

/* MySQL Insert commands. At the end, echo "success"; */

echo "success";

Why echo Success?
That is the command we are giving for jQuery file saying that the operation did successfully. If form-submit returned a string different than 'success', then its an error.

PS : in jQuery file, i commented "alert (dataString);return false;". You can uncomment this and see whether your dataString is correctly passing or not. coz of return "false", it will not proceed to ajax call. :)

On a later day, lets see how to achieve this via JSON. :)
Sunday, November 10, 2013
Posted by Anjana Jayaweera

Popular Post

Blogger templates


- Copyright © My Code Genius by 2 Geniuses -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -