Skip to content

Instantly share code, notes, and snippets.

@breezhang
breezhang / A
Last active October 2, 2015 01:38
Client just for test
public class MyRemoteClass : MarshalByRefObject, IMyInterface
{
public int FunctionOne(string str)
{
return str.Length;
}
}
@breezhang
breezhang / Service.cs
Created March 21, 2012 11:42
MarshalByRefObject remoting
public class MyRemoteClass : MarshalByRefObject, IMyInterface
{
public int FunctionOne(string str)
{
return str.Length;
}
}
@breezhang
breezhang / interface.cs
Created March 21, 2012 11:43
Test remoting MarshalByRefObject
public interface IMyInterface
{
int FunctionOne(string str);
}
@breezhang
breezhang / gist:2157745
Created March 22, 2012 11:20
autofac 2.6 lazy
##http://nblumhardt.com/wp-content/uploads/2009/12/LazyInAutofac2.zip
using System;
using System.Collections.Generic;
using System.Linq;
using Autofac;
namespace LazyInAutofac2
{
@breezhang
breezhang / path.cs
Created March 23, 2012 12:43
Environment right path
http://stackoverflow.com/questions/3038337/powershell-resolve-path-that-might-not-exist
[Environment]::CurrentDirectory = $pwd
[IO.Path]::GetFullPath(".\xyz")
@breezhang
breezhang / Dynamic.cs
Created March 24, 2012 23:35
MVC3 .net4 Y can dynamic view
strongly-typed View very stupid
///Key API
dynamic object =ExpandoObject();
object.sex = ...
object.name = ...
razor view
///
@breezhang
breezhang / gist:2204394
Created March 26, 2012 10:44
Shell Run in C#

cmd shell

PS shell

cmd Process

public bool CmdRun(Command cmd) { var proc = new System.Diagnostics.Process { EnableRaisingEvents = false,

Start just do ==> [XML]$book=Get-Content

whatever you just do you like $book.catalog.book | select author |sort price |group author -NoElement

Count Name                     
----- ----                     
    1 Kress, Peter             
 1 Knorr, Stefan 
@breezhang
breezhang / gist:2250964
Created March 30, 2012 11:36
XSLT import css

Rick Roen wrote:

Hi

<style type="text/css"> @import "salesdoc.css"; </style>

This (the "@import") is plain text for XSLT. You can use unparsed-text() to read a file as a string:

~> cat import-css.xsl

@breezhang
breezhang / gist:2250995
Created March 30, 2012 11:41
xslt import css file
[From] (http://stackoverflow.com/questions/1038101/how-to-inline-css-and-javascript-through-xsl)
You CSS file
<!--/*--><root><![CDATA[<!--*/-->
body
{
margin: 0;
}
div > p
{
background-color: yellow;