Cheat sheet:
- XAML for WPF: http://blog.blueboxes.co.uk/2009/02/03/xaml-for-wpf-cheatsheet/
- DataBinding: http://www.nbdtech.com/Blog/archive/2009/02/02/wpf-xaml-data-binding-cheat-sheet.aspx
Programming tools
- http://www.wpftutorial.net/wpfdevtools.html
Themes:
- http://wpf.codeplex.com/wikipage?title=WPF%20Themes&referringTitle=Home
- Download is here: http://wpf.codeplex.com/releases/view/14962
Data binding:
- See http://msdn.microsoft.com/en-us/library/ms750612.aspx
- Why we shouldn't use DependencyObject inside ViewModel layer: http://stackoverflow.com/questions/291518/inotifypropertychanged-vs-dependencyproperty-in-viewmodel
- How to serialize Dependency Object using XamlReader/Writer: http://www.codeproject.com/Tips/61443/Serialize-DependencyObject-it-s-easy
- How to reduce coding for INotifyPropertyChanged:
- http://stackoverflow.com/questions/1315621/implementing-inotifypropertychanged-does-a-better-way-exist
- Use CallerMemberName attribute available from .NET 4.5, see http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=vs.110).aspx
MVVM
- How to implement Command pattern: http://www.codeproject.com/Articles/101881/Executing-Command-Logic-in-a-View-Model
- Calling command by events: http://stackoverflow.com/questions/1048517/wpf-calling-commands-via-events
Topics:
- Async and data binding
- Types of bindings, multiple ? hierarchy ? collision ?
- Binding, converter, validation
Wednesday, December 5, 2012
Thursday, November 15, 2012
Tuesday, November 13, 2012
Emulating network bandwidth and latency
Network Emulator Toolkit:
http://blog.mrpol.nl/2010/01/14/network-emulator-toolkit/
http://blogs.msdn.com/b/lkruger/archive/2009/06/24/creating-a-stand-alone-network-emulator-using-vs2010-beta-1-release.aspx
Network Shaper:
http://stackoverflow.com/questions/130354/how-do-i-simulate-a-low-bandwidth-high-latency-environment
http://blog.mrpol.nl/2010/01/14/network-emulator-toolkit/
http://blogs.msdn.com/b/lkruger/archive/2009/06/24/creating-a-stand-alone-network-emulator-using-vs2010-beta-1-release.aspx
Network Shaper:
http://stackoverflow.com/questions/130354/how-do-i-simulate-a-low-bandwidth-high-latency-environment
WCF alternatives
- ServiceStack
- Transport is http only: http://www.servicestack.net/overview.htm
- NServiceBus
- Default transport is MSMQ, but others can be plugged in
- Agatha
- Use WCF for transport
- Why not WCF: http://thatextramile.be/blog/2009/07/why-i-dislike-classic-or-typical-wcf-usage
- no longer in active development
Monday, November 5, 2012
WCF Extension
MSDN link
http://msdn.microsoft.com/en-us/library/gg132853.aspx (MS document, not very good)
http://blogs.msdn.com/b/drnick/archive/2006/05/08/592110.aspx (Very good step-by-step blog)
-> improved and source code: http://blogs.msdn.com/b/dmetzgar/archive/2012/10/16/an-updated-custom-wcf-transport-channel-example.aspx
-> tcp example: http://code.msdn.microsoft.com/windowsdesktop/Sample-WCF-transport-474c4c02
Configuring custom binding:
- http://msdn.microsoft.com/en-us/library/ms788753.aspx
- http://msdn.microsoft.com/en-us/library/ms788759(v=vs.110).aspx
- http://robbincremers.me/2012/01/01/wcf-custom-binding-by-configuration-and-by-binding-standardbindingelement-and-standardbindingcollectionelement/
http://msdn.microsoft.com/en-us/library/dd699779.aspx (WCF example document)
http://blogs.msdn.com/b/carlosfigueira/archive/2011/12/08/wcf-extensibility-transport-channels-request-channels-part-1.aspx
http://msdn.microsoft.com/en-us/magazine/cc163302.aspx
http://msdn.microsoft.com/en-us/magazine/cc163394.aspx
http://blogs.msdn.com/b/drnick/archive/2006/05/08/592110.aspx (Very good step-by-step blog)
-> improved and source code: http://blogs.msdn.com/b/dmetzgar/archive/2012/10/16/an-updated-custom-wcf-transport-channel-example.aspx
-> tcp example: http://code.msdn.microsoft.com/windowsdesktop/Sample-WCF-transport-474c4c02
Configuring custom binding:
- http://msdn.microsoft.com/en-us/library/ms788753.aspx
- http://msdn.microsoft.com/en-us/library/ms788759(v=vs.110).aspx
- http://robbincremers.me/2012/01/01/wcf-custom-binding-by-configuration-and-by-binding-standardbindingelement-and-standardbindingcollectionelement/
http://msdn.microsoft.com/en-us/library/dd699779.aspx (WCF example document)
http://blogs.msdn.com/b/carlosfigueira/archive/2011/12/08/wcf-extensibility-transport-channels-request-channels-part-1.aspx
http://msdn.microsoft.com/en-us/magazine/cc163302.aspx
http://msdn.microsoft.com/en-us/magazine/cc163394.aspx
Example
http://wcfextensions.codeplex.com/http://webservices20.blogspot.jp/2008/11/introducing-wcf-clearusernamebinding.html
http://www.microsoft.com/en-us/download/details.aspx?id=21459
Tutorial
Writing channels: http://blogs.msdn.com/b/drnick/archive/2007/02/19/channel-development-tour-part-1.aspx
Class Diagram
Friday, November 2, 2012
How Fiddler works
Fiddler inserting itself as system proxy, see: http://msdn.microsoft.com/en-us/library/bb250446(v=vs.85).aspx
Thursday, October 25, 2012
WCF Performance
Thread pool throttling
Antivirus slowdown
Monday, October 15, 2012
Async/Await
Using Async/Await from .NET 4.0
* Download from http://nuget.org/packages/Microsoft.CompilerServices.AsyncTargetingPack
* License is here http://www.microsoft.com/en-us/download/details.aspx?id=29576
Using TPL to implement APM
* http://blogs.msdn.com/b/pfxteam/archive/2011/06/27/using-tasks-to-implement-the-apm-pattern.aspx
Synchronization Contexts in UI, Console, ASP.NET etc
* http://msdn.microsoft.com/en-us/magazine/gg598924.aspx
When used on UI application, the code after "await" is executed by UI thread by default. In Console application however, we need special treatments. See:
1. http://blogs.msdn.com/b/pfxteam/archive/2012/01/20/10259049.aspx
2. http://blogs.msdn.com/b/pfxteam/archive/2012/01/21/10259307.aspx
3. http://blogs.msdn.com/b/pfxteam/archive/2012/02/02/10263555.aspx
* Download from http://nuget.org/packages/Microsoft.CompilerServices.AsyncTargetingPack
* License is here http://www.microsoft.com/en-us/download/details.aspx?id=29576
Using TPL to implement APM
* http://blogs.msdn.com/b/pfxteam/archive/2011/06/27/using-tasks-to-implement-the-apm-pattern.aspx
Synchronization Contexts in UI, Console, ASP.NET etc
* http://msdn.microsoft.com/en-us/magazine/gg598924.aspx
When used on UI application, the code after "await" is executed by UI thread by default. In Console application however, we need special treatments. See:
1. http://blogs.msdn.com/b/pfxteam/archive/2012/01/20/10259049.aspx
2. http://blogs.msdn.com/b/pfxteam/archive/2012/01/21/10259307.aspx
3. http://blogs.msdn.com/b/pfxteam/archive/2012/02/02/10263555.aspx
Friday, October 12, 2012
WCF: Windows Communication Foundation
SelfHosting tutorial
http://msdn.microsoft.com/en-us/library/ms731758.aspxHow to publish metadata when using TCP binding:
1. Inside app.config, create service behavior element (e.g. HelloServiceBehavior)
2. Refer the behavior from service tag (behaviorConfiguration="HelloServiceBehavior")
3. Add endpoint to the service to exchange metadata, use contract="IMetadataExchange".
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="HelloServiceBehavior"> <serviceMetadata policyVersion="Policy15" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="HelloServiceBehavior" name="HelloService"> <endpoint address="net.tcp://localhost:8080/hello" binding="netTcpBinding" bindingConfiguration="" name="HelloService" contract="IHelloService" /> <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" /> </service> </services> </system.serviceModel> </configuration>
Using Async/Await
Async Cancellation/Progress is not supported
http://social.msdn.microsoft.com/Forums/en-US/async/thread/b1353952-ce52-4af7-b6ec-f792bef28566/
Enabling trace
netTcpBinding uses binary encoding and transport security, which delivers better performance.
Following URLS will help to get more information
Client proxy cannot be reused: http://stackoverflow.com/questions/1241331/recovering-from-a-communicationobjectfaultedexception-in-wcf
Solution: http://bloggingabout.net/blogs/erwyn/archive/2006/12/09/WCF-Service-Proxy-Helper.aspx
Solution: http://bloggingabout.net/blogs/erwyn/archive/2006/12/09/WCF-Service-Proxy-Helper.aspx
Classes
ServiceContractAttribute: http://msdn.microsoft.com/en-us/library/system.servicemodel.servicecontractattribute.aspx
OperationContractAttribute: http://msdn.microsoft.com/en-us/library/system.servicemodel.operationcontractattribute.aspx
ServiceBehaviorAttribute: http://msdn.microsoft.com/en-us/library/system.servicemodel.servicebehaviorattribute.aspx
Performance
Concurrency and Throttling combinations http://www.codeproject.com/Articles/89858/WCF-Concurrency-Single-Multiple-and-Reentrant-and
Timeout
Open/Close/Send/Receive/Operation: http://cs.gogo-asp.net/blogs/libaty/archive/2009/11/02/WCF_6730E930A630F330C930C830EA30C330D7306E30BF30A430E030A230A630C830245092302D8A9A5B59308B306B306F30_.aspx
Detecting Disconnected Clients
http://stackoverflow.com/questions/665473/how-to-handle-wcf-client-disconnect
http://stackoverflow.com/questions/5338842/detect-socket-disconnect-in-wcf
http://stackoverflow.com/questions/5338842/detect-socket-disconnect-in-wcf
Reliable Messaging
Need to turn-off or set level to Message Security for Bindings (doesn't work if the level is set to the default Transport level)
Working case
- Server not available during the first connection
- Network cable is blipping
Not working case
- Server is down and restarted
WCF and WebSocket
WebSocket only available in Windows8 ? (http://msdn.microsoft.com/en-us/library/system.servicemodel.nethttpbinding.aspx)
http://msdn.microsoft.com/en-us/library/hh977020.aspx
http://www.codeproject.com/Articles/341413/What-s-new-in-WCF-4-5-WebSocket-support-Part-2-of
http://msdn.microsoft.com/en-us/library/hh977020.aspx
http://www.codeproject.com/Articles/341413/What-s-new-in-WCF-4-5-WebSocket-support-Part-2-of
Performance Tuning
http://blogs.msdn.com/b/dmetzgar/archive/2011/05/04/wcf-scales-up-slowly-with-bursts-of-work.aspx
Multiple Contract per Service
Example
Thursday, October 11, 2012
Monday, October 1, 2012
.NET Async Await
* Performance consideration: http://msdn.microsoft.com/en-us/magazine/hh456402.aspx
* Comparison with old patterns: http://msdn.microsoft.com/en-us/library/jj152938.aspx
* Comparison with old patterns: http://msdn.microsoft.com/en-us/library/jj152938.aspx
,NET timers
Comparisons: http://msdn.microsoft.com/en-us/magazine/cc164015.aspx
Note that System.Timers.Timer and System.Threading.Timer by default call your timer event handler on a worker thread obtained from the common language runtime (CLR) thread pool.
Note that System.Timers.Timer and System.Threading.Timer by default call your timer event handler on a worker thread obtained from the common language runtime (CLR) thread pool.
System.Windows.Forms | System.Timers | System.Threading | |
---|---|---|---|
Timer event runs on what thread? | UI thread | UI or worker thread | Worker thread |
Instances are thread safe? | No | Yes | No |
Familiar/intuitive object model? | Yes | Yes | No |
Requires Windows Forms? | Yes | No | No |
Metronome-quality beat? | No | Yes* | Yes* |
Timer event supports state object? | No | No | Yes |
Initial timer event can be scheduled? | No | No | Yes |
Class supports inheritance? | Yes | Yes | No |
* Depending on the availability of system resources (for example, worker threads) |
Monday, September 24, 2012
WebGL
Model-View-Projection Matrices
- Model maps object coordinate to world coordinate
- View maps world coordinate to camera coordinate
- Projection maps camera coordinate to screen coordinate
Monday, September 10, 2012
Single Sign-On
How to configure IIS7 and IE for Single Sign-On using Windows Authentication: http://support.etouch.net/cm/wiki/?id=78151
Thursday, September 6, 2012
WebSocket
- Node.js and WebSocket
- http://socket.io
- http://martinsikora.com/nodejs-and-websocket-simple-chat-tutorial
- http://www.nodebeginner.org/
- WebApp framework for node js http://expressjs.com/
- Is binary transferable using websocket?
- What happen if a connection is disrupted ?
- Need to handle manually, see http://stackoverflow.com/questions/3780511/reconnection-of-client-when-server-reboots-in-websocket
- Socket.IO seems to have this supported
- How can I simulate disconnected connection for unit test
- Difficult but doable, see http://stackoverflow.com/questions/7268419/how-can-i-kill-a-websocket-connection?rq=1
- How about Proxy ?
- Good question ...
Thursday, August 9, 2012
Wednesday, August 8, 2012
Wednesday, July 25, 2012
Friday, July 20, 2012
Cookies
How to detect cookie in Javascript
http://stackoverflow.com/questions/8112634/jquery-detecting-cookies-enabled
Delete cookie for a specific site by clicking bookmark
http://labnol.blogspot.jp/2006/12/how-to-delete-browser-cookies-of-any.html
Cross-domain communication, 3rd party cookie problems:
- http://vimeo.com/24705559, options:
- PostMessage
- JSONP
- CORS Cross Origin Resource Sharing
- Document.domain Hacks
- Window.name Hacks
- IFrame Hacks
Creating P3P compact policy:
- http://blog.sweetxml.org/2007/10/minimal-p3p-compact-policy-suggestion.html
- http://stackoverflow.com/questions/5774014/iframe-cant-read-nor-set-cookies
- http://viralpatel.net/blogs/how-to-set-third-party-cookies-with-iframe/
http://stackoverflow.com/questions/8112634/jquery-detecting-cookies-enabled
Delete cookie for a specific site by clicking bookmark
http://labnol.blogspot.jp/2006/12/how-to-delete-browser-cookies-of-any.html
Cross-domain communication, 3rd party cookie problems:
- http://vimeo.com/24705559, options:
- PostMessage
- JSONP
- CORS Cross Origin Resource Sharing
- Document.domain Hacks
- Window.name Hacks
- IFrame Hacks
Creating P3P compact policy:
- http://blog.sweetxml.org/2007/10/minimal-p3p-compact-policy-suggestion.html
- http://stackoverflow.com/questions/5774014/iframe-cant-read-nor-set-cookies
- http://viralpatel.net/blogs/how-to-set-third-party-cookies-with-iframe/
Thursday, July 5, 2012
Monday, July 2, 2012
Uploading files to Web server
Using ASP.NET MVC
* (Only available from .NET 4.0) http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx
* http://stackoverflow.com/questions/569565/uploading-files-in-asp-net-without-using-the-fileupload-server-control
* (Only available from .NET 4.0) http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx
* http://stackoverflow.com/questions/569565/uploading-files-in-asp-net-without-using-the-fileupload-server-control
Localization/Globalization
How to make ASP.NET to follow client's language:
http://www.hanselman.com/blog/GlobalizationInternationalizationAndLocalizationInASPNETMVC3JavaScriptAndJQueryPart1.aspx
http://www.hanselman.com/blog/GlobalizationInternationalizationAndLocalizationInASPNETMVC3JavaScriptAndJQueryPart1.aspx
Friday, June 29, 2012
IE Stack Overflow at location 0
In-depth analysis
http://cappuccino.org/discuss/2010/03/01/internet-explorer-global-variables-and-stack-overflows/
http://www.nczonline.net/blog/2009/05/19/javascript-stack-overflow-error/
http://stackoverflow.com/questions/1288962/ie8-native-json-parse-bug-causes-stack-overflow
Need to use settimeout ?
http://creatorish.com/weblog/323
https://github.com/stamen/modestmaps-js/commit/c202b0a274f4235c4ebd8362fff11d88a2c0fc8f
Stack trace tool
https://github.com/eriwen/javascript-stacktrace
http://web.archive.org/web/20100813232637/http://blog.yoursway.com/2009/07/3-painful-ways-to-obtain-stack-trace-in.html
http://stackoverflow.com/questions/1502765/javascript-stack-trace-in-ie-or-maybe-just-a-simple-javascript-error
http://cappuccino.org/discuss/2010/03/01/internet-explorer-global-variables-and-stack-overflows/
http://www.nczonline.net/blog/2009/05/19/javascript-stack-overflow-error/
http://stackoverflow.com/questions/1288962/ie8-native-json-parse-bug-causes-stack-overflow
Need to use settimeout ?
http://creatorish.com/weblog/323
https://github.com/stamen/modestmaps-js/commit/c202b0a274f4235c4ebd8362fff11d88a2c0fc8f
Stack trace tool
https://github.com/eriwen/javascript-stacktrace
http://web.archive.org/web/20100813232637/http://blog.yoursway.com/2009/07/3-painful-ways-to-obtain-stack-trace-in.html
http://stackoverflow.com/questions/1502765/javascript-stack-trace-in-ie-or-maybe-just-a-simple-javascript-error
Wednesday, June 20, 2012
ASP.NET background thread
http://haacked.com/archive/2011/10/16/the-dangers-of-implementing-recurring-background-tasks-in-asp-net.aspx
http://blogs.msdn.com/b/tmarq/archive/2010/04/14/performing-asynchronous-work-or-tasks-in-asp-net-applications.aspx
In v4.0 ASP.NET, we won’t unload the AppDomain until all requests have completed. In v2.0/3.5 ASP.NET in IIS 7 integrated mode, we also won’t unload the AppDomain until all the requests have completed. In v2.0/3.5 classic mode, we will only wait until httpRuntime/shutdownTimeout has been exceeded before unloading the AppDomain, so long running async requests are vulnerable to being rudely aborted. To work around this, you’d want the shutdownTimeout to be sufficiently long.
http://blogs.msdn.com/b/tmarq/archive/2010/04/14/performing-asynchronous-work-or-tasks-in-asp-net-applications.aspx
In v4.0 ASP.NET, we won’t unload the AppDomain until all requests have completed. In v2.0/3.5 ASP.NET in IIS 7 integrated mode, we also won’t unload the AppDomain until all the requests have completed. In v2.0/3.5 classic mode, we will only wait until httpRuntime/shutdownTimeout has been exceeded before unloading the AppDomain, so long running async requests are vulnerable to being rudely aborted. To work around this, you’d want the shutdownTimeout to be sufficiently long.
Monday, May 28, 2012
Ubuntu
Installing Ubuntu onVmware Player on Windows 7 http://www.howtogeek.com/howto/11287/how-to-run-ubuntu-in-windows-7-with-vmware-player/
Thursday, May 10, 2012
Monday, May 7, 2012
Wednesday, April 25, 2012
How to remove incomplete uninstalled package
Use msizap.exe T ___.msi
See http://www.advancedinstaller.com/user-guide/qa-forced-uninstall.html
Wednesday, February 29, 2012
Thursday, February 23, 2012
Forcing Windows 7 to connect to SAMBA using old authentication method
For Windows 7 Pro
For Windows 7 Home
- Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LsaCreate a new DWORD value with the following properties: NAME: LmCompatibilityLevel VALUE: 1
- from the run command or from a cmd window run secpol.msc
- go to “Local Policies” -> “Security Options” -> “Network Security: LAN Manager authentication level”
- change to “LM and NTLM – use NTLMV2 session security if negotiated”
- Press the OK button
For Windows 7 Home
- Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LsaCreate a new DWORD value with the following properties: NAME: LmCompatibilityLevel VALUE: 1
Tuesday, January 24, 2012
Saturday, January 21, 2012
Friday, January 13, 2012
Regex
Regex info: http://www.regular-expressions.info/
- Basic ref: http://www.regular-expressions.info/reference.html
- Advance ref: http://www.regular-expressions.info/refadv.html
Email regex ? http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
- Basic ref: http://www.regular-expressions.info/reference.html
- Advance ref: http://www.regular-expressions.info/refadv.html
Email regex ? http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html