Monday, March 16, 2009
Sunday, March 15, 2009
Microsoft links I have yet to read, but really should...
Using Conditions?
How Do I: Create a Breakpoint Using Hit Count?
How Do I; Learn Tips and Tricks for Debugging in Visual Studio?
Office Development with Visual Studio Developer
Center Just Launched!
Microsoft Cloud Computing Tools
How Do I: Add Tool Windows to the Visual Studio IDE?
How Do I: Add a New Tool Window to Visual Studio?
How Do I: Integrate With the Error List?
How Do I: Create a Basic Language Service Using the Managed Babel System?
How Do I: Create Custom
Project Templates Using Visual Studio 2008?
How Do I: Create an Item Template Using Visual Studio 2008?
How Do I: Write to the Output Window?
Explore the New Features of Visual Studio 2008
How Do I: Create a Debugger Visualizer?
How Do I: Place My Commands Into Different Kinds of Visual Studio Menus?
How Do I: Add Commands
and Controls Into the Visual Studio IDE?
How Do I: Get Started with the VisualStudio Domain Specific Languages?
Heroes Happen Here
DotNetNuke® and Visual Studio 2008
Visual Studio Tip of the Day
How Do I: Add AJAX Functionality to an Existing ASP.NET Page?
How Do I: Debug a Windows Presentation Foundation Application in Visual Studio 2008?
How Do I: Use the LINQ-Enabled
XML API in Visual Studio 2008?
Some bluetooth resources. Rage.
Gizmodo, gadgets and fun in the news...
Friday, March 13, 2009
Tips 'n' Tricks - Null Coalescing Operator
Really we just want to do this:
public class Something
{
private string falafel;
public string GetInfo()
{
return falafel ?? "tabbouleh";
}
}
But then falafel doesn’t get set.
This feels inelegant:
if (falafel == null)
falafel = "tabbouleh";
return falafel;
Luckily, there’s a solution:
return falafel ?? (falafel = "tabbouleh");
This first sets the value of falafel and then returns it.
Wednesday, March 11, 2009
Fun With GridView...
Anwyay, todays subject, minor though it is, is GridView commands...
...I wanted to have a grid with a couple of buttons: Up and Down, as link buttons, to re-order my content without an edit button.
The solution is simple enough:
- Add a Button column to your GridView
- Set it's 'button type' to Link (this is optional really)
- In the GridView's events panel, double-click RowCommand
- In the generated event handler you can place:
switch (e.CommandName) { .... }
Simple really.
Lastly, here's some resources I've been looking at recently:
- http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand.aspx
- http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx
- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ASPNETProvMod_Prt5.asp
- http://www.ondotnet.com/pub/a/dotnet/2005/01/10/liberty.html
- http://www.odetocode.com/Articles/440.aspx
- http://www.asp.net/QuickStart/aspnet/doc/profile/default.aspx
- http://www.theserverside.net/tt/articles/showarticle.tss?id=CreatingProfileProvider
- http://flimflan.com/blog/ProfileView.aspx
- http://weblogs.asp.net/scottgu/archive/2006/01/10/435038.aspx
- http://www.asp.net/sandbox/samp_profiles.aspx?tabindex=0&tabid=1
- http://msdn2.microsoft.com/en-us/library/83y98ckk.aspx
- http://www.google.com/search?hl=en&lr=&q=aspnet_regsql+command-line+utility+&btnG=Search
- http://www.learnvisualstudio.net/
- http://www.asp.net/learn/absolute/default.aspx?tabid=63
- http://www.microsoft.com/uk/msdn/security/link_library.mspx
- http://weblogs.asp.net/scottgu/archive/2006/04/13/Source-Code-for-the-Built_2D00_in-ASP.NET-2.0-Providers-Now-Available-for-Download.aspx
- http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx
Caching and Url Mapping
If you look at the line <%@ OutputCache... in the .aspx files you will see that it is configured to cache the output of that whole page for the value in the Duration attribute. The VaryByParam value indicates that any url parameter will cause the page to be re-generated and cached. Replace the "*" with "none" and the caching will ignore the url params and that page will be cached once for the duration.
The OutputCache can be used in individual user controls as well, however, if the page has a duration of 20 and the control within it has a duration of 10 both will be cached for 20. Reverse those numbers and the page will be cached for 10 but the control will be cached for 20.
Be careful that you don't try to reference in your code a control which may have been cached, as it will come back with a null reference, possibly causing an exception!
One other method of caching is substitution mapping, the drawback being that you can only point this at .net controls, not user controls.
Url Mapping.
Now, go to IIS, create a virtual directory under Default Web Site, point it at the Test solution's directory. Open the Properties panel for the virtual dir. Do the following:
Disable directory browsing.
Under Documents, enable default document and have only 1 default document called default.aspx.
Go back to Virtual Directory, click Configuration, click Add and enter:
1. Executable: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
2. Extension: .*
3. All Verbs
4. Script Engine ticked
5. Check that file exists NOT ticked
6. Click Ok, Click Ok.
Go to ASP.NET tab and ensure the ASP.NET version is 2.0.50727
Click Ok.
Now, when you browse to http://localhost/test/lose/ or http://localhost/test/win/ you should see the page come up which is actually /test/win.aspx or /test/lose.aspx. Hit refresh and you will see the time has not changed, because the page has been cached. The page appears, even though you have entered a directory name, because IIS is automatically adding default.aspx to any requested directory listing and redirecting all file requests to the .net framework. The .net framework is redirecting from ~/win/ or ~/lose/ to ~/win.aspx or ~/lose.aspx because in the web.config you have a UrlMapping block! Easy.
The only problem with this is that you can't use regular expressions to have, for example, ~/search/ipod/ re-mapped to ~/search.aspx?query=ipod which is annoying, but only because the next server version from microsoft will have a fully operational url mapper and they didn't have time to put it into the current release.
Links:
Caching: http://msdn2.microsoft.com/en-us/library/xsbfdd8c.aspx
Substitution mapping: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.substitution(VS.80).aspx
Url Mapping: http://www.developer.com/net/asp/article.php/3581326
MS Blog: http://weblogs.asp.net/scottgu/archive/2005/11/14/430493.aspx
Tuesday, March 10, 2009
Tools List
- http://validator.w3.org/feed/
- Brass - Dynamic
- Windows Enhancement
- Kris' blog - VB.NET & C# comparison cheat sheets
- Fiddler Web Debugger - Freeware HTTP(S) debugging tool
- Time And Date .com
- Recuva - Undelete, Unerase, File Recovery - Builds
- regsitry cleaner
- dale lane » Blog Archive » Twitter for Windows Mobile
- http://aspnetresources.com/tools/keycreator.aspx
- XE.com - The World's Favorite
- Currency Site
- fiddler
- Free Virus Scan - Kaspersky Lab
- Dapper: Feed Generator
- Core Temp
- UNLOCKER 1.8.7 BY CEDRICK 'NITCH' COLLOMB
- Fences™ Community Preview Download - By Stardock - Clean
- up your ...
- Feed
- Validator for Atom and RSS
- http://www.dictionary.com/
- Elias Fotinis DeskPins :: Make Any Window Topmost
- Quick Media
- Converter
- ITUNES TOOLBOX: 30+ Tools For iTunes
- MD5 Generator
- Restoration Freeware download and review - file undeleteutility ...
- home of the nerd cave - Taskbar Shuffle
- http://www.coveritlive.com/index.php
- Say NO to 0870
- reCAPTCHA: Stop
- Spam, Read Books
- Crystal Dew World - Software - CrystalDiskInfo
- Launchy: The Open Source
- Keystroke Launcher
- VB.NET to C# Converter
- Freecorder audio recorder
- Free Online PDF viewer - PdfMeNot.com
- PAYPAL - ipn payment simulator
- MaxiVista - Multi Monitor Software
- YouTube Video Download Tool
- Online free Windows Icon creator
- SandCastle - Code Documentation Generator
- http://www.quickonlinetips.com/archives/2005/03/great-flickr-tools-collection/
- http://www.itagsoftware.com/index.php
- http://www.wingrep.com/download.htm
Rubberduck Debugging
We called it the Rubber Duck method of debugging. It goes like this:
1) Beg, borrow, steal, buy, fabricate or otherwise obtain a rubber duck (bathtub variety)
2) Place rubber duck on desk and inform it you are just going to go over some code with it, if that's all right.
3) Explain to the duck what you code is supposed to do, and then go into detail and explain things line by line
4) At some point you will tell the duck what you are doing next and then realise that that is not in fact what you are actually doing.
The duck will sit there serenely, happy in the knowledge that it has helped you on your way. Works every time. Actually, if you don't have a rubber duck you could at a pinch ask a fellow programmer or engineer to sit in.
Monday, March 09, 2009
ASP.NET Life Cycle Diagram
Creating a certificate in IIS
- IIS Resources Toolkit download: http://www.microsoft.com/downloads/details.aspx?FamilyId=56FC92EE-A71A-4C73-B628-ADE629C89499&displaylang=en
- IIS Resources help page: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/993a8a36-5761-448f-889e-9ae58d072c09.mspx?mfr=true
- Google search for IIS resources information: http://www.google.com/search?hl=en&rlz=1C1CHMB_en-GBGB316GB316&q=iis+resources&btnG=Search
- At a command prompt, switch to the "C:\InetPub\AdminScripts" folder.
- Type the following command:
CSCRIPT ADSUTIL.VBS SET W3SVC/DisableSocketPooling TRUE
C:\>cd InetpubC:\Inetpub>cd AdminScriptsC:\Inetpub\AdminScripts>CSCRIPT ADSUTIL.VBS SET W3SVC/DisableSocketPooling TRUEMicrosoft (R) Windows Script Host Version 5.6Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.DisableSocketPooling : (BOOLEAN) TrueC:\Inetpub\AdminScripts>
Augmented Reality in CSharp
http://www.mperfect.net/wpfAugReal/
- DirectShow API on WikiPedia: http://en.wikipedia.org/wiki/DirectShow
- DirectShow Article at CodeProject: http://www.codeproject.com/KB/directx/directshownet.aspx
- TotalImmersions AR video: http://video.google.com/videoplay?docid=6523761027552517909
- Also, a skeleton C# AR app: http://sites.google.com/site/augmentedrealitytestingsite/
Thursday, March 05, 2009
ASP.NET Globalization, Culture, Localization and the Resource tag
In addition to programmatic access, ASP.NET 2.0 also introduces declarative syntax you can use to bind a named string to a property of a page or control. The syntax involves using the dollar sign ($) followed by the Resources namespace, the name of the resource file and the name of the string:
Wednesday, March 04, 2009
Tweet tweet tweet...
Commerce Server, Afraid to ask?
http://blogs.msdn.com/maxakbar/search.aspx?q=pipeline+afraid&p=1
gacutil exited with error 9009
Tuesday, March 03, 2009
Quake? Online? In a browser window? Nice(?)
http://www.hanselman.com/blog/QuakeLiveReviewAndRantWhyIsThisInteresting.aspx
Thursday, February 19, 2009
Convert byte[] to String
I was going to make one big entry containing lots of little bits of code, then realised I only had one to put in, because I keep forgetting it...
Converting a byte[] (array) into a String:
string outStr = System.Text.Encoding.UTF8.GetString(inByteArr);
Thursday, February 12, 2009
More useful links...
I have posted many links on this blog, for many reasons. I'll now be posting even more. These are useful .NET coding resources which I simply don't want to forget.
TRULY UNDERSTANDING VIEWSTATE:
http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx
TRULY UNDERSTANDING DYNAMIC CONTROLS (PART 1):
http://weblogs.asp.net/infinitiesloop/archive/2006/08/25/TRULY-Understanding-Dynamic-Controls-_2800_Part-1_2900_.aspx
Building Templated Custom ASP.NET Server Controls:
http://msdn.microsoft.com/en-us/library/aa478964.aspx
Developing Custom ASP.NET Server Controls:
http://msdn.microsoft.com/en-us/library/zt27tfhy.aspx
Introducing Commerce Server 2007:
http://www.microsoft.com/commerceserver/default.mspx
Max akbar - For the hardcore Commerce Server Developer... and demystify the product:
http://blogs.msdn.com/maxakbar/
Getting Started with Windows Communication Foundation (WCF):
http://msdn.microsoft.com/en-us/netframework/aa663324.aspx
Windows Presentation Foundation:
http://en.wikipedia.org/wiki/Windows_Presentation_Foundation
Using Bluetooth in .NET:
http://dotnet.org.za/rudi/archive/2007/09/28/using-bluetooth-in-net.aspx
Search JQuery from inside Spotlight:
http://www.appelsiini.net/2009/2/search-jquery-api-docs-from-spotlight
Mozilla's new cloud-based HTML editor:
http://www.readwriteweb.com/archives/bespin_html_editor_cloud.php
Simon Edwards' blog:
http://www.transceiver.co.uk/
Adobe Photoshop Express:
https://www.photoshop.com/express/landing.html
CoolIris media viewer (see top of page):
http://www.cooliris.com/
What annoys you about Windows?:
http://www.annoyances.org/
YouTube tools:
http://www.quickonlinetips.com/archives/2006/10/the-amazing-youtube-tools-collection/