Categories
Technical

GStreamer pipeline for RTSP stream

A simple gstreamer pipeline to display at RTSP stream (from an Aircam)…

gst-launch -m rtspsrc location=rtsp://172.16.2.251/live/ch00_0 ! rtph264depay ! ffdec_h264 ! ffmpegcolorspace ! autovideosink
Categories
Technical

Harvest e-mail addresses from stdin

A little python script to do this:

#!/usr/bin/env python

import sys
import re

bulkemails = sys.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)


Categories
Technical

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:

<?php

$soapopts = array('trace' => 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);