webapi request rule

February 25, 2014 § Leave a comment

Only one parameter in each request, 

For post request, if the request type is string or value typed, must use [FromBody] to force the parameter comes from body.

i.e

public string GetString([FromBody]string name)

{

return “hello: ” + name;

}

 

use json in body for testing

{name:”abc”}

git setup

February 11, 2014 § Leave a comment

Setup GIT
Install Chrome (Some developer tools render properly only in Chrome for now)
Install GIT http://git-scm.com/downloads, choose default installation option, we will use GIT BASH application from this installation. (Windows 8 users can read Readying git on Windows 8 for Helix development)
Go to stash and attempt to login,this works off your windows login,.
Open GIT BASH and type ‘ssh-keygen’,press enter on prompts, note the location of the generated file which is a .pub file that contains your ssh key, you must always have network access to this location
when uploading/downloading files using git from stash.

Open .pub file (via notepad) created in above location and copy and paste all of the key to your stash ssh keys settings (press add key button)

6. Navigate to a folder you want to store GIT downloaded files in GIT Bash
7. Go to a repository in stash that has the files you want to download , press Clone button and copy and paste the SSH text like below

8. in GIT BASH type git clone sshtext like below, this will pull down the files from the repository above (helix.framework solution) to the specified folder below.
If this is successful, this proves you have successfuly setup GIT to talk to Stash.

Refer to Git and line endings to make sure your git configuration sittings are correct.

best Continuous Integration approach

January 30, 2014 § Leave a comment

stash + bamboo, for a small team, it only costs $20, host in house,
use confluence ($10) for team collaboration, host in house,
trello(free) to manage daily scrum / project process.
jira? not every useful for a small team

team collaboration on git branch vs folk

January 30, 2014 § Leave a comment

sBranch:
one public remote repository, everybody push to the remote repo using different branch, and merge to the developer branch at completion, send pull request to merge to master branch

Folk:
one public remote repo, one private remote repo for every dev. dev checkin to private repo, and merge to private repo when public repo is updated. raise a pull request at completion and push to public repo.

the advantage of folk:
1: keep the public repo clean, only see one clean push for each push, no need to see lots of bug fix, style formatting….
2: isolate dev private repo, if anything went wrong, there is no impact on public repo, they can simply refolk again.
2: when multiple pull request occurred, branch may have to rewind multiple pull request, but folk, only need to roll back the specific push (not quite understand how this works)

Use Service Stack for Web Service

January 29, 2014 § 1 Comment

vs WCF: easy to integrate for RESTful service
vs Web Api: automatic featured documentation, wsdl for xml
pro:
not rely on any other service package, keep nuget clean.
authentication
full format support, json, jsonp, xml, csv?…

Map a windows folder to driver

January 29, 2014 § 1 Comment

Map C:\abc to D:\ drive (http://en.wikipedia.org/wiki/SUBST#Persisting_across_reboots)

    •  In registry – go to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices
    • Add “D:” key with value “\??\C:\TFS”

Faulting module name: KERNELBASE.dll

June 14, 2012 § 1 Comment

Faulting application name: NServiceBus.Host.exe, version: 2.6.0.1505, time stamp: 0x4e7a1411
Faulting module name: KERNELBASE.dll, version: 6.1.7601.17651, time stamp: 0x4e21213c
Exception code: 0xe0434352
Fault offset: 0x000000000000cacd
Faulting process id: 0x18d8
Faulting application start time: 0x01cd49cf95949cbc
Faulting application path: xxxx
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: dc716cde-b5c2-11e1-86b7-000c29f5993e

Reason: x86 windows service deployed to x64

Resolution: compile the application against x64 or all CPU and reploy

Entity Framework Code First partial update

June 6, 2012 § Leave a comment

using (var db = new Db())
{
var c = new SystemConfig
{
Id = id
};
db.SystemConfigs.Attach(c);
c.Value = val;
c.LastUpdated = DateTime.Now;
db.SaveChanges();
}

[xml]: serialize object without namespace or declaration

June 5, 2012 § Leave a comment

 

using (StringWriter sw = new StringWriter())
{
using (XmlTextWriter w = new XmlTextWriter(sw))
{
w.Formatting = Formatting.None;
w.Namespaces = false;
w.WriteStartElement(“root”);
var s = new XmlSerializer(typeof(T));
var ns = new XmlSerializerNamespaces();
ns.Add(“”, “”);
s.Serialize(w, Instance, ns);
w.WriteEndElement();
w.Flush();
}
return sw.ToString();
}

nServiceBus Debug in VS

May 30, 2012 § Leave a comment

under debug of project property, use Start external program, select the NServiceBus.Host.exe