I’m confused here…

Posted in Randomness, Teh Funnies by Will on March 18, 2008.

Confused

Two WCF Stumbles

Posted in .NET, Coding, WCF, Work by Will on March 16, 2008.

Here’s two things that caused me a bit of pain when working with WCF. Hopefully these pointers should help you get back to more productive things.

No Output when returning Serialized / Serialised objects.

I had been working on adding a significant number of methods and properties to a series of classes, and when I went to test the service I got literally no output.

Debug points indicated that all properties were there, and valid - but still WCF wasn’t returning anything. There was no exceptions  being returned to the client.

The best tool for debugging these sorts of solutions is to first of all enable Tracing and MessageLogging.  This is done via the WCF Service Configuration Editor, on the Diagnostics tab. 

Once you’ve done that, and re-run the projects - you can open up Service Trace Viewer.  For me under Visual Studio 2008, this was under Microsoft Windows SDK v6.0A > Tools.

image

This tool then lets you open up the trace log generated in your solution directory, and see all the activity that’s been happening.

debugging-wcf-services

From here, it was just a matter of scrolling down to the activity entry that had the yellow hilighting (indicating a warning), selecting it - then clicking on the Errors.

For me, the first time this happened to me, it was because I had stuffed up the DataMember Name values. It has also occurred for other reasons, such as a property not being populated, when I had specified that it was both required, and also that it could not emit a default value.

Can’t get mex to work

No, this isn’t a misguided racial slur. I was having issues setting up the mexHttpBinding on an ASP.NET AJAX WCF Service.

The solutions all point towards the same thing, that you need to set up an endpoint, and set the contract to IMetaDataExchange, then set the behaviour to have <serviceMetadata />. Except that it just wouldn’t let me add that property to my endpoint behaviour, and whenever I changed it to a service behaviour it would then not allow me  to set the other properties I needed for that.

Well, perhaps I’m particularly slow - but hopefully this pointer will help someone else.

1: Create a NEW service behaviour:

<serviceBehaviors>
  <behavior name="MyServiceBehavior">
    <serviceMetadata
      httpGetEnabled="true"/>
    <serviceDebug
     includeExceptionDetailInFaults="true"
     />
  </behavior></serviceBehaviors>

2: Add a new endpoint to your  existing service

<endpoint
   address="mex"
   binding="mexHttpBinding"
   bindingConfiguration=""
   contract="IMetadataExchange" />

3: Add the behaviorConfiguration you added in Step 1 to the Service (NOT the endpoint).

<service
  behaviorConfiguration=”MyServiceBehavior”
  name=”MyProject.MyService”>

I kept trying to add it to the endpoint, and failing miserably. So much time spent back-and-forth on this!

 

That’s it for this instalment of “WCF is great, but I wish the config was a bit easier to understand”. Stay tuned for more exciting episodes!

Shared Windows Server Project

Posted in IT by Will on March 15, 2008.

I’m looking for a few folks to group together to get a dedicated Windows server.

Server Details:

  • CPU: Intel Xeon 3060 (Dual Core)
  • RAM: 2GB
  • HDD: 2x 250GB (not RAID)
  • Network Port: 100Mbit
  • Bandwidth Quota: 2500GB per month
  • OS: Windows Server 2003 R2  (x32)
  • Other Software: .NET 1.1, plus .NET 2.0 to  .NET 3.5.  MS SQL Server 2005 (Express),

The server would be hosted by The Planet (unless you know of a better place?) in the US.

Because there’s 10 IPs allocated, the way I thought it would be set up would be to have one IP for any shared web hosting, etc - plus remote access in. And one IP would be dedicated to a Linux VM Server (for any apache + php + mysql things you want to run).

Then the rest of the IPs would be split up between the  folks sharing the server - for any other things you wanted to do (FTP server,  etc)

Bandwidth, Diskspace and RAM wouldn’t be strictly controlled, but if the performance of the server is suffering, we’re out of disk space, or we’ve got an over-usage charge, then those who’re using far more than their quota will need to pay up (for bandwidth) or reduce their usage (for diskspace and RAM)  

You’d also be expected to know how to use manage IIS properly, and if you’re hosting stuff on the Linux VM, Apache too.  Oh, and also how to use common sense not to stuff with other people’s settings without their OK.

I shouldn’t need to mention this, but you’ll also be responsible for ensuring that you’re not doing anything illegal under US or Australian laws. So - no torrent downloads, thanks.

