Archive

Posts Tagged ‘Code’

MonoTouch and null

October 6th, 2009 Rev No comments

Remember.  Setting variables to null doesn’t necessarily mean null. I had an Enum variable that I would set once.  So I’d declare it:

Values MyValue = null;

Then, in the natural order of things I’d check to see if it was null and assign it the current value if it was.  But, oddly enough it was never null. I forgot in obj-c (or c in general) unless you specifically set a pointer it’s pointing at god knows what.  So I added a None value to my enum and made sure to set it up as such:

Values MyValue = Values.None;

Whoa, where am I? And MonoTouch!

September 24th, 2009 Rev 2 comments

I really haven’t been updating this very often have I? Probably because I spend so much time fighting with IE.

Just a quick heads up. I’ve talked about Mono in the past. Get your C# app on any platform. Now they’ve released MonoTouch.

MonoTouch allows you to develop iphone apps in you favorite .Net/Mono language and compile it down to run on the iPhone. You can use Xcode’s Interface Builder to edit the views and layout.

When complete your app it just like any other and can be submitted to the App Store.

This is a licensed and for pay tool. But you can download MonoTouch to evaluate and it’d fully functional, save the ability to build to your iphone (You can test in the simulator).

Have a look. I’m porting the app I was previously working on to it and we’ll see how it goes.

Entity + GAC’d Assembly == Hell?!

June 17th, 2009 Rev 1 comment

Okay, so I’m trying to have the .NET conversion of the site at work use Entity for our Data Access Layer. Seems reasonable. I also figure I’ll represent the different silo’s of data (accounts, catalog, etc) into their own Entity Contexts and in their own Assemblies… all under a namespace.. like DAL.Accounts or DAL.Catalogues. So far so good.

Now my thinking goes that I’ll want these accessible by any of the web applications we’ll be creating for the site. And I’ll only want to maintain one copy of the files rather than spread across all the web apps. So clearly I should put the assemblies in the GAC.

First issue comes up is that the default connection string is stored in the app.config file. This isn’t put in the GAC. So, no default connection string. Hrmmm okay…

Well, if I put the appropriate connection string in the web.config of the web app this should suffice. Hrmm stretching a bit.. but okay. Ooop, nope. Not working. Well, perhaps I need to be specific about the assembly name in the reference section of the connection string. Noooo… still hates me. In looking at the documentation is looks like (if I read it correctly) it’s going to search for the resources files in assemblies in every spot BUT the GAC!

Sure, sure… I can create a context and pass the connection string in by hand. okay.. that works. I even created an EntityFactory class in the assembly to pass back a new context… so I don’t have to worry about knowing the connection string. But, I’m faced with the fact that none of the data binding is working.

What am I, or Microsoft, doing wrong here? Clearly one of the two of us is at fault.

IE “Object doesn’t support this action”

March 9th, 2009 Rev 9 comments

I ran into this little bundle of awesome while trying to work with JSON and jQuery. In FireFox (as always) everything worked wonderfully. But as soon as I opened it up in IE it quickly turned into anything Microsoft is involved in, a huge cluster.

After hunting and hunting I found the issue with this bit of javascript:

for(item in ResultsArray.items){….

Turns out in IE ‘item’ is a reserved word. So watch out for that.

Ugg I hate IE. I hate how it makes me scream and complain.

Damn you MS!

Thanks for the pointer from Johannes Fahrenkrug’s site.

Update: this little bit comes from Bill in the comments. Makes a world of difference and no, I hadn’t tried this. =)

