<?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>coder . cl &#187; tips</title>
	<atom:link href="http://coder.cl/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://coder.cl</link>
	<description>system programmer &#38; web developer</description>
	<lastBuildDate>Thu, 29 Jul 2010 21:52:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>c++ type casting operators</title>
		<link>http://coder.cl/2010/07/c-type-casting-operators/</link>
		<comments>http://coder.cl/2010/07/c-type-casting-operators/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 21:25:52 +0000</pubDate>
		<dc:creator>Daniel Molina Wegener</dc:creator>
				<category><![CDATA[c++]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://coder.cl/?p=740</guid>
		<description><![CDATA[Traditionally, C programmers and Java programmers are accustomed to use the type casting form: (type)variable. C++, instead of that classical type casting form, has various type casting operators, used for different purposes. Each operator is used with different kinds of references, for example, you can not use the static_cast operator with virtual classes. Type casting [...]]]></description>
			<content:encoded><![CDATA[<p>Traditionally, <strong>C</strong> programmers and <strong>Java</strong> programmers are accustomed to use the type casting form: <i>(type)variable</i>. <strong>C++</strong>, instead of that classical type casting form, has various type casting operators, used for different purposes. Each operator is used with different kinds of references, for example, you can not use the <i>static_cast</i> operator with virtual classes. Type casting operators in <strong>C++</strong> has a syntax very similar to <i>C++ Templates</i>: <i>cast_operator&lt;type&gt;(variable)</i>.</p>
<p><span id="more-740"></span></p>
<p></p>
<h3>const_cast operators</h3>
<p>If you want an expression to being <i>const</i>, just use the <i>const_cast</i> operator. For example if a legacy function written in <i>C</i> requires of a <i>const</i> argument, just pass a non-const argument by using the <i>const_cast</i> operator:</p>
<pre name="code" class="cpp">
extern "C" {
    void my_function(const char *p);
};

std::string s = std::string("hello world");
my_function(const_cast&lt;char *&gt;(s.c_str()));
</pre>
<p></p>
<h3>static_cast operator</h3>
<p>The static_cast operator performs the conversion unconditionally, without verifying data types at <i>compile time</i>. This makes this operator quite dangerous, so, you need to verify data types before you use variables in this kind of type casting.</p>
<pre name="code" class="cpp">
if (typeid(*ptr_a) == typeid(MyClass)) {
    ptr_b = static_cast&lt;MyClass&gt;(ptr_a);
    ptr_b-&gt;applySomeMethod();
}
</pre>
<p>You can use the <i>typeid</i> C++ builtin to verify the data type. Also, you must consider that this operator is valid only if the conversion is explicit. Suppose <i>Parent</i> is a base class to <i>Child</i> and that <i>Unrelated</i> is an unrelated class. Then conversions from <i>Child</i> to <i>Parent</i> are valid, but a conversion from <i>Child</i> to <i>Unrelated</i> is disallowed:</p>
<pre name="code" class="cpp">
Parent a;
Child b;
Parent *a_1 = static_cast&lt;Parent *&gt;(&amp;b); // valid upcast
Unrelated *c_1 = static_cast&lt;Unrelated *&gt;(&amp;b_1); // invalid, Unrelated
</pre>
<p>The best usage for the <i>static_cast</i> opertaor, are numerical conversions, so you can cast from int, double, float and others of similar type to another int, double, float and similar types, including <i>enum types</i>. Some compilers does this kind of conversion explicit, but more strict compilers usually throw the proper warning on this kinds of assignment, without the proper type casting operation (line 4).</p>
<pre name="code" class="cpp">
float a;
int b;
a = static_cast&lt;float&gt;(b);
a = b;
</pre>
<p></p>
<h3>dynamic_cast operator</h3>
<p>The <i>dynamic_cast</i> operator, among other things, does a runtime check over types applied on the cast operation. As the above example of <i>static_cast</i> operator, dynamic cast does the <i>typeid()</i> checking. Then, if you have a pointer or reference to an object whose declared type is a base class, but you need to obtain a derived class pointer or reference, you should use <i>dynamic_cast</i>, since the <i>dynamic_cast</i> operator is another RTTI (<i>Run-time type information</i>) operator. The use of <i>dynamic_cast</i> derives into more overhead of your program, so you must use it with moderation.</p>
<pre name="code" class="cpp">
if (ptr_b == static_cast&lt;MyClass&gt;(ptr_a);) {
    ptr_b-&gt;applySomeMethod();
}
</pre>
<p>If the type checking and conversion fails, the operator returns a non-null reference, else it will return a null reference (zero). Also, some compilers will advice on the proper usage of the <i>dynamic_cast</i> operator, the more strict ones, will throw an error.</p>
<pre name="code" class="cpp">
Parent a;
Child b;
Parent *a_1 = dynamic_cast&lt;Parent *&gt;(&amp;b); // valid upcast
Unrelated *c_1 = dynamic_cast&lt;Unrelated *&gt;(&amp;b_1); // invalid, returns NULL
</pre>
<p></p>
<h3>reinterpret_cast operator</h3>
<p>This &mdash; possibly &mdash; is the most risky to use type casting operator. It completely transforms a pointer to very different types. For example:</p>
<pre name="code" class="cpp">
some_struct_s {
    short a;
    short b;
};
typedef struct some_struct_s some_struct_t;
some_struct_t *s;
unsigned long v = 0xd34db33f;
s = reinterpret_cast&lt;some_struct_t *&gt;(&amp;v);
std::cout &lt;&lt; s-&gt;a; // display first 2 bytes of value
</pre>
<p>As the example above, the pointer was completely transformed to different kind, with the dangerous assumption that the platform has a byte alignment that make possible to access the first to bytes of some address using this kind of operation. This cast is not portable, some compilers should throw some error about it.</p>
<p>The fact is that the <i>reinterpret_cast</i> operator overrides the initial declaration of the given variable, and makes possible to that variable to being reinterpreted as a different one. The usage of the <i>reinterpret_cast</i> must be done careful, for example for derived to base class reinterpretation.</p>
<pre name="code" class="cpp">
BaseClass a;
DerivedClass *c = reinterpret_cast&lt;DerivedClass *&gt;(&amp;a);
</pre>
<p>Since many of this kind of conversions are not possible in all compilers, you must try to setup your compiler to the most pedantic flags that it can allow. For example on GCC, you should use <i>-Wall -Wextra -Wshadow -pedantic -std=c++98</i> as compiler flags. It will keep your code portable and will allow you to create more standarized programs.</p>
<p>Here is a full compiling example of the core ideas in this post:</p>
<pre name='code' class='cpp'>

class A {
public:
	A();
	~A();
};

class B : public A {
public:
	B();
	~B();
};

A::A() {
}

A::~A() {
}

B::B() : A() {
}

B::~B() {
}

int
main(int argc, char **argv)
{

	A *ptr_a = new A();
	B *ptr_b = new B();

	A *a_1 = static_cast&lt;A *&gt;(ptr_b);
	B *b_1 = static_cast&lt;B *&gt;(ptr_a);

	A *a_2 = dynamic_cast&lt;A *&gt;(ptr_b);

	A *a_3 = reinterpret_cast&lt;A *&gt;(ptr_b);
	B *b_3 = reinterpret_cast&lt;B *&gt;(ptr_a);

	const A *a_4 = const_cast&lt;A *&gt;(ptr_a);
	const B *b_4 = const_cast&lt;B *&gt;(ptr_b);

	delete ptr_a;
	delete ptr_b;

	return 0;

}
</pre>



share this article at: 


	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fc-type-casting-operators%2F&amp;title=c%2B%2B%20type%20casting%20operators&amp;source=coder+.+cl+system+programmer+%26amp%3B+web+developer&amp;summary=Traditionally%2C%20C%20programmers%20and%20Java%20programmers%20are%20accustomed%20to%20use%20the%20type%20casting%20form%3A%20%28type%29variable.%20C%2B%2B%2C%20instead%20of%20that%20classical%20type%20casting%20form%2C%20has%20various%20type%20casting%20operators%2C%20used%20for%20different%20purposes.%20Each%20operator%20is%20used%20wi" title="LinkedIn"><img src="http://coder.cl/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fc-type-casting-operators%2F&amp;title=c%2B%2B%20type%20casting%20operators&amp;notes=Traditionally%2C%20C%20programmers%20and%20Java%20programmers%20are%20accustomed%20to%20use%20the%20type%20casting%20form%3A%20%28type%29variable.%20C%2B%2B%2C%20instead%20of%20that%20classical%20type%20casting%20form%2C%20has%20various%20type%20casting%20operators%2C%20used%20for%20different%20purposes.%20Each%20operator%20is%20used%20wi" title="del.icio.us"><img src="http://coder.cl/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fc-type-casting-operators%2F&amp;title=c%2B%2B%20type%20casting%20operators&amp;bodytext=Traditionally%2C%20C%20programmers%20and%20Java%20programmers%20are%20accustomed%20to%20use%20the%20type%20casting%20form%3A%20%28type%29variable.%20C%2B%2B%2C%20instead%20of%20that%20classical%20type%20casting%20form%2C%20has%20various%20type%20casting%20operators%2C%20used%20for%20different%20purposes.%20Each%20operator%20is%20used%20wi" title="Digg"><img src="http://coder.cl/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fc-type-casting-operators%2F&amp;title=c%2B%2B%20type%20casting%20operators" title="Reddit"><img src="http://coder.cl/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fc-type-casting-operators%2F&amp;t=c%2B%2B%20type%20casting%20operators" title="Facebook"><img src="http://coder.cl/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=c%2B%2B%20type%20casting%20operators%20-%20http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fc-type-casting-operators%2F" title="Twitter"><img src="http://coder.cl/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fc-type-casting-operators%2F&amp;title=c%2B%2B%20type%20casting%20operators&amp;annotation=Traditionally%2C%20C%20programmers%20and%20Java%20programmers%20are%20accustomed%20to%20use%20the%20type%20casting%20form%3A%20%28type%29variable.%20C%2B%2B%2C%20instead%20of%20that%20classical%20type%20casting%20form%2C%20has%20various%20type%20casting%20operators%2C%20used%20for%20different%20purposes.%20Each%20operator%20is%20used%20wi" title="Google Bookmarks"><img src="http://coder.cl/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>


<br/><br/><br/><hr height="1px" width="50%" />
<div style='text-align: center !important;'><b>Copyright © 2010 Daniel Molina Wegener</b><br/><b>Atribución-No Comercial-Sin Derivadas 2.0 Chile</b><br/><a target='_new' rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/cl/"><img alt="Creative Commons License" style="border-width:0" src="/cc88x31.png" /></a></div>
<br/><hr height="1px" width="100%" />
<p><small>© Daniel Molina Wegener for <a href="http://coder.cl">coder . cl</a>, 2010. | <a href="http://coder.cl/2010/07/c-type-casting-operators/">Permalink</a> | <a href="http://coder.cl/2010/07/c-type-casting-operators/#comments">No comment</a><br/>Post tags: <br/></small></p>
]]></content:encoded>
			<wfw:commentRss>http://coder.cl/2010/07/c-type-casting-operators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>configuring snmptrapd</title>
		<link>http://coder.cl/2010/07/configuring-snmptrapd/</link>
		<comments>http://coder.cl/2010/07/configuring-snmptrapd/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 23:28:27 +0000</pubDate>
		<dc:creator>Daniel Molina Wegener</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://coder.cl/?p=703</guid>
		<description><![CDATA[snmptrapd(8) is a SNMP trap daemon, in other words, it captures SNMP notifications from the network and similar devices. In this post I will try to explain how to configure this daemon to allow a network server to process SNMP traps using both, embeded perl handlers for snmptrapd(8) and plain standard input &#8212; or stdin [...]]]></description>
			<content:encoded><![CDATA[<p><strong>snmptrapd(8)</strong> is a SNMP trap daemon, in other words, it captures SNMP notifications from the network and similar devices. In this post I will try to explain how to configure this daemon to allow a network server to process SNMP traps using both, embeded perl handlers for <strong>snmptrapd(8)</strong> and plain standard input &mdash; or <i>stdin</i> &mdash; handlers.</p>
<p><span id="more-703"></span></p>
<p></p>
<h3>daemon configuration</h3>
<p>The daemon is quite easy to configure, you must setup the <strong>snmptrapd.conf(5snmp)</strong> file. For this configuration, you must read your desired configuration options, such as <i>logging</i> and <i>execution</i>. For example if we have a <i>community</i> called <i>inetsnmp</i>, we can configure the file to allow traps from that community and also configure a trap handler written in perl.</p>
<pre name="code" class="bash">

# configure inetsnmp community to allow logging,
# execution of handlers and network traffic.
authCommunity   log,execute,net         inetsnmp

# perl embeded handler.
perl do "/usr/share/snmp/handler/trapdembed.pl"
</pre>
<p>This configuration is not enough, the <strong>snmptrapd(8)</strong> daemon uses <strong>hosts.allow(5)</strong> facility, so we need to add the proper rule in that file:</p>
<pre name="code" class="bash">

snmptrapd : 192.168.100.0/255.255.255.0 : allow
snmptrapd : 10.10.10.0/255.255.255.0 : allow
</pre>
<p></p>
<h3>the embeded perl handler</h3>
<pre name="code" class="perl">
#!/usr/bin/perl -w
#

# strict perl is better
use strict;
use FileHandle;
use Data::Dumper;
use NetSNMP::TrapReceiver;

# we create a sample/demo log file...
my $log = FileHandle-&gt;new(&quot;/var/log/snmptrapsample.log&quot;, &quot;a+&quot;) ||
    die &quot;Failed to open log file&quot;;

# how we process an SNMP variable
sub process_var {
    my ($var) = @_;
    my %res;
    my $name = &quot;$var-&gt;[0]&quot;;
    my ($vt, $vv) = split /: /, &quot;$var-&gt;[1]&quot;;
    $res{'oid'} = $name;
    $res{'type'} = $vt;
    $res{'value'} = $vv;
    return \%res;
}

# our default receiver
sub default_receiver {
    my ($pdu, $ivars) = @_;
    my %vars;
    $log-&gt;print(Dumper($pdu));
    foreach my $k (@{$_[1]}) {
        $vars{$k-&gt;[0]} = process_var($k);
    }
    $log-&gt;print(Dumper(\%vars));
    $log-&gt;flush;
}

# every OIDs pass through the default_receiver
NetSNMP::TrapReceiver::register(&quot;all&quot;, \&amp;default_receiver) ||
    die &quot;Failed to laod Sample Trap Receiver\n&quot;;

# status message...
print STDERR &quot;Loaded Sample Trap Receiver\n&quot;;
</pre>
<p>This <strong>perl(1)</strong> handler will allow you basically to create a handler which is capable to process SNMP notifications creating two main variables on the handler itself <i>$pdu</i> which is the reference to the <i>%pdu</i> hash and <i>%vars</i> hash. Both hashes contains the proper data to process the request as you want:</p>
<pre name="code" class="perl">

%pdu = {
    'notificationtype' =&gt; 'TRAP',
    'receivedfrom' =&gt; 'UDP: [10.10.10.1]:53951-&gt;[192.168.100.5]',
    'version' =&gt; 1,
    'errorstatus' =&gt; 0,
    'messageid' =&gt; 0,
    'community' =&gt; 'public',
    'transactionid' =&gt; 1,
    'errorindex' =&gt; 0,
    'requestid' =&gt; 1012897136
};

%vars = {
    'IF-MIB::ifDescr' =&gt; {
        'value' =&gt; 'eth0',
        'type' =&gt; 'STRING',
        'oid' =&gt; 'IF-MIB::ifDescr'
    },
    'IF-MIB::ifAdminStatus.1' =&gt; {
        'value' =&gt; '1',
        'type' =&gt; 'INTEGER',
        'oid' =&gt; 'IF-MIB::ifAdminStatus.1'
    },
    'DISMAN-EVENT-MIB::sysUpTimeInstance' =&gt; {
        'value' =&gt; '(0) 0:00:00.00',
        'type' =&gt; 'Timeticks',
        'oid' =&gt; 'DISMAN-EVENT-MIB::sysUpTimeInstance'
    },
    'IF-MIB::ifIndex.1' =&gt; {
        'value' =&gt; '1',
        'type' =&gt; 'INTEGER',
        'oid' =&gt; 'IF-MIB::ifIndex.1'
    },
    'SNMPv2-MIB::snmpTrapOID.0' =&gt; {
        'value' =&gt; 'IF-MIB::linkUp',
        'type' =&gt; 'OID',
        'oid' =&gt; 'SNMPv2-MIB::snmpTrapOID.0'
    },
    'IF-MIB::ifOperStatus.1' =&gt; {
        'value' =&gt; '1',
        'type' =&gt; 'INTEGER',
        'oid' =&gt; 'IF-MIB::ifOperStatus.1'
    }
};
</pre>
<p>Where each OID or variable, can be treated by using the <strong>NetSNMP::OID</strong> package. Fora <i>stdin</i> handler, if you don&#8217;t know about <strong>perl(1)</strong>, the difference is made on the <strong>snmptrapd.conf(5snmp)</strong> file, instead of configuring a global perl script which itself registers which OIDs will handle, you need to configure a global trap handler or each handler for each OID that you want to handle:</p>
<pre name="code" class="bash">

# configure inetsnmp community to allow logging,
# execution of handlers and network traffic.
authCommunity   log,execute,net         inetsnmp

traphandle     default           /usr/share/snmp/handler/defaultstding.py   default
traphandle     IF-MIB::linkUp    /usr/share/snmp/handler/ifuphandler.py     up
</pre>
<p>This will make your script or application to receive the OID data from <i>stdin</i> as follows:</p>
<pre>
router
UDP: [10.10.10.1]:37745->[192.168.100.5]
DISMAN-EVENT-MIB::sysUpTimeInstance 0:0:00:00.00
SNMPv2-MIB::snmpTrapOID.0 IF-MIB::linkUp
IF-MIB::ifIndex.1 1
IF-MIB::ifAdminStatus.1 up
IF-MIB::ifOperStatus.1 up
IF-MIB::ifDescr eth0
</pre>
<p>And also will require that you will enable in some manner the processing of that data as <i>plain text</i>.</p>
<p>Good luck configuring SNMP traps <img src='http://coder.cl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>



share this article at: 


	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fconfiguring-snmptrapd%2F&amp;title=configuring%20snmptrapd&amp;source=coder+.+cl+system+programmer+%26amp%3B+web+developer&amp;summary=snmptrapd%288%29%20is%20a%20SNMP%20trap%20daemon%2C%20in%20other%20words%2C%20it%20captures%20SNMP%20notifications%20from%20the%20network%20and%20similar%20devices.%20In%20this%20post%20I%20will%20try%20to%20explain%20how%20to%20configure%20this%20daemon%20to%20allow%20a%20network%20server%20to%20process%20SNMP%20traps%20using%20both%2C%20embed" title="LinkedIn"><img src="http://coder.cl/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fconfiguring-snmptrapd%2F&amp;title=configuring%20snmptrapd&amp;notes=snmptrapd%288%29%20is%20a%20SNMP%20trap%20daemon%2C%20in%20other%20words%2C%20it%20captures%20SNMP%20notifications%20from%20the%20network%20and%20similar%20devices.%20In%20this%20post%20I%20will%20try%20to%20explain%20how%20to%20configure%20this%20daemon%20to%20allow%20a%20network%20server%20to%20process%20SNMP%20traps%20using%20both%2C%20embed" title="del.icio.us"><img src="http://coder.cl/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fconfiguring-snmptrapd%2F&amp;title=configuring%20snmptrapd&amp;bodytext=snmptrapd%288%29%20is%20a%20SNMP%20trap%20daemon%2C%20in%20other%20words%2C%20it%20captures%20SNMP%20notifications%20from%20the%20network%20and%20similar%20devices.%20In%20this%20post%20I%20will%20try%20to%20explain%20how%20to%20configure%20this%20daemon%20to%20allow%20a%20network%20server%20to%20process%20SNMP%20traps%20using%20both%2C%20embed" title="Digg"><img src="http://coder.cl/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fconfiguring-snmptrapd%2F&amp;title=configuring%20snmptrapd" title="Reddit"><img src="http://coder.cl/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fconfiguring-snmptrapd%2F&amp;t=configuring%20snmptrapd" title="Facebook"><img src="http://coder.cl/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=configuring%20snmptrapd%20-%20http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fconfiguring-snmptrapd%2F" title="Twitter"><img src="http://coder.cl/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fconfiguring-snmptrapd%2F&amp;title=configuring%20snmptrapd&amp;annotation=snmptrapd%288%29%20is%20a%20SNMP%20trap%20daemon%2C%20in%20other%20words%2C%20it%20captures%20SNMP%20notifications%20from%20the%20network%20and%20similar%20devices.%20In%20this%20post%20I%20will%20try%20to%20explain%20how%20to%20configure%20this%20daemon%20to%20allow%20a%20network%20server%20to%20process%20SNMP%20traps%20using%20both%2C%20embed" title="Google Bookmarks"><img src="http://coder.cl/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>


<br/><br/><br/><hr height="1px" width="50%" />
<div style='text-align: center !important;'><b>Copyright © 2010 Daniel Molina Wegener</b><br/><b>Atribución-No Comercial-Sin Derivadas 2.0 Chile</b><br/><a target='_new' rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/cl/"><img alt="Creative Commons License" style="border-width:0" src="/cc88x31.png" /></a></div>
<br/><hr height="1px" width="100%" />
<p><small>© Daniel Molina Wegener for <a href="http://coder.cl">coder . cl</a>, 2010. | <a href="http://coder.cl/2010/07/configuring-snmptrapd/">Permalink</a> | <a href="http://coder.cl/2010/07/configuring-snmptrapd/#comments">No comment</a><br/>Post tags: <br/></small></p>
]]></content:encoded>
			<wfw:commentRss>http://coder.cl/2010/07/configuring-snmptrapd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>query optimizations, quick recipes</title>
		<link>http://coder.cl/2010/07/query-optimizations-quick-recipes/</link>
		<comments>http://coder.cl/2010/07/query-optimizations-quick-recipes/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 13:13:24 +0000</pubDate>
		<dc:creator>Daniel Molina Wegener</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://coder.cl/?p=694</guid>
		<description><![CDATA[Optimizing SQL queries is quite simple task, you just need to follow some rules on how you sort the filtering criteria and how you use your select statements. I will try to explain how you can optimize your queries in this post. named columns Use named columns, instead of using the * wildcard. For example: [...]]]></description>
			<content:encoded><![CDATA[<p>Optimizing SQL queries is quite simple task, you just need to follow some rules on how you sort the filtering criteria and how you use your select statements. I will try to explain how you can optimize your queries in this post.</p>
<p><span id="more-694"></span></p>
<p></p>
<h3>named columns</h3>
<p>Use named columns, instead of using the <strong>*</strong> wildcard. For example:</p>
<pre name='code' class='sql'>
select
    t.*
from
    tbl as t
where
    t.tab_date > current_date - interval 1 month
order by
    t.tab_date desc;
</pre>
<p>Will be more slower than:</p>
<pre name='code' class='sql'>
select
    t.tab_id,
    t.tab_state,
    t.tab_date,
    t.tab_name
from
    tbl as t
where
    t.tab_date > current_date - interval 1 month
order by
    t.tab_date desc
</pre>
<p></p>
<h3>join filtering</h3>
<p>If you filter on join, your query will be faster, for example:</p>
<pre name='code' class='sql'>
select
    t1.tab_id,
    coalesce(t2.tab_date, current_date) as tab_date,
    t1.tab_name
from
    table1 as t1
        left join table2 as t2 on (t1.tab_id = t2.tab_tab_id)
where
    t2.tab_date IS NULL or t2.tab_date > current_date - interval 1 month;
</pre>
<p>Will be more slower than</p>
<pre name='code' class='sql'>
select
    t1.tab_id,
    coalesce(t2.tab_date, current_date) as tab_date,
    t1.tab_name
from
    table1 as t1
        left join table2 as t2 on (t1.tab_id = t2.tab_tab_id
            and t2.tab_date > current_date - interval 1 month);
</pre>
<p></p>
<h3>smaller set first</h3>
<p>The smaller set must selected first, for example:</p>
<pre name='code' class='sql'>
select
    t1.tab_id,
    coalesce(t2.tab_date, current_date) as tab_date,
    t1.tab_name
from
    table1 as t1
        left join table2 as t2 on (t2.tab_tab_id = t1.tab_id
            and t2.tab_date > current_date - interval 1 month);
</pre>
<p>Will be more slower than:</p>
<pre name='code' class='sql'>
select
    t1.tab_id,
    coalesce(t2.tab_date, current_date) as tab_date,
    t1.tab_name
from
    table1 as t1
        left join table2 as t2 on (t1.tab_id = t2.tab_tab_id
            and t2.tab_date > current_date - interval 1 month);
</pre>
<p>Since <tt>t1</tt> has less rows than <tt>t2</tt>, and <tt>t2</tt> is referencing <tt>t1</tt>. Assuming that <tt>t1</tt> has a smaller set of rows and is the referenced table. This applies to column selection too and where statements.</p>
<p></p>
<h3>notes</h3>
<p>You must measure the time of your queries, so you can have a more precise query. Those rules are not <i>absolute</i>.</p>



share this article at: 


	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fquery-optimizations-quick-recipes%2F&amp;title=query%20optimizations%2C%20quick%20recipes&amp;source=coder+.+cl+system+programmer+%26amp%3B+web+developer&amp;summary=Optimizing%20SQL%20queries%20is%20quite%20simple%20task%2C%20you%20just%20need%20to%20follow%20some%20rules%20on%20how%20you%20sort%20the%20filtering%20criteria%20and%20how%20you%20use%20your%20select%20statements.%20I%20will%20try%20to%20explain%20how%20you%20can%20optimize%20your%20queries%20in%20this%20post.%0D%0A%0D%0A%0D%0Anamed%20columns%0D%0A%0D" title="LinkedIn"><img src="http://coder.cl/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fquery-optimizations-quick-recipes%2F&amp;title=query%20optimizations%2C%20quick%20recipes&amp;notes=Optimizing%20SQL%20queries%20is%20quite%20simple%20task%2C%20you%20just%20need%20to%20follow%20some%20rules%20on%20how%20you%20sort%20the%20filtering%20criteria%20and%20how%20you%20use%20your%20select%20statements.%20I%20will%20try%20to%20explain%20how%20you%20can%20optimize%20your%20queries%20in%20this%20post.%0D%0A%0D%0A%0D%0Anamed%20columns%0D%0A%0D" title="del.icio.us"><img src="http://coder.cl/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fquery-optimizations-quick-recipes%2F&amp;title=query%20optimizations%2C%20quick%20recipes&amp;bodytext=Optimizing%20SQL%20queries%20is%20quite%20simple%20task%2C%20you%20just%20need%20to%20follow%20some%20rules%20on%20how%20you%20sort%20the%20filtering%20criteria%20and%20how%20you%20use%20your%20select%20statements.%20I%20will%20try%20to%20explain%20how%20you%20can%20optimize%20your%20queries%20in%20this%20post.%0D%0A%0D%0A%0D%0Anamed%20columns%0D%0A%0D" title="Digg"><img src="http://coder.cl/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fquery-optimizations-quick-recipes%2F&amp;title=query%20optimizations%2C%20quick%20recipes" title="Reddit"><img src="http://coder.cl/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fquery-optimizations-quick-recipes%2F&amp;t=query%20optimizations%2C%20quick%20recipes" title="Facebook"><img src="http://coder.cl/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=query%20optimizations%2C%20quick%20recipes%20-%20http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fquery-optimizations-quick-recipes%2F" title="Twitter"><img src="http://coder.cl/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fcoder.cl%2F2010%2F07%2Fquery-optimizations-quick-recipes%2F&amp;title=query%20optimizations%2C%20quick%20recipes&amp;annotation=Optimizing%20SQL%20queries%20is%20quite%20simple%20task%2C%20you%20just%20need%20to%20follow%20some%20rules%20on%20how%20you%20sort%20the%20filtering%20criteria%20and%20how%20you%20use%20your%20select%20statements.%20I%20will%20try%20to%20explain%20how%20you%20can%20optimize%20your%20queries%20in%20this%20post.%0D%0A%0D%0A%0D%0Anamed%20columns%0D%0A%0D" title="Google Bookmarks"><img src="http://coder.cl/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>


<br/><br/><br/><hr height="1px" width="50%" />
<div style='text-align: center !important;'><b>Copyright © 2010 Daniel Molina Wegener</b><br/><b>Atribución-No Comercial-Sin Derivadas 2.0 Chile</b><br/><a target='_new' rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/cl/"><img alt="Creative Commons License" style="border-width:0" src="/cc88x31.png" /></a></div>
<br/><hr height="1px" width="100%" />
<p><small>© Daniel Molina Wegener for <a href="http://coder.cl">coder . cl</a>, 2010. | <a href="http://coder.cl/2010/07/query-optimizations-quick-recipes/">Permalink</a> | <a href="http://coder.cl/2010/07/query-optimizations-quick-recipes/#comments">No comment</a><br/>Post tags: <br/></small></p>
]]></content:encoded>
			<wfw:commentRss>http://coder.cl/2010/07/query-optimizations-quick-recipes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>database usage rules</title>
		<link>http://coder.cl/2010/04/database-usage-rules/</link>
		<comments>http://coder.cl/2010/04/database-usage-rules/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 14:39:55 +0000</pubDate>
		<dc:creator>Daniel Molina Wegener</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://coder.cl/?p=683</guid>
		<description><![CDATA[Modelling databases is not a simple task. Many times we found some misspelled words, mixed case words and some horrifying things on many databases of third party systems. My rules are simple to follow, and most of them ensures a well designed database, with special care on how do we query that database, creating reliable [...]]]></description>
			<content:encoded><![CDATA[<p>Modelling databases is not a simple task. Many times we found some misspelled words, mixed case words and some horrifying things on many databases of third party systems. My rules are simple to follow, and most of them ensures a well designed database, with special care on how do we query that database, creating reliable and optimised for speed table design and queries.</p>
<p><span id="more-683"></span></p>
<p><br/></p>
<h3>table design</h3>
<p>You must follow a simple rule, <i>fixed length</i> data types goes first, from the one that fits with <i>CPU register length</i> to those types that have variable length. For example a a simple table design for MySQL could be as follows:</p>
<pre name='code' class='sql'>
CREATE TABLE customer
(
    customer_id bigint(11) NOT NULL AUTO_INCREMENT,
    cus_priority int NOT NULL,
    cus_state int NOT NULL,
    cus_products int NOT NULL,
    cus_date datetime NOT NULL,
    cus_name varchar(100) NOT NULL,
    cus_email varchar(50) NOT NULL,
    PRIMARY KEY USING BTREE (customer_id)
)
ENGINE= InnoDB DEFAULT CHARSET= utf8
</pre>
<p>If you take a look on the column order, fixed length table keys have the first priority, fixed length data types have the second priority and the last priority on the table creation script is for those types with variable length. From the perspective of the RDBMS system that we are using, the table structure is read the first time that we query the table, then each fixed length column is read in sequence as the RDBMS systems reads each row from the disk or memory, hence each non-fixed length column is read consequently each time that a row is handled, reading the column length first and then skipping the column offset on the disk or memory to handle the next column. So, reading non-fixed length columns is hard for the RDBMS.</p>
<p>Imagine those tables created with <i>variable length keys</i>!, those tables are creating a heavy overhead on any kind of table created. So, try to use table keys of fixed length, such as <i>int</i> and <i>bigint</i>. Including those tables which have a fixed length made of <i>char(n)</i>, are creating a heavy overhead, since those tables are using <i>string comparison algorithms</i> instead of <i>memory block</i> comparison, such as comparing integer types, which is more easy to handle.</p>
<p>Using a naming convention matters too. The table above has a lowercase name, lower case table fields and each field has a prefix related to the table. Why does they have a prefix?, while we are querying a table is more comfortable to identify them by the prefix that they have, specially when we are creating joined queries, allowing unique column identifiers.</p>
<p><br/></p>
<h3>query optimisation</h3>
<p>Some older RDBMS systems do not support the usage of the <i>join</i> keyword, so we must create joined queries using the <i>where</i> statement. But nowdays in most RDBMS systems supports the <i>join</i> keyword, allowing more faster queries, so there is a technique allowing us to create joins from the older way of using <i>where</i> statements.</p>
<pre name='code' class='sql'>
select
    pro.product_id,
    pro.pro_name,
    sum(coalesce(pay.pay_price, 0.0)) as payment
from
    product as pro
        left join subscription as sus on (pro.product_id = sus.product_id)
        left join payment as pay on (sus.payment_id = pay.payment_id)
group by
    pro.product_id,
    pro.pro_name
order by
    pro.product_id,
    pro.pro_name
</pre>
<p>The query above will bring us a report about <i>payments</i> related to each product on the database. If you see there is no where statement. Also, examine the join conditionals, the <i>smallest</i> dataset is filtered at the <i>left side</i> of the conditional. The more we filter on the join conditionals, faster is the query result. That query took just <i>0.002</i> seconds. Let&#8217;s see what happens with a non-joined query and using the <i>where</i> statement.</p>
<pre name='code' class='sql'>
select
    pro.product_id,
    pro.pro_name,
    sum(coalesce(pay.pay_price, 0.0)) as payments
from
    product as pro,
    subscription as sus,
    payment as pay
where
    (pro.product_id = sus.product_id and sus.product_id is not null)
    and (pro.product_id = sus.product_id or sus.product_id is null)
    and (sus.payment_id = pay.payment_id or pay.payment_id is null)
group by
    pro.product_id,
    pro.pro_name
order by
    pro.product_id,
    pro.pro_name
</pre>
<p>Using the <i>where</i> statement, the same query took <i>0.012</i> seconds. What happened behind on the RDBMS side? On the first query, row filtering was made while the RDBMS was reading rows from each table, hence on the second query, the selection was made over the complete dataset retrieved from all selection tables. In this case we have an enhancement of <i>600%</i> on performance, on more complex queries the same happens. Also the <i>having</i> clause is evil too, since it process those rows retrieved after the selection process on those rows retrieved on at last.</p>
<pre name='code' class='sql'>

select
    pro.product_id,
    pro.pro_name,
    sum(coalesce(pay.pay_price, 0.0)) as payment
from
    product as pro
        left join subscription as sus on (pro.product_id = sus.product_id)
        left join payment as pay on (sus.payment_id = pay.payment_id)
group by
    pro.product_id,
    pro.pro_name
having
    payment > 200000
order by
    pro.product_id,
    pro.pro_name
</pre>
<p>The <i>having</i> clause can process <i>aggregate columns</i>, but that processing is made at end of the selection process, so you must try to replace that <i>having</i> clause by other join or where statement if you have an option to do that.</p>
<p><br/></p>
<h3>rdbms tuning</h3>
<p>Each RDBMS has its own parameters. For example, MySQL have some parameters which allow you to have entire tables on memory, so most queries to those tables in memory are faster than reading the hard drive. If you have a system that is querying a database concurrently, you should increase the memory limit, allowing the RDBMS to maintain that table on memory. You must research which options fits for better on the RDBMS that you are using, which kind of keys and table format fits better with your needs. For example on MySQL InnoDB table format is not always the best option, since InnoDB require the highest resource usage, over other kind of tables available on MySQL RDBMS.</p>



share this article at: 


	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fdatabase-usage-rules%2F&amp;title=database%20usage%20rules&amp;source=coder+.+cl+system+programmer+%26amp%3B+web+developer&amp;summary=Modelling%20databases%20is%20not%20a%20simple%20task.%20Many%20times%20we%20found%20some%20misspelled%20words%2C%20mixed%20case%20words%20and%20some%20horrifying%20things%20on%20many%20databases%20of%20third%20party%20systems.%20My%20rules%20are%20simple%20to%20follow%2C%20and%20most%20of%20them%20ensures%20a%20well%20designed%20databas" title="LinkedIn"><img src="http://coder.cl/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fdatabase-usage-rules%2F&amp;title=database%20usage%20rules&amp;notes=Modelling%20databases%20is%20not%20a%20simple%20task.%20Many%20times%20we%20found%20some%20misspelled%20words%2C%20mixed%20case%20words%20and%20some%20horrifying%20things%20on%20many%20databases%20of%20third%20party%20systems.%20My%20rules%20are%20simple%20to%20follow%2C%20and%20most%20of%20them%20ensures%20a%20well%20designed%20databas" title="del.icio.us"><img src="http://coder.cl/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fdatabase-usage-rules%2F&amp;title=database%20usage%20rules&amp;bodytext=Modelling%20databases%20is%20not%20a%20simple%20task.%20Many%20times%20we%20found%20some%20misspelled%20words%2C%20mixed%20case%20words%20and%20some%20horrifying%20things%20on%20many%20databases%20of%20third%20party%20systems.%20My%20rules%20are%20simple%20to%20follow%2C%20and%20most%20of%20them%20ensures%20a%20well%20designed%20databas" title="Digg"><img src="http://coder.cl/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fdatabase-usage-rules%2F&amp;title=database%20usage%20rules" title="Reddit"><img src="http://coder.cl/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fdatabase-usage-rules%2F&amp;t=database%20usage%20rules" title="Facebook"><img src="http://coder.cl/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=database%20usage%20rules%20-%20http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fdatabase-usage-rules%2F" title="Twitter"><img src="http://coder.cl/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fdatabase-usage-rules%2F&amp;title=database%20usage%20rules&amp;annotation=Modelling%20databases%20is%20not%20a%20simple%20task.%20Many%20times%20we%20found%20some%20misspelled%20words%2C%20mixed%20case%20words%20and%20some%20horrifying%20things%20on%20many%20databases%20of%20third%20party%20systems.%20My%20rules%20are%20simple%20to%20follow%2C%20and%20most%20of%20them%20ensures%20a%20well%20designed%20databas" title="Google Bookmarks"><img src="http://coder.cl/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>


<br/><br/><br/><hr height="1px" width="50%" />
<div style='text-align: center !important;'><b>Copyright © 2010 Daniel Molina Wegener</b><br/><b>Atribución-No Comercial-Sin Derivadas 2.0 Chile</b><br/><a target='_new' rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/cl/"><img alt="Creative Commons License" style="border-width:0" src="/cc88x31.png" /></a></div>
<br/><hr height="1px" width="100%" />
<p><small>© Daniel Molina Wegener for <a href="http://coder.cl">coder . cl</a>, 2010. | <a href="http://coder.cl/2010/04/database-usage-rules/">Permalink</a> | <a href="http://coder.cl/2010/04/database-usage-rules/#comments">No comment</a><br/>Post tags: <br/></small></p>
]]></content:encoded>
			<wfw:commentRss>http://coder.cl/2010/04/database-usage-rules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>using dependency injection on gui</title>
		<link>http://coder.cl/2010/04/using-dependency-injection-on-gui/</link>
		<comments>http://coder.cl/2010/04/using-dependency-injection-on-gui/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 17:04:32 +0000</pubDate>
		<dc:creator>Daniel Molina Wegener</dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://coder.cl/?p=670</guid>
		<description><![CDATA[Many people know the Model View Controller architectural pattern. Another interesting pattern is Presentation Abstraction Control architectural pattern. We can implement it using Dependency Injection or similar Inversion of Control patterns. So, when we are modeling solutions, we many times leave the control or business logic on the Controller. This will guide us to a [...]]]></description>
			<content:encoded><![CDATA[<p>Many people know the <i>Model View Controller</i> architectural pattern. Another interesting pattern is <i>Presentation Abstraction Control</i> architectural pattern. We can implement it using <i>Dependency Injection</i> or similar <i>Inversion of Control</i> patterns. So, when we are modeling solutions, we many times leave the control or business logic on the <i>Controller</i>. This will guide us to a very coupled platform. Remember that any well designed architecture claims for cohesion instead of coupling its components. On this article I will try to analyze the use of IoC on the PAC pattern, so we can have more maintainable software components, mainly on <i>n-tier architectures</i>.</p>
<p><span id="more-670"></span></p>
<p><br/></p>
<h3>control classes and interfaces</h3>
<p>We can hold our business logic on separate classes. As example we will use a <i>bank loan</i> application, which is supposed to bring us the proper load for certain kind of customers of a bank. So, we need to define an interface pf the loan component.</p>
<pre name='code' class='java'>
interface Loan {
    void setUserData(User bankUser);
    void setCustomerData(Customer cus, Account acc);
    LoanResults getLoanResults();
}
</pre>
<p>This simple interface should be implemented by a variety of Loan types, from consumer ones to mortgage ones, since this variety of loans have different evaluation and estimation logic.</p>
<div style='border: 1px solid #000; text-align: center; overflow: scroll;'>
<img src='http://coder.cl/uploads/2010/04/loan-classes.png' title='Loan Classes' alt='Loan Classes' width='510'>
</div>
<p>Now we need to define a way to instantiate the proper Loan implementation. The proper Loan implementation request is on the hands of the control layer, since the Loan interface is the <i>abstraction</i> layer itself. So, if we have to need the same methods for every Loan that we request, we just use a <i>Factory Pattern</i> returning the interface Loan, instead of his real implementation.</p>
<p><br/></p>
<h3>the abstraction layer</h3>
<p>The abstraction layer is implemented on the Loan interface and its returning implementation based on the factory pattern. So we need to implement the factory outside of the package that holds that set of interfaces and implementations. The factory also hold the logic that <i>decides</i> which Loan implementation will be returned, based on the user data, customer data and account data. So we need a call similar to this one:</p>
<pre name='code' class='java'>
Loan loanRequest = LoanFactory.getInstance(data);
LoanResults requestResults = loanRequest.getLoanResults();
</pre>
<p>So, the <i>factory</i> and the <i>loan interface</i> holds the abstraction layer, separating the decoupling the business logic from its real implementation and generating more cohesion. What does the loan request form in the application about those components? The answer is quiet simple: nothing. We will use another pattern to hold input data and pass it through the abstraction layer from the presentation layer. Here is when we are doing <i>dependency injection</i>.</p>
<p><br/></p>
<h3>the presentation layer</h3>
<p>The presentation layer, which in this case holds a simple <i>LoanRequestForm</i> will never know which concrete class will be used to deliver the <i>LoanResults</i>, so we have to define an instance of another pattern, an <i>Adapter</i>. The adapter should transform the input data from the LoanRequestForm to some kind of Data Transfer Object, to be passed to the factory as CustomerData.</p>
<pre name='code' class='java'>
class LoanRequestForm {
    protected Customer cus;
    protected User usr;
    protected Account acc;
    protected LoanRequestFormAdapter adapter = new LoanRequestFormAdapter();
    protected Loan loanRequest;

    LoanResults getLoanResults() {
        try {
            loanRequest = LoanFactory.getInstance(adapter.transform(this));
            LoanResults requestResults = loanRequest.getLoanResults();
            return requestResults;
        } catch (InvalidDataException ex) {
            log.error(ex);
        }
    }
}
</pre>
<p>Here we are injecting a dependency for the LoanRequestForm and also we acquiring abstraction through the LoanFactory, transforming its input using the LoanRequestFormAdapter to transform the form data into a DTO (Data Transfer Object). The business logic is completely separated from the its User Interface and the abstraction layer. So we are fitting the model with PAC pattern and the IoC DI pattern at once.</p>
<div style='border: 1px solid #000; text-align: center; overflow: scroll;'>
<img src='http://coder.cl/uploads/2010/04/di-pattern-pac-pattern.png' title='Loan Classes' alt='Loan Classes' width='510'>
</div>
<p>The transformation between the form and the factory is a must. The factory can not depend on the form and the form can not depend on the factory. The adapter plays an important role here, since it&#8217;s separating layers and transforming the application into an <i>n-tier architected</i> application, so we have more control over changes and possible enhancements on the model. Also it will bring us possible automated processes, since the factory do not needs the form to operate over the loan. So you build another application that just handles the user data and generate loan bids automatically to the customers based on the same logic, then we are reusing the properly the code.</p>
<p><br/></p>
<h3>conclusion</h3>
<p>We can glue the PAC pattern with IoC DI pattern, so we have more reliable and flexible GUI implementations, then we can work in our platforms without worries about how to generate reusable code if we follow well designed and well applied patterns. Also we can use frameworks, but it depends on the application size and how do need to work on it. For an application with just two active forms, we do not need large scale architectures.</p>



share this article at: 


	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fusing-dependency-injection-on-gui%2F&amp;title=using%20dependency%20injection%20on%20gui&amp;source=coder+.+cl+system+programmer+%26amp%3B+web+developer&amp;summary=Many%20people%20know%20the%20Model%20View%20Controller%20architectural%20pattern.%20Another%20interesting%20pattern%20is%20Presentation%20Abstraction%20Control%20architectural%20pattern.%20We%20can%20implement%20it%20using%20Dependency%20Injection%20or%20similar%20Inversion%20of%20Control%20patterns.%20So%2C%20when" title="LinkedIn"><img src="http://coder.cl/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fusing-dependency-injection-on-gui%2F&amp;title=using%20dependency%20injection%20on%20gui&amp;notes=Many%20people%20know%20the%20Model%20View%20Controller%20architectural%20pattern.%20Another%20interesting%20pattern%20is%20Presentation%20Abstraction%20Control%20architectural%20pattern.%20We%20can%20implement%20it%20using%20Dependency%20Injection%20or%20similar%20Inversion%20of%20Control%20patterns.%20So%2C%20when" title="del.icio.us"><img src="http://coder.cl/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fusing-dependency-injection-on-gui%2F&amp;title=using%20dependency%20injection%20on%20gui&amp;bodytext=Many%20people%20know%20the%20Model%20View%20Controller%20architectural%20pattern.%20Another%20interesting%20pattern%20is%20Presentation%20Abstraction%20Control%20architectural%20pattern.%20We%20can%20implement%20it%20using%20Dependency%20Injection%20or%20similar%20Inversion%20of%20Control%20patterns.%20So%2C%20when" title="Digg"><img src="http://coder.cl/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fusing-dependency-injection-on-gui%2F&amp;title=using%20dependency%20injection%20on%20gui" title="Reddit"><img src="http://coder.cl/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fusing-dependency-injection-on-gui%2F&amp;t=using%20dependency%20injection%20on%20gui" title="Facebook"><img src="http://coder.cl/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=using%20dependency%20injection%20on%20gui%20-%20http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fusing-dependency-injection-on-gui%2F" title="Twitter"><img src="http://coder.cl/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fusing-dependency-injection-on-gui%2F&amp;title=using%20dependency%20injection%20on%20gui&amp;annotation=Many%20people%20know%20the%20Model%20View%20Controller%20architectural%20pattern.%20Another%20interesting%20pattern%20is%20Presentation%20Abstraction%20Control%20architectural%20pattern.%20We%20can%20implement%20it%20using%20Dependency%20Injection%20or%20similar%20Inversion%20of%20Control%20patterns.%20So%2C%20when" title="Google Bookmarks"><img src="http://coder.cl/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>


<br/><br/><br/><hr height="1px" width="50%" />
<div style='text-align: center !important;'><b>Copyright © 2010 Daniel Molina Wegener</b><br/><b>Atribución-No Comercial-Sin Derivadas 2.0 Chile</b><br/><a target='_new' rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/cl/"><img alt="Creative Commons License" style="border-width:0" src="/cc88x31.png" /></a></div>
<br/><hr height="1px" width="100%" />
<p><small>© Daniel Molina Wegener for <a href="http://coder.cl">coder . cl</a>, 2010. | <a href="http://coder.cl/2010/04/using-dependency-injection-on-gui/">Permalink</a> | <a href="http://coder.cl/2010/04/using-dependency-injection-on-gui/#comments">No comment</a><br/>Post tags: <br/></small></p>
]]></content:encoded>
			<wfw:commentRss>http://coder.cl/2010/04/using-dependency-injection-on-gui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>a perspective on code quality</title>
		<link>http://coder.cl/2010/04/a-perspective-on-code-quality/</link>
		<comments>http://coder.cl/2010/04/a-perspective-on-code-quality/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 14:31:54 +0000</pubDate>
		<dc:creator>Daniel Molina Wegener</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://coder.cl/?p=665</guid>
		<description><![CDATA[How can we measure the software quality? There are many perspectives on that issue of software development. Matthew Wilson has spotted some evaluations that we can follow to improve the quality of our code and bring us a wide perspective on what does matter when we are evaluating the software quality. Correctness: Software correctness can [...]]]></description>
			<content:encoded><![CDATA[<p>How can we measure the software quality? There are many perspectives on that issue of software development. Matthew Wilson has spotted some evaluations that we can follow to improve the quality of our code and bring us a wide perspective on what does matter when we are evaluating the software quality.</p>
<p><span id="more-665"></span></p>
<ul>
<li><strong>Correctness</strong>:
<p>Software correctness can be established using many techniques and tools, from <i>static analysis</i>, <i>runtime checkers</i> and <i>formal verification</i>. So we have enough tools to determine whether or not the software is correct. Also we can search for the proper algorithm, previously verified and tested to being used in our software.</p>
</li>
<li><strong>Robustness</strong>:
<p>We must try to create small and efficient code, regarding correctness and documenting it, so can create hardened code based on common standards to allow reliable modifications while we are maintaining the code. <a href='http://en.wikipedia.org/wiki/Jon_Postel'>Jon Postel</a>&#8216;s law says: <i>&quot;Be conservative in what you do; be liberal in what you accept from others&quot;</i>. This also reduces the amount of bugs that you can find on your applications.</p>
</li>
<li><strong>Efficiency</strong>:
<p>Efficient code has lower times and reduced cyclomatic complexity. For example we must prefer a construct that is <i>O(1)</i> instead of one that is <i>O(n)</i>, if it is available, and we must prefer a construct that has a cyclomatic complexity of <i>78</i> rather than other with <i>129</i>: <i>&quot;simplicity is divine&quot;</i>.</p>
</li>
<li><strong>Portability</strong>:
<p>The code must be portable. To create portable code we must simply omit the usage of language/platform specific features. There many standards that we can follow to create portable code and there also are compiler options to help us in that task. For example, GCC supports pedantic compiling flags to regard the strictness of some standards, try compiling your C code with: <tt>-Wall -Wextra -Wshadow -pedantic -std=c99</tt>, or your C++ code with: <tt>-Wall -Wextra -Wshadow -pedantic -std=c++98</tt>. Also there is a compiler with the portability issue in mind, the <a href='http://en.wikipedia.org/wiki/Tendra'>TENDRA</a> compiler, it comes with a <i>static analysis</i> tool too.</p>
</li>
<li><strong>Expressiveness</strong>:
<p>We must create legible code, this principle holds well known coding standards, naming conventions and similar scopes on how do we write the code, to let others read your code and understand it with a faster lookup to the documentation. Also documenting the code is a must. I&#8217;m sure that you can follow some standard on coding.</p>
</li>
<li><strong>Flexibility</strong>:
<p>We must try to use abstraction in our code, instead of concrete system calls. For example we have <i>dirent</i> on UNIX and <i>WIN32_FIND_DATA</i> on Windows, both structures are completely different and most Win32 API calls aren&#8217;t based on any known standard, so we need to create or use some kind of abstraction to access the system calls, like the <i>Façade</i> design pattern, to allow us to omit direct calls and create more flexible code, and easy to maintain.</p>
</li>
<li><strong>Modularity</strong>:
<p>It&#8217;s fully recommended that we must think on terms of OOP. For C programmers the book <i>&quot;<a href='http://www.planetpdf.com/codecuts/pdfs/ooc.pdf'>Object-oriented programming with ANSI-C</a>&quot;</i> possibly is a must read. Modularity bring us the robustness needed to operate on terms of cohesion, like any desired architecture, we want to implement <i>cohesion</i> instead of <i>attachment</i>, so we can create reusable code and modules.</p>
</li>
<li><strong>Discoverability</strong>:
<p>legible and modular code bring us a good discoverability, so we can establish good basis on well known standard APIs, like POSIX, C++0x and many others. This regards the intuitive approach of building portable code, so we can guess about how is called the function or class that we need to use in our problem.</p>
</li>
<li><strong>Transparency</strong>:
<p>In conjunction with modularity, transparency can bring us the proper cohesion between our software components. The proper abstraction layer between the application tiers allow us to create individual components that work together without <i>attachment</i> and with the proper <i>cohesion</i>. So the maintainability of the application becomes higher and easy.</p>
</ul>
<p>And here comes some questions: How can we measure all those points?; How can we become more strict and bring more reliable applications?. We must follow some steps to reach optimal software development process. The first one is to define the <i>application architecture</i>, so we can handle common problems with the proper <i>architectural patterns</i>. Then we must fit those <i>architectural patterns</i> with the proper <i>design patterns</i>. One time defined the <i>application architecture</i> we must design our components following that architecture. If we are using <i>Agile Methodologies</i>, we need a well defined architecture too, so we can follow a common paradigm on <i>how to solve</i> the problem that the application is solving.</p>
<p>Using third party frameworks or third party libraries is not a bad practice, but we must be constantly following its <i>roadmap</i>, looking the direction that the library or framework is following, so we can handle properly an incoming and imminent update. How to handle that issue?, using abstractions and modularity, which also reduces the amount of bugs. Here some patterns plays an important role in our quality goals, for example the <i>façade</i>, <i>factory</i> and <i>dependency inyection</i> patterns would help us on that task.</p>
<p><br/></p>
<h3>conclusion</h3>
<p>The more rigorous we are, we can get more reliable software. But sometimes we don&#8217;t have enough time or simply we don&#8217;t need to be too rigurous, for example we can not apply <i>formal verification</i> to enterprise applications, because usually those applications have millions of lines of code, instead possibly we can deliver just one module at time that has been verified formally. Instead we can use <i>metrics analyzers</i>, <i>static analyzers</i> and <i>runtime checkers</i> to bring us a better approach on how the code is working. You can learn <i>code hardening</i> techniques and <i>debugging techniques</i> to ensure your code too, which will bring you a better code if you get well taught on those topics.</p>



share this article at: 


	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-perspective-on-code-quality%2F&amp;title=a%20perspective%20on%20code%20quality&amp;source=coder+.+cl+system+programmer+%26amp%3B+web+developer&amp;summary=How%20can%20we%20measure%20the%20software%20quality%3F%20There%20are%20many%20perspectives%20on%20that%20issue%20of%20software%20development.%20Matthew%20Wilson%20has%20spotted%20some%20evaluations%20that%20we%20can%20follow%20to%20improve%20the%20quality%20of%20our%20code%20and%20bring%20us%20a%20wide%20perspective%20on%20what%20does" title="LinkedIn"><img src="http://coder.cl/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-perspective-on-code-quality%2F&amp;title=a%20perspective%20on%20code%20quality&amp;notes=How%20can%20we%20measure%20the%20software%20quality%3F%20There%20are%20many%20perspectives%20on%20that%20issue%20of%20software%20development.%20Matthew%20Wilson%20has%20spotted%20some%20evaluations%20that%20we%20can%20follow%20to%20improve%20the%20quality%20of%20our%20code%20and%20bring%20us%20a%20wide%20perspective%20on%20what%20does" title="del.icio.us"><img src="http://coder.cl/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-perspective-on-code-quality%2F&amp;title=a%20perspective%20on%20code%20quality&amp;bodytext=How%20can%20we%20measure%20the%20software%20quality%3F%20There%20are%20many%20perspectives%20on%20that%20issue%20of%20software%20development.%20Matthew%20Wilson%20has%20spotted%20some%20evaluations%20that%20we%20can%20follow%20to%20improve%20the%20quality%20of%20our%20code%20and%20bring%20us%20a%20wide%20perspective%20on%20what%20does" title="Digg"><img src="http://coder.cl/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-perspective-on-code-quality%2F&amp;title=a%20perspective%20on%20code%20quality" title="Reddit"><img src="http://coder.cl/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-perspective-on-code-quality%2F&amp;t=a%20perspective%20on%20code%20quality" title="Facebook"><img src="http://coder.cl/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=a%20perspective%20on%20code%20quality%20-%20http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-perspective-on-code-quality%2F" title="Twitter"><img src="http://coder.cl/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-perspective-on-code-quality%2F&amp;title=a%20perspective%20on%20code%20quality&amp;annotation=How%20can%20we%20measure%20the%20software%20quality%3F%20There%20are%20many%20perspectives%20on%20that%20issue%20of%20software%20development.%20Matthew%20Wilson%20has%20spotted%20some%20evaluations%20that%20we%20can%20follow%20to%20improve%20the%20quality%20of%20our%20code%20and%20bring%20us%20a%20wide%20perspective%20on%20what%20does" title="Google Bookmarks"><img src="http://coder.cl/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>


<br/><br/><br/><hr height="1px" width="50%" />
<div style='text-align: center !important;'><b>Copyright © 2010 Daniel Molina Wegener</b><br/><b>Atribución-No Comercial-Sin Derivadas 2.0 Chile</b><br/><a target='_new' rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/cl/"><img alt="Creative Commons License" style="border-width:0" src="/cc88x31.png" /></a></div>
<br/><hr height="1px" width="100%" />
<p><small>© Daniel Molina Wegener for <a href="http://coder.cl">coder . cl</a>, 2010. | <a href="http://coder.cl/2010/04/a-perspective-on-code-quality/">Permalink</a> | <a href="http://coder.cl/2010/04/a-perspective-on-code-quality/#comments">No comment</a><br/>Post tags: <br/></small></p>
]]></content:encoded>
			<wfw:commentRss>http://coder.cl/2010/04/a-perspective-on-code-quality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>a successful team</title>
		<link>http://coder.cl/2010/04/a-successful-team/</link>
		<comments>http://coder.cl/2010/04/a-successful-team/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 16:50:17 +0000</pubDate>
		<dc:creator>Daniel Molina Wegener</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://coder.cl/?p=655</guid>
		<description><![CDATA[Few people is capable to understand the meaning of working in teams. Among other things, on a team we need to set the proper communication channels. My last assignment as employee of a company was Software Architect for a set of projects for a new client on the company. I was in need to do [...]]]></description>
			<content:encoded><![CDATA[<p>Few people is capable to understand the meaning of working in teams. Among other things, on a team we need to set the proper communication channels. My last assignment as employee of a company was <i>Software Architect</i> for a set of projects for a new client on the company. I was in need to do research about the platform where we were working on and I don&#8217;t mean the third party pieces, such as language, application server and related stuff, I mean the <i>enterprise application</i>. It was poorly documented, so we need to harvest the code seeking for answers.</p>
<p><span id="more-655"></span></p>
<p>As result, we got a nice architecture design, very applicable to most problems present on the platform. Also, I was capable to answer many questions about the <i>enterprise application</i>. Many of those answers were made based on reverse engineering the source code, tracking every step and tracing component execution. Each member was capable to read some books that we recommended with the Project Manager and understand the third party software, like <i>Google Web Toolkit</i> and <i>Apache FOP</i>. The Project Manager was a good leader guiding the team to the right direction on what to read and how self taught those technologies, while I was doing the proper research, then we got a good team response, and being considered as a good provider.</p>
<p>The key on success was nobody was afraid to ask about the <i>enterprise application</i>, so each member of the team was capable to understand how to interact with  those layers that were not accessible as source code &mdash; like a black box &mdash; and that everyone on the team was responsible of learning the techonologies related to the team work: &quot;<i>read that book</i>&quot;, &quot;<i>read that blog article</i>&quot;, &quot;<i>take a look on this specification</i>&quot; and some other phrases were common on that team, so everyone was capable to understand their own task.</p>
<div style='border: 1px solid #000; text-align: center;'>
<img src='http://coder.cl/uploads/2010/04/team-organization.png' border='0' />
</div>
<p>Most questions were channeled directly to the project manager, then I he was capable to answer, the problem was solved on the fly. In other case, the problem was delivered to me as software architect. Also, team members were capable to ask me directly. Also, most questions were made on SCRUM sessions, and few ones were asked outside of those SCRUM sessions. Few books on <i>Software Architecture</i>, <i>JavaEE Design Patterns</i>, <i>Design Patterns</i> and <i>Architectural Patterns</i>, bring us a wide perspective on how to solve most problems for the kind of components that we were developing. So, most problems were found on the black-box-like <i>enterprise application</i>, since we were having few referrals.</p>
<p>Even if one <i>software engineer</i> was considered &mdash; before joining the team &mdash; as an NNPP or bad programmer, on the team we got a good result. I agree with <i>Phillip G. Armour</i> in his article <i>&quot;In Prise of Bad Programmers&quot;</i>, where he treat this problem as an advantage to make stronger teams:</p>
<blockquote><p>
Sometimes the teams are not made up of all superheroes and when the team asserts itself to overcome some limitation, even with its own personnel, it can become better than it would have been without limitations.
</p></blockquote>
<p>All team members were capable to learn about the <i>enterprise application</i> without the pressure of of not having someone supporting them and fear to commit bugs into the VCS. The were constantly improving their skills, by different reasons, but everyone was <i>learning</i>. As spotted <i>Pete Godlife</i> on his article <i>&quot;Live to love Learning&quot;</i>:</p>
<blockquote><p>
Your motivation might be to keep yourself fresh, to sharpen your existing skills or simply to satisfy your natural curiosity. Or the reason might be more mercenary: to strengthen your employability, or allow you to move into a programming field you are more interested in.
</p></blockquote>
<div style='border: 1px solid #000; text-align: center;'>
<img src='http://coder.cl/uploads/2010/04/question-model.png' border='0' />
</div>
<p><br/></p>
<h3>conclusion</h3>
<p>On every new <i>application</i> which requires new components or maintenance, we need to research it, we must invest time looking on how it works, how affects any change and how we can contribute to improve its construction. Analysis capability is learned along the time and acquired by studying applications and code, you can not request a 100% successful development to someone that do not have the proper guide on a large <i>enterprise application</i>, you need someone doing research on it, doing reverse engineering if it is not documented and let the people learn from that member that have the advantage, even if the application <a href='http://i.imgur.com/yzVW1.jpg'>looks like this one</a> &mdash; which fortunately isn&#8217;t the case in this post.</p>



share this article at: 


	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-successful-team%2F&amp;title=a%20successful%20team&amp;source=coder+.+cl+system+programmer+%26amp%3B+web+developer&amp;summary=Few%20people%20is%20capable%20to%20understand%20the%20meaning%20of%20working%20in%20teams.%20Among%20other%20things%2C%20on%20a%20team%20we%20need%20to%20set%20the%20proper%20communication%20channels.%20My%20last%20assignment%20as%20employee%20of%20a%20company%20was%20Software%20Architect%20for%20a%20set%20of%20projects%20for%20a%20new%20cl" title="LinkedIn"><img src="http://coder.cl/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-successful-team%2F&amp;title=a%20successful%20team&amp;notes=Few%20people%20is%20capable%20to%20understand%20the%20meaning%20of%20working%20in%20teams.%20Among%20other%20things%2C%20on%20a%20team%20we%20need%20to%20set%20the%20proper%20communication%20channels.%20My%20last%20assignment%20as%20employee%20of%20a%20company%20was%20Software%20Architect%20for%20a%20set%20of%20projects%20for%20a%20new%20cl" title="del.icio.us"><img src="http://coder.cl/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-successful-team%2F&amp;title=a%20successful%20team&amp;bodytext=Few%20people%20is%20capable%20to%20understand%20the%20meaning%20of%20working%20in%20teams.%20Among%20other%20things%2C%20on%20a%20team%20we%20need%20to%20set%20the%20proper%20communication%20channels.%20My%20last%20assignment%20as%20employee%20of%20a%20company%20was%20Software%20Architect%20for%20a%20set%20of%20projects%20for%20a%20new%20cl" title="Digg"><img src="http://coder.cl/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-successful-team%2F&amp;title=a%20successful%20team" title="Reddit"><img src="http://coder.cl/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-successful-team%2F&amp;t=a%20successful%20team" title="Facebook"><img src="http://coder.cl/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=a%20successful%20team%20-%20http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-successful-team%2F" title="Twitter"><img src="http://coder.cl/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fcoder.cl%2F2010%2F04%2Fa-successful-team%2F&amp;title=a%20successful%20team&amp;annotation=Few%20people%20is%20capable%20to%20understand%20the%20meaning%20of%20working%20in%20teams.%20Among%20other%20things%2C%20on%20a%20team%20we%20need%20to%20set%20the%20proper%20communication%20channels.%20My%20last%20assignment%20as%20employee%20of%20a%20company%20was%20Software%20Architect%20for%20a%20set%20of%20projects%20for%20a%20new%20cl" title="Google Bookmarks"><img src="http://coder.cl/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>


<br/><br/><br/><hr height="1px" width="50%" />
<div style='text-align: center !important;'><b>Copyright © 2010 Daniel Molina Wegener</b><br/><b>Atribución-No Comercial-Sin Derivadas 2.0 Chile</b><br/><a target='_new' rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/cl/"><img alt="Creative Commons License" style="border-width:0" src="/cc88x31.png" /></a></div>
<br/><hr height="1px" width="100%" />
<p><small>© Daniel Molina Wegener for <a href="http://coder.cl">coder . cl</a>, 2010. | <a href="http://coder.cl/2010/04/a-successful-team/">Permalink</a> | <a href="http://coder.cl/2010/04/a-successful-team/#comments">One comment</a><br/>Post tags: <br/></small></p>
]]></content:encoded>
			<wfw:commentRss>http://coder.cl/2010/04/a-successful-team/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>support my country Chile after earthquake 2010</title>
		<link>http://coder.cl/2010/03/support-my-country-chile-after-earthquake-2010/</link>
		<comments>http://coder.cl/2010/03/support-my-country-chile-after-earthquake-2010/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 22:24:45 +0000</pubDate>
		<dc:creator>Daniel Molina Wegener</dc:creator>
				<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://coder.cl/?p=634</guid>
		<description><![CDATA[Support my country Chile after the Earthquake on 2010 The official site where is centralized all the information about how to help our country is located at ChileAyuda. Chile Ayuda! How to support our country Chile [Earthquake 2010] share this article at: Copyright © 2010 Daniel Molina WegenerAtribución-No Comercial-Sin Derivadas 2.0 Chile © Daniel Molina [...]]]></description>
			<content:encoded><![CDATA[<p>Support my country Chile after the Earthquake on 2010</p>
<p>The official site where is centralized all the information about how to help our country is located at <a href='http://www.chileayuda.com/'>ChileAyuda</a>.</p>
<div class="box" style="text-align: center;">
<h2>Chile Ayuda!</h2>
<p>How to support our country Chile [Earthquake 2010]</p>
<p>    <a href='http://www.chileayuda.com/'><img src='/chileayuda-180x1501.jpg' border='0' /></a>
</div>



share this article at: 


	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F03%2Fsupport-my-country-chile-after-earthquake-2010%2F&amp;title=support%20my%20country%20Chile%20after%20earthquake%202010&amp;source=coder+.+cl+system+programmer+%26amp%3B+web+developer&amp;summary=Support%20my%20country%20Chile%20after%20the%20Earthquake%20on%202010%0D%0A%0D%0AThe%20official%20site%20where%20is%20centralized%20all%20the%20information%20about%20how%20to%20help%20our%20country%20is%20located%20at%20ChileAyuda.%0D%0A%0D%0A%0D%0A%20%20%20%20Chile%20Ayuda%21%0D%0A%20%20%20%20How%20to%20support%20our%20country%20Chile%20%5BEarthquake%202010%5D%0D" title="LinkedIn"><img src="http://coder.cl/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fcoder.cl%2F2010%2F03%2Fsupport-my-country-chile-after-earthquake-2010%2F&amp;title=support%20my%20country%20Chile%20after%20earthquake%202010&amp;notes=Support%20my%20country%20Chile%20after%20the%20Earthquake%20on%202010%0D%0A%0D%0AThe%20official%20site%20where%20is%20centralized%20all%20the%20information%20about%20how%20to%20help%20our%20country%20is%20located%20at%20ChileAyuda.%0D%0A%0D%0A%0D%0A%20%20%20%20Chile%20Ayuda%21%0D%0A%20%20%20%20How%20to%20support%20our%20country%20Chile%20%5BEarthquake%202010%5D%0D" title="del.icio.us"><img src="http://coder.cl/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F03%2Fsupport-my-country-chile-after-earthquake-2010%2F&amp;title=support%20my%20country%20Chile%20after%20earthquake%202010&amp;bodytext=Support%20my%20country%20Chile%20after%20the%20Earthquake%20on%202010%0D%0A%0D%0AThe%20official%20site%20where%20is%20centralized%20all%20the%20information%20about%20how%20to%20help%20our%20country%20is%20located%20at%20ChileAyuda.%0D%0A%0D%0A%0D%0A%20%20%20%20Chile%20Ayuda%21%0D%0A%20%20%20%20How%20to%20support%20our%20country%20Chile%20%5BEarthquake%202010%5D%0D" title="Digg"><img src="http://coder.cl/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fcoder.cl%2F2010%2F03%2Fsupport-my-country-chile-after-earthquake-2010%2F&amp;title=support%20my%20country%20Chile%20after%20earthquake%202010" title="Reddit"><img src="http://coder.cl/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fcoder.cl%2F2010%2F03%2Fsupport-my-country-chile-after-earthquake-2010%2F&amp;t=support%20my%20country%20Chile%20after%20earthquake%202010" title="Facebook"><img src="http://coder.cl/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=support%20my%20country%20Chile%20after%20earthquake%202010%20-%20http%3A%2F%2Fcoder.cl%2F2010%2F03%2Fsupport-my-country-chile-after-earthquake-2010%2F" title="Twitter"><img src="http://coder.cl/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fcoder.cl%2F2010%2F03%2Fsupport-my-country-chile-after-earthquake-2010%2F&amp;title=support%20my%20country%20Chile%20after%20earthquake%202010&amp;annotation=Support%20my%20country%20Chile%20after%20the%20Earthquake%20on%202010%0D%0A%0D%0AThe%20official%20site%20where%20is%20centralized%20all%20the%20information%20about%20how%20to%20help%20our%20country%20is%20located%20at%20ChileAyuda.%0D%0A%0D%0A%0D%0A%20%20%20%20Chile%20Ayuda%21%0D%0A%20%20%20%20How%20to%20support%20our%20country%20Chile%20%5BEarthquake%202010%5D%0D" title="Google Bookmarks"><img src="http://coder.cl/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>


<br/><br/><br/><hr height="1px" width="50%" />
<div style='text-align: center !important;'><b>Copyright © 2010 Daniel Molina Wegener</b><br/><b>Atribución-No Comercial-Sin Derivadas 2.0 Chile</b><br/><a target='_new' rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/cl/"><img alt="Creative Commons License" style="border-width:0" src="/cc88x31.png" /></a></div>
<br/><hr height="1px" width="100%" />
<p><small>© Daniel Molina Wegener for <a href="http://coder.cl">coder . cl</a>, 2010. | <a href="http://coder.cl/2010/03/support-my-country-chile-after-earthquake-2010/">Permalink</a> | <a href="http://coder.cl/2010/03/support-my-country-chile-after-earthquake-2010/#comments">No comment</a><br/>Post tags: <br/></small></p>
]]></content:encoded>
			<wfw:commentRss>http://coder.cl/2010/03/support-my-country-chile-after-earthquake-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>integrating kontact and skype</title>
		<link>http://coder.cl/2010/02/integrating-kontact-and-skype/</link>
		<comments>http://coder.cl/2010/02/integrating-kontact-and-skype/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 01:53:25 +0000</pubDate>
		<dc:creator>Daniel Molina Wegener</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://coder.cl/?p=627</guid>
		<description><![CDATA[Kontact is my default PIM application. On its configuration we can setup a phone calling program, such as ekiga, skype and others, it just requires a small script, like the one bellow, which I have integrated with KPilot, so I can manage my contacts centered and synchronized. #!/usr/bin/env python # skype_call.py import sys import Skype4Py [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://userbase.kde.org/Kontact'>Kontact</a> is my default PIM application. On its configuration we can setup a phone calling program, such as ekiga, skype and others, it just requires a small script, like the one bellow, which I have integrated with <a href='http://cvs.codeyard.net/kpilot/'>KPilot</a>, so I can manage my contacts centered and synchronized.</p>
<p><span id="more-627"></span></p>
<pre name="code" class="python">
#!/usr/bin/env python
# skype_call.py
import sys
import Skype4Py

def main():
    if len(sys.argv) != 2:
        print "No dialup number\n"
    number = sys.argv[1]
    number = number.strip()
    for n in [' ', '+', '(', ')', &quot;\s&quot;, &quot;\t&quot;, '-']:
        number = number.replace(n, &quot;&quot;);
    number = '+' + number
    print number, &quot;\n&quot;
    skype = Skype4Py.Skype()
    skype.Attach()
    skype.PlaceCall(number)

if __name__ == '__main__':
    main()
</pre>
<p>Then, on the Kontact configuration, on the address book settings, we configure the path to our script, called <i>skype_call.py</i>, in this case located at my home directory, on my personal scripts folder.</p>
<div style='border: 1px solid #000; text-align: center; overflow: auto;'><a href='http://coder.cl/uploads/2010/02/kontact-configuration.jpg' alt='Kontact Configuration' title='Kontact Configuration' target='_blank'><img border='0' alt='Kontact Configuration' title='Kontact Configuration' src='http://coder.cl/uploads/2010/02/kontact-configuration.jpg' style='text-align: center;'></a></div>
<p>One time configured contact, you can call your contacts just by clicking on their phone numbers. Remember that skype needs the format <i>+country_code&mdash;area_code&mdash;phone_number</i>, like <i>+56 (2) 555 55 55</i>.</p>
<div style='border: 1px solid #000; text-align: center; overflow: auto;'><a href='http://coder.cl/uploads/2010/02/kontact-calling.jpg' alt='Contact Calling' title='Contact Calling' target='_blank'><img border='0' alt='Contact Calling' title='Contact Calling' src='http://coder.cl/uploads/2010/02/kontact-calling.jpg' style='text-align: center;'></a></div>
<p>Happy internet calling <img src='http://coder.cl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>



share this article at: 


	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Fintegrating-kontact-and-skype%2F&amp;title=integrating%20kontact%20and%20skype&amp;source=coder+.+cl+system+programmer+%26amp%3B+web+developer&amp;summary=Kontact%20is%20my%20default%20PIM%20application.%20On%20its%20configuration%20we%20can%20setup%20a%20phone%20calling%20program%2C%20such%20as%20ekiga%2C%20skype%20and%20others%2C%20it%20just%20requires%20a%20small%20script%2C%20like%20the%20one%20bellow%2C%20which%20I%20have%20integrated%20with%20KPilot%2C%20so%20I%20can%20manage%20my%20contacts%20" title="LinkedIn"><img src="http://coder.cl/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Fintegrating-kontact-and-skype%2F&amp;title=integrating%20kontact%20and%20skype&amp;notes=Kontact%20is%20my%20default%20PIM%20application.%20On%20its%20configuration%20we%20can%20setup%20a%20phone%20calling%20program%2C%20such%20as%20ekiga%2C%20skype%20and%20others%2C%20it%20just%20requires%20a%20small%20script%2C%20like%20the%20one%20bellow%2C%20which%20I%20have%20integrated%20with%20KPilot%2C%20so%20I%20can%20manage%20my%20contacts%20" title="del.icio.us"><img src="http://coder.cl/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Fintegrating-kontact-and-skype%2F&amp;title=integrating%20kontact%20and%20skype&amp;bodytext=Kontact%20is%20my%20default%20PIM%20application.%20On%20its%20configuration%20we%20can%20setup%20a%20phone%20calling%20program%2C%20such%20as%20ekiga%2C%20skype%20and%20others%2C%20it%20just%20requires%20a%20small%20script%2C%20like%20the%20one%20bellow%2C%20which%20I%20have%20integrated%20with%20KPilot%2C%20so%20I%20can%20manage%20my%20contacts%20" title="Digg"><img src="http://coder.cl/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Fintegrating-kontact-and-skype%2F&amp;title=integrating%20kontact%20and%20skype" title="Reddit"><img src="http://coder.cl/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Fintegrating-kontact-and-skype%2F&amp;t=integrating%20kontact%20and%20skype" title="Facebook"><img src="http://coder.cl/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=integrating%20kontact%20and%20skype%20-%20http%3A%2F%2Fcoder.cl%2F2010%2F02%2Fintegrating-kontact-and-skype%2F" title="Twitter"><img src="http://coder.cl/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Fintegrating-kontact-and-skype%2F&amp;title=integrating%20kontact%20and%20skype&amp;annotation=Kontact%20is%20my%20default%20PIM%20application.%20On%20its%20configuration%20we%20can%20setup%20a%20phone%20calling%20program%2C%20such%20as%20ekiga%2C%20skype%20and%20others%2C%20it%20just%20requires%20a%20small%20script%2C%20like%20the%20one%20bellow%2C%20which%20I%20have%20integrated%20with%20KPilot%2C%20so%20I%20can%20manage%20my%20contacts%20" title="Google Bookmarks"><img src="http://coder.cl/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>


<br/><br/><br/><hr height="1px" width="50%" />
<div style='text-align: center !important;'><b>Copyright © 2010 Daniel Molina Wegener</b><br/><b>Atribución-No Comercial-Sin Derivadas 2.0 Chile</b><br/><a target='_new' rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/cl/"><img alt="Creative Commons License" style="border-width:0" src="/cc88x31.png" /></a></div>
<br/><hr height="1px" width="100%" />
<p><small>© Daniel Molina Wegener for <a href="http://coder.cl">coder . cl</a>, 2010. | <a href="http://coder.cl/2010/02/integrating-kontact-and-skype/">Permalink</a> | <a href="http://coder.cl/2010/02/integrating-kontact-and-skype/#comments">No comment</a><br/>Post tags: <br/></small></p>
]]></content:encoded>
			<wfw:commentRss>http://coder.cl/2010/02/integrating-kontact-and-skype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ramblings on email formalization</title>
		<link>http://coder.cl/2010/02/ramblings-on-email-formalization/</link>
		<comments>http://coder.cl/2010/02/ramblings-on-email-formalization/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 15:13:14 +0000</pubDate>
		<dc:creator>Daniel Molina Wegener</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[rants]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://coder.cl/?p=619</guid>
		<description><![CDATA[Netiquette (RFC1855) is a set of standard rules on writing electronic mail. Many of those conventions appears to be lost in time, and bad practices on writing emails are more popular around the Internet. I agree with those rules, but I think that some additional stuff can be used to get more organized electronic mail. [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://tools.ietf.org/html/rfc1855'><i>Netiquette (RFC1855)</i></a> is a set of standard rules on writing electronic mail. Many of those conventions appears to be lost in time, and bad practices on writing emails are more popular around the Internet. I agree with those rules, but I think that some additional stuff can be used to get more organized electronic mail. Here are some rules, some of them extracted from the netiquette used on mailing lists and Usenet.</p>
<p><span id="more-619"></span></p>
<p><br/></p>
<h3>the subject matters</h3>
<p>Sure, a good subject can be used to index properly your emails. For example try to use some kind of convention, do not throw the subject as a previously known conversation. For many years I&#8217;ve been using my own convention on electronic mail subjects for my projects. Generally I use the form: <i>&quot;Client, Project, Real Subject&quot;</i> or <i>&quot;Project, Real Subject&quot;</i>. So you can easily find your messages related to each project just by looking on the subject. The proper subject is a good introduction to the email that you will write or read.</p>
<p><br/></p>
<h3>the format matters</h3>
<p>Plain text (text/plain), wrapped on column 76 or 64 &mdash; it depends on your taste &mdash; with well formed paragraphs and using the proper mime encoding for localization &mdash; on Usenet and some mailing lists is useful to use US-ASCII as encoding. Many companies are using <b>HTML</b> formatted mail with those gif images as company logos attached, and sometimes a huge disclaimer as email footer, and many replying on top of the previous message. Well, your fancy looks ugly here. I use <i>Kontact</i>, hence I use <i>Kmail</i> and a great feature of <i>Kmail</i> is the fact that it do not opens HTML formatted mails immediately, it regards my preference and ask me if I want to open it. Do you remember the <i>I love you</i> virus which was spreading through electronic mail?. Fancy colors and pictures leave your mail looking as <b>SPAM</b>, overfilled with <i>propaganda</i>, and those huge disclaimers for me are a disrespect to me, since it is like to send a real mail, and mail service opens the envelope and attach another document into it.</p>
<p>A possible solution is to standardize the proper E-Mail header for those bring that information without modifying the content of the original message:</p>
<ul>
<li><strong>X-Company-Logo</strong>, should contain an URL to the company logo. I hope that it should reside under HTTPS protocol.</li>
<li><strong>X-Disclaimer</strong>, should contain an URL to the company disclaimer of the electronic mail.</li>
<li><strong>X-Sender-Identity</strong>, should contain an URL to the sender contact information, possibly a vCard or a plain text signature.</li>
</ul>
<p>Sending that information &mdash; since most SMTP email is authenticated &mdash; can be easyly inserted on the electronic mail and it will become a part of the envelope, not the original message.</p>
<p><br/></p>
<h3>labeling for indexing</h3>
<p>Many mail clients are using <i>labels</i> to create additional indexes on the electronic mail, but seems that is not standardized. Here an additional mail header should be useful &mdash; I hope that most companies will agree. <strong>X-Labels</strong> should be used to add labels to the electronic mail, it can be delimited with the <i>;;</i> string. So, it will become standardized for most clients, including on sending mail, so the mail client can receive them and ask the user if he wants to add the label.</p>
<p><br/></p>
<h3>conclusions</h3>
<p>Read some mailing lists or Usenet newsgroups to get introduced on how to write and read electronic mail. Read the RFC 1855 to get the <i>real rules</i> on formal electronic mail. Stop sending that fancy electronic mail, it has no sense, your company will not be more respected by sending those mails, for many people it has the opposed effect.</p>



share this article at: 


	<a rel="nofollow"  target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Framblings-on-email-formalization%2F&amp;title=ramblings%20on%20email%20formalization&amp;source=coder+.+cl+system+programmer+%26amp%3B+web+developer&amp;summary=Netiquette%20%28RFC1855%29%20is%20a%20set%20of%20standard%20rules%20on%20writing%20electronic%20mail.%20Many%20of%20those%20conventions%20appears%20to%20be%20lost%20in%20time%2C%20and%20bad%20practices%20on%20writing%20emails%20are%20more%20popular%20around%20the%20Internet.%20I%20agree%20with%20those%20rules%2C%20but%20I%20think%20that%20som" title="LinkedIn"><img src="http://coder.cl/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Framblings-on-email-formalization%2F&amp;title=ramblings%20on%20email%20formalization&amp;notes=Netiquette%20%28RFC1855%29%20is%20a%20set%20of%20standard%20rules%20on%20writing%20electronic%20mail.%20Many%20of%20those%20conventions%20appears%20to%20be%20lost%20in%20time%2C%20and%20bad%20practices%20on%20writing%20emails%20are%20more%20popular%20around%20the%20Internet.%20I%20agree%20with%20those%20rules%2C%20but%20I%20think%20that%20som" title="del.icio.us"><img src="http://coder.cl/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Framblings-on-email-formalization%2F&amp;title=ramblings%20on%20email%20formalization&amp;bodytext=Netiquette%20%28RFC1855%29%20is%20a%20set%20of%20standard%20rules%20on%20writing%20electronic%20mail.%20Many%20of%20those%20conventions%20appears%20to%20be%20lost%20in%20time%2C%20and%20bad%20practices%20on%20writing%20emails%20are%20more%20popular%20around%20the%20Internet.%20I%20agree%20with%20those%20rules%2C%20but%20I%20think%20that%20som" title="Digg"><img src="http://coder.cl/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Framblings-on-email-formalization%2F&amp;title=ramblings%20on%20email%20formalization" title="Reddit"><img src="http://coder.cl/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Framblings-on-email-formalization%2F&amp;t=ramblings%20on%20email%20formalization" title="Facebook"><img src="http://coder.cl/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=ramblings%20on%20email%20formalization%20-%20http%3A%2F%2Fcoder.cl%2F2010%2F02%2Framblings-on-email-formalization%2F" title="Twitter"><img src="http://coder.cl/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fcoder.cl%2F2010%2F02%2Framblings-on-email-formalization%2F&amp;title=ramblings%20on%20email%20formalization&amp;annotation=Netiquette%20%28RFC1855%29%20is%20a%20set%20of%20standard%20rules%20on%20writing%20electronic%20mail.%20Many%20of%20those%20conventions%20appears%20to%20be%20lost%20in%20time%2C%20and%20bad%20practices%20on%20writing%20emails%20are%20more%20popular%20around%20the%20Internet.%20I%20agree%20with%20those%20rules%2C%20but%20I%20think%20that%20som" title="Google Bookmarks"><img src="http://coder.cl/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>


<br/><br/><br/><hr height="1px" width="50%" />
<div style='text-align: center !important;'><b>Copyright © 2010 Daniel Molina Wegener</b><br/><b>Atribución-No Comercial-Sin Derivadas 2.0 Chile</b><br/><a target='_new' rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.0/cl/"><img alt="Creative Commons License" style="border-width:0" src="/cc88x31.png" /></a></div>
<br/><hr height="1px" width="100%" />
<p><small>© Daniel Molina Wegener for <a href="http://coder.cl">coder . cl</a>, 2010. | <a href="http://coder.cl/2010/02/ramblings-on-email-formalization/">Permalink</a> | <a href="http://coder.cl/2010/02/ramblings-on-email-formalization/#comments">No comment</a><br/>Post tags: <br/></small></p>
]]></content:encoded>
			<wfw:commentRss>http://coder.cl/2010/02/ramblings-on-email-formalization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
