<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EnricoSimonetti.com &#187; Teckie</title>
	<atom:link href="http://enricosimonetti.com/category/teckie/feed/" rel="self" type="application/rss+xml" />
	<link>http://enricosimonetti.com</link>
	<description>Enrico Simonetti's Personal Blog</description>
	<lastBuildDate>Mon, 04 Apr 2011 13:32:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Company information (phone number) based on the user geolocation</title>
		<link>http://enricosimonetti.com/2010/07/18/company-information-phone-number-based-on-the-user-geolocation/</link>
		<comments>http://enricosimonetti.com/2010/07/18/company-information-phone-number-based-on-the-user-geolocation/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 05:31:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Teckie]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://enricosimonetti.com/?p=227</guid>
		<description><![CDATA[The other day I got a question asked, about geolocation. How would I show a different phone number for my company&#8217;s website, based on the current user location? There are many different ways to solve this problem. Let&#8217;s analyze few of them: 1) We can use the browser language settings, detected via JavaScript and then [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I got a question asked, about geolocation.</p>
<p>How would I show a different phone number for my company&#8217;s website, based on the current user location?</p>
<p>There are many different ways to solve this problem.<br />
Let&#8217;s analyze few of them:</p>
<p>1) We can use the browser language settings, detected via JavaScript and then display a different phone number based on the user&#8217;s nation.</p>
<p>2) We could instead download one of the free ip to nation database mappings that there are on the net (or use one of the ip2country services), and code some server side script  that will determine the user location.</p>
<p>3) Use <a rel="nofollow" href="http://code.google.com/apis/ajax/documentation/" onclick="return TrackClick('http%3A%2F%2Fcode.google.com%2Fapis%2Fajax%2Fdocumentation%2F','Google+JS+API')" target="_blank">Google JS API</a> (that is a sort of ip2country webservice anyway&#8230;) to determine the user location, plus JavaScript.</p>
<p>I would say that number 1 is definitely too weak.<br />
Number 2, if I have to maintain my own ip/country database it is going to be a nightmare over time, and I don&#8217;t think there are companies (or at least I&#8217;m not aware of them) big and reliable enough that can offer a proper ip2country free webservice.</p>
<p>I would definitely go for number 3 and as personal choice I would use <a rel="nofollow" href="http://jquery.com" onclick="return TrackClick('http%3A%2F%2Fjquery.com','jQuery')" target="_blank">jQuery</a> as JavaScript library.</p>
<p>To gain further flexibility I would also add a dropdown where the default country value is the one that Google chooses as user&#8217;s position (if determined at all), and the user can interact with the dropdown if necessary, displaying a different phone number/country details.</p>
<p>The sample JavaScript/HTML code to be able to achieve this functionality is attached <a href="http://enricosimonetti.com/wp-content/uploads/2010/07/user_location.html" onclick="return TrackClick('http%3A%2F%2Fenricosimonetti.com%2Fwp-content%2Fuploads%2F2010%2F07%2Fuser_location.html','here')">here</a> (right click and save as).</p>
<p>NB: It is required a local copy of jQuery (saved as jquery.js)</p>
]]></content:encoded>
			<wfw:commentRss>http://enricosimonetti.com/2010/07/18/company-information-phone-number-based-on-the-user-geolocation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iCalendar / vCalendar meeting invitation</title>
		<link>http://enricosimonetti.com/2010/06/26/icalendar-vcalendar-meeting-invitation/</link>
		<comments>http://enricosimonetti.com/2010/06/26/icalendar-vcalendar-meeting-invitation/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 03:10:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Teckie]]></category>
		<category><![CDATA[SugarCRM]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://enricosimonetti.com/?p=203</guid>
		<description><![CDATA[Probably everybody is familiar with the calendar event invite features? If you use Microsoft Windows (with Outlook) or Mac OSX (with iCal) or just a basic browser with a GMail account and you use the calendar functionality, you would have realized, that every time you get invited or invite someone to an event, you get [...]]]></description>
			<content:encoded><![CDATA[<p>Probably everybody is familiar with the calendar event invite features?</p>
<p>If you use Microsoft Windows (with Outlook) or Mac OSX (with iCal) or just a basic browser with a GMail account and you use the calendar functionality, you would have realized, that every time you get invited or invite someone to an event, you get a basic email, that adds the recipient to the calendar event.</p>
<p>I had to write an invitation tool that was cross compatible between different platforms and integrated with <a rel="nofollow" href="http://www.sugarcrm.com" onclick="return TrackClick('http%3A%2F%2Fwww.sugarcrm.com','SugarCRM')" target="_blank">SugarCRM</a> for a customer of <a rel="nofollow" href="http://www.insightful.com.au" onclick="return TrackClick('http%3A%2F%2Fwww.insightful.com.au','InsightfulCRM')" target="_blank">InsightfulCRM</a> (Australian SugarCRM Gold Partner) where I work.</p>
<p>I started from some samples, and by reading the <a rel="nofollow" href="http://tools.ietf.org/rfc/rfc5545.txt" onclick="return TrackClick('http%3A%2F%2Ftools.ietf.org%2Frfc%2Frfc5545.txt','RFC')" target="_blank">RFC</a> of the protocol and the <a rel="nofollow" href="http://en.wikipedia.org/wiki/ICalendar" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FICalendar','iCalendar+Wikipedia')" target="_blank">iCalendar Wikipedia</a> entry.</p>
<p>According to the protocol RFC and the Wikipedia entry, the iCalendar and vCalendar seems really similar, so we can use the common items to create a meeting invite.</p>
<p>Let&#8217;s pick a basic sample so that we can run some tests on:</p>
<p><code>BEGIN:VCALENDAR<br />
VERSION:2.0<br />
CALSCALE:GREGORIAN<br />
METHOD:REQUEST<br />
BEGIN:VEVENT<br />
DTSTART:20100616T080000Z<br />
DTEND:20100616T090000Z<br />
DTSTAMP:20100616T075116Z<br />
ORGANIZER;CN=Enrico Simonetti:mailto:enrico@test.com<br />
UID:12345678<br />
ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP= TRUE;CN=Sample:mailto:sample@test.com<br />
DESCRIPTION:Complete event on http://www.sample.com/get_event.php?id=12345678<br />
LOCATION: Sydney<br />
SEQUENCE:0<br />
STATUS:CONFIRMED<br />
SUMMARY:Test iCalendar<br />
TRANSP:OPAQUE<br />
END:VEVENT<br />
END:VCALENDAR</code></p>
<p>Now, how do we send this event?<br />
It is pretty simple.<br />
We need a specific set of headers on the email, and the content of the email has to be the structured meeting code itself.<br />
(No, it is not an attachment, also if you see an attached file!)</p>
<p>The headers are exactly as below:</p>
<p><code>$headers = "From: Enrico &lt;enrico@test.com&gt;\n";<br />
$headers .= "MIME-Version: 1.0\n";<br />
$headers .= "Content-Type: text/calendar; method=REQUEST;\n";<br />
$headers .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;charset="UTF-8"';<br />
$headers .= "\n";<br />
$headers .= "Content-Transfer-Encoding: 7bit";</code></p>
<p><strong>NB:</strong> be REALLY careful with the spacing. Apparently calendars are really really fragile, and if you only remove a space, it will result on Outlook removing the buttons at the top of the email itself, where you can accept/reject the meeting, or/and even the attendees will disappear from the list!<br />
It really caused me a lot of headache!</p>
<p>Now we can actually send the above calendar invite, as body of the email, structuring the meeting as per above sample, inside the content of $message variable.</p>
<p><code>$subject = "Meeting Subject";<br />
$subject = html_entity_decode($subject, ENT_QUOTES, 'UTF-8');<br />
mail("sample@test.com", $subject, $message, $headers);</code></p>
<p>Of course you will have to send an email for each attendee.</p>
<p>There you go, you just invited your attendee to meeting with id &#8217;12345678&#8242;!</p>
<p>As simple as that!</p>
]]></content:encoded>
			<wfw:commentRss>http://enricosimonetti.com/2010/06/26/icalendar-vcalendar-meeting-invitation/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.10 (Karmic Koala) batch upgrades</title>
		<link>http://enricosimonetti.com/2009/11/02/ubuntu-9-10-karmic-koala-batch-upgrades/</link>
		<comments>http://enricosimonetti.com/2009/11/02/ubuntu-9-10-karmic-koala-batch-upgrades/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 00:10:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Teckie]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Medibuntu]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Upgrade]]></category>

		<guid isPermaLink="false">http://enricosimonetti.com/?p=183</guid>
		<description><![CDATA[I had the need to upgrade multiple pcs with Ubuntu 9.04 without downloading for every single instance all the files needed for the upgrade process to work. You will just need to download the &#8220;alternate&#8221; Ubuntu iso (that you can find here). Then as next step you have 2 choices, burn the cd or mount [...]]]></description>
			<content:encoded><![CDATA[<p>I had the need to upgrade multiple pcs with Ubuntu 9.04 without downloading for every single instance all the files needed for the upgrade process to work.<br />
You will just need to download the &#8220;alternate&#8221; <a rel="nofollow" href="http://www.ubuntu.com" onclick="return TrackClick('http%3A%2F%2Fwww.ubuntu.com','Ubuntu')" title="Ubuntu" target="_blank">Ubuntu</a> iso (that you can find <a href="http://releases.ubuntu.com/9.10/ubuntu-9.10-alternate-i386.iso" onclick="return TrackClick('http%3A%2F%2Freleases.ubuntu.com%2F9.10%2Fubuntu-9.10-alternate-i386.iso','ubuntu-9.10-alternate-i386.iso')" title="ubuntu-9.10-alternate-i386.iso" target="_blank">here</a>).</p>
<p>Then as next step you have 2 choices, burn the cd or mount the iso file locally as below:</p>
<p><code>sudo mount -o loop ubuntu-9.10-alternate-i386.iso /media/cdrom0</code></p>
<p>Then we can run the executable &#8220;cdromupgrade&#8221; inside the root of the cdrom:</p>
<p><code>sudo /cdrom/cdromupgrade &#038;</code></p>
<p>and then follow the normal upgrade process through the interface.</p>
<p>On upgrade complete, if you use the <a rel="nofollow" href="http://www.medibuntu.org" onclick="return TrackClick('http%3A%2F%2Fwww.medibuntu.org','Medibuntu')" title="Medibuntu" target="_blank">Medibuntu</a> repository, you will need to update the sources used and probably to update your software versions as well.<br />
You can find below the commands that you need to run, as stated on Medibuntu website:</p>
<p><code>sudo wget http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list \<br />
 --output-document=/etc/apt/sources.list.d/medibuntu.list &#038;&#038;<br />
sudo apt-get -q update &#038;&#038;<br />
sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring &#038;&#038;<br />
sudo apt-get -q update</code></p>
<p>If it is a fresh Ubuntu install, you will probably want to install the commonly used packages (or you can find the complete list of Medibuntu packages for Karmic Koala <a rel="nofollow" href="http://packages.medibuntu.org/karmic/index.html" onclick="return TrackClick('http%3A%2F%2Fpackages.medibuntu.org%2Fkarmic%2Findex.html','Karmic+Koala+Medibuntu+packages')" title="Karmic Koala Medibuntu packages">here</a>):</p>
<p><code>sudo apt-get install ubuntu-restricted-extras libdvdcss2 w32codecs skype</code></p>
<p>if it is just an upgrade, you can run:</p>
<p><code>sudo apt-get upgrade</code></p>
<p>and that will be working things out for you.</p>
<p>Happy upgrade!</p>
]]></content:encoded>
			<wfw:commentRss>http://enricosimonetti.com/2009/11/02/ubuntu-9-10-karmic-koala-batch-upgrades/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integration between SugarCRM and Perl using SOAP</title>
		<link>http://enricosimonetti.com/2009/10/21/integration-between-sugarcrm-and-perl-using-soap/</link>
		<comments>http://enricosimonetti.com/2009/10/21/integration-between-sugarcrm-and-perl-using-soap/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 10:58:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Teckie]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[SugarCRM]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://enricosimonetti.com/?p=143</guid>
		<description><![CDATA[I&#8217;ve been developing SugarCRM solutions for a while now at InsightfulCRM (Fonality Pty Ltd) and I never really got into interacting through SOAP with languages other than PHP until today. There are some tutorials and documentation on SugarCRM Wiki website about it, but not really for Perl, that is the programming language I&#8217;ve chosen today. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been developing <a rel="nofollow" href="http://www.sugarcrm.com" onclick="return TrackClick('http%3A%2F%2Fwww.sugarcrm.com','SugarCRM')" target="_blank" title="SugarCRM">SugarCRM</a> solutions for a while now at <a rel="nofollow" href="http://www.insightful.com.au" onclick="return TrackClick('http%3A%2F%2Fwww.insightful.com.au','InsightfulCRM+SugarCRM+Free+Trial')" onclick="return TrackClick('http%3A%2F%2Fwww.insightful.com.au','InsightfulCRM+%28Fonality+Pty+Ltd%29')" target="_blank" title="InsightfulCRM (Fonality Pty Ltd)">InsightfulCRM (Fonality Pty Ltd)</a> and I never really got into interacting through SOAP with languages other than PHP until today.</p>
<div id="attachment_170" class="wp-caption alignright" style="width: 312px;height:67px;">
<img src="http://enricosimonetti.com/wp-content/uploads/2009/10/sugarcrm_logo.gif" alt="SugarCRM" title="SugarCRM" width="302" height="62" class="size-full wp-image-170" />
</div>
<p>There are some tutorials and documentation on <a rel="nofollow" href="http://www.sugarcrm.com/wiki/index.php?title=SOAP_Documentation" onclick="return TrackClick('http%3A%2F%2Fwww.sugarcrm.com%2Fwiki%2Findex.php%3Ftitle%3DSOAP_Documentation','SugarCRM+Wiki+SOAP')" target="_blank" title="SugarCRM Wiki SOAP">SugarCRM Wiki</a> website about it, but not really for <a rel="nofollow" href="http://en.wikipedia.org/wiki/Perl" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPerl','Perl')" title="Perl">Perl</a>, that is the programming language I&#8217;ve chosen today.</p>
<p>I&#8217;m not a &#8220;rockstar&#8221; with Perl but let&#8217;s figure this out <img src='http://enricosimonetti.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>First of all why Perl?<br />
The main reason is: you get Perl with your Linux box, without mucking around too much, in any Linux distribution and doesn&#8217;t really need too much software around it. It is multi platform and it has his own package manager <a rel="nofollow" href="http://en.wikipedia.org/wiki/CPAN" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FCPAN','CPAN')" target="_blank" title="CPAN">(CPAN)</a> to install other components.<br />
This is all that&#8217;s needed to get started!</p>
<p>So let&#8217;s start.</p>
<p>First of all, let&#8217;s define what exactly we want to achieve through <a rel="nofollow" href="http://en.wikipedia.org/wiki/SOAP" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSOAP','SOAP')" target="_blank" title="SOAP">SOAP</a>.</p>
<p>1) We want Perl to log in to our SugarCRM instance.<br />
2) We want to create a new Case in Sugar<br />
3) We want to create a note with an attachment (file stored on the PC where the script is executed) linked to our new Case</p>
<p>The software I will write, will be running from command line, and to be safe, we will add another step before 1), to check the hostname where our SugarCRM resides is currently active, just by pinging it.</p>
<p>We will need to install some software that doesn&#8217;t really come out of the box.<br />
Usually SOAP Lite is not installed by default, so we will need to run </p>
<p><code>perl -MCPAN -e 'install SOAP::Lite'</code></p>
<p>Now we can start the real coding.</p>
<p>Step 0, write a few lines to check if the host is alive (works only if executed by root):</p>
<p><code>#!/usr/bin/perl<br />
use Net::Ping;<br />
my $p = Net::Ping->new("icmp");<br />
if ($p->ping('our.crm.com', 0.5))<br />
{<br />
&nbsp;&nbsp;print 'Alive\n';<br />
} else {<br />
&nbsp;&nbsp;print 'Dead\n';<br />
}</code></p>
<p>Now we have to use the SugarCRM SOAP login function. It requires the username and the password passed in as parameters, and it returns the session id that we will use for other SOAP calls.</p>
<p>Let&#8217;s write the login part using the necessary libraries.</p>
<p><code>use SOAP::Lite;<br />
use Data::Dumper;<br />
# For encoding notes attachment content we will need this<br />
use MIME::Base64;</code><code># Let's define some variables...<br />
my $soap_domain = 'http://www.sugarcrm.com/sugarcrm';<br />
my $soap_url = 'http://our.crm.com/soap.php';<br />
my $sugarcrm_username = 'username';<br />
# MD5 of the password<br />
my $sugarcrm_md5_password = '5f4dcc3b5aa765d61d8327deb882cf99';</code><code># Instantiate SOAP<br />
my $soap = SOAP::Lite->uri($soap_domain)->proxy($soap_url);</code><code># Hash with credentials<br />
my $user_auth = {'user_name' => $sugarcrm_username, 'password' => $sugarcrm_md5_password};</code><code># Execute the login<br />
my $result = $soap->login(SOAP::Data->value($user_auth));</code><code># We can eventually print out the result so that we understand the data structure for debug (yeah that's what I did all the time)<br />
# print(Dumper($result->result));</code><code># And finally get the session id<br />
my $session_id = $result->result->{'id'};</code><code># Now we can get the Sugar user id of the logged in user (always useful for assigning records to the right person)<br />
$result = $soap->get_user_id(SOAP::Data->value($session_id));<br />
my $sugarcrm_id = $result->result;</code></p>
<p>Now we have to complete point 2, creating the Case. For this we use the general purpose function &#8216;set_entry&#8217;.<br />
We just need to pass the session id previously generated, the module name, and an array of name and values for each field we want to fill in.</p>
<p><code># Ok let's create the Case<br />
$result = $soap->set_entry(<br />
&nbsp;&nbsp;SOAP::Data->value($session_id),<br />
&nbsp;&nbsp;SOAP::Data->value('Cases'),<br />
&nbsp;&nbsp;SOAP::Data->value(<br />
&nbsp;&nbsp;[<br />
&nbsp;&nbsp;&nbsp;&nbsp;{'name' => 'name', 'value' => 'Enrico Test'},<br />
&nbsp;&nbsp;&nbsp;&nbsp;{'name' => 'status', 'value' => 'Assigned'},<br />
&nbsp;&nbsp;&nbsp;&nbsp;{'name' => 'assigned_user_id', 'value' => $sugarcrm_id},<br />
&nbsp;&nbsp;&nbsp;&nbsp;{'name' => 'description', 'value' => 'Enrico Test'}<br />
&nbsp;&nbsp;]<br />
&nbsp;&nbsp;)<br />
);<br />
my $case_id = $result->result->{'id'};</code></p>
<p>Now we retrieve the record just created to use the case_number property. We can use the get_entry function.<br />
It needs the session, the module name, the case id and an array of fields we want back in the response.</p>
<p><code>$result = $soap->get_entry(<br />
&nbsp;&nbsp;SOAP::Data->value($session_id),<br />
&nbsp;&nbsp;SOAP::Data->value('Cases'),<br />
&nbsp;&nbsp;SOAP::Data->value($case_id),<br />
&nbsp;&nbsp;SOAP::Data->value(<br />
&nbsp;&nbsp;&nbsp;&nbsp;['case_number']<br />
&nbsp;&nbsp;)<br />
);</code><code># Hash, use ->{'key'}, array use ['0'] (Yeah this needed a bit of debugging before I got it right!)</code><code>my $case_number = $result->result->{'entry_list'}['0']->{'name_value_list'}['0']->{'value'};</code></p>
<p>It&#8217;s time for the step 3. Create a function to easily store multiple files.</p>
<p>a) Create a Note with set_entry<br />
b) Read the file<br />
c) Create an attachment for the note just created with set_note_attachment (This function can only link a file to an existing note&#8230;)</p>
<p>Here is the code:</p>
<p><code>sub create_note($$$$$)<br />
{<br />
&nbsp;&nbsp;my($soap_connection, $session_id, $filename, $display_filename, $case_id) = @_;<br />
&nbsp;&nbsp;# Check if the file exists<br />
&nbsp;&nbsp;if(-e $filename)<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;# Create note<br />
&nbsp;&nbsp;&nbsp;&nbsp;$result = $soap_connection->set_entry(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SOAP::Data->value($session_id),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SOAP::Data->value('Notes'),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SOAP::Data->value(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{'name' => 'name', 'value' => $display_filename},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{'name' => 'parent_id', 'value' => $case_id},<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{'name' => 'parent_type', 'value' => 'Cases'}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;);<br />
&nbsp;&nbsp;&nbsp;&nbsp;$note_id = $result->result->{'id'};<br />
&nbsp;&nbsp;&nbsp;&nbsp;# Read our file<br />
&nbsp;&nbsp;&nbsp;&nbsp;open(DAT, $filename) || die("Could not open file!");<br />
&nbsp;&nbsp;&nbsp;&nbsp;@data=<DAT>;<br />
&nbsp;&nbsp;&nbsp;&nbsp;close(DAT);<br />
&nbsp;&nbsp;&nbsp;&nbsp;# Convert array of lines to a string<br />
&nbsp;&nbsp;&nbsp;&nbsp;$data = join('', @data);<br />
&nbsp;&nbsp;&nbsp;&nbsp;# Attach the file (The content needs to be encoded in base 64)<br />
&nbsp;&nbsp;&nbsp;&nbsp;my $resp = $soap_connection->set_note_attachment(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SOAP::Data->value($session_id),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SOAP::Data->value(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'id' => $note_id,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'file' => encode_base64($data),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'filename' => $display_filename<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;);<br />
&nbsp;&nbsp;}<br />
}</code></p>
<p>Cool! Now we have completed all three pieces that we needed, and I&#8217;m sure that I&#8217;ve covered a bit of everything on how to integrate your Perl program with SugarCRM.</p>
<p>If you are interested on having a free trial SugarCRM system and purchasing it in Australia, you can always send me an email and/or go to <a rel="nofollow" href="http://www.insightful.com.au" onclick="return TrackClick('http%3A%2F%2Fwww.insightful.com.au','InsightfulCRM+SugarCRM+Free+Trial')" onclick="return TrackClick('http%3A%2F%2Fwww.insightful.com.au','InsightfulCRM+%28Fonality+Pty+Ltd%29')" target="_blank" title="InsightfulCRM SugarCRM Free Trial">InsightfulCRM</a> website.</p>
<p>Thank you,</p>
<p>Enrico</p>
]]></content:encoded>
			<wfw:commentRss>http://enricosimonetti.com/2009/10/21/integration-between-sugarcrm-and-perl-using-soap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asterisk FastAGI with PHP</title>
		<link>http://enricosimonetti.com/2009/04/27/asterisk-fastagi-with-php/</link>
		<comments>http://enricosimonetti.com/2009/04/27/asterisk-fastagi-with-php/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 00:37:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Teckie]]></category>
		<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[trixbox]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://enricosimonetti.com/?p=126</guid>
		<description><![CDATA[Lately I&#8217;ve been involved in some work projects related to Asterisk. I had the opportunity to play with the Asterisk Gateway Interface (AGI) to see what can be done with it. In a few words, it allows you to execute scripts on an action (eg: a user calling an extension), that will interact with other [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been involved in some work projects related to <a rel="nofollow" href="http://en.wikipedia.org/wiki/Asterisk_(PBX)" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FAsterisk_%28PBX%29','Asterisk')" target="_blank" title="Asterisk">Asterisk</a>.<br />
I had the opportunity to play with the <a rel="nofollow" href="http://en.wikipedia.org/wiki/Asterisk_Gateway_Interface" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FAsterisk_Gateway_Interface','Asterisk+Gateway+Interface')" target="_blank" title="Asterisk Gateway Interface">Asterisk Gateway Interface (AGI)</a> to see what can be done with it.</p>
<p>In a few words, it allows you to execute scripts on an action (eg: a user calling an extension), that will interact with other systems (eg: retrieve information from a database and store other input data) and trigger other actions.</p>
<p>First of all, given that I&#8217;m more familiar with PHP than Perl, I looked around for libraries that can interact with my loved PHP.<br />
You can get a lot of useful information at <a rel="nofollow" href="http://voip-info.org" onclick="return TrackClick('http%3A%2F%2Fvoip-info.org','Voip+Info')" target="_blank" title="Voip Info">http://voip-info.org</a>, being more specific at: <a rel="nofollow" href="http://www.voip-info.org/wiki/view/Asterisk+AGI" onclick="return TrackClick('http%3A%2F%2Fwww.voip-info.org%2Fwiki%2Fview%2FAsterisk%2BAGI','Asterisk+AGI')" target="_blank" title="Asterisk AGI">http://www.voip-info.org/wiki/view/Asterisk+AGI</a><br />
This will help you understand what can and cannot be done&#8230;</p>
<p>I used one of our company (Fonality Australia) trixbox Pro test systems for playing around with this.<br />
What I was interested on, was specifically the FastAGI. Basically call remote agi scripts that communicate with your Asterisk system via tcp sockets (more info <a rel="nofollow" href="http://www.voip-info.org/wiki/view/Asterisk+FastAGI" onclick="return TrackClick('http%3A%2F%2Fwww.voip-info.org%2Fwiki%2Fview%2FAsterisk%2BFastAGI','FastAGI')" target="_blank" title="FastAGI">here</a>).</p>
<p>This is interesting because it allows you to install software in your remote machine, without exposing your trixbox appliance to new software (even unsupported one).</p>
<p>First of all I&#8217;ve installed the phpagi library (that can be found on sourceforge at <a rel="nofollow" href="http://phpagi.sourceforge.net/" onclick="return TrackClick('http%3A%2F%2Fphpagi.sourceforge.net%2F','PHP+AGI+SourceForge')" target="_blank" title="PHP AGI SourceForge">http://phpagi.sourceforge.net/</a>) and had a look at the code.<br />
The server side part (so the one that the trixbox system will call in the next steps) will execute as a deamon with the aid of xinetd on your linux box.<br />
In my case xinetd wasn&#8217;t installed, and in a Debian flavoured linux distribution you can easily install it with &#8220;sudo apt-get install xinetd&#8221;, and of course you can get more info about xinetd at <a rel="nofollow" href="http://xinetd.org" onclick="return TrackClick('http%3A%2F%2Fxinetd.org','Xinetd')" target="_blank" title="Xinetd">http://xinetd.org</a>.</p>
<p>You can get more info on how all the the super server system is structured in the wikipedia inetd page <a rel="nofollow" href="http://en.wikipedia.org/wiki/Inetd" onclick="return TrackClick('http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FInetd','Inetd')" target="_blank" title="Inetd">here</a></p>
<p>Of course you have to make sure you have a working command line php server on your linux box (for Debian flavour: sudo apt-get install php5-cli) and test it running a command line script (php -f file.php).</p>
<p>As a first step of the installation of the library you need to unzip it somewhere in your linux box and that path will be from now on _PHP_LIBRARY_PATH<br />
You need to list the server port inside the services list (/etc/services). So at the bottom add the line &#8220;fastagi 4573/tcp&#8221;.<br />
And then to add a config entry inside /etc/xinetd.d/fastagi.<br />
For testing I&#8217;ve entered as follows:</p>
<p><code>service fastagi<br />
{<br />
&nbsp;&nbsp;socket_type  = stream<br />
&nbsp;&nbsp;user         = test<br />
&nbsp;&nbsp;group        = test<br />
&nbsp;&nbsp;server       = _PHP_LIBRARY_PATH/phpagi-fastagi.php<br />
&nbsp;&nbsp;wait         = no<br />
&nbsp;&nbsp;protocol     = tcp<br />
&nbsp;&nbsp;disable      = no<br />
}</code></p>
<p>After restarting xinetd, our server side is ready to go and will accept requests from external IPs.<br />
Just for being safe, I would ssh on a remote machine and see if we can telnet into the port of our FastAGI server and see if the server is listening (telnet IP_ADDRESS 4573).<br />
All good? Let&#8217;s go.</p>
<p>Now we create a sample agi script. I will write the php file at _PHP_LIBRARY_PATH/sample.php<br />
with just this as a content:</p>
<p><code>&lt;?php<br />
$fastagi->verbose('cool, the FastAGI server has been called!');<br />
?&gt;</code></p>
<p>Now we go inside our nice little trixbox menu interface and we add an agi script entry on the trixbox call menu with this syntax: agi://agi_server_ip_address/sample.php and save.</p>
<p>We can now ssh inside our trixbox box (or whatever asterisk based system you have) and access the asterisk cli interface with &#8220;asterisk -r&#8221; and enable the agi debugging with &#8220;agi debug&#8221;.</p>
<p>Now you can try to call your trixbox, and when you will reach the right menu steps you are calling the AGI script with&#8230; you will see the command sent from the php library to your Asterisk system!</p>
<p>Now you can have a play with the library and easily extend your phone system with new fancy features!<br />
Using the instance of the AGI object $fastagi you can call any method of the phpagi library, listed and explained in <a rel="nofollow" href="http://phpagi.sourceforge.net/phpagi2/docs/" onclick="return TrackClick('http%3A%2F%2Fphpagi.sourceforge.net%2Fphpagi2%2Fdocs%2F','PHP+AGI+Guide')" target="_blank" title="PHP AGI Guide">here</a></p>
<p>You can do a lot of other fancy stuff with AGI, like communicating via soap with other systems, accessing data, saving data, recording messages, playing messages, read and play DTMF tones, even read new messages with text to speech libraries and the other way around!</p>
<p>I guess there is no limit to the possibility it can give to your phone system!</p>
<p>See you next!</p>
]]></content:encoded>
			<wfw:commentRss>http://enricosimonetti.com/2009/04/27/asterisk-fastagi-with-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Another battle against IE</title>
		<link>http://enricosimonetti.com/2009/03/21/another-battle-against-ie/</link>
		<comments>http://enricosimonetti.com/2009/03/21/another-battle-against-ie/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 02:49:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Teckie]]></category>
		<category><![CDATA[Browsers Compatibility]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[W3C]]></category>

		<guid isPermaLink="false">http://enricosimonetti.com/?p=108</guid>
		<description><![CDATA[As usual, I was playing around with my new project, implementing something similar to Google Suggests for country/city suggestions, after using Google Map Geolocation. Basically the idea was to see a dynamic html table underneath every country/city text field, that suggests the possible values the user is typing. Everything is generated appending child elements through [...]]]></description>
			<content:encoded><![CDATA[<p>As usual, I was playing around with my new project, implementing something similar to <a rel="nofollow" href="http://www.google.com/webhp?complete=1" onclick="return TrackClick('http%3A%2F%2Fwww.google.com%2Fwebhp%3Fcomplete%3D1','Google+Suggests')" target="_blank">Google Suggests</a> for country/city suggestions, after using <a rel="nofollow" href="http://code.google.com/apis/maps/documentation/" onclick="return TrackClick('http%3A%2F%2Fcode.google.com%2Fapis%2Fmaps%2Fdocumentation%2F','Google+Map+Geolocation')" target="_blank">Google Map Geolocation</a>.</p>
<p>Basically the idea was to see a dynamic html table underneath every country/city text field, that suggests the possible values the user is typing.</p>
<p>Everything is generated appending child elements through javascript and removing them when needed.</p>
<p>As usual no problems with Firefox, but I had to battle a lot to understand the problem with Internet Explorer.</p>
<p>Basically the code was correctly appended inside the right element, but wasn&#8217;t visible using IE!</p>
<p>I could for example alert the innerHTML of the newly created table, but still couldn&#8217;t see it on the browser output.</p>
<p>The code I was using was:</p>
<p><code><br />
// creating table<br />
var mytable = document.createElement('table');<br />
mytable.setAttribute('id','this_table_id');<br />
mytable.className = 'my_class';<br />
&nbsp;<br />
// creating row<br />
var tr = document.createElement('tr');<br />
tr.className = 'new_row';<br />
tr.onclick = function() { do_something(); }<br />
&nbsp;<br />
// creating td<br />
var td = document.createElement('td');<br />
td.innerHTML = "My Td Content";<br />
// adding the td inside the row<br />
tr.appendChild(td);<br />
&nbsp;<br />
// adding the row inside the table<br />
mytable.appendChild(tr)<br />
&nbsp;<br />
var body = document.getElementById('my_page_body');<br />
// adding the new table inside the page body<br />
body.appendChild(mytable);<br />
&nbsp;<br />
</code></p>
<p>After few tests and headaches, I had a quick look at MSDN website and noticed that a lot of examples had the &#8220;tbody&#8221; tag in each generated table, why? Let&#8217;s try&#8230;</p>
<p>It worked! Internet Explorer needs the &#8220;tbody&#8221; tag for a table created through javascript to be visible! Crazy stuff.</p>
<p>The working code will look like:</p>
<p><code><br />
// creating table<br />
var mytable = document.createElement('table');<br />
mytable.setAttribute('id','this_table_id');<br />
mytable.className = 'my_class';<br />
&nbsp;<br />
// creating tbody tag<br />
var tbody = document.createElement('tbody');<br />
&nbsp;<br />
// creating row<br />
var tr = document.createElement('tr');<br />
tr.className = 'new_row';<br />
tr.onclick = function() { do_something(); }<br />
&nbsp;<br />
// creating td<br />
var td = document.createElement('td');<br />
td.innerHTML = "My Td Content";<br />
&nbsp;<br />
// adding the td inside the row<br />
tr.appendChild(td);<br />
&nbsp;<br />
// adding the row inside the tbody<br />
tbody.appendChild(tr);<br />
&nbsp;<br />
// adding the tbody inside the table<br />
mytable.appendChild(tbody)<br />
var body = document.getElementById('my_page_body');<br />
&nbsp;<br />
// adding the new table inside the page body<br />
body.appendChild(mytable);<br />
&nbsp;<br />
</code></p>
<p>Yes, I agree that the tag tbody is part of the w3c standard, but on <a rel="nofollow" href="http://www.w3.org/TR/html401/struct/tables.html#h-11.2.1" onclick="return TrackClick('http%3A%2F%2Fwww.w3.org%2FTR%2Fhtml401%2Fstruct%2Ftables.html%23h-11.2.1','HTML+4.01+W3C+standards')" target="_blank">HTML 4.01 W3C standards</a> it is stated the following:</p>
<p><cite><br />
The TBODY start tag is always required except when the table contains only one table body and no table head or foot sections. The TBODY end tag may always be safely omitted.<br />
&nbsp;<br />
</cite></p>
<p>What does it mean? I didn&#8217;t need the tbody, and IE forced me to use it! It CAN&#8217;T be safely omitted <img src='http://enricosimonetti.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Another thumb down for IE.</p>
]]></content:encoded>
			<wfw:commentRss>http://enricosimonetti.com/2009/03/21/another-battle-against-ie/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Do you Internet Explorer? I don&#8217;t.</title>
		<link>http://enricosimonetti.com/2009/03/05/do-you-internet-explorer-i-dont/</link>
		<comments>http://enricosimonetti.com/2009/03/05/do-you-internet-explorer-i-dont/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 12:12:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Teckie]]></category>
		<category><![CDATA[Browsers Compatibility]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://enricosimonetti.com/?p=87</guid>
		<description><![CDATA[Rants I&#8217;m a web developer and what does a web developer do? He tries to make a website work almost everywhere! Everywhere? According to w3schools browsers stats, the sum of the users of the 2 browsers is about 90% of the whole users, so yeah, everywhere. Here is the problem: we generally love Firefox, we [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Rants</strong></p>
<p>I&#8217;m a web developer and what does a web developer do? He tries to make a website work almost everywhere! <img src='http://enricosimonetti.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Everywhere? According to <a rel="nofollow" href="http://www.w3schools.com/browsers/browsers_stats.asp" onclick="return TrackClick('http%3A%2F%2Fwww.w3schools.com%2Fbrowsers%2Fbrowsers_stats.asp','w3schools+browsers+stats')" target="_blank">w3schools browsers stats</a>, the sum of the users of the 2 browsers is about 90% of the whole users, so yeah, everywhere.</p>
<p>Here is the problem: we generally love <a rel="nofollow" href="http://www.mozilla.com/firefox/" onclick="return TrackClick('http%3A%2F%2Fwww.mozilla.com%2Ffirefox%2F','Firefox')" target="_blank">Firefox</a>, we really do, because there are so many tools for make your life of debugging a website heaps easier than what it would be with other browsers.</p>
<p>A couple of examples? Of course <a rel="nofollow" href="http://addons.mozilla.org/firefox/addon/1843" onclick="return TrackClick('http%3A%2F%2Faddons.mozilla.org%2Ffirefox%2Faddon%2F1843','Firebug')" target="_blank">Firebug</a> and the <a rel="nofollow" href="http://addons.mozilla.org/firefox/addon/60" onclick="return TrackClick('http%3A%2F%2Faddons.mozilla.org%2Ffirefox%2Faddon%2F60','Web+Developer')" target="_blank">Web Developer</a> addons!<br />
That&#8217;s why we generally start with Firefox to build a website, then we check it on Internet Explorer&#8230; and bam! Nothing works also if you write code/javascript following every single <a rel="nofollow" href="http://www.w3.org" onclick="return TrackClick('http%3A%2F%2Fwww.w3.org','W3C')" target="_blank">W3C</a> standard.</p>
<p>So from that point on, developing will be more like crying blood tears to understand a common way to make things work in both the 2 main browsers user by the &#8220;internet population&#8221;.</p>
<p>But let&#8217;s not get into this, there would be too much to talk about, and it would be only a personal view anyway.</p>
<p>Let&#8217;s talk about the battle I had to win today&#8230;</p>
<p><strong>Objective</strong></p>
<p>I just had to do some pretty basic stuff with checkboxes.</p>
<p>Basically the webpage had a some content (that I couldn&#8217;t modify server side) and I had to add some events through javascript on some checkboxes, to be able to display/hide some parts inside the webpage, on check/uncheck action.</p>
<p>I had to obtain the same feature of a normal &#8220;onclick&#8221; like this:</p>
<p><code>&lt;div id='myid' onclick='alert("you clicked me!")' /&gt;</code></p>
<p>&#8230; dynamically.</p>
<p><strong>Events&#8230; what about them?</strong></p>
<p>How everyone knows, Internet Explorer uses its own weird way of handling events&#8230; and yeah who says that I am right? <a rel="nofollow" href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget-addEventListener" onclick="return TrackClick('http%3A%2F%2Fwww.w3.org%2FTR%2FDOM-Level-2-Events%2Fevents.html%23Events-EventTarget-addEventListener','W3C+standards')" target="_blank">W3C standards</a> of course! <img src='http://enricosimonetti.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
(and anyway I&#8217;m carrying Firefox&#8217;s flag, so there we go <img src='http://enricosimonetti.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> )</p>
<p>Anyway going back to the point, everyone knows that there are two<br />
 types of event handling:</p>
<p>1) Firefox (W3C compatible):</p>
<p><code><br />
myDomElement.addEventListener('eventType', function()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;/* some stuff here */<br />
&nbsp;&nbsp;}, bool<br />
);<br />
</code></p>
<p>2) IE:</p>
<p><code><br />
myDomElement.attachEvent('theirEventType', function()<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;/* some stuff here */<br />
&nbsp;&nbsp;}<br />
);<br />
</code></p>
<p>&#8230;and until here all good&#8230;</p>
<p>So a basic &#8220;browser detecting&#8221; would be something like:</p>
<p><code><br />
if(window.addEventListener)<br />
{<br />
&nbsp;&nbsp;/* My W3C Friends */<br />
}<br />
else<br />
{<br />
&nbsp;&nbsp;/* Evil Browsers */<br />
}<br />
</code></p>
<p>Then I&#8217;ve added my dirty little code on it&#8230; to attach events on the 2 browsers&#8230;</p>
<p><code><br />
if(window.addEventListener)<br />
{<br />
&nbsp;&nbsp;    myElement.addEventListener('click', function()<br />
&nbsp;&nbsp;&nbsp;&nbsp;        {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            checkboxChange(this, my_array_of_fields);<br />
&nbsp;&nbsp;&nbsp;&nbsp;        }, false<br />
&nbsp;&nbsp;    );<br />
}<br />
else<br />
{<br />
&nbsp;&nbsp;    myElement.attachEvent('onclick', function()<br />
&nbsp;&nbsp;&nbsp;&nbsp;        {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            checkboxChange(this, my_array_of_fields);<br />
&nbsp;&nbsp;&nbsp;&nbsp;        }<br />
&nbsp;&nbsp;    );<br />
}<br />
</code></p>
<p>As said before&#8230; I have a look at the result on Firefox&#8230; and all works fine&#8230; then I move to IE&#8230; and THUNDERSTORMS!<br />
The above code (OF COURSE) doesn&#8217;t work!</p>
<p>Why? WHY???<br />
After digging for a while I&#8217;ve figured out that the name of the object &#8220;this&#8221; passed to the function</p>
<p><code>checkboxChange(...)</code></p>
<p>was not the name of the object I was passing.<br />
I couldn&#8217;t even get the right element through the ID, because of another problem there is with IE!</p>
<p><code>document.getElementById('myId')</code></p>
<p>IE gets confused, if you have the name of an element, equal to the id of another element and that (not my choice) was the case.<br />
So there we go, we have to find another solution!</p>
<p><strong>Solutions? Workarounds?</strong></p>
<p>Of course the easiest way (and also browser indipendent) is&#8230; to use a library that someone &#8220;maybe smarter than you&#8221; wrote already <img src='http://enricosimonetti.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>For example:</p>
<p><a rel="nofollow" href="http://developer.yahoo.com/yui/" onclick="return TrackClick('http%3A%2F%2Fdeveloper.yahoo.com%2Fyui%2F','YAHOO')" target="_blank">YAHOO</a> one</p>
<p><code><br />
YAHOO.util.Event.addListener(myElement, 'click', function()<br />
&nbsp;&nbsp;        {<br />
&nbsp;&nbsp;&nbsp;&nbsp;            checkboxChange(this, my_array_of_fields);<br />
&nbsp;&nbsp;        }<br />
);<br />
</code></p>
<p>or my favorite one <a rel="nofollow" href="http://mootools.net" onclick="return TrackClick('http%3A%2F%2Fmootools.net','MooTools')" target="_blank">MooTools</a></p>
<p><code><br />
myElement.addEvent('click', function()<br />
&nbsp;&nbsp;        {<br />
&nbsp;&nbsp;&nbsp;&nbsp;            checkboxChange(this, my_array_of_fields);<br />
&nbsp;&nbsp;        }<br />
);<br />
</code></p>
<p>Figuring out that there weren&#8217;t other &#8220;onclick&#8221; events in the page for the element I was applying events on, I&#8217;ve decided to don&#8217;t use any external javascript library for this project.<br />
I&#8217;ve used instead an anonymous function associated to the onclick event listener of my element as below:</p>
<p><code><br />
myElement.onclick = function ()<br />
{<br />
&nbsp;&nbsp;checkboxChange(this, my_array_of_fields);<br />
}<br />
</code></p>
<p>This&#8230; just for IE of course <img src='http://enricosimonetti.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>For Firefox instead I&#8217;m still using the addEventListener!</p>
<p>Hopefully I&#8217;ve been helpful to someone with this article <img src='http://enricosimonetti.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>See ya next!</p>
]]></content:encoded>
			<wfw:commentRss>http://enricosimonetti.com/2009/03/05/do-you-internet-explorer-i-dont/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

