<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-27470674</id><updated>2011-11-28T04:16:51.888+02:00</updated><category term='Interop'/><category term='C#'/><category term='PHP'/><category term='800000'/><category term='006080'/><category term='Apache Axis'/><category term='Rants'/><category term='Architecture'/><category term='ff0000'/><category term='Java EE 5'/><category term='administration'/><category term='f4f4f4'/><category term='Music'/><category term='Review'/><category term='Practises'/><category term='0000ff'/><category term='Glassfish'/><category term='Book'/><category term='Java'/><category term='Notice'/><category term='Guitar'/><category term='606060'/><category term='008000'/><title type='text'>The Art of Development</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>55</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-27470674.post-7046505867283183415</id><published>2011-11-11T00:01:00.001+02:00</published><updated>2011-11-11T00:01:18.036+02:00</updated><title type='text'>Google+ C# client</title><content type='html'>&lt;p&gt;After the hackathon, I noticed that the .NET realm is not covered by the current Google+ clients. This prompted me to write a client to facilitate the current APIs. It is strongly typed, easy to use and pretty handy. I have included basic tests to describe it’s usage. Currently it only supports the API Key. Next is the OAuth 2. Check it out if you get a chance &lt;a title="http://ping.fm/X3zd6" href="http://ping.fm/xapV5"&gt;http://ping.fm/BqNtL&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Ciao&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-7046505867283183415?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/7046505867283183415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/11/google-c-client.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7046505867283183415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7046505867283183415'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/11/google-c-client.html' title='Google+ C# client'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-205531763822588216</id><published>2011-11-08T21:09:00.001+02:00</published><updated>2011-11-08T21:09:01.673+02:00</updated><title type='text'>A fool doesnâ€™t learn from his mistakes, a smart man learns from his mistakes and â€¦</title><content type='html'>&lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;a wise man learns from the mistakes of others! &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This is a list of things that I have learnt in my stint in the IT industry. I thought that everyone knew these things but as is often the case we take for granted the knowledge we have gained via experience.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Everyone knows better than you.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This might sound sarcastic but it is not. When you come fresh out of your studies you figure that University or College has prepared you for everything. Every eventuality, every possible problem until you walk into your first job. What you fail to realise is that while studying you have been given the perfect environment to build programs. You are the only person responsible for your projects. Things can be configured and set up as you please (unless the&amp;#160; assignment stipulates otherwise). Finally you never have to worry about the bottom line. By the bottom line I mean money. Sure you have to worry about marks but see how confident you are to make tough decisions that affect a companies bottom line. Listen to your peers, interact with them, make suggestions but be prepared to be corrected. You might very well have a good idea but it doesn’t fit the business problem. On the other hand you might have an idea that solves the problem. Business software development is a team effort. Be part of the team.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Learn when to keep quiet.&lt;/strong&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Your opinion counts. Really it does. When you express it is a different story. There are times to speak and times to keep quiet. If you are not sure whether it is time to speak or time to be quiet then it is probably best to be quiet. Don’t be afraid to speak though but before you speak, formulate your questions. Think about what you want to say and what you are trying to get answered. When you do speak make it concise and to the point. Leave no room for ambiguity. Don’t ramble or speak for the sake of speaking. Nothing turns people of your statement, no matter how smart it is, quick than rambling or disjointed statements. I often remind myself “Light travels quicker than sound. That is why people appear intelligent until they open their mouths”.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Don’t get precious about your project.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This does not mean that you are to take no pride in your work! What this does mean however, is don’t get so attached to what you have done that you refuse to improve it because it wasn’t your idea. Perfection is obtained through iteration. Nothing screams insecurity more than an individual who gets defensive about their code. Never forget that a software project is a strange beast, it can turn at the drop of a hat, hence all the agile methodologies now prevailing. These are not fancy management techniques but techniques put in place to help negate the dynamic nature of business and the rigged nature of software development. If you believe you are right, converse with the individual claiming there is a better way to do it. Perhaps they might educate or their reasoning might illuminate and angle you never thought of. Then again, you might very well educate the individual point what they believe to be a problem out.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Be professional.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Ok seriously. We have been potty trained. All of us. We have all figure we were old enough to rule the world and we most definitely thought we knew everything at some stage or another. That being said, why is it that when we first walk into the work place we become a bunch of snivelling cry babies? If faced with a difficult situation, evaluate it. Don’t throw a temper tantrum when you don’t get your way. Always remember that your employer is your client. You are a service provider, nothing more, nothing less. Do you job and do it well. If faced with a difficult situation tackle it. This is not only in the code base but also interpersonal relationships. If you have a problem with a fellow employee resolve it amicably. You guys, after all, are going to be spending a significant amount of time together. Deliver what you commit to delivering. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Be disciplined with your work. Check it before you submit it. Proof read the document before you submit it. Take pride in your project. The reason I said project as opposed to work is because their is nothing stopping you from continually checking the quality of the project. If you are a more experienced developer and you identify issues don’t just bounce it back to the developer. Take them time to help them fix. I have noticed that a significant amount of errors are due to a lack of understanding as opposed to laziness or stupidity. In this dog eat do world we have created we forget that we should carry the weak. Enable someone not to make the same mistake again, actively promote developer growth and maturing as opposed to bullying. The sooner they can do your job, the sooner your work load can be lightened.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;You going to have to wipe your own bum.&lt;/strong&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I cannot tell you how often I have seen (and yes been one of them) guys sitting in their office fuming at the fact that they can’t do things better because their managers won’t let them. Remember that your working environment and your perception of it, rests completely in your court. If there is something you want changed and it doesn’t go against company regulations then change it. If you think there is something that will fix your development cycles and the risk is minimal to the project, change it. If there is a piece of code that you know can be better, or a piece of refactoring that would remove duplication without bubbling significant issues up the code chain then do it. Don’t expect your managers to hold your hands with everything. Be proactive. Identify issues and figure out how to solve them. There is nothing worse than someone that continually points out problems without a way to fix them. If you put yourself out there and make yourself noticed people will take notice. Don’t sit back and wait for things to happen. If you can improve things then do it. Just don’t step on toes or hurt people doing it. Hurting someone does not imply that you should not be honest with them. It implies that you should not be dishonest with them.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Fill the gaps you identify.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If you notice a gap, fill it. If you can assume a little more responsibility for the benefit of the team then do it. If the leadership needs help then provide it. Don’t just do what you told, do what you see is not getting done. Before you get all mad just take a minute and think about it. This statements does not mean working yourself to the bone. It means that if you can take up a little slack then do it.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;It is a team effort.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt; As software development has matured so have it’s processes and methodologies. That being said, a significant number of old stable teams have been using a form of Agile before it became a catch phrase. Old stable teams have worked past all their teething issues. They have identified the optimal communication mechanism that they should use when addressing their team mates. They understand (you need to understand this so read it again if you have to) that the delivery of a section of the project is not the goal. It doesn’t matter how fantastic their piece of code is. If the project fails then the team has failed. Period. If your team does not produce the end result you have failed. Yes, don’t argue, no excuse, I don’t want to hear you did everything you were supposed to, you failed. End of story.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Be low maintenance.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;By this I mean that you should be fluid. Adapt to your environments and situations. Look for ways to best fit in. Be a problem solver. Even if your solution is the best one, try and help. Refer to the first point though. There are ways to communicate your ideas without screaming and making a fuss. Don’t whine about things that annoy you, fix them or suggest ways to fix them.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Business is right.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Yes it is. Sure they know nothing technically but I got bad news for you. If business doesn’t make money, neither do you. As opposed to fighting business become an ally. Facilitate their requirements, even if they seem absurd. This doesn’t mean that they should dictate implementations or technology spaces. This just means that if they request a change then best we perform it. If they request a feature then best we create it. Business is an extremely competitive industry. Being first to market means a competitive edge. The more money business makes, the longer we get to keep our jobs. Lets work with them. The more flexible we are, I have seen this, the more flexible and understanding business becomes.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Get to know the network engineers.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This is something I learned very quickly because I used to be one of those guys. People, for some reason, see network and infrastructure engineers as the plumbers of the IT world. This could not be further from the truth. Remember that the machine you are working on, the telephone you use, the server you hosting on, the network transmitting all your data is because of these guys. If anything ever goes wrong you going to need them to help you fix it. If you are certain there is an issue with the network then take as much data as you can to the network guys so they can diagnose the problem quicker. It is absolutely incredible how busy they can become when you need them if you have been off towards them. I also find that network engineers are generally the funniest and comedic of any division in the IT industry. If you ever need a laugh, go chat to your network engineers.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I am sure there are more but this is all I can think of at this time. The reason I raised this is due to a discussion we had in the office today. If you want top excel then don’t be afraid to stand up and be counted. Fail fast, that way you can move onto the next thing. I have noticed that companies promote initiative even if the answer is not 100% correct. Believe in what you are saying, if you don’t then don’t put it out there. If you put your ideas out there expect them to get cut off. Be prepared to defend them but never defend them subjectively or emotional. Always back your statements up with facts or experience. If your idea doesn’t get accepted then don’t get down or think no one loves you. One day, grasshopper, you will have an idea that everyone loves.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you don’t agree with the points above you will one day &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles4F28FCA/wlEmoticon-winkingsmile%5B2%5D.png" /&gt; As I always say, I am always right, most of the time.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-205531763822588216?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/205531763822588216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/11/fool-doesnat-learn-from-his-mistakes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/205531763822588216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/205531763822588216'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/11/fool-doesnat-learn-from-his-mistakes.html' title='A fool doesnâ€™t learn from his mistakes, a smart man learns from his mistakes and â€¦'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-2767345694840809145</id><published>2011-11-05T00:50:00.001+02:00</published><updated>2011-11-05T00:50:39.464+02:00</updated><title type='text'>Google South Africa 2011â€“Developers day</title><content type='html'>&lt;p&gt;Well after the experience of the hackathon I would be lying if I said I wasn’t nervous about attending the developers day. I decided to go anyways and give Google a chance to redeem themselves.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;well the day didn’t start off very well although the venue was superb. The keynote address was nothing short of uninspiring. The next segment regarding Android development was just as uninspiring. Being at a developers day I was expecting a slightly more in depth presentation regarding Android and not the usual stuff you can pick up anywhere on Google. After the first presentation I decided I was going to ditch the Android track and proceeded to the Google Application Engine (GAE) presentation, hoping things would get better but not expecting it to.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Well I was wrong! The Google Application Engine presentation was superb. Opening my eyes to a span of horizons regarding the technology (which I am not going to get into now). With a smile on my face I proceeded to the next mobile presentation which covered some stats. The audience asked some absurd questions that took up&amp;#160; most of the presentation so I don’t think the speaker got to finish. I will get back to the questions in a second.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Once he completed his segment we started a code lab using HTML 5 and Google Chrome. YAY! Finally get to do some coding! It was super cool to code along to the presentation and watch the project start taking shape. At the end of the presentation we could finish the application and submit it. By submitting it we would put ourselves in line to win a Samsung Galaxy Ace (S5830). I proceed to keep my head down and complete the project.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Will working on the lab, the presentations continued around Google+ (eish) and some start up support project that Google is running with interviews and some inspiration stuff for those that are interested in starting their own business. Having tried this and failed miserably (due to some bad decisions on my part), I am fully aware of the pitfalls and pointers that these individuals were giving so I listened with half an ear. They have some fantastic ideas though, I am looking forward to seeing them come to fruition.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Anyways I carried on with the lab and finally finished it. Sitting around a friend of mine asked if I had submitted it for review. This was 20 minutes before the deadline! So I rushed off and had the guys have a look at the lab and they signed it off. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Anyways we got to the prize giving and two individuals grabbed what appeared to be two Samsung Galaxy S2 devices. Very cool! Then came the announcement for the winner of the Samsung Galaxy Ace. After going through the process of eliminating contenders, by God’s grace alone, I was chosen as the winner. I gladly accepted the prize but was then asked to demo the lab! I am not much of a public speaker, especially if I am unprepared but I did it anyway. I am not sure the audience understood what I was saying while running through the lab application but at least the one liner at the end got a bit of a chuckle. Oh and for the record, to all you Microsoft haters out there, my code lab was completed using Visual Studio 2010 and hosted on IIS 7.5. So there! Microsoft tools can also get the job done! The right tool for the job.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So all in all, the day was a success. Some surprises as to offerings by Google, who seem to also be adopting a cloud service offering and some really cool education regarding HTML 5&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Thanks Google, for the time, the presentations and the prize. Only piece of advice I have is to perhaps include more labs, less rushed time slots and a little more food at lunch time &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles4AC543/wlEmoticon-smile%5B2%5D.png" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;As for the audience, I urge you to please formulate your thoughts before asking a question. Babbling along trying to create a question and sound intelligent at the same time just puts people to sleep. Make the question short and too the point. Give the speaker the opportunity to respond and leave it at that. Do not engage in a conversation with the individual, it is just rude and inconsiderate to the rest of the audience, if you want to explore your questions more in depth take it offline. Probably the most embarrassing moments for me (as a South African) was the questions around “What Google is going to do for the poor with regard to giving them mobile devices” and then the question regarding what Google was going to do about the fact that a 2 year old device wasn’t going to run the Android Ice Cream Sandwich (Android 4). Lets be honest here, 2 years in the technology space is a long time. I hate to admit it but it is. I also get upset with the fact that we toss out hardware like toilet paper but we cannot expect Google to make sure their Android OS is backwards compatible with the plethora of hardware vendors previous devices. Sure this was a Google Nexus device but let also not kid ourselves as to the maturity of the Android OS. It is a relatively new OS in the grand scheme of things and unfortunately if we are going to be early adopters these are the prices we are going to pay. Perhaps what we should do is petition the device manufacturers to work more closely together with Google.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Another thing to remember is that the more backwards compatible a piece of software is, the more bloated it will become. In the mobile space you cannot afford bloat. A mobile OS needs to be lean and tight. Doing only what it absolutely has to. With limited power we cannot go overboard the way we do with our personal computers. (This includes Mac)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Well I think I have pretty much covered everything and the next time I will 1) Prepare something for the Hackathon and 2) definitely attend the next developer day.Time to see if I can get a Microsoft developer day in somewhere as well &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles4AC543/wlEmoticon-smile%5B2%5D.png" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Thanks again to everyone that made today what it was and I enjoyed meeting those that I did and those that I didn’t, well maybe next time &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles4AC543/wlEmoticon-smile%5B2%5D.png" /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-2767345694840809145?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/2767345694840809145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/11/google-south-africa-2011adevelopers-day.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/2767345694840809145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/2767345694840809145'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/11/google-south-africa-2011adevelopers-day.html' title='Google South Africa 2011â€“Developers day'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-5800719813694355184</id><published>2011-11-02T22:20:00.001+02:00</published><updated>2011-11-02T22:20:55.726+02:00</updated><title type='text'>Google Hackathon South Africa 2011â€“Why Facebook will pwn Google+</title><content type='html'>&lt;p&gt;Well I must honestly say I was very disappointed. Perhaps I expected to much or didn’t know what a hackathon is about but I didn’t picture it being what happened today.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;From wikipedia:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;“A &lt;b&gt;hackathon&lt;/b&gt;, a &lt;/em&gt;&lt;a href="http://ping.fm/8SPHK"&gt;&lt;em&gt;hacker&lt;/em&gt;&lt;/a&gt;&lt;em&gt; &lt;/em&gt;&lt;a href="http://ping.fm/99O6B"&gt;&lt;em&gt;neologism&lt;/em&gt;&lt;/a&gt;&lt;em&gt;, is an event when &lt;/em&gt;&lt;a href="http://ping.fm/fQSr9"&gt;&lt;em&gt;programmers&lt;/em&gt;&lt;/a&gt;&lt;em&gt; meet to do &lt;/em&gt;&lt;a href="http://ping.fm/vvXBz"&gt;&lt;em&gt;collaborative&lt;/em&gt;&lt;/a&gt;&lt;em&gt; &lt;/em&gt;&lt;a href="http://ping.fm/lmxaA"&gt;&lt;em&gt;computer programming&lt;/em&gt;&lt;/a&gt;&lt;em&gt;. The spirit of a hackathon is to collaboratively build programs and applications. Hackathons are typically between several days and a week in length. A hackathon refers not simply to one time hacks, but to a specific time when many people come together to hack on what they want to, how they want to - with little to no restrictions on direction or goal of the programming.” &lt;/em&gt;&lt;a title="http://ping.fm/atn0K" href="http://ping.fm/4TwJP"&gt;http://ping.fm/XPwG6&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Let me walk you through the day. We got there and made ourselves comfortable. It was hosted at Wits university and the venue seemed pretty impressive and I prepared for a good time with like minded people. Then it started. First we got a presentation from one of the GTUG members (Google Technical User Group or something). The presentation made me feel like I was back in high school being subjected to an English speech that was not prepared before hand.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Then we moved on to a video call from one of the Google developers in the UK or somewhere. Myself and others spent most of the time lip reading what the guy was saying as we couldn’t hear anything! So you sit wondering what you missing and people started getting distracted and then the whispering and conversations start. Things are going down hill fast. Video call ends and then we move on.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Next we get what can only be described as a whirl wind trip through using OpenAuth presented in Ruby. I still cannot remember anything from the explanation other than the individual presenting was a Ruby expert of sorts.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Moving one we were issued with the orders to build something using the Google+ API. Cool! Lets get cracking. Start investigating the Google+ API and get the fright of my life. The API only supports read requests. I kid you not, the social application said to be Facebook’s major competitor only has read access via the API. WHAT! So I mean really how hard can it be to make an HTTP request, receive a JSON formatted response and render that data. This is where things get really interesting.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I was under the impression that a hackathon was an event where everyone starts from scratch and starts nailing things together. How wrong I was. It seems that terms in the software industry are nothing more than marketing hype. Upon beginning development I started noticing that groups were getting ready to deploy their applications. What is going on here? Well it seems that there where a few groups who had actually developed their applications prior to the “hackathon” and merely brought them along to present. Now, again, I am not sure if I am just the idiot, but I am certain the title of the event was hackathon not exhibition?&amp;#160; The event then proceeded to run an hour over time with myself and a few others extremely disillusioned about the entire event. Towards the end of the day I couldn’t help but look forward to being told the day was over so I could go home.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Sorry Google but I think you missed the mark with this one. Your Google+ API is wafer thin and offers nothing. If you are hoping to regain the traction you initially had I would recommend you start allowing developers to push and pull data from different applications and platforms. There is nothing that separates your social network site from Facebook and by virtue of the fact that the majority of the market is on Facebook, you really need to give people a reason to use Google+. I signed up for it with great expectations when it became available. Since then my usage has steadily decreased to next to nothing.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;That being said, I am really hoping that the developers conference on Friday makes up for today because today was truly disappointing. That being said, the gapping holes in the API and client interfaces has given me an idea for a new open source project.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-5800719813694355184?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/5800719813694355184/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/11/google-hackathon-south-africa-2011awhy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/5800719813694355184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/5800719813694355184'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/11/google-hackathon-south-africa-2011awhy.html' title='Google Hackathon South Africa 2011â€“Why Facebook will pwn Google+'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-1913401190047546554</id><published>2011-10-06T23:51:00.001+02:00</published><updated>2011-10-06T23:51:51.183+02:00</updated><title type='text'>Jenkins, Glassfish 3 and Windows 2008 R2</title><content type='html'>&lt;p&gt;Right lets get cracking. First thing you going to want to do is grab the Jenkins files available at &lt;a title="http://mirrors.jenkins-ci.org/" href="http://mirrors.jenkins-ci.org/"&gt;http://mirrors.jenkins-ci.org/&lt;/a&gt;. Select the package you looking for. The WAR file is the web application deployable to containers such as Tomcat or Glassfish. There is also a standalone version but seeing as I want to brush up my Glassfish skills I decided to grab the WAR file.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Now this is were I generally start getting extremely nervous. In my experience, deploying these things on app servers is always a nightmare requiring tweaking and additional work. So here we go.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In the Glassfish administration console, select the applications link. This will give you a list of currently deployed applications on the server. Right now I have zero &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles965736/wlEmoticon-smile%5B2%5D.png" /&gt; So, select the deploy button on the grid header, select the browse button and navigate to your jenkins.war file.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Once you have done all this you will notice that Glassfish has conveniently detected that it is a web application, suggested a context root and an application name. Select the the item “server” in the virtual servers list and make sure “Enabled” is checked. Proceed to select anything else you want the server to handle. I just want to get this deployed so I am going to keep it minimal. Once you are satisfied click the “OK” button on the bottom right of the page. I was pleasantly suppressed to see that the deployment went off with out a hitch! If successful you will be returned to the Applications list with jenkins listed there now. On the right of the grid you will see links to perform actions. Select the “Launch” link. This will take you to a web page giving you the URL for the http location and the https location.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Click the link you want and wait for jenkins to perform it’s initial operations. If all goes well, you will be presented with the dashboard to perform your configuration and maintenance.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Just as a side note, having been involved with Glassfish 1 and 2 then slacking off during development of 3 I must admit that the level of the application server has increased significantly! I am very impressed at how the admin UI has been fixed and the ease of use and deployment. Hats off to the development team.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Oh, just as point, for those that think they have to go buy super powered machines, this box is running 1GB RAM with one of the first AMD 64 bit processors and runs fine, so now need to empty the wallet just yet &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles965736/wlEmoticon-smile%5B2%5D.png" /&gt; Bear in mind that this is a personal machine so it isn’t subject to huge loads. Will do some stress testing and see where it gets me.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Other than that, have fun!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-1913401190047546554?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/1913401190047546554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/10/jenkins-glassfish-3-and-windows-2008-r2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1913401190047546554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1913401190047546554'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/10/jenkins-glassfish-3-and-windows-2008-r2.html' title='Jenkins, Glassfish 3 and Windows 2008 R2'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-4548787830948281921</id><published>2011-10-06T23:28:00.001+02:00</published><updated>2011-10-06T23:28:08.420+02:00</updated><title type='text'>Glassfish 3 on Windows Server 2008 R2</title><content type='html'>&lt;p&gt;First things first. Lets get the downloads out the way.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Go grab java 7 from &lt;a title="http://www.oracle.com/technetwork/java/javase/downloads/index.html" href="http://www.oracle.com/technetwork/java/javase/downloads/index.html"&gt;http://www.oracle.com/technetwork/java/javase/downloads/index.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Then go and grab Glassfish 3 from &lt;a title="http://glassfish.java.net/public/downloadsindex.html#top" href="http://glassfish.java.net/public/downloadsindex.html#top"&gt;http://glassfish.java.net/public/downloadsindex.html#top&lt;/a&gt; (I went with the open source edition)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Install Java 7 (you only need to do this if you don’t have a JRE 6 or higher). Then you need to install Glassfish. Follow the prompts. I left the installation location the same (c:glassfish3).&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Next thing you need to do is navigate to c:glassfish3bin. I had to open the asadmin.bat file and edit it. I had to change all virtual references to physical references (perhaps because the environment variables hadn’t been set yet)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Next thing, open a command prompt and navigate to c:glassfish3bin. We are going to create a domain now, you can do this by entering the command asadmin create-domain. This will walk you through the domain creation process. Once that is done you can run the command asadmin start-domain. To verify that the domain has started navigate &lt;a href="http://localhost:4848"&gt;http://localhost:4848&lt;/a&gt; (or change the port to the admin port you stipulated). If you see the admin console everything is running 100%&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Next post I am going to explore deploying Jenkins &lt;a title="http://jenkins-ci.org/" href="http://jenkins-ci.org/"&gt;http://jenkins-ci.org/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;References:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://glassfish.java.net/public/downloadsindex.html#top" href="http://glassfish.java.net/public/downloadsindex.html#top"&gt;http://glassfish.java.net/public/downloadsindex.html#top&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.eteration.com/blog/?p=494" href="http://blogs.eteration.com/blog/?p=494"&gt;http://blogs.eteration.com/blog/?p=494&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.oracle.com/technetwork/java/javase/downloads/index.html" href="http://www.oracle.com/technetwork/java/javase/downloads/index.html"&gt;http://www.oracle.com/technetwork/java/javase/downloads/index.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="file:///C:/glassfish3/glassfish/docs/quickstart.html" href="file:///C:/glassfish3/glassfish/docs/quickstart.html"&gt;file:///C:/glassfish3/glassfish/docs/quickstart.html&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-4548787830948281921?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/4548787830948281921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/10/glassfish-3-on-windows-server-2008-r2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/4548787830948281921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/4548787830948281921'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/10/glassfish-3-on-windows-server-2008-r2.html' title='Glassfish 3 on Windows Server 2008 R2'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-7571395442893500635</id><published>2011-09-27T18:16:00.001+02:00</published><updated>2011-09-27T18:16:28.250+02:00</updated><title type='text'>SOAP Message validation in WCF</title><content type='html'>&lt;p&gt;Well, after a bit more research it seems that Microsoft does support validating outgoing messages. It still doesn’t resolve the issues in my post (&lt;a title="http://kenneth.gotcheese.co.za/post/Microsoft-cannot-stop-being-a-rebel.aspx" href="http://kenneth.gotcheese.co.za/post/Microsoft-cannot-stop-being-a-rebel.aspx"&gt;http://kenneth.gotcheese.co.za/post/Microsoft-cannot-stop-being-a-rebel.aspx&lt;/a&gt;) but does answer where Microsoft feels any validation should be done regarding SOAP. On one hand I agree with them but on the other I disagree. They allow for the INotify property if you enable data binding but they can’t enable the max length on field? Strange I know but I suppose they have their reasons!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Anyways, you are able to validate the outgoing message against the declaring XSD. Again this sounds fine but has a few issues, namely those around exposing the XSDs for public consumption. I suppose you could get round this via HTTP authentication but that means you have to push authentication backwards and forwards. The other option is to distribute the XSDs with the client proxies. I see that the Service Reference created in Visual Studio 2010 does exactly this (after rewriting your XSDs for you &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles1D2F1D6/wlEmoticon-smile%5B2%5D.png" /&gt;).&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;To perform the validation you need to first create a client message inspector that implements the IClientMessageInspector.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Something like this:&lt;/p&gt;  &lt;pre class="brush: js;"&gt;public class MessageInspector : IClientMessageInspector&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Once you have done that you need to implement the relevant methods (those that the interface declares).&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The method we are going to focus on is the BeforeSendRequest method. In this method we will perform the validation using the XSD for the message. What you will need to do is check that the Message object is not a fault. If it is a fault return at this point. Next you want to get the Body of the Envelope. This can be achieved by calling GetReaderAtBodyContents()&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: js;"&gt;var bodyReader = message.GetReaderAtBodyContents();&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Next you going to need to get the XSD for your message. This might prove tricky if you have not got a naming convention that can be used to derive the name of the XSD. A way around this might be to load up the locations of the XSDs into a dictionary (perhaps even load all the XSD Schemas into that list so you can look it up via targetNamespace) but that I will leave to your imagination.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Once you have the body contents you open up the XSD file, load it into an XmlReader and read the XML document. If any errors occur, the callback method attached to the XmlReaderSettings.ValidationErrorHandler will be called.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;First we configure the XmlReaderSettings:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: js;"&gt;var xsdPath = &amp;quot;pathtoyourfile.xsd;&lt;br /&gt;&lt;br /&gt;using (var stream = File.OpenRead(xsdPath)) {&lt;br /&gt;&lt;br /&gt;   var schemaReader = XmlReader.Create(stream);&lt;br /&gt;&lt;br /&gt;   var readerSettings = new XmlReaderSettings&lt;br /&gt;                              {&lt;br /&gt;                                     CloseInput = true,&lt;br /&gt;                                     Schemas = new XmlSchemaSet(),&lt;br /&gt;                                     ValidationFlags = XmlSchemaValidationFlags.None,&lt;br /&gt;                                     ValidationType = ValidationType.Schema&lt;br /&gt;                              };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   readerSettings.Schemas.Add(&amp;quot;http://yournamespacehere.com&amp;quot;, schemaReader);&lt;br /&gt;   readerSettings.Schemas.Compile();&lt;br /&gt;&lt;br /&gt;    //Attach to error event handler&lt;br /&gt;   readerSettings.ValidationEventHandler += new ValidationEventHandler(InspectionValidationHandler);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Then to validate the document you create an instance of a reader, attach the reader settings and read the document like so:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: js;"&gt;var wrappedReader = XmlReader.Create(bodyReader, readerSettings);&lt;br /&gt;&lt;br /&gt;var startDepth = wrappedReader.Depth;&lt;br /&gt;&lt;br /&gt;while (wrappedReader.Read())&lt;br /&gt;{&lt;br /&gt;      if (wrappedReader.Depth == startDepth &amp;amp;&amp;amp; wrappedReader.NodeType == XmlNodeType.EndElement)&lt;br /&gt;      {&lt;br /&gt;             break;&lt;br /&gt;      }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If there are any errors in the document they will be raised while reading and pushed to the callback handler.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;For more information one solving this problem check out the references I found while solving it:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms734675.aspx"&gt;&lt;em&gt;http://msdn.microsoft.com/en-us/library/ms734675.aspx&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa717047.aspx"&gt;&lt;em&gt;http://msdn.microsoft.com/en-us/library/aa717047.aspx&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.message.properties.aspx"&gt;&lt;em&gt;http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.message.properties.aspx&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms255932(v=vs.80).aspx"&gt;&lt;em&gt;http://msdn.microsoft.com/en-us/library/ms255932(v=vs.80).aspx&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a href="http://stackoverflow.com/questions/2157325/how-to-find-restriction-values-in-a-simple-xsd-element-with-c"&gt;&lt;em&gt;http://stackoverflow.com/questions/2157325/how-to-find-restriction-values-in-a-simple-xsd-element-with-c&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.iclientmessageinspector.beforesendrequest.aspx"&gt;&lt;em&gt;http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.iclientmessageinspector.beforesendrequest.aspx&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms950778.aspx"&gt;&lt;em&gt;http://msdn.microsoft.com/en-us/library/ms950778.aspx&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a href="http://stackoverflow.com/questions/751511/validating-an-xml-against-referenced-xsd-in-c"&gt;&lt;em&gt;http://stackoverflow.com/questions/751511/validating-an-xml-against-referenced-xsd-in-c&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a href="http://blog.leekelleher.com/2009/02/23/convert-xmlreader-to-string/"&gt;&lt;em&gt;http://blog.leekelleher.com/2009/02/23/convert-xmlreader-to-string/&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a href="http://stackoverflow.com/questions/5858486/error-validating-message-body"&gt;&lt;em&gt;http://stackoverflow.com/questions/5858486/error-validating-message-body&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-7571395442893500635?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/7571395442893500635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/soap-message-validation-in-wcf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7571395442893500635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7571395442893500635'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/soap-message-validation-in-wcf.html' title='SOAP Message validation in WCF'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-2195684551636753989</id><published>2011-09-27T10:35:00.001+02:00</published><updated>2011-09-27T10:35:18.604+02:00</updated><title type='text'>Microsoft cannot stop being a rebel.</title><content type='html'>&lt;p&gt;Well they have done it once again. Microsoft has never been know to conform to what the world of software engineering classes as best practises. They are also known not to confirm to widely published standards.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This is true in their Internet Explorer browser (although with the new versions they seem to be getting there) and other products. Yes I know that is how they make money but it is also the way they are losing a great deal of potential customers.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I was investigating the SvcUtil tool earlier and was asked to figure out how to enforce the declarations in the XSD limiting the length of string values. Now it would make sense for a client to support this right? Well not according to Microsoft. The XSD.exe utility also doesn’t support doing this.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The ONLY reason I can figure Microsoft didn’t do this is because they believe that the service should truncate and enforce the maximum lengths of the strings being supplied. While this might have you nodding your head going “ah yes, well then they have a valid point” my next question to you is, why is that valid?&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Sure the contract needs to be enforced on the server side, that is a given. If it is not enforced on the server side it is not really a contract is it? However, does this mean that we should allow huge sets of string data to be transmitted if the first 250 characters are going to be consumed? I don’t think that is viable as you are polluting a call that was probably designed to be as efficient as possible. Still not convinced?&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Well let me throw it back to the consumer or client. If you are generating a client for a web service and you have not explicitly checked the XSD will you be aware of the restrictions? Well you won’t if you haven’t checked it. Then next thing is this. If the validation of those maximum lengths has fallen to the client to verify, how are you going to do that? How are you going to know that string you are submitting must only be a length of 200 characters? The only way you can do this is to verify that the restriction exists inside the XSD and then implement some sort of check on the field with a message letting you if the max length is exceeded.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;While this might seem like a viable solution, I am incline to disagree. There is a significant amount of work attached to doing this and if the contract should change for what ever reason, you will have to go back and find all the places you have implemented this.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I will be contacting Microsoft with regard to this and try and figure out their thinking behind it and if there is a road map to fix it. Until then, if you have any ideas or suggestions please let me know.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-2195684551636753989?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/2195684551636753989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/microsoft-cannot-stop-being-rebel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/2195684551636753989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/2195684551636753989'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/microsoft-cannot-stop-being-rebel.html' title='Microsoft cannot stop being a rebel.'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-1949333772345194058</id><published>2011-09-25T19:08:00.001+02:00</published><updated>2011-09-25T19:08:26.323+02:00</updated><title type='text'>Airsoft AK 47 MS</title><content type='html'>&lt;p&gt;YAY! I finally got myself an airsoft rifle care of the folks at &lt;a href="http://www.kreature.co.za"&gt;http://www.kreature.co.za&lt;/a&gt;. Full metal so it weights roughly 3kgs which is really neat (don’t really enjoy the plastic ones that feel like I am carrying a water pistol). My initial impression is that it is pretty neat. It doesn’t quiet have the resonance our presence as the real one (but you can’t go around discharging AK 47s randomly unless you are in some North-African countries) but it seems to work cool. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Lets have a look at a couple pictures shall we?&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;First up the rifle with the two point sling mounted and the stock extended&lt;/p&gt;  &lt;p&gt;&lt;a href="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles9E7E2B4/IMG00081-20110925-1556[5].jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="IMG00081-20110925-1556" border="0" alt="IMG00081-20110925-1556" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles9E7E2B4/IMG00081-20110925-1556_thumb[3].jpg" width="557" height="418" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Pretty neat huh? Next we take a look at it with the stock folded (still with the two point sling)&lt;/p&gt;  &lt;p&gt;&lt;a href="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles9E7E2B4/IMG00083-20110925-1558[5].jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="IMG00083-20110925-1558" border="0" alt="IMG00083-20110925-1558" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles9E7E2B4/IMG00083-20110925-1558_thumb[3].jpg" width="559" height="421" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Right my next challenge was charging the battery. I found a really cool site that describes the formula for charging the battery. The formula goes like this:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;(battery capacity (battery's mAh rating)/charger output (mA - usually written on the charger)) x 1.4(for NiCad batteries, 1.5 for NiMh batteries) = time (in hours).&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;You can view the rest of the discussion here : &lt;a title="http://answers.yahoo.com/question/index?qid=20091013093650AAcTEBp" href="http://answers.yahoo.com/question/index?qid=20091013093650AAcTEBp"&gt;http://answers.yahoo.com/question/index?qid=20091013093650AAcTEBp&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So I worked mine out and it needed 4 hours according to the formula. So I charged it for four hours and went outside to have some fun. The battery died in 5 minutes &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles9E7E2B4/wlEmoticon-sadsmile%5B2%5D.png" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So I remembered that some batteries require a longer initial charge. So I gave the guys at Kreature a call and asked what the story was. Seems the Ni-MH type batteries require and initial charge of 8-12 hours! Ok well at least there is nothing wrong with my battery. So now it is plugged in again and this time I will leave it for 10 hours.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Anyways, still very excited to finally have it (been trying to get one for over a year now!) so waiting a few more hours ain’t going to kill me. Now it is time to start finding some games!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-1949333772345194058?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/1949333772345194058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/airsoft-ak-47-ms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1949333772345194058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1949333772345194058'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/airsoft-ak-47-ms.html' title='Airsoft AK 47 MS'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-3263268190811826883</id><published>2011-09-22T23:01:00.001+02:00</published><updated>2011-09-22T23:01:46.608+02:00</updated><title type='text'>JavaScript Hashmap and MVC 3</title><content type='html'>&lt;p&gt;I was fiddling with an idea that allowed rows to be dynamically added to an html page and deleted off the page. This became a bit tricky because I couldn’t identify the row I wanted to get rid of.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Eventually what I ended up doing was maintaining a list of the rows in a JavaScript object that functioned the same as the hash map and as opposed to deleting one row at a time I would remove the entire list from the page and re render it. The reason for this is when submitting arrays to an MVC 3 controller based on a strongly typed model you have to name the hidden input fields sequentially. Something like this:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;pre class="brush: xml;"&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; id=&amp;quot;EventList_0_SomeId&amp;quot; name=&amp;quot;EventList[0].SomeId&amp;quot;  value=&amp;quot;myid&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; id=&amp;quot;EventList_0_Capacity&amp;quot;  name=&amp;quot;EventList[0].Capacity&amp;quot;  value=&amp;quot;25&amp;quot; /&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;As you probably gathered the next one would increment the 0 in the id and the 0 in the name to 1. The next one 2 and so on and so forth.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; id=&amp;quot;EventList_1_SomeId&amp;quot; name=&amp;quot;EventList[1].SomeId&amp;quot;  value=&amp;quot;myid&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; id=&amp;quot;EventList_1_Capacity&amp;quot;  name=&amp;quot;EventList[1].Capacity&amp;quot;  value=&amp;quot;25&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; id=&amp;quot;EventList_2_SomeId&amp;quot; name=&amp;quot;EventList[2].SomeId&amp;quot;  value=&amp;quot;myid&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; id=&amp;quot;EventList_2_Capacity&amp;quot;  name=&amp;quot;EventList[2].Capacity&amp;quot;  value=&amp;quot;25&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; id=&amp;quot;EventList_3_SomeId&amp;quot; name=&amp;quot;EventList[3].SomeId&amp;quot;  value=&amp;quot;myid&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;quot;hidden&amp;quot; id=&amp;quot;EventList_3_Capacity&amp;quot;  name=&amp;quot;EventList[3].Capacity&amp;quot;  value=&amp;quot;25&amp;quot; /&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Just as a pointer, the name and the id of the input have to be declared or the MVC 3 controller will not resolve the values. The above example is a model that contains a list of objects that contain a property called SomeId and Capacity. If you do it the way I have illustrated above, it will resolve into a nice object representation in the controller that you can manipulate.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The Hashmap declaration:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: js;"&gt;function Map()&lt;br /&gt;{&lt;br /&gt;    // members&lt;br /&gt;    this.keyArray = new Array(); // Keys&lt;br /&gt;    this.valArray = new Array(); // Values&lt;br /&gt;        &lt;br /&gt;    // methods&lt;br /&gt;    this.put = put;&lt;br /&gt;    this.get = get;&lt;br /&gt;    this.size = size;  &lt;br /&gt;    this.clear = clear;&lt;br /&gt;    this.keySet = keySet;&lt;br /&gt;    this.valSet = valSet;&lt;br /&gt;    this.showMe = showMe;   // returns a string with all keys and values in map.&lt;br /&gt;    this.findIt = findIt;&lt;br /&gt;    this.remove = remove;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function put( key, val )&lt;br /&gt;{&lt;br /&gt;    var elementIndex = this.findIt( key );&lt;br /&gt;    &lt;br /&gt;    if( elementIndex == (-1) )&lt;br /&gt;    {&lt;br /&gt;        this.keyArray.push( key );&lt;br /&gt;        this.valArray.push( val );&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;        this.valArray[ elementIndex ] = val;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function get( key )&lt;br /&gt;{&lt;br /&gt;    var result = null;&lt;br /&gt;    var elementIndex = this.findIt( key );&lt;br /&gt;&lt;br /&gt;    if( elementIndex != (-1) )&lt;br /&gt;    {   &lt;br /&gt;        result = this.valArray[ elementIndex ];&lt;br /&gt;    }  &lt;br /&gt;    &lt;br /&gt;    return result;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function remove( key )&lt;br /&gt;{&lt;br /&gt;    var result = null;&lt;br /&gt;    var elementIndex = this.findIt( key );&lt;br /&gt;&lt;br /&gt;    if( elementIndex != (-1) )&lt;br /&gt;    {&lt;br /&gt;        this.keyArray = this.keyArray.removeAt(elementIndex);&lt;br /&gt;        this.valArray = this.valArray.removeAt(elementIndex);&lt;br /&gt;    }  &lt;br /&gt;    &lt;br /&gt;    return ;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function size()&lt;br /&gt;{&lt;br /&gt;    return (this.keyArray.length);  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function clear()&lt;br /&gt;{&lt;br /&gt;    for( var i = 0; i &amp;lt; this.keyArray.length; i++ )&lt;br /&gt;    {&lt;br /&gt;        this.keyArray.pop(); this.valArray.pop();   &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function keySet()&lt;br /&gt;{&lt;br /&gt;    return (this.keyArray);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function valSet()&lt;br /&gt;{&lt;br /&gt;    return (this.valArray);   &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function showMe()&lt;br /&gt;{&lt;br /&gt;    var result = &amp;quot;&amp;quot;;&lt;br /&gt;    &lt;br /&gt;    for( var i = 0; i &amp;lt; this.keyArray.length; i++ )&lt;br /&gt;    {&lt;br /&gt;        result += &amp;quot;Key: &amp;quot; + this.keyArray[ i ] + &amp;quot;tValues: &amp;quot; + this.valArray[ i ] + &amp;quot;n&amp;quot;;&lt;br /&gt;    }&lt;br /&gt;    return result;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function findIt( key )&lt;br /&gt;{&lt;br /&gt;    var result = (-1);&lt;br /&gt;&lt;br /&gt;    for( var i = 0; i &amp;lt; this.keyArray.length; i++ )&lt;br /&gt;    {&lt;br /&gt;        if( this.keyArray[ i ] == key )&lt;br /&gt;        {&lt;br /&gt;            result = i;&lt;br /&gt;            break;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    return result;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function removeAt( index )&lt;br /&gt;{&lt;br /&gt;  var part1 = this.slice( 0, index);&lt;br /&gt;  var part2 = this.slice( index+1 );&lt;br /&gt;&lt;br /&gt;  return( part1.concat( part2 ) );&lt;br /&gt;}&lt;br /&gt;Array.prototype.removeAt = removeAt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The usage is just as simple. Include the JavaScript file and then:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: js;"&gt;var map = new Map();&lt;br /&gt;&lt;br /&gt;map.put(&amp;quot;key&amp;quot;, value);&lt;br /&gt;map.remove(&amp;quot;key&amp;quot;);&lt;br /&gt;&lt;br /&gt;//etc&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;A really nice feature is that it does not duplicate keys but performs an “update” on the object at that key. So if you want to retrieve all the keys you can do something like this:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: js;"&gt;for (var i = 0; i &amp;lt; hashMap.keyArray.length; i++) {&lt;br /&gt;    var value = map.valArray[i];&lt;br /&gt;    var key = map.keyArray[i];&lt;br /&gt;    console.log(key, value.toSource());&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I found the Hashmap declaration over here &lt;a title="http://ping.fm/AGQHA" href="http://ping.fm/YavTY"&gt;http://ping.fm/YAKIX&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Some other interesting tid bits on the MVC embedded arrays, lists and editors for:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://ping.fm/iJZ6d" href="http://ping.fm/m5ii3"&gt;http://ping.fm/yYBla&lt;/a&gt;&amp;#160;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://ping.fm/uMGak" href="http://ping.fm/7YksH"&gt;http://ping.fm/8h8JP&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-3263268190811826883?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/3263268190811826883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/javascript-hashmap-and-mvc-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/3263268190811826883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/3263268190811826883'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/javascript-hashmap-and-mvc-3.html' title='JavaScript Hashmap and MVC 3'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-7747763501482351845</id><published>2011-09-21T15:23:00.001+02:00</published><updated>2011-09-21T15:23:38.642+02:00</updated><title type='text'>Object Relation Mappers (ORM) vs Stored Procedures</title><content type='html'>&lt;p&gt;Recently I was tasked with doing some investigations as to the best route to go. Now before you go getting all excited I am not going to be posting performance comparisons or declaring an outright winner. What I am going to point out is how to make the decision based on other factors.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;As I was looking for feed back on the respective technologies it became very clear that this is a holy war that no one can win due to the emotional attachment to our egos and having to be right and the lack of really clear distinctions between the two.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;First lets look at some basic best practise in writing maintainable software:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Make code readable&lt;/li&gt;    &lt;li&gt;Use automated testing&lt;/li&gt;    &lt;li&gt;Use version control&lt;/li&gt;    &lt;li&gt;Ensure software is well designed&lt;/li&gt;    &lt;li&gt;Use less code&lt;/li&gt;    &lt;li&gt;Encapsulate&lt;/li&gt;    &lt;li&gt;DRY – do not repeat yourself&lt;/li&gt;    &lt;li&gt;Loose coupling&lt;/li&gt;    &lt;li&gt;Write unit tests&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This is the essence of what I feel the articles in the reference section encapsulate. The primary reason for writing maintainable code (asides from having to maintain it) is to facilitate change. Businesses are becoming more dynamic and cannot afford to wait for months or years for the implementation of a vision they had. First to market is more important than ever with smaller businesses finding it easier to compete due to software and the internet.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Now the generally preferred structure of a software application is view layer, business logic layer and data layer. If designed properly one can very easily attach multiple views for different platforms to the solution without having to reengineer the business logic. The data stores can also be swapped out with relative ease or perhaps extended to include other data stores. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So what is a stored procedure? According to wikipedia: &lt;em&gt;“A &lt;b&gt;stored procedure&lt;/b&gt; is a &lt;/em&gt;&lt;a href="http://en.wikipedia.org/wiki/Subroutine"&gt;&lt;em&gt;subroutine&lt;/em&gt;&lt;/a&gt;&lt;em&gt; available to applications accessing a &lt;/em&gt;&lt;a href="http://en.wikipedia.org/wiki/Relational_database"&gt;&lt;em&gt;relational&lt;/em&gt;&lt;/a&gt;&lt;em&gt; &lt;/em&gt;&lt;a href="http://en.wikipedia.org/wiki/Database_management_system"&gt;&lt;em&gt;database system&lt;/em&gt;&lt;/a&gt;&lt;em&gt;. Stored procedures (sometimes called a &lt;b&gt;proc&lt;/b&gt;, &lt;b&gt;sproc&lt;/b&gt;, &lt;b&gt;StoPro&lt;/b&gt;, &lt;b&gt;StoredProc&lt;/b&gt;, or &lt;b&gt;SP&lt;/b&gt;) are actually stored in the database &lt;/em&gt;&lt;a href="http://en.wikipedia.org/wiki/Data_dictionary"&gt;&lt;em&gt;data dictionary&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.”&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Now the benefits claimed with using stored procedures have always been related to performance. It is a common belief that stored procedures run quicker than generated SQL. While this might be the case with an experienced writer, I have had the distinct displeasure of seeing it go horribly wrong as well. This does not mean that I have not seen it happen in code but generally it is easier to fix the code than the stored procedure due to the unit tests. When changing a stored procedure inevitably you are going to have to change code. When changing DB structure you will have to change all the procedures that use that dataset and the code that maps to it.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Now let us get out of the emotional stuff and start comparing apples with apples. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If we have a look at the the description above on how to write maintainable code let see how stored procedures match up.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;Make code readable&lt;/strong&gt; – Well no, it is a structured query language. While it looks like bad English sometimes it can be difficult to read.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Use automated testing – &lt;/strong&gt;I haven’t seen a way to automate the testing of stored procedures&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Use version control&lt;/strong&gt; – I have not seen a way to handle versioning of stored procedures with ease&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Ensure software is well designed – &lt;/strong&gt;Being procedural in nature there is very little design that can happen&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Use less code – &lt;/strong&gt;There are certain things you can do in code you can’t do in SQL. So you might end up having to write far more SQL to facilitate it.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Encapsulate – &lt;/strong&gt;While some might argue that the procedure is encapsulated in the database I would argue that the logic is not encapsulated where it should be.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;DRY – do not repeat yourself – &lt;/strong&gt;With having to name tables and operations continually there is a great deal of replication happening&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Loose coupling – &lt;/strong&gt;Can stored procedures be interchanged between database vendors? Well yes, if you haven’t used vendor specific functions. It is also tightly coupled to the database unfortunately.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Write unit tests – &lt;/strong&gt;I would if I could! Haven’t seen this in Stored procedures.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I am not going to run the code through the same assessment as we all know that code supports all the above. Right lets get into the next point. While stored procedures might perform better, does the saving from the performance increase compliment the additional cost of maintenance attached by using stored procedures? The next question we need to ask is this. How safe is it to have business logic reside inside the database as opposed to the code base? What the you had specific rules for the same entities in a database? You would have to replicate the initial procedure and fine tune it for each entity. Now should the shared logic change you have multiple places you need to go and change. Not good!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Lets look at it from the other side. Yes generating SQL to query a database has a certain amount of overhead. That is the only concern that people have. Let me say that again, the only con that using code over using stored procedures has is the performance aspect. So what do we do? Well lets have a look at another definition: “&lt;em&gt;&lt;strong&gt;&amp;quot;Premature optimization&amp;quot;&lt;/strong&gt; is a phrase used to describe a situation where a programmer lets performance considerations affect the design of a piece of code. This can result in a design that is not as clean as it could have been or code that is incorrect, because the code is complicated by the optimization and the programmer is distracted by optimizing.”&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Is this not what we are doing when we allow the decision to use stored procedures affect our system designs? How about we try this from now on. Lets write the application first, get it working properly (even if it is a single feature&lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles6DD605/wlEmoticon-smile%5B2%5D.png" /&gt;) and release it. Once we identify bottle necks we begin to optimise the bottle necks. This might very well include using stored procedures! Lets get out of the dark ages folks. There is no right or wrong in this realm. There is only deliver on time or don’t. Lets deliver on time &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles6DD605/wlEmoticon-winkingsmile%5B2%5D.png" /&gt; Perfection is generally a refining process any way, expecting it on the initial iteration is absurd&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;References:&lt;/em&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="http://www.basilv.com/psd/blog/2006/how-to-create-maintainable-software" href="http://www.basilv.com/psd/blog/2006/how-to-create-maintainable-software"&gt;&lt;em&gt;http://www.basilv.com/psd/blog/2006/how-to-create-maintainable-software&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="http://www.advogato.org/article/258.html" href="http://www.advogato.org/article/258.html"&gt;&lt;em&gt;http://www.advogato.org/article/258.html&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="http://www.crazysquirrel.com/computing/java/basics/maintainable-code-part-1.jspx" href="http://www.crazysquirrel.com/computing/java/basics/maintainable-code-part-1.jspx"&gt;&lt;em&gt;http://www.crazysquirrel.com/computing/java/basics/maintainable-code-part-1.jspx&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="http://haacked.com/archive/2007/01/09/Writing_Maintainable_Code.aspx" href="http://haacked.com/archive/2007/01/09/Writing_Maintainable_Code.aspx"&gt;&lt;em&gt;http://haacked.com/archive/2007/01/09/Writing_Maintainable_Code.aspx&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="http://codebetter.com/jeremymiller/2006/12/06/on-writing-maintainable-code/" href="http://codebetter.com/jeremymiller/2006/12/06/on-writing-maintainable-code/"&gt;&lt;em&gt;http://codebetter.com/jeremymiller/2006/12/06/on-writing-maintainable-code/&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="http://en.wikipedia.org/wiki/Stored_procedure" href="http://en.wikipedia.org/wiki/Stored_procedure"&gt;&lt;em&gt;http://en.wikipedia.org/wiki/Stored_procedure&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a title="http://en.wikipedia.org/wiki/Premature_optimization#When_to_optimize" href="http://en.wikipedia.org/wiki/Premature_optimization#When_to_optimize"&gt;&lt;em&gt;http://en.wikipedia.org/wiki/Premature_optimization#When_to_optimize&lt;/em&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;ol&gt;&lt;!--EndFragment--&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-7747763501482351845?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/7747763501482351845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/object-relation-mappers-orm-vs-stored.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7747763501482351845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7747763501482351845'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/object-relation-mappers-orm-vs-stored.html' title='Object Relation Mappers (ORM) vs Stored Procedures'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-8751143874799298084</id><published>2011-09-21T14:18:00.001+02:00</published><updated>2011-09-21T14:18:44.363+02:00</updated><title type='text'>Internet Explorer 8 and JQuery 1.6.x</title><content type='html'>&lt;p&gt;Recently I launched a new site for a friend &lt;a href="http://ping.fm/ZWyXr"&gt;http://ping.fm/0u4cy&lt;/a&gt;. Everything was working really well till the site was opened in Internet Explorer 8. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So I set about trying to figure out what was going on. Every time a link was opened the tab would crash and recover. My initial thoughts where that something was wrong with the JavaScript. So I started commenting out code to try and establish what was going on. Then I thought there might be something wrong with the CSS that was causing the tab to crash. I went around in circles for about an hour till I decided to scrap everything.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I commented out all the styles and scripts and the site stopped crashing the tab. Then I started adding back the references one by one till the browser crashed again. This happened as soon as I included the JQuery 1.6 min file. I couldn’t figure out what to do till a ray of sunshine hit me and I thought about the JavaScript parsing engine in Internet Explorer 8. What if the parsing engine was failing on something and causing so sort of memory leak or overflow?&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So I proceeded to download the uncompressed version of the JQuery library and added it. Holding my breath, I refreshed the page and clicked around a few times. The site was now working!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-8751143874799298084?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/8751143874799298084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/internet-explorer-8-and-jquery-16x.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/8751143874799298084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/8751143874799298084'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/internet-explorer-8-and-jquery-16x.html' title='Internet Explorer 8 and JQuery 1.6.x'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-2699181094837437918</id><published>2011-09-19T20:13:00.001+02:00</published><updated>2011-09-19T20:13:49.258+02:00</updated><title type='text'>Facebook vs Google+</title><content type='html'>&lt;p&gt;I logged on to &lt;a href="http://www.facebook.com"&gt;www.facebook.com&lt;/a&gt; today and noticed something called “smart lists”. Upon closer inspection this feature is a mechanism to group friends and view only their feeds. Nice, so now you can isolate the feeds you want to see as opposed to having to sift through endless notifications from apps your friends are using that they need “an axe to chop down trees” or a neighbour “has found your long lost gold fish” or any other arbitrary rubbish that gets pushed to your news feed trying to get you to consume the application. So, yeah neat and original idea. Oh wait, it is not original! Doesn’t Google+ circles offer the same functionality? Well I suppose it does, I mean after all if it looks like a circle and acts like a circle it must be a circle “symbol crash”.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Upon seeing this I remembered that &lt;a href="http://www.facebook.com"&gt;www.facebook.com&lt;/a&gt; was suing someone over a very similar infringement of their beloved news feed.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So after reading an interesting article about who is suing who in the mobile space I thought I would see who &lt;a href="http://www.facebook.com"&gt;www.facebook.com&lt;/a&gt; is suing (&lt;a href="http://www.google.co.za/search?source=ig&amp;amp;hl=en&amp;amp;rlz=1G1ACAW_ENZA313&amp;amp;q=facebook+sues&amp;amp;oq=facebook+sues&amp;amp;aq=f&amp;amp;aqi=g6g-v4&amp;amp;aql=&amp;amp;gs_sm=e&amp;amp;gs_upl=162l1497l0l2823l8l6l0l0l0l0l573l1686l1.2.1.0.1.1l6l0" target="_blank"&gt;Google Search Results&lt;/a&gt;) I almost wet myself laughing when I viewed the results. So I thought, why not see who else is suing who. My next stop was who is Google suing (&lt;a href="http://www.google.co.za/search?source=ig&amp;amp;hl=en&amp;amp;rlz=1G1ACAW_ENZA313&amp;amp;q=google+sues&amp;amp;oq=google+sues&amp;amp;aq=f&amp;amp;aqi=g10&amp;amp;aql=&amp;amp;gs_sm=e&amp;amp;gs_upl=840l2426l0l2603l11l7l0l0l0l0l338l864l2.1.1.1l5l0" target="_blank"&gt;Results&lt;/a&gt;). The more I went on the more I started realising that software not only makes business supposedly run better but it is currently, single handed, funding law firms. With so much effort being pushed into suing people to get money that they feel is theirs no wonder there has been no significant break through since world war 2.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Let me validate that statement. World war 2 saw the discovery and implementation of:&lt;/p&gt;  &lt;p&gt;Jet aircraft&lt;/p&gt;  &lt;p&gt;Fuel injected engines&lt;/p&gt;  &lt;p&gt;Ballistic missiles&lt;/p&gt;  &lt;p&gt;Nuclear Fission&amp;#160; &lt;/p&gt;  &lt;p&gt;Assault Rifles&lt;/p&gt;  &lt;p&gt;Radar&lt;/p&gt;  &lt;p&gt;Sonar&lt;/p&gt;  &lt;p&gt;Precursors to the computer&lt;/p&gt;  &lt;p&gt;Devices used in household appliances&lt;/p&gt;  &lt;p&gt;Multi track recording&lt;/p&gt;  &lt;p&gt;Synthetic rubber&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;and the list goes on and on. So tell me, what have we discovered since world war 2? Asides from making making computers small and more powerful? Asides from increasing the capacity of previous discoveries? What have we done in the 66 years after world war 2? Well in my estimation, squat.&amp;#160; Argue all you want but provide me with proof. All we have done is create a society based on rampant consumerism, technological devices get upgraded and upgraded and upgraded, even though we are using less than 50% of the actual capacity of the machines.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Anyways this isn’t supposed to be a rant about society, it is just a pointer to how incredibly backwards we have everything. Perhaps I should do an article about creating opportunities for innovation in this space. Maybe I will if I get time. In the mean time, let carry on suing everyone because at the end of the day surely no one in the worlds population of ~&lt;em&gt;6,775,235,700 people&lt;/em&gt;&amp;#160; could possibly have the same idea as me. I mean, I am just that special!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-2699181094837437918?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/2699181094837437918/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/facebook-vs-google.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/2699181094837437918'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/2699181094837437918'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/facebook-vs-google.html' title='Facebook vs Google+'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-9049368518371962444</id><published>2011-09-19T19:10:00.001+02:00</published><updated>2011-09-19T19:10:52.381+02:00</updated><title type='text'>TOGAF Foundation day 1</title><content type='html'>&lt;p&gt;What an interesting day. For a while now I have wanted to do some sort of certification in the enterprise architecture realm. Mainly because I want to see if what I say all the time is actually the case and having a certification proving you know what you talking about never hurts!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Well I was extremely pleased with day one of the two day training presented by &lt;a href="http://www.realirm.com"&gt;http://www.realirm.com&lt;/a&gt;. The supporting documents are clear, there are no gaps in the presenters knowledge and the environment is fun and interactive yet professional.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I was very please to find that my ideas are correct but today also filled in a few gaps I have been struggling with. The thing that has become glaringly clear is that the role of enterprise architect is one often misunderstood. While a technical background is a good idea, a great deal of the initial work is done outside the context of any specific technologies. This is the part I absolutely love! Being presented with a problem or in TOGAF terms a “concern” then finding solutions to that concern. Problem solving is something I thoroughly enjoy, whether it be code based or business based.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Really looking to tomorrow and once I have finished the foundational aspect I will most definitely be doing the next level.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;For more info on TOGAF check out:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://ping.fm/4JG0e" href="http://ping.fm/HCmPy"&gt;http://ping.fm/m2J2I&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Other interesting links&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.zachman.com/" href="http://www.zachman.com/"&gt;http://www.zachman.com/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://ping.fm/3kaCO" href="http://ping.fm/qgCGL"&gt;http://ping.fm/o1UBG&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://ping.fm/jJdO5" href="http://ping.fm/20XCT"&gt;http://ping.fm/vw3wY&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-9049368518371962444?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/9049368518371962444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/togaf-foundation-day-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/9049368518371962444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/9049368518371962444'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/togaf-foundation-day-1.html' title='TOGAF Foundation day 1'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-3952608657548852240</id><published>2011-09-15T01:33:00.001+02:00</published><updated>2011-09-15T01:33:28.454+02:00</updated><title type='text'>Java Hibernate Setup</title><content type='html'>&lt;p&gt;Ok here we go again. Now I am struggling get Hibernate working with the persistence unit declaration.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The reason I am writing this is more a pointer to myself should I ever have to do this again. Oh, check out my project on github. It is an implementation of a repository pattern using hibernate. It is extendable if you download the source and implement other providers. It is defined for standalone instances, not the full Java 5 EE stack although I am pretty sure with a bit of tweeking it can be used in that instance.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;First I was getting the dreaded &amp;quot;javax.persistence.PersistenceException: No Persistence provider for EntityManager named”. After a little testing I figured out that the properties file contained an inverted commas wrapped persistence unit name where it should not have been wrapped&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;pre class="brush: plain;"&gt;datastore.database.persistanceunit = &amp;quot;PU1&amp;quot; -&amp;gt; wrong!&lt;br /&gt;datastore.database.persistanceunit = PU1 -&amp;gt; resolved correctly.&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Ok so yeah I am rusty but bare with me. After getting that right I started running into Unable to build EntityManagerFactory. Drilling down a bit further it came down to not having an initial context. So I went and manipulated the persistence.xml file to no avail. Then I started digging deeper and found a ClassNotDefined exception (doh!). Seems I had forgotten to include the Postgres driver jar file (this is one feature I really like in C#, if you reference an assembly that references another assembly you get a warning if you haven’t referenced the dependency. Although I can see how this falls through using an XML configuration when there is no type checking happening. So the driver is obviously being created using some sort of reflection. Note to the Hibernate and JPA developers – please provide more verbose or smarter messages. Perhaps I just need to wake up!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Ok well, now the persistence.xml looks like this:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;persistence version=&amp;quot;1.0&amp;quot; xmlns=”&lt;a href="http://java.sun.com/xml/ns/persistence"&gt;http://java.sun.com/xml/ns/persistence&lt;/a&gt;“&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;  &lt;pre class="brush: xml;"&gt;xmlns:xsi=”&lt;a href="http://www.w3.org/2001/XMLSchema-instance"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/a&gt;”&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre class="brush: xml;"&gt;xsi:schemaLocation=&amp;quot;http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;persistence-unit name=&amp;quot;CommunityPlatformPU&amp;quot; transaction-type=&amp;quot;RESOURCE_LOCAL&amp;quot;&amp;gt;&lt;br /&gt;        &lt;br /&gt;        &amp;lt;provider&amp;gt;org.hibernate.ejb.HibernatePersistence&amp;lt;/provider&amp;gt;&lt;br /&gt;        &amp;lt;properties&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.dialect&amp;quot; value=&amp;quot;org.hibernate.dialect.PostgreSQLDialect&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.connection.username&amp;quot; value=&amp;quot;xxx&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.connection.driver_class&amp;quot; value=&amp;quot;org.postgresql.Driver&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.connection.password&amp;quot; value=&amp;quot;xxx&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.connection.url&amp;quot; value=&amp;quot;jdbc:postgresql://localhost:5432/database&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.cache.provider_class&amp;quot; value=&amp;quot;org.hibernate.cache.NoCacheProvider&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.hbm2ddl.auto&amp;quot; value=&amp;quot;update&amp;quot;/&amp;gt;&lt;br /&gt;        &amp;lt;/properties&amp;gt;&lt;br /&gt;    &amp;lt;/persistence-unit&amp;gt;&lt;br /&gt;&amp;lt;/persistence&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Right, new exception to deal with. For primary keys I prefer using UUIDs or GUIDs as they are always unique. Yes I know indexing issues blah blah blah speed related issues blah blah blah. I use it for a reason. When I transform the data into XML I want globally unique Ids so I can link via Ids. Now I usually got round this with the @PrePersist annotation (because the implementations only supported the integer values) but wanted to see if there had been any improvements since my last run in with JPA. Turns out there has been.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This is the way you use UUIDs as PrimaryKeys&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: java;"&gt;@Id&lt;br /&gt;    @GeneratedValue(generator=&amp;quot;system-uuid&amp;quot;)&lt;br /&gt;    @GenericGenerator(name = &amp;quot;system-uuid&amp;quot;, strategy = &amp;quot;uuid2&amp;quot;)&lt;br /&gt;    @Type(type = &amp;quot;pg-uuid&amp;quot;)&lt;br /&gt;    private UUID id;&lt;br /&gt;&lt;br /&gt;    public UUID getId() {&lt;br /&gt;        return id;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setId(UUID id) {&lt;br /&gt;        this.id = id;&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Cool!&amp;#160; Next …&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This little rig didn’t seem to like the jdbc3 drivers so switching to the jdbc4 drivers seemed to resolve that.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So that is that! Finally my test is passing and I am able to go to bed &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfilesAA2EDF/wlEmoticon-smile%5B2%5D.png" /&gt;&amp;#160; Well almost. Next it is time to configure the caching for the database and the connection pooling. Seems most of the libraries are included in the hibernate distribution. So the final persistence.xml file looks like this:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: xml;"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;&amp;lt;persistence version=&amp;quot;1.0&amp;quot; xmlns=&amp;quot;http://java.sun.com/xml/ns/persistence&amp;quot; &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: xml;"&gt;xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot; &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: xml;"&gt;xsi:schemaLocation=&amp;quot;http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;persistence-unit name=&amp;quot;CommunityPlatformPU&amp;quot; transaction-type=&amp;quot;RESOURCE_LOCAL&amp;quot;&amp;gt;&lt;br /&gt;        &lt;br /&gt;        &amp;lt;provider&amp;gt;org.hibernate.ejb.HibernatePersistence&amp;lt;/provider&amp;gt;&lt;br /&gt;        &lt;br /&gt;        &amp;lt;properties&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.dialect&amp;quot; value=&amp;quot;org.hibernate.dialect.PostgreSQLDialect&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.connection.username&amp;quot; value=&amp;quot;dev&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.connection.driver_class&amp;quot; value=&amp;quot;org.postgresql.Driver&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.connection.password&amp;quot; value=&amp;quot;dev&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.connection.url&amp;quot; value=&amp;quot;jdbc:postgresql://localhost:5432/communityplatform&amp;quot;/&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.hbm2ddl.auto&amp;quot; value=&amp;quot;update&amp;quot;/&amp;gt;&lt;br /&gt;            &lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.cache.provider_class&amp;quot; value=&amp;quot;org.hibernate.cache.EhCacheProvider&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;hibernate.cache.use_second_level_cache&amp;quot; value=&amp;quot;true&amp;quot; /&amp;gt;&lt;br /&gt;            &lt;br /&gt;            &amp;lt;property name=&amp;quot;c3p0.min_size&amp;quot; value=&amp;quot;5&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;c3p0.max_size&amp;quot; value=&amp;quot;20&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;c3p0.timeout&amp;quot; value=&amp;quot;300&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;c3p0.max_statements&amp;quot; value=&amp;quot;50&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;property name=&amp;quot;c3p0.idle_test_period&amp;quot; value=&amp;quot;3000&amp;quot; /&amp;gt;&lt;br /&gt;            &lt;br /&gt;            &amp;lt;property name=&amp;quot;current_session_context_class&amp;quot; value=&amp;quot;thread&amp;quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/properties&amp;gt;&lt;br /&gt;    &amp;lt;/persistence-unit&amp;gt;&lt;br /&gt;&amp;lt;/persistence&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Green light on the tests, creating the database structure and persisting the information. Cool, now it is definitely time for bed, big day tomorrow, Skye turns 6 &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfilesAA2EDF/wlEmoticon-smile%5B2%5D.png" /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;References:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a title="http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/mapping.html#d0e5294" href="http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/mapping.html#d0e5294"&gt;http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/mapping.html#d0e5294&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a title="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-hibernatejdbc" href="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-hibernatejdbc"&gt;http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-hibernatejdbc&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a title="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performance.html#performance-cache" href="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performance.html#performance-cache"&gt;http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performance.html#performance-cache&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-3952608657548852240?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/3952608657548852240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/java-hibernate-setup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/3952608657548852240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/3952608657548852240'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/java-hibernate-setup.html' title='Java Hibernate Setup'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-1862621007208083210</id><published>2011-09-14T22:12:00.001+02:00</published><updated>2011-09-14T22:12:26.968+02:00</updated><title type='text'>Java resources (.properties)</title><content type='html'>&lt;p&gt;Ok so I am making progress on a fiddle project that I am working on. I decided I was going to store the the persistence unit name in a properties file to prevent embedding strings in the instantiation methods.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I sat and fought for sometime trying to get the resources as a stream and came across some interesting links that explain how to do this. Namely:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.bartbusschots.ie/blog/?p=360" href="http://www.bartbusschots.ie/blog/?p=360"&gt;http://www.bartbusschots.ie/blog/?p=360&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html" href="http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html"&gt;http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getSystemClassLoader%28%29" href="http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getSystemClassLoader%28%29"&gt;http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getSystemClassLoader%28%29&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResourceAsStream%28java.lang.String%29" href="http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResourceAsStream%28java.lang.String%29"&gt;http://download.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResourceAsStream%28java.lang.String%29&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;After fiddling and fiddling and getting very frustrated with the NullPointerException that kept on happening I was just about to give up.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Then I realised something. Looking at all the examples there is something I had added that I shouldn’t have&lt;/p&gt;  &lt;pre class="brush: java;"&gt;//Spot the ERROR!&lt;br /&gt;Properties configFile = new Properties();&lt;br /&gt;configFile.load(ClassLoader.getSystemResourceAsStream(&amp;quot;/za/co/codeshark/application.properties&amp;quot;));&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Don’t feel bad if you don’t see the problem. Laugh at me if you do &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles9BCFFE/wlEmoticon-winkingsmile%5B2%5D.png" /&gt; So here is the problem. If you have a look at the string pointing to the resource it has a leading “/”. Yes, this makes the path unresolvable. So it should have look like:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: java;"&gt;Properties configFile = new Properties();&lt;br /&gt;configFile.load(ClassLoader.getSystemResourceAsStream(&amp;quot;za/co/codeshark/application.properties&amp;quot;));&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Notice that there is no leading “/”. Once I made this change everything started grooving and I was able to access my resource file. Once again kicking myself for not keeping these skills fresh. I find it weird though, that with all the examples of how to do this, none point out anything about how to resolve the path. Perhaps I am just over tired but I figured it might be good to make a note of this for 50 years from now!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-1862621007208083210?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/1862621007208083210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/java-resources-properties.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1862621007208083210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1862621007208083210'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/java-resources-properties.html' title='Java resources (.properties)'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-9216682169034498244</id><published>2011-09-14T02:09:00.001+02:00</published><updated>2011-09-14T02:09:21.189+02:00</updated><title type='text'>The importance of rigid definitions â€“ or why a verbose explanation is sometimes a good idea.</title><content type='html'>&lt;p&gt;So I have been wiping the cobwebs from my Java skills and kicking myself for neglecting them. I suppose with work being focused on .NET development, two young children and a training schedule that leaves very little time for exploration on personal projects, it was bound to happen.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Anyway, things have changed now and I am able to squeeze in personal development time by sleeping less &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Open-mouthed smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles1010CD1/wlEmoticon-openmouthedsmile%5B2%5D.png" /&gt;. Right, lets get to the point of this article. While designing an API in Java I noticed that I was finding it very difficult to package my classes the way I was doing it in .NET so I started doing some digging.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;My first thought was to have a look at the access modifiers available in both languages. Do a like for like comparison and see if there were any equivalents. So the C# language has the following access modifiers:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;C#&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Public:&lt;/strong&gt; This is pretty much a free for all. The class can be accessed by everything inside the assembly and anything referencing the assembly. This applies to types and type members.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Private:&lt;/strong&gt; This makes members of the class only accessible to operations in the definition of the class. Kinda like private parts &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-surprisedsmile" alt="Surprised smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles1010CD1/wlEmoticon-surprisedsmile%5B2%5D.png" /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Internal: &lt;/strong&gt;This allows the the types or type members to be visible from the within the same assembly. So even if a different assembly shares the namespace (for whatever reason) it will not be able to access the internal types or methods of the referenced assembly.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Protected: &lt;/strong&gt;This is a member access modifier that dictates that only types that extend the declaring type can access this member. So a shared property, field, method or function that you want to be visible inside a type extending the type declaring the members but not available internally to the assembly or publically.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Right lets move on shall we?&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Java&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Public: &lt;/strong&gt;Pretty much the same as C#. Free for all on everything declared.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Private: &lt;/strong&gt;Again, pretty much the same as C# and the private parts.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;No Access Modifier: &lt;/strong&gt;This means that anything declared in the type or the type itself will only be visible in the package space it is declared in. Remember this! It is the topic of this post.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Protected: &lt;/strong&gt;Available to types extending the declaring type.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Right lets get to the point of this article. Now that we have established each languages modifiers, lets have a look at this &lt;a title="http://www.javacamp.org/javavscsharp/internal.html" href="http://www.javacamp.org/javavscsharp/internal.html"&gt;http://www.javacamp.org/javavscsharp/internal.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Looking at that you will see that the C# access modifier “internal” is implied to be the equivalent of the Java default or no access modifier declaration. Does the Java definition behave the same as the C# internal definition? Well have a look at the definitions again:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;C# Internal: &lt;/strong&gt;Accessible to everything inside the assembly. This means namespaces moving up to the root namespace and down to the last namespace node.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Java No Modifier: &lt;/strong&gt;Only available inside the package it is declared in.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Can you see it yet?&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Lets have a look at a code sample real quick:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;C# Code sample&lt;/strong&gt;&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;//Assuming this is inside assembly my.cool.dll&lt;br /&gt;namespace my.cool.project{&lt;br /&gt;  internal class Cheese(){}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;namespace my.cool{&lt;br /&gt;    public class StartTheCheese(){&lt;br /&gt;        var cheese = new Cheese(); //valid&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;namespace my.cool.project.goes.on{&lt;br /&gt;    public class DigestTheCheese(){&lt;br /&gt;        var cheese = new Cheese(); //valid&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;//end assembly&lt;br /&gt;&lt;br /&gt;//Assuming this is inside assembly my.ref.dll&lt;br /&gt;namespace my.cool{&lt;br /&gt;    public class DoWeHaveCheese(){&lt;br /&gt;        var cheese = new Cheese(); //invalid&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Java Code Sample &lt;br /&gt;    &lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;  &lt;pre class="brush: java;"&gt;package my.cool.project&lt;br /&gt;&lt;br /&gt;class CatchMe(){ // note that no access modifier is declared&lt;br /&gt; //body&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;package my.cool&lt;br /&gt;&lt;br /&gt;public class TheCheese(){&lt;br /&gt;    CatchMe catchMe = new CatchMe(); //fails!   &lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;You can see it now right? The primary, intrinsic difference is that the C# internal modifier can span multiple namespaces in the same assembly. The Java declaration with no access modifier cannot be seen outside the package my.cool.project. This means that there is no equivalent “internal” in Java. So here is the crux of the matter. If making comparisons, like in maths, we have to find the lowest common denominator before comparing or performing operations of logic in deciding the equivalents. Compare apples with apples to avoid confusion. Things we might take for granted will drive other people mad!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;References:&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/6tcf2h8w%28v=vs.71%29.aspx" href="http://msdn.microsoft.com/en-us/library/6tcf2h8w%28v=vs.71%29.aspx"&gt;http://msdn.microsoft.com/en-us/library/6tcf2h8w%28v=vs.71%29.aspx&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://www.javacamp.org/javaI/Modifier.html" href="http://www.javacamp.org/javaI/Modifier.html"&gt;http://www.javacamp.org/javaI/Modifier.html&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://www.javacamp.org/javavscsharp/internal.html" href="http://www.javacamp.org/javavscsharp/internal.html"&gt;http://www.javacamp.org/javavscsharp/internal.html&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-9216682169034498244?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/9216682169034498244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/importance-of-rigid-definitions-or-why.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/9216682169034498244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/9216682169034498244'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/importance-of-rigid-definitions-or-why.html' title='The importance of rigid definitions â€“ or why a verbose explanation is sometimes a good idea.'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-5369190474730597879</id><published>2011-09-13T01:40:00.001+02:00</published><updated>2011-09-13T01:40:49.261+02:00</updated><title type='text'>Java porting and the Date string conspiracy</title><content type='html'>&lt;p&gt;It has been a while since I have been able to write some Java code outside the context of Android. So I decided to take my C# NewsFeedParser (&lt;a title="https://github.com/RabidDog/C--News-Feed-Parser" href="https://github.com/RabidDog/C--News-Feed-Parser"&gt;https://github.com/RabidDog/C--News-Feed-Parser&lt;/a&gt;) and port it to Java just as an exercise. While I have just finished the RSS content parser I have also picked up a few issues with the C# version so will be cleaning that up soon.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Most of the concepts where the same but I must admit, I missed the internal key word available in C# &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles97C064/wlEmoticon-smile%5B2%5D.png" /&gt;. I still have to do a few tests to verify that I haven’t accidentally exposed anything in the library.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The one thing that was a bit upsetting is Java’s handling of date strings. The parsing of date strings requires a format to be stipulated if you are using the framework parsing mechanism. Examples can be found at &lt;a title="http://techtracer.com/2007/03/28/convert-date-to-string-and-string-to-date-in-java/" href="http://techtracer.com/2007/03/28/convert-date-to-string-and-string-to-date-in-java/"&gt;http://techtracer.com/2007/03/28/convert-date-to-string-and-string-to-date-in-java/&lt;/a&gt; and &lt;a title="http://javatechniques.com/blog/dateformat-and-simpledateformat-examples/" href="http://javatechniques.com/blog/dateformat-and-simpledateformat-examples/"&gt;http://javatechniques.com/blog/dateformat-and-simpledateformat-examples/&lt;/a&gt; and many other places on how to parse a date using a format. While this works when you have control of the format, it can be quiet tricky when you don’t have control over the format. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;A bit more searching led me to &lt;a title="http://stackoverflow.com/questions/3389348/parse-any-date-in-java" href="http://stackoverflow.com/questions/3389348/parse-any-date-in-java"&gt;http://stackoverflow.com/questions/3389348/parse-any-date-in-java&lt;/a&gt; and then a little piece of gold. &lt;a title="http://darthanthony.wordpress.com/2009/05/29/java-date-parsing-with-an-unknown-format/" href="http://darthanthony.wordpress.com/2009/05/29/java-date-parsing-with-an-unknown-format/"&gt;http://darthanthony.wordpress.com/2009/05/29/java-date-parsing-with-an-unknown-format/&lt;/a&gt; pointed to a project called the POJava Project. The article also pointed out that there is a handy DateTime object that has the capacity to parse dates from most strings.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Usage is something like&lt;/p&gt;  &lt;pre class="brush: java;"&gt;import org.pojava.datetime.DateTime;&lt;br /&gt;&lt;br /&gt;//rest of the class definition&lt;br /&gt;Date date = DateTime.parse(myDateString).toDate();&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So now you can parse many strings into date objects. Big thanks to the guys over at the POJava project. You can find them at &lt;a title="http://www.pojava.org/" href="http://www.pojava.org/"&gt;http://www.pojava.org/&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Time to go clean up the C# project &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles97C064/wlEmoticon-smile%5B2%5D.png" /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-5369190474730597879?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/5369190474730597879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/java-porting-and-date-string-conspiracy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/5369190474730597879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/5369190474730597879'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/java-porting-and-date-string-conspiracy.html' title='Java porting and the Date string conspiracy'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-8320458934378475791</id><published>2011-09-07T23:15:00.001+02:00</published><updated>2011-09-07T23:15:27.229+02:00</updated><title type='text'>Fluent Email and Git hub</title><content type='html'>&lt;p&gt;So after submitting the changes for Fluent Email to the initial developer and him suggesting that I create a fork of the repo to contribute via, I finally got round to doing it. So what I am going to do is share my experience here.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;First thing you need to do is git installed on your machine. The installer can be found here &lt;a title="http://code.google.com/p/msysgit/downloads/list" href="http://code.google.com/p/msysgit/downloads/list"&gt;http://code.google.com/p/msysgit/downloads/list&lt;/a&gt; (I went for the full installer download). Then proceed to install the package and follow the instructions. Once you have completed that install you are going to need to set up your RSA keys to be able to connect to git hub via the bash. You can add your keys at the address &lt;a title="https://github.com/account/ssh" href="https://github.com/account/ssh"&gt;https://github.com/account/ssh&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Right the next thing you might want to get is tortoise git. Simplifies the process of using git quiet significantly! Yes I am going to learn the command line stuff &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles118008/wlEmoticon-winkingsmile%5B2%5D.png" /&gt; Tortoise Git can be found at &lt;a title="http://code.google.com/p/tortoisegit/downloads/list" href="http://code.google.com/p/tortoisegit/downloads/list"&gt;http://code.google.com/p/tortoisegit/downloads/list&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Right now we got everything set up the next thing you need to do is fork the repo you want to work on. The instructions can be found here &lt;a title="http://help.github.com/fork-a-repo/" href="http://help.github.com/fork-a-repo/"&gt;http://help.github.com/fork-a-repo/&lt;/a&gt;. Once you forked the repo you can now clone it to a directory on your machine (much like SVN), then edit away and when you ready you can commit your changes and push them.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I updated the Fluent Email to allow use of the template parsing outside the context of the Email class. I thought this would be handy for situations like I had recently where I needed the parser but not the email. I would have created another project for the parser but figured that the credit is due to the initial developer so left it in there. Then I refactored the addressing mechanism to remove duplicate code. It now reuses a single mechanism to parse the email addresses and names. Anyways if you interested check out &lt;a title="https://github.com/RabidDog/FluentEmail" href="https://github.com/RabidDog/FluentEmail"&gt;https://github.com/RabidDog/FluentEmail&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-8320458934378475791?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/8320458934378475791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/fluent-email-and-git-hub.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/8320458934378475791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/8320458934378475791'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/fluent-email-and-git-hub.html' title='Fluent Email and Git hub'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-7295075951885985695</id><published>2011-09-07T20:31:00.001+02:00</published><updated>2011-09-07T20:31:19.911+02:00</updated><title type='text'>Razor Engine, more than just web pages</title><content type='html'>&lt;p&gt;Will working with a pet project I came across the need to populate a standard message with certain data values. Enter templating.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;First thing anyone might do is add the templating mechanism to the message distribution stack. I take a slightly different stance on this. I believe the message distribution stack should have no knowledge of the templates being used. All it should effectively do is distribute the formatted message according to the specified communication channel.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles31DA86/Classes6.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Classes" border="0" alt="Classes" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles31DA86/Classes_thumb4.jpg" width="377" height="155" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This means that the piece of code creating the message would have to assign the formatted body to the message object. Something like this:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;Message myMessage = new Message{&lt;br /&gt;    From = &amp;quot;from@domain.com&amp;quot;,&lt;br /&gt;    To = &amp;quot;to@domain.com&amp;quot;,&lt;br /&gt;    Subject = &amp;quot;My Subject&amp;quot;,&lt;br /&gt;    Body = &amp;quot;This is where my super long message that needs to be formatted will go&amp;quot;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;MessageGatewayFactory.CreateGatewayInstance(MessageType.Email).SendMessage(myMessage);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;As you can see the Body is is looking a bit smelly. This could be rectified by using an external resource. Good idea! The problem is that we might (well probably) will have to add dynamic data to the body.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So I started researching some templating solutions. There are some really heavy weight solutions out there. I didn’t want anything heavy weight though and I wanted to use the Razor Engine. My travels led me to a project called Fluent Email. A write up of the project can be found here &lt;a title="http://ping.fm/OBzQo" href="http://ping.fm/ZczOP"&gt;http://ping.fm/q4umY&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;When running through the examples and having a look at the code I noticed that it did everything I needed it to do but not in the fashion I wanted it done. Don’t get me wrong, this project has a great deal of potential and will prove very useful to many projects, it just wasn’t exactly what I was looking for. Digging a little deeper into the source I found the Email class which contained a method to parse a Razor formatted string template and a method to read a Razor formatted file of the disk. BINGO!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So I extracted the two methods and went ahead and changed them accordingly and lined them up with some best practises. This is what came out:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles31DA86/Template5.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Template" border="0" alt="Template" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles31DA86/Template_thumb3.jpg" width="558" height="296" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;and the code looks something like this (remembering our DRY principle &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles31DA86/wlEmoticon-winkingsmile2.png" /&gt;)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Our Interface definition:&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;public interface ITemplateParser{&lt;br /&gt;    string ParseFromFile&amp;lt;T&amp;gt;(string fileName, T model);&lt;br /&gt;    string ParseFromString&amp;lt;T&amp;gt;(string template, T model);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Parser factory:&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;public static class ParserFactory {&lt;br /&gt;    public static ITemplateParser TemplateParser {&lt;br /&gt;        get { return new RazorParserImpl(); }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Parser implementation:&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;class RazorParserImpl : ITemplateParser {&lt;br /&gt;&lt;br /&gt;    public RazorParserImpl(){&lt;br /&gt;        InitializeRazorParser();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /// &amp;lt;summary&amp;gt;&lt;br /&gt;    /// Parses from file.&lt;br /&gt;    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;    /// &amp;lt;typeparam name=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/typeparam&amp;gt;&lt;br /&gt;    /// &amp;lt;param name=&amp;quot;fileName&amp;quot;&amp;gt;Name of the file.&amp;lt;/param&amp;gt;&lt;br /&gt;    /// &amp;lt;param name=&amp;quot;model&amp;quot;&amp;gt;The model.&amp;lt;/param&amp;gt;&lt;br /&gt;    /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br /&gt;    public string ParseFromFile&amp;lt;T&amp;gt;(string fileName, T model){&lt;br /&gt;        var path = GetPath(fileName);&lt;br /&gt;&lt;br /&gt;        using (var textReader = new StreamReader(path)){&lt;br /&gt;            var template = textReader.ReadToEnd();&lt;br /&gt;            return ParseFromString(template, model);&lt;br /&gt;        }        &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /// &amp;lt;summary&amp;gt;&lt;br /&gt;    /// Parses from string.&lt;br /&gt;    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;    /// &amp;lt;typeparam name=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/typeparam&amp;gt;&lt;br /&gt;    /// &amp;lt;param name=&amp;quot;template&amp;quot;&amp;gt;The template.&amp;lt;/param&amp;gt;&lt;br /&gt;    /// &amp;lt;param name=&amp;quot;model&amp;quot;&amp;gt;The model.&amp;lt;/param&amp;gt;&lt;br /&gt;    /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br /&gt;    public string ParseFromString&amp;lt;T&amp;gt;(string template, T model){&lt;br /&gt;        var result = Razor.Parse(template, model);&lt;br /&gt;        return result;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //Some weirdness pointed out by lukencode. Will be validating this further when I get a chance&lt;br /&gt;    /// &amp;lt;summary&amp;gt;&lt;br /&gt;    /// Initializes the razor parser.&lt;br /&gt;    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;    private static void InitializeRazorParser(){&lt;br /&gt;        dynamic temp = new ExpandoObject();&lt;br /&gt;        temp.PlaceHolder = String.Empty;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /// &amp;lt;summary&amp;gt;&lt;br /&gt;    /// Gets the path.&lt;br /&gt;    /// &amp;lt;/summary&amp;gt;&lt;br /&gt;    /// &amp;lt;param name=&amp;quot;fileName&amp;quot;&amp;gt;Name of the file.&amp;lt;/param&amp;gt;&lt;br /&gt;    /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br /&gt;    private static String GetPath(string fileName){&lt;br /&gt;        const string tilde = &amp;quot;~&amp;quot;;&lt;br /&gt;        string output;&lt;br /&gt;&lt;br /&gt;        if (fileName.StartsWith(tilde)) {&lt;br /&gt;            var baseDir = AppDomain.CurrentDomain.BaseDirectory;&lt;br /&gt;            output = Path.GetFullPath(baseDir + fileName.Replace(tilde, String.Empty));&lt;br /&gt;        } else{&lt;br /&gt;            output = Path.GetFullPath(fileName);&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;&lt;br /&gt;        return output;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Usage&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;//Previous look ups left for brevity&lt;br /&gt;var body = ParserFactory.TemplateParser.ParseFromFile(&amp;quot;~/Templates/MyTemplateFile.cshtml&amp;quot;, response.Profile);&lt;br /&gt;&lt;br /&gt;var response = messageManager.SendMessage(new MessageRequest {&lt;br /&gt;            Body = body,&lt;br /&gt;            MessageType = MessageType.SayHello,&lt;br /&gt;            Subject = &amp;quot;Just popped in to say hello&amp;quot;,&lt;br /&gt;            ToId = id&lt;br /&gt;        });&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I decided to define the template parser as an interface to allow expansion on parser and templating engines at a later stage. When this comes about, obviously I will have to change the factory method to return the correct implementation. Yes it might be over kill for now but lose coupling is something I try do from the beginning.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I did submit these changes to the project in case you where wondering. When testing it in the scenarios I needed it in it worked really nicely. I really big thanks to the original author!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Hope you find it useful as well.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;References:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://ping.fm/GkIN2" href="http://ping.fm/DKUam"&gt;http://ping.fm/PZtnC&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://ping.fm/C132I" href="http://ping.fm/iRLIv"&gt;http://ping.fm/qZqKb&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://ping.fm/fgmNU/blob/master/FluentEmail/Email.cs" href="http://ping.fm/fgvZh/blob/master/FluentEmail/Email.cs"&gt;http://ping.fm/IE62R/blob/master/FluentEmail/Email.cs&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-7295075951885985695?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/7295075951885985695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/razor-engine-more-than-just-web-pages_07.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7295075951885985695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7295075951885985695'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/razor-engine-more-than-just-web-pages_07.html' title='Razor Engine, more than just web pages'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-6369308241708787963</id><published>2011-09-06T00:37:00.001+02:00</published><updated>2011-09-06T00:37:08.078+02:00</updated><title type='text'>Razor Engine, more than just web pages</title><content type='html'>&lt;p&gt;Will working with a pet project I cam across the need to populate a standard message with certain data values. Enter templating.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;First thing anyone might do is add the templating mechanism to the message distribution stack. I take a slightly different stance on this. I believe the message distribution stack should have no knowledge of the templates being used. All it should effectively do is distribute the formatted message according to the specified communication channel.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfilesA73056/Classes[6].jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Classes" border="0" alt="Classes" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfilesA73056/Classes_thumb[4].jpg" width="377" height="155" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This means that the piece of code creating the message would have to assign the formatted body to the message object. Something like this:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;Message myMessage = new Message{&lt;br /&gt;    From = &amp;quot;from@domain.com&amp;quot;,&lt;br /&gt;    To = &amp;quot;to@domain.com&amp;quot;,&lt;br /&gt;    Subject = &amp;quot;My Subject&amp;quot;,&lt;br /&gt;    Body = &amp;quot;This is where my super long message that needs to be formatted will go&amp;quot;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;MessageGatewayFactory.CreateGatewayInstance(MessageType.Email).SendMessage(myMessage);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;As you can see the Body is is looking a bit smelly. This could be rectified by using an external resource. Good idea! The problem is that we might (well probably) will have to add dynamic data to the body.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So I started researching some templating solutions. There are some really heavy weight solutions out there. I didn’t want anything heavy weight though and I wanted to use the Razor Engine. My travels led me to a project called Fluent Email. A write up of the project can be found here &lt;a title="http://lukencode.com/2011/04/30/fluent-email-now-supporting-razor-syntax-for-templates/" href="http://lukencode.com/2011/04/30/fluent-email-now-supporting-razor-syntax-for-templates/"&gt;http://lukencode.com/2011/04/30/fluent-email-now-supporting-razor-syntax-for-templates/&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;When running through the examples and having a look at the code I noticed that it did everything I needed it to do but not in the fashion I wanted it done. Don’t get me wrong, this project has a great deal of potential and will prove very useful to many projects, it just wasn’t exactly what I was looking for. Digging a little deeper into the source I found the Email class which contained a method to parse a Razor formatted string template and a method to read a Razor formatted file of the disk. BINGO!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So I extracted the two methods and went ahead and changed them accordingly and lined them up with some best practises. This is what came out:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfilesA73056/Template[5].jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Template" border="0" alt="Template" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfilesA73056/Template_thumb[3].jpg" width="558" height="296" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;and the code looks something like this (remembering our DRY principle &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfilesA73056/wlEmoticon-winkingsmile%5B2%5D.png" /&gt;)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Our Interface definition:&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;public interface ITemplateParser{&lt;br /&gt;    string ParseFromFile&amp;lt;T&amp;gt;(string fileName, T model);&lt;br /&gt;    string ParseFromString&amp;lt;T&amp;gt;(string template, T model);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Parser factory:&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;public static class ParserFactory {&lt;br /&gt;    public static ITemplateParser TemplateParser {&lt;br /&gt;        get { return new RazorParserImpl(); }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Parser implementation:&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;class RazorParserImpl : ITemplateParser {&lt;br /&gt;&lt;br /&gt;    public RazorParserImpl(){&lt;br /&gt;        InitializeRazorParser();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public string ParseFromFile&amp;lt;T&amp;gt;(string fileName, T model){&lt;br /&gt;        const string tilde = &amp;quot;~&amp;quot;;&lt;br /&gt;        if (fileName.StartsWith(tilde)) {&lt;br /&gt;            var baseDir = AppDomain.CurrentDomain.BaseDirectory;&lt;br /&gt;            fileName = Path.GetFullPath(baseDir + fileName.Replace(tilde, String.Empty));&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        var path = Path.GetFullPath(fileName);&lt;br /&gt;        var template  = String.Empty;&lt;br /&gt;&lt;br /&gt;        using (var textReader = new StreamReader(path)){&lt;br /&gt;            template = textReader.ReadToEnd();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        return ParseFromString(template, model);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public string ParseFromString&amp;lt;T&amp;gt;(string template, T model){&lt;br /&gt;        &lt;br /&gt;        var result = Razor.Parse(template, model);&lt;br /&gt;        return result;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //Some weirdness pointed out by lukencode. Will be validating this further when I get a chance&lt;br /&gt;    private static void InitializeRazorParser(){&lt;br /&gt;        dynamic temp = new ExpandoObject();&lt;br /&gt;        temp.PlaceHolder = String.Empty;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Usage&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;//Previous look ups left for brevity&lt;br /&gt;var body = ParserFactory.TemplateParser.ParseFromFile(&amp;quot;~/Templates/MyTemplateFile.cshtml&amp;quot;, response.Profile);&lt;br /&gt;&lt;br /&gt;var response = messageManager.SendMessage(new MessageRequest {&lt;br /&gt;            Body = body,&lt;br /&gt;            MessageType = MessageType.SayHello,&lt;br /&gt;            Subject = &amp;quot;Just popped in to say hello&amp;quot;,&lt;br /&gt;            ToId = id&lt;br /&gt;        });&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I decided to define the template parser as an interface to allow expansion on parser and templating engines at a later stage. When this comes about, obviously I will have to change the factory method to return the correct implementation. Yes it might be over kill for now but lose coupling is something I try do from the beginning.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I did submit these changes to the project in case you where wondering. When testing it in the scenarios I needed it in it worked really nicely. I really big thanks to the original author!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Hope you find it useful as well.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;References:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://lukencode.com/2011/04/30/fluent-email-now-supporting-razor-syntax-for-templates/" href="http://lukencode.com/2011/04/30/fluent-email-now-supporting-razor-syntax-for-templates/"&gt;http://lukencode.com/2011/04/30/fluent-email-now-supporting-razor-syntax-for-templates/&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="https://github.com/lukencode/FluentEmail" href="https://github.com/lukencode/FluentEmail"&gt;https://github.com/lukencode/FluentEmail&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="https://github.com/lukencode/FluentEmail/blob/master/FluentEmail/Email.cs" href="https://github.com/lukencode/FluentEmail/blob/master/FluentEmail/Email.cs"&gt;https://github.com/lukencode/FluentEmail/blob/master/FluentEmail/Email.cs&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-6369308241708787963?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/6369308241708787963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/razor-engine-more-than-just-web-pages.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6369308241708787963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6369308241708787963'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/razor-engine-more-than-just-web-pages.html' title='Razor Engine, more than just web pages'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-9099619733360862281</id><published>2011-09-05T23:55:00.001+02:00</published><updated>2011-09-05T23:55:15.274+02:00</updated><title type='text'>Seriously, Do not Repeat Yourself</title><content type='html'>&lt;p&gt;A few projects I have been on and off seem to suffer the same problem. Tight deadlines and the dreaded Ctrl+C, Ctrl+V. I honestly can’t figure out how this happens. Repeated logic is not consolidated into a single method that performs the required actions and returns the result.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Let me illustrate the problem very quickly&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;public Class1 CreateInstanceOfClass1(SuperInformation superInformation){&lt;br /&gt;    var myInstance = new Class1();&lt;br /&gt;    &lt;br /&gt;    myInstance.SuperInfo = superInformation;&lt;br /&gt;&lt;br /&gt;    return myInstance;   &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Class2 CreateInstanceOfClass2(SuperInformation superInformation){&lt;br /&gt;    var myInstance = new Class2();&lt;br /&gt;    &lt;br /&gt;    myInstance.SuperInfo = superInformation;&lt;br /&gt;&lt;br /&gt;    return myInstance;   &lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Right this is a very simplified example but lets examine it anyway. I am pretty certain that we have all gathered that these methods create an instance of class, assign a shared object to it and return it.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Do you notice a pattern here? Every time an instance of the object is created the shared superInformation definition is assigned to the instance and returned. Can anyone see how we are repeating ourselves? How do you think we might resolve this? Well my first thoughts would be to use a generic mechanism to create the instance and assign the shared object to the instance.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This might look something like&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;public T CreateClassInstance&amp;lt;T&amp;gt;(SuperInformation superInfo){&lt;br /&gt;    var output = Activator.CreateInstance(typeof(T));&lt;br /&gt;    &lt;br /&gt;    output.getType().getProperty(&amp;quot;SuperInfo&amp;quot;).SetValue(output, superInfo, null);&lt;br /&gt;&lt;br /&gt;    return output;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Which now changes our code to in the first example to&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: csharp;"&gt;public Class1 CreateInstanceOfClass1(SuperInformation superInformation){&lt;br /&gt;    return CreateClassInstance &amp;lt;Class1&amp;gt;(superInformation);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Class2 CreateInstanceOfClass2(SuperInformation superInformation){&lt;br /&gt;    return CreateClassInstance &amp;lt;Class2&amp;gt;(superInformation);  &lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Well that is one way of addressing the issue using Generics in C#. A similar mechanism can be applied to if else statements following the same logical flow inside different functions.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I guess the point of this article is this. If you copy and paste one piece of code you have replicated that code. If that code contains one bug, you have now created two bugs. If something intrinsic to the one changes you have an additional place to go and change. Perhaps I am just to pedantic but I am incline to state that if you replicate one piece of code, you would be far better off wrapping it into a general method. This doesn’t mean trying to find all places this might potentially happen. In my experience, code bases are organic (well kinda). They grow, they change, the expand, they contract. When the expansion happens, expand with wisdom, when they contract, shrink with wisdom, when they change, change with wisdom. We can all identify a pattern in our code. If you identify one, fix it. I know the deadlines are tight but taking a shortcut now my cost a substantial amount to rectify down the line when the 4th change set comes in. If you identify something that you can fix with out adding risk to the project then do it. If it means an extra hour behind the machine, do it.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If you are working on a legacy project and are asked to add features to the project be smart. If you see that the previous code base was replicating code, don’t do the same thing! Identify the pattern and figure out how to not replicate the code in your feature set. Do not push these changes across the whole system unless you have done a risk analysis. Keep your area clean. Be proud of your work and craft it. To often it is just a matter of writing as much code as possible in the most contrived fashion possible to prove how smart we are. I tell you something, you are going to look like an idiot when the next guy steps in and has to work with your code. Don’t be afraid to ask for help, don’t be so arrogant as to not give help when asked for. At the end of the day, the success of the project is not based on an individuals effort but the combine effort of the team involved in the project. Work together and deliver something you can all stand back and look at with admiration. If projects fail we need to take a hard look at ourselves and accept responsibility, no finger pointing.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Code hard, think hard and polish until&amp;#160; it is done and by virtue of the fact that it continually changes, it never is done &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles840C80/wlEmoticon-winkingsmile%5B2%5D.png" /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-9099619733360862281?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/9099619733360862281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/seriously-do-not-repeat-yourself.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/9099619733360862281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/9099619733360862281'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/seriously-do-not-repeat-yourself.html' title='Seriously, Do not Repeat Yourself'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-3350767202103675244</id><published>2011-09-02T10:31:00.001+02:00</published><updated>2011-09-02T10:31:58.635+02:00</updated><title type='text'>SABC TV Licenses</title><content type='html'>&lt;p&gt;So I get this nasty letter the other day, demanding I pay my TV license. I then proceed to tell them I have. I am then requested to provide proof of payment. So I attach it to an email and distribute it to the SABC and their debt collection agency. This was three weeks ago. Today I get this:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Your message      &lt;br /&gt;&amp;#160;&amp;#160; To: Justin Dorkin       &lt;br /&gt;&amp;#160;&amp;#160; Subject: Outstanding TV license account - TV License No: *******       &lt;br /&gt;&amp;#160;&amp;#160; Sent: Thursday, August 11, 2011 9:24:23 PM (UTC+02:00) Harare, Pretoria       &lt;br /&gt;was deleted without being read on Wednesday, August 31, 2011 9:50:29 AM (UTC+02:00) Harare, Pretoria.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;     &lt;br /&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&amp;#160;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Though it was funny how it was “demanded” of me to pay and prove it yet when I do comply it is not even considered.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Another update to the unread email saga:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Your message      &lt;br /&gt;&amp;#160;&amp;#160; To: Gina Grond      &lt;br /&gt;&amp;#160;&amp;#160; Subject: Outstanding TV license account - TV License No: ******&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&amp;#160;&amp;#160; Sent: Thursday, August 11, 2011 9:24:23 PM (UTC+02:00) Harare, Pretoria     &lt;br /&gt; was deleted without being read on Friday, September 02, 2011 8:30:51 AM (UTC+02:00) Harare, Pretoria.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Seems no one wants to read my emails &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfilesC2A98/wlEmoticon-sadsmile%5B2%5D.png" /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-3350767202103675244?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/3350767202103675244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/sabc-tv-licenses.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/3350767202103675244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/3350767202103675244'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/09/sabc-tv-licenses.html' title='SABC TV Licenses'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-7537942981526836911</id><published>2011-08-31T10:08:00.001+02:00</published><updated>2011-08-31T10:08:52.414+02:00</updated><title type='text'>SABC TV Licenses</title><content type='html'>&lt;p&gt;So I get this nasty letter the other day, demanding I pay my TV license. I then proceed to tell them I have. I am then requested to provide proof of payment. So I attach it to an email and distribute it to the SABC and their debt collection agency. This was three weeks ago. Today I get this:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Your message      &lt;br /&gt;&amp;#160;&amp;#160; To: Justin Dorkin      &lt;br /&gt;&amp;#160;&amp;#160; Subject: Outstanding TV license account - TV License No: *******      &lt;br /&gt;&amp;#160;&amp;#160; Sent: Thursday, August 11, 2011 9:24:23 PM (UTC+02:00) Harare, Pretoria      &lt;br /&gt; was deleted without being read on Wednesday, August 31, 2011 9:50:29 AM (UTC+02:00) Harare, Pretoria.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Though it was funny how it was “demanded” of me to pay and prove it yet when I do comply it is not even considered.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-7537942981526836911?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/7537942981526836911/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/sabc-tv-licenses.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7537942981526836911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7537942981526836911'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/sabc-tv-licenses.html' title='SABC TV Licenses'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-7074166495366825092</id><published>2011-08-29T15:53:00.001+02:00</published><updated>2011-08-29T15:53:42.281+02:00</updated><title type='text'>mDesktopâ€“Multiple dekstops on Windows 7</title><content type='html'>&lt;p&gt;I have been quiet annoyed for sometime now because I cannot have multiple desktops. I was using a product called Dexpot but it for some reason stopped working so I went fishing to see what I could find. Every desktop manager I came across was bloated, didn’t work properly and just didn’t fit the bill. I wanted a light weight desktop switching application for Windows 7.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I was just about to give up and start writing my own when I cam across mDesktop. Brilliant! Light weight, small foot print. Very cool.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;You can find it here &lt;a title="http://ping.fm/kDUhi" href="http://ping.fm/eJgHs"&gt;http://ping.fm/dx9au&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Cheat sheet:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Alt+Desktop Index (e.g. Alt+1, Alt+2...) switches between desktops &lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Alt+Ctrl+Desktop Index sends the active window to the Desktop Index&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Happy days! Perhaps Microsoft will catch a wake up one day regarding multiple desktops. The API is there, can’t for the life of me figure out why they haven’t done this.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-7074166495366825092?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/7074166495366825092/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/mdesktopamultiple-dekstops-on-windows-7.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7074166495366825092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7074166495366825092'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/mdesktopamultiple-dekstops-on-windows-7.html' title='mDesktopâ€“Multiple dekstops on Windows 7'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-6700267954963531485</id><published>2011-08-26T03:18:00.001+02:00</published><updated>2011-08-26T03:18:35.150+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='606060'/><category scheme='http://www.blogger.com/atom/ns#' term='008000'/><category scheme='http://www.blogger.com/atom/ns#' term='0000ff'/><category scheme='http://www.blogger.com/atom/ns#' term='f4f4f4'/><title type='text'>C# Arrays, extension methods and the way not to do something</title><content type='html'>&lt;p&gt;Right let me first start of by saying, the problem that this code solves should never exist, and I mean NEVER! There is no good reason to have to do this unless you have a legacy system that has all of a sudden had the carpet pulled out from underneath it, you have to add new functionality and if you don’t get it done on time (which is the next three days) the world will end. Seriously though, avoid this at all costs if you possibly can.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;Right that being said, I had a problem where by thousands of lines of code had been written against a SOAP service which made use of collections had been written many moons ago. Recently the definitions changed and all the collections were now arrays! The proxies are generated against svcutil and yes I know there is a switch to use collections as opposed to arrays but I entered the project at a time were it had been decided to convert all the code using the collections. Right this posed a significant problem in that myObject.Collection.Add() no longer existed.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;My first thought (yes perhaps not one of my greatest moments) was to do this&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;//given &lt;br /&gt;myObject.Collection.Add(myNewItem); &lt;br /&gt;&lt;br /&gt;//Convert it to &lt;br /&gt;myObject.Array.ToList().Add(myNewItem);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now for some reason this made sense in my head till I did it and found out it wasn’t working. Why wasn’t it working? You guessed it! The instance of ToList() was not being assigned to the collection. DOH!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Well my next solution was to implement a generic method that converted the array to a list, added the item then converted the list back to an array. Something like this.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;class&lt;/span&gt; ArrayHelper{&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;static&lt;/span&gt; &lt;span style="color: 0000ff"&gt;void&lt;/span&gt; Add&lt;T&gt;(&lt;span style="color: 0000ff"&gt;ref&lt;/span&gt; T[] array, T input) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;if&lt;/span&gt; (array == &lt;span style="color: 0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;             array = &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; T[0];&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;         var list = array.ToList();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt;         list.Add(input);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt;         array = list.ToArray();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum9"&gt;   9:&lt;/span&gt;     }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum10"&gt;  10:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum11"&gt;  11:&lt;/span&gt; &lt;span style="color: 008000"&gt;//Usage would be&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum12"&gt;  12:&lt;/span&gt; ArrayHelper.Add(&lt;span style="color: 0000ff"&gt;ref&lt;/span&gt; myObject.Array, myNewItem);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Well that looks a bit better and the best part? It works! Well kinda &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles3A87DAA/wlEmoticon-sadsmile2.png" /&gt; When running performance tests on it it turned out that adding 5000 items to this array it would take 71 milliseconds as opposed to the 2 milliseconds to do it natively. What a bummer. Well back to the drawing board I guess. This means if it takes 0.0004 milliseconds to add one item natively it would take 0.015 milliseconds to add one time using this method. This equates to 37.5 times longer!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I then came across Array.Resize and figured I would see what that does. So the method became:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 008000"&gt;//Class definition&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;static&lt;/span&gt; &lt;span style="color: 0000ff"&gt;void&lt;/span&gt; Add&lt;T&gt;(&lt;span style="color: 0000ff"&gt;ref&lt;/span&gt; T[] array, T input){&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;if&lt;/span&gt;(array == &lt;span style="color: 0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;         array = &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; T[0];&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;         Array.Resize(&lt;span style="color: 0000ff"&gt;ref&lt;/span&gt; array, array.Length + 1);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt;         array[array.Length - 1] = input;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum9"&gt;   9:&lt;/span&gt; //Usage remains the same&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This method took 10 times longer to add 5000 items. This means it would take 0.004 milliseconds to add one item. A bit more acceptable. Now thinking I am the cheese I wanted to wrap this into an extension method. My first attempt failed so I started looking around if anyone else had done this. Seems someone had &lt;a title="http://these-pretzels-are-making-me-thlrsty.blogspot.com/2010/05/c-extension-method-bummer.html" href="http://these-pretzels-are-making-me-thlrsty.blogspot.com/2010/05/c-extension-method-bummer.html"&gt;http://these-pretzels-are-making-me-thlrsty.blogspot.com/2010/05/c-extension-method-bummer.html&lt;/a&gt; and verified what I was too scared to admit, it wasn’t going to happen as an extension! Again this is an elegant solution to a problem that should never have existed.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Oh well …&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;References:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://www.dotnetperls.com/array-resize" href="http://www.dotnetperls.com/array-resize"&gt;http://www.dotnetperls.com/array-resize&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;//given&lt;br /&gt;  &lt;br /&gt;myObject.Collection.Add(myNewItem);&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;//Convert it to&lt;br /&gt;  &lt;br /&gt;myObject.Array.ToList().Add(myNewItem);&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-6700267954963531485?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/6700267954963531485/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/c-arrays-extension-methods-and-way-not_26.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6700267954963531485'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6700267954963531485'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/c-arrays-extension-methods-and-way-not_26.html' title='C# Arrays, extension methods and the way not to do something'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-2838961311512593818</id><published>2011-08-25T18:58:00.001+02:00</published><updated>2011-08-25T18:58:01.400+02:00</updated><title type='text'>In Flames â€œSounds of a playground fadingâ€</title><content type='html'>&lt;p&gt;In Flames has without doubt, in my opinion produced a master piece with this new album. The sound is raw, something I noticed in the Iron Maiden album “Final Frontier”. It is not over produced, it is just right. I really hope this becomes a trend with current bands, letting the musicians abilities speak as opposed to post production covering everything up leaving you with a thick soup lacking any texture, very quickly becoming unpalatable.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The new album sees In Flames go back to the roots of their art as first displayed in “Whoracle” (which is still one of my favourites). The guitar harmonies are back, holes of silence appear filled with nuances that add flavour back to their music.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The great metal bands of old can be heard as their influences again which I truly enjoy. Yet even though the influences can be heard the overall sound is still undoubtedly their own. The best part out about the album is the price. I cringed as I asked what the price of the disk was and was pleasantly surprised to hear “R139.00” as opposed to the “R270.00” I had become accustomed to. Basically half price! Could this drop in price be due to the fact that people can now buy single tracks online and the demand for hard media is dropping? I certainly hope the downward trend in pricing continues because it became seriously out of hand at a stage in South Africa.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Well that is that, fantastic job to In Flames and all involved in the new album. I am thoroughly enjoying it and cannot wait to get it onto my portable player and give it a listen while taking a long ride. I love the strong anthem flavour prevalent in most of the tracks and take my hat off to the craftsmanship. Perhaps a change in line up is what the band needed to stabilise itself again? Though it is sad to see a member leave sometimes change allows retrospect and a realigning back to the original vision that got them to where they are.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-2838961311512593818?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/2838961311512593818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/in-flames-asounds-of-playground-fadinga.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/2838961311512593818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/2838961311512593818'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/in-flames-asounds-of-playground-fadinga.html' title='In Flames â€œSounds of a playground fadingâ€'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-1468032618031237392</id><published>2011-08-25T00:04:00.001+02:00</published><updated>2011-08-25T00:04:17.154+02:00</updated><title type='text'>Ard Matthews and the botched South African national anthem.</title><content type='html'>&lt;p&gt;Look, I am going state outright that I don’t like the guy’s music. I never have and I never will. You might and that is your prerogative. In terms of marketing and producing something that sells, well he seems to have got that right so credit where it is due I suppose.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Right, now on to the South African national anthem. Lets be honest, I mean brutally honest. When performing a national anthem you generally are going to be unaccompanied with very little effects. This mean you best have a vocal range above or below a semi-tone. I am sorry but it is the truth. Singing in a studio now a days is one thing. Stacks of pitch correctors, reverb, echoes and many more things to make you sound like a rock opera singing. Multiple takes to get it right, pitch shifting and the list goes on and on!&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Then we move on to live gigs performing with your band. Generally the sound is so out of whack, levels are all over the place and then add in the alcohol and weed floating around ANYTHING is going to sound good.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Then we look at the national anthem. First let us define national anthem:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;“A national anthem (also national hymn, song etc.) is a generally patriotic musical composition that evokes and eulogizes the history, traditions and struggles of its people, recognized either by a nation's government as the official national song, or by convention through use by the people.”&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="http://ping.fm/KOtFa" href="http://ping.fm/F1gg5"&gt;http://ping.fm/veRiY&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So with that in mind let us consider what a good candidate to sing a national anthem would be:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;A child (as illustrated by the FNB advert)&lt;/li&gt;    &lt;li&gt;Someone with a voice that has the capacity to describe the emotion of what is being sung&lt;/li&gt;    &lt;li&gt;Someone with a vocal range and strength that doesn’t require accompaniment.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The point being that the singer HAS to be able to evoke enough emotion and patriotism in the audience listen that they end up standing with their right hand clenched over their heart singing the national anthem with a tear running down their cheek as they sing the last line of their anthem.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Well Ard Matthews 1) is not a child (although it looks like his mom still dresses him) 2) Has a voice that carries no emotion 3) Does not have a voice that is strong enough to go without accompaniment. So in my opinion no, he shouldn’t have done it. Perhaps pride got the better of him? Ag who knows. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;To Ard Matthews, sorry bud. I can’t even say nice try. At least you know now for next time.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In Ard Matthews defence: our national anthem is not one that evokes a great deal of emotion. It is wishy washy and tries to please everyone. In my opinion it should have been rewritten in it’s entirety. Not borrowed from bits and pieces of everything.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;To close: I remember the days when you would stand when you heard the national anthem, the days you&amp;#160; would sing it in school laughing and joking about it yet feeling and overwhelming sense of pride because it belonged to your country.I also remember the days where the youth stood up for the elderly on buses, men let woman through the door first, adults where respected not because they could dish out a hiding but because they had been around longer, sportsman held down full time jobs and children ran around outside playing sports, climbing trees and building forts. Fond memories, stashed alongside the ones of singing my country’s national anthem.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;P.S. for all those that are going to bin the old regime labels on me, don’t bother. I am not condoning what previous political parties did, all I want is the same sort of pride in our country that was found then to prevail today and in the future. Everyone in our country just wants to make enough money to get out. Don’t believe me? Go ahead and ask your buddies how many of them would leave if they could. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;P.S.S If you turn this comment thread into a political soap box I will remove your comments. If your comments are objective they will stay, I don’t want emotional baggage here.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-1468032618031237392?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/1468032618031237392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/ard-matthews-and-botched-south-african.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1468032618031237392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1468032618031237392'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/ard-matthews-and-botched-south-african.html' title='Ard Matthews and the botched South African national anthem.'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-6482623740290527764</id><published>2011-08-24T19:02:00.001+02:00</published><updated>2011-08-24T19:02:06.181+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='606060'/><category scheme='http://www.blogger.com/atom/ns#' term='008000'/><category scheme='http://www.blogger.com/atom/ns#' term='0000ff'/><category scheme='http://www.blogger.com/atom/ns#' term='f4f4f4'/><title type='text'>C# Arrays, extension methods and the way not to do something</title><content type='html'>&lt;p&gt;Right let me first start of by saying, the problem that this code solves should never exist, and I mean NEVER! There is no good reason to have to do this unless you have a legacy system that has all of a sudden had the carpet pulled out from underneath it, you have to add new functionality and if you don’t get it done on time (which is the next three days) the world will end. Seriously though, avoid this at all costs if you possibly can.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;Right that being said, I had a problem where by thousands of lines of code had been written against a SOAP service which made use of collections had been written many moons ago. Recently the definitions changed and all the collections were now arrays! The proxies are generated against svcutil and yes I know there is a switch to use collections as opposed to arrays but I entered the project at a time were it had been decided to convert all the code using the collections. Right this posed a significant problem in that myObject.Collection.Add() no longer existed.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;My first thought (yes perhaps not one of my greatest moments) was to do this&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 008000"&gt;//given&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; myObject.Collection.Add(myNewItem);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: 008000"&gt;//Convert it to&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt; myObject.Array.ToList().Add(myNewItem);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now for some reason this made sense in my head till I did it and found out it wasn’t working. Why wasn’t it working? You guessed it! The instance of ToList() was not being assigned to the collection. DOH!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Well my next solution was to implement a generic method that converted the array to a list, added the item then converted the list back to an array. Something like this.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;class&lt;/span&gt; ArrayHelper{&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;static&lt;/span&gt; &lt;span style="color: 0000ff"&gt;void&lt;/span&gt; Add&lt;T&gt;(&lt;span style="color: 0000ff"&gt;ref&lt;/span&gt; T[] array, T input) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;if&lt;/span&gt; (array == &lt;span style="color: 0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;             array = &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; T[0];&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;         var list = array.ToList();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt;         list.Add(input);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt;         array = list.ToArray();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum9"&gt;   9:&lt;/span&gt;     }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum10"&gt;  10:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum11"&gt;  11:&lt;/span&gt; &lt;span style="color: 008000"&gt;//Usage would be&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum12"&gt;  12:&lt;/span&gt; ArrayHelper.Add(&lt;span style="color: 0000ff"&gt;ref&lt;/span&gt; myObject.Array, myNewItem);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Well that looks a bit better and the best part? It works! Well kinda &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfiles4841E1/wlEmoticon-sadsmile%5B2%5D.png" /&gt; When running performance tests on it it turned out that adding 5000 items to this array would take approximately 35 times longer than doing it natively. What a bummer. Well back to the drawing board I guess. This means if it takes 0.0004 milliseconds to add one item natively it would take 0.015 milliseconds to add one time using this method.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I then came across Array.Resize and figured I would see what that does. So the method became:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 008000"&gt;//Class definition&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;static&lt;/span&gt; &lt;span style="color: 0000ff"&gt;void&lt;/span&gt; Add&lt;T&gt;(&lt;span style="color: 0000ff"&gt;ref&lt;/span&gt; T[] array, T input){&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;if&lt;/span&gt;(array == &lt;span style="color: 0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;         array = &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; T[0];&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;         Array.Resize(&lt;span style="color: 0000ff"&gt;ref&lt;/span&gt; array, array.Length + 1);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt;         array[array.Length - 1] = input;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum9"&gt;   9:&lt;/span&gt; //Usage remains the same&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This method took 10 times longer to add 5000 items. This means it would take 0.004 milliseconds to add one item. A bit more acceptable. Now thinking I am the cheese I wanted to wrap this into an extension method. My first attempt failed so I started looking around if anyone else had done this. Seems someone had &lt;a title="http://these-pretzels-are-making-me-thlrsty.blogspot.com/2010/05/c-extension-method-bummer.html" href="http://these-pretzels-are-making-me-thlrsty.blogspot.com/2010/05/c-extension-method-bummer.html"&gt;http://these-pretzels-are-making-me-thlrsty.blogspot.com/2010/05/c-extension-method-bummer.html&lt;/a&gt; and verified what I was too scared to admit, it wasn’t going to happen as an extension!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Oh well …&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;References:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://www.dotnetperls.com/array-resize" href="http://www.dotnetperls.com/array-resize"&gt;http://www.dotnetperls.com/array-resize&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-6482623740290527764?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/6482623740290527764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/c-arrays-extension-methods-and-way-not.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6482623740290527764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6482623740290527764'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/c-arrays-extension-methods-and-way-not.html' title='C# Arrays, extension methods and the way not to do something'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-3752587911945835700</id><published>2011-08-22T21:35:00.001+02:00</published><updated>2011-08-22T21:35:09.708+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='800000'/><category scheme='http://www.blogger.com/atom/ns#' term='006080'/><category scheme='http://www.blogger.com/atom/ns#' term='606060'/><category scheme='http://www.blogger.com/atom/ns#' term='008000'/><category scheme='http://www.blogger.com/atom/ns#' term='0000ff'/><category scheme='http://www.blogger.com/atom/ns#' term='ff0000'/><category scheme='http://www.blogger.com/atom/ns#' term='f4f4f4'/><title type='text'>Unobtrusive label to textbox association using JQuery</title><content type='html'>&lt;p&gt;Well things just seem to be getting easier and easier. Next up I have a form that I wanted to try the concept of unobtrusive JavaScript on. The form is relatively simple containing two labels and text boxes for a first name and a last name. Here we have the form in Razor (MVC3)&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: 800000"&gt;form&lt;/span&gt; &lt;span style="color: ff0000"&gt;id&lt;/span&gt;&lt;span style="color: 0000ff"&gt;="registrationForm"&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; @Html.LabelFor(x =&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt; x.FirstName)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt; @Html.TextBoxFor(x =&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt; x.FirstName)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: 800000"&gt;br&lt;/span&gt; &lt;span style="color: 0000ff"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt; @Html.LabelFor(x =&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt; x.LastName)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt; @Html.TextBoxFor(x =&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt; x.LastName)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: 800000"&gt;form&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Then I started experimenting with the page JavaScript is located in a separate file. So it would be included in a script tag. It actually turned out way simpler than I initially thought.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here is my first iteration of the JavaScript file&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 008000"&gt;/**&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: 008000"&gt;* Configure the function to handle the label insertion into&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: 008000"&gt;* the text areas&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: 008000"&gt;*/&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt; $(&lt;span style="color: 0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;     $(&lt;span style="color: 006080"&gt;'#registrationForm label'&lt;/span&gt;).each(&lt;span style="color: 0000ff"&gt;function&lt;/span&gt; (i) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; label = $(&lt;span style="color: 0000ff"&gt;this&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; textBoxId = &lt;span style="color: 006080"&gt;"#"&lt;/span&gt; + label.attr(&lt;span style="color: 006080"&gt;"for"&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum9"&gt;   9:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; text = label.text();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum10"&gt;  10:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; textBox = $(textBoxId).val(text);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum11"&gt;  11:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum12"&gt;  12:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum13"&gt;  13:&lt;/span&gt;         textBox.focus(&lt;span style="color: 0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum14"&gt;  14:&lt;/span&gt;             &lt;span style="color: 0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: 0000ff"&gt;this&lt;/span&gt;.value == text) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum15"&gt;  15:&lt;/span&gt;                 &lt;span style="color: 0000ff"&gt;this&lt;/span&gt;.value = &lt;span style="color: 006080"&gt;""&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum16"&gt;  16:&lt;/span&gt;             }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum17"&gt;  17:&lt;/span&gt;         })&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum18"&gt;  18:&lt;/span&gt;         .blur(&lt;span style="color: 0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum19"&gt;  19:&lt;/span&gt;             &lt;span style="color: 0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: 0000ff"&gt;this&lt;/span&gt;.value == &lt;span style="color: 006080"&gt;""&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum20"&gt;  20:&lt;/span&gt;                 &lt;span style="color: 0000ff"&gt;this&lt;/span&gt;.value = text;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum21"&gt;  21:&lt;/span&gt;         });&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum22"&gt;  22:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum23"&gt;  23:&lt;/span&gt;         label.hide();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum24"&gt;  24:&lt;/span&gt;     });&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum25"&gt;  25:&lt;/span&gt; });&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And that, honestly, was that. Of course looking at that I couldn’t help but feel it better to wrap it in a function so I don’t have to replicate that code on every form. So this is what I ended up with in my handy little helper class:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;function&lt;/span&gt; Helper() { }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt; Helper.processFormLabels = &lt;span style="color: 0000ff"&gt;function&lt;/span&gt; (formId) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; query = &lt;span style="color: 006080"&gt;"#"&lt;/span&gt; + formId + &lt;span style="color: 006080"&gt;" label"&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt;     $(query).each(&lt;span style="color: 0000ff"&gt;function&lt;/span&gt; (i) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; label = $(&lt;span style="color: 0000ff"&gt;this&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; textBoxId = &lt;span style="color: 006080"&gt;"#"&lt;/span&gt; + label.attr(&lt;span style="color: 006080"&gt;"for"&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; text = label.text();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum9"&gt;   9:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; textBox = $(textBoxId).val(text);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum10"&gt;  10:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum11"&gt;  11:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum12"&gt;  12:&lt;/span&gt;         textBox.focus(&lt;span style="color: 0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum13"&gt;  13:&lt;/span&gt;             &lt;span style="color: 0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: 0000ff"&gt;this&lt;/span&gt;.value == text) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum14"&gt;  14:&lt;/span&gt;                 &lt;span style="color: 0000ff"&gt;this&lt;/span&gt;.value = &lt;span style="color: 006080"&gt;""&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum15"&gt;  15:&lt;/span&gt;             }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum16"&gt;  16:&lt;/span&gt;         })&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum17"&gt;  17:&lt;/span&gt;         .blur(&lt;span style="color: 0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum18"&gt;  18:&lt;/span&gt;             &lt;span style="color: 0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: 0000ff"&gt;this&lt;/span&gt;.value == &lt;span style="color: 006080"&gt;""&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum19"&gt;  19:&lt;/span&gt;                 &lt;span style="color: 0000ff"&gt;this&lt;/span&gt;.value = text;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum20"&gt;  20:&lt;/span&gt;         });&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum21"&gt;  21:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum22"&gt;  22:&lt;/span&gt;         label.hide();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum23"&gt;  23:&lt;/span&gt;     });&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum24"&gt;  24:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Then the document on load script looks like this&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 008000"&gt;/**&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: 008000"&gt;* Configure the function to handle the label insertion into&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: 008000"&gt;* the text areas&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: 008000"&gt;*/&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt; $(&lt;span style="color: 0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;     Helper.processFormLabels(&lt;span style="color: 006080"&gt;"registrationForm"&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt; });&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Include all relevant JavaScript files and viola! Off you go.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-3752587911945835700?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/3752587911945835700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/unobtrusive-label-to-textbox.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/3752587911945835700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/3752587911945835700'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/unobtrusive-label-to-textbox.html' title='Unobtrusive label to textbox association using JQuery'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-6607813532796693859</id><published>2011-08-22T20:15:00.001+02:00</published><updated>2011-08-22T20:15:00.887+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='800000'/><category scheme='http://www.blogger.com/atom/ns#' term='006080'/><category scheme='http://www.blogger.com/atom/ns#' term='606060'/><category scheme='http://www.blogger.com/atom/ns#' term='008000'/><category scheme='http://www.blogger.com/atom/ns#' term='0000ff'/><category scheme='http://www.blogger.com/atom/ns#' term='ff0000'/><category scheme='http://www.blogger.com/atom/ns#' term='f4f4f4'/><title type='text'>ASP.NET, MVC3, Razor and adding scripts where they supposed to go</title><content type='html'>&lt;p&gt;I was always under the impression that the HEAD of an HTML document contained the SCRIPT tags. Call me old fashioned but I actually quiet like it that way.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;Then I cam across a discussion at &lt;a title="http://stackoverflow.com/questions/1213281/does-javascript-have-to-be-in-the-head-tags" href="http://stackoverflow.com/questions/1213281/does-javascript-have-to-be-in-the-head-tags"&gt;http://stackoverflow.com/questions/1213281/does-javascript-have-to-be-in-the-head-tags&lt;/a&gt; concerning this very thing. So say HEAD, some say BODY and some say WHERE_EVER_YOU_WANT. I then went and confirmed the HEAD and BODY issue at &lt;a href="http://www.w3.org/TR/html4/interact/scripts.html"&gt;http://www.w3.org/TR/html4/interact/scripts.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;I can see validity in the arguments but with the advent of the unobtrusive JavaScript model I am beginning to wonder if arguments like this are really valid any longer. I also question being able to see the page before being able to use it is such a good idea. I personally would prefer the user is not able to see anything till the code to assist them has loaded. Again with the unobtrusive JavaScript stuff, my argument is also flawed.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;Either way, I decided I wanted a mechanism where I could add the path to a collection and it would be inserted into the page in a central location, top or bottom, HEAD or BODY.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;So I had a look at the ViewBag now offered in MVC 3 and decided it would be the best place to have a collection like this. Seeing as it is dynamic and available on all pages it made the most sense. I didn’t want to have to go and create a store to store the collection in and then query it before rendering, I just wanted it to work so below is what I came up with:&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 008000"&gt;//Inside the view page&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; @{&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;     ViewBag.Title = &lt;span style="color: 006080"&gt;"MyPage"&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;     ViewBag.Scripts = &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; List&lt;String&gt; { &lt;span style="color: 006080"&gt;"Pages/MyPage.js"&lt;/span&gt; };&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Then in the master or layout page you can quiet easily do this:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: 800000"&gt;head&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: 800000"&gt;title&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;@ViewBag.Title&lt;span style="color: 0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: 800000"&gt;title&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: 800000"&gt;link&lt;/span&gt; &lt;span style="color: ff0000"&gt;href&lt;/span&gt;&lt;span style="color: 0000ff"&gt;="@Url.Content("&lt;/span&gt;~/&lt;span style="color: ff0000"&gt;Content&lt;/span&gt;/&lt;span style="color: ff0000"&gt;Site&lt;/span&gt;.&lt;span style="color: ff0000"&gt;css&lt;/span&gt;&lt;span style="color: 0000ff"&gt;")"&lt;/span&gt; &lt;span style="color: ff0000"&gt;rel&lt;/span&gt;&lt;span style="color: 0000ff"&gt;="stylesheet"&lt;/span&gt; &lt;span style="color: ff0000"&gt;type&lt;/span&gt;&lt;span style="color: 0000ff"&gt;="text/css"&lt;/span&gt; &lt;span style="color: 0000ff"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: 800000"&gt;script&lt;/span&gt; &lt;span style="color: ff0000"&gt;src&lt;/span&gt;&lt;span style="color: 0000ff"&gt;="@Url.Content("&lt;/span&gt;~/&lt;span style="color: ff0000"&gt;Scripts&lt;/span&gt;/&lt;span style="color: ff0000"&gt;jquery-1&lt;/span&gt;.&lt;span style="color: ff0000"&gt;6&lt;/span&gt;.&lt;span style="color: ff0000"&gt;2&lt;/span&gt;.&lt;span style="color: ff0000"&gt;min&lt;/span&gt;.&lt;span style="color: ff0000"&gt;js&lt;/span&gt;&lt;span style="color: 0000ff"&gt;")"&lt;/span&gt; &lt;span style="color: ff0000"&gt;type&lt;/span&gt;&lt;span style="color: 0000ff"&gt;="text/javascript"&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/&lt;/span&gt;&lt;span style="color: 800000"&gt;script&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt;� &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt;     @{&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;if&lt;/span&gt; (ViewBag.Scripts != &lt;span style="color: 0000ff"&gt;null&lt;/span&gt;) {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;             &lt;span style="color: 0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color: 0000ff"&gt;var&lt;/span&gt; script &lt;span style="color: 0000ff"&gt;in&lt;/span&gt; ViewBag.Scripts) {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt;         &lt;script src=&lt;span style="color: 006080"&gt;"@Url.Content("&lt;/span&gt;~/Scripts/&lt;span style="color: 006080"&gt;" + @script)"&lt;/span&gt; type=&lt;span style="color: 006080"&gt;"text/javascript"&lt;/span&gt;&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;span style="color: 0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: 800000"&gt;script&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt;             }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;         }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt;     }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: 800000"&gt;head&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This neatly renders the the script tags into the HEAD section (where I wanted it).&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I then went and created an html helper to do this so I could use without all the verbose checking&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;using&lt;/span&gt; System.Web.Mvc;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;namespace&lt;/span&gt; System.Web.Helpers {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;static&lt;/span&gt; &lt;span style="color: 0000ff"&gt;class&lt;/span&gt; HtmlHelper {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;const&lt;/span&gt; &lt;span style="color: 0000ff"&gt;string&lt;/span&gt; ScriptTag = &lt;span style="color: 006080"&gt;"&lt;script src="{0}" type="text/javascript"&gt;&lt;/script&gt;"&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum9"&gt;   9:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;private&lt;/span&gt; &lt;span style="color: 0000ff"&gt;const&lt;/span&gt; &lt;span style="color: 0000ff"&gt;string&lt;/span&gt; PathPrefix = &lt;span style="color: 006080"&gt;"~/Scripts/{0}"&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum10"&gt;  10:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum11"&gt;  11:&lt;/span&gt;         &lt;span style="color: 008000"&gt;/// &lt;summary&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum12"&gt;  12:&lt;/span&gt;         &lt;span style="color: 008000"&gt;/// Inserts the scripts. If using a viewbag remember to cast the input property&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum13"&gt;  13:&lt;/span&gt;         &lt;span style="color: 008000"&gt;/// &lt;/summary&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum14"&gt;  14:&lt;/span&gt;         &lt;span style="color: 008000"&gt;/// &lt;param name="html"&gt;The HTML.&lt;/param&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum15"&gt;  15:&lt;/span&gt;         &lt;span style="color: 008000"&gt;/// &lt;param name="scripts"&gt;The scripts.&lt;/param&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum16"&gt;  16:&lt;/span&gt;         &lt;span style="color: 008000"&gt;/// &lt;param name="urlHelper"&gt;The URL helper.&lt;/param&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum17"&gt;  17:&lt;/span&gt;         &lt;span style="color: 008000"&gt;/// &lt;returns&gt;&lt;/returns&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum18"&gt;  18:&lt;/span&gt;         &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;static&lt;/span&gt; IHtmlString InsertScripts(&lt;span style="color: 0000ff"&gt;this&lt;/span&gt; System.Web.Mvc.HtmlHelper html, IList&lt;String&gt; scripts, UrlHelper urlHelper) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum19"&gt;  19:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum20"&gt;  20:&lt;/span&gt;             &lt;span style="color: 0000ff"&gt;if&lt;/span&gt; (scripts == &lt;span style="color: 0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum21"&gt;  21:&lt;/span&gt;                 &lt;span style="color: 0000ff"&gt;return&lt;/span&gt; &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; HtmlString(String.Empty);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum22"&gt;  22:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum23"&gt;  23:&lt;/span&gt;             var output = &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; StringBuilder();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum24"&gt;  24:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum25"&gt;  25:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum26"&gt;  26:&lt;/span&gt;             &lt;span style="color: 0000ff"&gt;foreach&lt;/span&gt; (var script &lt;span style="color: 0000ff"&gt;in&lt;/span&gt; scripts) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum27"&gt;  27:&lt;/span&gt;                 output.AppendFormat(ScriptTag, urlHelper.Content(String.Format(PathPrefix, script)));&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum28"&gt;  28:&lt;/span&gt;             }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum29"&gt;  29:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum30"&gt;  30:&lt;/span&gt;             &lt;span style="color: 0000ff"&gt;return&lt;/span&gt; html.Raw(output.ToString());&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum31"&gt;  31:&lt;/span&gt;         }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum32"&gt;  32:&lt;/span&gt;     }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum33"&gt;  33:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Which means the call in the view or layout page is reduced to&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: 800000"&gt;head&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: 800000"&gt;title&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;@ViewBag.Title&lt;span style="color: 0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: 800000"&gt;title&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: 800000"&gt;link&lt;/span&gt; &lt;span style="color: ff0000"&gt;href&lt;/span&gt;&lt;span style="color: 0000ff"&gt;="@Url.Content("&lt;/span&gt;~/&lt;span style="color: ff0000"&gt;Content&lt;/span&gt;/&lt;span style="color: ff0000"&gt;Site&lt;/span&gt;.&lt;span style="color: ff0000"&gt;css&lt;/span&gt;&lt;span style="color: 0000ff"&gt;")"&lt;/span&gt; &lt;span style="color: ff0000"&gt;rel&lt;/span&gt;&lt;span style="color: 0000ff"&gt;="stylesheet"&lt;/span&gt; &lt;span style="color: ff0000"&gt;type&lt;/span&gt;&lt;span style="color: 0000ff"&gt;="text/css"&lt;/span&gt; &lt;span style="color: 0000ff"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: 800000"&gt;script&lt;/span&gt; &lt;span style="color: ff0000"&gt;src&lt;/span&gt;&lt;span style="color: 0000ff"&gt;="@Url.Content("&lt;/span&gt;~/&lt;span style="color: ff0000"&gt;Scripts&lt;/span&gt;/&lt;span style="color: ff0000"&gt;jquery-1&lt;/span&gt;.&lt;span style="color: ff0000"&gt;6&lt;/span&gt;.&lt;span style="color: ff0000"&gt;2&lt;/span&gt;.&lt;span style="color: ff0000"&gt;min&lt;/span&gt;.&lt;span style="color: ff0000"&gt;js&lt;/span&gt;&lt;span style="color: 0000ff"&gt;")"&lt;/span&gt; &lt;span style="color: ff0000"&gt;type&lt;/span&gt;&lt;span style="color: 0000ff"&gt;="text/javascript"&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/&lt;/span&gt;&lt;span style="color: 800000"&gt;script&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt;     @Html.InsertScripts((IList&lt;span style="color: 0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: 800000"&gt;String&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;)ViewBag.Scripts, Url);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: 800000"&gt;head&lt;/span&gt;&lt;span style="color: 0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Nice and clean (well kinda)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-6607813532796693859?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/6607813532796693859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/aspnet-mvc3-razor-and-adding-scripts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6607813532796693859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6607813532796693859'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/aspnet-mvc3-razor-and-adding-scripts.html' title='ASP.NET, MVC3, Razor and adding scripts where they supposed to go'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-877518809645436428</id><published>2011-08-22T13:28:00.001+02:00</published><updated>2011-08-22T13:28:12.545+02:00</updated><title type='text'>COPY /Y Error</title><content type='html'>&lt;p&gt;Was trying to compile an application that had post build events in it and the build kept on failing. The error in a nutshell was “copy /y [path args here] exited with code 1”&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The environment is as follows:&lt;/p&gt;  &lt;p&gt;Windows 7 64bit&lt;/p&gt;  &lt;p&gt;Visual Studio 2010&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I remembered seeing this before and couldn’t recall how I fixed it:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The command was:&lt;/p&gt;  &lt;p&gt;COPY /Y “$(TargetDirectory)$(TargetName).dll” “$(SolutionDir)Bin”&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Which looks fine until you realise that a directory reference is going to expand to include the trailing “”&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So the above command would output&lt;/p&gt;  &lt;p&gt;COPY /Y “ctempmy.dll” “c:myothertempBin”&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Notice the double slashes? Well I did, so changing the command to:&lt;/p&gt;  &lt;p&gt;COPY /Y “$(TargetDirectory)$(TargetName).dll” “$(SolutionDir)Bin”&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Which produces&lt;/p&gt;  &lt;p&gt;COPY /Y “ctempmy.dll” “c:myothertempBin”&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;And everything started playing nicely again.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-877518809645436428?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/877518809645436428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/copy-y-error.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/877518809645436428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/877518809645436428'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/copy-y-error.html' title='COPY /Y Error'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-6042737310731606155</id><published>2011-08-21T23:47:00.001+02:00</published><updated>2011-08-21T23:47:20.005+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='606060'/><category scheme='http://www.blogger.com/atom/ns#' term='008000'/><category scheme='http://www.blogger.com/atom/ns#' term='0000ff'/><category scheme='http://www.blogger.com/atom/ns#' term='f4f4f4'/><title type='text'>JSON serialization and deserialization</title><content type='html'>&lt;p&gt;More JSON goodness! While doing my tests using the Jasmine framework I started noticing in my code that the data I was submitting needed to be serialized from a JavaScript object to a JSON representation. One would think that this might be real easy but alas, it seems that only the newer versions of the browsers implement the stipulated methods to serialize the object.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;Even everybody's favourite JavaScript library, JQuery, doesn’t implement a mechanism to do this. (check out &lt;a title="http://stackoverflow.com/questions/2277405/json-stringify-missing-from-jquery-1-4-1" href="http://stackoverflow.com/questions/2277405/json-stringify-missing-from-jquery-1-4-1"&gt;http://stackoverflow.com/questions/2277405/json-stringify-missing-from-jquery-1-4-1&lt;/a&gt; for further discussions and &lt;a title="http://api.jquery.com/category/utilities/" href="http://api.jquery.com/category/utilities/"&gt;http://api.jquery.com/category/utilities/&lt;/a&gt; for confirmation)&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;So I started going through posts and pointers from other developers. The first set of posts I read used a customised mechanism of serializing the object (&lt;a title="http://blog.stchur.com/2007/04/06/serializing-objects-in-javascript/" href="http://blog.stchur.com/2007/04/06/serializing-objects-in-javascript/"&gt;http://blog.stchur.com/2007/04/06/serializing-objects-in-javascript/&lt;/a&gt; and &lt;a title="http://www.sitepoint.com/javascript-json-serialization/" href="http://www.sitepoint.com/javascript-json-serialization/"&gt;http://www.sitepoint.com/javascript-json-serialization/&lt;/a&gt;). While this looks very cool I wasn’t willing to replicate the functionality just in case I missed something.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;Then I came across &lt;a title="http://www.json.org/js.html" href="http://www.json.org/js.html"&gt;http://www.json.org/js.html&lt;/a&gt; which defined a mechanism to do what I needed but I still wasn’t convinced. So after a while of reading I came across (&lt;a title="http://stackoverflow.com/questions/2277405/json-stringify-missing-from-jquery-1-4-1" href="http://stackoverflow.com/questions/2277405/json-stringify-missing-from-jquery-1-4-1"&gt;http://stackoverflow.com/questions/2277405/json-stringify-missing-from-jquery-1-4-1&lt;/a&gt; –&gt; last post which points to &lt;a title="http://code.google.com/p/jquery-json/" href="http://code.google.com/p/jquery-json/"&gt;http://code.google.com/p/jquery-json/&lt;/a&gt;). HOOAH! This did exactly what I wanted and wrapped it up nicely.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;So off I go implementing the methods using the functions provided in jquery-json. The more I did, the less I liked it. The code was starting to smell a bit. So instead of doing the the following over and over and over:&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 008000"&gt;//Convert to JSON string&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; jsonString = $.toJSON(myObject); &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I decided it would probably be better to wrap every the entry point into this mechanism into a single entry point for my application. Allowing me to swop out the implementation if need be without having to remove/rename a stack of references. So it ended up looking like this.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 008000"&gt;//Back to my handy helper class :)&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;function&lt;/span&gt; Helper() { }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: 008000"&gt;//Convert JSON to object&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt; Helper.getObject = &lt;span style="color: 0000ff"&gt;function&lt;/span&gt; (jsonString) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;return&lt;/span&gt; $.evalJSON(jsonString);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt;� &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum9"&gt;   9:&lt;/span&gt; &lt;span style="color: 008000"&gt;//Convert object to JSON&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum10"&gt;  10:&lt;/span&gt; Helper.getJson = &lt;span style="color: 0000ff"&gt;function&lt;/span&gt; (&lt;span style="color: 0000ff"&gt;object&lt;/span&gt;) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum11"&gt;  11:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;return&lt;/span&gt; $.toJSON(&lt;span style="color: 0000ff"&gt;object&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum12"&gt;  12:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;A great deal of people might think this is over complicating it, adding an unnecessary layer etc. I would argue that it decouples my dependency on the jquery-json library or at least isolates it’s usage to one location. As pointed out previously, should I need to call a different library I would only have to change it in one file. Nothing really fancy about the code but might spark other ideas. The jquery-json library also implements a secureEvalJSON which seems to prevent possible abuse of the JSON returned. With that being said I am going to change my getObject implementation to use it &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfilesC83536/wlEmoticon-smile%5B2%5D.png" /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;References:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a title="http://code.google.com/p/jquery-json/" href="http://code.google.com/p/jquery-json/"&gt;http://code.google.com/p/jquery-json/&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a title="http://www.metaltoad.com/blog/using-jsonp-safely" href="http://www.metaltoad.com/blog/using-jsonp-safely"&gt;http://www.metaltoad.com/blog/using-jsonp-safely&lt;/a&gt; – interesting post on JSONP security&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-6042737310731606155?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/6042737310731606155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/json-serialization-and-deserialization.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6042737310731606155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6042737310731606155'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/json-serialization-and-deserialization.html' title='JSON serialization and deserialization'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-1288914535056987287</id><published>2011-08-21T19:30:00.003+02:00</published><updated>2011-08-21T19:30:47.300+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='006080'/><category scheme='http://www.blogger.com/atom/ns#' term='606060'/><category scheme='http://www.blogger.com/atom/ns#' term='0000ff'/><category scheme='http://www.blogger.com/atom/ns#' term='f4f4f4'/><title type='text'>Jasmine and mock AJAX</title><content type='html'>&lt;p&gt;Things just keep getting better for me today &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfilesA4B2763/wlEmoticon-smile2.png" /&gt;. Having had a great deal of fun with the nHibernate search I stumbled across a really neat JavaScript testing framework call ‘Jasmine’. Now not to go through the whole blah blah of what ‘Jasmine’ is I would recommend you Google it. Plenty of references to the project there (&lt;a title="http://www.mediafly.com/content/exploring-jasmine-bdd-framework-javascript" href="http://www.mediafly.com/content/exploring-jasmine-bdd-framework-javascript"&gt;http://www.mediafly.com/content/exploring-jasmine-bdd-framework-javascript&lt;/a&gt; for starters!)&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;What I would like to point out is the AJAX mock requests and responses. One painful thing about testing JavaScript is the need to manually navigate the site/pages and debug the responses. Personally I like a TDD approach and wanted to try doing the JavaScript development using TDD.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;p&gt;While getting started with ‘Jasmine’ is very simple I did fiddle for an hour or so trying to assimilate the mechanism I was to use in mocking AJAX responses. So below I have listed the steps required to get a basic round trip going. This would reside in the *Spec.js file.&lt;/p&gt;  &lt;p&gt;�&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; describe(&lt;span style="color: 006080"&gt;"Application"&lt;/span&gt;, &lt;span style="color: 0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; application;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; profile;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;  &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt;     beforeEach(&lt;span style="color: 0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;         application = &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; Application();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt;         profile = &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; Profile();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt;         spyOn($, &lt;span style="color: 006080"&gt;"ajax"&lt;/span&gt;).andCallFake(&lt;span style="color: 0000ff"&gt;function&lt;/span&gt; (&lt;span style="color: 0000ff"&gt;params&lt;/span&gt;) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum9"&gt;   9:&lt;/span&gt;             &lt;span style="color: 0000ff"&gt;params&lt;/span&gt;.success(&lt;span style="color: 006080"&gt;'{"IsRegistered" : true}'&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum10"&gt;  10:&lt;/span&gt;         });&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum11"&gt;  11:&lt;/span&gt;     });&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum12"&gt;  12:&lt;/span&gt;  &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum13"&gt;  13:&lt;/span&gt;     it(&lt;span style="color: 006080"&gt;"should be able to register with the site"&lt;/span&gt;, &lt;span style="color: 0000ff"&gt;function&lt;/span&gt; () {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum14"&gt;  14:&lt;/span&gt;         profile.firstName = &lt;span style="color: 006080"&gt;"firstname"&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum15"&gt;  15:&lt;/span&gt;         profile.lastName = &lt;span style="color: 006080"&gt;"last"&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum16"&gt;  16:&lt;/span&gt;         profile.email = &lt;span style="color: 006080"&gt;"email@domain.com"&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum17"&gt;  17:&lt;/span&gt;         profile.birthDate = &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; Date(&lt;span style="color: 006080"&gt;"2011-04-01"&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum18"&gt;  18:&lt;/span&gt;  &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum19"&gt;  19:&lt;/span&gt;         application.register(profile);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum20"&gt;  20:&lt;/span&gt;         expect(profile.isRegistered).toEqual(&lt;span style="color: 0000ff"&gt;true&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum21"&gt;  21:&lt;/span&gt;     });&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum22"&gt;  22:&lt;/span&gt; });&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And to quickly run through it:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;beforeEach is the same as SetUp in your standard unit testing frameworks, so here you setup your test case. &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;spyOn is a method declared in the ‘Jasmine’ framework and dictates which class it should ‘spyOn’ and what method it should spyOn in that class. &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;andCallFake is the mechanism that reroutes the AJAX request to the anonymous method declared inside it. &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;params relates back to the jQuery AJAX definition. Via this we can execute the success method and pass in the response data we have manually defined. &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Very cool. As this is my initial exploration into ‘Jasmine’ I might very well have got it wrong or there might be a smarter way of doing this but I thought I would share it anyways!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;References:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://willcode4beer.com/tips.jsp?set=jsonInvalidLabel" href="http://willcode4beer.com/tips.jsp?set=jsonInvalidLabel"&gt;&lt;em&gt;http://willcode4beer.com/tips.jsp?set=jsonInvalidLabel&lt;/em&gt;&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://api.jquery.com/jQuery.ajax/" href="http://api.jquery.com/jQuery.ajax/"&gt;&lt;em&gt;http://api.jquery.com/jQuery.ajax/&lt;/em&gt;&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://a-developer-life.blogspot.com/2011/06/jasmine-part-2-spies-and-mocks.html" href="http://a-developer-life.blogspot.com/2011/06/jasmine-part-2-spies-and-mocks.html"&gt;&lt;em&gt;http://a-developer-life.blogspot.com/2011/06/jasmine-part-2-spies-and-mocks.html&lt;/em&gt;&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://stackoverflow.com/questions/4662641/how-do-i-verify-jquery-ajax-events-with-jasmine" href="http://stackoverflow.com/questions/4662641/how-do-i-verify-jquery-ajax-events-with-jasmine"&gt;&lt;em&gt;http://stackoverflow.com/questions/4662641/how-do-i-verify-jquery-ajax-events-with-jasmine&lt;/em&gt;&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://sparecycles.wordpress.com/2011/06/07/non-destructive-spies-in-jasmine/" href="http://sparecycles.wordpress.com/2011/06/07/non-destructive-spies-in-jasmine/"&gt;&lt;em&gt;http://sparecycles.wordpress.com/2011/06/07/non-destructive-spies-in-jasmine/&lt;/em&gt;&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="https://github.com/pivotal/jasmine/wiki/Spies" href="https://github.com/pivotal/jasmine/wiki/Spies"&gt;&lt;em&gt;https://github.com/pivotal/jasmine/wiki/Spies&lt;/em&gt;&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://javascript.crockford.com/private.html" href="http://javascript.crockford.com/private.html"&gt;&lt;em&gt;http://javascript.crockford.com/private.html&lt;/em&gt;&lt;/a&gt;&lt;em&gt; – Very interesting pointers on object orientated principles and JavaScript classes&lt;/em&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://gigasquidsoftware.com/wordpress/?p=201" href="http://gigasquidsoftware.com/wordpress/?p=201"&gt;&lt;em&gt;http://gigasquidsoftware.com/wordpress/?p=201&lt;/em&gt;&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://www.mediafly.com/content/exploring-jasmine-bdd-framework-javascript" href="http://www.mediafly.com/content/exploring-jasmine-bdd-framework-javascript"&gt;&lt;em&gt;http://www.mediafly.com/content/exploring-jasmine-bdd-framework-javascript&lt;/em&gt;&lt;/a&gt;&lt;em&gt; – very nice getting started with ‘Jasmine’ post&lt;/em&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://iknuth.com/2011/04/getting-started-for-tdd-with-jasmine-usin-backbone-js/" href="http://iknuth.com/2011/04/getting-started-for-tdd-with-jasmine-usin-backbone-js/"&gt;http://iknuth.com/2011/04/getting-started-for-tdd-with-jasmine-usin-backbone-js/&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-1288914535056987287?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/1288914535056987287/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/jasmine-and-mock-ajax.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1288914535056987287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1288914535056987287'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/jasmine-and-mock-ajax.html' title='Jasmine and mock AJAX'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-2307247931109167885</id><published>2011-08-21T19:30:00.001+02:00</published><updated>2011-08-21T19:30:29.879+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='006080'/><category scheme='http://www.blogger.com/atom/ns#' term='606060'/><category scheme='http://www.blogger.com/atom/ns#' term='008000'/><category scheme='http://www.blogger.com/atom/ns#' term='0000ff'/><category scheme='http://www.blogger.com/atom/ns#' term='f4f4f4'/><title type='text'>JavaScript Associative Array</title><content type='html'>&lt;p&gt;Although an associative array doesn’t technically exist in JavaScript it can be achieved via&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; myArray = &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; Array();&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; myArray[&lt;span style="color: 006080"&gt;"index1"&lt;/span&gt;] = &lt;span style="color: 006080"&gt;"Value1"&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt; myArray[&lt;span style="color: 006080"&gt;"index2"&lt;/span&gt;] = &lt;span style="color: 006080"&gt;"Value2"&lt;/span&gt;;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This is all fine and dandy till you realise that the length property will always return zero ( 0 )&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 008000"&gt;//always displays zero&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; alert(myArray.length);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This can be highly annoying considering the fact that you might need to do work based on whether or not the array has any values. The only solution I could find is to create a static helper method. So in my OO nature I created:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;function&lt;/span&gt; Helper() { }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; Helper.arraySize = &lt;span style="color: 0000ff"&gt;function&lt;/span&gt; (associativeArray) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;                                 &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; count = 0;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;                                 &lt;span style="color: 0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: 0000ff"&gt;var&lt;/span&gt; i &lt;span style="color: 0000ff"&gt;in&lt;/span&gt; associativeArray) {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt;                                     count++;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;                                 }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt;                                 &lt;span style="color: 0000ff"&gt;return&lt;/span&gt; count;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt;                             }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So now if I need to check the length of an “associative array” I can do so via:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: 008000"&gt;// Displays 2&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;var&lt;/span&gt; size = Helper.arraySize(myArray);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt; alert(size);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Might seem like a long way round but it is the only method I found thus far that facilitates my use case. Don’t forget to include the JS file if you have put it in a separate file &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="file:///C:/Users/Kenneth.Clark/AppData/Local/Temp/WindowsLiveWriter1286139640/supfilesA49C798/wlEmoticon-winkingsmile2.png" /&gt;�&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;References:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://stackoverflow.com/questions/5223/length-of-javascript-associative-array" href="http://stackoverflow.com/questions/5223/length-of-javascript-associative-array"&gt;http://stackoverflow.com/questions/5223/length-of-javascript-associative-array&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://www.pageresource.com/jscript/jarray2.htm" href="http://www.pageresource.com/jscript/jarray2.htm"&gt;http://www.pageresource.com/jscript/jarray2.htm&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://www.mojavelinux.com/articles/javascript_hashes.html" href="http://www.mojavelinux.com/articles/javascript_hashes.html"&gt;http://www.mojavelinux.com/articles/javascript_hashes.html&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;  &lt;li&gt;&lt;a title="http://blog.anselmbradford.com/2009/04/09/object-oriented-javascript-tip-creating-static-methods-instance-methods/" href="http://blog.anselmbradford.com/2009/04/09/object-oriented-javascript-tip-creating-static-methods-instance-methods/"&gt;http://blog.anselmbradford.com/2009/04/09/object-oriented-javascript-tip-creating-static-methods-instance-methods/&lt;/a&gt; &lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/JavaScript" rel="tag"&gt;JavaScript&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;Windows Live Tags: &lt;a href="http://windows.live.com/connect/tag/JavaScript" rel="clubhouseTag"&gt;JavaScript&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;WordPress Tags: &lt;a href="http://wordpress.com/tag/JavaScript" rel="Tag"&gt;JavaScript&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-2307247931109167885?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/2307247931109167885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/javascript-associative-array.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/2307247931109167885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/2307247931109167885'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/javascript-associative-array.html' title='JavaScript Associative Array'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-4893276903174458432</id><published>2011-08-21T19:27:00.001+02:00</published><updated>2011-08-21T19:27:51.978+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='006080'/><category scheme='http://www.blogger.com/atom/ns#' term='606060'/><category scheme='http://www.blogger.com/atom/ns#' term='0000ff'/><category scheme='http://www.blogger.com/atom/ns#' term='f4f4f4'/><title type='text'>NHibernate Search</title><content type='html'>&lt;p&gt;Well I had all but given up on being able to use Lucene.net in the project I am currently busy with. The root indexes where being created correctly but when ever I add a child to the root collection it was not attaching the data to the indexed document. This actually provide so frustrating that I left it and continued on other aspects of the project, hoping that something might pop out at me.&lt;/p&gt;  &lt;p&gt;Well, by God’s grace, something did. If you take the model below:&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; height: 400px; max-height: 400px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; [Indexed]&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;class&lt;/span&gt; Person{&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt;     [DocumentId]&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;string&lt;/span&gt; Id{get;set;}&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum5"&gt;   5:&lt;/span&gt;     [Field]&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;string&lt;/span&gt; FirstName{get;set;}&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum7"&gt;   7:&lt;/span&gt;     [Field]&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum8"&gt;   8:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;string&lt;/span&gt; LastName{get;set;}&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum9"&gt;   9:&lt;/span&gt;     [IndexedEmbedded(Depth = 1, Prefix = &lt;span style="color: 006080"&gt;"attr_"&lt;/span&gt;, TargetElement = &lt;span style="color: 0000ff"&gt;typeof&lt;/span&gt;(PersonAttribute))]&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum10"&gt;  10:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; IList&lt;PersonAttribute&gt; Attributes{get;set;}&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum11"&gt;  11:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum12"&gt;  12:&lt;/span&gt;  &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum13"&gt;  13:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;class&lt;/span&gt; PersonAttribute{&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum14"&gt;  14:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;string&lt;/span&gt; Id{get;set;}&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum15"&gt;  15:&lt;/span&gt;     [Field]&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum16"&gt;  16:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; AttributeKey Key{get;set;}&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum17"&gt;  17:&lt;/span&gt;     [Field]&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum18"&gt;  18:&lt;/span&gt;     &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;string&lt;/span&gt; Value{get;set;}&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum19"&gt;  19:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum20"&gt;  20:&lt;/span&gt;  &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum21"&gt;  21:&lt;/span&gt; &lt;span style="color: 0000ff"&gt;public&lt;/span&gt; &lt;span style="color: 0000ff"&gt;enum&lt;/span&gt; AttributeKey{&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum22"&gt;  22:&lt;/span&gt;     Height,&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum23"&gt;  23:&lt;/span&gt;     Weight,&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum24"&gt;  24:&lt;/span&gt;     ShoeSize&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum25"&gt;  25:&lt;/span&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And then of course you add the listeners:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; config.SetListener(NHibernate.Event.ListenerType.PostUpdate, &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; FullTextIndexEventListener());&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; config.SetListener(NHibernate.Event.ListenerType.PostInsert, &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; FullTextIndexEventListener());&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt; config.SetListener(NHibernate.Event.ListenerType.PostDelete, &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; FullTextIndexEventListener());&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Everything works great for the nHibernate persistence to the Postgres data store. The root entry (Person) gets added to the data store and added to the document store but when ever I add an attribute the data store gets updated correctly but is not added to the document store. So I fought and I fought and I fought and I fought till eventually I came across a listing that someone else had in their configuration file and added it to the configuration of my application. Namely:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum1"&gt;   1:&lt;/span&gt; config.SetListener(NHibernate.Event.ListenerType.PostCollectionUpdate, &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; FullTextIndexCollectionEventListener());&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum2"&gt;   2:&lt;/span&gt; config.SetListener(NHibernate.Event.ListenerType.PostCollectionRemove, &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; FullTextIndexCollectionEventListener());&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: 606060" id="lnum3"&gt;   3:&lt;/span&gt; config.SetListener(NHibernate.Event.ListenerType.PostCollectionRecreate, &lt;span style="color: 0000ff"&gt;new&lt;/span&gt; FullTextIndexCollectionEventListener());&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And viola! On update of the child attribute list the embedded indexes were added correctly. Now this might seem obvious but the documentation on configuration is hard to find so I posted it incase someone else runs into the issue.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;References:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a title="http://stackoverflow.com/questions/1328647/lucene-net-indexes-are-not-updating-when-dealing-with-many-to-many-relationships" href="http://stackoverflow.com/questions/1328647/lucene-net-indexes-are-not-updating-when-dealing-with-many-to-many-relationships"&gt;&lt;em&gt;http://stackoverflow.com/questions/1328647/lucene-net-indexes-are-not-updating-when-dealing-with-many-to-many-relationships&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/NHibernate" rel="tag"&gt;NHibernate&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Search" rel="tag"&gt;Search&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Lucene" rel="tag"&gt;Lucene&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Windows Live Tags: &lt;a href="http://windows.live.com/connect/tag/NHibernate" rel="clubhouseTag"&gt;NHibernate&lt;/a&gt;,&lt;a href="http://windows.live.com/connect/tag/Search" rel="clubhouseTag"&gt;Search&lt;/a&gt;,&lt;a href="http://windows.live.com/connect/tag/Lucene" rel="clubhouseTag"&gt;Lucene&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;WordPress Tags: &lt;a href="http://wordpress.com/tag/NHibernate" rel="Tag"&gt;NHibernate&lt;/a&gt;,&lt;a href="http://wordpress.com/tag/Search" rel="Tag"&gt;Search&lt;/a&gt;,&lt;a href="http://wordpress.com/tag/Lucene" rel="Tag"&gt;Lucene&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-4893276903174458432?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/4893276903174458432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/nhibernate-search.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/4893276903174458432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/4893276903174458432'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2011/08/nhibernate-search.html' title='NHibernate Search'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-4113100520098442337</id><published>2010-01-19T22:31:00.000+02:00</published><updated>2010-01-19T22:31:34.421+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Music'/><category scheme='http://www.blogger.com/atom/ns#' term='Guitar'/><title type='text'>Rabid Dog Labs new track</title><content type='html'>Not sure if anyone is aware of this but I do occasionally write and record music. Well after a year of trying to write a new track I finally have. If you interested you can check it out at &lt;a href="http://www.myspace.com/rabiddoglabs"&gt;http://www.myspace.com/rabiddoglabs&lt;/a&gt; Hope you enjoy it and any feedback would be greatly appreciated!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-4113100520098442337?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/4113100520098442337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2010/01/rabid-dog-labs-new-track.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/4113100520098442337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/4113100520098442337'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2010/01/rabid-dog-labs-new-track.html' title='Rabid Dog Labs new track'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-65552951451675839</id><published>2010-01-19T22:14:00.003+02:00</published><updated>2010-01-19T22:16:57.893+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Review'/><category scheme='http://www.blogger.com/atom/ns#' term='Java EE 5'/><category scheme='http://www.blogger.com/atom/ns#' term='Glassfish'/><category scheme='http://www.blogger.com/atom/ns#' term='Book'/><category scheme='http://www.blogger.com/atom/ns#' term='administration'/><title type='text'>Glassfish administration book review</title><content type='html'>Well as you all know I am a HUGE fan of the Glassfish project. I honestly feel it is one of nicest Java EE 5 implementations. Having used glassfish V2 in multiple projects I have come across numerous resources which are extremely helpful.&lt;br /&gt;&lt;br /&gt;Right now I am busy reading &lt;a href="http://www.packtpub.com/files/6507-glassfish-administration-chapter-no-6-configuring-jms-resources.pdf"&gt;http://www.packtpub.com/files/6507-glassfish-administration-chapter-no-6-configuring-jms-resources.pdf&lt;/a&gt; and will be posting a review on the book once it is complete.&lt;br /&gt;&lt;br /&gt;Oh a happy 2010 to everyone!&lt;br /&gt;&lt;br /&gt;Lord Bless&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-65552951451675839?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/65552951451675839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2010/01/glassfish-administration-book-review.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/65552951451675839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/65552951451675839'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2010/01/glassfish-administration-book-review.html' title='Glassfish administration book review'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-8395169662188529330</id><published>2008-02-23T21:45:00.002+02:00</published><updated>2008-02-23T22:21:43.325+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Architecture'/><title type='text'>Web applications are cool ... NOT! Well kinda ...</title><content type='html'>&lt;p&gt;   &lt;p&gt;The single sentence that drives me mad is &amp;quot;We want a web application because it is easier to deploy&amp;quot;.&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;   &lt;p&gt;Well lets face it, it is &amp;quot;easier&amp;quot; to deploy. Single application repository, single update scenario. Yeah, sounds all pleasant. &lt;/p&gt; &lt;/p&gt;  &lt;p&gt;BUT!&lt;/p&gt;  &lt;p&gt;   &lt;p&gt;When designing the application and taking into considerations all the interface requirements along with the length of time it will take to implement those requirements are you willing to sacrifice usability so you have an &amp;quot;easier&amp;quot; to deploy application?&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;   &lt;p&gt;Now I can hear you laugh at me saying I am crazy but am I? Should each project not be carefully planned and the needs of the client decided the interface that is to be used? With all the technologies available for interoperability there are so many more avenues available.&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;   &lt;p&gt;Think of it this way. With web browsers you are given your sandbox to work in and you are effectively taking a presentation technology and turning it into an application technology. Is that smart? In my eyes no it isn't (yes then again what do I know :)). This sandbox has limited access to the underlying system and therefore all the load is retained on the server for processing. Now I know you want to isolate your business logic to a single layer, preferably in a service orientated method. I am all for that. My problem is the presentation layer.&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;   &lt;p&gt;The web presentation layer is so disconnected. Maintaining session state is hard and configuring the environment you want to run in is impossible. Then don't even get me started on the browser wars! Why would anyone want to hand their rendering layer to engines that don't comply to the standards they are supposed to?&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;   &lt;p&gt;Enter the smart / composite client. This is a theory / pattern that I think is going to make a huge impact in the coming years. The web will never die but I am hoping that we will see smarter business systems that allow for smart integration rather than having to inject directly into SQL, reverse engineer their logic to implement a service layer on them or tossing them and having to rewrite them completely.&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;   &lt;p&gt;If you have ever faced Enterprise Integration into legacy systems you will know all to well what I am talking about. So let us all vow to change the way we do things. To think about the poor nana down the line who is going to have to interface with your system because he is cheaper and let us expose services / API's and save him a heart attack :) The guy will love you, promote your software all over the place and we all win!&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;   &lt;p&gt;Let us also vow to turn the Internet back into what it is good at, offering information services. Always to engineer our applications that any front-end can consume it (Java, .NET, PHP etc). This way we will finally create a network that can change the face of things. Think about it. You want to offer a conversion utility to people, they consume your service and present it how ever they want! What could be better? The first question every company asks me when acquiring a piece of software is &amp;quot;How easy is it to change the interface?&amp;quot;. What I am saying is lets take away that interface and let them build up their applications in an interface they see fit, consuming services from multiple systems! Ah this is a place I would like to retire to :)&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;   &lt;p&gt;So let us always use the right tool for the right job. The web has a place, the desktop has a place.&lt;/p&gt; &lt;/p&gt;  &lt;p&gt;Anyway's if you made it this far I thank you, and think about it. It makes sense.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-8395169662188529330?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/8395169662188529330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2008/02/web-applications-are-cool-not-well.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/8395169662188529330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/8395169662188529330'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2008/02/web-applications-are-cool-not-well.html' title='Web applications are cool ... NOT! Well kinda ...'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-6876441045536897548</id><published>2007-05-10T22:27:00.002+02:00</published><updated>2008-02-23T22:14:55.128+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Architecture'/><category scheme='http://www.blogger.com/atom/ns#' term='Practises'/><title type='text'>The importance of privacy</title><content type='html'>Well I never!&lt;br /&gt;&lt;br /&gt;For the past few months I have been ranting about the importance of access to customer credit card information and the possible ramifications if someone untrust worth working in an organization got hold of the information. Tonight I hear that this has happened.&lt;br /&gt;&lt;br /&gt;We are so busy protecting ourselves from external intruders that we sometimes miss the most obvious point of attack, from inside.&lt;br /&gt;&lt;br /&gt;I was investigating the possibility of inegrating a well known piece of accounting software into our CRM and realised that the credit card info is stored in plain text. Imagine my horror as I started scrolling through credit card details which contained verification numbers and suddenly I was overwhelmed with the thought of what could be done with this info.&lt;br /&gt;&lt;br /&gt;I understand that you can't stop everyone from accessing this data BUT you can audit the access. The idea of allowing call centre staff to access this information is WAY beyond me. Call centres probably have the highest staff turn over and they say that a large percentage of hacks are done by disgruntled employees.&lt;br /&gt;&lt;br /&gt;I am putting some more thought into this topic and will post my solutions when I have some.&lt;br /&gt;&lt;br /&gt;Till then stay safe and stick to the rubber cheques :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-6876441045536897548?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/6876441045536897548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2007/05/importance-of-privacy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6876441045536897548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/6876441045536897548'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2007/05/importance-of-privacy.html' title='The importance of privacy'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-4317662503653912385</id><published>2007-04-24T06:59:00.001+02:00</published><updated>2008-02-23T22:08:11.562+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rants'/><title type='text'>Shuddup about Microsoft already!</title><content type='html'>Everyone gets the point!. No one likes Microsoft. No one likes there marketing strategy, no one likes their release software etc etc. I am sick and tired of hearing how unsecure Windows and IE is. The truth of the matter is this. They own the largest market share, that would lead one to believe that the major reason for getting nuked with viruses is the major audience.&lt;br /&gt;&lt;br /&gt;Think about it, if 10% of the world ran windows and the rest ran *nix, you think there would be viruses for Windows? Neither do I.&lt;br /&gt;&lt;br /&gt;As for the vulnerabilities, all machines are. Every vendor has holes. Patch your OS and if you really want to be safe, never connect to any network including the internet. Every browser has flaws it just seems that jealousy makes you nasty.&lt;br /&gt;&lt;br /&gt;That being said, I hate Bill as well but if I had his money I wouldn't :)&lt;br /&gt;&lt;br /&gt;Stop whining about nonsense and get back to work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-4317662503653912385?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/4317662503653912385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2007/04/shuddup-about-microsoft-already.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/4317662503653912385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/4317662503653912385'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2007/04/shuddup-about-microsoft-already.html' title='Shuddup about Microsoft already!'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-1652954818451104487</id><published>2007-02-15T06:52:00.001+02:00</published><updated>2008-02-23T22:08:40.901+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rants'/><title type='text'>South Africa my sad country</title><content type='html'>You are dying and make me tired, why should I fight for you any longer when you continue to rape me?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-1652954818451104487?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/1652954818451104487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2007/02/south-africa-my-sad-country.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1652954818451104487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/1652954818451104487'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2007/02/south-africa-my-sad-country.html' title='South Africa my sad country'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-7785952320546865431</id><published>2007-02-09T12:47:00.002+02:00</published><updated>2008-02-23T22:14:47.035+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Architecture'/><category scheme='http://www.blogger.com/atom/ns#' term='Rants'/><category scheme='http://www.blogger.com/atom/ns#' term='Practises'/><title type='text'>The misconception of cheap development environments</title><content type='html'>How many times have you heard that the development environment doesn't need to have decent machines in it? How many times have you heard that you can continue to develop on that clunky Pentium 2 with 512 megs of RAM?&lt;br /&gt;&lt;br /&gt;Well sitting and thinking about it I decided to have my say.&lt;br /&gt;&lt;br /&gt;First thing I thought about was the rate that development is expected at. Now let us think about this. Working on a large application that consumes a large amount of resources during deployment is very exciting. Unless you have to wait 5 minutes for the clunker to deploy to find out you spelt one of your annotations wrong. Then it is back to the IDE, make changes, recompile and redeploy. Another five minutes. So now every time you deploy (which could be a hefty number during the dev and debug phases) you have to wait five minutes.&lt;br /&gt;&lt;br /&gt;8 * 60 = 480 minutes in a business day&lt;br /&gt;480 / 5 = 96 deployments.&lt;br /&gt;&lt;br /&gt;See where I am going? Rather get a stronger machine so the developers can focus on what they do best, develop, not wait for deployments.&lt;br /&gt;&lt;br /&gt;Another thing. All changes get made to development (theoretically) before being pushed to production. Now you working on BIG project. BIG project almost complete. About to be deployed to projection. Dev machine crashes due to the old hardware. SIRENS!&lt;br /&gt;&lt;br /&gt;I can hear you mumbling backups, backups, backups. Now I have backed up my BIG project. Hard disk gets replaced. Now due to lack of resources it takes another 54 years (exaggeration) to restore your backups. Now all of a sudden the move to production has been pushed back 54 years.&lt;br /&gt;&lt;br /&gt;Okay one last example and I am willing to bet we have all done this. Developers hitting development environment hard. Development environment slows down to a stand still. Get tired of waiting. Hmmmm, my machine is quicker than the dev machine. Hack, hack, copy, paste, scribble, reboot. Ah now my machine is my development environment. All developers realise the bliss of working in a quick development environment. All developers switch to standalone environments. Now you have 50 disparate development environments that have to deploy on the same production environment.&lt;br /&gt;&lt;br /&gt;The moral of the story is that your development environment is not your production environment BUT it is just a critical. Never underestimate the importance of a good development environment.&lt;br /&gt;&lt;br /&gt;Once upon a time ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-7785952320546865431?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/7785952320546865431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2007/02/misconception-of-cheap-development.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7785952320546865431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/7785952320546865431'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2007/02/misconception-of-cheap-development.html' title='The misconception of cheap development environments'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-116353440764060181</id><published>2006-11-14T21:39:00.001+02:00</published><updated>2008-02-23T22:08:59.084+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rants'/><title type='text'>500 000 x 12 years = the new holocaust</title><content type='html'>Everyday I wake up, I look over at my wife and count my blessings. Then I get up and walk to my daughters room and watch her sleeping, again counting my blessings.&lt;br /&gt;&lt;br /&gt;I go to work to earn money to provide for my family, come home to my beautiful wife and daughter and relax till I start working again later in the evening. It is hard but I do it for the benefit of my family.&lt;br /&gt;&lt;br /&gt;While working I end up glancing over at the television to see a report on abortion. Then I almost suffer a massive cardiac arrest when I hear the figures. In South Africa alone this year there have been 500 000 aborts. Count to 500 000. 500 000 lives have been taken, 500 000 children have been killed at the request of the "mothers" carrying them. Mothers, the creatures we look to for comfort, for answers, for protection. Now the definition of mother is someone who decides they can take your life. How secure do you feel now?&lt;br /&gt;&lt;br /&gt;Effectively what is being said is that you are not a human being till you are born, you are not alive till you are born. Up until the time you are born you are nothing. Girls who have no idea of how to take care of a child are having sex. Where are the parents?&lt;br /&gt;&lt;br /&gt;Say it again, 500 000 children executed at the request of the individual carrying the child. 500 000 lives. Am I the only one who is horrifide at this? I look over at my daughter and can't imagine being without her.&lt;br /&gt;&lt;br /&gt;Money is not an excuse. Children don't need rich parents, they don't need fancy houses, they don't need fancy food. All a child needs is their parents. Plain and simple. Stop having premarital sex and if you do have sex before you are married, accept responsibility for your actions. If you fall pregant or are involved with making you partner pregnant step up and accept it. DO NOT make an unborn child suffer (and yes dying is suffering, it isn't painless for the unborn child, &lt;a href="http://www.pregnancycenters.org/abortion.html"&gt;have a look. I mean, really visualise&lt;/a&gt;) for the sins you have committed. Think how many people there are that CAN NOT have children. Stop being so selfish.&lt;br /&gt;&lt;br /&gt;500 000 x 12 = 6 000 000. Think about it. Think about it carefully ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-116353440764060181?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/116353440764060181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/11/500-000-x-12-years-new-holocaust.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/116353440764060181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/116353440764060181'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/11/500-000-x-12-years-new-holocaust.html' title='500 000 x 12 years = the new holocaust'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-116134803486279063</id><published>2006-10-20T14:36:00.001+02:00</published><updated>2008-02-23T22:09:41.839+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Interop'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Architecture'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>SOAP and Interoperability : Urban Legends</title><content type='html'>With the advent of SOAP and the new catch phrase "Interop" I am left wondering just how interoperable Java and C# are.&lt;br /&gt;&lt;br /&gt;All documentation on the subject is always one side. If you write a Java web service the documentation assumes you will be connecting with a Java client. The same applies for C#. C# web service assumes C# client.&lt;br /&gt;&lt;br /&gt;This week I have been researching Glassfish as a replacement for our failing Tomcat (nothing wrong with Tomcat, it just can't deliver the quality requirements for the project).&lt;br /&gt;&lt;br /&gt;Alot of the documentation deals with setting up basic web service RPC style, none deal with the concept of request and response objects. I finally managed to figure out how to do this. I did come across a fantastic article that does deal with C# and Java interop &lt;a href="http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns2/"&gt;available here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Once I have completed the research I need to do I will post some examples of things I found relatively hard to find information on.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-116134803486279063?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/116134803486279063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/10/soap-and-interoperability-urban.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/116134803486279063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/116134803486279063'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/10/soap-and-interoperability-urban.html' title='SOAP and Interoperability : Urban Legends'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-115687913830634455</id><published>2006-08-29T21:02:00.001+02:00</published><updated>2008-02-23T22:09:50.259+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>In this corner, weighing in at 2, C#!</title><content type='html'>What a week we have ahead. After being on course for two weeks doing "Advanced Java" and "XML and Webservices" (oh, offered by the friendly folk at &lt;a href="http://www.solms.co.za/"&gt;Solms TCD&lt;/a&gt;) I am pretty stoked and ready to role with some new ideas.&lt;br /&gt;&lt;br /&gt;The initial module of our current development is due for release into user testing at the end of this week. Nerves are on edge a bit but all in all I think it will come off pretty nicely. We obviously have to get through the teething stages but I don't think we will have to much to worry about.&lt;br /&gt;&lt;br /&gt;I had an interesting discussion with an indivdual the other day who claimed that C# is better than Java. Naturally after being on the advanced Java course I disagreed. Then looking back on it I think the two are incomparable.&lt;br /&gt;&lt;br /&gt;If you think about it logically, Java is platform independant. Yes sure it compiles down to a CRL the same way C# does but the fact that it is platform independant by design means that the two languages have no lowest common denominator. If it was a pure *nix or Windows CRL then fine you can compare them, but it isn't.&lt;br /&gt;&lt;br /&gt;This boils down to a conclusion I have raised amongst people many times. Use the right tool for the job. If your target platform is specifically Windows with no chance of moving to another platform, use .NET. If you have to implement your application on a *nix platform only, or it has to be cross platform then use Java.&lt;br /&gt;&lt;br /&gt;If you want to develop an enterprise application (which will obviously run on some form of *nix due to instability in Windows (oh yes it is)) then develop Java.&lt;br /&gt;&lt;br /&gt;Again, use the right tool for the job. The solution we are deploying is an n-tier SOA solution. The business logic is developed and served via Java frameworks. The thin client is developed in C#. *nix stability with Windows desktops.&lt;br /&gt;&lt;br /&gt;So let us all stop comparing apples with bananas and get on with our jobs. The best possible thing any developer can do is learn as many different technologies as possible. This will allow you to provide proper solutions and it makes you more marketable.&lt;br /&gt;&lt;br /&gt;Have a happy day now :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-115687913830634455?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/115687913830634455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/08/in-this-corner-weighing-in-at-2-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/115687913830634455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/115687913830634455'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/08/in-this-corner-weighing-in-at-2-c.html' title='In this corner, weighing in at 2, C#!'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-115333806381611383</id><published>2006-07-19T21:33:00.001+02:00</published><updated>2008-02-23T22:09:57.080+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rants'/><title type='text'>Copy protection software</title><content type='html'>WOW&lt;br /&gt;&lt;br /&gt;That is all I can say. I found a file called CmdLineExt02.dll and couldn't delete it so I did some research.&lt;br /&gt;&lt;br /&gt;Turns out is is supposed to be part of copy protection software. Now the only game I have installed on my machine (aside from the Novalogic title "Black Hawk Down") is the EA games title "Cricket 2005".&lt;br /&gt;&lt;br /&gt;Upon diggin deeper I found that A LOT of my favourite games use this technology and some even make use of software that installs root kits or derivitives of. This is quiet a scary thought as I do all my banking online. Now if some stupid hacker tool hooks up with the root kit there is no ways my anti virus software is going pick it up.&lt;br /&gt;&lt;br /&gt;So I have decided to effectively remove all the games from my machine until I can establish which vendor is running what.&lt;br /&gt;&lt;br /&gt;To the software vendors I would like to say this. You are inconveniencing the lives of legitimate users with all of this nonsense. ALL software can be cracked and anyone that is using cracked software knows there is a risk attached to it. No my question to you is this. Is it safer to use the legitimate software with all of this nonsense going round? You guys are shooting yourselves in the foot by doing this. Me for one will not buy any more EA titles (which is a disappointment as I was really enjoying the Battlefield 2)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-115333806381611383?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/115333806381611383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/07/copy-protection-software.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/115333806381611383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/115333806381611383'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/07/copy-protection-software.html' title='Copy protection software'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-115247990487282208</id><published>2006-07-09T22:53:00.001+02:00</published><updated>2008-02-23T22:10:28.698+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rants'/><title type='text'>Zidane shows what is means to use your head</title><content type='html'>Okay this is off topic I know but it is something that has been bugging me for a LONG time.&lt;br /&gt;&lt;br /&gt;The incident between french football player Zidane and some italian player (lost interest in the team after what appeared to be the players humping after scoring a goal) where Zidan head butted the itallian in the chest raised many eyebrows.&lt;br /&gt;&lt;br /&gt;If you look at the footage again carefully Zidane was moving away from the player and then turned and head butted him. This can only mean that as the Zidane was walking away the italian must have said something that hit a nerve.&lt;br /&gt;&lt;br /&gt;I cannot condone the action but it makes me wonder if the powers that be allow this type of thing to happen by letting the players rile each other up with comments. Some of the comments I have heard (especially in the cricket arena) are absolutely disgusting and I am not suprised that players retaliate.&lt;br /&gt;&lt;br /&gt;Now everyone says it is part of the game but I firmly believe that it is not. The only place I can see fitting for this type of behaviour is in some form of fighting sport because once the comments are made you are allowed to beat the snot out of your opponent.&lt;br /&gt;&lt;br /&gt;Not to mention the example that this type of behvaiour sets for our children. As a father there is no ways I will condone this type of behaviour from my child/ren. If I had to ever see my child/ren playing with gamesmanship and not sportsmanship I would stop them from playing the sport till they learnt the true values of sport.&lt;br /&gt;&lt;br /&gt;For those of us that have forgotten, the true value of sport is not WAR! We have enough governments creating wars. The true meaning of sport is honesty, integrity and fair play. Put money into that equation and now all of a sudden there is under handedness, dishonesty and mind games.&lt;br /&gt;&lt;br /&gt;To the governing bodies of sports. Bring back the values of the game. DO NOT allow this degeneration to continue and put the games before the pay cheques. If cleaning up the gaming is going to cost money because sponsors pull out because people prefer watching (what is fast becoming) roman circuses then so be it. Do the right thing, for the sake of our children and the human race as a whole. Think about it. I have no idea how you our the players that employ these tactics sleep at night.&lt;br /&gt;&lt;br /&gt;Finally...&lt;br /&gt;Zidane, we bid you farewell from international football. You have had a fantastic career and led your team well. Don't let this incident get you down. As far as I am concerned I would have broken a few noses and probably not lasted more than one game. I hope you had a good laugh in the change rooms at the way the guy went down. Everyone has a breaking point, you found yours tonight.&lt;br /&gt;&lt;br /&gt;To the itallian player who got beaten down (LOL). As far as I am concerned you got off lightly. I can think of things a lot worse that I would have done.&lt;br /&gt;&lt;br /&gt;Then Buffon (what an unfortunate surname). Did you run off crying to your mother everytime someone did something? How on earth did the red card come it if the ref and linesman did not see the incident?&lt;br /&gt;&lt;br /&gt;All in all it was a fantastic game, congrats to italy for winning and a big congrats to Germany for hosting the event extremely well. To the USA, next world cup lads, I am sure you will kick some serious behind. Your dismissal from the world cup to Ghana (vomit) was not because of a lack of skill on your part, it was a brilliant piece of acting that secured that penalty.&lt;br /&gt;&lt;br /&gt;To all the players that dive. DON'T complain when the ref doesn't call a legit foul against you. Let me give you a quick lesson. Ref goes home, watches game to view mistakes he might have made. Makes mental notes of players who have dived and is alot more weary of you the next game he refs with you in it. PLAY THE GAME! Give our children proper role models.&lt;br /&gt;&lt;br /&gt;To the German team. What an amazing performance. I recon the next world cup is yours!&lt;br /&gt;&lt;br /&gt;See you all in South Africa in 2010. (If the planet surives long enough)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-115247990487282208?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/115247990487282208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/07/zidane-shows-what-is-means-to-use-your.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/115247990487282208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/115247990487282208'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/07/zidane-shows-what-is-means-to-use-your.html' title='Zidane shows what is means to use your head'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-114858498415615341</id><published>2006-05-25T21:08:00.002+02:00</published><updated>2008-02-23T22:13:42.593+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rants'/><category scheme='http://www.blogger.com/atom/ns#' term='Practises'/><title type='text'>View source and the right click killer</title><content type='html'>Why oh why would you put something on the internet if you don't want people to view it?&lt;br /&gt;&lt;br /&gt;So many times I have seen a really nifty piece of work and wanted to know how the author did it. They, however, had different ideas and implement some contrived method of stopping you from right clicking and viewing the source.&lt;br /&gt;&lt;br /&gt;To these authors I have one thing to say, not even Microsoft, the notorious closed source initiative stops people viewing the source on their website.&lt;br /&gt;&lt;br /&gt;Think about it. The internet is PUBLIC network. Anything posted on a PUBLIC network is open to, yes you guessed it, the public. Implementing these stupid "anti-right click" mechanisms pisses people off just enough to figure out a way round it.&lt;br /&gt;&lt;br /&gt;There are a multitude of ways to get round it and I am going to list them:&lt;br /&gt;A) Save the web page and open it in your favourite text editor locally&lt;br /&gt;B) Certain methods implemented in IE will not work in Firefox, so open the site in that browser rather and then right click and view source.&lt;br /&gt;C) If you have office installed you will have the option to edit in Office, this will reveal the code&lt;br /&gt;D) any site "optimised for Microsoft Internet Explorer" open in firefox or some other browser to circumvent any source protection.&lt;br /&gt;E) Alot of people (including myself but for other reasons) reference external javascripts. look for the tag &amp;lt;script language="JavaScript" src="myjavascript.js"&gt; . Copy the src value and past it int the browser after the domain. This will reveal the javascript file&lt;br /&gt;F) Close the site and never, ever go back. You have to ask yourself what that site is doing and why they would want to prevent you from viewing the source? Something malicious maybe? Javascript security flaws are a dim a dozen.&lt;br /&gt;G)Copy the url and paste it into your favourite download manager and download the processed page for editing locally.&lt;br /&gt;&lt;br /&gt;Oh and one other thing for you developers using the .inc file extension. Please, please, please for your own safety map the extention to be processed by the script engine you are running (ASP, PHP etc). If you don't these pages can be viewed in plain text and it is amazing the imformation that can be gleaned from them.&lt;br /&gt;&lt;br /&gt;Those of you preventing the right click, STOP! You are wasting your time and effort. You could be doing something more productive and remember, what every you have done, someone else has done better.&lt;br /&gt;&lt;br /&gt;Have a happy day :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-114858498415615341?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/114858498415615341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/view-source-and-right-click-killer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114858498415615341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114858498415615341'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/view-source-and-right-click-killer.html' title='View source and the right click killer'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-114803674305881342</id><published>2006-05-19T12:53:00.002+02:00</published><updated>2008-02-23T22:12:58.935+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Java EE 5'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Apache Axis'/><title type='text'>C# 505 protocol unsupported and psychotic episodes</title><content type='html'>There is nothing basic about BASIC authentication when using Tomcat and AXIS to serve web services and a C# windows forms client to consume them.&lt;br /&gt;&lt;br /&gt;Many a google search turned up nothing aside from people using a work around to force the client to use HTTP/1.0. I didn't believe this was the best solution as you would have to change it every time you updated the client.&lt;br /&gt;&lt;br /&gt;I managed to get Tomcat authenticating users off an OpenLDAP server (very cool). There is also a windows port of the popular LDAP server (search google "windows OpenLDAP"). Then came the mission of getting the client to authenticate against the Tomcat server.&lt;br /&gt;&lt;br /&gt;It appears that the problem is related to the Keep Alive settings on the Tomcat server and the way C# deals with it's authentication information. Upon setting the server to not keep connections alive everything started grooving.&lt;br /&gt;&lt;br /&gt;so effectively all you do is add the attribute &lt;span style="FONT-WEIGHT: bold"&gt;maxKeepAliveRequests="1"&lt;/span&gt; to the Tomcat server.conf &amp;lt;Connector&gt; entry and restart apache. Below is an example&lt;br /&gt;&lt;br /&gt;&lt;pre style="FONT-WEIGHT: bold; MARGIN: 0px"&gt;&lt;br /&gt;&amp;lt;Connector port="8080"&lt;br /&gt;  maxHttpHeaderSize="8192"&lt;br /&gt;  maxKeepAliveRequests="1"&lt;br /&gt;  maxThreads="150"&lt;br /&gt;  minSpareThreads="25"&lt;br /&gt;  maxSpareThreads="75"&lt;br /&gt;  enableLookups="false"&lt;br /&gt;  redirectPort="8443"&lt;br /&gt;  acceptCount="100"&lt;br /&gt;  connectionTimeout="20000"&lt;br /&gt;  disableUploadTimeout="true" /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then in C# create the NetworkCredentials object like so&lt;br /&gt;&lt;pre style="FONT-WEIGHT: bold; MARGIN: 0px"&gt;&lt;br /&gt;NetworkCredential cred =&lt;br /&gt;new NetworkCredential("username", "password");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and assign it to the web service object credentials you have created and away you go! I will be posting a tutorial on this soon.&lt;br /&gt;&lt;br /&gt;I hope this helps someone, as for more info on the topic refer to the apache bug log &lt;a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=31567"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;On another note a very bright chap pointed out that setting &lt;span style="FONT-WEIGHT: bold"&gt;ServicePointManager.Expect100Continue = false;&lt;/span&gt; also works (thus allowing the keep alives). His comments can be found &lt;a href="http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic9525.aspx"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One day our technologies will talk to each other and be happy. Anyways, I can finally get some sleep tonight and if you have a web service containing sensitive information, please for your own good, secure it. Basic is not the best route to go but it is a start.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-114803674305881342?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/114803674305881342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/c-505-protocol-unsupported-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114803674305881342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114803674305881342'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/c-505-protocol-unsupported-and.html' title='C# 505 protocol unsupported and psychotic episodes'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-114732739290230598</id><published>2006-05-11T08:02:00.002+02:00</published><updated>2008-02-23T22:12:37.373+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Apache Axis'/><title type='text'>Would you like milk with your serialization?</title><content type='html'>Man what a mission! I have been sitting for the past four hours trying to figure out how to pass a custom object via SOAP. Everything deals with serailizing the object then calling it using Java. Now my problem lays in the fact that it will be called by C#.&lt;br /&gt;&lt;br /&gt;I finally figured out the process I am supposed to follow but for the life of me can't find any decent documentation. Will soldier on though (have, it is my job LOL).&lt;br /&gt;&lt;br /&gt;If any of you guys out there have any pointers to some decent documentation I would appreciate it. The platform that is serving the web services is Apache Axis. The client consuming the services is C#.&lt;br /&gt;&lt;br /&gt;Thanks in advanced&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-114732739290230598?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/114732739290230598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/would-you-like-milk-with-your.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114732739290230598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114732739290230598'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/would-you-like-milk-with-your.html' title='Would you like milk with your serialization?'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-114684634761449774</id><published>2006-05-05T18:18:00.002+02:00</published><updated>2008-02-23T22:12:14.450+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Architecture'/><category scheme='http://www.blogger.com/atom/ns#' term='Practises'/><title type='text'>Procedural is for the army</title><content type='html'>Okay, don't get me wrong, but procedural code has its place. Inside a little box far away from enterprise solutions. It is great for the quick fix it or the once off or twice off export.&lt;br /&gt;&lt;br /&gt;The reason I say this is because developers come and go but the application running your enterprise will be around for a long, long time. Now if you write this solution in procedural code making changes is a NIGHTMARE! If you change one line of code the implications bubble through all 1000 lines of your web page!&lt;br /&gt;&lt;br /&gt;Now take Object Orientated design and you have a scalabile, updatable model. It might take longer to design and impliment but at the end of the day are you looking for a quick fix or a long term solution?&lt;br /&gt;&lt;br /&gt;Every developer has different ways of developing procedual and object orientated code BUT the object orientated code (if designed properly) has more advantage is the long run. It makes finding procedures easier, updating the procedure shouldn't affect the objects that hook into it (unless it is exposed and used by other classes). What a pleasure!&lt;br /&gt;&lt;br /&gt;Anyways, you take the high road and I'll take the low road and have less maintenance to do, which means I get home before you! :P&lt;br /&gt;&lt;br /&gt;Enjoy your weekend people.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-114684634761449774?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/114684634761449774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/procedural-is-for-army.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114684634761449774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114684634761449774'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/procedural-is-for-army.html' title='Procedural is for the army'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-114677094430687456</id><published>2006-05-04T21:21:00.002+02:00</published><updated>2008-02-23T22:11:41.430+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='Rants'/><title type='text'>mod_rewrite and the jaws of insanity</title><content type='html'>WOW! what a mission. Who would have thought it would take me almost 12 hours to right a simple rewrite rule! In all fairness I did trash the server config my host so generously set up to run off PHP5 at my request (great bunch of people).&lt;br /&gt;&lt;br /&gt;The biggest problem is that I was unable to log the rewrite rule, so eventually I started from scratch and slowly added and subtracted things until I had the rule running. In my rampant search on google I came across some very interesting material. I will post the links tomorrow. It is amazing what is available out there.&lt;br /&gt;&lt;br /&gt;The rewrite rule was to convert dynamic urls to appear to be static urls. As soon as I did this I noticed an increase in google activity on the site and the sitemap revealed more pages. So it worked :)&lt;br /&gt;&lt;br /&gt;Added two more tutorials to &lt;a href="http://www.rabiddog.co.za/"&gt;rabiddog.co.za&lt;/a&gt;. Both PHP. One dealing with classes and the other dealing with output buffering. The tutorials section is still look a bit bleak but time will fill the holes. This weekend I am hoping to get onto the next section of the site.&lt;br /&gt;&lt;br /&gt;Oh and in my travels I came across an article that pretty much sums up the challenge facing good developers and the plague destroying the programming art. &lt;a href="http://www.sadeveloper.net/Articles_View.aspx?articleID=235" target="_blank"&gt;http://www.sadeveloper.net/Articles_View.aspx?articleID=235&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-114677094430687456?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/114677094430687456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/modrewrite-and-jaws-of-insanity_04.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114677094430687456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114677094430687456'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/modrewrite-and-jaws-of-insanity_04.html' title='mod_rewrite and the jaws of insanity'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-114668637117735298</id><published>2006-05-03T21:53:00.001+02:00</published><updated>2008-02-23T22:11:47.684+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rants'/><title type='text'>The FAST Lane</title><content type='html'>Driving home this evening on the M1 I encountered a traffic jam (nothing strange really, happens everyday) and for some arb reason I had a thought. I asked myself "how on earth can the fast lane stop?"&lt;br /&gt;&lt;br /&gt;Valid question if you think about it. The fast lane has no off-ramps, no robots (traffic-lights) and no stop streets. To effectively jam up the fast lane it would mean that the lanes end must have stopped.&lt;br /&gt;&lt;br /&gt;The fastest lane on the highway has to be the emergency (taxi) lane. These guys rip down the emergency lane and block off ramps because they need to get past them.&lt;br /&gt;&lt;br /&gt;Viva metro police, viva traffic police, viva South African law enforcement and excuse me while I vomit.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-114668637117735298?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/114668637117735298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/fast-lane.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114668637117735298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114668637117735298'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/fast-lane.html' title='The FAST Lane'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-27470674.post-114666156169404860</id><published>2006-05-03T15:03:00.001+02:00</published><updated>2008-02-23T22:12:03.666+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Notice'/><title type='text'>Up, up and away!</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Finally the &lt;/span&gt;&lt;a style="FONT-FAMILY: verdana" href="http://www.rabiddog.co.za/"&gt;Rabid Dog labs website &lt;/a&gt;&lt;span style="font-family:verdana;"&gt;has been launched. Although things have started pretty slow I am hopeful that they will pick up. So If you know anyone that does development, that needs a tutorial, a code library or an application, PLEASE ask them to request it at my site. The only way this thing is going to get any bigger is if I get feed back from the community.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/27470674-114666156169404860?l=rabiddoglabs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rabiddoglabs.blogspot.com/feeds/114666156169404860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/up-up-and-away.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114666156169404860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/27470674/posts/default/114666156169404860'/><link rel='alternate' type='text/html' href='http://rabiddoglabs.blogspot.com/2006/05/up-up-and-away.html' title='Up, up and away!'/><author><name>Rabid Dog</name><uri>http://www.blogger.com/profile/15901452954561958548</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_tRPYuaTrTDQ/S1YV57D6xjI/AAAAAAAAACI/oKPNSWd6Y6I/S220/AIbEiAIAAABECLL18e7G4-aB9QEiC3ZjYXJkX3Bob3RvKig4YWZkOWNlNTIzYjJmZmU3MjYwMTAwMzBkNTIwOTRhOGIzZWZhNjZmMAHgVdXfxmjPa7cPH5cPP_o3-bEmyg.jpg'/></author><thr:total>0</thr:total></entry></feed>
