Bulk Upload Categories to Magento

One of those pain points in Magento is bulk uploading Categories. I know there’s this solution and also this bulk category solution, which are both basically the same thing. I actually feel more comfortable using Python and it also means that I don’t have to install Zend on my local machine to access the remote API.

One struggle I did get stuck on is the “Access Denied” message when connecting. A lot of people are having issues with it. My issue was that I had used the same username for my API access as I use to login to the admin in my testing. As soon as I changed from that, I overcame that issue.

Anyway, I stumbled across this Python Magento library and saw it had a number of useful functions already in it. So I decided to hack away and add to it.

So far, I have added a function to retrieve the list of categories and write them to a file from the catelog_category.tree api call and finally, as per my original intention, write a function to bulk upload categories from a CSV file.

I’ve never contributed code to a project before so if I get these changes in, it’s my first public contribution.. until that happens, you can hit me up for the code and a sample CSV file.

I might add: Python xmlrpc is beautiful to work with and gives a great deal of flexibility for building a gui on top of this. Working with the Magento API was nice also.

Bigpond NextG ZTE-MF633 modem with Ubuntu 9.10

There’s some instructions on ZTE forums on how to get this modem working and it *does work* but it’s convoluted.

I just created a file called /etc/modprobe.d/zte-mf633.conf

and added the following to it:

options usbserial vendor=0x19d2 product=0x0031

and then reboot with the modem in to test it works on a fresh boot. If you insert the modem *after* you have booted, you may have to unmount/eject the cdrom that it is detect as prior to it being detect in connection manager. The above may also interrupt with other usb devices, though my storage key still works and it’s all I need for now.

Then it will display as a 3G card and you can use the network wizard to configure it.

Two things to note.
1. You have to “register/signup” using a Windows computer – which I had a lot of problems with and had to end up doing it in store
2. I forget now, but it seemed noteworthy.

USB Redirection for Remote Desktop & Virtual Desktop Implementation

No it’s not open source but it is available for both Linux and Windows.

IncentivesPro make a product I recently used for a Virtual Desktop Thin Client Implementation. That is USB Redirection for Remote Desktop. It uses a proprietary client/server and so I used Windows XP embedded thin clients to redirect specialised USB Thermal Laser Printers to the Vista Virtual Machines. The website looks a bit underwhelming but the product is flawless and it’s priced much better than their competitors. If you have more time than I did, it’s likely you can get the Linux client working with Thinstation

For the other desktops, I used 2x’s Thin Client Server that use PXE (or USB / CDRom) to boot the original desktops over the network, essentially converting the original desktops into diskless thin clients. It’s a shame you can’t build your own images or add your own software to 2x’s desktop as I really didn’t like having to implement the Windows XP embedded thin clients.

As it’s a small environment, we are using VMWare Vsphere 4.0 free version. I was aiming to use Xenserver 5.5 but it doesn’t natively support Tape Drive passthrough to the client and I wanted to easily accomplish this without kernel rebuilds, as it is possible to achieve this with Xen by recompiling the kernel with ISCSI support and making the Tape Drive an ISCSI target.

Some other useful software was SplitView, allowing the accountant to use Dual Monitors. RDP  5.2 only allows to use the mstsc.exe /span option which spans the monitor across two screens. Splitview allows you to manage those windows as individual desktops. The only issue I had was with Adobe Reader 9.2, I had to add it to the exceptions list in Splitview otherwise it would crash.

Technorati Tags: , , , , ,

Using mod_rewrite for moving websites, folder and domain names for SEO retention

mod_rewrite is a powerful Apache module that gives you the power over the URL’s displayed to your visitors to your site.

Much has been written already by many people using both examples and tutorials of the basics. The aim of my addition, as always is primarily for my own notes and secondarily to explain why you want to use mod_rewrite for SEO ranking retention.

Let’s say you have a website that enjoys well ranked pages and a lot of traffic via google or has a great deal of Backlinks from other blogs or websites to particular pages in your site. One of the powerful aspects of Google Webmaster Tools is that it easily provides you a way to be able to view which URL’s are linking particular pages on your own website. When contemplating moving a website or rearranging the structure of an existing website, one of your first considerations should be to maintain the availability of accessing your new pages via your old links. Essentially we map your current (old) structure to your new (proposed) structure.

Here’s our first sample. The old url was http://www.domain.com.au/mstore/2wsub1 and our new URL includes keyword rich content: http://www.domain.com.au/htc-hero-android-brown. We use the following mapping:

     RewriteRule ^mstore/2wsub1(.*)$ http://www.domain.com.au/htc-hero-android-brown   [R=301,NC,L]

The above means: Any content being requested at /mstore/2wsub1 or /mstore/2wsub1.html or /mstore/2wsub1.asp etc. will be redirected to http://www.domain.com.au/htc-hero-android-brown. The redirect additionally offers the following further information about the redirect.[R=301,NC,L] tells the requester that it is a permanent redirect (R=301 – Permanent Redirect) and that the requested URL match is case-insensitive (NC – no-case) and that if it finds a match, then redirect and do not attempt any further matches [L – Last match]