Total cost per month for the server setup above is USD$230/month. I’m prepared to pay about USD$80/month, so I’m looking for 3-4 people willing to split about USD$150/month.

So, for about $10/month you’d get an allocation of about 100GB of bandwidth quota, and 20GB/disk space (10GB per drive).  IPs would be divvied up based on % of contribution, after I’ve got enough people onboard, but you’d get at least one IP.

So, if you’re interested - add me on MSN - will@hughesfamily.net.au and let me know.

Update: I now have two other people who’re onboard, and another who’s interested…  I need another four people who’re interested in putting in about USD$30/month each.

If that doesn’t happen, then I guess we’ll have to look at trying to get a smaller server, but this is pretty much as small as it gets before things stop being useful.

WCF Service Giving Blank or No Response

Posted in .NET, Coding, IT, LINQ, WCF, Work by Will on March 13, 2008.

Today I spent about half an hour banging my head against this problem:
Whenever I would try and return a business object, I’d simply get no response from my WCF Service. Litterally nothing.

The problem turned out to be that I had accidentally specified the DataMember Name of a property in a sub object twice.

So, I had my broken class set up like:


[DataContract(Name = "MyClass", Namespace = "Example")]
public partial class MyClass
{
[DataMember(Name = "property1")] public int Property1 { get; set; }
[DataMember(Name = "property1")] public string Property2{ get; set; }
}

An instance of this class was used as a property in another object, which was being returned from WCF.

.NET didn’t throw any sort of error unless I tried to return just “MyClass”.

Sure, it was my fault, but if you have a complex data structure, this could get awefully difficult to find without some sort of message from WCF.

Yes, this is part of that ultra nifty WCF JSON .NET 3.5 Flex project at work. :)

LINQ to SQL, WCF, JSON and Flex. Oh My.

Posted in .NET, Coding, IT, LINQ, WCF, Work by Will on March 8, 2008.

(A note to readers: This is all pure geek/coder content - Please skip this if nothing in the subject line makes sense)

I started on a new project at work for a client a bit over a week ago, by virtue of the requirements, we decided to investigate the use of new version of Microsoft’s  .NET Framework, Version 3.5, for all of the server-side services.

Microsoft have been quite strongly pushing the benefits of the new features of .NET 3.5. There’s been a few key features which are particularly interesting, and if all goes according to the marketing hype, should end up saving a huge amount of time and effort, whilst ensuring that we use well known and standardised interfaces.

What features?

Windows Communications Foundation (WCF) is particularly interesting because it promises to let you (mostly) remove the whole ‘how’ and ‘where’ portion of communications between tiers, and let you focus on the ‘what’ and ‘when’.

In essence, WCF should let me state that I want to create (say) a Web Service, that accepts information in format X, and outputs responses in some other format. It doesn’t have to be a Web Service either, it could be a Peer to Peer network speaking in straight binary streams.

For this project the client-functionality is all in Flex, so we need to ensure that the Flex guys can quickly decode all the responses and turn them into Action Script objects. Through a bit of experimenting and application prior experience - Web Services speaking JSON appeared to be the easiest and most light weight method of doing this.

Language Integrated Queries (LINQ) is another particularly interesting technology, particularly because it lets me focus on what I want to do with the data I have, rather than spending time transforming it from the Database tables, rows, and procedures, into .NET objects and methods.

There are a number of implementations of LINQ, which enables you to query a variety of sources - the one that I’m most likely to use is LINQ to SQL (talking to SQL Server). Regardless of what I’m accessing however, the syntax is identical - again, removing the need to modify my code if I need to query an XML file, Oracle or MySQL Database, or even native .NET objects.

You can probably see a common theme here - WCF lets me focus on communication with the outside world without needing to write that interface or conversion functionality, and LINQ lets me access and manipulate data, without needing to write that interface either.

So, it’s all plug and play?

Well, that depends entirely on what you’re doing with your data. If you’ve got something like a CRM application where the client is responsible for managing (most of) the data, then yes it can quite possibly be almost plug and play if you’re going with a “CRUD” interface.

If your data structure is more complex, then you need to determine exactly where the split is. In this specific project, I’m presenting an abstracted view of the data that the client needs, and doing all of the business logic to manage data management in the SQL and Web Services Layer.

So far, the whole WCF and LINQ combination looks good. I’m hoping to post some more detailed posts later on.

Further Reading

