Fremus.co.za

Demistifying Life and Web Development

Archive for September, 2009

Showing some respect for wrestlers

In the last two weeks or so I have been watching Youtube videos of wrestlers and in particular Bill Goldberg, and the thing that I found the most interesting to read is the Wikipedia entries for these wrestlers. If you read Bill Goldberg’s wiki article you will note that he was an American football star, and its fascinating to note that a lot of these wrestlers come from an American football background. Duane Johnson (the Rock) played American football and so did John Layfield. Other wrestlers that got my interest were Brock Lesnar and Kurt Angle. Brock Lesnar was an NCAA champion, tried out for American football and now fights in something called the Ultimate Fighting Championship. I also watched a video of Kurt Angle on Youtube where he spoke about his match against Brock Lesnar and it was great hearing how they seemed to agree on how a match would go, and how some of these wrestlers really get hurt.

The video of Bill Goldberg I like the most is where he wrestles against The Giant, or as he is now known in the WWE, The Big Show. The best part is where he jackhammer’s The Giant, who weighs 220 Kg. Check this out:

  • Share/Bookmark
posted by fr3dr1k in General and have No Comments

Is JavaScript object oriented?

When I started my career about 5 or so years ago I didnt know much about JavaScript, but I knew something about object oriented analysis and design. OOAD in this case was the classical approach to OO where an object is an instance, which means that each thing or object that you create in a system must first be instantiated, and this is something that does not happen in JavaScript at all really. Everything in JavaScript is object-based, there is no class instantiating as in the classical OO approach. The other thing that is quite notable is that it takes a bit of a work around to create some sort of inheritance in JavaScript, its not something that exists in the language itself. Similarly a thing like polymorphism is not a language feature as it is in say C#. With all that being said though, it does not mean that these features cannot be created in JavaScript, it just means JavaScript kinda works better without them.

It’s amazing then to hear an experienced JavaScript developer then speak of JavaScript being object oriented because it supports basic dot notation, even though the language itself is not object oriented in the classical sense.

  • Share/Bookmark
posted by fr3dr1k in Application Development and have No Comments

My personal growth – sustaining it

My manager asked me today to give him some insight into the things I would like to learn more about, with a particular focus on my own development, and I thought it a good idea to spend a few minutes posting a blog on the topic. My personal interests lie in a few areas at the moment, and when I say personal interest the context is work, and more specifically the technologies that I work with. One area I really want to focus a lot on in the coming months is the C# language itself and in particular:

  • Generics
  • Delegates with the specific aim of better understanding Linq
  • Linq to Objects
  • Linq to XML

I would like to know and understand the C# programming language in a comprehensive manner. In addition to the language I would also like to understand design patterns and overall system design, with a very strong OO flavour. I think if I can spend the next 6 months learning C# I would be a better developer for it. In addition to C# I would like to learn a second programming language and I have been thinking Python is a good candidate in this regard. I would like to apply the knowledge directly into what I do though. So if I learn Linq to XML now, I want to start using it now. If I learn the yield keyword now, I want to use it now.

Other aspects that I would like to incorporate in my learning of C# would be areas of social media such as Facebook, Twitter, Youtube, etc. I really enjoy SEO (search engine optimisation) as well, I love the metrics and the art that goes with it. I believe I can develop many aspects of this in C#. I also believe I can develop a total marketing solution that encompasses email and social media.

I am interested in topics such as ASP.NET MVC and Silverlight, but I am also interested in developing full-blown client applications in WPF.

My manager also mentioned that each new thing that we learn should be set as a target for each day. You have set yourself some goals and stick to them. One way to determine a few goals is to reflect on yourself and see what you do each day, and through that reflection set some ideals and goals.

We are at work for a purpose after all.

  • Share/Bookmark
posted by fr3dr1k in Personal and have No Comments

Sites that use Silverlight, updated

Last year July I wrote a blog post that listed some sites that use Silverlight to power rich application content. Twelve months later and I have found a few more cool ones, although the Hardrock Memorabilia site still remains my favourite.

ShineDraw still remains a great site for checking out the same things done in either Flash or Silverlight. And its updated regularly, which is always great.

In the meantime though I have found two other cool examples of Silverlight:

  • Share/Bookmark
posted by fr3dr1k in Silverlight and have No Comments

My new camera – Canon Powershot SX20 IS

In a couple of months from now I will be going on a holiday and one of the holiday maker necessities is a digital camera. Initially I was interested in the Canon Powershot SX 200 IS, but after seeing and hearing about the flash mechanism that pops up, and could potentially break, I decided to take a look at the Canon Powershot SX 10 IS, which has a 20 optical zoom. After looking and inquiring about the camera, a salesman kindly informed me that the SX 10 is being replaced by the SX 20. So my attention was shifted to the SX 20, and here are some of the features that caught my eye:

  • It has a 20 Optical zoom which equates to a 28 mm zoom lens. This is more than sufficient for my holiday making needs, but it will also serve me very well after the holiday
  • It can capture video at 720p which is not full HD, but is good enough for me, because I do not see it as a video camera, although I will be using it to take a few videos
  • It has a feature that allows you to take full manual control of the camera, which means you get to understand some of the more advanced features. Its not just a simple point and click camera

