Skip navigation

Category Archives: Uncategorized

‘Language is a virus from Outer Space’ – William S. Burroughs

Cosmic dust contains platinum and iridium, in case you should ever need to know. Certain stars are imploding right now, and it looks like rain. I’ll write you again tomorrow. Regards, Gwendolyn (Gwendolyn MacEwen, ‘The Letter’)

So this Christmas I have booked my male in-laws and myself on a Fishing Charter. My brother-in-law, Bruce, asked if I could also book his Dad on the trip. This I did and then sent Bruce a confirmatory email in the imagined style of a Los Angeles Gangsta Rap gang leader:

Hey Bro.
Da Fishkillas da worst gang in da hood round Double 99 has a drive-by planned and we’s welcomin’ your old man Snoop Fishy Fish Killa dats right dose fish with the fake jacks gonna get laid on their backs and I mean real bad.

Approximate Translation:
Bruce’s Dad has also been booked for the fishing charter.

This is how BabelFish saw it when I translated it into German then French then Greek then back to English

Schlechteste Gruppe DA-Fishkillas DA in DA-Haube the worst team DA-Fishkillas in t o n of hood provided that it doubles the 99 that become rond THERE it corrects a opinion d’? a car that passes the dishes and welcomin your old person Schnüffler-fischartigen of fishes Killa dats fishes of dose with that are forged publications of placement that go, that is placed in his backs us receives also I means the bad truth.

- Barra (Floppy Fish Must Die)

I find this screamingly funny. That means I am normal.

It’s always a pleasure to put the boot into New Zealand, so it’s grand to see Sky News Australia giving a cross-Tasman fingers to our cousins in the Woolly Shaky Isles.

Running down the Medal Table in the current Winter Olympics, a graphic was thrown up with Norway, Germany, USA at the top, followed by who knows…Latvia, then skipping to Australia in 18th place with One Gold and One Silver then this entry:

New Zealand 0 0 0

as the super-model newsreader intoned “New Zealand still not yet off the mark.”.

And it’s not as if NZ is short of snow either. Stop admiring the scenery and get mogulling you lazy sods. You’re letting down the Southern Hemisphere…again ;-)

“Some men like it, but Cold Mutton has wrecked many happy homes.”

-Blanche Ebbutt, “Don’ts For Wives”, A&C Black Ltd., London, 1913
ISBN: 9780713687903

Season’s Gruntings.

As Christmas roars toward us I am reminded of the cheapest box of Christmas Cards I ever purchased. I am a cheapskate and love digging around for specials of say 800 Christmas cards for $1.50 – that would be ideal. So I buy such a box and start happily posting them off, admiring their awful quality and designs only tangentially related to Christmas, when one stopped me in my tracks.
The design was a bunch of animals playing in a playground sliding down slippery-dips, bouncing on trampolines etc. There was a Walrus, a Penguin, a Bear and maybe a Fish. It was as if a Birthday card for a two-year old had been mislabelled “Merry Christmas”.

Next day the penny dropped. The animals were all the kinds of animals you would find at the North Pole…where Santa lives…so that was the connection to Christmas. It was a generic “things associated with ice” card.

I am looking for this year’s set which I’m told feature Russian Nuclear Powered Submarines surfing through fields of anchovies.

Merry Christmas!

Blokes and Blokettes:

Here are some questions I was asked by a Consulting company for a mid-level programmer’s position for a .NET C# Web Developer role:

1) Can you have Multiple Inheritance in .NET ? Why did the language designers decide to exclude it?

1a) What is Encapsulation ?
Ans: I gave the classic answer which is that Encapsulation is the OO concept that a class contains both all the data it needs plus all the methods it needs to operate on the data. I was stunned to be told I was incorrect. The interviewer went on to describe what I would call ‘aggregation’. See below.

1 b) As to why Multiple Inheritance is not supported in .NET, here is a great answer from a the Microsoft Architect David Chou, .NET and Multiple Inheritance.

The basic answers are:
- .NET is a multi-language platform. Not all languages can be easily tweaked to support Multiple Inheritance.
- It would decrease cross-language library interoperability via the CLS
- Increases language complexity e.g. resolving inheritance ambiguities e.g classic ‘Diamond Problem’
- Complexity reduces readability and maintainability

AND There is no solution provided by Multiple Inheritance that cannot be solved by other means.

