Optimize JA T3 Framework on your Joomla website

After a long long time, I’m back again ūüėÄ

I’m give you a little trick to speed up your Joomla website and optimize its loading time.

If you are using the JoomlArt.com’s JA T3 Framework, which is really great, you might experience slow joomla website and long wainting times until something shows up!

Pages being slow are a pain for the visitors and might make them go away from your website.

I found out that if you enable the CSS and JS¬†optimise¬†options from your template’s settings page, the requests made to the¬†optimised¬†CSS and JS files are redirected multiple times which causes serious performance issues and slows down your pages! Strange huh??

 

That is because of a bug in the JAT3 base system plugin. Here is the fix:

Open the file:

<JOOMLA_ROOT>/plugins/system/jat3/head.php

Replace the “buildURL” function (from line 814 until 835) with the following:

 

    function buildURL($url)
    {
        if (JPluginHelper::isEnabled('system', 'languagefilter')) {
            $lang_codes = JLanguageHelper::getLanguages('lang_code');
            $default_lang = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
            $default_sef = $lang_codes[$default_lang]->sef;
            $app = JFactory::getApplication();
            $router = $app->getRouter();
            if ($router->getMode() == JROUTER_MODE_SEF) {
                if ($app->getCfg('sef_rewrite')) {
                    $url = JURI::base(true) . "/" .$default_sef. "/?$url";
                } else {
                    $url = JURI::base(true) . "/index.php" . "/" .$default_lang. "/?$url";
                }
            } else {
                $url = JURI::base(true) . "/index.php?lang=$default_sef&$url";
            }
        } else {
            $url = JURI::base(true) . "/index.php?$url";
        }
        return $url;
    }

 

MacBook Pro Freeze after RAM upgrade

My MacBook Pro came with 4GB of RAM, and 320GB of disk drive. The ThunderBolt technology is also available on my MacBook Pro. I decided recently to upgrade the RAM so it can run smoother with heavy softwares.

Why upgrade MacBook’s RAM?

The main reason to upgrade is that  4GB RAM is not enough on a MacBook Pro if you run a virtual machine with Windows and want to do an RAM intensive work with your Mac. With a total of 8GB RAM, the MacBook Pro runs very smooth, even when running a virtual machine with 1.5GB RAM allocated to Windows 7.

I upgraded my MacBook Pro (early 2011) RAM from 4GB with 2 new CORSAIR 4GB modules, so a total of 8GB  of RAM. I recommend you upgrade your MacBook to 8GB of RAM to enjoy a lot smoother Mac!

The built-in RAM modules from Apple’s MacBook Pro were 2 HYNIX 2GB modules so a total of 4GB RAM.

WARNING: The tests and procedures in this article are for informative purposes only. Gibni.com and its authors take absolutely no responsibility for the damages, errors and troubles you may cause to your devices. Use at your own risk.

RAM issue or not?

Until now, it happened 3 times:

While using my Mac, the screen froze and horizontal lines appeared on the screen. The only way out is to “hard shutdown” the mac by holding down the power button for 7 seconds. From my IT experience, this relates some times to the Graphical Procession Unit (GPU) and some times to the RAM. So either the Graphics card is buggy or the new CORSAIR RAM modules.

Solving : Mac freeze, horizontal lines…

RAM stress test for Mac:

To test the RAM on the Mac, you should run some stress tests to find if any errors lay in the RAM. Sometimes the RAM behaves good in normal conditions but may throw errors on heavy computation. It is recommended to stress the RAM specially if it is new. One of the best tools is MemTest.

Here’s how to use MemTest on Mac:

( I recommend using MemTest on Single User mode to be able to test more memory as in Single User mode the system occupies very few RAM.)

  1. Restart your Mac and hold “Command + S” to go in Single User mode,
  2. A black screen appears with lots of text and after a few moments you will get a prompt,
  3. Type in : memtest all 4
  4. Wait about 1 hour! Remove the 3 to make it just about 20 minutes, but less reliable…
  5. If everything gets passed, your RAM is probably OK
  6. Else, proceed:
  7. The first thing to do is to put back the own Apple’s RAM and run the stress tests again to see if the issue happens or not.

If the new CORSAIR RAM modules are having errors, I should find out which one is messy. I put only one CORSAIR 4GB RAM on the Mac, leaving the other RAM slot empty. Once I find which one is damaged, I will send it back to where I bought it from (RueDuCommerce.com), so they can change it for me.

CPU and GPU stress test for Mac:

If the problem is not with the RAM, it is probably with the GPU, or the way the GPU deals with the RAM (as it shares the system’s RAM)

Start your Mac normally, and use “smallLux GPU” (a tool I used and recommend it) to stress the GPU:

  1. Download SmallLuxGPU
  2. Install and run it
  3. On the top left side, in the interactive modes section, Select “Instances 130Mil Scene”
  4. Set the resolution to the maximum available,
  5. Select GPU + 4 CPU threads
  6. Hit “Run Interactive Mode”
  7. Wait…

Your Mac will run and run and will heat up. If everything goes fine for about 20 minutes, your GPU is OK, else if you get errors, freeze or horizontal/vertical lines on screen, there is an issue either with your GPU or the way it handles its memory.

If your GPU passes the tests above, BUT you still have freeze/horizontal or vertical lines issues, then the problem might be software or something very complicated which is not in the scope of this article. You should call an Apple Authorized Repair expert in your area.

In case you have an issue with the GPU, RAM, CPU or any hardware on your Mac, call an Apple specialist as soon as possible. Don’t try to open up you Mac because there is nothing you can do.

Some tools for your Mac:

Mac RAM Stress test:

Memory Tester from diglloydTools

MemTest for Mac

Mac CPU stress test:

Simple Terminal: open up 8 terminal windws and enter (no quotes) ‘yes > /dev/null’

MySQL stress Test on Mac

Stress CPU from Folding@Home

CPU / GPU stress test:

SmallLuxGPU

CPU, RAM, Hard drive,… Temperature Monitor for Mac:

TemperatureMonitor

Fan speed Control for Mac:

smcFanControl

SOLVED : Can't update to Joomla 1.7?

To Joomla 1.7…

If you are running a Joomla! website, you’ve already heard about the Joomla 1.7 upgrade. It’s recommended to upgrade to this version specially if you run Joomla 1.6.

 

Basic steps to update/upgrade to Joomla 1.7:

 

In some situtations, you might have trouble upgrading Joomla with the built-in “Joomla Updater”.

Joomla 1.7 Upgrade errors:

  • “Update: :Collection: Could not open http://update.joomla.org/core/list.xml”

    To solve this errror, you need to “allow fopen” on your server:

    1. Create a php.ini file in your Joomla site’s root. This file should contain the following line:
         
      allow_url_fopen = on
    2. Make sure that the file is having the 644 permissions at least.
    3. Check if fopen is allowed by running a simple php file inside your Joomla root directory containing the following line:
      <?php phpinfo(); ?>

      and look for “allow_url_fopen”, it should say “ON”

    To upgrade to Joomla 1.7 on a Godaddy hosting running PHP5, you should create a “php5.ini” instead of the php.ini stated above.

  • Joomla updates do not appear, and Joomla says there is no upgrade available at the moment?

    If you run Joomla 1.6.x,

    1. Go to the “Extension Manager”, hit the “Manage” tab, click the “Refresh Cache” button.
    2. Go back to “Update” tab, click “Purge Cache”
    3. Click on the “Find updates” button,
    4. Joomla should appear as an update option, check it and click the “Update” button.
  • Fatal error: Cannot instantiate abstract class¬†JDatabaseQuery in mysite/plugins/system/jat3/jat3/core/joomla/modulehelper.php on line 292

    When you run a JoomlaArt template, as of today, you will get an error after upgrading to Joomla 1.7.

    As the error message says it, the error is on line 292 of the above file. With your FTP client, or web file manager, navigate to the file mentioned above and edit the file.

    On line 292, comment out this:

    $query = new JDatabaseQuery;

    and insert this line below it:

    $query = $db->getQuery(true);

    so the final result at lines 292 and 293 looks like this:

    //$query = new JDatabaseQuery;
    $query = $db->getQuery(true);
  • Fatal error: Cannot instantiate abstract class¬†JDatabaseQuery in mysite/plugins/system/jat3/jat3/core/menu/base.class.php on line 329

    If you use the mega menu of JoomlaArt, you need to do the same proccess for the file base.class.php

    That is, the lines 329 and 330 should be as follows:

    //$query = new JDatabaseQuery;$query = $db->getQuery(true);

Can't login after OS X Lion install/upgrade : SOLVED

After installing the latest upgrade for Mac OS X, the Lion, I couldn’t ¬†login to my user account on my Macbook Pro! There was no way to log into my user. I tried to login with “root” and the root account was not available.