Read about some of the other features on Canon’s website. The only other camera that I considered was the Canon PowerShot SX1 IS, but the only difference between the two from what I could see was that the SX1 had Full HD video capabilities, whereas the SX20 has 720p. The SX1 was also slightly more expensive.

So this morning I quickly went out and bought myself the camera, and I unboxed it and took a video. The only issue I had though was that the video’s native format is MOV which is QuickTime. Why do they use QuickTime? Now I have to do some conversion first before I can really use it. Anyway thats the only issue so far, and to solve it I managed to google a piece of freeware that converted it to MPEG. I uploaded it, which is also my first ever, to Youtube:

  • Share/Bookmark
posted by fr3dr1k in Photography and have No Comments

Using nullable types in C#

I was busy reading an MSDN article on modifying an attribute’s value in an XML document and I read the bit that looks like this:

int? c2 = (int?)root.Attribute("Att2");
Console.WriteLine("c2:{0}", c2 == null ? "attribute does not exist" : c2.ToString());

Notice the ternary operator after the the type. It’s saying that c2 can be null. If you wrote code like this:


//declare variable
int c = null;

You will get a compiler error. Also notice the conditional shorthand, which is something I see a lot in JavaScript. If I wrote this:


string myName = "Frederik";

Console.WriteLine("myName:{0}", myName == "Fredrik" ? myName : "My name is not correct");

The result will read “My name is not correct”.

  • Share/Bookmark
Tags:
posted by fr3dr1k in C# and have No Comments

Concept, CV Updater

One of the things that I see a lot on websites of other developers is a resume or CV section. It seems only logical that a developer would want to show off their pedigree, but I’m guessing a lot of developers would not mind some extra work (and extra cash). Creating a resume for your website is relatively straight forward, just create it! You just create some HTML page and add the information and its done, or is it? Well I found myself thinking in the shower (weird place to get an idea) and I thought that it would be really useful to write some code that made the maintenance of a resume or CV easy. Useful code does not have to be unnecessarily complex, because it achieves a certain function or purpose.

I consider maintaining my CV easy when I can edit the content of my CV and export the CV in as many formats possible. So basically I want my CV stored in one place where I can update it on a continuous basis, and when needed download it in Word, for instance. I’m sure that what I am doing has probably been done many times before, but I guess part of being a developer gives you the freedom to create your own solutions. And something I think developers should always do is use their own IP (intellectual property) to create solutions that they themselves use.

So for the CV solution I am thinking of using a very basic XML document with a very basic structure of sections and subsections. Think about it, a CV or resume is made up of sections and subsections. For instance I have a personal information section with subsections for my name, address, etc. Thus you can derive a quick schema:




  
    
      
    
  


Once the CV is in XML I can pretty much do with it what I want both in terms of modifying its content and exporting it. I actually started this idea by typing it out using Inkscape, simply because I dont have Word installed on my desktop machine, but also because it allows me to draw diagrams and go mad. I started off by defining some generic XML structure (without using XSD):



    
          
                CVSubsection Value
          
    

As you can see from the code that a CV could be made up of multiple sections and that each section could have multiple subsections. If you relate this structure to a more practical example:



    
          
                Fredrik
          
          
                Erasmus
          
    
    
           
                BSc Computer studies
           
    

It fits into the structure quite nicely. Each section will only have a single attribute called “name”, and each subsection will also only have a single attribute called “name”, but the subsection will have a node value, whereas the section name will not. The question begs though, what if you want to say where you got your qualification from? How would you structure that? Well you could add a custom attribute to the section called “institution”, which would change your xml:

    
           
                BSc Computer studies
           
    

The basic operations for the sections and subsections would mostly involve adding,editing and removing items. I think Linq to XML would perform this quite well.

  • Share/Bookmark
Tags: ,
posted by fr3dr1k in Application Development and have No Comments

Planning the Fremus brand

At the moment I have two domains:

The difference between the two is that one runs on an Apache HTTP server and the other runs on Internet Information Services (IIS). Why two different web servers? WordPress is my favourite blogging platform, and although .NET has a few blogging platforms available (BlogEngine.NET and Subtext) I have been using WordPress for a few years now and have come to really appreciate it for its powerful simplicity. I also do not want to create two separate blogging systems, one for the .NET website and the other for the WordPress one. I want to show that both systems can work together to build a single brand.

www.fremus.co.za will focus on all aspects of blogging and will cover general areas of technology, .NET specific technologies and general interest. I may from time-to-time blog about personal issues and feelings.

