Fremus.co.za

Demistifying Life and Web Development

Dev Days 2011 Cape Town Overview Part 1

I have been to several developer conferences in Cape Town now, from the first ones in 2006 through to Mix Essentials in 2008, Dev Days in 2010 and now again in 2011, and this is the first one where you had to pay, which is not the worst thing, but still. I have also been to Internetix, the Internet Solutions conference and it gave me an opportunity to look at both the style of conference and the attendees. The feeling I got from Dev Days 2011 was that the energy levels werent that great, compared to say Mix Essentials where Brad Abrams did the demos. Strangely he still worked for Microsoft at the time. As the day went on Dev Days 2011 seemed to just fizzle out as interest in the talks waned. Is this how open source devs experience conferences? I mean aren’t we suppose to be passionate about technology and the environments we use the technology. Is it just about the day off from work or the lunch and free bag of goodies? My general feeling was that the presenters lacked some energy, they seemed rushed to get through their powerpoint slides and in some cases I got the feeling that they were a little unprepared. Maybe I am wrong. There were a few good moments though and code was shared, but I somehow felt that the ASP.NET MVC 3 session covered stuff I have already read about, and I was expecting some new features. Maybe some cool new syntax features would have been nice. I might also be too critical and might need to just appreciate it for what it was – Microsoft keeping developers interested just enough to keep them using Microsoft developer tools and technologies. And unashamedly I love the Microsoft toolsets.

Keynote

The keynote seemed to focus on a a few key areas, Windows Mobile Phone, Windows Azure (cloud computing) and the developer tools that can be used to develop applications for these platforms. Some interesting insights were shared in terms of where Microsoft sees itself positioned in the mobile market – 2nd by 2014. In the keynote a developer used Microsoft’s Web Matrix and something that stood out was that he renamed a plain html file to cshtml and it was ready for the Razor view engine. I also enjoyed the Eclipse demo that integrated with VSTFS, FROM Ubuntu no less, AND the code was written in Java (JSP). The VSTFS actually demonstrated how testing and source control can all be achieved with TFS, from different development platforms. The keynote also covered aspects of the Azure platform which I picked up on in a later session. Azure seems rather complicated and South Africans will only have it available in 6 months, which makes me less than reluctant to use it.

ASP.NET web development with MVC

The first session I attended actually focussed on scaffolding with entity framework 4.1, and did not go into a lot of depth. The presenter touched on the ASP.NET MVC execution process illustrating with a few diagrams how ASP.NET MVC was as much a part of ASP.NET as webforms was. He pointed out that ASP.NET MVC differed from ASP.NET Webforms by virtue of its viewing engines, with MVC using the razor view engine and the latter using the ASP.NET Webforms view engine. The diagram also illustrated that WebPages, used in the ASP.NET Web Matrix, used the Razor view engine. The presenter then showed how easy it is to create an entity framework 4.1 model from a code first perspective using standard POCO classes, and then how easy it is to create the necessary scaffolding for create/edit/view operations, including controller actions and views.

A lap around Internet Explorer

The second session I attended was a demonstration of Internet Explorer’s new features, including things like a new fresh UI experience, a fast JavaScript rendering engine, GPU-enabled graphics acceleration and a few other things. The session also showed off some of IE9’s developer tools, which to my mind will not make me switch from Chrome. I kind of like Chrome’s dev tools, and I’m not a Firefox user anymore really, but I’m not an IE9 convert either. Visually IE9 performed way better with one or two HTML 5 examples when compared to Chrome. The thing though is that IE9 can only run on Windows 7 and if Microsoft thinks that XP will totally disappear then well I think they might be wrong. Chrome runs on XP. IE 9 is nice, but I’m not convinced.

I’m exhausted! Will write part 2 tomorrow.

  • Share/Bookmark
posted by fr3dr1k in DevDays,Microsoft and have No Comments

Society of masochism

Mainstream society portrays a tendency of masochism very well, and before I define this further I’ll try and see what it, masochism, means. If you do a search for masochistic, you might find this page that will lead you to this page and if you look at the key points from “Self-defeating personality disorder” then it seems like we see that appearing in every facet of our society, yet we try to cover it up with our material achievements. “A pervasive pattern of self-defeating behaviour” is indicative of how we make movies isn’t it? Most movies portray characters that are already in a defeatist state – the focus of which is then to see these characters go from this defeatist state to something better. We love movies about demons, vampires and evil things because we like the evil, because we seem to want to find a justification for the evil. Lately vampire movies feature a “good vampire” or a “good bad guy”. Why don’t we ever see movies that stay with the good and end with the good. Is that even possible?