I highly recommend Scott Guthrie’s LINQ to SQL series of posts. Start with Part 1: Introduction to LINQ to SQL

These resources have also been of a great help in getting my head around the whole LINQ thing:

Windows Server 2008 as a Desktop OS

Posted in Randomness by Will on March 5, 2008.

Last week I went to Microsoft’s “Heroes Happen {Here} 2008″ launch of the 2008 series of products: Windows Server 2008, SQL Server 2008, and Visual Studio 2008.

As part of the ‘goodies bag’ given away, I got a complementary copy of Windows Server 2008 Enterprise Edition. Having read very good things about it, and being rather impressed - I installed it on my work desktop machine. (Rather risky, I know).

I would highly recommend anyone considering this to read Vijayshinva Karnure’s blog post on how to configure it properly. Once done, it looks and “feels” just like Windows Vista. (Only, significantly faster).

However - the first thing I would recommend you do is to turn off the Enhanced Security settings for Internet Explorer. Microsoft have changed the way this is done from Windows Server 2003, so it can take some hunting to find how to change it.

The frustrating thing is that it’s right infront of you. No, really - The Server Manager console that shows on first login has the option right there, but “helpfully” disguises it in acronym form.

IE ESC

Click on that link, and turn off IE ESC for both Admins and Users.

Update on the ADSL issues

Posted in IT, On the Intertron, Rant by Will on February 27, 2008.

Those following me on Twitter have had the joy of seeing random messages about the ongoing issues I’ve had getting my ADSL2+ connected.

Since the last post on this (on the 13th of Feb) I basicly gave up on calling iiNet - I’d already spent a fortune in mobile costs listening to their hold music, and was just waiting for them to get back to my support-enquiry email. (I never did get a response to that)

However, last Friday (22nd) as I was going to bed at about 1:30am (Okay, so technically Saturday morning) I noticed that my DSL Router was saying it had sync. I normally check the router panel when I get home, so I must’ve missed it that night. I stayed up about an hour setting up a bunch of tests to see how fast/stable the connection was. I left these tests to continue running whilst I slept. When I left home on Saturday at about 9AM it was still running, and I was feeling somewhat optimistic that it might continue to work. Of course, Murphy was listening, and when I got home at around 5pm, I had lost line sync once again.

Sunday I called iiNet again, this time because their Toolbox said there should only be about a 7min wait. The tech guy tried a few things from their end, but once again no success - and said he’d put the request through to their Fault Manager who would try to get VisionStream to narrow down the timeframe.

Come Monday morning, I get a call from Christy at Vision Stream, “Is Wednesday suitable for you?”. Grr. Same situation as last time Christy called me! Looking at the iiNet Toolbox - what do you know, a 45min or so wait on hold, again. Instead of doing that, I try another tact - go straight to the top.

So, I write a pleading email to Michael Malone, the Managing Director of iiNet. He’s quite active on Whirlpool’s forums, and makes his email available there. I give a bunch of possible ways we could try and work together, such as asking for the first/last timeslot on the day, getting a call an hour or two beforehand, and even offering to pay for a Saturday callout if necessary.

Tuesday I get a call from Rebecca at iiNet regarding the email, she’s called VisionStrem and tried getting them to go with any of the options I presented - no luck. I think up one last option - asking the Tech to call me as he’s starting the job before mine. Rebecca thinks it might work, and goes back to VisionStream.

Today, (Wednesday) Rebecca calls back - VisionStream won’t go for it, despite having escalated it up the chain of management there. Apparently VisionStream started quoting sections of the Telecommunications Act to her, and stating that “we treat all customers equally”. However, the VisionStream manager has agreed to commit to a particular timeslot (9AM-12:30PM or 12PM to 6PM), AND to get the Tech to call an hour beforehand.

I ask Rebecca what the chances are of switching to a regular ADSL2 service (and having the line connected as a standard phone again) - apparently it can be done, but I’d be the first to have tried it. And the time it would take would probably be somewhere up around a month, assuming everything went according to play.

So, for now Rebecca is sending the case back to VisionStream, and getting them to commit to providing a 9AM-12:30PM timeslot for this job plus the hour-before call.

Here’s hoping that VisionStream can come through on this!

Side Rant:
VisionStream’s comment to Rebecca that they treat all customers equally, is rather stupid. Yes, they treat all customers equally poorly. VisionStream’s view is apparently that All customers’ time is worth nothing, and they obviously have nothing better to do.

