SQL Server 2005 sa Login Problem

January 23rd, 2008

I came across this problem today when trying to login to SQL Server 2005 using SQL Server Authentication. The first attempt resulted in ‘SQL Server Error 233′. The second attempt resulted in ‘SQL Server Error 18452′.

If you have come across this problem the chances are that your SQL Server has been configured to operate in ‘Windows Authentication Mode (Windows Authentication)’ and therefore will not allow the use of SQL accounts.

To solve the problem do the following:

  • Login to SQL Server Management Studio using Windows Authentication.
  • Right click the server and select Properties.
  • On the Security page, select SQLServer and Windows Authentication mode.
  • You will now need to restart SQL Server. To do this right click on your server and then click Restart.
  • To enable sa login using Management Studio, expand Security, expand Logins, right click sa, and then click Properties.
  • On the General page, you may have to create and confirm a password for the sa login.
  • On the Status page, in the Login section, click Enabled, and then click OK.
 

Resize Image or Create Thumbnail ASP.NET

November 30th, 2007

After reading the article on true image resizing on 4 Guys from Rolla.com, I wanted to create a function that I could reuse to create thumbnail images and resized images after an image upload.

The following function will create either a thumbnail of the original uploaded image or will resize the original uploaded image depending on the paramaters that are passed into the function.

The parameters for this function are as follows:

lsFilename: The filename of the uploaded file
lsImagePath: The complete path of the uploaded file
liResize: The pixel size the image should be resized to
liResizeType: If this equals 1 the image will be resized by width. If this equals 2 the image will be resised by height
lbCreateThumbNail: If True a new image will be saved ending with “_smail.jpg”

To use this function create a new class in your App_Code Folder and paste the following code into your new file. This will allow the class to be available via Intellisense in Visual Studio.

If anyone has any suggestions on how I could improve this code, let me know.

Imports System
Imports System.IO
Imports System.Drawing
Imports System.Drawing.Imaging

Public Class BMFuncLib

‘*********************************************************************
‘Description: Resizes original image or creates thumbnail.
‘*********************************************************************
Sub ResizeImage(ByVal lsFilename As String, ByVal lsImagePath As String, ByVal liResize As Integer, ByVal liResizeType As Integer, ByVal lbCreateThumbNail As Boolean)

Dim liWidth As Integer
Dim liHeight As Integer
Dim lbResize As Boolean = False

Dim loDummyCallBack As System.Drawing.Image.GetThumbnailImageAbort
loDummyCallBack = New System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)

Dim loFullSizeImg As System.Drawing.Image
loFullSizeImg = System.Drawing.Image.FromFile(lsImagePath + lsFilename)

Select Case liResizeType
‘Type 1 is resize by width
Case 1
liWidth = liResize
liHeight = (liWidth * loFullSizeImg.Height) / loFullSizeImg.Width
If loFullSizeImg.Width > liWidth Then
lbResize = True
End If
‘Type 2 is resize by height
Case 2
liHeight = liResize
liWidth = (liHeight * loFullSizeImg.Height) / loFullSizeImg.Height
If loFullSizeImg.Height > liHeight Then
lbResize = True
End If
End Select

Dim lsOutputFilename As String
Dim lsSplitlcFilename() As String

If lbResize Then

Dim loResizedImg As System.Drawing.Image
loResizedImg = loFullSizeImg.GetThumbnailImage(liWidth, liHeight, loDummyCallBack, IntPtr.Zero)

loFullSizeImg.Dispose()

lsSplitlcFilename = lsFilename.Split(”.”)

If lbCreateThumbNail Then
lsOutputFilename = lsImagePath + lsSplitlcFilename(0) + “_small.jpg”
Else
lsOutputFilename = lsImagePath + lsSplitlcFilename(0) + “.jpg”
Try
Dim loFileInfo As FileInfo = New FileInfo(lsOutputFilename)
If loFileInfo.Exists Then
File.Delete(lsOutputFilename)
Else
Throw New FileNotFoundException()
End If

Catch ex As FileNotFoundException

Catch ex As Exception

End Try

