<?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>Mostly Software Engineering</title>
	<atom:link href="http://www.advansen.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.advansen.com</link>
	<description>Gabriel Gonzalez&#039;s notebook</description>
	<lastBuildDate>Mon, 25 Jan 2010 09:32:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Twitter Internal Fragmentation: Python + Twitter</title>
		<link>http://www.advansen.com/2010/01/25/twitter-internal-fragmentation-python-twitter/</link>
		<comments>http://www.advansen.com/2010/01/25/twitter-internal-fragmentation-python-twitter/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 09:32:55 +0000</pubDate>
		<dc:creator>Gabriel Gonzalez</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[open source tools]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.advansen.com/?p=129</guid>
		<description><![CDATA[As a toy project to play a little bit more with Python and accessing Twitter, I came out with the idea of calculating the Internal Fragmentation of user&#8217;s tweet. 
To interface with Twitter services I used the Twitter extension located at http://code.google.com/p/python-twitter/, which has a pretty straightforward API.
The script shown below gives you back what [...]]]></description>
			<content:encoded><![CDATA[<p>As a toy project to play a little bit more with <strong>Python </strong>and accessing <strong>Twitter</strong>, I came out with the idea of calculating the <a href="http://en.wikipedia.org/wiki/Fragmentation_(computer)">Internal Fragmentation</a> of user&#8217;s tweet. </p>
<p>To interface with Twitter services I used the <a href="http://code.google.com/p/python-twitter/">Twitter extension</a> located at <a href="http://code.google.com/p/python-twitter/">http://code.google.com/p/python-twitter/</a>, which has a pretty straightforward API.</p>
<p>The script shown below gives you back what average percentage of your last 20 tweets have been wasted.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">import</span> &nbsp;twitter</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">import</span> &nbsp;<span class="kw3">sys</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">if</span> <span class="kw2">len</span><span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#41;</span> != <span class="nu0">2</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span> &nbsp; <span class="st0">&quot;Provide a Twitter Username as Argument&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; exit<span class="br0">&#40;</span><span class="nu0">-1</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">api = twitter.<span class="me1">Api</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li2">
<div class="de2">st = api.<span class="me1">GetUserTimeline</span><span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">sum</span> = <span class="nu0">0.0</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">for</span> s <span class="kw1">in</span> st:</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">sum</span> += <span class="br0">&#40;</span><span class="nu0">140.0</span> &#8211; <span class="kw2">len</span><span class="br0">&#40;</span>s.<span class="me1">text</span>.<span class="me1">encode</span><span class="br0">&#40;</span><span class="st0">&quot;utf-8&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>/<span class="nu0">140.0</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">print</span> <span class="st0">&quot;%s internal fragmentation is %.2f%s&quot;</span> % <span class="br0">&#40;</span><span class="kw3">sys</span>.<span class="me1">argv</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>, <span class="kw2">round</span><span class="br0">&#40;</span><span class="kw2">sum</span> / <span class="kw2">len</span><span class="br0">&#40;</span>st<span class="br0">&#41;</span> * <span class="nu0">100</span>, <span class="nu0">2</span><span class="br0">&#41;</span>, <span class="st0">&quot;%&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>And now some results:<br />
<code><br />
$ python twinternal.py GabrielGonzalez<br />
GabrielGonzalez internal fragmentation is 39.89%<br />
$ python twinternal.py 48bits<br />
48bits internal fragmentation is 36.79%<br />
$ python twinternal.py reversemode<br />
reversemode internal fragmentation is 38.72%<br />
$ python twinternal.py aramosf<br />
aramosf internal fragmentation is 32.41%<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.advansen.com/2010/01/25/twitter-internal-fragmentation-python-twitter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Vulnerability Engineering</title>
		<link>http://www.advansen.com/2009/11/12/vulnerability-engineering/</link>
		<comments>http://www.advansen.com/2009/11/12/vulnerability-engineering/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 08:59:13 +0000</pubDate>
		<dc:creator>Gabriel Gonzalez</dc:creator>
				<category><![CDATA[Computer Security]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[vulnerability engineering]]></category>

		<guid isPermaLink="false">http://www.advansen.com/?p=123</guid>
		<description><![CDATA[I have just published an article about Vulnerabily Engineering in Wintercore&#8217;s blog (spanish version in 48bits.com). It focuses in applying Software Engineering metrics to the world of Vulnerability Research which can give us an idea about how Reliable a Software Product is.
In this article I analyze five applications Microsoft&#8217;s Explorer, Sun&#8217;s Java JRE, Apple&#8217;s QuickTime, [...]]]></description>
			<content:encoded><![CDATA[<p>I have just published an article about <a title="Vulnerability Engineering" href="http://blog.wintercore.com/?p=26">Vulnerabily Engineering in Wintercore&#8217;s blog </a>(<a title="Vulnerability Engineering" href="http://blog.48bits.com/?p=735">spanish version in 48bits.com</a>). It focuses in applying Software Engineering metrics to the world of Vulnerability Research which can give us an idea about how Reliable a Software Product is.</p>
<p>In this article I analyze five applications Microsoft&#8217;s Explorer, Sun&#8217;s Java JRE, Apple&#8217;s QuickTime, HP NodeManager and Adobe Reader. The conclusion I formulated after writing the article was that the reliability of Software Product is too low to be even bad.</p>
<p>QuickTime&#8217;s users are 99% of the time exposed to at least one unfixed vulnerability, which I think should ban this products for almost all computers.</p>
<p>I hope you enjoy the article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.advansen.com/2009/11/12/vulnerability-engineering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQUID + Active Directory</title>
		<link>http://www.advansen.com/2009/09/21/squid-active-directory/</link>
		<comments>http://www.advansen.com/2009/09/21/squid-active-directory/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 10:59:54 +0000</pubDate>
		<dc:creator>Gabriel Gonzalez</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQUID]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.advansen.com/?p=114</guid>
		<description><![CDATA[A few post ago I wrote about integrating SQUID and Active Directory in order to allow/deny users to access specific webpages depeding on the groups a user belongs.
The windows package of Squid comes with several external programs which can be used as external ACLs which allow you to query the local Active Directory in order [...]]]></description>
			<content:encoded><![CDATA[<p>A few post ago I wrote about integrating <strong><em>SQUID </em></strong>and <strong><em>Active Directory </em></strong>in order to allow/deny users to access specific webpages depeding on the groups a user belongs.</p>
<p>The windows package of <strong><em>Squid </em></strong>comes with several external programs which can be used as <em><strong>external ACL</strong></em>s which allow you to query the local Active Directory in order to obtain access or not. The one dealing with users and groups is called <em><strong>mswin_check_ad_group.exe </strong><span style="font-style: normal;">which, as all the external ACLs, reads the standard input looking for a user and a group and return whether the user belongs to the given group.</span></em></p>
<p><em><span style="font-style: normal;">This is fine and pretty straight forward it has a PROBLEM, it only works with Groups with scope set to &#8220;Domain Local&#8221;; which turn into a drawback when your users belong to Groups with Global Scope. I haven&#8217;t found any documentation explaining how to achive this so I have created a simple external ACL to peform this task in python.</span></em></p>
<p><em><span style="font-style: normal;">You only need to download <a title="pywin32" href="http://sourceforge.net/projects/pywin32/">pywin32 </a>and the <a title="Active Directory for Python" href="http://timgolden.me.uk/python/downloads/active_directory-0.6.7.zip">active directory plugin</a> for python. After installing just use the following code, which will return OK IFF the user belongs to the given group (non matter which scope):</span></em></p>
<p><em><span style="font-style: normal;"><span id="more-114"></span></span></em></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">import</span> <span class="kw3">os</span>, <span class="kw3">subprocess</span>, <span class="kw3">sys</span>, <span class="kw3">re</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">import</span> active_directory</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">while</span> <span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span> :</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; squid = <span class="kw3">sys</span>.<span class="me1">stdin</span>.<span class="kw3">readline</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="kw2">len</span><span class="br0">&#40;</span>squid<span class="br0">&#41;</span> == <span class="nu0">0</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">break</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; m = <span class="kw3">re</span>.<span class="me1">search</span><span class="br0">&#40;</span><span class="st0">&#8216;(?&lt;=%5C)<span class="es0">\w</span>+&#8217;</span>, squid<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; username = m.<span class="me1">group</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; m = <span class="kw3">re</span>.<span class="me1">search</span><span class="br0">&#40;</span><span class="st0">&#8216;(?&lt;= )[<span class="es0">\w</span><span class="es0">\.</span>]+&#8217;</span>, squid<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; checkgroup = m.<span class="me1">group</span><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; ret = <span class="st0">&quot;ERR&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">user</span> = active_directory.<span class="me1">find_user</span><span class="br0">&#40;</span>username<span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> group <span class="kw1">in</span> <span class="kw3">user</span>.<span class="me1">memberOf</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw2">cmp</span><span class="br0">&#40;</span>group.<span class="me1">cn</span>, checkgroup<span class="br0">&#41;</span> &nbsp;== <span class="nu0">0</span><span class="br0">&#41;</span>:</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ret = <span class="st0">&quot;OK&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">break</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">print</span>&nbsp; &nbsp;ret + <span class="st0">&quot;<span class="es0">\r</span><span class="es0">\n</span>&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">sys</span>.<span class="me1">stdout</span>.<span class="me1">flush</span><span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
</ol>
</div>
<div><span style="font-style: normal;">I am new to the Python world so, for sure, this little thing can be improved, feel free to comment anything.</span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.advansen.com/2009/09/21/squid-active-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an Installer Using NSIS (III)</title>
		<link>http://www.advansen.com/2009/09/07/creating-an-installer-using-nsis-iii/</link>
		<comments>http://www.advansen.com/2009/09/07/creating-an-installer-using-nsis-iii/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 09:32:45 +0000</pubDate>
		<dc:creator>Gabriel Gonzalez</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[NSIS]]></category>
		<category><![CDATA[open source tools]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.advansen.com/?p=104</guid>
		<description><![CDATA[In this last post about NSIS I am going to describe how to use some of the most useful plugins which will allow you create a pretty decent and featurefull installer for windows.

Checking for adminstrator privileges:

 userInfo::getAccountType
 Pop $0
 StrCmp $0 &#8220;Admin&#8221; +3
 
 MessageBox MB_OK &#8220;Debe tener privilegios de administrador para correr este programa [...]]]></description>
			<content:encoded><![CDATA[<p>In this last post about <strong><em><a title="NSIS homepage" href="http://nsis.sourceforge.net/Main_Page">NSIS</a></em></strong> I am going to describe how to use some of the most useful plugins which will allow you create a pretty decent and featurefull<strong><em> installer for windows</em></strong>.</p>
<ul>
<li>Checking for adminstrator privileges:</li>
</ul>
<blockquote><p><span style="white-space: pre;"> </span>userInfo::getAccountType</p>
<p><span style="white-space: pre;"> </span>Pop $0</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>StrCmp $0 &#8220;Admin&#8221; +3</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>MessageBox MB_OK &#8220;Debe tener privilegios de administrador para correr este programa de instalación: $0&#8243;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>Return</div>
<p><span style="white-space: pre;"> </span>StrCmp $0 &#8220;Admin&#8221; +3</p>
<p><span style="white-space: pre;"> </span>MessageBox MB_OK &#8220;You need Administrator privileges: $0&#8243;</p>
<p><span style="white-space: pre;"> </span>Return</p></blockquote>
<p>This chunk of code will pop up a windows with the propoer notification. The <em>StrCmp </em>sentence compares the <em>$0</em> variable poped from the stack against <em>&#8220;Admin&#8221; </em>and if they are equal continue the execution with the 3rd line of code, the one below Return.</p>
<ul>
<li>Downloading and Executing, e.g. an external installer:</li>
</ul>
<blockquote><p><span style="white-space: pre;"> </span>NSISdl::download /TIMEOUT=30000 &#8220;http://www.advansen.com/this/is/a/test/advansen.msi&#8221; &#8220;$INSTDIR\advansen.msi&#8221;</p>
<p><span style="white-space: pre;"> </span>Pop $R0 ;Get the return value</p>
<p><span style="white-space: pre;"> </span>StrCmp $R0 &#8220;success&#8221; +3</p>
<p><span style="white-space: pre;"> </span>MessageBox MB_OK &#8220;Download failed: $R0&#8243;</p>
<p><span style="white-space: pre;"> </span>Quit</p>
<p><span style="white-space: pre;"> </span>ExecWait  &#8217;&#8221;msiexec&#8221; /i &#8220;$INSTDIR\advansen.msi&#8221; /quiet&#8217;</p></blockquote>
<p><span id="more-104"></span></p>
<ul>
<li>Unziping :</li>
</ul>
<p>To use the unzip feature you need to download the <a href="http://nsis.sourceforge.net/ZipDLL_plug-in">unzip external plugin</a>, follow the installation guidelines (basically copying the dll to the plugins directory) and that&#8217;s it.</p>
<blockquote><p><span style="white-space: pre;"> </span>nsisunz::Unzip &#8220;$INSTDIR\squid.zip&#8221; &#8220;C:\&#8221;</p>
<p><span style="white-space: pre;"> </span>Pop $R0</p>
<p><span style="white-space: pre;"> </span>StrCmp $R0 &#8220;success&#8221; +2</p>
<p><span style="white-space: pre;"> </span>DetailPrint &#8220;$R0&#8243;</p></blockquote>
<ul>
<li>Modifying the <a href="http://en.wikipedia.org/wiki/Environment_variable">environment variables</a>:</li>
</ul>
<p>Adding to PATH</p>
<blockquote><p>${EnvVarUpdate} $0 &#8220;PATH&#8221; &#8220;A&#8221; &#8220;HKLM&#8221; &#8220;C:\some\path&#8221;</p></blockquote>
<p>Removing a PATH</p>
<blockquote><p>${un.EnvVarUpdate} $0 &#8220;PATH&#8221; &#8220;R&#8221; &#8220;HKLM&#8221; &#8220;C:\some\path&#8221;</p></blockquote>
<p>To use the code above you also need external help, just download the <a href="http://nsis.sourceforge.net/Environmental_Variables:_append,_prepend,_and_remove_entries#Function_Code">EnvVarUpdate extension</a> and will able to update the $PATH variable easily</p>
]]></content:encoded>
			<wfw:commentRss>http://www.advansen.com/2009/09/07/creating-an-installer-using-nsis-iii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an Installer Using NSIS (II)</title>
		<link>http://www.advansen.com/2009/09/02/creating-an-installer-using-nsis-ii/</link>
		<comments>http://www.advansen.com/2009/09/02/creating-an-installer-using-nsis-ii/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 09:08:41 +0000</pubDate>
		<dc:creator>Gabriel Gonzalez</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[NSIS]]></category>
		<category><![CDATA[open source tools]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.advansen.com/?p=92</guid>
		<description><![CDATA[After playing for a few days with NSIS I have manage to create a full features installer which perform all the actions I needed. These are the following:

Download files
Unzip Files to a specific folder
Execute external installers
Modify Environment Variables

Since NSIS supports plug-ins there are quite a few available which provide extra functionalities such as the unzipping [...]]]></description>
			<content:encoded><![CDATA[<p>After playing for a few days with <strong><em>NSIS </em></strong>I have manage to create a full features installer which perform all the actions I needed. These are the following:</p>
<ul>
<li>Download files</li>
<li>Unzip Files to a specific folder</li>
<li>Execute external installers</li>
<li>Modify Environment Variables</li>
</ul>
<p>Since <strong><em>NSIS </em></strong>supports plug-ins there are quite a few available which provide extra functionalities such as the unzipping one.</p>
<p>Before going into these extra features, which will be subject of a new post, I prefer writing down how a more complex script is structure, just to keep in to the future.</p>
<p><strong><em>NSIS</em></strong> is structured in pages (page == panels show each time a &#8220;next button&#8221; is clicked), most of them are predefined, where you can only change tittle or add extra text in them. Following are the pages definition using the <a title="MUI2" href="http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html">MUI2 interface</a>:</p>
<blockquote><p>!insertmacro MUI_PAGE_LICENSE &#8220;path\to\license.txt&#8221;</p>
<p>!insertmacro MUI_PAGE_COMPONENTS</p>
<p>!insertmacro MUI_PAGE_DIRECTORY</p>
<p>!insertmacro MUI_PAGE_INSTFILES</p></blockquote>
<p><span id="more-92"></span></p>
<p>Except for the components page which is configured using the section described in the previous post.  Each Section name will appear as a component with its corresponding checkbox, groups can also be specified and the code inside each section will be only executed if the component is checked:</p>
<blockquote><p>SectionGroup &#8220;Extra Plug-ins&#8221;</p>
<p>Section &#8220;Spreadsheet&#8221;</p>
<p>SectionEnd</p>
<p>Section &#8220;PDF&#8221;</p>
<p>SectionEnd</p>
<p>SectionGroupEnd</p></blockquote>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 176px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">!insertmacro MUI_PAGE_LICENSE &#8220;${NSISDIR}\Docs\Modern UI\License.txt&#8221;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 176px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">!insertmacro MUI_PAGE_COMPONENTS</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 176px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">!insertmacro MUI_PAGE_DIRECTORY</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 176px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">!insertmacro MUI_PAGE_INSTFILES</div>
<p><img class="aligncenter size-full wp-image-95" title="components" src="http://www.advansen.com/wp-content/uploads/2009/09/components.PNG" alt="components" width="582" height="367" /></p>
<p>A section declared as follows is executed always :</p>
<blockquote><p>Section &#8220;&#8221;</p>
<p>SectionEnd</p></blockquote>
<p>The next chunk of code creates an entry in the program&#8217;s menu:</p>
<blockquote><p>CreateDirectory &#8220;$SMPROGRAMS\Advansen\&#8221;</p>
<p>CreateShortCut &#8220;$SMPROGRAMS\Advansen\uninstall.lnk&#8221; &#8220;$INSTDIR\uninstall.exe&#8221;</p></blockquote>
<p>And in order to execute external installers or additional programs the <strong><em>ExecWait </em></strong>sentences provides an easy way to achive that. In the next line python uninstaller is called with the quite flag so no window pops up:</p>
<blockquote><p>ExecWait  &#8217;&#8221;msiexec&#8221; /uninstall &#8220;$INSTDIR\python-2.6.2.msi&#8221; /quiet&#8217;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.advansen.com/2009/09/02/creating-an-installer-using-nsis-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an Installer Using NSIS (I)</title>
		<link>http://www.advansen.com/2009/09/01/creating-an-installer-using-nsis-i/</link>
		<comments>http://www.advansen.com/2009/09/01/creating-an-installer-using-nsis-i/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 09:00:26 +0000</pubDate>
		<dc:creator>Gabriel Gonzalez</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[NSIS]]></category>
		<category><![CDATA[open source tools]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.advansen.com/?p=85</guid>
		<description><![CDATA[Last week I faced a new problem, I had to program a installer for Windows in order to deploy some software we have produced at work. After a quick googling I found NSIS an installer generator, open source and with a simple scripting language.
NSIS comes with a compiler which parses the sentences writting in its [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I faced a new problem, I had to program a <strong><em>installer for Windows</em></strong> in order to deploy some software we have produced at work. After a quick googling I found <a href="http://nsis.sourceforge.net/Main_Page"><strong><em>NSIS</em></strong></a><strong><em> </em></strong>an installer generator, <strong><em>open source</em></strong> and with a simple scripting language.</p>
<p><em><strong>NSIS </strong></em>comes with a compiler which parses the sentences writting in its own language and produces a pretty decent installer. It also has a <a href="http://nsis.sourceforge.net/NSIS_2">look-and-feeling similar to latets Windows versions</a>, so it was the perfect choice!</p>
<p>The scripting language is really simple, we can generate a simple installer with only the next few lines:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">outFile &#8220;installer.exe&#8221;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">installDir $DESKTOP</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">section</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>userInfo::getAccountType</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>pop $0</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>strCmp $0 &#8220;Admin&#8221; +3</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>messageBox MB_OK &#8220;not admin: $0&#8243;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>return</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>messageBox MB_OK &#8220;is admin&#8221;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>setOutPath $INSTDIR</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>file test.txt</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>writeUninstaller $INSTDIR\uninstaller.exe</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>createShortCut &#8220;$SMPROGRAMS\new oxtias.lnk&#8221; &#8220;$INSTDIR\uninstaller.exe&#8221;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">sectionEnd</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">section &#8220;Uninstall&#8221;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>delete $INSTDIR\uninstaller.exe</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>delete $INSTDIR\test.txt</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>delete &#8220;$SMPROGRAMS\new oxtias.lnk&#8221;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">sectionEnd</div>
<blockquote><p>OutFile &#8220;simpleAdvansenInstaller.exe&#8221;</p>
<p>InstallDir $DESKTOP</p>
<p>Section</p>
<p><span style="white-space:pre"> </span>SetOutPath $INSTDIR</p>
<p><span style="white-space:pre"> </span>WriteUninstaller $INSTDIR\uninstaller.exe</p>
<p><span style="white-space:pre"> </span>CreateShortCut &#8220;$SMPROGRAMS\simpleAdvansen.lnk&#8221; &#8220;$INSTDIR\uninstaller.exe&#8221;</p>
<p>SectionEnd</p>
<p>Section &#8220;Uninstall&#8221;</p>
<p><span style="white-space:pre"> </span>Delete $INSTDIR\uninstaller.exe</p>
<p><span style="white-space:pre"> </span>Delete $INSTDIR\test.txt</p>
<p><span style="white-space:pre"> </span>Delete &#8220;$SMPROGRAMS\simpleAdvansen.lnk&#8221;</p>
<p>SectionEnd</p></blockquote>
<p>After compiling the script with the tool NSIS package&#8217;s comes with, two executables are generated:</p>
<blockquote><p>simpleAdvansenInstaller.exe</p></blockquote>
<p>Which will copy the uninstaller.exe to the Installation Dir set up to the Desktop and will add an entry in the Programs Menu for the uninstaller.</p>
<blockquote><p>uninstaller.exe</p></blockquote>
<p>Will delete itself and remove the entry in the Programs Menu.</p>
<p>NOTE: NotePad++ highlights the syntax of <em><strong>NSIS </strong></em>as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.advansen.com/2009/09/01/creating-an-installer-using-nsis-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glueing applications with Python</title>
		<link>http://www.advansen.com/2009/08/27/glueing-applications-with-python/</link>
		<comments>http://www.advansen.com/2009/08/27/glueing-applications-with-python/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 12:54:44 +0000</pubDate>
		<dc:creator>Gabriel Gonzalez</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.advansen.com/?p=82</guid>
		<description><![CDATA[The problem I faced was the following:

Two processes I have to communicate with in order to validate data using stdin/stdout
No source code of this programs
Windows Platform

Since I am a UNIX guy I haven&#8217;t ever done anything advanced in Windows so I didn&#8217;t have the time to learn how to achive this in Windows as I [...]]]></description>
			<content:encoded><![CDATA[<p>The problem I faced was the following:</p>
<ul>
<li>Two processes I have to communicate with in order to validate data using stdin/stdout</li>
<li>No source code of this programs</li>
<li>Windows Platform</li>
</ul>
<p>Since I am a UNIX guy I haven&#8217;t ever done anything advanced in Windows so I didn&#8217;t have the time to learn how to achive this in Windows as I would have done in any other Unix. Obviously I downloaded Mingw and I tried to used the proper POSIX functions but it didn&#8217;t work.</p>
<p>Now is when Python comes into play. It is an <em>&#8220;easy to learn&#8221;</em> (at sometime I will be discussing this topic) scripting language with a pretty well support in Windows platform, at some point this support seemed better than perl&#8217;s one so I chose Python.</p>
<p>After googling for 2 minutes about basic Python syntax and looking for function descriptions I came up with the solution, which was really straightforward and worked super-duper.</p>
<blockquote><p>import subprocess</p>
<p>program = subprocess.Popen(['C:\path\to\program.exe, arg1, argn'], shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE);</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 105px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>ret = check_ad.communicate(username + &#8221; &#8221; + group[0])</div>
<p>ret = program.communicate(&#8220;writing to stdin&#8221;);</p>
<p>print ret</p>
<p><em>Read from stdout</em></p></blockquote>
<p>Really easy and simple code that can save someones life when working under pressure and do not have time to read a dozen of C/C++ examples.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.advansen.com/2009/08/27/glueing-applications-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back to Work: SQUID + Active Directory</title>
		<link>http://www.advansen.com/2009/08/25/back-to-work-squid-active-directory/</link>
		<comments>http://www.advansen.com/2009/08/25/back-to-work-squid-active-directory/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 16:39:20 +0000</pubDate>
		<dc:creator>Gabriel Gonzalez</dc:creator>
				<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://www.advansen.com/?p=77</guid>
		<description><![CDATA[This post doesn&#8217;t mean I haven&#8217;t been working for the last two years! Just I haven&#8217;t been in the mood to post. I want to keep adding notes to this blog so I can remember those little easy-forgetable things I spend some time figuring out so I can get back to blog in the near [...]]]></description>
			<content:encoded><![CDATA[<p>This post doesn&#8217;t mean I haven&#8217;t been working for the last two years! Just I haven&#8217;t been in the mood to post. I want to keep adding notes to this blog so I can remember those little easy-forgetable things I spend some time figuring out so I can get back to blog in the near future and do not waste time again.</p>
<p>These days I have been playing with <strong><em>SQUID </em></strong>and the <strong><em>external ACL</em></strong> feature which allow the user to add some amount of customization without too many work. The syntax for those external ACL is the following:</p>
<blockquote><p>external_acl_type &lt;type-name&gt; %&lt;PARAMETER&gt; /path/to/external/program</p></blockquote>
<p>That&#8217;s how you define an external acl to be used afterwards. There a bunch of allowed parameters, the external program can read from the stdin, as follow:</p>
<blockquote><dt>%LOGIN</dt>
<dt>%IDENT</dt>
<dt>%SRC</dt>
<dt>%DST</dt>
<dt>%PROTO</dt>
<dt>%PORT</dt>
<dt>%METHOD</dt>
<dt>%{Header}</dt>
<dt> </dt>
</blockquote>
<dt>The external program must return &#8220;ERR&#8221; or &#8220;OK&#8221; to the stdout and restricted reduced info such as &#8220;ERR error=\&#8221;Error message\&#8221;" or &#8220;OK user=username&#8221;. Squid doesn&#8217;t allow return any other parameter, which IMHO is terrible awful!! Enabling the return of arbitrary date would increase in an order of magnitude the power of SQUID.</dt>
<dt> </dt>
<dt>Why have I been using these External ACL? Because I want to be able to check data against an Active Directory. I haven&#8217;t reach really far yet, I have just configured the AD</dt>
<dt> </dt>
<blockquote><dt>dcpromo</dt>
</blockquote>
<dt> </dt>
<dt>and that&#8217;s all.</dt>
<dt>
</dt>
<dt><strong>Update:</strong> There are a few more return parameters, but still fixed and not enough IMHO.</dt>
<dt> </dt>
]]></content:encoded>
			<wfw:commentRss>http://www.advansen.com/2009/08/25/back-to-work-squid-active-directory/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Long long time ago</title>
		<link>http://www.advansen.com/2007/09/13/long-long-time-ago/</link>
		<comments>http://www.advansen.com/2007/09/13/long-long-time-ago/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 09:37:48 +0000</pubDate>
		<dc:creator>Gabriel Gonzalez</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.advansen.com/2007/09/13/long-long-time-ago/</guid>
		<description><![CDATA[Not enough time to keep this blog up to dates with articles and stuff. But soon I will be presenting a really nice and innovative tool which is gonna make our life better. See you soon
]]></description>
			<content:encoded><![CDATA[<p>Not enough time to keep this blog up to dates with articles and stuff. But soon I will be presenting a really nice and innovative tool which is gonna make our life better. See you soon</p>
]]></content:encoded>
			<wfw:commentRss>http://www.advansen.com/2007/09/13/long-long-time-ago/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protocol Specification with UML</title>
		<link>http://www.advansen.com/2007/02/26/protocol-specification-with-uml/</link>
		<comments>http://www.advansen.com/2007/02/26/protocol-specification-with-uml/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 16:33:25 +0000</pubDate>
		<dc:creator>Gabriel Gonzalez</dc:creator>
				<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://www.advansen.com/2007/02/26/protocol-specification-with-uml/</guid>
		<description><![CDATA[When building distributed application sometimes you need to use some kind of protocol to allow your parts to communicate each other. In the simple example I have been using for a while where you have an embedded client asking to a centralized server for new firmware updates, you have to establish a way to log [...]]]></description>
			<content:encoded><![CDATA[<p>When building distributed application sometimes you need to use some kind of protocol to allow your parts to communicate each other. In the simple example I have been using for a while where you have an embedded client asking to a centralized server for new firmware updates, you have to establish a way to log into the server and ask for the next available version you can upgrade.</p>
<p>Along with the Class and sequence diagrams you have to use the State Machine diagrams or Protocol State Machine diagrams. The main difference is in the second one you do not need to specify embedded states.</p>
<p>I will write a longer post with some diagrams and nifty stuff <img src='http://www.advansen.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.advansen.com/2007/02/26/protocol-specification-with-uml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