Basically, ¬†all users disappear after install of Mac OS X Lion or upgrade to Lion (10.7), and you can’t login to your system.

After a little research, here is what worked for me:

Before giving you the solution, you should know that the first thing to do, is to call Apple’s customer service, and I take no responsibility for what ever might happen if you follow these instructions. They worked for my case, use at your own risk.¬†

 

 

Solution for Mac OS X Lion Login Error (Users disappear after upgrade to Lion):

  • Step 0 : Don’t panic, your files are not gone !¬†¬†

  • Step 1: Reset ROOT Password for Mac OS X Lion:

      1. Restart your Mac,
      2. Hold “Command+R” buttons just the moment your Mac starts up,
      3. Hold still…
      4. A window should appear, it says “Utilities…”
      5. From the tools menu, at the top, open “Terminal”
      6. Type “resetpassword” and hit enter
      7. A new window opens, select the System Administrator account (root) option
      8. Set a new password, easy to remember for you,
      9. Confirm and close all the windows,
      10. A question will appear as would you like to restart?
      11. Restart!
  • Step 2: Login as ROOT on Mac OS X Lion:¬†

      1. Let the Mac startup,
      2. At login screen, type the user ¬†name as “root” and put in the password you’ve chosen in step 1.8 above.
      3. Wait a while…
      4. You should be logged in with the “root” account to your Mac OS X Lion.
  • Step 3: Re-create your user (Reincarnation!)

      1. Right click on the “Finder” icon in the dock, select “Go to folder…”
      2. Type “/” and click on “GO” to go to your Mac’s hard drive,
      3. Navigate to the “Users” directory, you should¬†see your own user folder, remember the folder’s name!
      4. Click the Apple logo on the left top side of the screen, select “System Preferences…”
      5. Go to “Users and Groups”
      6. Your user should not exist in the left side list, so click the small “+” button below the users list to add a new one.
      7. Set your Full name as it was previously (not very important though)
      8. Set the “Account name” ¬†EXACTLY AS THE FOLDER NAME YOU SAW IN STEP3.3 (VERY IMPORTANT)
      9. Set an easy to remember password for your account,
      10. And hit “Create User”
      11. Confirm on “using the Existing folder for Home…”
      12. Wait….until you see your user appear on the users list…
  • Step 4: Back on the Road:

      1. Restart your Mac
      2. Login to your own account easily and get all your data back!
  • Step 5: Send me a coffee from the Donations Page.

Add a Google +1 button to your PrestaShop store for Free!

Today I’m going to give you some great news.

 

Online stores, e-commerce software…

More than 50 thousand online stores run on PrestaShop, an online e-commerce software. There are lots of advantages using this software, e.g. it’s open source, it’s got a huge community of developers and users, lots of modules and themes are being added to it regularly…

 

PrestaShop’s Drawback

But the main drawback of PrestaShop is that most of its modules are not free and to run a decent business you gonna spend a lot of money over the modules. Well, I would recommend to buy the modules you need without hesitation, because it is an investment in your business, but I know that you are looking for the Free ones at first.

 

Google +1

You’ve certainly heard of the “+1” button from Google, and it would be nice to add it to your shop so that your users can recommend your products on Google.

There are modules on the PrestaShop’s market to allow you putting a “Google +1” button to you store, and they are priced at around 40‚ā¨ (about 50USD).

 

Free Google +1 for PrestaShop

oGooglePlusOne module Logo

The great news is that odience.net offers a “Google +1” button for PrestaShop, completely FREE! and that saves you about 50USD!

 

As you know, you can donate to thank the developer ūüėČ

 

I got a copy of the oGooglePlusOne module from odience.net and tested it on one of my e-commerce websites. It is complete and integrates itself automatically! Go to odience.net and grab yourself a Free copy of oGooglePlusOne for Prestashop!

 

Don’t forget to say Thank You and send a donation if you think it’s worth it.

Embed Images in PHPMailer

I’ll keep this one short and fast:

PHPMailer has lots of features, even if it’s a bit old.

One great feature is that it allows you to embed images inline within your e-mail’s body. In most email clients, the inline embedded images are shown in their right place just as on a web page and are “also” in the attachements list.

To be able to use this feature, proceed as follows:

1- Instantiate PHPMailer:



$mail = new PHPMailer(true);

$mail->CharSet='UTF-8';

...

...

//Path to image file (use full path)

$filepath= '/path/to/file/logo_mail.jpg';

//File token ID, use unique interger.

$filecid = 1001;

//File name which will be in the mail, overrides default filename.

