Category Archives: Programming

How to use the Twitter Search API using Python (or other language)

Due to my experience with the Twitter API through my implementation of ThinkTwit, I’ve had a few questions lately on how to implement the Twitter (Search) API in Python so rather than answer people individually I figured it would be best to share with everyone on my blog.

Continue reading How to use the Twitter Search API using Python (or other language)

ThinkTwit Update 1.4.2

It’s been a while since I last posted or made any changes to ThinkTwit as work is very busy at the moment – apologies if anyone has missed me, but I’m guessing not as I’ve not had a lot of feedback. One request that came through recently which stood out has prompted this latest release, here’s a summary:

Continue reading ThinkTwit Update 1.4.2

How to open a new tab in an existing Internet Explorer instance in C#

A problem that I recently came across is when opening a new Internet Explorer instance in C# the user was being required to login to a site that they had already logged in to. It was pretty clear that this was because the existing session was not being used as a new IE process was being started, therefore I surmised that the solution was to utilise the existing process.

I had read previously about the Navigate2 API and thought it may help but it wasn’t entirely clear how to use it and specifically how to use it on an existing IE instance, so I feel this blog may help others.

Continue reading How to open a new tab in an existing Internet Explorer instance in C#

How to save to PDF in C# using Word 2003 or 2007 without SP 2 (using Pechkin)

I’ve spent a significant amount of time lately on trying to solve this issue and came across many, many barriers, so I thought I’d share with you my findings and the solution that I used. Whilst Word 2007 SP2 (or Word 2007 using the Save As PDF Add-in) and above natively support saving documents as PDF (and can therefore be used by C# to save as if saving a normal .doc or .docx – you can do this easily by adapting my code) below this level it is not possible. There are a few different ways that this problem can be solved (notably, using a paid library or a web service) but most involve payment and some involve methods that, in my case, were not acceptable (e.g. having to install additional software or having to access locations that were locked down).

Continue reading How to save to PDF in C# using Word 2003 or 2007 without SP 2 (using Pechkin)

How to force open Internet Explorer 32-bit or 64-bit in C#

On a project I was recently working on it was necessary to open a URL in Internet Explorer (a requirement of it to work correctly, unfortunately) and we had a few “bugs” which seemed to randomly occurred. It turned out this was due to Process.Start(“iexplore.exe”) loading 32-bit IE whereas it seems we required 64-bit.

Continue reading How to force open Internet Explorer 32-bit or 64-bit in C#

How to remove warning: The ‘log4net’ element is not declared

So I’ve seen a lot of questions around this issue with generally the only resolution being: “It’s a warning, just ignore this”. Whilst it is safe to do this, for pedants like me there is a true resolution. There are a few places around the net to get this but (like a lot of issues I blog about) you often need to combine the advice. Here’s the true resolution:

Continue reading How to remove warning: The ‘log4net’ element is not declared

Colour your Log4Net events in your RichTextBox

You’re most probably here because you have already read my article How to watch your log through your application in Log4Net and you’re thinking “that’s great, but I need to somehow differentiate all of this output!” – either that or you just really need a handy way to format certain keywords within your RichTextBox.

Continue reading Colour your Log4Net events in your RichTextBox

Scrolling textbox when text is added, but not if the user has scrolled

You may (or may not) have read my recent article How to watch your log through your application in Log4Net which allows you to append Log4Net events direct in to a textbox – if so, you may then also have come across a frustration that I also had, which is that whenever the texbox is updated it scrolls incorrectly and what you actually want is for it to scroll to the bottom unless the user has scrolled themselves and therefore it should remain in place (so that the user can carry on reading where they are).

Continue reading Scrolling textbox when text is added, but not if the user has scrolled