May 2012
1 post
1 tag
Github for Windows →
Get this, get this now. An awesome metro based git client for Windows. Awesomesauce!
April 2012
8 posts
2 tags
Insert, Update, and Delete Operations (LINQ to... →
Why ow why would you bother writing SQL in your code anymore with stuff like LINQ to SQL. If you want to know how it works read up on the Unit Of Work pattern. I highly recommend Tekpub’s series on LINQ.
2 tags
Back to Basics: Moving beyond for, if and switch →
Well worth reading Scott Hanselman questions the abuse of for, if & switch statements when programming to perform simple parsing tasks before offering examples and solutions to clean up your code. Very interesting!
1 tag
Format a String as Currency in C# →
Handy when working with ASP.NET and C#.
1 tag
How to limit the looping of a foreach loop
I had this very question, was about to write a traditional for loop to achieve it but then a quick search on stackoverflow turned up a super simple code solution shown below:
]]>
Resource: stackoverflow
1 tag
SQL SERVER – Reset sa Password →
I’m working from home today and I normally don’t do much database work from home but unsurprisingly I had picked a password for the sa account I couldn’t remember! This handy post tells you what to do to change it.
1 tag
Move a database from one server to another server... →
Detailed post on the 4 different ways to move your database information from one SQL Server to another. My preference being number 4, script generation. This is a handy resource as it’s not a very common task for small to medium sized websites & web applications and it can be hard to remember the best way to carry out such a job.
1 tag
Temporary Tables – MS SQL Server →
Handy reference article when it comes to temp databases with MSSQL. Explains the difference between global & local databases well.
1 tag
March 2012
1 post
3 tags
Design Patterns
There are a lot of resources online if you want to brush up on design patters but I can’t recommend pluralsights on demand videos on design patterns enough.
They cover:
Adapter Pattern
Bridge Pattern
The Builder Pattern
Chain of Responsibility
The Command Pattern
Decorator Design Pattern
Event Aggregator
Facade Pattern
Factory Patterns
Flyweight
Iterator Pattern
Lazy Load...
February 2012
2 posts
1 tag
Calculate a leap year in C#
Handy bit of code this if you have an application that plays around with DateTime a bit too much and you start seeing errors February 29th ;)
1 tag
Column to Column SQL copy
Funny enough, I couldn’t find this snippet of sql code online. I needed to copy a column within the same table to another.
January 2012
5 posts
1 tag
Get IP Address in C#
Here is a little snippet of code I use in ASP.NET to get a client’s IP Address, handy to have this info if you web application is designed for certain countries or regions.
1 tag
Remote Desktop not allowed to use saved... →
I was having this annoying error with remote desktop credentials not being saved at work. This little tutorial fixed the issue, worth a read if your having this problem.
1 tag
SQL & Distinct Results
If you are working through a large list of potentially similar entries for maybe a cascading dropdown for manual location entry then you might find the DISTINCT sql command quite valuable.
This query returned 3800+ counties with tons of double entries:
Add in our special DISTINCT keyword and we get just 91 unique counties:
2 tags
How to Increase Message Size Quota
Sometimes when dealing with web services that return large amounts of data you get the follow error message.
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.
This can be fixed by increasing the maxReceivedMessageSize, maxBufferSize, maxBufferPoolSize, maxArrayLength...
1 tag
Tumblr Custom Theme Recovery →
For a second there I thought I had just undone all my custom theme work on my blog by previewing a theme that really did wipe out my html code. Thankfully Tumblr have a theme history set up. Use the link supplied and you can view the last 20 code changes you have made to your theme and revert back to the state of any of them. Phew!
November 2011
7 posts
2 tags
Bundling and Minification in ASP.NET 4.5 →
Great overview of the new bundling & minification options in ASP.NET 4.5
1 tag
2 tags
ASP.NET Response.Redirect to new window →
Bit a life saver, works great for iFrame apps on Facebook if you need the user to engage with a full screen web app outside of Facebook’s width limitations.
2 tags
Local Machine DNS Control For Better Testing
When setting up a new website or web application it is advisable to make sure your new creation is working properly on the server it will live on remotely.
This is made easy by simply setting up your server but not creating the public DNS entry for the website and only setting the DNS settings up on your own PC so you can test away.
This is done by editing the hosts file...
2 tags
Remove .aspx from Umbraco URLs
You probably noticed, as did I that when you enable clean urls in umbraco that you can still access your pages using the .aspx extension.
This is pretty bad for SEO as Google will see identical copies of each page, thus duplicate content as far as the bots will be concerned.
To solve this you can go into the UrlRewriting.config file in your umbraco installation and drop in the code below, make...
2 tags
Change Umbraco from email for Contour
This one is well hidden within Umbraco for some reason and is not adjustable with Contour from what I can see.
If you want your emails to show as something other than your@email.here then you will need to go into config/umbracoSettings.config.
You should find this in that file around line 30.
<notifications>
<email>your@email.here</email>
...
2 tags
Content dependent markup in Umbraco using Razor
With Razor being so easy to use in Umbraco now, I thought I might try out a simple if statement to hide markup that wraps around non mandatory content.
Took a couple of attempts but it was fairly easy to do and works well.
<umbraco:Macro runat=”server” language=”cshtml”>
@if (@Model.aboutMeImage.ToString() != string.Empty)
{
...
October 2011
5 posts
2 tags
Fancybox & ASP.NET Web Forms
There was a nasty little problem I came across with Fancybox that really tested my patience before I noticed what the problem was.
If you pop open a modal window with a contact form in it, you will notice that your form won’t submit with ASP.NET web forms. No js errors, nothing at all. You press your button, the page won’t reload and your modal box stays open.
Fortunately I...
3 tags
2 tags
Using reCAPTCHA with ASP.NET →
Very simple bit of code to get running in the above link. The only thing about the dll Google supply is you must have MVC installed on your system, use the web platform installer if you haven’t got it. Also Google show the code in VB! Below is the reCAPTCHA control check code in CSharp for btnSubmit.
protected void btnSubmit_Click(object sender, EventArgs e)
{
if...
2 tags
Umbraco Contour & Razor Bug
A quick note for something that has cost me considerable time working out. If you are using Umbraco’s contact form package Contour and you insert a contact form into your page via a richtext box editor.
Make sure in your template you are not using a Razor macro to insert the content of your richtext box, use the normal XSLT method. Your form won’t show otherwise.
So don’t do...
1 tag
Razor DynamicNode Cheat Sheet →
A great cheat sheet for using Razor in Umbraco 4.7.1
September 2011
2 posts
1 tag
Build an Umbraco powered website from start to...
Lately I have been doing a lot of specific development work, back in February I had been getting familiar with the basics of Umbraco but it had to be sidelined for 6-7 months.
However a couple of website builds are upon me now and I need to quickly get up to speed with taking a static website (html/css/js) and having it powered by Umbraco with contact forms.
There is a new tutorial series on...
2 tags
Simple 301 Redirects ASP.NET 4.0 in Code
Sometimes it is just easier to code in 301 redirects into an application that you are building. Specially if it is replacing a system on the same domain.
I had this recently with https://carquote.quoteline.ie.
It is very easy to use your Global.asax file to program in 301 redirects without having to use IIS when using ASP.NET 4.0.
void Application_BeginRequest(object sender, EventArgs e)
...
August 2011
6 posts
2 tags
http://base64decode.org/ →
A very handy website to encode & decode BASE64 strings. Always nice to know what is in the viewstate of your web form application.
1 tag
IE9 Compatibility Mode
Easy to forget this tag but it comes in handy if IE9 is not playing nice with older designs.
<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE8” >
Just drop that in below the title & other meta tags in your header section and it will force IE8 rendering mode in IE9.
1 tag
Web Development Project: Motor Quotation System
Features:
This system was built using ASP.NET Web Forms, it uses the Relay web services for broker quotation of products and integration with their back end for staff using the Relay desktop client.
- Broker Software Integration (Relay Web Services)
- Email Storage (Mailchimp Services)
- Full Payment/Direct Debit Processing (Realex Services)
- Text messaging service for client sales (Esendex...
2 tags
ASP.NET Data Scraping
Something that has been annoying me for a while on a hobby website is the process of maintaining a points table of F1 drivers. Recently I thought there had to be a way to pull the drivers standings from the official website; there was.
Using the WebClient class, String functions and some Regex I was able to pull down the drivers standings from the official website… nice! Here is the code, very...
2 tags
How to maintain a .gif animation after a page...
So, this has been quite a difficult thing to do, so many sources online are either outdated or only address the IE problem and not Firefox.
So here is a very simple, easy & reliable way to make a gif animation continue animating on a pleasewait page. Please note, I use jQuery in this example.
PleaseWait.html - The redirect page that will show the gif via another page using an iframe tag....
2 tags
ASP.NET’s HttpHandler to bridge the cross-domain... →
An absolutely brilliant article on ASP.NET & JSON from Dave Ward. If you are an ASP.NET dude you should watch this guys blog and follow him on twitter. He knows his stuff!
July 2011
5 posts
1 tag
Looking for the new ConfigurationManager in... →
Much like this guy I was wondering why the hell I was getting a warning pulling in an app.config variable.
http://weblogs.asp.net/scottcate/archive/2005/06/13/Looking-for-the-new-ConfigurationManager_3F00_.aspx
2 tags
IIS Crypto, PCI compliance software for... →
Got a PCI compliance test coming up? Make sure you are not using weak Cryptographic Algorithms, this little piece of software will disable old & weak protocols for you.
https://www.nartac.com/Products/IISCrypto/Default.aspx
4 tags
Simple encrypting & decrypting of strings in...
Using the link I posted earlier about encrypting & decrypting data in C#, here is the code for a simple ASP.NET web site that uses the encryption/decryption explained on a string.
.aspx file
<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML...
3 tags
Simple encrypting and decrypting data in C# →
A super simple CSharp example of encryption/decryption of a string, well worth reading.
2 tags
Disable buttons when performing an Ajax.NET...
Recently I have been having trouble with a new system that went live a few weeks ago with users getting impatient with ajax postbacks and deciding that spamming the buttons will make things go faster…
Needless to say I was getting lots of exceptions in my elmah log. =(
However over on Encosia.com Dave Ward has got a pretty awesome server control called PostBack Ritalin that will disable...
June 2011
3 posts
1 tag
ASP.NET Viewstate Decrypter
Came across this handy website that allows one to see what is in the Base64 encrypted viewstate of an ASP.NET webform. Fairly interesting what you find in there! ;)
http://ignatu.co.uk/ViewStateDecoder.aspx
3 tags
Regex SQL Injection Protection in CSharp
I have been working with some private web services for the last few months and the project based around them is finally coming together.
However the last thing I am looking into is SQL Injection, the web services wrap around a database and I have nothing to do with the formatting of the SQL so what do I do?
Well I check to make sure with the developers of the web services to ensure that they do...
1 tag
To support IE6 or not?
If ( your site does not make money )
{
do what makes you happy
}
else if ( the cost of supporting IE6 > the money you make from IE6 users )
{
stop supporting IE6
}
else
{
keep making money from IE6 users
}
May 2011
4 posts
1 tag
CheckBox Enable/Disable Button Control
Some super handy validation controls put together by Scot Mitchell fill the validation void in ASP.NET Web Forms for checkbox & checkbox list controls.
However he expanded on these controls to allow for easy enable/disable functionality for a button triggered by a checkbox. This sort of functionality is quite common with systems that require you to accept the terms and conditions before...
1 tag
Expand & Collapse regions in all Visual Studio...
One of my favourite features of working with the Visual Studio Express Editions for ASP.NET and Windows Phone is regions in the code behind files.
#region my region
int string = “awesome”;
#endregion
And then you can hide the code within the region and expand the region when you need to review the code.
However these can build up and while you might like that since your region...
2 tags
Accessing Session State from App_Code folder
Adding functionality to your ASP.NET web pages from your App_Code folder is probably my favourite feature of ASP.NET Web Forms, however you might have noticed that you cannot not access session state from your .cs files as easily as you might from a code behind file.
Thankfully it is quite easy to get a hold of current session state data from your application.
Add in this using statement to your...
2 tags
Sorting custom objects in CSharp
Recently I had to figure out a way to sort a large amount of data coming back from a web service call that I had put into a List of custom objects to store the returned data individually.
Turned out there is a Sort() method for Lists in CSharp that has the power to dig into lists and sort your data, even for custom objects.
So, in my case I had a custom object called TheQuote which stored data...
April 2011
3 posts
1 tag
SQL Server Error Log Management
If you are in control of a website that has considerable traffic you have no doubt found that MS SQL Server will eat into hard drive space with it’s error log file.
Basically this file contains log information on the activity of SQL Server instance. However it can grow to a fairly large size and it is advisable to move it from you live server to some sort of backup.
You can’t just...