The defeatist and masochistic nature reveals itself far more in how we live our lives. People claiming to be the “meanest bitch” or “not caring who they offend” are all examples of masochism in my mind. You are hurting yourself because you want to portray a particular image to the world. You know the “I-don’t-give-a-shit” attitude, which is really screaming “I want lots of love and attention”, especially when you don’t get the love. Having a don’t care attitude reminds of a documentary I once watched about lions and buffaloes, where the lions were hunting the buffaloes as young lions and how eventually the hunting took its toll on them physically as they grew older because of the injuries they picked up while hunting. The injuries did not affect them as much when they were young but eventually as they grew older became more apparent. The same analogy can be drawn for people who have an attitude of “don’t-care” when they are younger, because eventually your soul gets weary of being like that.

We are so unlike nature because we always tend to seek the humanistic element in nature, the thing that suits us. Instead nature just is, it asks no questions or gives no answers, it just is. Why are we not like that? Death is such an equaliser yet we discriminate, we try to make ourselves better than others. There is a very fine line between who you are now and how you are living your life now, and how it all could change in an instant. An instant which would make you no better than anyone else.

Saying you are a bitch is a sign of a person with a small and pitiful ego deeming it necessary to make themselves appear meaner to make up for what they lack on a personal level. You will generally find these people to be the same proponents of drinking every weekend (all in the name of having a good time). They generally associate themselves with the typical crowd – ones who deem their material wealth (measured in both monetary and achievements) to be the epitome of achievements in life. They also tend to be the ‘neat and clean’ crowd, yet you have to wonder what the ‘neat and clean’ appearance must cost them, both personally and otherwise. I am pretty sure many individuals sell a piece of their soul to achieve this. The ‘neat and clean’ lifestyle often reminds of how we always try and disassociate ourselves from the poor and the sick.

What am I trying to say here? Life is not a predictable thing, you cannot always live it the way you imagine it, perfectly in your mind. Therefore you must be accepting of people, and be open to what they offer, rather than be a “bitch”. I have so many more thoughts around this though.

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

Daily Code – Day 3 – How do I understand “Unobtrusive JavaScript”

In my previous job I learnt the unfortunate bad habit of attaching onclick events to DOM elements, in other words I would take a div and add an onclick event to it. I realised at some point that this was a very bad habit and clearly nobody took the time to understand how it should work. Instead of doing the onclick thing you should be attaching “event listeners” to your elements so that when you click on them they are triggered. Still don’t understand what I mean? In the past I might have had this:

Instead you should do something like this:

Then you wire it up using jQuery’s Live event like this:

$(".mySillyClickableArea").live("click", function () { });

This has several obvious advantages:

  • Your markup is much cleaner
  • You dont have to add multiple onclicks for multiple elements. Instead apply an event to a class

If you did it like I did before, stop, and re-evaluate!

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

What you should learn from your digital agency

A few days ago I wrote what I thought you should expect from a digital agency and to be fair I may have been rash and a bit too critical. Unfortunately I find myself being too critical at times, but thats another point entirely. It got me thinking though about what you should be learning from your digital agency, because as someone pointed out to me during the week a digital agency cannot repeat its offering to you again and again. Let me explain in simple terms. If your digital agency offers say a pay-per-click strategy for 12 months it seems obvious to me that when you work with the digital agency you will soon learn and realize that what they are offering as a PPC strategy can be accomplished by an internal resource dedicated to the task. Pay per click is a skill that can be learned quite easily, either by reading up on it or by following key people doing it. Point is though if a digital agency only offers to do a simple pay per click campaign, and not much else, they are just acting as a middle man between you and Google.

There is still nothing better in any marketing environment than being organised, simply put. If your digital agency is not organised in the way it approaches your marketing campaigns, its not really worth it. Some may say but you have to react to the way the market is playing at certain times, bullshit, you can still have a 6 month or even 3 month calendar planned for your marketing events. A digital agency that fails to plan with you on your marketing strategy and who does hit and miss strategies is bound to fail.

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

Daily Code – Day 3 – A great reason to use interfaces

Any class that inherits an interface is considered of that type, so it makes it easy to create implementations that do different things. More importantly it makes it easier to test. Lets say you have an Interface called IMyInterface:

    public interface IMyInterface
    {
        void PrintMessage(string message);
    }

