<?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>Dragly</title>
	<atom:link href="http://dragly.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://dragly.org</link>
	<description>It was about time I started writing my own tutorials to share some of the knowledge I&#039;ve picked up from around.</description>
	<lastBuildDate>Tue, 31 Aug 2010 12:59:56 +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>Internal licensing error</title>
		<link>http://dragly.org/2010/08/31/internal-licensing-error/</link>
		<comments>http://dragly.org/2010/08/31/internal-licensing-error/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 22:08:43 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[rdp]]></category>
		<category><![CDATA[rdpv5]]></category>
		<category><![CDATA[remote desktop server]]></category>
		<category><![CDATA[terminal server client]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=300</guid>
		<description><![CDATA[What do you say? Is there something wrong with the internal license? Well, just change the name of that client, and we'll be alright! <a href="http://dragly.org/2010/08/31/internal-licensing-error/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>What do you say? Is there something wrong with the internal license?  Well, just change the name of that client, and we&#8217;ll be alright!</strong></p>
<p>Welcome to the world of connecting an Ubuntu computer to a Windows Server. The later years this has become quite easy, but this summer the University of Oslo has upgraded its servers. And with a new version of Windows, there is bound to be new problems on the way.</p>
<p><span id="more-300"></span></p>
<p><strong><span style="color: #000000;"><span style="font-family: Georgia,&amp;amp;quot;">Update:</span></span></strong> After another search I found the following workaround. Just run the two following commands in a terminal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> root:root ~<span style="color: #000000; font-weight: bold;">/</span>.rdesktop
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">500</span> ~<span style="color: #000000; font-weight: bold;">/</span>.rdesktop</pre></div></div>

<p>Now you may connect again without problems. If you want to see the alternative workaround, keep reading.</p>
<p>Connecting to a Windows machine running Remote Desktop is easy in Ubuntu if you use the Terminal Server Client. You just type in whatever you need in this window, and you&#8217;re set to connect:</p>
<p><a href="http://dragly.org/wp-content/uploads/2010/08/Screenshot-Terminal-Server-Client.png" rel="lightbox[300]"><img class="aligncenter size-full wp-image-301" title="Screenshot-Terminal Server Client" src="http://dragly.org/wp-content/uploads/2010/08/Screenshot-Terminal-Server-Client.png" alt="" width="405" height="535" /></a>Notice that &#8220;hmm&#8230;&#8221; in there? Well, that&#8217;s what it is. It&#8217;s a hmm&#8230;</p>
<p>Quite frankly I haven&#8217;t investigated what this Client Hostname is supposed to do, but it turned out to be the solution for today&#8217;s problem. And the problem is that whenever I try to connect to a University terminal server I receive the following error:</p>
<p><a href="http://dragly.org/wp-content/uploads/2010/08/Screenshot-Terminal-Server-Client-Error.png" rel="lightbox[300]"><img class="aligncenter size-full wp-image-302" title="Screenshot-Terminal Server Client Error" src="http://dragly.org/wp-content/uploads/2010/08/Screenshot-Terminal-Server-Client-Error.png" alt="" width="265" height="206" /></a>After a quick search on the Internet, the &#8220;Internal licensing error&#8221; turned out to be a common beast, but with no obvious solution for me. I realized quickly that I was not in a position to do administrative modifications on one of UiO&#8217;s terminal servers, so no luck with those suggestions. Instead I gave the good old trial-and-error approach a try.</p>
<p>Typing in different settings for domain, protocol, display, local resources, keyboard and so forth I came to change the Client Hostname of my Terminal Server Client.</p>
<p>Success!</p>
<p>I connected to the terminal server without any hick-ups.</p>
<p>Once.</p>
<p>Whenever I reconnect now I get the same error as above. However, if I change the Client Hostname to something new, I get back in.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/08/31/internal-licensing-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Skip the packaging step in Qt Creator 2.0</title>
		<link>http://dragly.org/2010/07/19/skip-the-packaging-step-in-qt-creator-2-0/</link>
		<comments>http://dragly.org/2010/07/19/skip-the-packaging-step-in-qt-creator-2-0/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 22:11:10 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[N900]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=266</guid>
		<description><![CDATA[Qt Creator finally has support for packages, but now it is lacking the support to disable them instead. <a href="http://dragly.org/2010/07/19/skip-the-packaging-step-in-qt-creator-2-0/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just figured that Qt Creator is now packaging every Maemo application whenever you tell it to run one. This might be annoying if <a href="http://bugreports.qt.nokia.com/browse/QTCREATORBUG-1637">packaging fails</a> and will in any case slow down the whole process of debugging. However, if you want to skip the packaging step, this is not an option in Qt Creator 2.0(!).</p>
<p>Luckily the Qt developers over at Nokia are aware of this and have released a fix in the latest builds of Qt Creator. To acquire these, go to <a href="http://qt.nokia.com/developer/qt-snapshots/">Qt&#8217;s snapshot homepage</a> or just download the <a href="ftp://ftp.qt.nokia.com/qtcreator/snapshots/2010-07-16/qtcreator-linux-x86-opensource-2.0.80-201007160104-setup.bin">32-bit</a> or <a href="ftp://ftp.qt.nokia.com/qtcreator/snapshots/2010-07-12/qtcreator-linux-x86_64-opensource-2.0.80-201007120237-setup.bin">64-bit</a> versions for Linux directly from the build made on 12th of July.</p>
<p>Now you may select to skip the packaging by editing the build steps in Qt Creator.</p>
<p>Be aware that the snapshot versions are in development and may have bugs causing irrevocable data loss. That&#8217;s the risk you&#8217;ve got to take these days to avoid those bloated packages.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/07/19/skip-the-packaging-step-in-qt-creator-2-0/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Connect to your N900 while developing via usb</title>
		<link>http://dragly.org/2010/07/18/connect-to-your-n900-while-developing-via-usb/</link>
		<comments>http://dragly.org/2010/07/18/connect-to-your-n900-while-developing-via-usb/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 17:16:43 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[N900]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Network Manager]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=251</guid>
		<description><![CDATA[Sometimes it feels good to be a bit lazy and let your OS do that boring terminal-typing for you whenever you connect a new device. <a href="http://dragly.org/2010/07/18/connect-to-your-n900-while-developing-via-usb/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are developing for Nokia N900 using the Nokia Qt SDK, you are most likely following <a href="http://doc.qt.nokia.com/nokia-qtsdk-1.0/creator-developing-maemo.html">this guide</a> to set up your environment. This is all nice and easy, but if you are connecting using usb you have to open a terminal each time you plug in your N900 and write</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ifconfig</span> usb0 192.168.2.14 up</pre></div></div>

<p>If you, like me, get tired of doing this you may instead let Network Manager in Gnome do the work for you. First of all, connect your N900 via an available USB port. Next, right click the Network Manager icon and hit &#8220;Edit Connections&#8230;&#8221;.</p>
<p><span id="more-251"></span></p>
<p><a href="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Network-Connections.png" rel="lightbox[251]"><img class="size-full wp-image-252 alignnone" title="Screenshot-Network Connections" src="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Network-Connections.png" alt="" width="436" height="300" /></a></p>
<p>This window will pop up. Press the &#8220;Add&#8221; button.</p>
<p><a href="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Editing-N900-via-usb.png" rel="lightbox[251]"><img class="alignnone size-full wp-image-253" title="Screenshot-Editing N900 via usb" src="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Editing-N900-via-usb.png" alt="" width="361" height="471" /></a></p>
<p>Type in a useful name, such as &#8220;N900 via usb&#8221;, and leave everything under &#8220;Wired&#8221; as is. Select the &#8220;IPv4 Settings&#8221; tab.</p>
<p><a href="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Editing-N900-via-usb-1.png" rel="lightbox[251]"><img class="alignnone size-full wp-image-254" title="Screenshot-Editing N900 via usb-1" src="http://dragly.org/wp-content/uploads/2010/07/Screenshot-Editing-N900-via-usb-1.png" alt="" width="403" height="471" /></a></p>
<p>Set the Method to &#8220;Manual&#8221; and click &#8220;Add&#8221;.</p>
<p>Type in 192.168.2.14 as the address and 255.255.255.0 as the netmask. Leave the gateway blank.</p>
<p>Hit &#8220;Apply&#8221; and you are good to go!</p>
<p>Next, just click the Network Manager icon and select &#8220;N900 via usb&#8221;. If nothing went wrong, you should now be connected to your device, enabling you to use Qt Creator to its full extent. The next time you plug in your N900, Network Manager will do the work for you automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/07/18/connect-to-your-n900-while-developing-via-usb/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Loading wavefront .obj files in Qt&#8217;s OpenGL ES</title>
		<link>http://dragly.org/2010/04/09/loading-wavefront-obj-files-in-qts-opengl-es/</link>
		<comments>http://dragly.org/2010/04/09/loading-wavefront-obj-files-in-qts-opengl-es/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 13:43:41 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dragly.org/?p=242</guid>
		<description><![CDATA[I&#8217;ve been looking all over the web for a Qt library for loading files exported from Blender into OpenGL. Since I didn&#8217;t find anything I figured I would create a library myself. Even though I didn&#8217;t find anything specifically about &#8230; <a href="http://dragly.org/2010/04/09/loading-wavefront-obj-files-in-qts-opengl-es/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div id="attachment_244" class="wp-caption alignright" style="width: 310px"><a href="http://dragly.org/wp-content/uploads/2010/04/Screenshot-Untitled-Window.png" rel="lightbox[242]"><img class="size-medium wp-image-244" title="Screenshot-Untitled Window" src="http://dragly.org/wp-content/uploads/2010/04/Screenshot-Untitled-Window-300x221.png" alt="" width="300" height="221" /></a><p class="wp-caption-text">Suzanne rendered with Qt and OpenGL ES</p></div>
<p>I&#8217;ve been looking all over the web for a Qt library for loading files exported from Blender into OpenGL. Since I didn&#8217;t find anything I figured I would create a library myself.</p>
<p>Even though I didn&#8217;t find anything specifically about Blender and Qt&#8217;s OpenGL ES implementation, I managed to find something about each of them separately. Loading files from Blender seems to be most easily done by exporting to another format first. A lot of people mentioned Wavefront&#8217;s .obj file format as a good candidate. It is a small format, easy to parse and a lot of libraries already exist. At least that&#8217;s what they said.</p>
<p><span id="more-242"></span></p>
<p>Finding a working .obj-loading library wasn&#8217;t that hard, but finding one that would load and compile nicely together with Qt was a bit harder. Finally I found GLM by <a href="http://www.pobox.com/~nate">Nate Robins</a>, written way back in 1997. It might be old, but it certainly did the job. It even managed to draw on the screen! The next problem, however, was to make it draw with the newer OpenGL specifications. OpenGL ES 2.0 especially, since that&#8217;s what&#8217;s running on my Nokia N900.</p>
<p>The problem is that the old fixed API of OpenGL won&#8217;t compile with N900&#8242;s Scratchbox environment. I was close to giving up the whole GLM library, but I figured that I could try commenting out the functions which wouldn&#8217;t compile. And it worked!</p>
<p>I had to comment out glmDraw() and glmList(), and thus do the drawing on my own, but at least I had a library working which would load the files. I didn&#8217;t have to write all that myself, or even get into how .obj files are structured.</p>
<p>The next step was drawing the data. This was a bit of a pain, since the newer OpenGL ES API wants all data in certain arrays before drawing, while I was looking at just a bunch of vertices.</p>
<p>Stepping through the code in GLM, however, made me realize how it structured all groups and triangles from the .obj file, and made it possible for me to get these out and draw them on screen. Today I finally figured out how to draw the textures as well.</p>
<p>For testing I started with the hellogl_es2 example from Nokia and used this to draw my Blender monkey (named &#8216;Suzanne&#8217;). The whole example which now is loading the .obj model and drawing it on-screen is hosted <a href="http://github.com/dragly/hellogl_es2_obj_loader">over at GitHub</a>. And for the interested, the main changed parts are loading the file and storing the data in arrays:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">model <span style="color: #000080;">=</span> glmReadOBJ<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;monkey1.obj&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
GLMgroup<span style="color: #000040;">*</span> group<span style="color: #008080;">;</span>
group <span style="color: #000080;">=</span> model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>groups<span style="color: #008080;">;</span>
<span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span>group<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    Group grp<span style="color: #008080;">;</span>
    <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span> group<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>numtriangles<span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        Triangle triangle<span style="color: #008080;">;</span>
        QVector verts<span style="color: #008080;">;</span>
        <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> j <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> j <span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span> <span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> j<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
            QVector3D vector<span style="color: #008000;">&#40;</span>model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>vertices<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">3</span> <span style="color: #000040;">*</span> model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>group<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#93;</span>.<span style="color: #007788;">vindices</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000040;">+</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span>,
                             model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>vertices<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">3</span> <span style="color: #000040;">*</span> model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>group<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#93;</span>.<span style="color: #007788;">vindices</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000040;">+</span> <span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span>,
                             model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>vertices<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">3</span> <span style="color: #000040;">*</span> model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>group<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#93;</span>.<span style="color: #007788;">vindices</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000040;">+</span> <span style="color: #0000dd;">2</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            verts.<span style="color: #007788;">append</span><span style="color: #008000;">&#40;</span>vector<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
        QVector norms<span style="color: #008080;">;</span>
        <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> j <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> j <span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span> <span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> j<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
            QVector3D vector<span style="color: #008000;">&#40;</span>model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>normals<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">3</span> <span style="color: #000040;">*</span> model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>group<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#93;</span>.<span style="color: #007788;">nindices</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000040;">+</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span>,
                             model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>normals<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">3</span> <span style="color: #000040;">*</span> model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>group<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#93;</span>.<span style="color: #007788;">nindices</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000040;">+</span> <span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span>,
                             model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>normals<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">3</span> <span style="color: #000040;">*</span> model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>group<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#93;</span>.<span style="color: #007788;">nindices</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000040;">+</span> <span style="color: #0000dd;">2</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            norms.<span style="color: #007788;">append</span><span style="color: #008000;">&#40;</span>vector<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        QVector texs<span style="color: #008080;">;</span>
        <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> j <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> j <span style="color: #000040;">&amp;</span>lt<span style="color: #008080;">;</span> <span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> j<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
            QVector3D vector<span style="color: #008000;">&#40;</span>model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>texcoords<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">2</span> <span style="color: #000040;">*</span> model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>group<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#93;</span>.<span style="color: #007788;">tindices</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000040;">+</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span>,
                             model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>texcoords<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">2</span> <span style="color: #000040;">*</span> model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>group<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#93;</span>.<span style="color: #007788;">tindices</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000040;">+</span> <span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span>,
                             model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>texcoords<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">2</span> <span style="color: #000040;">*</span> model<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>group<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>triangles<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#93;</span>.<span style="color: #007788;">tindices</span><span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000040;">+</span> <span style="color: #0000dd;">2</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            texs.<span style="color: #007788;">append</span><span style="color: #008000;">&#40;</span>vector<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
        triangle.<span style="color: #007788;">vertices</span> <span style="color: #000080;">=</span> verts<span style="color: #008080;">;</span>
        triangle.<span style="color: #007788;">normals</span> <span style="color: #000080;">=</span> norms<span style="color: #008080;">;</span>
        triangle.<span style="color: #007788;">texcoords</span> <span style="color: #000080;">=</span> texs<span style="color: #008080;">;</span>
        grp.<span style="color: #007788;">triangles</span>.<span style="color: #007788;">append</span><span style="color: #008000;">&#40;</span>triangle<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
    groups.<span style="color: #007788;">append</span><span style="color: #008000;">&#40;</span>grp<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    group <span style="color: #000080;">=</span> group<span style="color: #000040;">-</span><span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span>next<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>And drawing the model:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">glBindTexture<span style="color: #008000;">&#40;</span>GL_TEXTURE_2D, m_uiTexture<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
foreach<span style="color: #008000;">&#40;</span>Group grp, groups<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    foreach<span style="color: #008000;">&#40;</span>Triangle triangle, grp.<span style="color: #007788;">triangles</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        program1.<span style="color: #007788;">setUniformValue</span><span style="color: #008000;">&#40;</span>textureUniform1, <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>    <span style="color: #666666;">// use texture unit 0</span>
        program1.<span style="color: #007788;">enableAttributeArray</span><span style="color: #008000;">&#40;</span>normalAttr1<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        program1.<span style="color: #007788;">enableAttributeArray</span><span style="color: #008000;">&#40;</span>vertexAttr1<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        program1.<span style="color: #007788;">enableAttributeArray</span><span style="color: #008000;">&#40;</span>texCoordAttr1<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        program1.<span style="color: #007788;">setAttributeArray</span><span style="color: #008000;">&#40;</span>vertexAttr1, triangle.<span style="color: #007788;">vertices</span>.<span style="color: #007788;">constData</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        program1.<span style="color: #007788;">setAttributeArray</span><span style="color: #008000;">&#40;</span>normalAttr1, triangle.<span style="color: #007788;">normals</span>.<span style="color: #007788;">constData</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        program1.<span style="color: #007788;">setAttributeArray</span><span style="color: #008000;">&#40;</span>texCoordAttr1, triangle.<span style="color: #007788;">texcoords</span>.<span style="color: #007788;">constData</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        glDrawArrays<span style="color: #008000;">&#40;</span>GL_TRIANGLES, <span style="color: #0000dd;">0</span>, triangle.<span style="color: #007788;">vertices</span>.<span style="color: #007788;">size</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        program1.<span style="color: #007788;">disableAttributeArray</span><span style="color: #008000;">&#40;</span>normalAttr1<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        program1.<span style="color: #007788;">disableAttributeArray</span><span style="color: #008000;">&#40;</span>vertexAttr1<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        program1.<span style="color: #007788;">disableAttributeArray</span><span style="color: #008000;">&#40;</span>texCoordAttr1<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>I will turn this all into a Qt OpenGL ES library in the future, but for now I figured you might be interested in a working example. Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/04/09/loading-wavefront-obj-files-in-qts-opengl-es/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving around and going to github</title>
		<link>http://dragly.org/2010/03/24/moving-around-and-github/</link>
		<comments>http://dragly.org/2010/03/24/moving-around-and-github/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 08:03:00 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://dragly.org/2010/03/24/moving-around-and-github/</guid>
		<description><![CDATA[I don&#8217;t think you&#8217;ll notice, but I&#8217;ve just moved this page permanently to dragly.org. There seems to have been some problems getting this site indexed properly when it was hosted on a subdomain of dragly.com. To get the site ut &#8230; <a href="http://dragly.org/2010/03/24/moving-around-and-github/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t think you&#8217;ll notice, but I&#8217;ve just moved this page permanently to dragly.org. There seems to have been some problems getting this site indexed properly when it was hosted on a subdomain of dragly.com. To get the site ut to speed I decided to move it. After all, what is a webpage without visitors? And how would you get here without the site being visible?</p>
<div id="attachment_238" class="wp-caption alignright" style="width: 310px"><a href="http://dragly.org/wp-content/uploads/2010/03/yafaray-2010-03-25_033548.png" rel="lightbox[229]"><img class="size-medium wp-image-238 " title="Github wallpaper created in Blender." src="http://dragly.org/wp-content/uploads/2010/03/yafaray-2010-03-25_033548-300x225.png" alt="Alt text" width="300" height="225" /></a><p class="wp-caption-text">I&#39;ve found that github offers just what I need to host everything from small to big projects.</p></div>
<p>Until now we have been hosting dragly.com at <a href="http://one.com">One.com</a>, but since they don&#8217;t support several domains I&#8217;m considering to move everything to <a href="http://ProISP.no">ProISP.no</a> where I&#8217;m currently hosting dragly.org. At the same time I think we&#8217;ll have to do something about those outdated webpages we&#8217;ve got there. We haven&#8217;t really updated those in a while.</p>
<p>On a completely different topic I&#8217;m trying out git at the moment as an alternative to Subversion. Way too many people have been talking positively about it lately, so I figured I needed to give git a shot.</p>
<p>First of all I&#8217;ve set up a profile over at <a href="http://github.com/dragly">github</a> and am going to upload a few of my projects during the next couple of weeks. I&#8217;ve got too much source code lying around not to share it with everyone <img src='http://dragly.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And for starters that&#8217;s a big plus for github. Keeping my projects stored in one place makes it a much better alternative than hosting alternatives for Subversion, like SourceForge and Google Code.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/03/24/moving-around-and-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to draw a spring in Inkscape</title>
		<link>http://dragly.org/2010/02/25/how-to-draw-a-spring-in-inkscape/</link>
		<comments>http://dragly.org/2010/02/25/how-to-draw-a-spring-in-inkscape/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 21:23:28 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Inkscape]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://svenni.dragly.com/v7/?p=198</guid>
		<description><![CDATA[I&#8217;ve been working on some free-body diagrams lately, and in my last paper I needed to draw a spring. Since I didn&#8217;t find any simple way to do this, I thought I should give a quick tutorial here. First of &#8230; <a href="http://dragly.org/2010/02/25/how-to-draw-a-spring-in-inkscape/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on some free-body diagrams lately, and in my last paper I needed to draw a spring. Since I didn&#8217;t find any simple way to do this, I thought I should give a quick tutorial here.</p>
<p>First of all, turn on the grid by clicking SHIFT + 3 on your keyboard (the # key).</p>
<p><img class="aligncenter size-full wp-image-199" title="Screenshot-New document 1 - Inkscape" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-New-document-1-Inkscape.png" alt="" width="375" height="428" />When your grid is turned on, enable the bezier curve editor by clicking this button:</p>
<p><span id="more-198"></span></p>
<p><img class="aligncenter size-full wp-image-200" title="bezier" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/bezier.png" alt="" width="35" height="33" />Now, draw a shape similar to this. I&#8217;ve enabled the grid so you may see the distance between the points:</p>
<p><img class="aligncenter size-full wp-image-201" title="Screenshot-New document 1 - Inkscape-1" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-New-document-1-Inkscape-1.png" alt="" width="418" height="308" />If you&#8217;re having trouble with the handles you may want to enable cornered points by clicking this button:</p>
<p><img class="aligncenter size-full wp-image-202" title="curve" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/curve.png" alt="" width="36" height="26" />Next, you should make a copy of your newly drawn curve and open this for editing (double click on it).</p>
<p><img class="aligncenter size-full wp-image-203" title="Screenshot-New document 1 - Inkscape-3" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-New-document-1-Inkscape-3.png" alt="" width="552" height="399" />Select the two leftmost points (as shown above) and delete these. Then move the new shape next to the other.</p>
<p><img class="aligncenter size-full wp-image-204" title="Screenshot-New document 1 - Inkscape-4" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-New-document-1-Inkscape-4.png" alt="" width="534" height="346" />As you see, in my drawing the shapes don&#8217;t really fit. We&#8217;ll fix this by editing the second curve.<img class="aligncenter size-full wp-image-205" title="Screenshot-New document 1 - Inkscape-5" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-New-document-1-Inkscape-5.png" alt="" width="534" height="330" /></p>
<p>Now we&#8217;re soon done. All we need to do now is to exit editing mode by clicking the arrow tool:</p>
<p><img class="aligncenter size-full wp-image-206" title="arrow" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/arrow.png" alt="" width="39" height="33" /></p>
<p>Then select the second curve and copy + paste it as many times as you like:</p>
<p><img class="aligncenter size-full wp-image-207" title="Screenshot-New document 1 - Inkscape-6" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-New-document-1-Inkscape-6.png" alt="" width="603" height="157" /></p>
<p>Copy+paste the first shape and flip it</p>
<p><img class="aligncenter size-full wp-image-208" title="Screenshot-New document 1 - Inkscape-8" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-New-document-1-Inkscape-8.png" alt="" width="524" height="459" /></p>
<p>Now, move this to the end of the spring:</p>
<p><img class="aligncenter size-full wp-image-209" title="Screenshot-New document 1 - Inkscape-9" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-New-document-1-Inkscape-9.png" alt="" width="756" height="177" /></p>
<p>I did some final editing on the last part, but all in all you should be finished now! If you want to reuse this string, save it in a folder and import it when you need it or use it right away in your new diagram. Or just download the source here: <a href="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/spring.svg_.zip">Spring model</a>.</p>
<p><img class="aligncenter size-full wp-image-210" title="rect3765" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/rect3765.png" alt="" width="760" height="321" /></p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/02/25/how-to-draw-a-spring-in-inkscape/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I&#8217;m not using Ubuntu One</title>
		<link>http://dragly.org/2010/02/16/why-im-not-using-ubuntu-one/</link>
		<comments>http://dragly.org/2010/02/16/why-im-not-using-ubuntu-one/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 22:55:12 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://svenni.dragly.com/v7/?p=193</guid>
		<description><![CDATA[Recently I&#8217;ve had some issues with my previous solution for synchronizing files between my computers. I used to have an SSH server which I placed all my files on, and usually I edited them directly on this server. Whenever needed &#8230; <a href="http://dragly.org/2010/02/16/why-im-not-using-ubuntu-one/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve had some issues with my previous solution for synchronizing files between my computers. I used to have an SSH server which I placed all my files on, and usually I edited them directly on this server. Whenever needed offline I used to synchronize them to my computers using Unison. Recently, however, the SSH connection to the server has been pretty sluggish on my laptop, causing the work flow to slow down.</p>
<p>I went looking for an alternative, and since Ubuntu comes with Ubuntu One preinstalled, I thought I should give it a try. The results were not even close to what I wanted.</p>
<p>First of all, there appears to be no kind of encryption on the Ubuntu One server &#8211; didn&#8217;t really bother me. I just set up an EncFS folder on my local computer and put all the files to synchronize inside this folder. The problem, however, occured when I needed to synchronize some of my papers while working on them. I went ahead and saved everything, waited a couple of minutes after seeing the message from Ubuntu One telling me that the files where syncing, and shut down the laptop. Back home, however, the sync would not start at first. I waited a little and when the sync seemed to have started, I opened the folder with the files &#8211; but, there where only my old files in there.</p>
<p>In frustration I picked up my laptop, put it on the desk, connected it to the Internet, and watched Ubuntu One sync the files over again. Wasn&#8217;t it supposed to do this four hours ago?</p>
<p>I went back to the main computer and looked at the folder, refreshed it, stared at it, cursed at it. Nothing happened. Not even after 30 minutes.</p>
<p>Okay. Back to looking for alternatives.</p>
<h3>Spideroak and Dropbox</h3>
<p>So, are all synchronization solutions this bad? You don&#8217;t have to worry, they are not even close!</p>
<p>I tried out Dropbox. Installed it and placed a few files in the Dropbox folder. Time to sync? I don&#8217;t have a clue. I didn&#8217;t even get to push the button on my stopwatch to check! Once the file was placed in the folder on my main computer, it was already on my laptop. Quite nice.</p>
<p>Spideroak on the other hand took 20 seconds or so before synchronizing, but that&#8217;s still an enormous improvement compared to Ubuntu One. And Spideroak has a couple of other benefits.</p>
<p>Where Dropbox only let&#8217;s you sync files in a specific folder, Spideroak let&#8217;s you set up several folders in different paths on your computer to sync. And you may also backup files which are not supposed to be synced.</p>
<p>The probably most important feature that Spideroak has is that the files are encrypted on each computer, making them unreadable even to the Spideroak employees. This is an important security measure which Dropbox lacks. On the other hand you could just put everything in an encrypted folder in the first place, which I think you should do even with Spideroak. The latter is because Spideroak decrypts the files when you watch them through the web-viewer, which means it&#8217;s technically possible to read your files when you are doing the same online.</p>
<h3>Speed vs. features</h3>
<p>I guess it&#8217;s up to you to decide what&#8217;s most important for you. The ease of use and speed which Dropbox offers, or the more advanced features and all over decent speed of Spideroak.</p>
<p>At the moment I&#8217;m running a sync of 900 MB of files using both solutions. I&#8217;ll update this post whenever they finish to give you some information about whether the speed differs on large synchronizations. Currently Dropbox is already syncing all the files, while Spideroak is &#8220;Pending new calculations&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/02/16/why-im-not-using-ubuntu-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python deleted my vector values</title>
		<link>http://dragly.org/2010/02/15/python-deleted-my-vector-values/</link>
		<comments>http://dragly.org/2010/02/15/python-deleted-my-vector-values/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 16:23:54 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://svenni.dragly.com/v7/?p=191</guid>
		<description><![CDATA[Sometimes scripting languages can be a real annoyance. Why? Because when you get as much help as you do with for instance Python, you also lose a lot of control. Being used to scripting languages like PHP, I made the &#8230; <a href="http://dragly.org/2010/02/15/python-deleted-my-vector-values/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometimes scripting languages can be a real annoyance. Why? Because when you get as much help as you do with for instance Python, you also lose a lot of control.</p>
<p>Being used to scripting languages like PHP, I made the funny mistake today of initializing a set of arrays like:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">a = v = r = zeros<span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>n,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>,<span style="color: #008000;">float</span><span style="color: black;">&#41;</span></pre></div></div>

<p>This seemed like a really good idea, saving me from typing two extra lines(!). As the sucker I am for short code I was happy with my newfound shortcut. What I didn&#8217;t realize is that Python, in comparison to PHP, treats assignments like these as pointers instead of variables.</p>
<p>I believed this would create three arrays with a lot of zeros in two dimensions as I would expect from PHP, but the result was that I instead created one array with loads of zeros in two dimensions, with three pointers <strong>a</strong>, <strong>v</strong> and <strong>r</strong> all pointing to the same array.</p>
<p>When I then started setting the values for each of these arrays using Euler&#8217;s method, the result was that I got a lot of nonsense in what I thought was three separate arrays.</p>
<p>As a reminder to myself and everyone else out there; Python is not PHP. If you want to initialize three arrays like this in Python, you&#8217;ll have to stick to  the long version:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">a = zeros<span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>n,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>,<span style="color: #008000;">float</span><span style="color: black;">&#41;</span>
r = zeros<span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>n,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>,<span style="color: #008000;">float</span><span style="color: black;">&#41;</span>
v = zeros<span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>n,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>,<span style="color: #008000;">float</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Or, you could at least save yourself from having to edit each assignment if you ever need to change the code by writing:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">a = zeros<span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>n,<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>,<span style="color: #008000;">float</span><span style="color: black;">&#41;</span>
r = a.<span style="color: #dc143c;">copy</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
v = a.<span style="color: #dc143c;">copy</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/02/15/python-deleted-my-vector-values/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Getting started with encrypted e-mail using Thunderbird and Enigmail</title>
		<link>http://dragly.org/2010/02/13/getting-started-with-encrypted-e-mail-using-thunderbird-and-enigmail/</link>
		<comments>http://dragly.org/2010/02/13/getting-started-with-encrypted-e-mail-using-thunderbird-and-enigmail/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 14:56:01 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://svenni.dragly.com/v7/?p=172</guid>
		<description><![CDATA[E-mail encryption is getting more and more important as more information is accessible to your ISP, e-mail provider or even your government. In this tutorial I won&#8217;t be going into any of the principles for why you should encrypt your &#8230; <a href="http://dragly.org/2010/02/13/getting-started-with-encrypted-e-mail-using-thunderbird-and-enigmail/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>E-mail encryption is getting more and more important as more information is accessible to your ISP, e-mail provider or even your government. In this tutorial I won&#8217;t be going into any of the principles for why you should encrypt your e-mail or how it works &#8211; I rather assume that you have already realized the dangers of letting your personal e-mails swarm around on mail servers open for everyone to read.</p>
<h3>Preliminaries</h3>
<p>In this tutorial I&#8217;m going to use Thunderbird on Ubuntu. If you are running Windows or another Linux distro, you might need to do some extra modifications. I&#8217;ll see if I might implement those at a later point in time, but for the moment being you are on your own.</p>
<h3>Installing Thunderbird</h3>
<p>First of all, you should have Thunderbird installed. This is done through the Ubuntu Software Center, which you find by clicking Applications &gt; Ubuntu Software Center.</p>
<p>Search for Thunderbird and install it by clicking the yellow arrow.</p>
<p><img class="aligncenter size-large wp-image-174" title="Screenshot-Ubuntu Software Center-1" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-Ubuntu-Software-Center-1-800x470.png" alt="" width="800" height="470" />Then click &#8220;Install&#8221;.</p>
<p><img class="aligncenter size-large wp-image-175" title="Screenshot-Ubuntu Software Center-2" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-Ubuntu-Software-Center-2-800x470.png" alt="" width="800" height="470" />When Thunderbird is installed, start it up by clicking</p>
<pre>Applications &gt; Internet &gt; Thunderbird</pre>
<p>When you start Thunderbird for the first time you&#8217;ll be asked to set up your account. The wizard which is used in Thunderbird is quite intuitive, so I won&#8217;t give you a explanation of it in this tutorial.</p>
<h3>Installing the Enigmail extension</h3>
<p>Now, we are going to install the Enigmail extension. This may be done through the Ubuntu Software Center as well, but since you might be running Windows or Thunderbird 3.0 (as I am), I&#8217;ll show you how you may do this through the interface in Thunderbird.</p>
<p>In Thunderbird, click</p>
<pre>Tools &gt; Add-ons
</pre>
<p>Search for Enigmail, and click &#8220;Add to Thunderbird&#8230;&#8221;</p>
<p><img class="aligncenter size-full wp-image-176" title="Screenshot-Add-ons" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-Add-ons.png" alt="" width="520" height="380" />When prompted, restart Thunderbird.</p>
<h3>Setting up Enigmail</h3>
<p>There will be a new button next to &#8220;Tools&#8221; which reads &#8220;OpenPGP&#8221;. Click on</p>
<pre>OpenPGP &gt; Setup Wizard
</pre>
<p>Then click Next</p>
<p><img class="aligncenter size-full wp-image-177" title="Screenshot-OpenPGP Setup Wizard" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-OpenPGP-Setup-Wizard.png" alt="" width="600" height="500" />Then Next again</p>
<p><img class="aligncenter size-full wp-image-178" title="Screenshot-OpenPGP Setup Wizard-1" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-OpenPGP-Setup-Wizard-1.png" alt="" width="600" height="500" />Now, you should decide whether to sign and encrypt all your mail by default &#8211; that&#8217;s up to you, but I of course chose both.</p>
<p><img class="aligncenter size-full wp-image-179" title="Screenshot-OpenPGP Setup Wizard-2" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-OpenPGP-Setup-Wizard-2.png" alt="" width="600" height="500" /></p>
<p>This is for decryption (which only will be enabled for people you have a public key for).</p>
<p><img class="aligncenter size-full wp-image-180" title="Screenshot-OpenPGP Setup Wizard-3" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-OpenPGP-Setup-Wizard-3.png" alt="" width="600" height="500" /></p>
<p>Next, you may select whether you want Enigmail to disable/enable some things for you, to make sure it runs flawlessly. For instance, it disables HTML in outgoing messages, which some of you might not want. In that case, click Details&#8230; and change the values to whatever you want. Nothing will crash if you deselect these boxes, but some messages might not get decrypted as they are supposed to. If you don&#8217;t need fancy formatting in your messages, I suggest you leave everything checked.</p>
<p><img class="aligncenter size-full wp-image-181" title="Screenshot-OpenPGP Setup Wizard-4" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-OpenPGP-Setup-Wizard-4.png" alt="" width="600" height="500" /></p>
<p>The next part is to create a new public and private key:</p>
<p><img class="aligncenter size-full wp-image-182" title="Screenshot-OpenPGP Setup Wizard-5" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-OpenPGP-Setup-Wizard-5.png" alt="" width="600" height="500" />Select an account and type in a passphrase:</p>
<p><img class="aligncenter size-full wp-image-183" title="Screenshot-OpenPGP Setup Wizard-6" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-OpenPGP-Setup-Wizard-6.png" alt="" width="600" height="500" />And we are as good as done!</p>
<p>Click next, and Enigmail will do the rest for you.</p>
<p><img class="aligncenter size-full wp-image-184" title="Screenshot-OpenPGP Setup Wizard-7" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-OpenPGP-Setup-Wizard-7.png" alt="" width="600" height="500" />Now, sit back and relax. Enigmail is creating your superduper encryption key while you are encouraged to surf the web.</p>
<p>When prompted, say yes to create a revocation sertificate (if you want to). Enigmail pretty much explains this itself.</p>
<p><img class="aligncenter size-full wp-image-187" title="Screenshot-OpenPGP Confirm" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-OpenPGP-Confirm.png" alt="" width="609" height="143" /></p>
<p>And some more info&#8230;</p>
<p><img class="aligncenter size-full wp-image-186" title="Screenshot-OpenPGP Alert" src="http://svenni.dragly.com/v7/wp-content/uploads/2010/02/Screenshot-OpenPGP-Alert.png" alt="" width="609" height="158" />That&#8217;s it for now. You should now be able to send and recieve encrypted messages using your key-pair!</p>
<p>More info will come about how to use your new safe e-mail!</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/02/13/getting-started-with-encrypted-e-mail-using-thunderbird-and-enigmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing a bug with python-visual in Ubuntu Karmic</title>
		<link>http://dragly.org/2010/01/21/fixing-a-bug-with-python-visual-in-ubuntu-karmic/</link>
		<comments>http://dragly.org/2010/01/21/fixing-a-bug-with-python-visual-in-ubuntu-karmic/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 12:42:00 +0000</pubDate>
		<dc:creator>Svenn-Arne Dragly</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://svenni.dragly.com/v7/?p=158</guid>
		<description><![CDATA[I was preparing to do some tasks in my physics course today, and experienced a rather annoying problem when attempting to use the python-visual package in Ubuntu. There seems to be a bug in Ubuntu Karmic which results in the &#8230; <a href="http://dragly.org/2010/01/21/fixing-a-bug-with-python-visual-in-ubuntu-karmic/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I was preparing to do some tasks in my physics course today, and experienced a rather annoying problem when attempting to use the python-visual package in Ubuntu.</p>
<p>There seems to be a bug in Ubuntu Karmic which results in the following output when trying to run this command:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> visual <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span></pre></div></div>

<p>The output is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Traceback <span style="color: #7a0874; font-weight: bold;">&#40;</span>most recent call <span style="color: #c20cb9; font-weight: bold;">last</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>:
  File <span style="color: #ff0000;">&quot;cooper.py&quot;</span>, line <span style="color: #000000;">1</span>, <span style="color: #000000; font-weight: bold;">in</span>
    from visual import <span style="color: #000000; font-weight: bold;">*</span>
  File <span style="color: #ff0000;">&quot;/usr/lib/python2.6/dist-packages/visual/__init__.py&quot;</span>, line <span style="color: #000000;">59</span>, <span style="color: #000000; font-weight: bold;">in</span>
    import cvisual
AttributeError: <span style="color: #ff0000;">'Boost.Python.StaticProperty'</span> object attribute <span style="color: #ff0000;">'__doc__'</span> is read-only</pre></div></div>

<p>The fix is luckily quite simple.</p>
<p>Andrew Mitchell has a package repository for Ubuntu which contains an update to a library called &#8220;boost&#8221;. You can add this repository by selecting System &gt; Administration &gt; Software Sources. Then select &#8220;Other Software&#8221; and click on &#8220;Add&#8230;&#8221;.</p>
<p>Now, type in the following in the textbox:</p>
<pre><strong>ppa:ajmitch/ppa
</strong></pre>
<p>Then click &#8220;Add source&#8221; and &#8220;Close&#8221;. If prompted, select &#8220;Reload&#8221; and then go to System &gt; Administration &gt; Update Manager. Click &#8220;Check&#8221; and then install all updates.</p>
<p>When this has been done, you are ready to run your python script.</p>
<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://dragly.org/2010/01/21/fixing-a-bug-with-python-visual-in-ubuntu-karmic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
