<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.2" -->
<rss version="0.92">
<channel>
	<title>Rizal Almashoor's Blog</title>
	<link>http://www.rizalalmashoor.com/blog</link>
	<description>Valid use of Null</description>
	<lastBuildDate>Mon, 23 Aug 2010 21:25:21 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>
	
	<item>
		<title>Tolstoy for bedtime</title>
		<description>Last night I read Tolstoy to my four-year-old.

No, it wasn't Leo Tolstoy's War and Peace; it was Alexei Tolstoy's The Enormous Turnip. </description>
		<link>http://www.rizalalmashoor.com/blog/tolstoy-for-bedtime/</link>
			</item>
	<item>
		<title>Worthy of a Moleskine</title>
		<description>When I first heard about Moleskines I immediately fell in love with them. Just the idea of carrying around these notebooks &#8211; the type used by van Gogh, Picasso and Hemingway, no less! &#8211; felt awe-inspiring.

They are available in Kuala Lumpur, and the prices are perhaps more awe-inspiring than the ...</description>
		<link>http://www.rizalalmashoor.com/blog/worthy-of-a-moleskine/</link>
			</item>
	<item>
		<title>By value, by reference: by analogy</title>
		<description>Here's my best attempt to explain C# value types and reference types, and "pass by value" and "pass by reference" to a newbie. (Not you, of course.)

Value types

A piece of paper, on which is written the number 5. You use this number to calculate something.

Reference types

A piece of paper, on ...</description>
		<link>http://www.rizalalmashoor.com/blog/by-value-by-reference-by-analogy/</link>
			</item>
	<item>
		<title>When all you have is a hammer</title>
		<description>... everything looks like a nail. The point I would like to make here is this: when all you know is C#, everything looks like a class.

(Note: When I say C#, I mean Java or C#. At the core both are the same. I only mean to avoid from having ...</description>
		<link>http://www.rizalalmashoor.com/blog/when-all-you-have-is-a-hammer/</link>
			</item>
	<item>
		<title>Calling a SOAP web service from PHP</title>
		<description>The SOAP binding is RPC/encoded, and the WSDL is not published.

Using the PHP SoapClient:


define('NEWLINE', "&#60;br /&#62;\\n");

// SOAP client

$options = array
(
	'location' =&#62; 'https://example.com:1234/sample/service',
	'uri' =&#62; 'http://example.com/sample/namespace/data',
	'style' =&#62; SOAP_RPC,
	'use' =&#62; SOAP_ENCODED,
	'trace' =&#62; true // in conjunction with $soapClient-&#62;__getLastRequest() below
);
$soapClient = new SoapClient(null, $options);

// SOAP header

$nsHeader = 'http://example.com/sample/namespace/security';
$elementName = 'Security';

$usernameToken-&#62;Username = new SoapVar('user9', XSD_STRING, ...</description>
		<link>http://www.rizalalmashoor.com/blog/calling-a-soap-web-service-from-php/</link>
			</item>
	<item>
		<title>Calling a WCF service from PHP</title>
		<description>The WCF service needs to use basicHttpBinding.

The PHP code:


define('NEWLINE', "&#60;br /&#62;\\n");

// SOAP client

$wsdl = 'http://example.com/SampleWcfService.SampleService.Service?wsdl';
$soapClient = new SoapClient($wsdl, array('cache_wsdl' =&#62; 0));

// SOAP call

$sampleData-&#62;SampleProperty = "abc";

$parameters-&#62;sampleId = 123;
$parameters-&#62;sampleData = $sampleData;

try
{
	$result = $soapClient-&#62;GetData($parameters);
} 
catch (SoapFault $fault)
{
	echo "Fault code: {$fault-&#62;faultcode}" . NEWLINE;
	echo "Fault string: {$fault-&#62;faultstring}" . NEWLINE;
	if ($soapClient != null)
	{
		$soapClient = null;
	}
	exit();
}
$soapClient = ...</description>
		<link>http://www.rizalalmashoor.com/blog/calling-a-wcf-service-from-php/</link>
			</item>
	<item>
		<title>Using log4php</title>
		<description>A how-to for the excellent log4php:


Rolling daily file
Log error statements into one file, and info statements into another
Send emails


Usage


include_once('/var/www/example/components/log4php/2.0.0/Logger.php');

class Example
{
	private $logger;
	
	function __construct()
	{
		$loggerConfig = '/var/www/example/config/log4php.xml';
		Logger::configure($loggerConfig);
		$this-&#62;logger = Logger::getLogger('example');
	}

	public function doSomething()
	{
		$var = $this-&#62;getSomeValue();
		$this-&#62;logger-&#62;debug('in doSomething: $var = ' . $var);
		try
		{
			$this-&#62;doSomethingSpecific();
		}
		catch (Exception $ex)
		{
			$this-&#62;logger-&#62;error($ex-&#62;getMessage());
			throw new Exception("There is a problem with Something. We apologize for any inconvenience ...</description>
		<link>http://www.rizalalmashoor.com/blog/using-log4php/</link>
			</item>
	<item>
		<title>Calling a .NET asmx web service over https from PHP</title>
		<description>
Enable SOAP by uncommenting "extension=php_soap.dll" in php.ini
https should be included in "Registered PHP Streams" (phpinfo) &#8211; uncomment "extension=php_openssl.dll" in php.ini



// SOAP client

$wsdl = 'https://www.example.com/services/ProductManagement.asmx?wsdl';
$endpoint = array
(
	'location' =&#62; 'https://www.example.com/services/ProductManagement.asmx'
);
$soapClient = new SoapClient($wsdl, $endpoint);

// SOAP header

$soapHeaders = array();

$namespace = 'http://www.example.com/services/ProductManagement';
$elementName = 'Authentication';
$authenticationHeader = array
(
	'Username' =&#62; 'user9',
	'Password' =&#62; 'pass1234',
);
$soapHeader = new SoapHeader($namespace, $elementName, ...</description>
		<link>http://www.rizalalmashoor.com/blog/calling-a-net-asmx-web-service-over-https-from-php/</link>
			</item>
	<item>
		<title>Data Sanitizer</title>
		<description>I wrote a C# console app to sanitize CSV files. It replaces numbers with X's so that social security number 123456 becomes XXXXXX and the address "49 Main St" becomes "XX Main St". Both the input and the output are streamed to ensure that the program won't run out of ...</description>
		<link>http://www.rizalalmashoor.com/blog/data-sanitizer/</link>
			</item>
	<item>
		<title>Urgent</title>
		<description>You don't know the meaning of urgent until you're stuck in a traffic jam with a small child who has just started potty training, who urgently needs to go ... </description>
		<link>http://www.rizalalmashoor.com/blog/urgent/</link>
			</item>
</channel>
</rss>
