When developing for Magento, there are two ways to modify code provided by other modules - doing rewrites and observing events. If appropriate event is available for observing, it is preferred to use second method to alter other module's behavior. More precisely it is preferred to observe event of your interest, and when this event occurs, to trigger execution of your own code. But how are you supposed to know the list of events that are available for observing on your Magento installation? If you're interested to find out answer to this question, take the red pill, and I'll show you how deep the rabbit-hole goes.
Continue readingTag Archives: Bash
Udev rule to run a script after plugging in USB device on Ubuntu Linux operating system
For my video chat sessions I use my Logitech E3500 USB web cam. On my Linux box this hardware device sort of works fine, but it does have it's own set of quirks I've developed workarounds for over the years. One of the things that bug me is that even though you can change it's configuration options trough GUI or CLI, this hardware device has it's defaults, and these defaults are back every time you plug it in. In this article I'll show you how to create script that changes web cam settings using CLI tools I've explained in one of my earlier articles, and how to make this script being executed every time web cam is plugged in.
Continue readingLatest Oracle (Sun) Java JDK and JRE 6 on Ubuntu operating systems
Lets be honest, coding on Linux will probably include some Java based application like Eclipse or NetBeans. That's actually not a bad thing because we get to carry our development environment with us when using other proprietary operating systems. But since Oracle sliced "Operating System Distributor License for Java" and now nobody can legally host Java repository we have to install Java manually by downloading their JRE or JDK blob from Oracle servers. That isn't exactly hard thing to do but we don't want to give Oracle the pleasure of knowing that they made our already crowded day a little more complicated. So here I'm presenting work of excellent Debian packaging work by Janusz Dziemidowicz and a fellow open source enthusiast Martin Wimpress from Flexion.Org. These guys made it possible for us to create Java JDK 6 and JRE 6 deb packages and create local Java repository our selves.
Continue readingUbuntu / Debian environment variables and starting scripts at boot
Environment variables are very important aspect of Linux based operating systems. They are used by system to adjust its own behavior according to what you have specified during operating system installation and after that you can use it to tweak you system even more. Environment variables take form of name=value and you can view list of current environment variables by issuing following command on your favorite Linux terminal:
printenv |
Some environment variables are set by the root user for all users on one PC, but every one of those users can have its own environment variables. Now lets see how should we assign lets say "en_US.UTF-8" value to environment variable named "LC_ALL" (by the way this is the way to tweak you environment locale setting for things like time and date format and things like that). Typically you will assign environment variable like this:
export LC_ALL=en_US.UTF-8 |
Start shell script on Network Manager successful connection
The other day I was writing a script that needed to do its job only when specific network interface is triggered (wireless broadband ppp0 in my case). Pinging Google every 10 seconds to detect Internet access was out of the question. There is a more elegant way to do this. If you are interested please proceed.
Do you know that authors of Network Manager built option to trigger scripts right into this great application. To use this option you need to write bash script with some specific bash variables and put it to "/etc/NetworkManager/dispatcher.d/" directory. Specific variables are necessary to receive instructions from Network Manager about network interface that triggers execution of your script and should it be executed on "up" or "down" operation on that interface.
Continue reading