//To serialize into XElement:
XmlSerializer x = new XmlSerializer(typeof(ComplexType));
XDocument doc = new XDocument();
ComplexType ct = _getComplexType();
using (XmlWriter xw = doc.CreateWriter())
{
ComplexType ct = _getComplexType();
x.Serialize(xw, complexType);
xw.Close();
}
XElement el = doc.Root;
//To deserialize into ComplexType:
using (XmlReader xr = el.CreateReader())
{
ComplexType deserializedComplexType =
x.Deserialize(xr) as ComplexType;
xr.Close();
}
Feb 4, 2011
Serialize and Deserialize object to DB / XElement
Feb 3, 2011
Exposing unreferenced data types via WCF service
For example, need to expose an enumeration that is not used by any of the WCF service operations to the client (via WSDL).
While
Eventually ended up with a dummy solution of having a dummy method:
Not the best solution, but couldn't gracefully work around it. Easy and works nicely though.
While
ServiceKnownType
attribute on the service class/interface/method exposed the type in the XSD schema of the WSDL, the default client proxy generation does not generate code for it.Eventually ended up with a dummy solution of having a dummy method:
public class ExposedDataTypes
{
public CustomType1 type1 { get; set; }
public CustomType2 type2 { get; set; }
}
ExposedDataTypes IService.Ignore()
{
return null;
}
Not the best solution, but couldn't gracefully work around it. Easy and works nicely though.
Jan 31, 2011
WCF Service over HTTPS / SSL with basicHttpBinding
- In IIS, set "Require secure channel (SSL)" option for the site / virtual directory.
- In web.config, set
<bindings><basicHttpBinding><binding...><security mode="Transport">
. - In web.config, set
<system.serviceModel><behaviors><serviceBehaviors><behavior...><serviceMetadata httpsGetEnabled="true"/>
Jan 19, 2011
.NET System.Diagnostics.Stopwatch may be wrong
The .NET System.Diagnostics.Stopwatch timer is a software based timer and it will not count while device is in sleep mode as CPU is not running. Only less accurate real time clock will keep running.
Found this when timing a long web service call. Suppose this is the case for operations not using full CPU ticks.
Example code:
May results in something like:
Found this when timing a long web service call. Suppose this is the case for operations not using full CPU ticks.
Example code:
Console.WriteLine("start...");
var sw = System.Diagnostics.Stopwatch.StartNew();
System.Threading.Thread.Sleep(5000);
sw.Stop();
Console.WriteLine(string.Format("Elaped: {0} ({1} ms)", sw.Elapsed, sw.ElapsedMilliseconds));
May results in something like:
start...
Elaped: 00:00:02.3029859 (2302 ms)
Nov 20, 2010
Neuro Web Design by Susan Weinschenk
What makes them click?
Book notes
Nov 13, 2010
Presumably Unsafe Plastics
Number 3 Plastics: V (Vinyl) or PVC
May release toxic breakdown products (including pthalates) into food and drinks. The risk is highest when containers start wearing out, are put through the dishwasher or when they are heated (including microwaved). |
Number 6 Plastics: PS (polystyrene)
Can release potentially toxic breakdown products including styrene, particularly when heated! Watch for takeaway hot drinks. (See comments for more information). |
Number 7 Plastics: Miscellaneous
Studies have shown polycarbonate can leach bisphenol A, a potential hormone disruptor, into liquids. |
Nov 12, 2010
FCS Fin Sizes
Type | Image | Base (mm) | Depth (mm) | Area (mm2) | Sweep (o) |
---|---|---|---|---|---|
G-1000 | 108 | 107 | 8405 | 32.3 | |
M2 | 108 | 107 | 8405 | 32.3 | |
M3 | 109 | 112 | 9172 | 31 | |
M5 | 111 | 115 | 9525 | 33 | |
M7 | 115 | 119 | 10137 | 33 | |
GYU Side | 111 | 115 | 9478 | 34.9 | |
GYU Centre | 106 | 113 | 8465 | 34.6 | |
MR-TX Side | 128 | 142 | 13580 | 33 | |
MR-TX Stabilizer | 90 | 99 | 6200 | 31 | |
GPR Side | 114 | 115 | 9939 | 34.3 | |
GPR Centre | 107 | 116 | 9081 | 33.8 | |
G-R | 117 | 118 | 10243 | 31.6 |
Subscribe to:
Posts (Atom)