End If
loResizedImg.Save(lsOutputFilename, ImageFormat.Jpeg)
loResizedImg.Dispose()
Else
‘Create thumbnail of original size if resize not needed
If lbCreateThumbNail Then
lsSplitlcFilename = lsFilename.Split(”.”)
lsOutputFilename = lsImagePath + lsSplitlcFilename(0) + “_small.jpg”
loFullSizeImg.Save(lsOutputFilename, ImageFormat.Jpeg)
End If
loFullSizeImg.Dispose()
End If
End Sub

‘Helper function. Don’t need to know about this
Function ThumbnailCallback() As Boolean
Return False
End Function

 

 

 

Flex 2 Yahoo maps onPOIClicked problem

April 18th, 2007

Flex 2.0After trying for several days to capture a click event on a CustomPOIMarker I have finally found the solution.

To capture click events you need the following code:

 

import com.yahoo.webapis.maps.events.MapEventDispatcher;

myAS2Map.addEventListener(’onMapLoad’, onMapLoaded);
myAS2Map.addEventListener(’onMapError’, onMapError);
mapEventDispatcher = new MapEventDispatcher(myAS2Map);
mapEventDispatcher.addEventListener(’onPOIClicked’,test);

public function test(ev:Object):void {
Alert.show(”Hello”);
}

 

Big Al is a Genius

April 12th, 2007

Flex 2.0The new Yahoo Maps Flash API with ActionScript 3 for Flex lets you easily add Yahoo maps to your Flex 2.0 apps.

However I came across a problem with it today. If your Flex app is embedded on a page that has a doctype definition, the Yahoo Maps stop working when viewed through a Firefox browser. Big Al came up with a genius solution to this problem.

Simply keep your Flex app within a separate page with no doctype definition and add your page containing the Flex app to the page you want to display it on using an iframe.

 

Edinburgh Film Festival

December 18th, 2006

Here is the small video that GRP put together for a presentation for the Edinburgh Film Festival.

In my defence I have been poorly edited.


 

Wordpress Image Upload Problem

October 27th, 2006

Nice one bruvaMe and Big Al had a problem today with wordpress not displaying uploaded images in the thumbnail preview when creating or editing a post. The images were uploaded to the correct folder but where not written into the database. To solve this do the following:

You need to disable Strict Mode in MySQL 5. If you have already installed MySQL 5 goto Start–>MySQL–>Server Config Wizard. Follow through the detailed config steps and deselect ‘Enable Strict Mode’.

If on the other hand you dont want to relax your entire MySQL 5 server you can change it on a per-session basis. To do this add the following:

mysql_query(”set session sql_mode = ””);

to the function wpdb in wp-db.php (after the successful mysql_connect query). This will ignore all the disobeyed NOT NULLs in WordPress’s CREATE TABLEs, but only during a WordPress session.

Nae bother tae us!!!

 

Dreamweaver Coding Color is Black

October 13th, 2006

I lost all color coding in Dreamweaver this morning and I found many people with the same problem when I did a search on google.

Must have done an accidental keypress which switched it off.

To get it back do the following:

Go to: View -> code View Options -> Syntax coloring

 

Taylor Clarke 360

July 27th, 2006

Taylor ClarkeRecently I have been building a new web application for Taylor Clarke Partnership which allows them to create online questionnaires, used to gather information about how the people taking part on their management courses are perceived by themselves and their colleagues. This tool was aimed at making the process of completing online questionnaires more user friendly compared to their current system. The new system will be integrated with the new website that Biscuitmedia have been building, which is due for launch in the near future.

 

Community Server 2.0

May 23rd, 2006

Community Server

Spent all day today trying to get Community Server 2.0 to work. I am getting a stupid error message “Could not load type CommunityServer.Components.CSProviderHttpModule from assembly CommunityServer.Components”. I think it is a permissions problem which is stopping the dll from being accessed so if anyone has any ideas let me know.

There is a mystery prize to the genius who can solve this!!

 

Flex 2.0

May 22nd, 2006

Flex 2.0The Steelso has given me the orders to get learning Flex 2.0. We will be using this in the near future for a new clients website. The possibilities of this development tool are very impressive. Lots to learn but the end results will be worth a look.

 

 
  • Glasgow weather

    • Temp: 59°F
    • Wind: SW at 8 mph
    • Dew Point: °F
    • Sunrise: 06:15 BST
    • Sunset: 20:21 BST
    • Gathered at: 03:20 2008-08-28 BST