for (var item in ResultsArray.items) {….

Note the ‘var’ statement.

The reason I ask is that I use the variable ‘item’ all over in my IE code and never have a problem *unless* I forget to ‘var’ a local variable named ‘item’.

Thanks, Bill.

System.IndexOutOfRangeException: Index was outside the bounds of the array.

March 6th, 2009 Rev 1 comment

Okay, this one made me want to smash my head with a brick.  I’m working along on a web site using C# and ASP.NET 1.1 when I suddenly get this error.  I’m getting a DataTable from a DataSet so it makes sense.

I start by checking the query. Nope, still returns data just fine.  I test and make sure the DataSet isn’t null.  I make sure the table isn’t null.  Nothing seems to be wrong.  So I say, okay, fuck it and I choose a different way of getting my DataTable.  Then suddenly it’s saying assign “” to the value of a string is an array out of bounds exception.

By this time I’m losing my ever loving mind.  Finally I google it up and find that for what ever reason ASP.NET will flag the first line of a method for that exception even though it happens later in the method.

Completely blew my mind. I mean, I had other errors and exceptions come up that pointed to the right line of code.  But not that one.  VERY furstrating.

So, keep an eye out for that one.

Scriptaculous and effect callbacks

March 19th, 2008 Rev 1 comment

Took me a few minutes to figure out why some of my functions weren’t firing in the afterFinish callback function from an Effect. Apparently you can’t access global variables in an Effect callback. I haven’t dug too deeply into this but I sort of assumed it would work since I can access globals on an ajax callback.

Just a heads up if you’re banging your head against a wall.

Tags:

Javascript trim

March 14th, 2008 Rev 1 comment

This is your friend when you need to trim whitespace in javascript:

replace(/^\s*|\s*$/g,”)

Tags: ,

Execution of the ASP page caused the Response Buffer to exceed its configured limit.

August 30th, 2007 Rev 8 comments

Ran into a ticket here at work that had a few people stumped. We were trying to export a report as an Excel file so the user could down load it. This error popped up and long story short I got a ticket to check it out.

I found the answer on ClearGlass.net. Here’s a quick summary of the solution:

Solution:

If you get the above error when you click on an attachment, the attachment is larger than IIS is configured to allow. Change the AspBufferingLimit setting in Metabase.xml to a larger size. The default value is 4194304, which is about 4 MB. Change this to whatever limit is reasonable for the types of files your users will be attaching.

This change does not require stopping IIS, but to make the Metabase.xml file write-able, you need to go to the IIS control panel, right click the server, select properties, and check off the box that says “allow changes to MetaBase configuration while IIS is running”.

Tags: ,

Setting the WiX Product Version number from NaNT

September 6th, 2006 Rev No comments

If you’re setting up your wix install as part of an automated build, with NaNT, here’s a quick way to set the MSI Product Version attribute. In my case I’m having CruiseControl.Net run my builds and so I use this bit of NaNT XML to make sure that the MSI version is the same as the CCNET build version.

<if test="${property::exists('CCNetLabel')}">
<xmlpoke file="${build.rootFolder}\Product.wxs" value="${CCNetLabel}" xpath="/wix:Wix/wix:Product/@Version" verbose="true">
<namespaces>
<namespace prefix="wix" uri="http://schemas.microsoft.com/wix/2003/01/wi"/>
</namespaces>
</xmlpoke>

Tags:

ClickOnce as an install prepatcher

July 10th, 2006 Rev No comments

Researching the idea I wrote about in the last post about having ClickOnce make sure the System Admin Tool and the Installer are up-to-date – a sort of prepatch – I came across the article “Choosing Between ClickOnce and Windows Installer” where in Michael Sanford suggests using both.

I can see how it might be handy to have your install package just lay down a link to the ClickOnce app but I can see how you’ll have more to worry about. What if the “application” includes assemblies that need to be GAC’d or (in the case of my MMC 3.0 assembly) needs to have InstallUtil run against it. Or if it’s a service that needs to be registered.

The other thing I’m concerned about is this post which seems to indicate that we’ll have spring for an Authenticode cert. We already have a VeriSign cert. This is an old blog post so I’ll need to sift through the docs for resolutions or solid facts.

*UPDATE*: Reading this article (which talks about signing your application manifest), mentions that you can use “…a ‘real’ publisher certificate (that is, a Verisign one, or one that your development organization uses signed by some other trusted root authority)…” So it appears Verisign is going to work. One problem down.

I think the article does show that ClickOnce is more of tool in the Release Engineers tool box rather than an entire single path solution. And the way I plan to use it will be just to make sure the install media is up-to-date before being run.

More later

Tags: