Category: Programming

MySQL Select Columns Quirk

A long time ago I came across a quirk with MySQL that would not let you select all columns in a query  if you first specify a column name.  So executing the following SQL:

select post_title, * from posts;

Read More »

Posted in Programming | Tagged | Leave a comment

Password Generator

When creating passwords it’s usually hard to make them secure and random. To create strong passwords I use my originally named Password Generator!
Read More »

Posted in Programming | Tagged | 2 Comments

Add Request Header to jQuery Ajax Requests

Sometimes it is necessary to determine if a request was performed by a jQuery Ajax call or a normal request. Using ajaxSetup it is possible to add custom headers to all Ajax requests executed by jQuery.

   'beforeSend': function(xhr) {           
      xhr.setRequestHeader("AJAX", "true");

Server-side you can then check the request header to identify the type of request and output the appropriate response.

Posted in Programming | Tagged | Leave a comment

Make Visual Studio Run Faster

Running Visual Studio can be quite demanding on your operating system. Working on large projects with lots of files can really start to make Visual Studio freeze. I find that by turning off a lot features you can speed up the response time of Visual Studio and improve your productivity. Read More »

Posted in Programming | Tagged | 5 Comments

Migrating From SQL Server 2008 Back to SQL Server 2005

It may seem unusual migrating from SQL Server 2008 back to SQL Server 2005, but believe me it is useful to know a few gotchas if you do find yourself in this position.

I tried many different ways to migrate back 2008 to 2005. The following steps are what has worked for me quite reliably, but I am sure there are other ways to go about this.

Read More »

Posted in Programming | Tagged | Leave a comment

Preserve Comments in MySQL Stored Procedures

Comments in any code are good practice and can help guide yourself and others through more complicated processes.

Single and multi-line comments can be included in MySQL stored procedures using the following syntax:

# a single-line comment

select 1;

/* a

When creating stored procedures for a MySQL database using a GUI, like MySQL Browser, any comments added are preserved (as you would expect). However, if you use the command line client you may have noticed that comments are stripped out. The command line client removes any comments before executing the script so comments are lost. Read More »

Posted in Programming | Tagged | 2 Comments

Make Input and Textarea Text Resize Correctly

To make text accessible and resize the solution is to use relative fonts:

body { font-size:medium; }

When text is resized through a browser all font sizes should change relatively. Unfortunately this does not apply to the <input> and <textarea> tags and so the text size does not change.

Fear not though, the simple solution is to simply set a percentage value to the input and textarea selectors:

input, textarea { font-size:100%; }

Now the text in the <input> and <textarea> tags should resize correctly.

Posted in Programming | Tagged | Leave a comment

Using Themed CSS Files Requires a Header Control

When using ASP.NET themes and you specify the global theme in web.config you can run into problems when you want to create a page that does not use the theme. Read More »

Posted in Programming | Tagged , | Leave a comment

List MySQL Stored Procedures

When using stored procedures with MySQL you may at some point want to get a list of all the stored procedures that exist in your database. Using the MySQL INFORMATION_SCHEMA  database and the ROUTINES table we can easily list information about procedures or functions. Read More »

Posted in Programming | Tagged | 1 Comment

ASP.NET Server-side Comments

When working with an ASP.NET page or control you many want to remove code temporarily or stop some code executing while debugging. This can be achieved easily using the server-side comment opening, <%--, and closing tag, --%>.

Read More »

Posted in Programming | Tagged | Leave a comment