2) How can you simulate Multiple Inheritance in .NET?
Ans: By aggregation. Let’s say you wanted to simulate multiple inheritance of classes B and C into a new class A. What you do is instatiate instances of B and C as nested (inner) classes inside A. Now you have access to all of B and C’s members inside A.

The answer I gave was that Multiple Inheritance can be simulated through implenting multiple interfaces, which has been an acceptable answer elsewhere. This interviewer rejected it saying Interafce implementation is an example of polymorphism, not a way to simulate multiple inheritance.

3) What’s an abstract class ? Compare it to an Interface. Why would you implement an abstract class?
Ans: You would implement an abstract class if you wanted to provide a partial implementation of a class, yet leave some details to the final implementer. e.g. Framework classes are often implemented as Abstract Classes.

4) Let’s say you had a Framework Class (source code not available to you) and you wanted to extend it. How would you do it.
Ans: If Sealed class use Method Extensions

5) Building on the above, what if the class was not sealed and you wanted to implement a method which had an identical name to one in the Framework Class. Assume the original method is NOT virtual. What would you do ?
Ans: Use ‘new’ keyword in the method signature.

6) Let’s say you wanted to provide a new implementation of an existing method and the method is virtual. How would you do it.
Ans: Provide new implementation in sub-class using keyword ‘overrides’

7) Can you instatiate a class with some methods abstract ?
Ans: No. A class with any methods abstract must be marked as abstract and cannot be instantiated.

8. Provide the UML for the following scenario. Demonstrate knowledge of UML for class inheritace, interface implementation, aggregation, association.

9) What is the keyword ‘volatile’ used for ? Surely you want the most recent result available to you at all times. Shouldn’t all variables be marked volatile? Why or why not?

10) What is a delegate ? Provide some examples of how they are used.

11) Write the code that would enable you to update all the TextBoxes situated on a Panel with the data from one row of a GridView when that row is clicked.
Ans: Custom Event and Handler

12) Given a class B which inherits from class B, in which order are the constructors executed if you instantiate an instance of Class B using new B() ?
Ans: A constructor is called first then B’s constructor.

13) What is the effect of compilation debug=true in web.config ?
Ans: Generates debug symbols in pdb file, but also, and this is what he was after, it generates one file per class in the Temporary ASP.NET files folder. In a large project this is a huge amount of disk space consumed and can lead to all your disk space being consumed.

14) What is the effect of selecting ‘Debug’ from the Configuration Manager in Visual Studio.
Ans: They said ‘nothing’. I’m going to have to look this up.
Yeah, so what the guy was getting at is that the Configuration Manager has a ‘Debug’ setting by default, but it doesn’t do anything until you activate it by selecting options that are associated with it. One of those options is compilation options, which you can set to ‘debug’. But just selecting Configuration debug from the drop-down menu doesn’t generate pdb symbols automatically. You have to set up the debug configuration to actually do this.

Other things that a Configuration in Visual Studio can do are described in a book extract here . You can target seperate config files for each Configuration, select a build order for your projects, a different start page for your app, exclude and include different projects in your build and so on.

15) What is ViewState ? What can you do about a page that is heavy on View State ?
Ans: View State allows Web Apps to emulate stateful behaviour. It contains the encrypted value of all ASP server controls on the page and their original values. It can be turned off through control attributes and Page Directives. If ViewState is very heavy you may decide to use HTMLControls. These are not server controls and do not contribute to ViewState. You can also use IIS Compression which reduces Request size by 90% or use custom compression on the request i.e. you implement it say using gzip in the Application-level events.

Since I am too much of a scab to pay WordPress for the use of their blogging site, I am restricted to the functionality of their free version, which does not include polls.

So I’m implementing this as a Thread instead.

Poll: What’s Your Favourite Guid ?

A. 8d3de6d8-df22-4e10-8a19-b30aa044265f
B. 22845c1f-0fe0-46dd-a71d-4f47da37bade
C. 1a1ccc5d-50af-4c80-9d9b-e5b89b620264
D. Other (please specify)

Instructions

Leave a comment with a vote for your favourite Guid. Please also leave a short note explaining why you like that Guid so much.

More Guid Fun

Check out this page! I’m still quivering!

Fellow Job-Seekers:

Here’s what I was asked in a second-stage interview for a C#.NET Intermediate-level contract position for a major software company:

1) What is an Anonymous Method and when would you use it ?
[I didn't know, but mentioned in-line delegates and got points for knowing about those. I said we used it for very simple routines that did not justify a whole method for itself, so can save a few lines of code. They said 'that's fair enough'.
2) What is a nullable type ? Are they useful in method signatures ?
[I said not to use them in method sigs as the consumer will be confused as to whether or not to pass a value or not. Better to have an overloaded method for the null case. Interviewer said this was a good answer.
3) What is the difference between String and StringBuilder ?
4) Since strings are immutable, what is the implication for security e.g Passwords ?
[No idea]
5) A user does not have permissions to access a file? How can you give them those permissions
through .NET ?
[I speculated that CASPOL might do it, then said to use anonymous authetication and set permissions on the folder to the anonymous user. They said no, has to be an authenticated user. I said I would just use Windows and give them permission, then said I don't know how .NET would do it. They said 'Trick Question. It actually can't be done in .NET.]
6) What is Reflection and what’s a use for it ?
7) What does this block of code in LINQ do ?
[It was a simple block that grouped an array of numbers according to the Modulus of 5 (i.e. n % 5) then printed out each group and the numbers in that group.
8) In LINQ what does var signify ?
[My answer: an anonymous type]
9) What is an AsyncCallbackDelegate and when do you use it ?
10) Explain protected, internal, public, private.
11) SQL: What is a clustered index ?
12) SQL: What is a primary key ?
13) SQL: What kind of collection does ADO.NET return from a SELECT statement?
[Ans: Dataset]
14) NUNIT: What class- and method-decoration attributes are available to you and what do they do ?
[I talked about TextFixture, Test, TearDown and SetUp and local Teardown and SetUp]
15) Given this block of code find all the errors and comment on coding style.
[It was a fairly simple FileStream example - unfortunately FileStreams are not my strongest point.]
16) POWERSHELL: What differentiates Powershell from other scripting shells e.g JScript ?
[It returns and processes .NET objects, not text]
17) POWERSHELL: Why is it an advanatge that it doesn’t process text ?
[Text is tedious to Pipe because you have to extract the pieces of information you require by position and length. .NET objects can be processed directly by each chain in the Pipe.]
18) POWERSHELL: What is get-member ? Which .NET technique is it analagous to ?
[Reflection]
19) POWERSHELL: What is where-object ?
20) POWERSHELL: What is format-table ?
21) POWERSHELL: What is get-wmiobject ?
22) What is a WebService? How does it work ?
[Exposure of services to heterogenous systems. SOAP over HTTP]
23) What is WSDL ?
24) What is UDDI ?
25) What is the method GetHashCode in relation to object equivalence? What is it used for ?
[Didn't know this one]
26) What’s the difference beween a.Equals(b) and a == b ?

And So ?
I got most of them and for my reward was required to sit an IKM Knowledge Test. Which I did at Moderate level and got 83 which is 87th percentile all thanks to Google.

So now its up to the reference checks…wish me luck.

Just had a phone interview for a C# Contract position. It was for a major global software company and the client’s objective was merely to screen candidates for a possible second interview face-to-face.

Here is what I was asked:

1) What is IDisposable and what would you use it for ?
2) How do you ensure Thread synchronization ?
3) What are the Sort methods available to you in Generic collections ?
4) Give an example of some C# Attributes ?
5) What is Platform.Invoke used for ?
6) What is Reflection ?
7) How would you implement a Custom Event and its handler ?

Here Are My Answers

1) IDisposable is implemented when you want to provide a deterministic means of freeing resources. Normally you leave this to the Framework Garbage Collector, but sometimes you have resource-intensive classes where you want to explicitly Dispose of resources, so… [Them: That's OK you've got a handle on this]

2) Thread synchronization. Hmmm. Haven’t done many threads, but you want to make sure that variables are not modified haphazardly, so you take out a lock on an arbitrary object and then perform all your processing within that lock. [Them: OK]

3) Sort methods available to you in Generic collections ? Ermmm. Isn’t there ArrayList.Sort ? What else…[Them: That's OK, We just want quick answers]

4) An Attribute can be applied to say whether a class can be Serialized or not, to provide security e.g. to determine whether or not a method can access the File System…[Them: That's fine]

5) Platform.Invoke. [Blank] Sorry that one escapes me. [Them: Its for calling unmanaged code. Me: Oh yeah]

6) Reflection is for inspection the meta-data of Assemblies and classes at run-time. Essentially you do this if you need to discover something at run-time that you didn’t know at compile-time…[Them: Cool. You've got an understanding of that]

7) Writing a CustomEvent and its handler. OK. Let me start with EventArgs. I would declare a Custom EventArgs class, then a Delegate which would take those Args as a parameter and name that delegate. Then… [Them: Fine. You've got a grip on that.]

And then they said “You got a broad range of knowledge of C#.”
I was chuffed.

So now I’m hopeful for a second interview. :-)

Global Economic Turndown

Been looking for a job since I got laid off last Tuesday. Found this one on Seek, Mid-Level C#.NET and PL/SQL which looked alright, so I applied, got a phone call at 3pm asking me to interview at 2pm the following day. Great! An Interview! But only 23 hrs to prepare minus sleep, travel and looking after the kids. Can I possibly revise two entire languages plus humanity’s collective wisdom on Web Development in one day ?

Crammin’

The C# should be alright but I haven’t done any PL/SQL for 2 years. Gawd. How does it work again ??? So I flog Google for Interview Questions and try to bone up on RDBMS basics as well. The known unknowns start to seep back into the frontal cortex from the subterranean layers where I sequestered all the PL/SQL from last time I worked on it. What are the Transaction Isolation Levels again ? How many kinds of Collection classes does PL/SQL have ? What’s an Anonymous Block ? For crying out loud don’t slip up on the C# either. I find Scott Hanselman’s blog article on what he reckons every C# Web Developer should ‘just know’. Hells Bells, it reads like a NASA Specification for a Robot-Controlled Desalination Plant on Mars. I start to realise just how much I don’t know. Am I going to crash and burn ?

Cool it. Just keep revising. Try to prioritize. Forget the DBA related SQL. Strewth, they listed Javascript as the #1 requirement – no time to revise that too – just cover the other stuff. Oh cool, so that’s a REF_CURSOR yeah squirrel that into the memory banks. Forgot the difference between Response.Redirect and Server.Transfer, DECODE and CASE, TRANSLATE and REPLACE, Primary Key and Unique Key, VARCHAR2 and VARCHAR. Not hard though just keep moving.

Interview

So I get to the interview. I’ve been trying to prepare for a set of random questions on anything I may have done for the past three and a half years. It’s a hopeless cause. In the end I just tried to cover the basics so I don’t embarass myself on something straight-forward. I need to get lucky.

Question 1: “Tell Me About Yourself”
Answer: “I’m your typical hyper-motivated genius.”

Question 2: “Given a REF_CURSOR (aargh REF_CURSOR I’m going to burn…) which returns a result set containing R, R’s related tuples X, X’s related tuples Y and Y’s related tuples Z (diagram attached) [I knew it I'm going to crash and burn] all of which can repeat N-times giving an overall result set S, how would you return this result to .NET ?

Answer: [Silence] Ermm. I don’t get what you mean by ‘return it’.

Them: You know. Show it in .NET as a report.
Me: [Report??] Do you mean, what data structure would I use ?
Them: Yes.
Me: DataSet ?
Them: Yes. What else. How would you report the data ?
Me: [Report?? It's just text..A row of TextBoxes?? No. No. Think, Boy] I guess… let’s see. So maybe R is a Student and X is a Course and Y is a Subject and Z is Grades.
Them: Yeah. That’s a practical way of looking at it.
Me: So. Maybe [Taking a Stab] X,Y and Z are DataTables and you use DataRelations to navigate between them.
Them: Yes.
Me: [Jagged It!!!]
Them: Now how will you report it ?
Me: [Report It???] [Light dawns] You mean what kind of .NET control will I use to display it ?
Them: Yes.
Me: [Gold!] Drill-down DataGrid..no too much work.
Them: Drill-down. Not a bad idea.
Me: [I had a good idea? Cool!] Has to be a hierarchical. Use a TreeView.
Them: Yes. Exactly right. Well done.

And That Concluded Festivities

That’s right. Fully two questions.
I had been trying to commit the Ye Olde Encyclopedia Brittanica of Code to memory and they asked me ONE technical question. Freakier than a Fruit Bat at A Cranberry Convention.

Sudden Weird Sensations Of Fear
Catching the train after the interview I was gripped by sudden weird sensations of fear. One technical question. That can’t be right. Maybe they flunked me after one question…no it seems right…But just ONE question…

Well Done Me
They offered me the job!

Acknowledgements
Fruit Bat analogy courtesy of the US Version of ‘Life On Mars’.

Hey cool…

A milestone for Under The Milky Way
Blogotariat just added me to their Blog Roll and subscribed to a feed.
That’s my first one.

I am a Blog. :-)

Follow

Get every new post delivered to your Inbox.