Software development can sometimes be a comical affair, I have just been caught out badly by a strange gotcha - it appeared that #pragma once stopped working on a Visual Studio C++ project on which I have been working.  I was getting plenty of error messages about redefined classes! 

 

Well it turns out that I had left a copy of one of my header files lying around in one of the project folders.  As pragma once uses a header file’s full path to figure out if it has already opened it, a situation arose whereby both files were included and compile errors flooded in (despite the pragma onces)!

 

Well removing the (accidential) copy of the header file fixed the problem - boy do I feel stupid, I hope this post may help someone with a similar problem in the future!


Related Posts

  • No Related Post

I ran into a problem the other day with .NET’s Convert.ToDecimal() , it turns out that it doesn’t handle scientific Notation! Pass it something like “8E-5″ and the poor thing just throws an exception…

 

The software in which the problem surfaced was developed as a web application that must deal with numbers read from an Excel chart and so the formats encountered are many and varied!

 

This post points out that you can use this instead:

 

Decimal.Parse(val, System.Globalization.NumberStyles.AllowExponent);

 

But just to be safe I am now using:

 

Decimal.Parse(val, System.Globalization.NumberStyles.Any);

 

And it does work for Exponents, hopefully along with everything else!


Related Posts

I have been developing a web application for one of our clients using drupal, it’s a dashboard type data visualisation system that consumes and displays data over an intranet from their software systems.  I have been using google charts with great success.

 

The Chart API module for drupal is very nice, it lets you quite easily incorporate google charts into your web site or application without having to get into the details of the google chart API itself, and the charts themselves look great - just the kind of thing to cheer up a busy software developer.  However it deosn’t seem to support Radar or Polar charts.  There is no mention of them in the documentation, no example on the examples page.  There is also no symbol such as ‘CHART_TYPE_RADAR’ defined in the module as there is for the other chart types, for example ‘CHART_TYPE_LINE’ defined for line charts.

 

So is it possible to plot radar charts using the Chart API module?  I consulted the google chart api and found that the radar chart type is donated as ‘r’, so I tried creating a simple chart and just set it’s type to ‘r’ (rather than say CHART_TYPE_LINE) and it worked just fine!

 

$chart = array( ‘#chart_id’ => ’sink_radar’, ‘#title’ => chart_title(t(’Failures by Sink’), ‘001334′, 15), ‘#type’ => ‘r’, ‘#size’ => chart_size(400, 240), ); $chart['#data'][] = array(20, 30, 15, 70, 90, 20); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink1′); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink2′); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink3′); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink4′); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink5′); $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(’sink6′); echo chart_render($chart);

 This code yileds a chart like this:

 

Radar Chart


Related Posts

I ran into a funny problem recently with Ridge’s debian fileserver - I connected a second external USB drive to it and it stopped working! It always had one external USB drive connected, this was mapped to /dev/sda1 and auto-mounted in /etc/fstab along the lines of:

 

/dev/sda1    /mnt/usb   auto    rw    0       0

 

Everything was running nicely until I introduced a second usb device, this time a large flash disk onto which our automatic backup script is going to periodically dump an encrypted tarball (to provide an easy way for us to move encrypted backups off-site.)

 

Anyway, I saw that the second disk was mapped to /dev/sdb1 and I optimistically modified /etc/fstab to cater for the new flash disk along the lines of:

 

/dev/sda1    /mnt/usb   auto    rw    0       0
/dev/sdb1   /mnt/flash  vfat  rw,users,umask=0   0    0

 

So far so good, after reboot both file systems successfully mounted. But after the next reboot things were not as expected, the original disk was mounted onto the new ‘flash’ mount point and the FAT flash disk was not mounted at all!

 

With the second USB disk connected the way in which the disks were mapped to Linux devices would change randomly every time the system was rebooted - sometimes a disk would appear as /dev/sda1 and sometimes as /dev/sdb1.  As you can imagine this completely ruined the file system setup as configured in /etc/fstab!!

 

I had never encountered this before, but after a little research I found a work around - this involved mounting the disks by label rather than by the more traditional device name.

 

All labelled disks/volumes can be found in /dev/disk/by-label/ , these labels are static and can be used to mount their volumes (instead of using the non-static /dev/sda1 etc.).  Only labelled device appear in the by-label directory, so if you don’t see a disk you may have to give it a label using the tune2fs command. I had to give my original USB disk’s volume a label, I determined that it was currently mapped to /dev/sdb1 and issued the following command to label it as ‘external’:

 

tune2fs -L external /dev/sdb1

 

Now with both disks labelled I modified /etc/fstab as follows:

 

/dev/disk/by-label/external    /mnt/usb   auto    rw    0       0
/dev/disk/by-label/CORSAIR    /mnt/flash  vfat  rw,users,umask=0   0    0

 

And thankfully that fixed the problem! - with the IT systems purring along I can get back to the many more mundane aspects of running a software development consultancy…


Related Posts

October 27, 2009

Here’s an interesting thing, the Register reports that the whitehouse has moved its website over to drupal - http://www.whitehouse.gov/

 

It’s a fairly pedestrian website but it’s good to see that the fledgling administration know their web technology!


Related Posts

Chris Horn will give the Engineers Ireland presidential address tomorrow at Clyde Road. The talk is entitled “Software Engineering: how can we make it better?” It is great to have Engineers Ireland address software engineering topics and Chris always has something interesting and worthwhile to say and he is a no-quibbles heavy weight in the Irish Software Industry!

 

Having said all this I can’t go as I have to mind the kids tomorrow evening, but I would love to hear how it goes if anybody would like to report back…


Related Posts

Man oh Man it can be though keeping a blog on the road, and some of yee may have noticed that as well this Blog, I have been keeping a Web development blog on Pride Design for the past while now, this blog deals mostly with the fanaticising (!) world of web development and the issues that I encounter while working with Pride developing our content managed websites - As there are only so many hours in the week and as I don’t think that duplicated content servers any purpose, I have decided that I will publish most if not all of my webby stuff on my pride blog from now on, and keep this blog for other software engineering and development stuff.

 

So if you get a chance why not pop over to my pride blog and take a look, but don’t forget to visit this blog as I am working on some very interesting non web-stuff at the moment too and hope to keep this blog up to date too - thanks!!


Related Posts

September 16, 2009

Pride Design (www.pridedesign.ie) has put the new Adare Bridal (www.adarebridal.ie) website live.  Once again we have been working closely with pride on the development of this site.  The site is built using drupal 6 and uses custom CCK types and drupal views to model (pun intended) and display all those fantastic designers and their bridal gowns!

 

The site is a full CMS solution, the client can add, edit or remove content on the site including designers, dresses, special offers etc. by just logging in and using a simple content administration interface.


Related Posts

I was making some mods to an old ASP .NET web app today when I discovered that I could no longer properly debug it - when I started the debugger, VS2005 would launch IE8 and load the app but would then just detach and exit debug mode!  I have been running IE8 for a few months now and figured that the problem might have something to do with IE8 and sure enough it did!!

 

I found this excellent post which details a simple fix for the problem - I can now happily debug again!  It seems that the fix prevents IE8 from spreading itself across multiple processes this was confusing the poor VS2005 debugger..


Related Posts

Just in case I forget how to do it - here a link to a post that tells you how to change the add to cart button in ubercart, http://www.pridedesign.ie/content/ubercart-style-add-cart-button

very handy indeed!


Related Posts