Ramblings of an IT Consultant

Archive for October, 2010|Monthly archive page

Today I asked myself the question: What are my reasons for blogging?

In Blog, Technology, Wordpress on October 27, 2010 at 5:00 pm

As I have mentioned before I am quite new to blogging.  Before I started I looked at lots of blogs related to blogging.  I found lots of useful information about the topic, and my interest as a blogger began.

The main reason I decided to start my blog was initially to let my clients know what I was up to, as well as  posting useful code snippets.  Slowly the focus of my blog started to change and my topics moved onto reviews of hardware and software.  I now also enjoy having the occasional rant or sharing a funny article or video via my blog.

However since moving my blog to WordPress I have started to read more and more blog articles about things I wouldn’t usually read about.  I am pleased to say I am a fan of  freshly pressed on WordPress too!  It always amazes me the amount of useful information available online and that there are people who are more than happy to contribute.  I have been trying to search for random things via the search option,  to see how my content stands up to other blogs.  I am pleased to say that so far I feel that I am making some headway.

If I am honest I was beginning to wonder if there was a point to my blogging.  For some it seems pointless.  I was out having a beer with a few friends on Friday when I  mentioned I had now created a blog.  The response was “Why? isn’t that a bit sad?”.  Then someone said “Oh don’t tell me you find it relaxing?.  Before I got a chance to answer all of the questioned posed to me the conversation had moved on.  Sometimes I am not the most confident of people so started to doubt my reasoning behind my blog.  I get a lot of flack from people asking me how I have time to blog when I am so busy running my business.

So all of this got me thinking.  I can still stand by my initial thoughts on starting my blog.  Below are my main reasons for blogging:

  • To give potential and current customers a view of the work I have undertaken in the past and my capabilities
  • When I have the time to review hardware and software
  • To help other programmers with code and ideas of things I have found useful
  • To have the occasional rant.  It’s good to get bad experiences or days off your chest
  • Throw ideas out to other people.  Sometimes for help mostly out of interest
  • Provide links to useful and funny stuff on the web
  • Provide myself with a creative outlet
  • Have Fun!

After completing my list it makes my reasons blogging clear and put a little smile on my face.  Maybe its indulgent, maybe its therapy but one thing is for sure, I now truly understand my reasons for blogging!

So I suppose the big question is…..  Why do you blog?

Dynamically Resizing an Image in ASP.NET

In asp.net on October 25, 2010 at 8:25 am

I have been working in ASP today rather than ASP.NET and I was a bit rusty at it.  Which is quite odd as I can still remember how to use DataEase for DOS which did not even support a mouse.  Maybe its old age or memory overload, but I really did struggle at the start of the day.  I generally program in ASP.NET these days, however today has got me thinking.  Was life simpler in the old days of  standard ASP?  Ok you can’t have as many bells and whistles but do we actually need them?

Saying that I did use an ASP.NET web page to pass through images for dynamic resizing.  In the old days I would have had to use ASP JPEG or something similar to resize images.  In case your interested I have attached the code below:

<%@ Page Language=”VB” %>

<!–DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>

<%@Import Namespace=”System.Drawing.Imaging” %>
<script language=”VB” runat=”server”>

Function ThumbnailCallback() as Boolean
Return False
End Function
Sub Page_Load(sender as Object, e as EventArgs)

‘Read in the image filename to create a thumbnail of
Dim imageUrl As String = Request.QueryString(“img”)

‘Read in the width and height
Dim imageHeight as Integer = Request.QueryString(“h”)
Dim imageWidth As Integer = Request.QueryString(“w”)
‘Make sure that the image URL doesn’t contain any /’s or \’s
If imageUrl.IndexOf(“/”) >= 0 Or imageUrl.IndexOf(“\”) >= 0 then
‘We found a / or \
Response.End()
End If

‘Add on the appropriate directory
imageUrl = “~/images/” & imageUrl

Dim bitmapNew = New System.Drawing.Bitmap(Server.MapPath(imageUrl)) ‘ // load original image
Dim widthOrig = bitmapNew.Width
Dim heightOrig = bitmapNew.Height

Dim fullSizeImg as System.Drawing.Image
fullSizeImg = System.Drawing.Image.FromFile(Server.MapPath(imageUrl))

If imageHeight = 0 Then
imageHeight = (heightOrig * imageWidth) / widthOrig

End If

‘Do we need to create a thumbnail?
Response.ContentType = “image/jpg”
If imageHeight > 0 And imageWidth > 0 Then
Dim dummyCallBack As System.Drawing.Image.GetThumbnailImageAbort
dummyCallBack = New  _
System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)

Dim thumbNailImg As System.Drawing.Image
thumbNailImg = fullSizeImg.GetThumbnailImage(imageWidth, imageHeight, _
dummyCallBack, IntPtr.Zero)

thumbNailImg.Save(Response.OutputStream, ImageFormat.Jpeg)

‘Clean up / Dispose…
thumbNailImg.Dispose()
Else
fullSizeImg.Save(Response.OutputStream, ImageFormat.Jpeg)
End If

‘Clean up / Dispose…
fullSizeImg.Dispose()
End Sub
</script>

I saved the above code in a page called showimage.aspx.  The code below shows how I used the new page within an ImageURL.

imagebutton runat=”server” ID=”imgProd” ImageUrl='<%# “~/Showimage.aspx?img=” & eval(“ProductImage”)  & “&w=203&h=128″ %>’ postbackurl=”someform.aspx” />

So after typing this blog I have realised that I would not want to go backwards so its ASP.NET all the way!

Pointless but funny!

In Just for Fun, Technology on October 23, 2010 at 12:02 pm