You can then create two different classes that both implement the interface:

    public class ConcreteClassA : IMyInterface
    {
        public void PrintMessage(string message)
        {
            Console.WriteLine("My implementation here: " + message);
        }
    }
    class MyConcreteClassB : IMyInterface
    {
        public void PrintMessage(string message)
        {
            Console.WriteLine("My other implementation here: " + message);
        }
    }

This means that when I implement the code like this:


    class Program
    {
        static IMyInterface myInterface;
        static void Main(string[] args)
        {
            myInterface = new ConcreteClassA();
            myInterface.PrintMessage("hello");
            myInterface = new MyConcreteClassB();
            myInterface.PrintMessage("good day");
        }
    }

I dont create a dependency for class Program on either ConcreteClassA or MyConcreteClassB. If I make any subsequent changes to either of these classes then it doesnt affect class Program because it only deals with the interface. Its a great way to abstract your code, and its something I did not realise after reading up on it. Can an abstract class provide the same type of “abstraction”? Not really, and for a several reasons, the first being that you cannot create an instance of an abstract class and secondly you would have to expose the implementation details of the classes that inherit the abstract class.

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

Daily Code – Day 2 – Difference between an abstract class and an interface

I got asked this the other day and its one of those things that devs just have to know I guess, apart from the other fundamental C# stuff. I think of interfaces as thin classes or thinned out classes with no implementations of its methods, only signatures. Its the responsibility of the class that implements that interface to provide the implementation specifics. An abstract class on the other hand cannot be instantiated but rather acts as a base class for other classes. The responsibility lies with the class that implements it to override any methods, if the methods within the abstract class are declared as abstract. Another key difference between interfaces and abstract classes is that the members within an interface are implicitly abstract, in other words the class inheriting the Interface MUST create implementations of the inherited interface, whereas an abstract class may have non abstract members.

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

Daily Code – Day 2 – Use jQuery Data Templates

In yesterday’s blog post I illustrated how I can generate dynamic types, and return that dynamic type as JSON. Today I just want to show how I display the JSON data. To get the JSON data you have to make an AJAX call to the controller method, and you do this by using $.ajax like this:

    var restEndPoint = serviceURL + 'Home/GetOfferings';
    var templateId = '#offeringCheckTmpl';
    var data = '';
    var divToFill = '#offeringList';
    $.ajax({
        type: "POST",
        url: restEndPoint,
        contentType: "application/x-www-form-urlencoded; charset=utf-8",
        dataType: "json",
        data: data,
        success: function (msg) {
            var jsonObj = JSON.stringify(msg.Offerings);
            var temp = JSON.parse(jsonObj);
            if (templateId != null)
                $(templateId)
                    .tmpl(temp)
                    .appendTo(divToFill);
          }
    )};

The important bit is where I call the tmpl function and use a another script tag titled #offeringCheckTmpl which contains html and other bits. It looks like this:


Notice the ${OfferingId}, it matches up to the OfferingId field in your JSON object and basically maps it to the value and displays it. Using templates in this way makes it easy to create re-usable html without having to do string concatenations in your functions.

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

Daily Code – Day 1 – ASP.NET MVC: Using Json() to create dynamic types

Do you ever have to return more than one result set, or dataset for that matter to some UI? If for instance you have a piece of UI that allows users to create something new with by entering a value into a textbox AND by selecting a value from a dropdown list AND you are displaying existing (already added) data in a table below the dropdown and the textbox and they all appear on a modal dialog. Logic tells me that when I click to activate the dialogue the dropdownlist and the table with the data must be populated with data. It also tells me that its not feasible to make two jQuery ajax calls, one for the data in the table and another for the data in the dropdown. What to do? Return arrays of objects with one ajax call and bind it to the UI. How do you return arrays of objects in ASP.NET MVC? Well you can create dynamic objects like this:


        [HttpPost]
        public JsonResult GetOfferings()
        {
            offerings = new OfferingRepository();
            offerings.GetOfferings();
            offeringTypes = new OfferingTypeRepository();
            offeringTypes.GetOfferingTypes();
            return Json(
                new
                {
                    Offerings = offerings.Offerings.Select(t =>
                        new
                        {
                            OfferingName = t.OfferingName,
                            OfferingId = t.Id
                        }),
                    OfferingTypes = offeringTypes.OfferingTypes.Select(t =>
                        new {
                            OfferingTypeName = t.OfferingTypeName,
                            OfferingTypeId = t.Id
                        })
                });
        }
  • Share/Bookmark
