<?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>iXce's blog &#187; Tips</title>
	<atom:link href="http://guillaume.segu.in/blog/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://guillaume.segu.in/blog</link>
	<description>Stuff that doesn’t matter</description>
	<lastBuildDate>Mon, 28 Feb 2011 22:28:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Accepting invalid SSL certs in Thunderbird</title>
		<link>http://guillaume.segu.in/blog/tips/265/accepting-invalid-ssl-certs-in-thunderbird/</link>
		<comments>http://guillaume.segu.in/blog/tips/265/accepting-invalid-ssl-certs-in-thunderbird/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 04:46:09 +0000</pubDate>
		<dc:creator>iXce</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[exception]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[thunderbird]]></category>

		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=265</guid>
		<description><![CDATA[Since Thunderbird 3 (or maybe before that), when you encounter an invalid SSL certificate, the GUI doesn&#8217;t even offer you to add an exception as in Firefox. Counter-intuitively, the same GUI than in Firefox is actually, available you just have to dig it through the menus. Here is a step-by-step tutorial with screenshots (had to [...]]]></description>
			<content:encoded><![CDATA[<p>Since Thunderbird 3 (or maybe before that), when you encounter an invalid SSL certificate, the GUI doesn&#8217;t even offer you to add an exception as in Firefox. Counter-intuitively, the same GUI than in Firefox is actually, available you just have to dig it through the menus. Here is a step-by-step tutorial with screenshots (had to do them for a doc, thought I&#8217;d share).</p>
<div id="attachment_266" class="wp-caption aligncenter" style="width: 440px"><a href="http://guillaume.segu.in/blog/wp-content/uploads/2010/07/thunderbird-cert-1.png"><img src="http://guillaume.segu.in/blog/wp-content/uploads/2010/07/thunderbird-cert-1.png" alt="" title="Go to Account Settings" width="430" height="424" class="size-full wp-image-266" /></a><p class="wp-caption-text">Go to Account Settings</p></div>
<div id="attachment_267" class="wp-caption aligncenter" style="width: 857px"><a href="http://guillaume.segu.in/blog/wp-content/uploads/2010/07/thunderbird-cert-2.png"><img src="http://guillaume.segu.in/blog/wp-content/uploads/2010/07/thunderbird-cert-2.png" alt="" title="In Security menu select View Certificates (alternatively, you can get there through Edit, Preferences, Advanced, Certificates, View Certificates if you have no Security menu here)" width="847" height="682" class="size-full wp-image-267" /></a><p class="wp-caption-text">In Security menu select View Certificates (alternatively, you can get there through Edit, Preferences, Advanced, Certificates, View Certificates if you have no Security menu here)</p></div>
<div id="attachment_268" class="wp-caption aligncenter" style="width: 618px"><a href="http://guillaume.segu.in/blog/wp-content/uploads/2010/07/thunderbird-cert-3.png"><img src="http://guillaume.segu.in/blog/wp-content/uploads/2010/07/thunderbird-cert-3.png" alt="" title="In Servers tab, hit Add Exception" width="608" height="428" class="size-full wp-image-268" /></a><p class="wp-caption-text">In Servers tab, hit Add Exception</p></div>
<div id="attachment_269" class="wp-caption aligncenter" style="width: 515px"><a href="http://guillaume.segu.in/blog/wp-content/uploads/2010/07/thunderbird-cert-4.png"><img src="http://guillaume.segu.in/blog/wp-content/uploads/2010/07/thunderbird-cert-4.png" alt="" title="Enter the address:port of the service you are using (without any protocol://) and hit Get Certificate" width="505" height="508" class="size-full wp-image-269" /></a><p class="wp-caption-text">Enter the address:port of the service you are using (without any protocol://) and hit Get Certificate</p></div>
<div id="attachment_270" class="wp-caption aligncenter" style="width: 521px"><a href="http://guillaume.segu.in/blog/wp-content/uploads/2010/07/thunderbird-cert-5.png"><img src="http://guillaume.segu.in/blog/wp-content/uploads/2010/07/thunderbird-cert-5.png" alt="" title="Hit Confirm Security Exception, and you&#039;re done !" width="511" height="510" class="size-full wp-image-270" /></a><p class="wp-caption-text">Hit Confirm Security Exception, and you're done !</p></div>
]]></content:encoded>
			<wfw:commentRss>http://guillaume.segu.in/blog/tips/265/accepting-invalid-ssl-certs-in-thunderbird/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vim (on windows or not) configuration tips</title>
		<link>http://guillaume.segu.in/blog/home/121/vim-tips/</link>
		<comments>http://guillaume.segu.in/blog/home/121/vim-tips/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 07:45:56 +0000</pubDate>
		<dc:creator>iXce</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[~home]]></category>

		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=121</guid>
		<description><![CDATA[For a project of mine (involving LEJOS-OSEK, mostly), I&#8217;m forced (well, almost) to use Windows, which my dear VirtualBox virtualizes fairly well on my clean Linux host. I obviously setup vim for my coding needs, but its default behavior isn&#8217;t quite what we are used to on other platforms. For instance visual mode selection with [...]]]></description>
			<content:encoded><![CDATA[<p>For a project of mine (involving <a href="http://lejos-osek.sourceforge.net/">LEJOS-OSEK</a>, mostly), I&#8217;m <em>forced</em> (well, almost) to use Windows, which my dear <a href="http://www.virtualbox.org/">VirtualBox</a> virtualizes fairly well on my <em>clean</em> Linux host. I <em>obviously</em> setup vim for my coding needs, but its default behavior isn&#8217;t quite what we are used to on other platforms. For instance visual mode selection with arrows requires you to hold Shift, while it doesn&#8217;t elsewhere and backup files are created upon write.</p>
<p>So, let&#8217;s edit the .vimrc file, which actually is at VIM_INSTALL_PATH\_vimrc (for instance C:\Program Files\vim\_vimrc with the default install options).<br />
Disabling backup files is as simple as adding</p>
<pre><code>set nobackup</code></pre>
<p>Getting visual mode arrows selection is a bit different, as explained in <a href="http://http://www.vim.org/tips/tip.php?tip_id=864">vim tip 864 comments</a>, you can either add</p>
<pre><code>set keymodel-=stopsel</code></pre>
<p>around the end of the file<br />
or drop the</p>
<pre><code>behave mswin</code></pre>
<p>line from the default vimrc.</p>
<p>Here are two other (non windows-specific) tips:<br />
Bash like filename completion:</p>
<pre><code>set wildmode=longest:full
set wildmenu</code></pre>
<p>Pythonic smart indent:</p>
<pre><code>autocmd BufRead *.py set ai et ts=4 sw=4 sts=4
autocmd FileType python set ai et ts=4 sw=4 sts=4
autocmd BufRead *.pyx set ai et ts=4 sw=4 sts=4
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class</code></pre>
<p>See also <a href="http://blog.micampe.it/articles/2006/10/20/vim-tango-color-scheme">this pretty Tango color scheme for vim</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://guillaume.segu.in/blog/home/121/vim-tips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>molly-guard: prevent accidental shutdowns/reboots</title>
		<link>http://guillaume.segu.in/blog/home/118/molly-guard-prevent-accidental-shutdownsreboots/</link>
		<comments>http://guillaume.segu.in/blog/home/118/molly-guard-prevent-accidental-shutdownsreboots/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 17:07:46 +0000</pubDate>
		<dc:creator>iXce</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[~home]]></category>

		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=118</guid>
		<description><![CDATA[Have you ever mistakenly shut down or rebooted your operation-critical server while you were willing to halt your desktop computer through ssh before going to bed, or anything like this? If so, and if you are on Debian/Ubuntu, molly-guard is designed for you: this nifty bash script gets between you and the shutdown/reboot/halt tools, checking [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever mistakenly shut down or rebooted your operation-critical server while you were willing to halt your desktop computer through ssh before going to bed, or anything like this? If so, and if you are on Debian/Ubuntu, <a href="http://packages.debian.org/unstable/admin/molly-guard">molly-guard</a> is designed for you: this nifty bash script gets between you and the shutdown/reboot/halt tools, checking if you are connecting through ssh and if so asking for the hostname of the machine before proceeding.</p>
<p>Wondering how it looks? Here is the output of a little test:</p>
<pre><code>ixce@timmy:~$ sudo shutdown -r
W: molly-guard: SSH session detected!
Please type in hostname of the machine to shutdown:
Good thing I asked; I won't shutdown timmy ...</code></pre>
<p>Since it doesn&#8217;t correctly handle sudo yet (actually sudo is at fault here, since it drops SSH_CONNECTION environment variable when doing its stuff), you might want to add PRETEND_SSH around the beginning of /usr/sbin/shutdown <a href="http://nion.modprobe.de/blog/archives/570-Installing-molly-guard.html">as specified on Nico &#8220;nion&#8221; Golde&#8217;s blog</a>.</p>
<p>You might also want to grab the <a href="http://guillaume.segu.in/packages/molly-guard/molly-guard_0.3.2-1_all.deb">molly-guard 0.3.2 etch package</a> I backported from sid (all I changed is downgrade debhelper build-dep version and debhelper compatibility level in debian/compat since etch only has debhelper 5 and the sid package required debhelper 6 ; this shouldn&#8217;t break anything since the newer debhelper just seems to be needed to recognize a few fields in debian/control about where the package is maintained). <a href="http://guillaume.segu.in/packages/molly-guard/">Sources are also available</a>, anyway.</p>
<p>Thanks <a href="http://www.bonz.org/tech/">hr</a> for the tip <img src='http://guillaume.segu.in/blog/wp-includes/images/smilies/smile.png' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://guillaume.segu.in/blog/home/118/molly-guard-prevent-accidental-shutdownsreboots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tip of the day: Dynamic forms with Django newforms</title>
		<link>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/</link>
		<comments>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 21:03:57 +0000</pubDate>
		<dc:creator>iXce</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[~home]]></category>

		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=116</guid>
		<description><![CDATA[Building dynamic forms with Django newforms module is quite undocumented, though it&#8217;s quite easy to do. All you need to do is to hook up the __init__ function of the form, raise the __init__ to the parent forms.Form class and then add your dynamically generated fields to self.fields dict. Here is a quick snippet demonstrating [...]]]></description>
			<content:encoded><![CDATA[<p>Building dynamic forms with Django newforms module is quite undocumented, though it&#8217;s quite easy to do. All you need to do is to hook up the __init__ function of the form, raise the __init__ to the parent forms.Form class and then add your dynamically generated fields to self.fields dict.</p>
<p>Here is a quick snippet demonstrating it, which will create a form with n integer fields named from 0 to (n &#8211; 1), but you will easily be able to heavily extend it.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> django <span style="color: #ff7700;font-weight:bold;">import</span> newforms <span style="color: #ff7700;font-weight:bold;">as</span> forms
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> MyForm <span style="color: black;">&#40;</span>forms.<span style="color: black;">Form</span><span style="color: black;">&#41;</span>:
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span> <span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, n, <span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>:
        forms.<span style="color: black;">Form</span>.<span style="color: #0000cd;">__init__</span> <span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, <span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span> <span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, n<span style="color: black;">&#41;</span>:
            field = forms.<span style="color: black;">IntegerField</span> <span style="color: black;">&#40;</span>label = <span style="color: #483d8b;">&quot;%d&quot;</span> <span style="color: #66cc66;">%</span> i, required = <span style="color: #008000;">True</span>,
                                        min_value = <span style="color: #ff4500;">0</span>, max_value = <span style="color: #ff4500;">200</span><span style="color: black;">&#41;</span>
            <span style="color: #008000;">self</span>.<span style="color: black;">fields</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;%d&quot;</span> <span style="color: #66cc66;">%</span> i<span style="color: black;">&#93;</span> = field</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Xen tip</title>
		<link>http://guillaume.segu.in/blog/tips/95/xen-tip/</link>
		<comments>http://guillaume.segu.in/blog/tips/95/xen-tip/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 11:56:04 +0000</pubDate>
		<dc:creator>iXce</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://guillaume.segu.in/blog/tips/95/xen-tip/</guid>
		<description><![CDATA[Dear Google friend, Could you please keep this little tip safe and warm? If your friendly Xen hypervisor stops outputting during the boot process at some point and completely freezes, or just stops until you get X or so, just add &#8220;console=vga vga=keep&#8221; to your Xen kernel line in your GRUB configuration, so that it [...]]]></description>
			<content:encoded><![CDATA[<p>Dear Google friend,</p>
<p>Could you please keep this little tip safe and warm?<br />
If your friendly Xen hypervisor stops outputting during the boot process at some point and completely freezes, or just stops until you get X or so, just add &#8220;console=vga vga=keep&#8221; to your Xen kernel line in your GRUB configuration, so that it looks like this:</p>
<p><code>title		Xen 3.1<br />
root		(hd0,4)<br />
kernel		/xen-3.1.gz console=vga vga=keep noreboot<br />
module		/vmlinuz-2.6.19-4-generic root=/dev/mapper/lvm-root ro console=tty0<br />
module		/initrd.img-2.6.19-4-generic<br />
</code></p>
<p>Thanks dear.</p>
]]></content:encoded>
			<wfw:commentRss>http://guillaume.segu.in/blog/tips/95/xen-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sed tip</title>
		<link>http://guillaume.segu.in/blog/code/58/sed-tip/</link>
		<comments>http://guillaume.segu.in/blog/code/58/sed-tip/#comments</comments>
		<pubDate>Tue, 31 Jul 2007 13:30:31 +0000</pubDate>
		<dc:creator>iXce</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://guillaume.segu.in/blog/code/58/sed-tip/</guid>
		<description><![CDATA[Quick sed tip : C++ // comments to C /* comments */ : sed -e "s/\/\/\(.*\)$/\/*\1 *\//"(yes, I know that sed -r -e &#8220;s,//(.*),/*\1 */,&#8221; looks a lot better, but it&#8217;s just too obvious to read )]]></description>
			<content:encoded><![CDATA[<p>Quick sed tip :<br />
C++ <strong>//</strong> comments to C <strong>/*</strong> comments <strong>*/</strong> :<br />
<code>sed -e "s/\/\/\(.*\)$/\/*\1 *\//"</code>(yes, I know that sed -r -e &#8220;s,//(.*),/*\1 */,&#8221; looks a lot better, but it&#8217;s just too obvious to read <img src='http://guillaume.segu.in/blog/wp-includes/images/smilies/tongue.png' alt=':p' class='wp-smiley' /> )</p>
]]></content:encoded>
			<wfw:commentRss>http://guillaume.segu.in/blog/code/58/sed-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

