<?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>Fahhem's Blog &#187; Software</title>
	<atom:link href="http://fahhem.com/blog/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://fahhem.com/blog</link>
	<description>An intermittent post of thoughts.</description>
	<lastBuildDate>Sun, 29 Aug 2010 23:34:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Django debug toolbar Profiling</title>
		<link>http://fahhem.com/blog/2010/08/django-debug-toolbar-profiling/</link>
		<comments>http://fahhem.com/blog/2010/08/django-debug-toolbar-profiling/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 12:04:10 +0000</pubDate>
		<dc:creator>Fahhem</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://fahhem.com/blog/?p=133</guid>
		<description><![CDATA[I spent the past half-hour trying to debug a problem that turned out to be from debugging, profiling to be exact. If you&#8217;re doing a quick google for profiling with django-debug-toolbar, you may be tempted to use adurdin&#8217;s Profiling Panel. I&#8217;m writing this to tell you to WATCH OUT!! Now, this isn&#8217;t personal, so sorry [...]]]></description>
			<content:encoded><![CDATA[<p>I spent the past half-hour trying to debug a problem that turned out to be from debugging, profiling to be exact. If you&#8217;re doing a quick google for profiling with django-debug-toolbar, you may be tempted to use <a href="http://backslashn.com/post/505601626/profiling-execution-with-the-django-debug-toolbar">adurdin&#8217;s Profiling Panel</a>. I&#8217;m writing this to tell you to WATCH OUT!!</p>
<p>Now, this isn&#8217;t personal, so sorry adurdin, but your panel can break things. It runs the view twice, no matter what view, which means if you are adding new objects in the view, you&#8217;re gonna get two new objects and have no clue why it&#8217;s happening. I thought I had somehow pushed a bug into the admin site as I kept making two of everything, no matter what.</p>
<p>This may be a drawback of profiling outside of middleware, I can&#8217;t find any django-debug-toolbar based profiling systems that don&#8217;t call the view twice, but it likely is possible inside of a middleware that pushes its data over to a panel on the far end of a request.</p>
<p>There was a <a href="http://github.com/robhudson/django-debug-toolbar/issues/#issue/1">promise made for a singe-call panel</a> but after trying it, there&#8217;s no fix for the double-call nor does it even work with the latest debug-toolbar. If anybody knows of a profiling debug-toolbar panel (or writes one), comment below and I&#8217;ll write a post and publicize it.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;"><a href="http://twitter.com/adurdin/">adurdin</a></div>
]]></content:encoded>
			<wfw:commentRss>http://fahhem.com/blog/2010/08/django-debug-toolbar-profiling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Native and Cross-Compiling Pidgin on Linux (Debian)</title>
		<link>http://fahhem.com/blog/2010/08/native-and-cross-compiling-pidgin-on-linux-debian/</link>
		<comments>http://fahhem.com/blog/2010/08/native-and-cross-compiling-pidgin-on-linux-debian/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 06:20:46 +0000</pubDate>
		<dc:creator>Fahhem</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://fahhem.com/blog/?p=128</guid>
		<description><![CDATA[Recently I&#8217;ve been working a little on my plugin for Pidgin (Google Talk Invisible) but my Windows computer has been formatted since I last worked on it so I no longer had my Windows compiling environment. So I spent some time and created two working environments (one for libpurple 2.5.1 and 2.7.1) so that I [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been working a little on my plugin for Pidgin (Google Talk Invisible) but my Windows computer has been formatted since I last worked on it so I no longer had my Windows compiling environment. So I spent some time and created two working environments (one for libpurple 2.5.1 and 2.7.1) so that I can compile both Linux (.so) and Windows (.dll) plugins for both versions. I chose 2.5.1 because my Palm Pre reports using that version of libpurple, so if someone wants to push my plugin into a package for Preware they can without recompiling it.</p>
<h2>Environment 2.5.1</h2>
<p>So to build the version 2.5.1 environment, I followed <a href="http://code.google.com/p/pidgin-privacy-please/wiki/HowToCrossCompileForWindows">these (Windows) instructions</a> and <a href="http://developer.pidgin.im/wiki/Installing%20Pidgin#Compiling">these (Linux) instructions</a></p>
<h3>Linux</h3>
<p>For compiling in Linux, since I only want a plugin, I ran configure with parameters to disable all the pieces I didn&#8217;t care about and didn&#8217;t have the libraries for:</p>
<p>./configure &#8211;disable-gtkui &#8211;disable-gstreamer &#8211;disable-vv &#8211;disable-idn &#8211;disable-meanwhile &#8211;disable-avahi &#8211;disable-nm &#8211;disable-nss &#8211;disable-gnutls &#8211;disable-tcl</p>
<h3>Windows</h3>
<p>For Windows, I followed the instructions and stopped after the local.mak instruction and ran &#8220;make -f Makefile.mingw&#8221; on $BUILDDIR/pidgin-2.5.1 but at some point it wants &#8220;dlfcn.h&#8221; so I just let it error out.</p>
<h3>Compiling</h3>
<p>I cd into pidgin-2.5.1/libpurple/plugins/ and checkout my git repository. I then run &#8220;make gtalkinvisible.so; make -f Makefile.mingw gtalkinvisible.dll&#8221; and a few other commands to zip/tar the files and upload them to my website and update the version/Changelog.</p>
<h2>Environment 2.7.1</h2>
<p>It may be possible to combine these, despite the relative change in packages that breaks the gaim-extprefs project, but I didn&#8217;t bother. Thanks to the <a href="http://code.google.com/p/pidgin-privacy-please/wiki/HowToCrossCompileForWindowsAgainstLatestPidgin">pidgin-privacy-please plugin for Windows instructions for the latest pidgin releases</a> too, as they made the previous instructions as well. They&#8217;re instructions were perfect, better than Pidgin&#8217;s own Wiki.</p>
<h3>Linux</h3>
<p>These instructions were as simple as before, except I downloaded 2.7.1. Same simple setup if you don&#8217;t care about the libraries necessary for compiling the rest of Pidgin.</p>
<h3>Windows</h3>
<p>Following the instructions from above was super easy, I just had a small hiccup along the way that is super easy to fix. Just replace the first export to this:</p>
<pre>export PIDGIN_DEV_ROOT=/tmp/build
</pre>
<p>Once you&#8217;ve done that, you can literally copy-paste almost the whole page as a script and copy-paste the local.mak file and you&#8217;re done. Of course, I didn&#8217;t use /tmp/build as my directory because I wanted to keep my environment around as well as have it fit into my ~/projects/ schema. I basically put it into my existing ~/projects/pidgin/ folder as /before270/ and /after270/ for the two environments.</p>
<p>So now I can update the plugin easier and upload both Linux and Windows binaries. If anyone knows how to compile automatic Windows installers, please comment so that I can create some sort of a shell repository for plugins. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://fahhem.com/blog/2010/08/native-and-cross-compiling-pidgin-on-linux-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django and Stored Procedures</title>
		<link>http://fahhem.com/blog/2010/06/django-and-stored-procedures/</link>
		<comments>http://fahhem.com/blog/2010/06/django-and-stored-procedures/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 21:38:20 +0000</pubDate>
		<dc:creator>Fahhem</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://fahhem.com/blog/?p=123</guid>
		<description><![CDATA[There is no code to go along with this post because I haven&#8217;t had the time or use-case to develop it yet, but it was an idea spawned from the ORM of Django and some maintenance I was doing in a PHP project. Basically, Django&#8217;s built-in ORM is awesome, but lacking. There are many reasons [...]]]></description>
			<content:encoded><![CDATA[<p>There is no code to go along with this post because I haven&#8217;t had the time or use-case to develop it yet, but it was an idea spawned from the ORM of Django and some maintenance I was doing in a PHP project.</p>
<p>Basically, Django&#8217;s built-in ORM is awesome, but lacking. There are many reasons to move to SQLAlchemy, but not if you&#8217;re more interested in speed of development. One feature that Django&#8217;s ORM is missing is stored procedure support, including the ability to make them quickly.</p>
<p>A stored procedure is basically a function definition on the database side that runs a few to hundreds of lines of SQL and returns the result, decreasing the amount of SQL sent over the network. This is very useful for complicated statements that are called often, say once for every single page, but require only a few variables if any. A use-case in my PHP project was where 99% of the pages ran the same lookup query which consisted of about 10 lines of SQL; instead of sending that SQL over (around half a KB) each time, I replaced the SQL with &#8220;CALL generic_lookup($pageid)&#8221; or in Python &#8220;CALL generic_lookup(%s)&#8221; % pageid.</p>
<p>Now, to port this to Django we need a two-phrase process. The first one creates the procedures in the database, the second replaces normal ORM calls with stored procedures.</p>
<p>I have not made this, but here are the specifications for the code that would take only a few hours to create and a few more to debug (if only I had the time):</p>
<p>A decorator for models.Manager functions. Called @stored, it will function in both phases differently. For the creation phase, it will simply tag the function it is wrapping with func.is_stored = True, allowing introspecting code to identify it as a stored procedure. It will also make the wrapped function available like so:</p>
<pre>@stored
def all(self):
    return self.get_query_set()

all.is_stored == True
str(all.func.__class__) == &lt;type 'function'&gt;</pre>
<p>The first phase also involves a management command that goes through every model&#8217;s managers and looks for stored procedures using the .is_stored property created above. The .is_stored and .func properties could be combined.</p>
<p>This management command, having found all the stored procedures, will then proceed to get the SQL for each QuerySets and wrap it with the DB-specific code for stored-procedures (MySQL&#8217;s is provided earlier). Once the SQL has been wrapped, it is sent to the DB for creation and the procedure is now available. The SQL will need some filter to allow for arguments to the stored procedures, but that&#8217;s a whole other can of worms for a possible continuation of this post.</p>
<p>Once the procedures have been created on the DB, the @stored decorator now just ignores the function it&#8217;s wrapping save for its name and arguments and returns the dataset returned by the database after a call to the stored procedure. Since most databases don&#8217;t allow further filtering on procedure output, returning the dataset is the only way to easily keep loose-coupling with the DB.</p>
<p>I hope this post was useful to someone else who can code in Python/Django. If you create a decorator using these specifications, please post a link in the comments so that others can benefit from it too. If I write it, I&#8217;ll definitely provide the app somehow, though I don&#8217;t see it in my near future.</p>
]]></content:encoded>
			<wfw:commentRss>http://fahhem.com/blog/2010/06/django-and-stored-procedures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 7 Jump Lists and PuTTY</title>
		<link>http://fahhem.com/blog/2010/03/windows-7-jump-lists-and-putty/</link>
		<comments>http://fahhem.com/blog/2010/03/windows-7-jump-lists-and-putty/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 09:21:32 +0000</pubDate>
		<dc:creator>Fahhem</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://fahhem.com/blog/?p=116</guid>
		<description><![CDATA[Recently I had the good fortune to upgrade my hard drive to 120GB and felt that while I&#8217;m reinstalling my OS anyway, I should update it to Windows 7. Why not, as it has been touted as the &#8220;fix&#8221; for Vista. And so far, months in, dozens of homework assignments, hundreds of odd tasks for [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had the good fortune to upgrade my hard drive to 120GB and felt that while I&#8217;m reinstalling my OS anyway, I should update it to Windows 7. Why not, as it has been touted as the &#8220;fix&#8221; for Vista. And so far, months in, dozens of homework assignments, hundreds of odd tasks for different entities, it has exceeded my expectations.</p>
<p>Skipping all the Windows 7 stuff, I&#8217;ll just skip to what I did.</p>
<p>The Jump List is what shows up when a user right-clicks on a taskbar item in Windows 7, so I modified PuTTY&#8217;s source to enable JumpList functionality. On my main site, I have a binary and the necessary patch.</p>
<p>Added Functionality:</p>
<p>* Each session can add itself to the JumpList for PuTTY</p>
<p>* Upon startup, JumpList is created</p>
<p>* If user pins PuTTY to the Start Menu, JumpList remains</p>
<p><a href="http://fahhem.com/putty/">My main site has some further information, as well as the actual files.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fahhem.com/blog/2010/03/windows-7-jump-lists-and-putty/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>UC Berkeley VPN on Debian/Linux</title>
		<link>http://fahhem.com/blog/2009/07/uc-berkeley-vpn-on-debianlinux/</link>
		<comments>http://fahhem.com/blog/2009/07/uc-berkeley-vpn-on-debianlinux/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 03:19:42 +0000</pubDate>
		<dc:creator>Fahhem</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://fahhem.com/blog/?p=102</guid>
		<description><![CDATA[As a student at UC Berkeley who&#8217;s active with web development and campus groups, I need to be able to connect to computers that only allow Berkeley IP addresses. This means I have to connect to the Berkeley VPN service if I wish to work from off-campus. Therefore, with the campus moving to a new [...]]]></description>
			<content:encoded><![CDATA[<p>As a student at UC Berkeley who&#8217;s active with web development and campus groups, I need to be able to connect to computers that only allow Berkeley IP addresses. This means I have to connect to the Berkeley VPN service if I wish to work from off-campus. Therefore, with the campus moving to a new VPN service, I had to figure it out as well, but they didn&#8217;t have anything for a Linux system, only a *BSD script and Windows executable. Cisco &#8220;supports&#8221; Ubuntu 32-bit, but there are a lot of problems with what Cisco does and, for me, it doesn&#8217;t work at all. Full tunnel, Split tunnel, nothing. So in order to do my work effectively, I&#8217;ve taken on the task of maintaining a wrapper script for Debian (and possibly all Linux systems) that uses <a href="http://www.infradead.org/openconnect.html">openconnect</a>.</p>
<p>There are many improvements of openconnect over the official Cisco AnyConnect client, one of them being that it actually works. Because of these, I&#8217;m an advocate of this script versus the official client.</p>
<p>I&#8217;ve made <a href="http://fahhem.com/ucbvpn/">my script available here</a>. Please comment here regarding any issues or dependencies regarding this script. I&#8217;m happy to incorporate any patches you have for making more things work, and I&#8217;ll try to fix any problems you may have. If you have to modify the script to make it work for your system, let me know so I can make the script more generic (assuming you&#8217;re using a generic distribution, I have no intention in supporting custom Linux OSes).</p>
<p>Happy VPN&#8217;ing!</p>
]]></content:encoded>
			<wfw:commentRss>http://fahhem.com/blog/2009/07/uc-berkeley-vpn-on-debianlinux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google Talk Invisible</title>
		<link>http://fahhem.com/blog/2009/02/google-talk-invisible/</link>
		<comments>http://fahhem.com/blog/2009/02/google-talk-invisible/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 14:10:36 +0000</pubDate>
		<dc:creator>Fahhem</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://fahhem.com/blog/?p=84</guid>
		<description><![CDATA[There have been some questions regarding Google Talk and its Invisible status. XMPP/Jabber didn&#8217;t support Invisible when Google Talk, which is based on XMPP/Jabber, added support for it. This was likely to create a uniform interface to the user who now had the ability to go invisible on their AIM account. Well, there&#8217;s good news. [...]]]></description>
			<content:encoded><![CDATA[<p>There have been some questions regarding Google Talk and its Invisible status. XMPP/Jabber didn&#8217;t support Invisible when Google Talk, which is based on XMPP/Jabber, added support for it. This was likely to create a uniform interface to the user who now had the ability to go invisible on their AIM account.</p>
<p>Well, there&#8217;s good news. I created a <a href="http://fahhem.com/pidgin/">plugin</a> to enable Invisible for Google Talk accounts.</p>
<p><span style="text-decoration: line-through;">Now, before you go rushing off to download and install that plugin, here&#8217;s the big caveat: I only made it work for one account. If you have more than one Jabber/XMPP/GTalk account, then it won&#8217;t work for all of them. Proceed with caution, because having multiple accounts may break it. I have tested it with one account, so no worries there</span><strong> Fixed, now supports multiple accounts</strong> (but no guarantees, this is open source software).</p>
<p><a href="http://fahhem.com/pidgin/">Instructions are available on my main site for both Windows and Linux.</a></p>
<p>Update 3/19/2010: There have been a lot of requests for fixes/updates/rewrites to this code. I&#8217;m sorry to say, but I&#8217;ve moved on to newer projects. This was originally only a weekend project for me, little did I realize that there was this much demand for it. I&#8217;ve provided all the code I have for this, if anyone wishes I can provide the whole working directory as well as instructions to compile on both Linux and Windows, but beyond that I will not be making any more changes.</p>
<p>Now, I have a patch waiting in my email, and I will attempt to incorporate that sometime in the future, but as above, no guarantees.</p>
<p>Sorry to everyone who has posted with problems with this code, but it&#8217;s over a year old, meant for a much older version of Pidgin, and works with at least historically badly documented APIs (sorry Pidgin, but that documentation wasn&#8217;t easy to understand at all, I worked mostly off examples). Good luck with getting a real invisible implementation into Pidgin trunk!</p>
<p>Update 6/27/2010: Again, there have been many further comments as to whether it works or not. Seeing this much demand for only a few lines of code is very interesting. Until now, many of your problems have been either unfixable due to the way the plugin works (a hack) or too much work to reproduce. However, I&#8217;ve been notified of a better way to go about going invisible and I will try to update the plugin soon (no guarantees however) with that new system: http://chinmaykamat.wordpress.com/2010/01/22/google-talk-invisible-mode-in-pidgin/</p>
<p>Sorry to everyone who&#8217;s Pidgin crashes when using this plugin, there&#8217;s little I can do when I have the plugin enabled all the time and get no crashes. In fact, I&#8217;ve had Pidgin crash repeatedly on me before, but never since I enabled this plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://fahhem.com/blog/2009/02/google-talk-invisible/feed/</wfw:commentRss>
		<slash:comments>81</slash:comments>
		</item>
	</channel>
</rss>