$filename= 'shop-logo.jpg';

//Encoding

$encodingtouse = 'base64';

//File type MIME

$filemime = 'image/jpeg';

//EMBED IT

$mail->AddEmbeddedImage($filepath, $filecid, $filename, $encoding, $filemime);

//Message Html Body

$mail->MsgHTML(file_get_contents('/path/to/contents.html'));

2- In your /path/to/contents.html file, which is your mail template message, you can include the inline image. Use this syntax for the <img> tag:

<img src=”cid:1001” alt=”shop logo used in emails” width=”182″ height=”75″ />

Note the CID here, it should be the same as the one you defined for your embedded inline image.

Tested and working with PHPMailer 5.1 on GMAIL, Yahoo!Mail and Mac Mail application

 

ref: http://www.sitepoint.com/forums/php-34/embed-images-phpmailer-586789.html

[SOLVED] Could not instantiate mail function in PHPMailer

(This article has an advanced technical level, written for people with PhpMailer experience.)

PHPMailer 5.1 in PrestaShop 1.4

Trying to integrate PHPMailer in Prestashop and use it instead of SWIFT Mailer 3 (which is the default mailer script included with Prestashop 1.4), I spent hours to no avail and was getting the Could not instantiate mail function error.

mail() function

The mail() function by itself ¬†was working correctly before and after loading Prestashop and every passed argument seemed to be correct. I did get the “Bad parameters to mail() function, mail not sent” error for mail() too.

Debugging and Abracadabra!

I’ve done lots of debugging and found in my case that the following functions were causing the error, when passing the $Subject parameter to mail():

SecureHeader();
EncodeHeader();

To solve the “Could not instantiate mail function” error in PHPMailer, I removed the above 2 functions from the mail() function arguments.

Just be careful to remove these functions correctly from all places in your class.phpmailer.php.

I recommend using the PHP function

mb_encode_mimeheader()

http://php.net/manual/en/function.mb-encode-mimeheader.php

because it encodes your stuff correctly for the headers in emails.

To be more clear,

1- open the PHPMAILER class file (class.phpmailer.php)

2- Locate:

protected function MailSend($header, $body)

function and in its body,

3- In every call to mail(),

replace this:

@mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);

by this:

@mail($val, mb_encode_mimeheader($this->Subject,$this->CharSet, 'B', ''), $body, $header, $params);

 

This way you are sure to correctly encode your subjet.

Remember to set the correct Charset for your PHPMAILER instance. That is, when calling PHPMailer, just after:

$mail=new PHPMailer(true);

add:

$mail->CharSet = 'UTF-8';

(or any other charset you need).

This solved my “Could not instantiate mail() function in PHPMailer issue. I hope it helps you out if you got this issue too.

Evenmore:

I’ll write more about PHPMailer and PrestaShop later,

In my next post, learn how to correctly include inline images in PHPMailer email to display in GMAIL, YAHOO, Mac Mail app and other email clients correctly as inline images.

Bug Prestashop, la liste des magasins n'apparait pas

Cette article est sponsorisé par odience.net¦works

En plein developpement

En plein¬†d√©veloppement¬†de plusieurs modules PrestaShop, j’ai rencontrer plusieurs souci dans les code du package PrestaShop. Ce qui¬†m’√©tonne, c’est qu’il y a beaucoup de gens qui utilise PrestaShop, m√™me si c’est du gros n’importe quoi en terme de codage et programmation.

 

Alors pourquoi je créer des module?

Tout simplement parcequ’il y a de la demande.

(Restez connecté pour avoir des nouvelles de mes modules:

Ces modules sont créer pour odience.net et seront sont disponible sur odience.net)

Retour à nos moutons

Je vous explique un bug que j’ai trouver aujourd’hui et la solution.

Le problème est ceci:

La variable SMARTY qu’utilise PrestaShop pour stocker les informations des magasin est nom√©e “$stores”. On peut y acceder et donc afficher les details de nos magasin un peu partout dans les pages et les modules sans diriger le visiteur sur la page de “nos-magasin”.Module Contact PrestaShop avec formulaire de contact et carte google maps

Quand vous changez la configuration de l’affichage simplifi√© dans le Back Office, la variable $stores devient VIDE partout sur votre boutique. Donc vous ne pouvez plus afficher les details comme un num√©ro t√©l√©phone ou une photo tir√© directement de la variable $stores.