Surely someone at VisionStream can see that doing this just gives them a really poor reputation.

Killing with Kindness

Posted in IT, On the Intertron, Randomness, Teh Funnies by Will on February 14, 2008.

We killed Twitter, again.

This time it was from an excess of Love - Of the less-than-three (”<3") variety.

My screen was filled with hundreds of messages like these two:
Less than Three’s for everyone.

For the non-Twitter’ers out there, the Twitter folks added a way to send a special type of tweet. By entering “@username <3" - it would transform the ordinary tweet, into this special type of message.

It also results in that person getting a "Do you love (sender)?" prompt, with a button to quickly reply.

This novelty, combined with the easy reply, lead to a major increase in the number of Tweets for valentines day, and thus Twitter slowing down / refusing to respond for many people (including me).

Edit: Here's a better screenshot of what was/is going on (read from bottom up)

Less than 3 (more)

Anatomy of an ongoing Disaster

Posted in Randomness, Rant by Will on February 13, 2008.

So, here’s my tale of trying (and so far failing) to get Internet access on at my new apartment.

big_hindenburg_explodes_over_lakehurst

(with apologies to Dreamhost for nicking their headline AND public domain photo)

December 13th: I get the word from the real estate agent that I’ve got the unit. Immediately sign up on the iiNet website for Naked DSL.

December 19th: iiNet respond to my application with the message “Service Address Not Found”.  I contact iiNet and ask what that means, turns out they need a phone number.

December 21-22nd: I move in.

December 24th: I finally go back to my apartment, plug in a phone and find out the number. I give that to iiNet, they re-submit.

December 28th: I get an email from iiNet with “Service Address Not Found” again. I call, they do some quick tests - the number doesn’t show up in their access to Telstra’s provisioning systems.
I call Telstra to get the phone connected, it’ll take several days because as it turns out, it’s on the Optus cable network. Appointment made for January 4th.

January 4th: No Telstra guy.

January 8th: I get a call from a Telstra guy: “Umm,I’m at the premesis now…” me: “Well, you wern’t 4 days ago when I was there…”

January 9th: Telstra call back to reschedule, and say has to be all day. I ask for Saturday timeslot if that’s the case, sure - January 19th. Ugh.

January 19th: Line connected. But after the Tech leaves, I find out the line is a Silent line, and 12722123 to find out my number doesn’t work.

January 21st and 22nd: Too busy at work to call Telstra before their Sales centres close at 5pm.

January 23rd: Call Telstra, get my line number. Go sign up again at iiNet.

January 30th: Email from iiNet: DSL Connection will be on Feb 5th, but I don’t need to be home (because provisioned line).

Feb 5th: No line sync. iiNet connection email says might take a few more days.

Feb 7th: Still no line sync. Call iiNet, on hold for ~30mins (on my mobile) - Guy says it looks like my entire DSLAM is down. But, (good news for me) they work on Saturdays (9th)- so, give a call then or Monday.

Feb 9th: (Still no line sync) Call iiNet, on hold for another 30mins, guy says Telstra have to fix it, and they don’t work on weekends, but should know more Monday (11th)

Feb 11th: (Still no line sync) Call iiNet, on hold for ~45mins. Guy says they’ve added my name to a list to send to Visionstream, and they’ll call to let me know when it’ll be fixed.

Today (Feb 13th): Visionstream calls me at about 10 am  -

VS: “We’re calling to make an appointment for your ADSL Installation”
me: “err.. don’t you mean fault repair?”
VS: “Oh, I don’t know… So, will Friday (15th) be ok?”
me: “Uhm, What time?” 
VS: “You’ll have to be there All day”
me: “Oh, no, that’s really not possible, any chance for a shorter time period?”
VS: “No, sorry - you can leave a key with a friend family member and they can be there instead”
Me: “Err, no, I really can’t.”
VS: “Okay, well, we’ll send this back to iiNet then”
Me: “Fine, I’ll call them” 

I call iiNet, left on hold for 45mins.  I explain the situation,

“Well, you’ll have to be home then”
me: “But I understood the issue to be with your DSLAM, not with my line - everyone else on the exchange was down”.
“No, that’s been rectified, you’ll have to be at home for them to fix the issue”.
me: “Well, that’s just not an option for me at the moment.”
“Let me talk to a senior, see what we can do”
Me: “okay”
(5mins hold)
“We’ll try rebuilding the port, but, that might not help”

I get home tonight, and, well… they’re right, it didn’t help.

So, ~3hrs in total of calls on my mobile, and I’m still no closer to having proper internet access on. I’ve sent a ’support form’ in telling them that if they can’t narrow down the appointment timeslot to 3-4 hours, then just to cancel my account.

I suppose if they go ahead and cancel, I’ll be able to get the line reconnected (and if necessary, do it on a Saturday), then I’ll get normal ADSL2+ with someone else. Which has far less chance of f’cking up.

Seriously sucks.

 

Addendum: I’m not blaming iiNet that they can’t fix something when I’m not home - I’m just saying that the whole process of getting internet access is a disaster. It’s now over 2 months, for something that should have been fairly simple.  If the Telcos stopped playing bullshit politics, we’d all be in a much better situation.

Recipe File: Ginger and Shallot Sauce

Posted in Food by Will on February 10, 2008.

I’ve decided to share a recipe that we’ve been using in our family for years. I don’t know the origins of the sauce, but I believe mum did get it from a friend.  I’ve only rarely seen it in asian restraunts, and usually it’s some variation on the basic sauce.

Typically we have this sauce with steamed chicken, rice, and some sort of steamed asian veggies.  It does have a strong flavour, so it might not be to everyone’s tastes.

Other suggested uses are to add it to a chicken or fish soups, or with noodles. But I’m a fan of the basic chicken and rice addition.

Disambiguation: Shallots, Shallots, or Shallots?

When I say Shallots, I’m referring to the vegetable also known as Scallions, Spring Onions, or Green Onions. And, because that still doesn’t necessarily clarify things, look at the pic on the left. Those are what you need to make this sauce.

Do not, under any circumstances confuse these with French Shallots, which also known as “eschalots” in NSW, Australia. Someone I gave this recipe to once got the two mixed up, and ended up with this godaweful mess with a horrible aftertaste.

 

Ingredients

These are approximates only, please adjust to taste.

  • 1/2 Bunch Shallots (3-4 medium size shoots)
    Washed carefully and trimmed of any roots, dead/dry bits, etc.
  • 1-3 tablespoons of salt (adjust to taste)
    I use rock salt, but ordinary table salt is fine. Especially if you don’t have a good mortar and pestle.
  • 1 ‘knob’ of fresh ginger (not from a jar)
    Aproximately the length of a thumb, peeled.
  • 3-5 tablespoons of good olive oil.
    I use olive oil, others may choose to use another type of oil suitable for salads.

I recommend that you also have a good quality solid stone Mortar and Pestle, however this can be prepared in a food processor, but it does significantly change the look (it goes whiteish due to the air introduced).

Preparation

  1. Trim the shallots (scallions) so that you remove all bar about 5cm of the dark green hollow tops. Discard the tops, keep the bottom of the shoots.
    (We want to keep all of the white, and light green sections - but only a small proportion of the hollow dark green portion)
  2. Slice the shallots finely and place into your mortar or food processor.
    Note: If your mortar and pestle isn’t large enough to hold all of the shallots comfortably at once, you can just add a smaller amount at first and come back later.
  3. Dice the peeled lump of ginger finely, and place about 3/4 into the mortar/food processor.
  4. Add a tablespoon of salt and 2 tablespoons of oil to the mortar/food processor.
  5. Using the pestle, grind/crush/pound the contents of the mortar - or pulse in a food processor - until the shallots and ginger are pulverised.
    Note: When using a food processor, be sure to use quick bursts.
  6. Taste the sauce, and if necessary add more ginger, or salt. and pulverise
    The sauce should definitely be salty, but still allow the flavours of the ginger and shallots to intermingle.
  7. Once to taste, add more oil to ensure there is a good covering.
    Adding more oil will allow you to ‘dilute’ the strong flavour when used on rice/vegetables.

Serve it in a shared bowl on the table, and let people drizzle a small amount on their rice/chicken/etc. Don’t go overboard with the sauce until you’re used to it :)

This sauce can be stored inside a sealed glass jar for several days in the fridge. Don’t use gladwrap/saran wrap to cover, as the flavours/smells will contaminate everything else in the fridge.  Despite how much I like this sauce, Shallot flavoured milk is *not* something you want with your tea/coffee/cereal.

Preparation Time: Approximately 15-20 minutes (about the same amount of time as it takes to cook rice using the Absorbtion method)

Serves: Between 2 and 4 people.

Image Credit: Wikimedia Commons.

Older Entries