I was looking through twitter and I came across this video on Youtube which as recommended by Jonathan Ross.  One of the funniest videos I seen in a while! Thought it could add some fun to my fellow bloggers day.  It is technology based sort of…… well its on YouTube! Baby Monkey (Going Backwards On A Pig) – Parry Gripp Enjoy!

Top 10 Reasons to pull your hair out at work

In Just for Fun, Technology on October 23, 2010 at 9:21 am

As a software consultant I get pleasure of working with other peoples handy work.  Generally in most consultancy jobs I can spot good and bad bits and so I decided to list of top 10 gripes.  Whilst putting this list together I realised that this list could apply to any job.  Also if you are a client of mine this is not personal to you its just been one of those days! 

  1. The client calls you with a very complicated programming problem and then expects to you explain how to resolve it over the phone
  2. After explaining it to them over the phone you realise it would have been quicker and a lot less stress to drive to their site in Newcastle to do it yourself
  3. Your drive there and fix the problem in 1 1/2  hours and realising there is not a days work to do and the client expects not to pay for your time
  4. You arrive on site to fix an issue and after a 3 hour drive you find if they spelt correctly it would have probably worked for them too
  5. You arrive to take a look at an error in their code and try to fix it only to waste at least 3 hours before realising that if you had started again you would be in a pub somewhere by now
  6. They think a weeks work can be done in a day don’t but dont really want to pay a days money either
  7. No matter how many times you tell the customer that you dont program in clingon the customer still expects you to take a look
  8. Someone buys a ready made solution and thinks you can understand it and change it with a 30 second look at the programming when it would be easier and cheaper to start again
  9. The client believes that if you are not working on their site then the chances are your not working for them at all.  Ok so sometimes you do go and do something else but generally you work harder without the distractions
  10. The client changes their requirement at the last minute and you have to more or less start from scratch before the 2hr deadline is upon you

So there are my top 10 I am sure most of you can add to that!  Feel free to leave your comments on your bad day in the office.

ASP.NET 301 Redirect in VB

In Google, Microsoft, PageRank, SEO on October 22, 2010 at 10:05 am

I have been recently been moving a complete website to a new domain and the client asked what will happen to all of the broken links in Google.  They were quite concerned that their page rank would drop due to the massive changes.  Simple I said a 301 redirect and an update to the sitemap will help.

There is a way you can do this from within the web.config or even java script, but for this site decided to create 301 code in the page init event.

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Response.Status = “301 Moved Permanently”
Response.AddHeader(“Location”, “http://www.gallagherit.co.uk&#8221;)
End Sub

I made sure that all of the old pages were redirected to their matching new page and following a quick update of the sitemap to remove the broken links and away we went.  I used XML-Sitemaps.com to generate my sitemaps which is free if your website is less than 500 pages in size.

The good thing about 301 redirects is that it keeps Google happy and we all like to keep Google happy dont we?

The Art of Blogging – What is it?

In Blog, Technology, Wordpress on October 21, 2010 at 8:19 pm
Sucessful Blogging

I am a new blogger and if I am honest I am still not sure if I understand it all totally. Like most people serious about blogging I did my research and to a degree, I still am. So why has it not worked for me yet?

I will agree with most people looking at this blog thinking that it is new and its going to take some time. However I originally started with a Blog Engine blog on my business website which you will find at www.gallagherit.co.uk. Every new article is read by about 10 people. However Blog Engine allows for serious spamming which makes it difficult to moderate. For now I have decided to keep them both going with more or less similar content to see which one is going to work out best.

I never realised it could be so hard to get readers. I mean everyone will find what I have to say useful right? Then I realised maybe not after all my content is quite specialist although I try to write an interesting story around what I am trying to explain, I suppose most people might not be interested in that!

I have read so many blogs on how to be a successful blogger and they all say the same thing. Here are the top 10 tips that I always come across:

1. Find a topic you enjoy and write about that

2. Content is king! Make sure you write interesting and accurate content.

3. Research and then research some more about blogging

4. Keep on Topic. (I find this difficult!)

5. Quality is key. Even if your blog post is a short one make sure it’s good. Don’t give in to bad spelling and grammar.

6. Keep to the schedule. If you say your going to write blog every day then write one every day! You readers will expect this.

7. Make sure the design of your blog is easy to read and navigate. If your blog is in bright pink remember most men will turn away!

8. Readers might be few and far between at the start – Give your blog time to mature like a good wine.

9. Dont just write your blog for search engine results.

10. Make sure you enjoy blogging. It can be fun and rewarding so make sure you keep it that way!

I suppose now I am in the waiting game. Waiting is the one thing none of us humans are good at. I am a keen gardener and when growing veg I cant help but have a sneak peak and pull up carrots to see if they are growing. But as my wife keeps on telling me that waiting and playing the long game will reap its rewards.

The way I look at it is now I might be writing lots of articles that nobody reads but like my garden my audience will grow with a bit of care and attention.

Do you have patience or are you ready to throw in the towel too soon?

Internet Terror Threat!

In BBC, Microsoft, Technology, War on Terror on October 20, 2010 at 7:40 pm

So its been plastered all over the news that the UK will be hit by hackers in a new terror threat.  On Radio 2 yesterday they were discussing if this was possible and its effect on the UK and its banking and energy systems.

I think we are already being terrorised by Microsoft!  They sell and promote software that can be hacked and always needs updating.  All we need is another virus like the one we had a few years ago.  That virus restarted thousands of computers across the world anytime they connected to the internet!

Now imagine that virus but a lot more powerful.  Maybe with the capability to destroy the boot sector of a pc then the world’s computer systems could be in deep trouble!  Just think there could be a Microsoft vuneriability out there already just waiting to be exploited.

Just a thought!