Skip navigation

Harvest e-mail addresses from stdin

A little python script to do this:

#!/usr/bin/env python

import re

data = open("emailsin",'r')
bulkemails = data.read()

# regex = whoEver@wHerever.xxx
r = re.compile("[-a-zA-Z0-9._]+@[-a-zA-Z0-9_]+.[a-zA-Z0-9_.]+")
results = r.findall(bulkemails)

emails = ""   
for x in results:
	print str(x)

rossg@rossg-workstation:~/Desktop$ vi emails.py 
rossg@rossg-workstation:~/Desktop$ cat emails.py 
#!/usr/bin/env python

import os
import re

bulkemails = os.stdin.read()

# regex = whoEver@wHerever.xxx
r = re.compile("[-a-zA-Z0-9._]+@[-a-zA-Z0-9_]+.[a-zA-Z0-9_.]+")
results = r.findall(bulkemails)

emails = ""   
for x in results:
	print str(x)


Magento API problem setting additional_attributes

For some reason, it’s damn hard to get the additional_attributes set via Magento’s v2 API. Even the example code in their API docs doesn’t cover it. After trying many permutations, I finally managed to get it working with the following snippet of code:

 1, 'exceptions' => 1, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
$client = new SoapClient ( 'http://www.yourmagentosite.com/api/v2_soap/?wsdl', $soapopts);
$session = $client->login ( 'apiuser', 'apipassword' ); 

$productData = (object)array(
	'additional_attributes' => (object)array(
		'single_data' => array(
			(object)array(
				'key' => 'custom_image_url',
				'value' => 'http://www.yourmagentosite.com/nicepic.jpg',
			),
		),
	),
);
$result = $client->catalogProductUpdate($session, 'abjb91', $productData);
print $client->__getLastRequest();
var_dump($result);

Tidy up website

So I finally got round to creating a basic WordPress theme from my old Joomla theme. Here it is. Enjoy, but bear in mind it’ll be a bit rough around the edges for now.

Hopefully, I will find some time one day to fill in all the older support content, and all my historical blog entries, and otherwise fill it out a bit.

Another server move

Today, I moved the ‘golder.org’ services again. I’ve moved things to a more safer and more resilient hosting arrangement. Hopefully it will also save me some money each month. Everything should be much as it was before, but I’ve replace the old Joomla web front-end with a new WordPress one, hence the sudden change in style and content. I will tidy this up and add any necessary content as and when I get time.