posted by fr3dr1k in ASP.NET MVC and have No Comments

Daily Code – Day 1 – ASP.NET MVC Execution Pipeline

I have decided to stop whining about not being able to do certain pieces of code by learning the pieces of code needed to do particular things. With that in mind I am going to try and write a blog post everyday for the next year about code and concepts. Usually a piece of code has a concept behind it and usually it is required that you understand the concept before you rush in and code. Its understood that we don’t always follow the approach of understanding code before we implement it, but it should nonetheless be reason to try and understand it.

This morning I started reading up on the ASP.NET MVC 2 processing pipeline, which differs quite a bit from ASP.NET Webforms. Its important to understand the processing pipeline because it allows you to implement custom functionality such as your own Controller factory. Understanding the processing pipeline is also important because you understand what is possible and what not.

Webforms use a page life cycle whereas ASP.NET MVC starts off by processing an incoming request which it first tries to match up  with a file on disk. If it finds that the incoming request maps to a physical file it serves the physical file. If however it finds that the incoming request is for a .NET type that implements IRoutehandler, it looks in your Global.asax file at the routes in your RouteTable and looks to see if the request matches any of the route entries. MvcRouteHandler then knows how to take the request and invoke the relevant controller class. The controller is a class that inherits from a class called Controller which exposes the methods within that class to action methods, i.e. they can implement ActionResults or ViewResults which is rendered by a viewengine.

I think that describes the execution pipeline quite well.

  • Share/Bookmark
posted by fr3dr1k in ASP.NET MVC and have No Comments

What do you look for in a digital agency?

And by digital agency I refer to organisations that provide services ranging from SEO, mobile marketing and email marketing. Yes I mean those. Do you look for the shiny and fresh website with the never-ending list of clients, or the barrage of comments on the “what customers say” page? Do you look at their value proposition and ask yourself, “is that in line with what my organisation wants”? Is it all just a matter of shopping and finding the one that looks and sounds the best?

Personally none of these things matter, because if a digital agency does not have the time or resources to spend on you, yet they accept you as a customer (read take your money) then you should be worried.  If a digital agency has 30 clients and three of those clients, for arguments sake, contributed to 50% of their income it surely implies that they will offer more (and better) service to those that contribute the biggest portion of their income. It only makes sense for the digital agency to protect their income, but where does that leave the other clients who do not get the same amount of service? It leaves you in a very dark and unforgiving place, where you are left with a situation of paying a monthly retainer for which you do not necessarily get your pound of butter, for sake of a better phrase.

If you choose a digital agency do you ever ask them for a list of their clients, and a list of their top clients, and a list of their current projects? I guess not because you are too eager to get yourself on the digital road-map, and you were really impressed with the presentation given to you, and the shiny website. If the digital agency has a long client list then the next question you should be asking them is how many staff members they have, and if the proportion between staff members and client list and active project list is not balanced then you should seriously reconsider. Logic tells you that if a digital agency has a limited number of staff members and a lot of project work, which means your project will take priority somewhere between a desert and an ocean. Sounds odd, but thats the way I see it. As a developer I know that I can only write so much code in a single day, even though I would want to write more, its just not feasible to try and write for 24 hours a day.  The same applies to digital agencies, who can only do so much in a single day. Meaning that if a customer, who pays a digital agency 3x as much as another, asks them to jump they will surely jump, leaving the other customers a little less satisfied.

Things to notice when a digital agency is not giving you as much as you deserve, or are paying for, are simple things like grammar in promotional write ups. If the responsibility of checking the quality of the written content comes back to you, as the client, then the digital agency are not doing their job. Its their job to create content that is reputable. Another item that can be of concern is when they send out social media communication and they do not notify you, and you end up picking up errors in the communication. Basic skills are not negotiable for a digital agency, whether they be written or communication skills. Ask a digital agency for a copy of their last campaign(s) and read the content to establish the quality of what they are capable of delivering.

In hindsight its always easy to list what went wrong and in this instance its no different. Picking a digital agency to provide services should not be just about a perceived image or a seemingly good organisational fit bit also about the detail. Ask some of the following questions before you pick a digital agency:

  1. Who are their biggest clients?
  2. What are their biggest current and active projects?
  3. How many staff members do they assign to each project?
  4. What is some of their most recent campaign work?
  • Share/Bookmark
posted by fr3dr1k in eMarketing and have Comment (1)
Get Adobe Flash playerPlugin by wpburn.com wordpress themes