C#

  • System OutOfMemoryException Error using System.IO

    system.io error message

    If you ever see this exception error message it might be worth checking out that you're validating the files you're reading into your system to confirm that they are the correct file type. Wasted too much time on this error just now, oy!

    .Net, C#
  • RTE News Reader pulled from the Marketplace

    RTE News Reader pulled from the Marketplace

    So I guess this was inevitable but RTE sent a cease and desist letter to me via the Windows Phone marketplace tonight. Their reasons for asking for me to take down the app were that I was using the RTE logo (fair enough) and for using the public RSS feeds which according to their terms are for personal use only....even though I never made a cent from the app.

  • Arabic culture that uses the Gregorian calendar

    Arabic culture that uses the Gregorian calendar

    One of the multilingual sites I work on was recently converted to Arabic. The site was already running with French, German, Polish and a whole host of others but Arabic was our first right to left language on this particular site.

    Once we got the right to left stuff working for our HTML - mostly by using the 'direction' attribute in CSS - we noticed that our code was failing when displaying dates in the system.

  • Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

    I was working recently on an import script that would allow the end user upload an excel file, read it and import the data. Everything worked great on my own computer but when I ran the project on our Windows Server 2003 the project would fail when attempting to open the .xlsx file. The error returned to me was:

    Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

    Obviously the server was missing the component required to read in a xlsx excel file. To solve this issue you need to download the 2007 Office System Driver: Data Connectivity Components onto your server. No server restart is required to install this tool and once it is installed everything will work as expected and your .net project will be allowed open and read .xlsx files.

  • RTE News Reader for Windows Phone gets a new update

    Just a quick post to say that my RTE News Reader app for Windows Phone has been upgraded to version 1.6. This new version fixes a small bug that prevented users from re-read the same article after they returned to the article from IE. The big improvement for this version is that the app now displays the content from rte.ie within it. I don't open up the web browser in a separate window anymore.

    This proved a little tricky to do as it meant I had to scrape the site and parse the HTML. I did this by using the excellent HTML Agility Pack for Windows Phone. The one gotcha here was that I had to make sure I encoded my web calls correctly. The default encoding was making Irish words or euro symbols come out all weird.

    It's great to get another release of this app out the door. Hopefully you'll like it!

  • There is already an open DataReader associated with this Command which must be closed first

    I was working on one of my Entity Framework Code First websites the other day when I noticed the following error being returned to me:

    There is already an open DataReader associated with this Command which must be closed first

    Doing a few searches online I could see some of the solutions were to include the parameter 'MultipleActiveResultSets=True' in your entity framework setting in the web.config. However, when I checked my web.config to look for this setting I noticed that I did actually have it all setup as expected.

    Doing some more digging around I noticed that the cause for this issue is down to an issue with deferred execution in some of my queries.

    The solution was to add a simple .ToList() at the end of my query.

    A simple fix but one that drove me nuts for a while!

  • Workaround for the PDFSharp error: Cannot handle iref streams

    [July 09 2012 Update] As some people have emailed and commented, another option to work around this solution is to plugin iTextSharp and use that for opening PDFs older than ver 5. The workaround can be found over on the PDFSharp forums http://forum.pdfsharp.net/viewtopic.php?f=2&t=693#p5855. I decided against this option myself as it would have required me to install and setup another third party library which I didn't want to do.

    [Original Article]

    I use PDFSharp with my ,net projects as a great way to produce invoices for our online stores. Some of our customers supply us with blank PDFs and we use these as templates when generating a new invoice.

    I was given a PDF recently that was encoded using Adobe Acrobat 9. Normally we don't have any issues but this file was throwing the following error any time I wanted to open it:

    cannot handle iref streams. the current implementation of pdfsharp cannot handle this pdf feature introduced with acrobat 6

    It turns out that the encoding a PDF form above ver 5 gives PDFSharp a bit of a headache. The solution for us was to simply re-save the file with Adobe Reader v5 format. We were able to do this using Adobe Acrobat or Photoshop.

  • New update for RTE News Reader app coming out shortly

    I've just submitted a new update to the Windows Marketplace for my RTE News Reader app. This update is only a minor update but includes a fix to a nasty bug that was forcing some news articles to not display.

    The bug was caused by badly formatted XML from RTE.ie - rogue ampersands to be precise. I was able to track down that it was badly formatted XML by using a simple XML validate checker - http://validator.w3.org/feed/ This checker highlights everywhere that the feed could be failing.

    Once I could see the issues I then had to put in a workaround. The problem with just replacing &'s is that they are also going to be used for valid html encoded values in the XML. I had to ensure that I was replacing single ampersands only. I was able to do this by using a regular expression to find single instances of ampersands in the text and replaced them with html encoded versions of themselves. This Stackoverflow article discusses how to implement such a fix: http://stackoverflow.com/questions/121511/reading-xml-with-an-into-c-sharp-xmldocument-object

    The app is now going through the usual approval processes in the App Hub. All going well, it should be available for download by the end of next week.

     

  • ← Older Posts

Updates

Follow me online at TwitterFacebook or Flickr. If you want to get in touch with me try emailing me.

Latest Tweets