So then why have a web server that runs on IIS? Well I am a C# developer by day, so I thought I would like a portal where I could publish or demo solutions I develop, and .NET just does not run on Apache (maybe Mono solves this) at the moment for me. Thus its clear from this that Fremus.co.za will act as the home for my blog and Fremus.net will be used for .NET development. What is not clear is how I will use the two to create some sort of brand. Clearly both serve a different purpose, but I feel both represent some sort of personal brand.

So with that in mind I decided to fire up my mindmapping tool, Cayra, and started to map some ideas on how the two websites will feed off each other. And basically I came up with a strategy that focuses the .NET side of things to have a homepage that is dedicated to the following items (areas on the home page):

  • An ATOM/RSS feed of the posts from www.fremus.co.za
  • An area dedicated to ‘Social Feeds’:
    • Twitter – Here I want to look at .NET technologies that provide cool ways to interact with Twitter. My thinking is to have my own status updates plus several Twitter threads. It might be useful to write some code that assimilates this functionality. I have been looking at LinqToTwitter for this purpose.
    • Youtube – I thought it might be a cool idea to list the videos that I watch. And there are API’s available for it.
    • Galleries – I would like to write some sort of gallery application that displays photos I have taken of places I have been to. I am going to be buying a digital camera soonish.
    • I will only have links to LinkedIn and Facebook profiles, have no immediate plans to use API’s
  • I want to create an area that shows/tells of the projects I am currently busy with. I have two projects I am working on at the moment, which I will detail later

The goal is to create some sort of personal brand that represents me and what my passion is. The brand should ideally be reflective of how I would express myself and how that expression would materialize to the rest of the world, and technology is a part of that brand.

  • Share/Bookmark
Tags:
posted by fr3dr1k in Fremus.co.za and have No Comments

Building a case for ORM

Okay, so I have been guilty in the past for not implementing any form of ORM (Object Relational Model) for some of the projects I have written. The main reason for this is/was that the projects I have worked on have never really used them. But the more I code the more I realise I sometimes find myself re-coding the same stuff. I mean my understanding of an ORM tool is that it creates a set or sets of classes that map to one or more databases. But why is this beneficial and why does this improve my life as a developer. I started out by reading this article on Wikipedia, which is not as detailed as I had hoped, but I guess its a starting point, because it lead me to this article. I also found this article and watched the video and from it got to understand that for the relational world to co-exist with the OO world several things need to be considered:

  • Inheritance: In the OO world a User object might serve as a base class for users of type teacher or student. How do you map this relationship in the relational database?
  • Granularity: This happens if the classes do not match up to the tables in the database. You might for example have a situation where a User is associated to a country. In your database you might represent this as two tables, but in your class you might represent the country as a property or field of the User class. So there exists a mismatch. How do you map this situation?
  • Identity and Equality: Lets say you query a database for a User with ID 100. The result you get back will always point to user with ID 100. If you look at it from an OO perspective, will a User with ID point to the same object, or multiple instances of it?
  • Association (directionality): In an OO model you associate classes with each other by placing references in each class of the other. In a relational model you create the associations by placing a foreign key in a table.
  • Type systems: The types in a database are quite different from those in an OO environment. For instance a VARCHAR with a size of 100 is not the same as a string, because a string is dependant on the amount of memory available.

I then read two StackOverflow topics, one here and one here. From what I could gather ORM’s are not great at performing bulk operations, but what they lack in that area they make up for in developer productivity.

I remember coming across an article that compared the performance between various ORM mappers on this website.

  • Share/Bookmark
Tags:
posted by fr3dr1k in Application Development and have No Comments

My opinion on webforms and such

Today someone asked me what my opinion on webforms are or were, and sometimes I feel like the proverbial deer that gets caught with the light in his eyes. It probably seemed like I knew nothing about web forms, which is not entirely true. I mean I did a lot of my first ASP.NET programming with web forms, and its a really great platform for several reasons. Firstly you can develop a working demo of something in really short order, you don’t have to really go out and code a user control from scratch, because the controls that are already there are pretty good. I mean the Gridview/Datagrid control is pretty cool and it is pretty customizable. Secondly ASP.NET does a good job of taking HTTP from the stateless protocol it is, to a model that maintains state quite well. I coded a lot with ASP.NET Webforms and its not a bad technology or platform to work with.

In the same breath, however, I have been working with SOAP calls and web services for the last 8 to 9 months and what I like the most about this approach is the freedom to totally control the markup that is rendered in the browser. With web forms you had to deal with something called ViewState which could in some scenarios make a mess of your code. I like clean HTML. What the SOAP/Webservice model also kinda reinforces is that HTTP is stateless and should be treated as such.

I have also been doing some ASP.NET MVC and I personally like it, a lot, and will continue developing a bit more with it. There is a clean and clear separation between your presentation logic and your business logic and there is no viewstate.

Maybe I need to do some more webforms for a bit to get to grips with it again, maybe not. I do prefer spending time learning C# language features actually.

  • Share/Bookmark
posted by fr3dr1k in ASP.NET and have No Comments
Get Adobe Flash playerPlugin by wpburn.com wordpress themes