Thursday, March 13, 2014

SSRS and Numeric Superscripts

They said it couldn't be done. Well I did it.
The below code can be embedded in a SSRS report as custom code. It takes any number and returns the superscript value.

    Function Superscriptify(ByVal number As Integer)
        Dim superscripts As New System.Collections.Generic.Dictionary(Of Integer, Integer)
        superscripts.Add(0, 8304)
        superscripts.Add(1, 185)
        superscripts.Add(2, 178)
        superscripts.Add(3, 179)
        superscripts.Add(4, 8308)
        superscripts.Add(5, 8309)
        superscripts.Add(6, 8310)
        superscripts.Add(7, 8311)
        superscripts.Add(8, 8312)
        superscripts.Add(9, 8313)
        Dim returnString As String = ""
        Do While ((number Mod 10 <> 0) Or (number / 10 > 0))
            Dim remainder As Integer = number Mod 10
            returnString = ChrW(superscripts.Item(remainder)) & returnString
            number = Math.Floor(number / 10)
        Loop
        Return returnString
    End Function


Use as follows (set the expression of a textbox): =Code.Superscriptify(723)
This should result in: 723 

Friday, April 12, 2013

Visual Studio SQL Compare - Cannot Update or Generate Script

Using SQL Compare in Visual Studio is kinda great.

However if you find you cannot generate the change script, or update the database directly after comparing because the Update and Generate Script buttons are greyed-out / disabled (see below), this may be the reason: the version of the .NET framework.



Right-click on the database project, select Properties and go to the SQLCLR tab and change the Target Framework version. 


Wednesday, January 16, 2013

App.Config transforms for non-Web projects

So I was doing a simple winform app for a client today and added an app.config to store the connection strings.
"Hmmm, lemme use this *new* (for me at least) config transform magic", I thought to myself.

Sadly, it only supports web projects (web.config). D'oh!
But no fear, someone out there has bumped up against the same issue. Thanks :)


Thursday, April 5, 2012

Levels of abstraction

I can't honestly say i understood it all, but i liked this:
"To design quickly and confidently, we need to be able to try out ideas and verify hypotheses as fast as we think of them"

That makes sense to me.

Tuesday, June 28, 2011

Page_ClientValidate blocking Submit to server

So I was wanting to do some client-side validation and then call back to the server should the page suddenly have become in/valid, I called Page_ClientValidate from javascript.

This returns a boolean value. It also as a side-affect of setting the Page_BlockSubmit to false should the page is invalid.

Which in turn blocks anything from submitting back to the server.

So to get around this, just set Page_BlockSubmit to false and submitting back to the server works as expected.

Thanks to the forum link!

Friday, November 5, 2010

Goddamn Object not set to an instance...

"Object reference not set to an instance of an object."

I love non-descriptive error messages.
Perhaps a mention of which object is returning the error would be great. It certainly would help.

k'thnx bye

Tuesday, July 13, 2010

CruiseControl and WatiN

Running CruiseControl as a service and wanting to run WatiN web tests?
Ensure ccService is running as a local user who has used IE before.

The other gotcha I found so far was more to do with setting up IIS to run multiple websites on the same port (specifically 80). Ensure that each site has differing Host header values.

Tuesday, June 15, 2010

Linq-To-Sql Sproc Return Type is None

For when the design is being especially useless.

Tuesday, May 25, 2010

Humans fail at being software components

Key from this:

"I presented several characteristics of people that have recognizable effects on methodology design.

The first is that we are sensitive to communication timing and modalities. The prediction is that physical proximity and ease of communication has dominant effect.

The second is that people tend to inconsistency. The prediction is that methodologies requiring disciplined consistency are fragile in practice.

The third is that people vary, not just daily, but from group to group. Methodologies don’t currently, but do need to deal with this cultural variation.

The fourth is that people like to be good citizens, are good at looking around and taking initiative. These combine to form that common success factor, “a few good people stepped in at key moments.”

"

Wednesday, April 21, 2010

ASP .Net Generic Handlers and Session

For session state to be available to a handler, the handler has to implement IReadOnlySessionState (for read-only access) or IRequiresSessionState (for read-write access). For example:

public class MyHandler : IHttpHandler, IRequiresSessionState
{
// ...
}

There are no actual methods to implement for IRequiresSessionState - it is just a "marker" interface that ASP.NET will look for at runtime. If it find the interface it goes to the trouble of making session state available.