<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6184501332033258310</id><updated>2012-01-11T16:34:44.957+02:00</updated><category term='Threading'/><category term='Python'/><category term='Vista'/><category term='Visual Studio'/><category term='IIS 7.0'/><category term='MySQL'/><category term='JBoss Seam'/><category term='CSS'/><category term='XP'/><category term='SQL Server'/><category term='AJAX'/><category term='GNU Plot'/><category term='VB.NET'/><category term='GDAL'/><category term='Security'/><category term='NetBeans'/><category term='Java'/><category term='Ossim'/><category term='Latex'/><category term='Best Practices'/><category term='XAML'/><category term='ASP.NET'/><category term='Gentoo'/><category term='C#'/><category term='C++'/><category term='PHP'/><category term='VSTO'/><category term='Tomcat'/><category term='IPC'/><category term='Linq'/><category term='Linux'/><category term='Eclipse'/><category term='Networking'/><category term='Ubuntu'/><category term='Windows Service'/><category term='Apache'/><category term='WPF'/><category term='.NET'/><title type='text'>Adventures in Development</title><subtitle type='html'>As a dev, one often have to solve technical issues. This blog serves as a knowledge base of the issues I encounter and the ways I solved them.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>47</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-3205979006452006790</id><published>2011-06-12T20:05:00.002+02:00</published><updated>2011-06-12T20:07:05.531+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VSTO'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>VSTO: Changes to Zoom percentage not persisted</title><content type='html'>I have been playing around with VSTO and for some odd reason, my zoom percentage changed to 10% and any subsequent changes to the zoom percentage were not persisted. Using &lt;a href="http://www.google.com/codesearch"&gt;Google's Code Search&lt;/a&gt;, I found some examples of how to change these settings in the code-behind:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;this.ActiveWindow.View.Type = Word.WdViewType.wdPrintView;&lt;br /&gt;this.ActiveWindow.View.Zoom.Percentage = 100;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;But it is still&amp;nbsp;annoying&amp;nbsp;when going into design-mode and having to zoom in again.&lt;br /&gt;&lt;br /&gt;One way to fix this is to close Visual Studio, create a copy of the docx file, make the necessary changes and replace the old file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-3205979006452006790?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/3205979006452006790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=3205979006452006790' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3205979006452006790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3205979006452006790'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2011/06/vsto-changes-to-zoom-percentage-not.html' title='VSTO: Changes to Zoom percentage not persisted'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-6102154777371363974</id><published>2011-02-08T19:33:00.000+02:00</published><updated>2011-02-08T19:33:21.897+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>WCF: Programmatically set dataContractSerializer's maxItemsInObjectGraph value</title><content type='html'>When programmtically setting up a WCF Client, one often have to set the &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;dataContractSerializer&lt;/span&gt;'s &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;maxItemsInObjectGraph &lt;/span&gt;parameter (within the &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;serviceBehaviors&lt;/span&gt;) to a higher value than the default &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;65536&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;I struggled a bit to find this one on-line, but finally came across a solution on &lt;a href="http://www.lapathy.com/home/2009/9/30/programmatically-setting-maxitemsinobjectgraph-in-wcf.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Here's the way to do it:&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;foreach (OperationDescription operation in myClient.Contract.Operations)&lt;br /&gt;   operation.Behaviors.Find&amp;lt;DataContractSerializerOperationBehavior&amp;gt;().MaxItemsInObjectGraph = 2147483646;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Where the myClient object is an instance of the ServiceClient.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-6102154777371363974?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/6102154777371363974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=6102154777371363974' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/6102154777371363974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/6102154777371363974'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2011/02/wcf-programmatically-set.html' title='WCF: Programmatically set dataContractSerializer&apos;s maxItemsInObjectGraph value'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-4814705507402579497</id><published>2010-04-25T08:22:00.003+02:00</published><updated>2010-04-25T08:30:42.241+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IIS 7.0'/><title type='text'>IIS 7 and SSL Error</title><content type='html'>If ever faced with the error &lt;span style="font-family: courier new;"&gt;ssl_error_rx_record_too_long&lt;/span&gt; in IIS 7, check to see if you have IIS 6 Compatibility switched on (Control Panel -&gt; Programs and Features -&gt; Turn Windows features on or off -&gt; Internet Information Services -&gt; Web Management Tools -&gt; IIS 6 Management Compatibility).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-4814705507402579497?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/4814705507402579497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=4814705507402579497' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/4814705507402579497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/4814705507402579497'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2010/04/iis-7-and-ssl-error.html' title='IIS 7 and SSL Error'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-3030069226959973070</id><published>2010-03-29T10:44:00.007+02:00</published><updated>2010-03-29T11:09:58.566+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='XAML'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>WPF: Dynamically create a Table</title><content type='html'>Being new to WPF, there are a few funnies you'd need to know about before being able to create a simple table with text.&lt;br /&gt;&lt;br /&gt;First, one can't simply add a &lt;span style="font-family:courier new;"&gt;Table&lt;/span&gt; within a &lt;span style="font-family:courier new;"&gt;Grid&lt;/span&gt; container. Tables need to be housed within a &lt;span style="font-family:courier new;"&gt;FlowDocument&lt;/span&gt;. One also need a container to display these &lt;span style="font-family:courier new;"&gt;FlowDocuments&lt;/span&gt;. I found the &lt;span style="font-family:courier new;"&gt;FlowDocumentScrollViewer &lt;/span&gt;to be the simplest. Some code to display a blank table:&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;&amp;lt;FlowDocumentScrollViewer&lt;br /&gt;      VerticalScrollBarVisibility="Disabled"&lt;br /&gt;      HorizontalScrollBarVisibility="Disabled"&amp;gt;&lt;br /&gt;   &amp;lt;FlowDocument&amp;gt;&lt;br /&gt;      &amp;lt;Table Name="myTable"&amp;gt;&amp;lt;/Table&amp;gt;&lt;br /&gt;   &amp;lt;/FlowDocument&amp;gt;&lt;br /&gt;&amp;lt;/FlowDocumentScrollViewer&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;To populate the table programmatically with some basic text one need to follow the next procedure (the code is pretty much self-explanatory):&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;int cols = 5;&lt;br /&gt;int rows = 10;&lt;br /&gt;&lt;br /&gt;for (int c = 0; c &amp;lt; cols; c++)&lt;br /&gt;   myTable.Columns.Add(New TableColumn());&lt;br /&gt;&lt;br /&gt;for (int r = 0; r &amp;lt; rows; r++)&lt;br /&gt;{&lt;br /&gt;   TableRow tr = new TableRow();&lt;br /&gt;&lt;br /&gt;   for (int c = 0; c &amp;lt; cols; c++)&lt;br /&gt;      tr.Cells.Add(New TableCell(New Paragraph(New Run("Some Text"))));&lt;br /&gt;&lt;br /&gt;   TableRowGroup trg = new TableRowGroup();&lt;br /&gt;   trg.Rows.Add(tr);&lt;br /&gt;   myTable.RowGroups.Add(trg);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;I must say that this approach (a &lt;span style="font-family:courier new;"&gt;Run&lt;/span&gt; within a &lt;span style="font-family:courier new;"&gt;Paragraph&lt;/span&gt; within a &lt;span style="font-family:courier new;"&gt;TableCell&lt;/span&gt; within a &lt;span style="font-family:courier new;"&gt;Row&lt;/span&gt; within a &lt;span style="font-family:courier new;"&gt;RowGroup&lt;/span&gt;) isn't terribly intuitive and the process seems a bit tedious when only trying to create a simple table.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-3030069226959973070?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/3030069226959973070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=3030069226959973070' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3030069226959973070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3030069226959973070'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2010/03/wpf-dynamically-create-table.html' title='WPF: Dynamically create a Table'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-585364453848950905</id><published>2009-12-10T18:21:00.006+02:00</published><updated>2009-12-10T18:48:09.292+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Best Practices'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>C#: Calling/Overriding Grandparent Base Class Methods</title><content type='html'>I use a base class for 99% of my ASP.Net pages, which executes a few operations in the OnInit() method. Here's a simplified version:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;public abstract class BasePage : System.Web.UI.Page, IBasePage&lt;br /&gt;{&lt;br /&gt;  protected override void OnInit(EventArgs e)&lt;br /&gt;  {&lt;br /&gt;     // Do stuff&lt;br /&gt;     Method1();&lt;br /&gt;     Method2();&lt;br /&gt;     Method3();&lt;br /&gt;&lt;br /&gt;     // Call System.Web.UI.Page.OnInit&lt;br /&gt;     base.OnInit(e);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;This works great for all my child classes/pages, but there are a few scenario's where I'd only like to call a specific set of methods, as illustrated here:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;public class MyPage: BasePage&lt;br /&gt;{&lt;br /&gt;  protected override void OnInit(EventArgs e)&lt;br /&gt;  {&lt;br /&gt;     // Ommit Method2()&lt;br /&gt;     Method1();&lt;br /&gt;     Method3();&lt;br /&gt;&lt;br /&gt;     // This calls BasePage.OnInit, which makes&lt;br /&gt;     // redudant calls to Method1() and Method3(),&lt;br /&gt;     // and the undesired call to Method2().&lt;/code&gt;&lt;br /&gt;     base.OnInit(e);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;It is obvious that the last base.OnInit(e) call will have the undesired effect. Being 6:23 PM, after coding all day, my fried brain's initial thought was to bypass the base class' OnInit(e) method and to call the grandparent's OnInit(e) method directly.&lt;br /&gt;&lt;br /&gt;An obvious faux pas. Whenever venturing into the "grandparent" or "grandchild" realm (more than one degree of seperation), you're probably going down the wrong path.&lt;br /&gt;&lt;br /&gt;The proper and easy approach is merely to move the method calls out to a seperate method, which one overrides in the child class like so:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;public abstract class BasePage : System.Web.UI.Page, IBasePage&lt;br /&gt;{&lt;br /&gt;  protected override void OnInit(EventArgs e)&lt;br /&gt;  {&lt;br /&gt;     // Do stuff&lt;br /&gt;     Initialize();&lt;br /&gt;&lt;br /&gt;     // Call System.Web.UI.Page.OnInit&lt;br /&gt;     base.OnInit(e);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  protected virtual void Initialize()&lt;br /&gt;  {&lt;br /&gt;     Method1();&lt;br /&gt;     Method2();&lt;br /&gt;     Method3();&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class MyPage: BasePage&lt;br /&gt;{&lt;br /&gt;  protected override void Initialize()&lt;br /&gt;  {&lt;br /&gt;     // Do stuff&lt;br /&gt;     Method1();&lt;br /&gt;     Method3();&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-585364453848950905?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/585364453848950905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=585364453848950905' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/585364453848950905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/585364453848950905'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/12/c-callingoverriding-grandparent-base.html' title='C#: Calling/Overriding Grandparent Base Class Methods'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-1565883123956988363</id><published>2009-12-07T16:23:00.004+02:00</published><updated>2009-12-07T16:30:32.511+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='GNU Plot'/><title type='text'>GNU Plot and SVG: Change the terminal size and font</title><content type='html'>Again, not really a dev related issue, but I did not find much info online regarding this.&lt;br /&gt;&lt;br /&gt;When using gnuplot to create SVG files, one use the &lt;span style="font-weight: bold;font-family:courier new;" &gt;set term svg&lt;/span&gt; command that sets the following defaults:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;gnuplot&amp;gt; set term svg&lt;br /&gt;Terminal type set to 'svg'&lt;br /&gt;Options are 'size 640 480 fixed fname 'Arial' fsize 12 butt '&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;One can speficy custom parameters to get the desired output:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;gnuplot&amp;gt; set term svg size 640,350 fname 'Times New Roman' fsize 10&lt;br /&gt;Terminal type set to 'svg'&lt;br /&gt;Options are 'size 640 350 fixed fname 'Times New Roman' fsize 10 butt '&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-1565883123956988363?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/1565883123956988363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=1565883123956988363' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1565883123956988363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1565883123956988363'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/12/gnu-plot-and-svg-change-terminal-size.html' title='GNU Plot and SVG: Change the terminal size and font'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-1762009416497669336</id><published>2009-11-23T09:53:00.002+02:00</published><updated>2009-11-23T09:56:51.026+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Type 'DataContract' is not defined</title><content type='html'>This error can be resolved by adding a reference to the .net System.Runtime.Serialization assemly and also importing this namespace in the file where applicable.&lt;br /&gt;&lt;br /&gt;Also, applies to Type 'DataMember' is not defined.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-1762009416497669336?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/1762009416497669336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=1762009416497669336' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1762009416497669336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1762009416497669336'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/11/type-datacontract-is-not-defined.html' title='Type &apos;DataContract&apos; is not defined'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-3049580312803147391</id><published>2009-11-03T16:50:00.003+02:00</published><updated>2009-11-03T16:59:57.165+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><title type='text'>VB.NET: Check if an event handler has been assigned to a method</title><content type='html'>This is how one checks if an event handler (or any delegate handler for that matter) has been assigned to a method.&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;' Create the delegate&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;Public&lt;/span&gt; Delegate &lt;span style="color: rgb(102, 51, 255);"&gt;Sub&lt;/span&gt; UpdateEvent()&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;' Create a handler&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;Public&lt;/span&gt; Update &lt;span style="color: rgb(102, 51, 255);"&gt;As&lt;/span&gt; UpdateEvent&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;' ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;' Rest of the class&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;' ...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;' Check if the event handler has been assigned to&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;If Not&lt;/span&gt; Update &lt;span style="color: rgb(102, 51, 255);"&gt;Is Nothing Then&lt;/span&gt;&lt;br /&gt; Update()&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;End If&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-3049580312803147391?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/3049580312803147391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=3049580312803147391' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3049580312803147391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3049580312803147391'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/11/vbnet-check-if-event-handler-has-been.html' title='VB.NET: Check if an event handler has been assigned to a method'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-6790218161324020745</id><published>2009-11-03T14:51:00.003+02:00</published><updated>2009-11-03T15:57:31.966+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><title type='text'>'SyncLock' operand cannot be of type '' because '' is not a reference type</title><content type='html'>Just had this little error in VB.NET:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Error Message: &lt;/b&gt;&lt;span style="font-family:courier new;"&gt;'SyncLock' operand cannot be of type 'Boolean' because 'Boolean' is not a reference type. &lt;/span&gt;&lt;b&gt;&lt;br /&gt;Error ID:&lt;/b&gt; BC30582&lt;br /&gt;&lt;br /&gt;I tried to change the variable to type Object, but this seems to be converted to Boolean during runtime, which raises the same error.&lt;br /&gt;&lt;br /&gt;A clumsy way around this is to simply use a Boolean array of length 1. There must be a better way though, and I'll update this post when I find a better approach.&lt;br /&gt;&lt;br /&gt;Yes, I did say vb. Yes, I am ashamed. Client's request.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Update:&lt;/span&gt;&lt;br /&gt;Ok here's the deal on using SyncLock or Monitor.Enter (mutex) with value types such as Boolean, Integer, or Double. One is not supposed to lock value types, as they do not have the necessary overhead fields (MethodTablePointer and SyncBlockIndex) to allow a lock to be acquired. One gets around this issue, by creating a reference type, which acts as a flag when the value type is being written to. More on this at the end of Jeffery Richter's article on &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc188793.aspx"&gt;Safe Thread Synchronization&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-6790218161324020745?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/6790218161324020745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=6790218161324020745' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/6790218161324020745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/6790218161324020745'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/11/synclock-operand-cannot-be-of-type_03.html' title='&apos;SyncLock&apos; operand cannot be of type &apos;&lt;typename&gt;&apos; because &apos;&lt;typename&gt;&apos; is not a reference type'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-1209500379891589640</id><published>2009-10-23T15:46:00.005+02:00</published><updated>2009-10-23T17:21:19.090+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>An error occurred while reading the app.config file</title><content type='html'>I edited my app.config file manually, which did not seem to agree with VS. Even though the XML was valid, I received the message: &lt;span style="font-family: courier new;"&gt;An error occurred while reading the app.config file. The file might be corrupted or contain invalid XML&lt;/span&gt;. Despite this message the code will still run, but its just annoying.&lt;br /&gt;&lt;br /&gt;This is a &lt;a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=434990"&gt;known bug&lt;/a&gt;, which I managed to get rid off by removing the project from the solution, restarting Visual Studio and adding the project again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-1209500379891589640?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/1209500379891589640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=1209500379891589640' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1209500379891589640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1209500379891589640'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/10/error-occurred-while-reading-appconfig.html' title='An error occurred while reading the app.config file'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-7678470161369857657</id><published>2009-10-22T16:31:00.006+02:00</published><updated>2009-10-22T16:59:13.890+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>SQL Server: Automated log file maintenance</title><content type='html'>Ok you've all seen it before. You remote desktop onto a client's sql server to upload your app, when your upload fails due to a lack of disk space. Darnit! So you have to reduce the LDF's, which has grown to be several GBs large.&lt;br /&gt;&lt;br /&gt;The following little script will reduce all the non-system db's log files. One can also schedule this script as a job that automatically reduces the log files. (Disclaimer: Read-up on the function log files fulfil before simply using this script. I would not recommend running this on critical production systems.)&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;-- This gets us all on the same page&lt;br /&gt;use [master]&lt;br /&gt;&lt;br /&gt;-- Define some variables&lt;br /&gt;declare @statement varchar(2000) &lt;br /&gt;declare @dbname sysname&lt;br /&gt;declare dbname_cursor cursor for&lt;br /&gt;&lt;br /&gt;-- Select all non-system db's&lt;br /&gt;select [name] from master.dbo.sysdatabases where &lt;br /&gt;  [name] &amp;lt;&amp;gt; 'master' and &lt;br /&gt;  [name] &amp;lt;&amp;gt; 'model' and &lt;br /&gt;  [name] &amp;lt;&amp;gt; 'msdb' and &lt;br /&gt;  [name] &amp;lt;&amp;gt; 'tempdb'&lt;br /&gt;&lt;br /&gt;-- Iterate through each db record&lt;br /&gt;open dbname_cursor&lt;br /&gt;fetch next from dbname_cursor into @dbname&lt;br /&gt;while @@fetch_status &amp;lt;&amp;gt; -1&lt;br /&gt;  begin&lt;br /&gt;    select @statement = ''&lt;br /&gt;    select @statement = @statement + 'use ' + @dbname + '; '&lt;br /&gt;&lt;br /&gt;    -- Backup db by runcating only (will not reduce physical file size)&lt;br /&gt;    select @statement = @statement + 'backup log ' + @dbname + ' with truncate_only; '&lt;br /&gt;&lt;br /&gt;    -- Get the db log file name&lt;br /&gt;    select @statement = @statement + 'declare @log_file varchar(2000); '&lt;br /&gt;    select @statement = @statement + 'select @log_file = [name] from sys.database_files where type_desc = ''LOG''; '&lt;br /&gt;&lt;br /&gt;    -- Reduce the physical file size&lt;br /&gt;    select @statement = @statement + 'exec(''dbcc shrinkfile ('' + @log_file + '', 0)''); '    &lt;br /&gt;    exec(@statement)&lt;br /&gt;    fetch next from dbname_cursor into @dbname&lt;br /&gt;  end&lt;br /&gt;close dbname_cursor&lt;br /&gt;deallocate dbname_cursor&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-7678470161369857657?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/7678470161369857657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=7678470161369857657' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/7678470161369857657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/7678470161369857657'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/10/sql-server-automated-log-file.html' title='SQL Server: Automated log file maintenance'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-8018300071575093284</id><published>2009-04-29T14:18:00.018+02:00</published><updated>2009-04-29T15:20:48.280+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>g++ 4.3 more strict with declarations</title><content type='html'>I've been moving a bunch of old C++ code over to g++ 4.3 and have found that gcc is now more strict on declarations and I often receive these sorts of errors:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;error: ‘memset’ was not declared in this scope&lt;br /&gt;error: ‘strncmp’ was not declared in this scope&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;I'm going to continually update this look-up table, which will explain what to do when receiving any of these errors:&lt;br /&gt;&lt;style type="text/css"&gt;.nobrtable br { display: none } table.custom {border-width: 1px 1px 1px 1px;border-spacing: 0px; border-style: solid solid solid solid; border-color: black black black black; border-collapse: separate; background-color: background-color: rgb(238, 238, 238);}table.custom th { border-width: 1px 1px 1px 1px; padding: 5px 5px 5px 5px; border-style: solid solid solid solid; border-color: rgb(180, 180, 180); background-color: rgb(238, 238, 238); -moz-border-radius: 0px 0px 0px 0px;}table.custom td { border-width: 1px 1px 1px 1px; padding: 5px 5px 5px 5px; border-style: solid solid solid solid; border-color: rgb(180, 180, 180); background-color: rgb(238, 238, 238); -moz-border-radius: 0px 0px 0px 0px;}&lt;/style&gt;&lt;br /&gt;&lt;div class="nobrtable"&gt;&lt;br /&gt;&lt;table class="custom"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th width="50%"&gt;Error&lt;/th&gt;&lt;th width="50%"&gt;Resolution&lt;/th&gt;&lt;br /&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="font-family: courier new;"&gt;error: ‘memset’ was not declared in this scope&lt;/td&gt;&lt;td rowspan="2"&gt;Add #&lt;span style="font-family:courier new;"&gt;include &amp;lt;cstring&amp;gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr style="font-family: courier new;"&gt;&lt;td&gt;&lt;br /&gt;error: ‘strncmp’ was not declared in this scope&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-8018300071575093284?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/8018300071575093284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=8018300071575093284' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/8018300071575093284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/8018300071575093284'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/04/gcc-43-more-strict-with-declarations.html' title='g++ 4.3 more strict with declarations'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-146507062952710469</id><published>2009-04-21T22:45:00.005+02:00</published><updated>2009-04-21T22:51:30.631+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>C++: Increasing void pointer position</title><content type='html'>I've becoming better friends with c++ today. I don't think this relationship is going anywhere.&lt;br /&gt;&lt;br /&gt;Managed to crack this little stupid nut though. If you have a void pointer (dynamic array) you can increase it as follows:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;void* ptr;            // Say of type char&lt;br /&gt;(*(char*)ptr) += 100; // Or any integer&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-146507062952710469?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/146507062952710469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=146507062952710469' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/146507062952710469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/146507062952710469'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/04/c-increasing-void-pointer-position.html' title='C++: Increasing void pointer position'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-4599273639295185084</id><published>2009-04-20T16:20:00.003+02:00</published><updated>2009-04-20T16:33:27.256+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ossim'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>Ossim on Ubuntu causes error on missing llampi++</title><content type='html'>When compiling &lt;a href="http://www.ossim.org/"&gt;Ossim&lt;/a&gt; with lam mpi on Ubuntu 9, you might receive this error:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;/usr/bin/ld: cannot find -llammpi++&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;The easiest way to fix this is to ensure &lt;span style="font-family: courier new;"&gt;liblam4&lt;/span&gt; and &lt;span style="font-family: courier new;"&gt;openmpi&lt;/span&gt; is installed (via the Synaptic Package Manager) and to edit the &lt;span style="font-family: courier new;"&gt;Makefile.common&lt;/span&gt; in the ossim directory (&lt;span style="font-family: courier new;"&gt;$OSSIM_HOME&lt;/span&gt;), changing the &lt;span style="font-family: courier new;"&gt;MPI_LIB_PATH&lt;/span&gt;.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;# Open the Makefile.common&lt;br /&gt;gedit $OSSIM_HOME/Makefile.common&lt;br /&gt;&lt;br /&gt;# Locate the following line and set its path to &lt;/code&gt;&lt;code&gt;/usr/lib/lam/lib&lt;br /&gt;&lt;/code&gt;&lt;code&gt;MPI_LIB_PATH         = -L/usr/lib/lam/lib&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-4599273639295185084?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/4599273639295185084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=4599273639295185084' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/4599273639295185084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/4599273639295185084'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/04/ossim-on-ubuntu-causes-error-on-missing.html' title='Ossim on Ubuntu causes error on missing llampi++'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-3081770568860715089</id><published>2009-04-20T13:11:00.008+02:00</published><updated>2009-04-20T15:36:33.415+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GDAL'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><title type='text'>Compile GDAL with GeoTiff support</title><content type='html'>I've been running Ubuntu on my personal machine for a while now and just realized that the gdal synaptic package does not enable support for GeoTiffs. This is where Gentoo has one up, but its not the end of the world. You can 'simply' build GDAL from source with the correct flags.&lt;br /&gt;&lt;br /&gt;Here's what I did:&lt;br /&gt;1. Install the Tiff, GeotTiff, Png and OpenJpeg dev packages and their dependencies (&lt;span style="font-family:courier new;"&gt;libtiff4-dev, libgeotiff-dev, libpng12-dev and libopenjpeg-dev&lt;/span&gt;). Also be sure to install g++ and subversion.&lt;br /&gt;2. Fire up a terminal and checkout the GDAL subversion repository anywhere in your home directory:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px;"&gt;&lt;code&gt;svn co http://svn.osgeo.org/gdal/trunk/gdal&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;3. Go into the GDAL directory and run configure:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px;"&gt;&lt;code&gt;cd gdal&lt;br /&gt;./configure --with-geotiff=/usr --with-jpeg=/usr --with-libtif=/usr &lt;/code&gt;&lt;span style="line-height: 13px;" class="style"&gt;--without-libtool&lt;/span&gt;&lt;/pre&gt;4. In theory you should be able to run make now, but the configure script missed the geotiff header files directory so I had to set these manually. This is the error I received:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; height: 100px; width: 100%;"&gt;&lt;code&gt;make -C gtiff install-obj&lt;br /&gt;make[2]: Entering directory `/home/andreh/workspace/project-ossim_dev/gdal/frmts/gtiff'&lt;br /&gt;/bin/sh /home/andreh/workspace/project-ossim_dev/gdal/libtool --mode=compile --tag=CXX g++ -g -O2  -Wall  -I/home/andreh/workspace/project-ossim_dev/gdal/port -I/home/andreh/workspace/project-ossim_dev/gdal/gcore -I/home/andreh/workspace/project-ossim_dev/gdal/alg -I/home/andreh/workspace/project-ossim_dev/gdal/ogr -I/home/andreh/workspace/project-ossim_dev/gdal/ogr/ogrsf_frmts   -DOGR_ENABLED -I/home/andreh/workspace/project-ossim_dev/gdal/port -I/usr/lib/include -I -I/include  -c -o ../o/geotiff.lo geotiff.cpp&lt;br /&gt;libtool: compile:  g++ -g -O2 -Wall -I/home/andreh/workspace/project-ossim_dev/gdal/port -I/home/andreh/workspace/project-ossim_dev/gdal/gcore -I/home/andreh/workspace/project-ossim_dev/gdal/alg -I/home/andreh/workspace/project-ossim_dev/gdal/ogr -I/home/andreh/workspace/project-ossim_dev/gdal/ogr/ogrsf_frmts -DOGR_ENABLED -I/home/andreh/workspace/project-ossim_dev/gdal/port -I/usr/lib/include -I -I/include -c geotiff.cpp  -fPIC -DPIC -o ../o/.libs/geotiff.o&lt;br /&gt;geotiff.cpp:34:21: error: xtiffio.h: No such file or directory&lt;br /&gt;geotiff.cpp:35:21: error: geotiff.h: No such file or directory&lt;br /&gt;geotiff.cpp:36:27: error: geo_normalize.h: No such file or directory&lt;br /&gt;geotiff.cpp:37:23: error: geovalues.h: No such file or directory&lt;br /&gt;geotiff.cpp:46: error: 'GTIF' was not declared in this scope&lt;br /&gt;geotiff.cpp:46: error: expected primary-expression before ',' token&lt;br /&gt;geotiff.cpp:46: error: 'GTIFDefn' was not declared in this scope&lt;br /&gt;geotiff.cpp:46: error: expected primary-expression before ')' token&lt;br /&gt;geotiff.cpp:46: error: initializer expression list treated as compound expression&lt;br /&gt;geotiff.cpp:47: error: 'GTIF' was not declared in this scope&lt;br /&gt;geotiff.cpp:47: error: expected primary-expression before ',' token&lt;br /&gt;geotiff.cpp:47: error: expected primary-expression before 'const'&lt;br /&gt;geotiff.cpp:47: error: initializer expression list treated as compound expression&lt;br /&gt;geotiff.cpp: In destructor 'virtual GTiffDataset::~GTiffDataset()':&lt;br /&gt;geotiff.cpp:2249: error: 'XTIFFClose' was not declared in this scope&lt;br /&gt;geotiff.cpp: In member function 'void GTiffDataset::WriteGeoTIFFInfo()':&lt;br /&gt;geotiff.cpp:3336: error: 'TIFFTAG_GEOPIXELSCALE' was not declared in this scope&lt;br /&gt;geotiff.cpp:3346: error: 'TIFFTAG_GEOTIEPOINTS' was not declared in this scope&lt;br /&gt;geotiff.cpp:3363: error: 'TIFFTAG_GEOTRANSMATRIX' was not declared in this scope&lt;br /&gt;geotiff.cpp:3393: error: 'TIFFTAG_GEOTIEPOINTS' was not declared in this scope&lt;br /&gt;geotiff.cpp:3404: error: 'GTIF' was not declared in this scope&lt;br /&gt;geotiff.cpp:3404: error: 'psGTIF' was not declared in this scope&lt;br /&gt;geotiff.cpp:3413: error: 'TIFFTAG_GEOKEYDIRECTORY' was not declared in this scope&lt;br /&gt;geotiff.cpp:3420: error: 'TIFFTAG_GEODOUBLEPARAMS' was not declared in this scope&lt;br /&gt;geotiff.cpp:3422: error: 'TIFFTAG_GEOASCIIPARAMS' was not declared in this scope&lt;br /&gt;geotiff.cpp:3425: error: 'GTIFNew' was not declared in this scope&lt;br /&gt;geotiff.cpp:3428: error: 'GTIFSetFromOGISDefn' cannot be used as a function&lt;br /&gt;geotiff.cpp:3434: error: 'GTRasterTypeGeoKey' was not declared in this scope&lt;br /&gt;geotiff.cpp:3434: error: 'TYPE_SHORT' was not declared in this scope&lt;br /&gt;geotiff.cpp:3435: error: 'RasterPixelIsPoint' was not declared in this scope&lt;br /&gt;geotiff.cpp:3435: error: 'GTIFKeySet' was not declared in this scope&lt;br /&gt;geotiff.cpp:3438: error: 'GTIFWriteKeys' was not declared in this scope&lt;br /&gt;geotiff.cpp:3439: error: 'GTIFFree' was not declared in this scope&lt;br /&gt;geotiff.cpp: In static member function 'static GDALDataset* GTiffDataset::OpenDir(GDALOpenInfo*)':&lt;br /&gt;geotiff.cpp:4285: error: 'XTIFFClose' was not declared in this scope&lt;br /&gt;geotiff.cpp: In member function 'CPLErr GTiffDataset::OpenOffset(TIFF*, GTiffDataset**, toff_t, int, GDALAccess, int)':&lt;br /&gt;geotiff.cpp:4640: error: 'TIFFTAG_GEOPIXELSCALE' was not declared in this scope&lt;br /&gt;geotiff.cpp:4647: error: 'TIFFTAG_GEOTIEPOINTS' was not declared in this scope&lt;br /&gt;geotiff.cpp:4659: error: 'TIFFTAG_GEOTRANSMATRIX' was not declared in this scope&lt;br /&gt;geotiff.cpp:4700: error: 'TIFFTAG_GEOTIEPOINTS' was not declared in this scope&lt;br /&gt;geotiff.cpp:4724: error: 'GTIF' was not declared in this scope&lt;br /&gt;geotiff.cpp:4724: error: 'hGTIF' was not declared in this scope&lt;br /&gt;geotiff.cpp:4725: error: 'GTIFDefn' was not declared in this scope&lt;br /&gt;geotiff.cpp:4725: error: expected `;' before 'sGTIFDefn'&lt;br /&gt;geotiff.cpp:4730: error: 'GTIFNew' was not declared in this scope&lt;br /&gt;geotiff.cpp:4739: error: 'sGTIFDefn' was not declared in this scope&lt;br /&gt;geotiff.cpp:4739: error: 'GTIFGetDefn' was not declared in this scope&lt;br /&gt;geotiff.cpp:4741: error: 'GTIFGetOGISDefn' cannot be used as a function&lt;br /&gt;geotiff.cpp:4748: error: 'GTRasterTypeGeoKey' was not declared in this scope&lt;br /&gt;geotiff.cpp:4749: error: 'GTIFKeyGet' was not declared in this scope&lt;br /&gt;geotiff.cpp:4751: error: 'RasterPixelIsPoint' was not declared in this scope&lt;br /&gt;geotiff.cpp:4757: error: 'GTIFFree' was not declared in this scope&lt;br /&gt;geotiff.cpp: In static member function 'static TIFF* GTiffDataset::CreateLL(const char*, int, int, int, GDALDataType, char**)':&lt;br /&gt;geotiff.cpp:5707: error: 'XTIFFClose' was not declared in this scope&lt;br /&gt;geotiff.cpp: In static member function 'static GDALDataset* GTiffDataset::CreateCopy(const char*, GDALDataset*, int, char**, int (*)(double, const char*, void*), void*)':&lt;br /&gt;geotiff.cpp:6217: error: 'TIFFTAG_GEOPIXELSCALE' was not declared in this scope&lt;br /&gt;geotiff.cpp:6226: error: 'TIFFTAG_GEOTIEPOINTS' was not declared in this scope&lt;br /&gt;geotiff.cpp:6242: error: 'TIFFTAG_GEOTRANSMATRIX' was not declared in this scope&lt;br /&gt;geotiff.cpp:6279: error: 'TIFFTAG_GEOTIEPOINTS' was not declared in this scope&lt;br /&gt;geotiff.cpp:6301: error: 'GTIF' was not declared in this scope&lt;br /&gt;geotiff.cpp:6301: error: 'psGTIF' was not declared in this scope&lt;br /&gt;geotiff.cpp:6303: error: 'GTIFNew' was not declared in this scope&lt;br /&gt;geotiff.cpp:6304: error: 'GTIFSetFromOGISDefn' cannot be used as a function&lt;br /&gt;geotiff.cpp:6310: error: 'GTRasterTypeGeoKey' was not declared in this scope&lt;br /&gt;geotiff.cpp:6310: error: 'TYPE_SHORT' was not declared in this scope&lt;br /&gt;geotiff.cpp:6311: error: 'RasterPixelIsPoint' was not declared in this scope&lt;br /&gt;geotiff.cpp:6311: error: 'GTIFKeySet' was not declared in this scope&lt;br /&gt;geotiff.cpp:6314: error: 'GTIFWriteKeys' was not declared in this scope&lt;br /&gt;geotiff.cpp:6315: error: 'GTIFFree' was not declared in this scope&lt;br /&gt;geotiff.cpp:6325: error: 'XTIFFClose' was not declared in this scope&lt;br /&gt;make[2]: *** [../o/geotiff.lo] Error 1&lt;br /&gt;make[2]: Leaving directory `/home/andreh/workspace/project-ossim_dev/gdal/frmts/gtiff'&lt;br /&gt;make[1]: *** [gtiff-install-obj] Error 2&lt;br /&gt;make[1]: Leaving directory `/home/andreh/workspace/project-ossim_dev/gdal/frmts'&lt;br /&gt;make: *** [frmts-target] Error 2&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;And this is how to get rid of it:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px;"&gt;&lt;code&gt;# open the GDALmake.opt file with an editor&lt;br /&gt;gedit GDALmake.opt&lt;br /&gt;&lt;br /&gt;# locate the CPPFLAGS line and add the include path at the end "-I/usr/include/geotiff"&lt;br /&gt;CPPFLAGS    =  -I$(GDAL_ROOT)/port -I/usr/lib/include -I -I/include -I/usr/include/geotiff&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;5. One can now run make and make install:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px;"&gt;&lt;code&gt;make&lt;br /&gt;sudo make install&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-3081770568860715089?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/3081770568860715089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=3081770568860715089' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3081770568860715089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3081770568860715089'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/04/compile-gdal-with-geotiff-support.html' title='Compile GDAL with GeoTiff support'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-1807292084178166828</id><published>2009-04-02T21:59:00.004+02:00</published><updated>2009-04-02T22:09:24.812+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linq'/><title type='text'>Limited Linq to Sql</title><content type='html'>I've been playing around (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;ie&lt;/span&gt; pulling my hair out) in my spare time over the last few weeks, trying to make &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Linq&lt;/span&gt; more loosely coupled with a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;UI&lt;/span&gt; and to extend its capabilities to allow for many-to-many table updates. I find it completely &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;rediculous&lt;/span&gt; how intricate Ms has made all of this. Perhaps I'm missing the plot, but unless you're trying to do some really simple little application that requires little to no flexibility on the DB side of things, STAY AWAY FROM &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;LINQ&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;I wrote my own &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;Linq&lt;/span&gt; a few years ago, but decided to give Ms &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;Linq&lt;/span&gt; a chance and it hasn't really been smooth sailing. The most enjoyable part of the experience was dragging my tables into the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;dbml&lt;/span&gt; window and seeing VS create all the classes for me. The rest is a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;friggin&lt;/span&gt; nightmare.&lt;br /&gt;&lt;br /&gt;I'm not about to give up the fight though, but I'm pretty distraught at the moment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-1807292084178166828?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/1807292084178166828/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=1807292084178166828' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1807292084178166828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1807292084178166828'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/04/limited-linq-to-sql.html' title='Limited Linq to Sql'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-627543730810460733</id><published>2009-03-11T10:47:00.004+02:00</published><updated>2009-03-11T11:06:49.589+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Latex'/><category scheme='http://www.blogger.com/atom/ns#' term='Vista'/><title type='text'>TexnicCenter DDE Commands for Acrobat Reader</title><content type='html'>Not really a dev related post, but I had to re-install Vista due to an epic fail on MS's part. My pc went into sleep mode and wrote the files from the &lt;span style="font-family: courier new;"&gt;C:\ProgramData\Microsoft&lt;/span&gt; directory to the &lt;span style="font-family: courier new;"&gt;C:\ProgramData\Microso~1&lt;/span&gt; dir.&lt;br /&gt;&lt;br /&gt;If this ever happens to you, I'm sorry to say you'll have to re-install your OS. I tried everything to get the files back to where they were supposed to be, but it looks like MS tightened security on FS and its impossible to move some of the Crypto files to where they belong. Even if you boot up in Linux...&lt;br /&gt;&lt;br /&gt;Anyhow, I have to get latex running again and I'm using TexnicCenter as an editor. I forgot the DDE commands and had to figure it out again. Joy.&lt;br /&gt;&lt;br /&gt;Here's the basic setup:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;In TexnicCenter, hit Alt+F7 and click on the viewer tab.&lt;/li&gt;&lt;li&gt;In the "View project output" and "Forward search" options, select the "DDE Command" radio button and fill in the following: Command = [DocOpen("%bm.pdf")][FileOpen("%bm.pdf")], Server = acroview, Topic = control&lt;/li&gt;&lt;li&gt;For the "Close document before running Latex" , select DDE with the same settings as above, but change the command to be [DocClose("%bm.pdf")]&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;One can also fool around with some other commands. Here's the snippet on DDE from the &lt;a href="http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/iac/IACOverview.pdf"&gt;Adobe Interapplication Communication document&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Acrobat Application DDE Messages&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;This section lists all DDE messages. For complete descriptions of the parameters associated with DDE messages, see the DDE sections of the Acrobat Interapplication Communication Reference.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Application Configuration&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;AppExit — Exits Acrobat.&lt;/li&gt;&lt;li&gt;AppHide — Iconifies or hides Acrobat.&lt;/li&gt;&lt;li&gt;AppShow — Shows Acrobat.&lt;/li&gt;&lt;li&gt;CloseAllDocs — Closes all open documents.&lt;/li&gt;&lt;li&gt;HideToolbar — Hides the toolbar.&lt;/li&gt;&lt;li&gt;MenuitemExecute — Invokes a menu item, given its language-independent name.&lt;/li&gt;&lt;li&gt;ShowToolbar — Shows the toolbar.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Document Manipulation&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;DocClose — Closes the file without saving it and without prompting the user to save the document if it has been modified.&lt;/li&gt;&lt;li&gt;DocDeletePages — Deletes a specified range of pages in a document. It cannot delete all pages in a document.&lt;/li&gt;&lt;li&gt;DocInsertPages — Inserts specified pages from one file into another.&lt;/li&gt;&lt;li&gt;DocOpen — Opens a document and adds it to the list of documents known to DDE, allowing it to be manipulated by other DDE messages (for example, FileOpen).&lt;/li&gt;&lt;li&gt;DocReplacePages — Replaces specified pages using pages from another file.&lt;/li&gt;&lt;li&gt;DocSave — Saves the specified file.&lt;/li&gt;&lt;li&gt;DocSaveAs — Saves an open file into a new file, without warning the user if there is a problem saving.&lt;/li&gt;&lt;li&gt;DocSetViewMode — Controls whether bookmarks or thumbnail images are shown in addition to the document content.&lt;/li&gt;&lt;li&gt;FileOpen — Opens and displays a file, making it the current document and bringing it to the front if it is already open.&lt;/li&gt;&lt;li&gt;FileOpenEx — Opens and displays a file, making it the current document and bringing it to the front if it is already open. The file is opened during an idle loop to allow DDE messages to continue flowing during the opening of large documents.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Document Printing&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;DocPrint — Prints a specified range of pages from a document, without displaying a modal Print dialog box to the user.&lt;/li&gt;&lt;li&gt;FilePrint — Prints all pages in a document, displaying a modal Print dialog box to the user.&lt;/li&gt;&lt;li&gt;FilePrintEx — Prints all pages in a document, displaying a modal Print dialog box to the user. Only PostScript Level 1 operators are used for PostScript printing. Printing is performed during an idle loop to allow DDE messages to continue flowing during the printing of large documents.&lt;/li&gt;&lt;li&gt;FilePrintSilent — Prints all pages in a document, displaying no print dialog box to the user.&lt;/li&gt;&lt;li&gt;FilePrintSilentEx — Prints all pages in a document, displaying no print dialog box to the user. Only PostScript Level 1 operators are used for PostScript printing. Printing is performed during an idle loop to allow DDE messages to continue flowing during the printing of large documents.&lt;/li&gt;&lt;li&gt;FilePrintTo — Prints all pages in a document to a specified printer, using a specified driver and port, displaying a modal Print dialog box to the user.&lt;/li&gt;&lt;li&gt;FilePrintToEx — Prints all pages in a document to a specified printer, using a specified driver and port, displaying a modal Print dialog box to the user. Only PostScript Level 1 operators are used for PostScript printing. Printing is performed during an idle loop to allow DDE messages to continue flowing during the printing of large documents.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;View Manipulation&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;DocGoTo — Goes to the specified page.&lt;/li&gt;&lt;li&gt;DocGoToNameDest — Goes to the specified name destination within the document.&lt;/li&gt;&lt;li&gt;DocPageDown — Scrolls forward through the document by one screen area.&lt;/li&gt;&lt;li&gt;DocPageLeft — Scrolls to the left by a small amount.&lt;/li&gt;&lt;li&gt;DocPageRight — Scrolls to the right by a small amount.&lt;/li&gt;&lt;li&gt;DocPageUp — Scrolls backward through the document by one screen area.&lt;/li&gt;&lt;li&gt;DocScrollTo — Scrolls the view of the current page to a specified location.&lt;/li&gt;&lt;li&gt;DocZoomTo — Sets the zoom for a specified document.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Search-related&lt;/span&gt;&lt;ul&gt;&lt;li&gt;DocFind — Finds a string in a specified file.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-627543730810460733?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/627543730810460733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=627543730810460733' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/627543730810460733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/627543730810460733'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2009/03/texniccenter-dde-commands-for-acrobat.html' title='TexnicCenter DDE Commands for Acrobat Reader'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-1809012793351650511</id><published>2008-12-12T12:14:00.004+02:00</published><updated>2009-04-20T13:37:26.661+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GDAL'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Python, GDAL: Set JPEG quality values and other att</title><content type='html'>Here I shall show how to set the quality values of the JPEG format in GDAL. This post will build upon &lt;a href="http://adventuresindevelopment.blogspot.com/2008/12/creating-jpgs-and-other-formats-with.html"&gt;this previous article&lt;/a&gt; which describes how to create a basic JPEG.&lt;br /&gt;&lt;br /&gt;It is pretty trivial to set the quality (and other) JPEG values. Here is a &lt;a href="http://www.gdal.org/frmt_jpeg.html"&gt;list of parameters&lt;/a&gt; one can set for the JPEG format. These parameters are simply passed to the &lt;span style="font-family:courier new;"&gt;CreateCopy()&lt;/span&gt; method as a list of options. Here's an example:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;# ... Some other code ... #&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;if (cmp(output_file_ext.lower(),&lt;span style="color: rgb(51, 102, 255);"&gt;".jpg"&lt;/span&gt;) == 0 or cmp(output_file_ext.lower(),&lt;span style="color: rgb(51, 102, 255);"&gt;".jpeg"&lt;/span&gt;) == 0):&lt;br /&gt;  &lt;span style="color: rgb(102, 102, 102);"&gt;# Add options&lt;/span&gt;&lt;br /&gt;  options = []&lt;br /&gt;  options.append(&lt;span style="color: rgb(51, 102, 255);"&gt;"QUALITY=90"&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;  jpg_driver = gdal.GetDriverByName(&lt;span style="color: rgb(51, 102, 255);"&gt;"JPEG"&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: rgb(102, 102, 102);"&gt;# Pass options as parameter&lt;/span&gt;&lt;br /&gt;  jpg_driver.CreateCopy( output_file, dst_ds, options=options )&lt;br /&gt;  os.remove(output_file_tmp)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-1809012793351650511?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/1809012793351650511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=1809012793351650511' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1809012793351650511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1809012793351650511'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/12/python-gdal-set-jpeg-quality-values-and.html' title='Python, GDAL: Set JPEG quality values and other att'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-5782067186063579089</id><published>2008-12-11T13:25:00.007+02:00</published><updated>2009-04-20T13:39:39.204+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GDAL'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Python, GDAL: Adding GeoTiff Meta Data</title><content type='html'>I'm pretty much a noob when it comes coordinate systems and projections. I only know the standard GPS coordinates which are in the latitude/longitude (lat/long) format. It turns out that this system is known as the &lt;a href="http://en.wikipedia.org/wiki/WGS84"&gt;WGS84&lt;/a&gt; (World Geodetic System) format.&lt;br /&gt;&lt;br /&gt;The project I'm busy with at the moment, generates GeoTiff images and I only had a raster with the bottom lower left corner coordinates and the pixel sizes in km. It also happened that this is the only information I needed to generate the GeoTiff.&lt;br /&gt;&lt;br /&gt;So this is the info I have:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;ncols         174&lt;br /&gt;nrows         115&lt;br /&gt;xllcorner     14.97&lt;br /&gt;yllcorner     -34.54&lt;br /&gt;cellsize      0.11&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;It's just the number of x and y pixels, the lower left corner and the pixel size.&lt;br /&gt;&lt;br /&gt;Now we can go ahead and generate the GeoTiff like so:&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="font-weight: bold;"&gt;if&lt;/span&gt; __name__ == '__main__':&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;# Import libs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;import&lt;/span&gt; numpy, os&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;from&lt;/span&gt; osgeo &lt;span style="font-weight: bold;"&gt;import&lt;/span&gt; osr, gdal&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;# Set file vars&lt;/span&gt;&lt;br /&gt;output_file = &lt;span style="color: rgb(51, 102, 255);"&gt;"out.tif"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;# Create gtif&lt;/span&gt;&lt;br /&gt;driver = gdal.GetDriverByName(&lt;span style="color: rgb(51, 102, 255);"&gt;"GTiff"&lt;/span&gt;)&lt;br /&gt;dst_ds = driver.Create(output_file, 174, 115, 1, gdal.GDT_Byte )&lt;br /&gt;raster = numpy.zeros( (174, 115) )&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;# top left x, w-e pixel resolution, rotation, top left y, rotation, n-s pixel resolution&lt;/span&gt;&lt;br /&gt;dst_ds.SetGeoTransform( [ 14.97, 0.11, 0, -34.54, 0, 0.11 ] )&lt;br /&gt;  &lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;# set the reference info &lt;/span&gt;&lt;br /&gt;srs = osr.SpatialReference()&lt;br /&gt;srs.SetWellKnownGeogCS(&lt;span style="color: rgb(51, 102, 255);"&gt;"WGS84"&lt;/span&gt;)&lt;br /&gt;dst_ds.SetProjection( srs.ExportToWkt() )&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;# write the band&lt;/span&gt;&lt;br /&gt;dst_ds.GetRasterBand(1).WriteArray(raster)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Easy as pie with GDAL.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-5782067186063579089?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/5782067186063579089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=5782067186063579089' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/5782067186063579089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/5782067186063579089'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/12/python-gdal-adding-geotiff-meta-data.html' title='Python, GDAL: Adding GeoTiff Meta Data'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-1476347911497961153</id><published>2008-12-04T09:41:00.002+02:00</published><updated>2008-12-04T09:54:32.772+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Grep and punctuation marks</title><content type='html'>I've often tried to use &lt;span style="font-family: courier new;"&gt;grep&lt;/span&gt; to filter search results for locate and several times I've had to search for a string with &lt;span style="font-family: courier new;"&gt;locate&lt;/span&gt;:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;locate svn&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;This search would obviously include all the '.svn' folders too. Trying to get rid with them with&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;locate svn | grep -v '.svn'&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;does not work, since &lt;span style="font-family: courier new;"&gt;grep&lt;/span&gt; uses basic regular expressions, and the period mark will simply match any character.&lt;br /&gt;&lt;br /&gt;To explicitly indicate the usage of a punctuation mark, one has to put it in brackets. The statement will now look something like:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;locate svn | grep -v '[.]svn'&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;I just scanned through the grep man pages, and everything is explained pretty clearly there. I'd recommend reading the bit on regular expressions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-1476347911497961153?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/1476347911497961153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=1476347911497961153' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1476347911497961153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1476347911497961153'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/12/grep-and-punctuation-marks.html' title='Grep and punctuation marks'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-1888480081653552345</id><published>2008-12-03T16:34:00.003+02:00</published><updated>2008-12-03T17:01:38.610+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Gentoo'/><title type='text'>MySQL and the joys of security</title><content type='html'>I've been running my local MySQL server on Gentoo without hassles for a while and recently tried to connect to it from a remote machine. Obviously there was bound to be some issues and here's how I solved them.&lt;br /&gt;&lt;br /&gt;When you first try to connect remotely to the machine, you'll be greeted by this lovely message:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;# mysql --user=root --password=some_password --host=192.168.0.1 MYDB&lt;br /&gt;ERROR 2003 (HY000): Can't connect to MySQL server on '&lt;/code&gt;&lt;code&gt;192.168.0.1&lt;/code&gt;&lt;code&gt;' (111)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;To get this sucker out of the way, edit your &lt;span style="font-family:courier new;"&gt;/etc/mysql/&lt;span style="font-weight: bold;"&gt;my.cnf&lt;/span&gt;&lt;/span&gt; file and comment the following line:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;# bind-address = 127.0.0.1&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;span style="font-style: italic;"&gt;Note to all the security girls: Your server will now be accessible from any other networked machine. Oooohh nooooo!!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Anyhow, now we try to connect again, and whooopa!! Another error:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;mysql --user=root --password=some_password --host=192.168.0.1 MYDB&lt;br /&gt;ERROR 1130 (00000): Host 'remote_pc_hostname' is not allowed to connect to this MySQL server&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Ah bite me.  Ok, so you have to grant his Lordship permissions to connect to thy server. In order to do that logon to sql on the sql server itself:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;# mysql --user=root --password=some_password&lt;br /&gt;Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;Your MySQL connection id is 11&lt;br /&gt;Server version: 5.0.70-log Gentoo Linux mysql-5.0.70-r1&lt;br /&gt;&lt;br /&gt;Type 'help;' or '\h' for help. Type '\c' to clear the buffer.&lt;br /&gt;&lt;br /&gt;mysql&amp;gt; GRANT ALL ON *.* TO 'root'@'remote_pc_hostname';&lt;br /&gt;Query OK, 0 rows affected (0.00 sec)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Now all should be well in fairyland, but alas. The code securo freaks over at Sun have presented ye with another trial.&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;# mysql --user=root --password=some_password --host=192.168.0.1 MYDB&lt;br /&gt;ERROR 1045 (28000): Access denied for user 'root'@'remote_pc_hostname' (using password: YES)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Ok I'm taking the fairytale rubbish too far. Here's what you should've done on the sql server in the first place:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;# mysql --user=root --password=some_password&lt;br /&gt;Welcome to the MySQL monitor.  Commands end with ; or \g.&lt;br /&gt;Your MySQL connection id is 11&lt;br /&gt;Server version: 5.0.70-log Gentoo Linux mysql-5.0.70-r1&lt;br /&gt;&lt;br /&gt;Type 'help;' or '\h' for help. Type '\c' to clear the buffer.&lt;br /&gt;&lt;br /&gt;mysql&amp;amp;gt; GRANT ALL ON *.* TO 'root'@'remote_pc_hostname' &lt;span style="font-weight: bold;"&gt;IDENTIFIED BY 'some_password'&lt;/span&gt;;&lt;br /&gt;Query OK, 0 rows affected (0.00 sec)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Sheesh! You little girls are wasting my time. Take a que from MS SQL Server.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-1888480081653552345?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/1888480081653552345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=1888480081653552345' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1888480081653552345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1888480081653552345'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/12/mysql-and-joys-of-security.html' title='MySQL and the joys of security'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-599939216550472381</id><published>2008-12-03T11:32:00.004+02:00</published><updated>2008-12-11T13:54:50.594+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GDAL'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Creating JPG's and other formats with Python and GDAL</title><content type='html'>Ok for some daft reason the &lt;span style="font-family:courier new;"&gt;driver.Create()&lt;/span&gt; method is not supported by all image drivers, but the &lt;span style="font-family:courier new;"&gt;driver.CreateCopy()&lt;/span&gt; is. The main difference being that &lt;span style="font-family:courier new;"&gt;Create() &lt;/span&gt;actually creates the format from scratch whereas &lt;span style="font-family:courier new;"&gt;CreateCopy() &lt;/span&gt;makes a copy of another existing image. I'm sure they have their reasons, but I don't understand why everything isn't created in a generic image type and then converted to the destintation image format through C&lt;span style="font-family:courier new;"&gt;reateCopy()&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Anyhow, this is how I created a JPEG with GDAL. The same approach can be followed for multiple image formats. See &lt;a href="http://www.gdal.org/formats_list.html"&gt;this link&lt;/a&gt; for a complete list of supported formats.&lt;br /&gt;&lt;pre   style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); line-height: 14px; width: 100%;font-family:Andale Mono,Lucida Console,Monaco,fixed,monospace;font-size:12px;"&gt;&lt;code&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;# Import libs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;import&lt;/span&gt; numpy, os&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;from&lt;/span&gt; osgeo &lt;span style="font-weight: bold;"&gt;import&lt;/span&gt; osr, gdal&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;# Set file vars&lt;/span&gt;&lt;br /&gt;output_file = &lt;span style="color: rgb(51, 102, 255);"&gt;"out.jpg"&lt;/span&gt;&lt;br /&gt;output_file_root = os.path.splitext(output_file)[0]&lt;br /&gt;output_file_ext = os.path.splitext(output_file)[1]&lt;br /&gt;output_file_tmp = output_file_root + &lt;span style="color: rgb(51, 102, 255);"&gt;".tmp"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;# Create tmp gtif&lt;/span&gt;&lt;br /&gt;driver = gdal.GetDriverByName(&lt;span style="color: rgb(51, 102, 255);"&gt;"GTiff"&lt;/span&gt;)&lt;br /&gt;dst_ds = driver.Create(output_file_tmp, 512, 512, 1, gdal.GDT_Byte )&lt;br /&gt;raster = numpy.zeros( (512, 512) )&lt;br /&gt;dst_ds.GetRasterBand(1).WriteArray(raster)&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;# Create jpeg or rename tmp file&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;if&lt;/span&gt; (cmp(output_file_ext.lower(),&lt;span style="color: rgb(51, 102, 255);"&gt;"jpg"&lt;/span&gt; ) == 0 or cmp(output_file_ext.lower(),&lt;span style="color: rgb(51, 102, 255);"&gt;"jpeg"&lt;/span&gt;) == 0):&lt;br /&gt; jpg_driver = gdal.GetDriverByName(&lt;span style="color: rgb(51, 102, 255);"&gt;"JPEG"&lt;/span&gt;)&lt;br /&gt; jpg_driver.CreateCopy( output_file, dst_ds, 0 )&lt;br /&gt; os.remove(output_file_tmp)&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;else&lt;/span&gt;:&lt;br /&gt; os.rename(output_file_tmp, output_file)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-599939216550472381?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/599939216550472381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=599939216550472381' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/599939216550472381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/599939216550472381'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/12/creating-jpgs-and-other-formats-with.html' title='Creating JPG&apos;s and other formats with Python and GDAL'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-5779932327605656126</id><published>2008-12-03T08:53:00.005+02:00</published><updated>2008-12-03T11:43:01.318+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GDAL'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Create a GeoTiff with Python and GDAL</title><content type='html'>It looks like the &lt;a href="http://www.gdal.org/gdal_tutorial.html"&gt;GDAL tutorial&lt;/a&gt; on creating GeoTiff's is slightly outdated (2008/05). I received this error with Python 2.5.2, GDAL 1.53 and NumPy 1.0.4:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;Traceback (most recent call last):&lt;br /&gt;File "test.py", line 9, in &amp;lt;module&amp;gt;&lt;br /&gt;dst_ds.GetRasterBand(1).WriteArray(raster)&lt;br /&gt;File "/usr/lib/python2.5/site-packages/gdal.py", line 796, in WriteArray&lt;br /&gt;&lt;br /&gt;File "usr/lib/python2.5/site-packages/osgeo/gdal_array.py", line 154, in BandWriteArray&lt;br /&gt;AttributeError: dtype&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;As far as I can tell this occurs because the matrix &lt;span style="font-family:courier new;"&gt;raster&lt;/span&gt; doesn't have the attribute (property) &lt;span style="font-family:courier new;"&gt;dtype&lt;/span&gt;. Something must have changed, but I managed to get it going by using the &lt;span style="font-family:courier new;"&gt;numpy&lt;/span&gt; lib rather than &lt;span style="font-family:courier new;"&gt;Numeric&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;The code that worked for me looks like this:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&lt;span style="font-weight: bold;"&gt;import&lt;/span&gt; numpy&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;from&lt;/span&gt; osgeo &lt;span style="font-weight: bold;"&gt;import&lt;/span&gt; osr, gdal&lt;br /&gt;format = &lt;span style="color: rgb(51, 102, 255);"&gt;"GTiff"&lt;/span&gt;&lt;br /&gt;driver = gdal.GetDriverByName( format )&lt;br /&gt;dst_ds = driver.Create(&lt;span style="color: rgb(51, 102, 255);"&gt;"out.tif"&lt;/span&gt;, 512, 512, 1, gdal.GDT_Byte )&lt;br /&gt;raster = numpy.zeros( (512, 512) )&lt;br /&gt;dst_ds.GetRasterBand(1).WriteArray(raster)&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;One can also explicitly state the matrix's data type by adding the dtype attribute:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;raster = numpy.zeros( (512, 512), dtype = numpy.uint8)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-5779932327605656126?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/5779932327605656126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=5779932327605656126' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/5779932327605656126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/5779932327605656126'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/12/create-geotiff-with-python-and-gdal.html' title='Create a GeoTiff with Python and GDAL'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-2514907983654698907</id><published>2008-11-18T13:00:00.002+02:00</published><updated>2008-11-18T13:27:25.704+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>PHP: move_uploaded_file, Permission denied</title><content type='html'>If you ever receive the &lt;span style="font-weight: bold;font-family:courier new;" &gt;failed to open stream: Permission denied&lt;/span&gt; error in Linux on the &lt;span style="font-family: courier new;"&gt;move_uploaded_file&lt;/span&gt; function, try changing the upload folder's permissions through the chmod command:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;chmod 0777 upload_dir&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-2514907983654698907?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/2514907983654698907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=2514907983654698907' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/2514907983654698907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/2514907983654698907'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/11/php-moveuploadedfile-permission-denied.html' title='PHP: move_uploaded_file, Permission denied'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-8089526505049904165</id><published>2008-11-17T09:46:00.007+02:00</published><updated>2008-12-17T13:28:35.434+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><title type='text'>Nesting floating DIV overflow problem</title><content type='html'>I had an issue with non-IE browsers where a floating div would oveflow its parent container.&lt;br /&gt;&lt;br /&gt;Here's an example:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&amp;lt;div id="Container" style="background-color: Blue; width: 400px; padding: 10px;"&amp;gt;&lt;br /&gt; &amp;lt;div id="Image" style="float: left;"&amp;gt;&lt;br /&gt;     &amp;lt;img src="http://www.google.com/images/logo.gif" /&amp;gt;&lt;br /&gt; &amp;lt;/div&amp;gt;&lt;br /&gt; Some text yada yada. Some more text yada dada.&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;One can solve this issue by simply adding a div that places a break after the floating div:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&amp;lt;div style="clear: both; font: 1px/1px sans-serif;"&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;So in the end, it should look something like this:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;&amp;lt;div id="Container" style="background-color: Blue; width: 400px; padding: 10px;"&amp;gt;&lt;br /&gt; &amp;lt;div id="Image" style="float: left;"&amp;gt;&lt;br /&gt;     &amp;lt;img src="http://www.google.com/images/logo.gif" /&amp;gt;&lt;br /&gt; &amp;lt;/div&amp;gt;&lt;br /&gt; Some text yada yada. Some more text yada dada.&lt;br /&gt; &amp;lt;div style="clear: both; font: 1px/1px sans-serif;"&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-8089526505049904165?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/8089526505049904165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=8089526505049904165' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/8089526505049904165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/8089526505049904165'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/11/floating-div-overflow-problem.html' title='Nesting floating DIV overflow problem'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-3379197395524113857</id><published>2008-10-28T15:13:00.003+02:00</published><updated>2008-10-28T15:15:46.594+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><title type='text'>PHP Web Application Root URL</title><content type='html'>I wrote this little function to return a PHP applicaiton's root url. It is very quick and dirty, but I thought I'd still share it:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;function get_app_root_url()&lt;br /&gt;{&lt;br /&gt;    $app_root_dir_name = getcwd();&lt;br /&gt;    $idx = strripos($app_root_dir_name, '/');&lt;br /&gt;    &lt;br /&gt;    if($idx &amp;gt;= 0)&lt;br /&gt;        $app_root_dir_name = substr($app_root_dir_name, $idx + 1);&lt;br /&gt;&lt;br /&gt;    $app_root_url = get_page_url();&lt;br /&gt;    &lt;br /&gt;    $idx = strpos($app_root_url, $app_root_dir_name);&lt;br /&gt;    &lt;br /&gt;    if($idx &amp;gt;= 0)&lt;br /&gt;        $app_root_url = substr($app_root_url, 0, $idx + strlen($app_root_dir_name));&lt;br /&gt;        &lt;br /&gt;    return $app_root_url;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Curtosy of http://www.webcheatsheet.com/PHP/get_current_page_url.php&lt;br /&gt;function get_page_url() &lt;br /&gt;{&lt;br /&gt;    $page_url = 'http';&lt;br /&gt;    &lt;br /&gt;    if ($_SERVER[&amp;quot;HTTPS&amp;quot;] == &amp;quot;on&amp;quot;) &lt;br /&gt;        $page_url .= &amp;quot;s&amp;quot;;&lt;br /&gt;    &lt;br /&gt;    $page_url .= &amp;quot;://&amp;quot;;&lt;br /&gt;    &lt;br /&gt;    if ($_SERVER[&amp;quot;SERVER_PORT&amp;quot;] != &amp;quot;80&amp;quot;) &lt;br /&gt;        $page_url .= $_SERVER[&amp;quot;SERVER_NAME&amp;quot;].&amp;quot;:&amp;quot;.$_SERVER[&amp;quot;SERVER_PORT&amp;quot;].$_SERVER[&amp;quot;REQUEST_URI&amp;quot;];&lt;br /&gt;    else &lt;br /&gt;        $page_url .= $_SERVER[&amp;quot;SERVER_NAME&amp;quot;].$_SERVER[&amp;quot;REQUEST_URI&amp;quot;];&lt;br /&gt;    &lt;br /&gt;    return $page_url;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-3379197395524113857?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/3379197395524113857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=3379197395524113857' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3379197395524113857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3379197395524113857'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/10/php-web-application-root-url.html' title='PHP Web Application Root URL'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-3167647413964580214</id><published>2008-10-24T14:12:00.003+02:00</published><updated>2008-10-24T14:41:00.095+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss Seam'/><title type='text'>So long Java!</title><content type='html'>I've been struggling on and off for over two weeks to get my development environment up and running for Java web apps. I went with the JBoss Seam framework, since it was supposedly lightweight; Eclipse because it had a lot of plugins and seamed to be the most popular free IDE; Tomcat, since its what our web server is running.&lt;br /&gt;&lt;br /&gt;In the end I had to ditch Eclipse because it has major issues with plugins cross versions. It's near impossible to get the right jar files and versions for all the Tomcat, Seam and Debugging plugins to play together. So I went with NetBeans, which seemed to be miles simpler to use, but with less functionality and a smaller community.&lt;br /&gt;&lt;br /&gt;Even with the simpler NetBeans it was still a mission to get everything working. Finally I was ready to start doing some real coding, but oh my, what a mess!! Perhaps I'm just an idiot, but Seam doesn't have any logical (/www/myproject/...) structure and there's hundreds of XML files all over the shop. Phew... I tried to follow a few tutorials, but I was unable to find a good one. There isn't a single one that just says 1. Here is all the crazy config files, 2. Here is the code, 3. This is how it it all is structured, 4. This is how you deploy... bla bla. Come on people! Keep it simple!&lt;br /&gt;&lt;br /&gt;After getting the examples going I read somewhere that I would need JBoss AS in order to run Enterprise Java Beans and it seemed like Seam used EJB for session management or something. Aaargh!!!! The Seam website explicitly states that you can run Seam on Tomcat, but fails to mention that you wouldn't have all the functionalities. What a load of rubbish!! Our web server only runs Apache 2 and Tomcat, so this is a bit of an issue.&lt;br /&gt;&lt;br /&gt;I could see that ease of web development in Java is still VERY mush inferior to the likes of Asp.Net or RoR. It's almost impossible for a noob to create a simple website that queries a db with an IDE that supports debugging.&lt;br /&gt;&lt;br /&gt;I had a quick look at PHP and it took me two days (which is also far too long for my liking) to get a full dev environment setup with Apache 2, MySql, Eclipse, PDT and Zend. After that my first application was up and running within minutes. PHP is logical, very well documented and has a huge dev community. It seems brilliant!&lt;br /&gt;&lt;br /&gt;So that was the final blow to the head for Java. I can't understand why Java is so popular in big enterprises. Well at least for the web side of things. It's like using C++ to run a web app. It simply isn't geared for that purpose. Or perhaps I'm just missing something.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-3167647413964580214?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/3167647413964580214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=3167647413964580214' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3167647413964580214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3167647413964580214'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/10/so-long-java.html' title='So long Java!'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-4775962344266174931</id><published>2008-10-16T11:04:00.003+02:00</published><updated>2008-10-16T11:40:32.185+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NetBeans'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss Seam'/><title type='text'>Facelets Support in NetBeans 6.1</title><content type='html'>After getting Seam working by manually deploying a .war, I moved onto the next step of integrating Seam into an IDE. Eclipse is a clunky heap of rubbish. I'd say its problem is that it is too flexible. There's a million ways to do one simple thing, but no single way to do one simple thing properly.&lt;br /&gt;&lt;br /&gt;After serveral hours wasted on Eclipse, I moved over to NetBeans (6.1). There's a great little tutorial on getting your NetBeans environment setup over at &lt;a href="http://edemmorny.wordpress.com/2007/12/12/getting-netbeans-60-ready-for-seam-development"&gt;Edem Morny's tech blog&lt;/a&gt;. Everything went smoothely, up to the part where one installs Facelets Support, where I get this nasty little message:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;Missing required modules for Plugin Facelets Support:&lt;br /&gt;JSP Parser [module org.netbeans.modules.web.jspparser/3 = 200805300101]&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;This can be avoided by not updating NetBeans. Fortunately there is a bit of a &lt;a href="http://blogs.sun.com/poting/entry/build_and_install_facelets_support"&gt;hack&lt;/a&gt; to get around this issue:&lt;br /&gt;1. Go to your &lt;span style="font-family:courier new;"&gt;netbeans-6.1/enterprise5/modules&lt;/span&gt; directory&lt;br /&gt;2. Unjar the &lt;span style="font-family:courier new;"&gt;org-netbeans-modules-web-jspparser.jar&lt;/span&gt; file&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;jar xf org-netbeans-modules-web-jspparser.jar&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;3. Create a backup of the orignal &lt;span style="font-family:courier new;"&gt;org-netbeans-modules-web-jspparser.jar&lt;/span&gt; just in case.&lt;br /&gt;4. Edit the &lt;span style="font-family:courier new;"&gt;META-INF/MANIFEST.MF&lt;/span&gt; file.&lt;br /&gt;5. Change the &lt;span style="font-family:courier new;"&gt;OpenIDE-Module-Implementation-Version:&lt;/span&gt; to match the verion the facelet is complaining about. In this instance &lt;span style="font-family:courier new;"&gt;200805300101&lt;/span&gt;.&lt;br /&gt;6. Save the file and jar the whole thing again (by explicitly adding the modified manifest file)&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;jar cfm org-netbeans-modules-web-jspparser.jar META-INF/MANIFEST.MF org&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-4775962344266174931?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/4775962344266174931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=4775962344266174931' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/4775962344266174931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/4775962344266174931'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/10/facelets-support-in-netbeans-61.html' title='Facelets Support in NetBeans 6.1'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-1410506505857876185</id><published>2008-09-25T17:14:00.004+02:00</published><updated>2008-11-30T18:41:31.478+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gentoo'/><title type='text'>Manaully clean your Gentoo world file</title><content type='html'>I've been in a love-hate relationship with Gentoo for over 3 years now. Luckily there's a lot more love than hate these days. Well 3 years is a long time and it's time to clean this bad boy up...&lt;br /&gt;&lt;br /&gt;There's a lot of articles on-line on how to remove cruft and deprecated packages etc. But I struggled to find one that will help you clean up your world file. Being a bit of a quick fix kind of guy, I hammered this little python script together, which will loop through your world file and find the package description for each entry. The script isn't perfect, but it gets the job done for the most part. I still have to manually edit the world file, but at least now I get a description of each entry as I step through the file.&lt;br /&gt;&lt;br /&gt;Here's what you need to do:&lt;br /&gt;&lt;br /&gt;Log in as root and fire up a text editor:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;nano print_world_file_details.py&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And paste the following:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;import os&lt;br /&gt;import string&lt;br /&gt;import sys&lt;br /&gt;&lt;br /&gt;if __name__ == '__main__':&lt;br /&gt; f_in = open("/var/lib/portage/world")&lt;br /&gt;&lt;br /&gt; lines = f_in.readlines()&lt;br /&gt;&lt;br /&gt; for line in lines:&lt;br /&gt;     index = line.find("/")&lt;br /&gt;     length = len(line) - 1&lt;br /&gt;  &lt;br /&gt;     if(index &amp;gt; 0):&lt;br /&gt;         print ""&lt;br /&gt;         print "--------------------------------------"&lt;br /&gt;         print line[index+1:length]&lt;br /&gt;         print ""&lt;br /&gt;         cmd = "emerge -s " + line[index+1:length] + " | grep -A7 '" + line[:length] + "' "&lt;br /&gt;         os.system(cmd)&lt;br /&gt;      &lt;br /&gt;     sys.stdin.readline()&lt;br /&gt;&lt;br /&gt; f_in.close()&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Exit and save (Ctrl+x, Enter). Run the script:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;python print_world_file_details.py&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Just hit enter after each lookup and manually remove the entry from your world file. Since the script uses grep to filter the ermerge -s results you might get multiple descriptions for some packages. Like &lt;span style="font-family:courier new;"&gt;dev-java/java-config&lt;/span&gt; will list &lt;span style="font-family:courier new;"&gt;dev-java/java-config-wrapper&lt;/span&gt; too. A slight nuisance, but who cares?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Note:&lt;/span&gt; &lt;span style="font-style: italic;"&gt;It is not considered safe to update your world file manually, so don't mess around if you don't know what you're doing. Please make a backup before editing.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-1410506505857876185?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/1410506505857876185/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=1410506505857876185' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1410506505857876185'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1410506505857876185'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/09/manaully-clean-your-gentoo-world-file.html' title='Manaully clean your Gentoo world file'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-8090851136822213083</id><published>2008-09-23T11:21:00.009+02:00</published><updated>2008-09-25T13:16:55.180+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Tomcat'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss Seam'/><title type='text'>Get JBoss Seam going on Gentoo Linux with Tomcat</title><content type='html'>I've been given a web app to do for an open source driven organization. I like the ideology behind open source, but I must say that the complexities involved in just getting started, must be the single biggest hurdle in the adoption of OSS.&lt;br /&gt;&lt;br /&gt;Most Java and Linux fanboys might rupture a vain for me saying this, but to get any sort of Java web app going is massive pain in butt. To get Asp.Net going, one merely install visual studio and off you go. You don't even need IIS these days. To get a Java web app (dev environment) going you have to install a web server, an application server, a java framework, an IDE, IDE plugins to support the java framework and perhaps additional frameworks / tools which will allow you to work in a "code-behind" fashion. Then you have to decide on a  web frameworks and the choices are endless:  Spring MVC, Struts, Seam, JSF, Tapestry, Wicket, Hibernate, Stripes, etc. You can Google until you're blue in the face, but every single framework claims to be the best and all have their own following of groupies. To be honest, it is a big geeky mess!&lt;br /&gt;&lt;br /&gt;Unfortunately I don't have the luxury of cleaning up this steaming pile of &lt;span style="font-style: italic;"&gt;rubbish&lt;/span&gt;, so I'll have to get my hands dirty and figure out what the best solution is through trial and error (very scientific).&lt;br /&gt;&lt;br /&gt;My client already has Tomcat running, so luckily I don't have to bother about figuring out which application server is the best. A further requirement is that the web framework should be quite lightweight. It seems as if JBoss' Seam framework isn't too much of a brute, so I'll go with that and probably get burned half-way in.&lt;br /&gt;&lt;br /&gt;Even though I detest overcomplicated systems, I've grown quite fond of Gentoo. Once you've mastered this beast, it is quite pleasant to work with. (Perhaps I'll have the same feelings towards Java web apps once I've finished here, but for now it's not looking good.) So I'll run through the steps of getting Seam going on Gentoo.&lt;br /&gt;&lt;br /&gt;To start off with, we'll need JDK (or JRE). Login as root, &lt;span style="font-family:courier new;"&gt;emerge sun-jdk&lt;/span&gt; (in my case version 1.6.0.07) and logout. After that we need to get Tomcat.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Note: &lt;/span&gt;&lt;span style="font-style: italic;"&gt;You can try to get Tomcat going through portage, but you'll end up pulling your hair out, because Seam uses the naming-factory-dbcp.jar, which is not included in the build for some bizarre reason.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;cd ~&lt;br /&gt;mkdir applications&lt;br /&gt;cd applications&lt;br /&gt;wget http://apache.mirrors.hoobly.com/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz&lt;br /&gt;tar -xf apache-tomcat-6.0.18.tar.gz&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Now let's set the environmental variables needed:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;nano ~/.bashrc&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;and add these lines:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;export JRE_HOME=/opt/sun-jdk-1.6.0.07&lt;br /&gt;export TOMCAT_HOME=/home/yourname/applications/apache-tomcat-6.0.18&lt;br /&gt;export CATALINA_HOME=$TOMCAT_HOME&lt;br /&gt;export CATALINA_BASE=$TOMCAT_HOME&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Note: &lt;/span&gt;&lt;span style="font-style: italic;"&gt;You might want to emerge the tomcat-native package, since it will add the Apache Tomcat Native library. I'm not sure if Seam needs this, but I noticed Tomcat having a bit of a fit when it couldn't find it. The message in the $TOMCAT_HOME/logs/catalina.out was "INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One can also configure an admin user, but this is not necessarily required. Edit the tomcat-users.xml file like this:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;nano $TOMCAT_HOME/conf/tomcat-users.xml&lt;br /&gt;&lt;br /&gt;&amp;lt;tomcat-users&amp;gt;&lt;br /&gt;&amp;lt;role rolename="manager"&amp;gt;&lt;br /&gt;&amp;lt;user username="root" password="irock" roles="manager"&amp;gt;&lt;br /&gt;&amp;lt;/user&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;One can now start Tomcat:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;cd $TOMCAT_HOME/bin&lt;br /&gt;./startup.sh&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;You should now be able to access Tomcat on &lt;span style="font-family: courier new;"&gt;http://localhost:8080&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Tomcat will display &lt;span style="font-family: courier new;"&gt;$TOMCAT_HOME/webapps/ROOT/index.html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So we can now follow Seam's Tomcat guide, which I had to modify a bit:&lt;br /&gt;&lt;br /&gt;1. Go into the &lt;span style="font-family: courier new;"&gt;jboss-seam/examples/jpa&lt;/span&gt; directory&lt;br /&gt;2. Copy the lib&lt;span style="font-family: courier new;"&gt;/hsqldb.jar&lt;/span&gt; into &lt;span style="font-family: courier new;"&gt;$TOMCAT_HOME/lib&lt;/span&gt;&lt;br /&gt;3. Run &lt;span style="font-family: courier new;"&gt;ant tomcat6&lt;/span&gt; to build the application&lt;br /&gt;4. Stop Tomcat &lt;span style="font-family: courier new;"&gt;$TOMCAT_HOME/&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;bin/shutdown.sh&lt;/span&gt;&lt;br /&gt;5. Remove previous any exiting deployments:  &lt;span style="font-family: courier new;"&gt;rm -r $TOMCAT_HOME/webapps/jboss-seam-jpa&lt;/span&gt;&lt;br /&gt;6. Copy war file: &lt;span style="font-family: courier new;"&gt;cp dist-tomcat6/jboss-seam-jpa.war $TOMCAT_HOME/webapps&lt;/span&gt;&lt;br /&gt;7. Start Tomcat &lt;span style="font-family: courier new;"&gt;$TOMCAT_HOME/&lt;/span&gt;&lt;span style="font-family: courier new;"&gt;bin/starup.sh&lt;/span&gt;&lt;br /&gt;8. Access the app at &lt;span style="font-family: courier new;"&gt;http://localhost:8080/jboss-seam-jpa&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And Bob's you're uncle!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-8090851136822213083?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/8090851136822213083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=8090851136822213083' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/8090851136822213083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/8090851136822213083'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/09/get-jboss-seam-going-on-gentoo-linux.html' title='Get JBoss Seam going on Gentoo Linux with Tomcat'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-3381293618710151080</id><published>2008-09-17T19:34:00.006+02:00</published><updated>2008-09-17T20:06:21.079+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Linq'/><title type='text'>Linq Context.Add Renamded To</title><content type='html'>A number of Linq to Sql tutorials online are based on intial "Orcas" (now 3.5) release of the .Net Framework. A number of namechanges were made and I picked one up whilst learning Linq. Here's the error I received:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;'System.Data.Linq.Table&amp;lt;Namespace&amp;gt;' does not contain a definition for 'Add' and no extension method&lt;br /&gt;'Add' accepting a first argument of type 'System.Data.Linq.Table&amp;lt;Namespace&amp;gt;' could be found&lt;br /&gt;(are you missing a using directive or an assembly reference?)&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The &lt;span style="font-family:courier new;"&gt;&lt;span style="font-style: italic;"&gt;context.&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Add&lt;/span&gt;&lt;/span&gt; methods was changed to &lt;span style="font-family:courier new;"&gt;&lt;span style="font-style: italic;"&gt;context.&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;InsertOnUpdate&lt;/span&gt;&lt;/span&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-3381293618710151080?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/3381293618710151080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=3381293618710151080' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3381293618710151080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3381293618710151080'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/09/linq-contextadd-renamded-to.html' title='Linq Context.Add Renamded To'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-3392788690091859073</id><published>2008-09-10T17:17:00.011+02:00</published><updated>2008-09-14T14:55:56.210+02:00</updated><title type='text'>Apply themes to Images in Asp.Net</title><content type='html'>&lt;div&gt;The Asp.Net Themes approach is somewhat lacking when it comes to images. It is easy enough to switch between CSS and Skin files, but switching between images aren't as trivial. Luckily there is a relatively simple way to do this.&lt;br /&gt;&lt;br /&gt;My thinking was to set the image folder dynamically. First, we'll have to figure out what our image path is. Say one use the following structure for your image folders:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;App_Themes/Theme1/Images&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;App_Themes/Theme2/Images&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The following &lt;span style="font-family:courier new;"&gt;ImagePath&lt;/span&gt; accessor can be used to determine the current theme's image path (I would recommend you to put this in a Base class for this to be accessible to all pages/controls):&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-size: 12px; width: 100%; color: rgb(0, 0, 0); line-height: 14px; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; background-color: rgb(238, 238, 238);"&gt;&lt;code&gt;public string ImagePath&lt;br /&gt;{&lt;br /&gt;  get&lt;br /&gt;  {&lt;br /&gt;      return string.Format("{0}://{1}{2}/App_Themes/{3}", Request.Url.Scheme, Request.Url.Authority, Request.ApplicationPath, Page.Theme);&lt;br /&gt;  }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now that we know where the currently selected theme's images are, we need to set the path for the controls in the aspx page. This is easy enough if you using normal HTML controls as follows:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-size: 12px; width: 100%; color: rgb(0, 0, 0); line-height: 14px; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; background-color: rgb(238, 238, 238);"&gt;&lt;code&gt;&amp;#60;img src='&amp;#60;&amp;#37; Response.Write(ImagePath); &amp;#37;&amp;#62;/Image.jpg' /&amp;#62;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;But this approach does not work for server controls. If you use the following line, you'll receive an error:&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-size: 12px; width: 100%; color: rgb(0, 0, 0); line-height: 14px; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; background-color: rgb(238, 238, 238);"&gt;&lt;code&gt;&lt;asp:image imageurl=""&gt;&amp;#60;asp:Image ImageUrl="&amp;#60;&amp;#37; Response.Write(ImagePath); &amp;#37;&amp;#62;/Image.jpg" runat="server" /&amp;#62;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Error:&lt;/span&gt;&lt;br /&gt;Server tags cannot contain &amp;#60;&amp;#37; ... &amp;#37;&amp;#62; constructs.&lt;br /&gt;&lt;/asp:image&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;One could set the &lt;span style="font-family:courier new;"&gt;asp:image&lt;/span&gt;'s &lt;span style="font-family:courier new;"&gt;ImageUrl&lt;/span&gt; in the codebehind, but I find it to be a bit clunky. In order to use the &lt;span style="font-family:courier new;"&gt;ImagePath&lt;/span&gt; in the aspx file, one can use an approach by &lt;a href="http://infinitiesloop.blogspot.com/2006/04/codeexpressionbuilder.html"&gt;Dave Reed&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Create a class in the &lt;span style="font-family:courier new;"&gt;App_Code&lt;/span&gt; called &lt;span style="font-family:courier new;"&gt;CodeExpressionBuilder&lt;/span&gt;:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-size: 12px; width: 100%; color: rgb(0, 0, 0); line-height: 14px; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; background-color: rgb(238, 238, 238);"&gt;&lt;code&gt;using System;&lt;br /&gt;using System.CodeDom;&lt;br /&gt;using System.Web.Compilation;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;&lt;br /&gt;[ExpressionPrefix("Code")]&lt;br /&gt;class CodeExpressionBuilder : ExpressionBuilder&lt;br /&gt;{&lt;br /&gt;  public override object ParseExpression(string expression, Type propertyType, ExpressionBuilderContext context)&lt;br /&gt;&lt;/code&gt;&lt;code&gt;    &lt;/code&gt;&lt;code&gt;{&lt;br /&gt;  &lt;/code&gt;&lt;code&gt;    &lt;/code&gt;&lt;code&gt;return expression;&lt;br /&gt;&lt;/code&gt;&lt;code&gt;    &lt;/code&gt;&lt;code&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;code&gt;    &lt;/code&gt;&lt;code&gt;public override CodeExpression GetCodeExpression(BoundPropertyEntry entry, object parsedData, ExpressionBuilderContext context)&lt;br /&gt;&lt;/code&gt;&lt;code&gt;    &lt;/code&gt;&lt;code&gt;{&lt;br /&gt;  &lt;/code&gt;&lt;code&gt;    &lt;/code&gt;&lt;code&gt;return new CodeSnippetExpression(parsedData.ToString());&lt;br /&gt;&lt;/code&gt;&lt;code&gt;    &lt;/code&gt;&lt;code&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;One can now set the &lt;span style="font-family:courier new;"&gt;ImageUrl&lt;/span&gt; in the aspx file as follows:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-size: 12px; width: 100%; color: rgb(0, 0, 0); line-height: 14px; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; background-color: rgb(238, 238, 238);"&gt;&lt;code&gt;&amp;#60;asp:Image ImageUrl='&amp;#60;&amp;#37;$ Code: ImagePath + "/Image.jpg" &amp;#37;&amp;#62;' runat="server" /&amp;#62;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-3392788690091859073?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/3392788690091859073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=3392788690091859073' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3392788690091859073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3392788690091859073'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/09/apply-themes-to-images-in-aspnet.html' title='Apply themes to Images in Asp.Net'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-1348173082254316175</id><published>2008-08-20T14:53:00.003+02:00</published><updated>2008-08-20T15:01:46.700+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>AJAX ProgressUpdate issue</title><content type='html'>I had an issue with the &lt;span style="font-family:courier new;"&gt;UpdatePanel&lt;/span&gt; and &lt;span style="font-family: courier new;"&gt;ProgressUpdate&lt;/span&gt; AJAX extensions controls in ASP.NET.&lt;br /&gt;&lt;br /&gt;The following error occurred in the Javascript:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;if (this._dynamicLayout) this.get_element().style.display = 'block';&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;I solved the problem by moving my &lt;span style="font-family:courier new;"&gt;ProgressUpdate&lt;/span&gt; control out of the &lt;span style="font-family:courier new;"&gt;UpdatePanel&lt;/span&gt;'s &lt;contenttemplate&gt; tags. I guess I was looking for trouble when I did that.&lt;br /&gt;&lt;br /&gt;Having the &lt;span style="font-family:courier new;"&gt;ProgressUpdate&lt;/span&gt; within the &lt;span style="font-family:courier new;"&gt;UpdatePanel&lt;/span&gt; work in certain instances, but I also had another &lt;span style="font-family:courier new;"&gt;UpdatePanel &lt;/span&gt;in the same &lt;span style="font-family:courier new;"&gt;UserControl&lt;/span&gt;, so it got a bit hairy.&lt;br /&gt;&lt;br /&gt;I'd like to verify this, but as always, the deadline looms.&lt;br /&gt;&lt;/contenttemplate&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-1348173082254316175?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/1348173082254316175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=1348173082254316175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1348173082254316175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/1348173082254316175'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/08/ajax-progressupdate-issue.html' title='AJAX ProgressUpdate issue'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-996767886031154804</id><published>2008-08-13T21:50:00.005+02:00</published><updated>2008-09-17T20:07:24.178+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Constraint cannot be special class 'object'</title><content type='html'>I was busy creating a generic method to convert a &lt;span style="font-family:courier new;"&gt;List&lt;/span&gt; to a &lt;span style="font-family:courier new;"&gt;DataTable&lt;/span&gt; when I received the error:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;Constraint cannot be special class 'object'&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;on this statement:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;public DataTable ListToDataTable&lt;t&gt;(IList&lt;t&gt; list) where T : Object&lt;br /&gt;&lt;/t&gt;&lt;/t&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Blegh... why would this be? Anyhow, I did a workaround by changing the statement to the following:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;public DataTable ListToDataTable&lt;t&gt;(T list) where T : IList&lt;object&gt;&lt;br /&gt;&lt;/object&gt;&lt;/t&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;A bit annoying, since now one has to send a &lt;span style="font-family:courier new;"&gt;List&lt;/span&gt;&lt;object&gt; and can't simply pass a &lt;span style="font-family:courier new;"&gt;List&lt;myclass&gt;&lt;myclass&gt;&lt;/myclass&gt;&lt;/myclass&gt;&lt;/span&gt;&lt;myclass&gt;.&lt;br /&gt;&lt;br /&gt;Another workaround is to use a blank interface, with the statement as:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;public DataTable ListToDataTable&lt;t&gt;(IList&lt;t&gt; list) where T : IBlank&lt;br /&gt;&lt;/t&gt;&lt;/t&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now one can send &lt;span style="font-family:courier new;"&gt;List&lt;/span&gt;&lt;myclass&gt; if &lt;span style="font-family:courier new;"&gt;MyClass&lt;/span&gt; 'implements' the &lt;span style="font-family:courier new;"&gt;IBlank&lt;/span&gt; interface.&lt;br /&gt;&lt;br /&gt;I'm not really too happy with any of these workarounds. I see no reason why the &lt;span style="font-family:courier new;"&gt;Object&lt;/span&gt; class is "too special" to be used as a generic placeholder.&lt;br /&gt;&lt;br /&gt;Oh, and merely for interest sake. Here is the generic &lt;span style="font-family:courier new;"&gt;List&lt;/span&gt; to &lt;span style="font-family:courier new;"&gt;DataTable&lt;/span&gt; converter method:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;public DataTable ListToDataTable&lt;t&gt;(List&lt;t&gt; list) where T : IBlank&lt;br /&gt;{&lt;br /&gt;DataTable dataTable = new DataTable();&lt;br /&gt;&lt;br /&gt;Type type = typeof(T);&lt;br /&gt;PropertyInfo[] properties = type.GetProperties();&lt;br /&gt;&lt;br /&gt;// Create the columns&lt;br /&gt;foreach (PropertyInfo property in properties)&lt;br /&gt;    dataTable.Columns.Add(property.Name, property.PropertyType);&lt;br /&gt;&lt;br /&gt;// Populate the rows&lt;br /&gt;foreach (T obj in list)&lt;br /&gt;{&lt;br /&gt;    DataRow newRow = dataTable.NewRow();&lt;br /&gt;&lt;br /&gt;    foreach (PropertyInfo property in properties)&lt;br /&gt;        newRow[property.Name] = property.GetValue(obj, null);&lt;br /&gt;&lt;br /&gt;    dataTable.Rows.Add(newRow);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return dataTable;&lt;br /&gt;}&lt;br /&gt;&lt;/t&gt;&lt;/t&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/myclass&gt;&lt;/myclass&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-996767886031154804?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/996767886031154804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=996767886031154804' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/996767886031154804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/996767886031154804'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/08/constraint-cannot-be-special-class.html' title='Constraint cannot be special class &apos;object&apos;'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-4181158287825793595</id><published>2008-07-30T15:40:00.003+02:00</published><updated>2008-07-30T15:49:54.229+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Python: Multi-dimensional dynamic arrays</title><content type='html'>Another very poorly documented topic is how to create dynamic arrays of type &lt;span style="font-family:courier new;"&gt;array&lt;/span&gt;. Every second website will show you how to create static 2D arrays, which is pretty much useless for 90% of the practical applications out there.&lt;br /&gt;&lt;br /&gt;I 'solved' it to a degree by creating a list of array items, but this is still not ideal. I would like to use a pure multi-deminsional array of type &lt;span style="font-family:courier new;"&gt;array&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Here's how I did it:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;multi_arr = []&lt;br /&gt;&lt;br /&gt;for i in range(some_range):&lt;br /&gt;   arr = array('f') # array of type float&lt;br /&gt;  &lt;br /&gt;   # ... populate arr ...&lt;br /&gt;&lt;br /&gt;   multi_arr.append(arr)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-4181158287825793595?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/4181158287825793595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=4181158287825793595' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/4181158287825793595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/4181158287825793595'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/07/python-multi-dimensional-dynamic-arrays.html' title='Python: Multi-dimensional dynamic arrays'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-8705525238602527617</id><published>2008-07-30T09:48:00.003+02:00</published><updated>2008-07-30T10:04:47.245+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Julian Day in Python</title><content type='html'>I found very little documentation on obtaining the Juilian day with the time module in Python. So this is how it's done:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;import time&lt;br /&gt;&lt;br /&gt;print time.strftime("%j")&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;As easy as that!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-8705525238602527617?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/8705525238602527617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=8705525238602527617' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/8705525238602527617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/8705525238602527617'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/07/julian-day-in-python.html' title='Julian Day in Python'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-4357925731947130141</id><published>2008-07-28T16:21:00.007+02:00</published><updated>2008-09-17T19:31:48.069+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gentoo'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><title type='text'>Linux: shutdown: you must be root to do that!</title><content type='html'>In order to use the console commands shutdown, poweroff, halt or reboot, one has to be a super user. One might see messages such as: &lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;shutdown: you must be root to do that!&lt;br /&gt;poweroff: must be superuser.&lt;br /&gt;reboot: must be superuser.&lt;br /&gt;halt: must be superuser.&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;In some cases the user can simply be added to the &lt;span style="font-style: italic;"&gt;wheel&lt;/span&gt; group. This should give the user enough privileges to shut the machine down. A more reliable approach is to make use of Sudo, which was specifically designed to allow ordinary users to execute certain super-user-only commands.&lt;br /&gt;&lt;br /&gt;The following section will explain how to setup sudo to allow other users to the machine down through the command line under the Gentoo distro.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Install Sudo&lt;/span&gt;&lt;br /&gt;Login as su:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;su -&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Emerge Sudo:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;emerge app-admin/sudo&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Configure Sudo&lt;/span&gt;&lt;br /&gt;Run visudo:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;visudo&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Enter the following:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;# Runas alias specification&lt;br /&gt;YourUserName  ALL=(root) NOPASSWD: /sbin/reboot&lt;br /&gt;YourUserName  ALL=(root) NOPASSWD: /sbin/halt&lt;br /&gt;YourUserName  ALL=(root) NOPASSWD: /sbin/poweroff&lt;br /&gt;YourUserName  ALL=(root) NOPASSWD: /sbin/shutdown&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Replace &lt;span style="font-family:courier new;"&gt;YourUserName&lt;/span&gt; with the user name which requires shutdown privileges.&lt;br /&gt;&lt;br /&gt;See &lt;a href="http://www.spencerstirling.com/computergeek/shutdown.html"&gt;this guide&lt;/a&gt; on how to create  a group which allows all its users to shut the machine down.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-4357925731947130141?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/4357925731947130141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=4357925731947130141' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/4357925731947130141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/4357925731947130141'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/07/linux-shutdown-you-must-be-root-to-do.html' title='Linux: shutdown: you must be root to do that!'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-367394223450924519</id><published>2008-07-13T14:02:00.002+02:00</published><updated>2008-07-13T14:22:32.087+02:00</updated><title type='text'>Named pipes issue: WaitForConnection hangs around indefinitely</title><content type='html'>I recently created an IPC client and server based on the newish &lt;span style="font-family: courier new;"&gt;NamedPipeServerStream &lt;/span&gt;and &lt;span style="font-family: courier new;"&gt;NamedPipeClientStream &lt;/span&gt;classes in .NET 3.x.&lt;br /&gt;&lt;br /&gt;It worked great, but when trying to stop the server,  the main thread would hang aound waiting for the &lt;span style="font-family: courier new;"&gt;WaitForConnection()&lt;/span&gt; statement to return. I tried to kill the thread in a number of ways, but to no avail.&lt;br /&gt;&lt;br /&gt;In the end, I created an easy workaround by doing a "dummy" client connection to the server. This will cause &lt;span style="font-family: courier new;"&gt;WaitForConnection()&lt;/span&gt; method to continue and the thread can then be stopped gracefully.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-367394223450924519?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/367394223450924519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=367394223450924519' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/367394223450924519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/367394223450924519'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/07/named-pipes-issue-waitforconnection.html' title='Named pipes issue: WaitForConnection hangs around indefinitely'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-2342957621518403521</id><published>2008-07-11T21:05:00.003+02:00</published><updated>2008-07-11T21:31:20.828+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='IPC'/><title type='text'>Named pipes issue: System.UnauthorizedAccessException: Access to the path is denied.</title><content type='html'>After yesterday's &lt;a href="http://adventuresindevelopment.blogspot.com/2008/07/net-ipc-through-named-pipe-servers.html"&gt;triumphant discovery&lt;/a&gt; I had a nightmare of a day trying to figure out why my client couldn't connect to the server. Time and time again, the following exception was raised:&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;System.UnauthorizedAccessException: Access to the path is denied.&lt;br /&gt;at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)&lt;br /&gt;at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout)&lt;br /&gt;at System.IO.Pipes.NamedPipeClientStream.Connect()&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;And in the debug output window:&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;A first chance exception of type 'System.UnauthorizedAccessException' occurred in System.Core.dll&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;My best googling skills couldn't find an answer for this one and I ended up trying to change the permission for the &lt;span style="font-family:courier new;"&gt;NamedPipeServerStream &lt;/span&gt;and venturing down the wrong path by changing the &lt;span style="font-family:courier new;"&gt;PipeAuditRule&lt;/span&gt; and &lt;span style="font-family:courier new;"&gt;PipeAccessRule&lt;/span&gt; settings.&lt;br /&gt;&lt;br /&gt;In the end turned out my &lt;span style="font-family:courier new;"&gt;PipeDirection &lt;/span&gt;had to be set to &lt;span style="font-family:courier new;"&gt;InOut&lt;/span&gt;, even though I was only streaming information from the Server, and not receiving information.&lt;br /&gt;&lt;br /&gt;Here's the winning line of code:&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;NamedPipeServerStream Pipe = new NamedPipeServerStream(PipeName, &lt;span style="font-weight: bold;"&gt;PipeDirection.InOut&lt;/span&gt;, 1,&lt;br /&gt;   PipeTransmissionMode.Message, PipeOptions.None);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-2342957621518403521?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/2342957621518403521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=2342957621518403521' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/2342957621518403521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/2342957621518403521'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/07/named-pipes-issue-systemunauthorizedacc.html' title='Named pipes issue: System.UnauthorizedAccessException: Access to the path is denied.'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-8306481089369925394</id><published>2008-07-10T13:15:00.004+02:00</published><updated>2008-07-10T13:30:54.367+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='IPC'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><title type='text'>.NET IPC through Named Pipe Servers</title><content type='html'>I've been struggling to get my own IPC server and client going. The work was based on &lt;a href="http://www.codeproject.com/KB/threads/dotnetnamedpipespart1.aspx"&gt;this great post&lt;/a&gt; on The Code Project. Even though the article was very useful, I found the code to be a bit clunky.&lt;br /&gt;&lt;br /&gt;I restructured a lot of it into very neat client / server structure. During debugging, I stumbled onto &lt;a href="http://blogs.msdn.com/bclteam/archive/2006/12/07/introducing-pipes-justin-van-patten.aspx"&gt;this "new" addition&lt;/a&gt; in the .Net 3.5 Framework. Named pipes are neatly integrated, so no need for my client and server anymore. Doh!&lt;br /&gt;&lt;br /&gt;Oh well, I only lost a day's worth of coding, and at least I can rest assured that this part of my project will be quite stable.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-8306481089369925394?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/8306481089369925394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=8306481089369925394' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/8306481089369925394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/8306481089369925394'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/07/net-ipc-through-named-pipe-servers.html' title='.NET IPC through Named Pipe Servers'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-199826722408627224</id><published>2008-07-08T14:40:00.003+02:00</published><updated>2008-09-17T19:26:28.082+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Service'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Windows Service uninstall failed</title><content type='html'>Whilst developing a Windows Service, an exception occurred. I opted not to debug and when I exited the VS instance the service naturally terminated.&lt;br /&gt;&lt;br /&gt;When I got back into the Services MMC, my service was marked as &lt;span style="font-weight: bold;"&gt;Disabled&lt;/span&gt;. When trying to uninstall the service through&lt;span style="font-family:courier new;"&gt; InstallUtil myservice.exe /u&lt;/span&gt;, the following exception was raised:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;An exception occurred during the Install phase.&lt;br /&gt;System.ComponentModel.Win32Exception: The specified service has been marked for deletion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This problem is easy enough to solve. Just quit the MMC and uninstall the service again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-199826722408627224?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/199826722408627224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=199826722408627224' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/199826722408627224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/199826722408627224'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/07/windows-service-uninstall-failed.html' title='Windows Service uninstall failed'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-3135717225628177595</id><published>2008-07-08T12:26:00.004+02:00</published><updated>2008-07-08T13:59:35.283+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Visual Studio editor annoyances</title><content type='html'>I have the nasty habit of copying code and then accidentally hitting Crtl+C again without selecting any text. VS clears your current clipboard item and replaces it with the line you're on.&lt;br /&gt;&lt;br /&gt;I find this quite annoying, but luckily there's a way to get the previous items in the clipboard back. Just keep hitting Ctrl+Shitf+V to cycle through all the previous items.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-3135717225628177595?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/3135717225628177595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=3135717225628177595' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3135717225628177595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/3135717225628177595'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/07/visual-studio-editor-annoyances.html' title='Visual Studio editor annoyances'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-2986396343388124666</id><published>2008-07-03T14:00:00.008+02:00</published><updated>2008-07-03T15:04:55.876+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Threading'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>UI updates and threading</title><content type='html'>I've been working on a small Windows Forms app which has a thread running in the background. This read needs to send info back to the UI during certain intervals. It's a pretty easy problem to solve and there are numerous sources on the web explaining this.&lt;br /&gt;&lt;br /&gt;I did come across weird behaviour when my app went into a deadlock. It hanged at the &lt;span style="font-family:courier new;"&gt;Invoke&lt;/span&gt; method in the following code:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eeeeee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;// This updates some control safely&lt;br /&gt;protected void UpdateSomeControl()&lt;br /&gt;{&lt;br /&gt;    // Check if an Invoke is required&lt;br /&gt;    if (InvokeRequired)&lt;br /&gt;    {&lt;br /&gt;        // Update the UI through delegation&lt;br /&gt;        Invoke((ThreadStart)delegate()&lt;br /&gt;            {&lt;br /&gt;                // ... Update the UI ...&lt;br /&gt;            });&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;        // ... Update the UI ...&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;This is upposed to work! So what happened?&lt;br /&gt;&lt;br /&gt;Turns out there are two types of calls to modify a control in .Net. The first is a &lt;span style="font-family:courier new;"&gt;SendMessage &lt;/span&gt;and the other &lt;span style="font-family:courier new;"&gt;PostMessage&lt;/span&gt;. &lt;span style="font-family:courier new;"&gt;Invoke &lt;/span&gt;uses &lt;span style="font-family:courier new;"&gt;SendMessage&lt;/span&gt;, which causes the update message to be sent, but hangs around until the message has been processed. &lt;span style="font-family:courier new;"&gt;BeginInvoke &lt;/span&gt;uses &lt;span style="font-family:courier new;"&gt;PostMessage &lt;/span&gt;which is basically a fire-and-and-forget approach; the message is added to the queue and the process goes of doing other work without waiting for it to processed.&lt;br /&gt;&lt;br /&gt;So my Invoke was obviously hanging around waiting for the control update to be completed, while the control update was waiting for some other process further back in the queue... at least that's how I understand it.&lt;br /&gt;&lt;br /&gt;To solve this issue, simply use &lt;span style="font-family:courier new;"&gt;BeginInvoke &lt;/span&gt;rather than &lt;span style="font-family:courier new;"&gt;Invoke&lt;/span&gt;. I'm sure this fix is not appropriate for all problems, but in my case it did the trick.&lt;br /&gt;&lt;br /&gt;For a more detailed explenation, see this &lt;a href="http://www.codeproject.com/KB/cpp/begininvoke.aspx"&gt;CodeProject page&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-2986396343388124666?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/2986396343388124666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=2986396343388124666' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/2986396343388124666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/2986396343388124666'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/07/ui-updates-and-threading.html' title='UI updates and threading'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-6776823024684603432</id><published>2008-06-30T16:41:00.000+02:00</published><updated>2008-06-30T16:53:58.183+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XP'/><category scheme='http://www.blogger.com/atom/ns#' term='Vista'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><title type='text'>The infamous "\\computer is not accessible. You might not have permission to use this network" error</title><content type='html'>I must have come across this stupid error a dosen times and it is often solved by simply changing the Windows machine's Network ID or by running the Network Connection Wizard thingy in the Control Panel -&gt; Connections page.&lt;br /&gt;&lt;br /&gt;This time though, we had a computer playing hardball and was only solved by doing the following (from &lt;a href="http://networking.nitecruzr.net/2005/05/advanced-file-sharing-tweaks-in.html"&gt;PChuck's Network&lt;/a&gt;):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Download and install the Windows 2003 Server Resource Kit Tools.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; Click Start | All Programs | Windows Resource Kit Tools | Command Shell.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; Type these three lines, one at a time, at the command prompt. The ntrights&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; commands are case-sensitive, so type them exactly as shown. Note the "+r" in&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; the second one and the "-r" in the third one:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; net user guest /active:yes&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; ntrights +r SeNetworkLogonRight -u Guest&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; ntrights -r SeDenyNetworkLogonRight -u Guest&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And that solved our problems. Well for most guys. For some reason my Vista still did not want to connect. I changed my Network ID to be same, and whala! It worked! This is a bit peculiar considering that I was able to connect across different Network ID's on my previous XP machine. I don't have time to double check and validate that now though.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-6776823024684603432?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/6776823024684603432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=6776823024684603432' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/6776823024684603432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/6776823024684603432'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/06/infamous-computer-is-not-accessibleyou.html' title='The infamous &quot;\\computer is not accessible. You might not have permission to use this network&quot; error'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-7937789430277654920</id><published>2008-06-29T22:49:00.001+02:00</published><updated>2008-07-08T13:58:43.154+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>More issues moving over to new system</title><content type='html'>Ok so I don't have this dll on my system.&lt;br /&gt;&lt;br /&gt;Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.&lt;br /&gt;&lt;br /&gt;Just download and install the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&amp;amp;displaylang=en"&gt;ASP.NET 2.0 AJAX Extensions&lt;/a&gt; package. Problems solved!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-7937789430277654920?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/7937789430277654920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=7937789430277654920' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/7937789430277654920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/7937789430277654920'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/06/more-issues-moving-over-to-new-system.html' title='More issues moving over to new system'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-5152417190133675031</id><published>2008-06-29T21:45:00.000+02:00</published><updated>2008-06-29T21:58:03.208+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Vista'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Vista administrator woes</title><content type='html'>Ok if you're a Vista user you're undoubtely also sick and tired of being bombarded with security pop-ups, which are aimed at keeping the average user from destroying the system with malware.&lt;br /&gt;&lt;br /&gt;So you want to be a real administor? Follow these steps:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;First, turn off UAC warnings.&lt;/span&gt;&lt;br /&gt;1. Go into &lt;span style="font-weight: bold;"&gt;Control Panel&lt;/span&gt;.&lt;br /&gt;2. Open up &lt;span style="font-weight: bold;"&gt;User Accounts&lt;/span&gt; (in classic view) and &lt;span style="font-weight: bold;"&gt;User Accounts and Family Safety -&gt; User Accounts&lt;/span&gt; (in standard view).&lt;br /&gt;3. Click &lt;span style="font-weight: bold;"&gt;Turn User Account Control on or off&lt;/span&gt; and follow the rest of the instructions.&lt;br /&gt;&lt;br /&gt;Ok now you got rid of most of the issues, but Vista still with give you a hard time with Services and applications such as SQL Server and Visual Studio. It still won't think you are a full blown administrator and prompt you with the odd warning. Quite annoying.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Finally, Turn off   &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;"Run all administrators in Admin Approval Mode"&lt;/span&gt;&lt;br /&gt;1. Open a run window, and type in &lt;span style="font-weight: bold;"&gt;secpol.msc&lt;/span&gt; and hit enter.&lt;br /&gt;2. Expans &lt;span style="font-weight: bold;"&gt;Local Policies -&gt; Security Options.&lt;/span&gt;&lt;br /&gt;3. Scroll down to &lt;span style="font-weight: bold;"&gt;User Account Control: &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Run all administrators in Admin Approval Mode&lt;/span&gt;&lt;span&gt; and disable the damned thing.&lt;br /&gt;4. Restart and all should be well.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-5152417190133675031?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/5152417190133675031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=5152417190133675031' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/5152417190133675031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/5152417190133675031'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/06/vista-administrator-woes.html' title='Vista administrator woes'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6184501332033258310.post-9071280588429472528</id><published>2008-06-29T20:57:00.000+02:00</published><updated>2008-06-29T22:16:48.930+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vista'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='IIS 7.0'/><title type='text'>Visual Studio 2005 and IIS 7:  Unable to open the Web</title><content type='html'>I recently upgraded to a new workstation, which came with Vista Ultra SP1. I tried to open my previous web apps and got this message:&lt;br /&gt;&lt;br /&gt;"Unable to open the Web 'http://localhost/...'. The Web server does not appear to have the FrontPage server extensions installed."&lt;br /&gt;&lt;br /&gt;A quick google search came up with this article on the MS Knoweldge Base:&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/936857"&gt;http://support.microsoft.com/kb/936857&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I followed the instructions and enabled the &lt;strong class="uiterm"&gt;IIS Metabase and IIS 6 configuration compatibility&lt;/strong&gt; component. I went back into VS Studio, clicked Reload Project, but no luck.&lt;br /&gt;&lt;br /&gt;Next I went into IIS 7's management console. I noticed that the web apps were not added to an application pool yet. Just right-click the folder and choose &lt;span style="font-weight: bold;"&gt;Convert to Application.&lt;/span&gt; Reloaded the project again, and nothing...&lt;br /&gt;&lt;br /&gt;Trying to solve the issue, I got a bit side-tracked and sorted out some annoying  &lt;a href="http://adventuresindevelopment.blogspot.com/2008/06/vista-administrator-woes.html"&gt;administrator issues&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I rebooted my system and my web app is working!! Whoop whoop!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6184501332033258310-9071280588429472528?l=adventuresindevelopment.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresindevelopment.blogspot.com/feeds/9071280588429472528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6184501332033258310&amp;postID=9071280588429472528' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/9071280588429472528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6184501332033258310/posts/default/9071280588429472528'/><link rel='alternate' type='text/html' href='http://adventuresindevelopment.blogspot.com/2008/06/visual-studio-2005-and-iis-7-unable-to.html' title='Visual Studio 2005 and IIS 7:  Unable to open the Web'/><author><name>Andre</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://3.bp.blogspot.com/_b99jUoyd9wU/Sa4g8GBOb3I/AAAAAAAACD8/x-eIhgfkqEU/S220/avatar.png'/></author><thr:total>0</thr:total></entry></feed>
