Category: primers - to get started (in the various topics)

looping in php

Outer and Inner loops are important as seen here:
Read more »

learning to code

Objectives
What do you want to learn?
Programming in general / making websites / making mobile apps?

Areas
There are 4 aspects to being a software solution developer
* Concept – what to make / how it will work / who uses it?
* Design – can you leverage whats in practice today – are you good with images and colours, have you a good understanding of usability?
* Familiarity with Platform – how are you going to build it?
* Programming – an ability that you gain from experience / familiarity with a language. A simple way to start is with a set of programming exercises and also seeing how things are done.
Read more »

starting a project

Approach to starting a new project – c. May 2013

Understand functional goals
Consider options to achieve – choose best option with the functional and technical goals

find high risk areas and try to do POCs (proofs of concept) early to mitigate them
look at usability, UI guidelines etc
find types of development task (list form, crud form, report, admin section)
consider non functional requirements

remember rules (try not to reinvent the wheel) and patterns
and antipatterns – golden hammer – using a golden hammer for everything
Read more »

xml serializer: known types with tidy namespace

The KnownType attribute in WCF is XmlInclude in Xml.
These let the serializer know that other types can be encountered which is not know by scanning the contract of the object being serialized. This normally happens when a contract is on a base type, but can hold derived types.

When your xml is visible to the user it matters how clean the text is. Using XmlInclude adds an attribute to let itself know the runtime type like so:
<Item d5p1:type=”Button”.

Now the definition of d5p1 is in the namespace xmlns:d5p1=”http://www.w3.org/2001/XMLSchema-instance”
If this namespace was not already in the root element, the generated xml would have this reference in every item such as:
<Item d5p1:type=”Button” xmlns:d5p1=”http://www.w3.org/2001/XMLSchema-instance” …

Adding this namespace explicitly to the XmlSerializer means that this xmlnd definition will now appear 100000 times in the document annoying the user who is reading it (or worse yet who has to edit it)

If you add code like so, the document magically becomes tidy.

var xml = new XmlSerializer(typeof(T), extraKnownTypes);
var ns = new XmlSerializerNamespaces();
ns.Add("d5p1", "http://www.w3.org/2001/XMLSchema-instance");
xml.Serialize(fileStream, obj, ns);

t4 templating

These include files (with samples) worry about reading files in the current project, reading direct sql / sprocs and files (tsv) and Grouping them by a given columnIndex

Tips

Host.ResolvePath("Data.txt")

Warnings

//Mention language (at top of file / include file)
<#@ template language="C#v3.5" debug="True" hostspecific="True" #>

//Add assemblies and import namespaces
<#@ assembly name="System.Core"#>
<#@ import namespace="System.Linq"#>

//Include files
<#@ include file="Project.ttinclude" #>

//Inside ttinclude files, Make sure to add a + inside
 the final code block (after includes, imports etc)
<#+
  //helper methods
#>

code management

Find Dead Code:

You want a tool that generates a call tree.

Either Resharper / ndepend (with cql)

http://stackoverflow.com/questions/245963/find-unused-code

cakephp baking

Baking is the way of generating code in cakephp.
You can bake anything from plugins to views.
First create the tables needed. based on where the cake bake command is invoked, the baker automatically connects to the default db configured in app/config and prompts what to bake.
Logically, baking is done in this order. Model, Controller, Views.

See a quick tutorial here or view the original screencast (with ads) or on youtube.

To bake plugins, see here.

 

fluent conventions

Adding conventions to the fluennt nhibernate mapping is as simple as: Read more »

wcf

http://www.microsoft.com/learning/en/us/certification/mcts.aspx#tab2

Server Tracing

Can you enable tracing on the server (http://msdn2.microsoft.com/en-us/library/ms733025.aspx) to figure out which exception is being thrown at that location? That will help figuring out if the problem is due to a quota being exceeded. Read more »

collaborating

Google Docs

I recently started using it. It’s fantastic!

You can even be using it Offline as part of the cloud (found link here)

I will try and find out if it can be shared with non gmail users.

Google Apps

I would recommend Google Apps if you can live with their once freaky privacy policy. Its easy to changeover any company having its own domain and its FREE.

gmail (upto 100 email accounts)
docs + spreadsheets / calendar
GA Help Home Page

Avoiding bounced messages in MX.