Ceci est du au faite que une fois la configuration dans le Back Office modifié, PrestaShop relance une requete vers la base de donnée pour recréer $stores, mais cette fois il relance la requete en cherchant a calculer un distance! Donc la variable $stores reste vide.

Essayez d’ouvrir votre boutique en ligne en ajoutant “?all=1” √† la fin de votre URL et vous verrez que la variable $stores fonctionne correctement et affiche bien les infos de vos magasins.

Remède, Solution

Le remède a ceci est de modifier le fichier

PSdir ->controllers -> StoresController.php

qui gère la variable $stores.

 

Au environs de la ligne 73, on ajoute une nouvelle requete SQL qui remplit la variable $stores avec la liste de tous nos magasins, et une deuxième requete SQL qui servira a calculer la distance en cas de recherche.

$stores = Db::getInstance()->ExecuteS(' SELECT s.*, cl.name country, st.iso_code state FROM '._DB_PREFIX_.'store s LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country) LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state) WHERE s.active = 1 AND cl.id_lang = '.(int)($cookie->id_lang)); $results = Db::getInstance()->ExecuteS(' SELECT s.*, cl.name country, st.iso_code state, ('.(int)($multiplicator).' * acos(cos(radians('.(float)(Tools::getValue('latitude')).')) * cos(radians(latitude)) * cos(radians(longitude) - radians('.(float)(Tools::getValue('longitude')).')) + sin(radians('.(float)(Tools::getValue('latitude')).')) * sin(radians(latitude)))) distance, cl.id_country id_country FROM '._DB_PREFIX_.'store s LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country) LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state) WHERE s.active = 1 AND cl.id_lang = '.(int)($cookie->id_lang).' HAVING distance < '.(int)($distance).' ORDER BY distance ASC LIMIT 0,20');

A savoir que la variable $results sera vide si il n’y a pas de demande de recherche de distance et donc StoresController.php ne gen√®rera pas de fichier XML servant a la mise en place d’une carte Google Maps dans le Store Locator. Pour assurer que le fichier XML sera cr√©er seulement si $results contient quelque chose, je fait une verification avec:

if (!empty($results))

Téléchargez, tout simplement

Vous pouvez télécharger la version corrigée de ce fichier dans la page téléchargement de Gibni.com (nom du fichier: StoresController-1.4.Amir.zip)

 

Pour l’utiliser,

1- Allez dans:

DossierPrestaShop/controllers/

2- Renommez votre present fichier StoresController.php en StoresController.php.bak,

3- Placez le fichier php que vous avez télécharger et décompresser dans le même dossier.

 

Maintenant la variable $stores est de nouveau accessible, quelconque la configuration dans le Back Office de PrestaShop.

Je souhaite un grand succ√®s √† la communaut√© PrestaShop et j’esp√®re qu’un jour ils¬†auront¬†du code¬†concrete, correcte, scientifiquement √©tudi√© et structur√©.


Cette article est sponsorisé par odience.net¦works

HTC HD2 broken screen

Last Sunday, just in front of my car, my few months old HTC HD2, fell, bounced and hit the ground by its face and the digitizer (the glass on the screen, not the LED display) broke!

That’s very unlucky, but sh*t happens! I’m writing this post to first of all let you know how great is the HD2, and secondly, how to replace the HTC HD2 screen. I’ll put a video tutorial and some photos if I repair my HD2.

First of all, call your local HTC Repair and ask them their price for the repair.

If it’s more than $150, then you may want to do it yourself.

If you want to replace the HTC HD2 LED and/or Digitizer (Touch Pad) screen, then continue reading…

Buy a combo of the digitizer (Touch pad) and LED Display, pre-assembled.

I’ve read a lot about people braking the LED display while trying to replace the digitizer, so as I will do, I suggest you to replace the whole set, which is the LED display and the digitizer.

Look for the authentic, original, OEM HTC part only. The regular price is somewhere around $100.

Disassembling the HTC HD2 is quite tricky. You should be very careful, have the right tools and be patient.

Check this official HTC HD2 Disassembly Video Tutorial

Once you’ve removed the broken screen, replace it with your new one, and follow this video to assemble the HTC HD2


Official HTC HD2 Assembly video tutorial:

http://www.youtube.com/watch?v=t8Q7mXdcJ5

It looks quite easy, but you should know that you can BRICK your phone VERY EASILY.

I take no responsibility for any damage or issue caused to your device.


Here are some more photos of my HTC HD2 broken screen:

This post is under revision and will get updated. Stay tuned.

Search on your favorite search engine for more info on replacing HTC HD2 Screen.