After migrating a website, I advise to monitor both Google Webmaster Tools and also your server site statistics / logs for 404 Errors, so you can correct any URL’s you hadn’t originally mapped.

Migrating domain names & ensuring a single accessible URL

In this scenario, we are moving http://www.olddomain.com.au/ to http://www.coolnewdomain.com.au/ because your audience are Mac users and like anything with the title “cool” in it ;). As an aside, we want to ensure that people are always directed to http://www.coolnewdomain.com.au if they type in http://coolnewdomain.com.au and search engines only index the www version so that you do not have duplicate content listed.

        RewriteCond %{HTTP_HOST} !^www\.coolnewdomain\.com\.au$
        RewriteRule (.*)       http://www.coolnewdomain.com.au/$1 [R=301,NC]

The above means: If you have NOT accessed the website using http://www.coolnewdomain.org.au then redirect you to http://www.coolnewdomain.org.au . The $1 value is the ‘first variable’. What it means is that if you access: http://olddomain.com.au/cool-product will be redirected to http://www.coolnewdomain.com.au/cool-new-product. Everything after the domain name is used as a variable to attach to the end of the new domain name. Even if you have not migrated domain names it is still wise to use this code on your existing site so that search engines only search one ‘form’ of your domain name. One last thing to note here, is that we don’t use the [L] flag, allowing mod_rewrite to continue looking for matches, as there’s still a chance it could find a match for url’s like our first example.

Using mod_rewrite for blocking access to a website as an alternative to Basic Authentication

Real life usage scenario. Some developers I know created a development website similar to http://dev.coolnewsite.com.au/ that was accessible publicly without authentication. They assumed as they hadn’t advertised it, nobody knew about it but just prior to going live, google ‘found’ the site and indexed it. When the real site went live, anytime they were searching in google for the site or for products, the http://dev.coolnewsite.com.au/ was being displayed. They wanted to block access to the dev site but they didn’t want to lose the fact that they already had some visitors and page rank on the dev site. I tried to use a mod_rewrite rule as above before the Authentication rule but the auth rule takes effect before the rewrite rule,so visitors were being asked to authenticate and not being redirected, additionally this wouldn’t have told google about the new, actual live site. So here’s what I did:

 RewriteCond %{REMOTE_ADDR} !^213\.206\.175\.212$
 RewriteCond %{REMOTE_ADDR} !^124\.231\.17\.180$
 RewriteCond %{REMOTE_ADDR} !^123\.168\.239\.32$
 RewriteRule ^(.*)$ http://www.coolnewdomain.com.au/$1 [R=301,L]

ps: fictitous IP addresses provided ;)
The above means:
If your IP address is NOT (dev A) or (dev B) or (Customer) then redirect the visitor to http://www.coolnewdomain.com.au/ with a permanent redirect [R=301] and make it the last matching rule [L].

This means search engines will know about the real, live site next time they come to visit, anyone searching for the site finding the dev site will be redirected to the equivalent URL on the live site but the developers and customer can still access the dev site from the three different locations. The obvious downside to the above code is that if you are not using a static IP address, you will need to update the addresses each time your IP changes. We will add authentication as our live site begins to take rankings above the dev site.

Technorati Tags: , , ,

An Open Source PDF Editor for Windows, Mac & Linux

I have previous written about PDF Editors for Windows and Linux here and here, so this is, in effect Part 3.

I have used OpenOffice PDF Import Extension, PDFEdit and numerous other tools listed in my first posts but nothing works as well as the latest Inkscape. It has one downside though, right now. That is, you can only edit one page at a time.

So here’s a random PDF I found by googling for random PDF ;). Here’s a shot of the first page in my PDF Viewer (evince).

Now we open Inkscape click File -> Open and you will see the following dialogue box where we can choose which page to import.

Now you can see that the page imported perfectly into Inkscape and objects are editable.

and finally, here’s our slightly edited, more up-to-date version.

A few other tips.

Inkscape won’t import encrypted PDF’s. To get around this you can use pdftops .pdf which turns the PDF into a Postscript file. You can then use ps2pdf .ps to return the file back into an unencrypted pdf.

On Linux, you can print to PDF automatically. On Windows, you will want to have installed a PDF Printer, like PDFCreator and on Mac OSX, read this tutorial about setting up a free PDF printer.

If you need to merge multiple PDF’s into a single PDF, there is a nice tool called PDFtk that can do that for you which is available for Windows, MacOSX and Linux.

Technorati Tags: , , , , , , ,

Interesting OSS links: Skype for Asterix / Wavemaker / AccountLabPlus

Haven’t had much time to go into detail with these but I think it’s worthy to take note of them

