home | contact us
» » June


So, if you’ve ever had the situation where the only backup of a magento database has been done through phpmyadmin (hint: don’t do this, use the inbuilt backup tool or lightbackup magento extension), you need to set up some magic at the top and bottom of the dump files :-

Add the following at the top :-
SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT;
SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS;
SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION;
SET NAMES utf8;
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0;

and the following at the bottom :
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT;
SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS;
SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION;
SET SQL_NOTES=@OLD_SQL_NOTES;

This can also be done if you use some other backup systems (we’ve seen a table-per-file system too), in that instance, we created 00-head.sql and zz-foot.sql containing the above and create a single backup with ‘cat *.sql all.sql’ before restoring.


 

If you have issues with netbeans and xdebug not connecting on recent distros, you might find that netbeans is listening on tcp6 and xdebug connecting on plain tcp.

To check if this is the case, run the following command whilst netbeans is “waiting for connection” (change 9000 if you’ve set a different port) :-

netstat -aln | grep 9000

if you get a line similar to the following (specifically tcp6 and not just tcp), it may well be that xdebug can’t connect over ipv6 :-
tcp6 0 0 :::9000 :::* LISTEN

One solution is to disable ipv6, which can be done by creating the file /etc/sysctl.d/10-disable-ipv6.conf with the following contents :-
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1

then run (as root or sudo)
sysctl -p /etc/sysctl.d/10-disable-ipv6.conf
and restart netbeans. Suddenly, netbeans will listen on tcp (ipv4) and xdebug will connect.


 

Just came across this interesting site:

https://www.onx.ms/#recipesPage

It seems to be a very nice system for really customising your Android experience.


 

If you are using a Java application on your nice new Linux Mint desktop and are wondering why its so damn ugly, this might be your solution.

It looks like there is an issue with Java detecting your standard system style, fonts etc so it reverts to something pretty hideous.

One easy solution to at least get it looking alright (and also fixing a bug with menus and maximisation) is to set your netbeans conf to the following.

Simply go to your netbeans folder and look for an etc folder.

Inside there is a file called netbeans.conf

Back that up (rename to netbeans.conf.backup) and create a new file called netbeans.conf

Then paste this in:


# ${HOME} will be replaced by JVM user.home system property
netbeans_default_userdir="${HOME}/.netbeans/7.1.2"

# Options used by NetBeans launcher by default, can be overridden by explicit
# command line switches:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true"

#trying to fix teh UGLY
netbeans_default_options="${netbeans_default_options} --laf Nimbus -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd"

# Note that default -Xmx and -XX:MaxPermSize are selected for you automatically.
# You can find these values in var/log/messages.log file in your userdir.
# The automatically selected value can be overridden by specifying -J-Xmx or
# -J-XX:MaxPermSize= here or on the command line.

# If you specify the heap size (-Xmx) explicitly, you may also want to enable
# Concurrent Mark & Sweep garbage collector. In such case add the following
# options to the netbeans_default_options:
# -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled
# (see http://wiki.netbeans.org/FaqGCPauses)

# Default location of JDK, can be overridden by using --jdkhome <dir>:
netbeans_jdkhome="/opt/java/64/jre1.7.0_04"

# Additional module clusters, using ${path.separator} (';' on Windows or ':' on Unix):
#netbeans_extraclusters="/absolute/path/to/cluster1:/absolute/path/to/cluster2"

# If you have some problems with detect of proxy settings, you may want to enable
# detect the proxy settings provided by JDK5 or higher.
# In such case add -J-Djava.net.useSystemProxies=true to the netbeans_default_options.

 

If you need to know what number a mouse button is (for example if you are configuring compiz) in Linux then you might like this little trick.

xev | grep button

Run the above in a terminal and it will display a white box. As you click on it, the button number will appear in your terminal.

The pipe to grep is to filter out the large amount of noise from xev and only display the button number notifications.


 

If you are struggling to figure out why a perfectly good jQuery plugin that works elsewhere is not loading into jQuery for a particular page, this may well be your solution.

This behaviour will happen if something reloads jQuery elsewhere on your page, below the script tag that calls the plugin.

If this happens, jQuery is effectively reloaded and has lost all the extensions you have made to it.

The solution of course is to simply remove the extra jQuery loads. If that is not very easy to do, you can at least try to modify it so that it won’t reload it if it already exists:

<script type="text/javascript">
    if (typeof jQuery == 'undefined') {
        var script     = document.createElement('script');
        script.setAttribute("type","text/javascript");
        script.src = "jquery-latest.pack.js";
        var head = document.getElementsByTagName('head')[0],
        done = false;

        // Attach handlers for all browsers
        script.onload = script.onreadystatechange = function() {
            if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
                done = true;
                // callback function provided as param
                onload_stuff();
                script.onload = script.onreadystatechange = null;
            };
        };
        head.appendChild(script);
    }else{
        onload_stuff();
    }
    onload_stuff = function(){
         // your onload stuff goes here
    }
</script>

 

Thinking of being able to set different Magento Categories to display its sub-categories which can be controllable in the Magento admin i.e.

from        to this;    

You might be interested in using or viewing the zipped file here;subcat


 
rss icon