<?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>Baking Noodles &#187; linux</title>
	<atom:link href="http://bakingnoodles.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://bakingnoodles.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 26 May 2010 14:18:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Geany: The Linux text editor for ex-Windows users</title>
		<link>http://bakingnoodles.com/2009/09/geany-the-linux-text-editor-for-ex-windows-users/</link>
		<comments>http://bakingnoodles.com/2009/09/geany-the-linux-text-editor-for-ex-windows-users/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 16:24:16 +0000</pubDate>
		<dc:creator>Simon Oxley</dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://bakingnoodles.com/?p=153</guid>
		<description><![CDATA[Ok, this is going to be controversial . . .
Today I found Geany . . . and my search for the perfect Linux text-editor finally ended. If you&#8217;re already a VIM or Emacs ninja then you may want to stop reading now, if however you come from a Windows background (like me) or you like [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, this is going to be controversial . . .</p>
<p>Today I found <a title="Geany.org" href="http://www.geany.org/">Geany</a> . . . and my search for the perfect Linux text-editor finally ended. If you&#8217;re already a VIM or Emacs ninja then you may want to stop reading now, if however you come from a Windows background (like me) or you like the niceties a true GUI tool can offer, then Geany may be everything you&#8217;ve been looking for.</p>
<p>I use Python, so whitespace management is *very* important to me, for this I need some key functionality:</p>
<ul>
<li>Whitespace display</li>
<li>Correct tab/space handling</li>
</ul>
<p>On Windows my editor of choice was <a title="Notepad++" href="http://notepad-plus.sourceforge.net/">Notepad++</a>, it did all of above superbly. When I moved to Linux most of my development-related tasks became much easier, however I sorely missed some of the key editing  features that I had become used to (as a side note &#8211; I also miss the GUI repo browsing offered by the <a title="TortoiseHG" href="http://bitbucket.org/tortoisehg/stable/">TortoiseHG</a>).</p>
<h3>Why I love Geany</h3>
<p>It&#8217;s fast, lightweight and has some killer features . . .</p>
<h4>1. Whitespace</h4>
<p>Geany shows whitespace clearly.  It handles tabs and spaces properly without interchanging the two. These features make all Python indentation issues just drift away.<br />
<img class="size-full wp-image-154 alignnone" style="margin-top: 15px; margin-bottom: 15px;" title="whitespace" src="http://bakingnoodles.com/wp-content/uploads/whitespace.png" alt="Geany Whitespace" width="300" height="240" /></p>
<h4>2. Folding</h4>
<p>It&#8217;s great to be able to collapse all the classes and functions that you&#8217;re not working on to save some screen real-estate (not to mention the scrolling up/down).<br />
<img class="size-full wp-image-155 alignnone" style="margin-top: 15px; margin-bottom: 15px;" title="folding" src="http://bakingnoodles.com/wp-content/uploads/folding.png" alt="Geany Folding" width="300" height="240" /></p>
<h4>3. Class/Function browser</h4>
<p>This sealed the deal. The browser on the left pane lists all the classes, functions, variables and imports found in the open file. This makes navigation very quick, and is a boon for working your way around an unfamiliar piece of code.<br />
<img class="size-full wp-image-156 alignnone" title="symbols" src="http://bakingnoodles.com/wp-content/uploads/symbols.png" alt="Geany Symbols" width="300" height="240" /></p>
<h4>3. Other great stuff</h4>
<p>And there&#8217;s more: Built-in file browser, shell, scratchpad, and support for 3rd-party plugins are just some of the other great features that Geany has to offer. As a bonus, Geany can also run on Windows too.</p>
<p>So Geany it is, and I&#8217;m finally happy. Here are some of the other editors I tried (and why they didn&#8217;t quite fit the bill for me).</p>
<p><strong>Gedit</strong><br />
The default editor in Ubuntu is actually a really nice little tool and does 99% of what I need, but something I cannot live without is whitespace display. None of the available Gedit plugins seem to offer this..</p>
<p><strong>VIM</strong><br />
Immensely powerful, but has a learning curve that right now I&#8217;m just to busy for.</p>
<p><strong>Emacs</strong><br />
See VIM.</p>
<p><strong>Wing IDE</strong><br />
I had high hope for <a title="Windg IDE" href="http://www.wingware.com/">Wing</a>, but it let me down massively when it started to mix up tabs and spaces within the same indented sections.</p>
<p><strong>Eclipse</strong><br />
I really don&#8217;t want to wait 10mins for Eclipse to load every day. It&#8217;s far too big for my needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://bakingnoodles.com/2009/09/geany-the-linux-text-editor-for-ex-windows-users/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Command Line Email with Django and Gmail</title>
		<link>http://bakingnoodles.com/2009/03/command-line-email-with-django-and-gmail/</link>
		<comments>http://bakingnoodles.com/2009/03/command-line-email-with-django-and-gmail/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 12:55:48 +0000</pubDate>
		<dc:creator>Simon Oxley</dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://bakingnoodles.com/?p=35</guid>
		<description><![CDATA[I needed to find a way to send email reports from a scheduled cron job. I looked for a simple linux command-line email solution but couldn&#8217;t find anything that fitted the bill. I was already using Django&#8217;s EmailMessage class in an existing app, so I started to think about how I could re-use it for [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to find a way to send email reports from a scheduled cron job. I looked for a simple linux command-line email solution but couldn&#8217;t find anything that fitted the bill. I was already using <a href="http://docs.djangoproject.com/en/dev/topics/email/#the-emailmessage-and-smtpconnection-classes">Django&#8217;s EmailMessage</a> class in an existing app, so I started to think about how I could re-use it for scheduled jobs.</p>
<p>I&#8217;m using linux in this scenario, but it would probably work fine in Windows too.</p>
<p>First I configured my cron job (actually the .sh script that cron job runs) to output to a file called <code>report.txt</code>. This would be overwritten each time the job ran, so would always be the latest version.</p>
<p>An existing Django project <code>settings.py</code> had the following settings to enable email sending via a Gmail (or Google Apps) account. The settings are based on Nathan Ostgard&#8217;s <a href="http://nathanostgard.com/archives/2007/7/2/gmail_and_django/">Gmail and Django</a> article.<a href="http://nathanostgard.com/archives/2007/7/2/gmail_and_django/"><br />
</a></p>
<pre class="brush: python">

EMAIL_HOST = &#039;smtp.gmail.com&#039;
EMAIL_HOST_USER = &#039;user@domain.com&#039;
EMAIL_HOST_PASSWORD = &#039;password&#039;
EMAIL_PORT = 587
EMAIL_USE_TLS = True
</pre>
<p>So I knocked up a standalone python script <code>sendreport.py</code> that would take these settings and email the <code>report.txt</code> file to me.</p>
<pre class="brush: python">
#!/user/bin/python
#
# Get settings from an existing django project
import sys
import os
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), &#039;/..&#039;))
os.environ[&#039;DJANGO_SETTINGS_MODULE&#039;] = &#039;my_django_project.settings&#039;

from django.core.mail import EmailMessage

# Set up email fields
recipient = &#039;myemail@mydomain.com&#039;
subject = &#039;CRON Job Report&#039;
body = &#039;CRON Job Report for blah, blah, blah . . .&#039;

# Create email object, attach file, send
email = EmailMessage(subject, body, to = [recipient])
email.attach_file(&#039;report.txt&#039;)
email.send()
</pre>
<p>The <code>EmailMessage </code>class makes it very easy to attach a file and send the email.  I can tag this on to the end of the .sh script executed by the cron job and jobs-a-good-un <img src='http://bakingnoodles.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Well sort of . .  it&#8217;s functional, but not ideal. It works by reading email settings from an existing Django app&#8217;s <code>setting.py</code>. I wanted it to be more portable, and not dependent on a specific Django configuration/app.</p>
<p>Then I found out that you can specify Django settings from within a standalone python script. Could this method be used to break any dependencies and make the script more portable? Absolutely!</p>
<pre class="brush: python">
#!/user/bin/python
#
# Configure some standalone django settings
# These settings are for a gmail or google apps account
from django.conf import settings
settings.configure (
EMAIL_HOST = &#039;smtp.gmail.com&#039;
EMAIL_HOST_USER = &#039;user@domain.com&#039;
EMAIL_HOST_PASSWORD = &#039;password&#039;
EMAIL_PORT = 587
EMAIL_USE_TLS = True
)

from django.core.mail import EmailMessage
import datetime
import sys
import socket

# Get the hostname and current time to put in the email
hostname = socket.gethostname()
timestamp = datetime.datetime.now().ctime()

# Set up email fields
recipient = &#039;myemail@mydomain.com&#039;
subject = &#039;%s CRON Job Report: %s&#039; % (hostname, timestamp)
body = &#039;Report for %s on %s attached&#039; % (hostname, timestamp)

# Create email object, attach file, send
email = EmailMessage(subject, body, to = [recipient])
email.attach_file(&#039;bkp_report.txt&#039;)
email.send()
</pre>
<p>I also made use of <code>hostname()</code>and <code>datetime()</code> to provide some more detail for the email subject and body.</p>
<p>Now the only dependency is Django itself &#8211; which I&#8217;m happy with, my job reports are archived in email &#8211; which I like, and I get to use more Python &#8211; which is good for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://bakingnoodles.com/2009/03/command-line-email-with-django-and-gmail/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