Skype for Asterisk has been released at last.
Skype for Asterisk
A new Skype for Linux Beta 2.1.047 has been released which fixes CPU problems with new PulseAudio and works brilliantly and also adds SMS support.

Also, I came across a very Rapid Application framework for building Ajax web apps called Wavemaker. They have an open source version and an Enterprise Version. Watch one of the videos where he builds a searchable client database in 10 minutes while explaining concepts.

Also, an announcement from Netenberg, the people who make Fantastico for Cpanel have announced that they will be open sourcing their AccountLab Plus application in Jan 2010.

Technorati Tags: , , , , ,

Netboot.me – boot Linux systems directly from Internet

netboot.me is a service that allows you to boot nearly any operating system or utility on any computer with a wired internet connection – without having to know ahead of time what you’ll want to boot.

netboot.me works through the magic of netbooting over http. There are a number of ways to boot a computer with netboot.me. The simplest is to download a bootable image, which is 626Kb and burn it to a CD or put it on a USB memory stick, or floppy disk. Boot off it on any networked computer, and it will automatically fetch the latest boot options from netboot.me and let you choose from dozens of installation, recovery, testing, portable desktop and other tools. You can also start netboot.me from any computer running gPXE, or from any netbootable computer with some simple tweaks to your DHCP server.

Here’s a screenshot:

I just tested it and it works beautifully. It seems to update it’s menu system from it’s website each time it boots, so it’s always fresh. Currently in the menu, the following are available:

FreeBSD 7.2 (x86 or amd64)
Debian Lenny (5.0)
Debian Testing (x86 / amd64)
Fedora 11(x86/amd64)
OpenSUSE 11.1 (x86/amd64)
Ubuntu Jaunty & Karmic (x86/amd64)
Live  Linux
Tiny Core Linux 2.2
Micro Core Linux 2.2
Diagnostics -> (Memtest86 & 86+, HDT 0.3.4)
Disk Tools -> (Gparted LIve 0.4.5-2, Parted Magic 4.4)
Rescue -> (Ubuntu Jaunty / Karmic in rescue mode)

Anyway, I grabbed Micro Core and on my 1024kbps connection, it was booting in about 30 seconds and I had a runnning linux distribution.

Technorati Tags: , , , ,

Yakuake for Gnome

I have previously written about Tilda, a gnome replacement for Yakuake. I had some issues with Tilda so I came to have a nice relationship with Yakauke. It’s important to note though, that there is another reasonable alternative to both Tilda and Yakuake and it’s called Guake.

Guake has some of the basic features of Yakuake but is still lacking in a few things. The main ones for me are:

  • Yakauke allows you to choose terminal width / Guake takes up fullscreen width. The advantage of this for me is that I can sit Yakuake on the right side of the page and read a web page as a reference if I am programming in vim or copying instructions for something.
  • Yakuake allows you to Alt+Shift+Left/Right to increase / decrease terminal width size on the fly. So if you can’t quite read the text you are referencing, it’s easy to shrink the terminal slightly so you can.

Still, if you are looking for a nice Gnome-based Quake style terminal window, Guake is a good alternative to both Tilda and Yakuake.

Tonidoplug – a sheeva plugin server that uses 5-12watts

TonidoPlug is a tiny, low power, low cost home server based on the 1.2 GHz Sheeva processor that allows you to access your applications, files, photos, music and media from anywhere (Powered by Tonido).

TonidoPlug comes pre-installed with powerful Tonido Applications – Photos, Jukebox, Webshare, Workspace, Thots, Explorer, Torrent and Search – all running on top of embedded Ubuntu Jaunty Linux OS. Additionally, TonidoPlug can be extended by installing new applications from Tonido App store.

Not sure if we are going to see them in Australia anytime soon, and if any adapters will be needed

Here’s a Youtube review of the TonidoPlug:

Technorati Tags: , , , , , ,

Linux Chromium now supports Flash

Chromium is the open source version of Google Chrome for Linux. It’s still in alpha stage but it’s been very stable for me. The biggest downside is lack of Flash support for things like Google Analytics and Youtube.

For Ubuntu, install Chromium like so:

echo "deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main #chromium-browser" > /etc/apt/sources.list.d/chromium.list
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xfbef0d696de1c72ba5a835fe5a9bf3bb4e5e17b5
sudo apt-get update && sudo apt-get install chromium-browser

to get Flash working:

cd /usr/lib/chromium-browser/plugins
sudo ln -s ../../flashplugin-installer/libflashplayer.so

Screenshot running on 64bit Ubuntu Jaunty Jackalope. Watching this was consuming approx 25% cpu in a single chromium process instance:

Flash for Chromium on Linux
Flash for Chromium on Linux

I am now likely to spend most of my day in Chromium, though extensions are working in Chromium, my favourite part of Opera is native mouse gestures. I tested a few of the mouse gestures available for Chromium but none are working very well at the moment.

I will still use Firefox for it extensions like Firebug, Web Developer Toolbar & Yslow