April 28, 2005
Server.Transfer, Caching and Tracing Links
Why Server.Transfer Causes Problems
HOW TO: Prevent Caching of web forms by the browser
ASP.NET Tracing in a Pop-Up Window
April 21, 2005
Using Enumerated Types in C# as Bit Flags
example
[Flags]
public enum Layout : byte //<= specify UNDERLYING type here
{
CentreColumn = 1,
LeftColumn = 2,
RightColumn = 4
}
private Layout m_Layout = Layout.CentreColumn | Layout.LeftColumn | Layout.RightColumn;
...
// USAGE
m_Layout.ToString(); // => Gives "'CentreColumn, LeftColumn, RightColumn'"
// Going the other way
Layout m_Layout = (Layout)Enum.Parse(typeof(Layout), "CentreColumn, LeftColumn");
Layout m_Layout = (Layout)4; // => m_Layout = RightColumn
April 14, 2005
Weblog Sample
Took a closer look at http://www.codeproject.com/soap/weblog.asp. Tested it on my PC and it worked. Had to copy the Weblog project to my Inetpub directory and set it as an web application using the ComputerManager=>Services and Applications=>InternetInformatioServices tool.There are some useful techniques to learn from this sample. The way it uses passwords to access a webservice. I also like the fact that it persists the data direct to an XML file rather than some database.
Managed to get editdvdcollection.aspx to write the updated dvdcollection.xml file correctly. I had to remove the TITLE, DESCRIPTION and LASTUPDATED elements from the COLLECTION node and then just regenerate the xsd. Makes me wonder how the DataSets handle complex XML. What if I kept these elements but put all the ENTRY nodes under a single ENTRIES node could I get the code to work then. I havent got time to investigate this I just want something that works. Next I need to work out how an aspx web page can accessed using only secured (via a password) users. I want access to a web page for everyone but the editing facilities only available to those who are logged on.
When I started writing the Freelancer XSL I got used to the two different forms ways of processing nodes. I like the idea of writing a rule to match a node no matter where it is in the sequence and processing it. However sometimes you want to choose a particular node and ignore all the rest. This is why I had got used to the named template style. When writing xsl decied if all the nodes of a certain type will be output. If so use a rule to match against it, if not the parent node will have to select the interseting node or nodes and invoke a named template on them.
xsl:sort
Learned about using 'xsl:sort'. Its very easy just put it after the for statement. Specify what of part of each node processed by the 'for' dtatement is to provide the basis of the sort.
xsl:import
Got 'xsl:import' to work. Found that unlike the 'xsl:include' it has to be straight after the xsl:stylesheet' definition
Compiling an ASP.NET dll by hand
>csc /t:library /out:bin\dvdcollection.dll /r:System.dll /r:System.Web.dll dvdcollection.aspx.cs
EnableViewState="false"
<%@ Page EnableViewState="false" %> Use this to turn off ViewState in an aspx page. Its not needed unless there are controls in the page.
TechInterviews -
What does the "EnableViewState" property do? Why would I want it on or off?
Enable ViewState turns on the automatic state management feature that enables server controls to re-populate their values on a round trip without requiring you to write any code. This feature is not free however, since the state of a control is passed to and from the server in a hidden form field. You should be aware of when ViewState is helping you and when it is not. For example, if you are binding a control to data on every round trip (as in the datagrid example in tip #4), then you do not need the control to maintain it’s view state, since you will wipe out any re-populated data in any case. ViewState is enabled for all server controls by default. To disable it, set the EnableViewState property of the control to false.
TechInterviews -
What does the "EnableViewState" property do? Why would I want it on or off?
Enable ViewState turns on the automatic state management feature that enables server controls to re-populate their values on a round trip without requiring you to write any code. This feature is not free however, since the state of a control is passed to and from the server in a hidden form field. You should be aware of when ViewState is helping you and when it is not. For example, if you are binding a control to data on every round trip (as in the datagrid example in tip #4), then you do not need the control to maintain it’s view state, since you will wipe out any re-populated data in any case. ViewState is enabled for all server controls by default. To disable it, set the EnableViewState property of the control to false.
RSS Feed Using Asp.Net
http://www.uberasp.net/getarticle.aspx?id=17 - Simple sample Using aspx to write RSS as XML to the client
April 13, 2005
Interesting Links
Discovered some useful links: This one goes over the nuances of Xml Serialization
Code Behind for Web Services. - JIT Compilation is Possible, eg '<%@ WebService language="C#" class="SomeClass" %>' just do not use the Codebehind attribute. In this case the class must exist in the same file
HTML to XML webservice
Code Behind for Web Services. - JIT Compilation is Possible, eg '<%@ WebService language="C#" class="SomeClass" %>' just do not use the Codebehind attribute. In this case the class must exist in the same file
HTML to XML webservice
April 7, 2005
'Assembly src=' Directive
Discovered that can use 'Assembly src=' directive to compile other C# files into a single source file type aspx file. In the main source file you can use classes and types mentioned in the Assembly source file.
http://www.jenitennison.com/cv.xml - CV in XML form, do View Source
http://www.snapfiles.com/opinions/for_abilon.html - A freeware blogging tool
Did some work on the 'EMailMe' project. I put all the code to output the stylesheet partions into a separate class. From the '.apsx' file I use type statements to output the stylesheet html statements. This means that the main block of statements for outputting the page has to be copied to each new web page. This is not perfectly satisfactory but at least the process of setting up the page is semi-automatic. Really should used the 'editdvdcollection' project to test this new code as it uses my standard web-page layout.
Found the location of the IIS compiled web applications. They are at: 'C:\Documents and Settings\\VSWebCache'. Only the Web applications go here.
April 6, 2005
Browser Redirection
Skidoo_too: Use
#innerColumnContainer, #outerColumnContainer { border-left-width: 0; border-right-width: 0;}
to make both left and right hand menus dissappear
The following line cause the browser to redirect to the specified page after 3 seconds:
<meta http-equiv="refresh" content="3;URL=index.html">
April 5, 2005
Codebehind To Inline In Visual Studio
Tried a simple trick. Used Visual Studio to create a dummy web application. Changed the 'Codebehind' directive in the 'Global.asax' and 'WebForm1.aspx' files to 'Src' and the web page would load from IE without any compiling or anything. First off I just copied the 'aspx' and 'aspx.cs' file to another directory and then changed the 'Codebehind' to 'Src' and that worked as well. A simply deploy could just be to copy the files to a target directory and change the 'Codebehind'.
http://www.google.com/search?q=Web+Forms+Code+Model - Web Forms Code Model. Explains COdebehind and the Single file asp.net model
http://www.dotnetjunkies.com/Tutorial/3623050C-B046-4E7B-A2C7-0934F1105312.dcik - The @ Page Directive - Inherits vs.Src vs. Codebehind Codebehind is a Visual Studio attribute not a .NET attribute, it is used to track the class file associated with the form
http://www.wilsondotnet.com/Demos/Generator.aspx - Generates code for a web page
April 4, 2005
Inserting C# into XSL
http://www.aspfree.com/c/a/ASP.NET/Advanced-XSL-Transformations-With-ASP-NET/ - Interesting Article on Performing XSLT tranformations in ASP.NET, in particular how to insert c# code into a XSLT stylesheet
April 3, 2005
Useful CSS Links
http://www.uoguelph.ca/~stuartr/articles/beginnercss.shtml - Good Basic Stylesheet, Try it out
http://webmonkey.wired.com/webmonkey/98/15/index0a.html - Intro to Stylesheets
http://www.mako4css.com/TMat.htm - Good stylesheets intro
http://www.bluerobot.com/web/layouts/ - Basic 2 columnn layout style sheets
http://www.alistapart.com/articles/journey/ - Found the above link here
http://glish.com/css/home.asp - More css layouts without tables
http://www.thenoodleincident.com/tutorials/box_lesson/boxes.html - More layouts horrible colours
http://www.brainjar.com/css/tabs/default3.asp - Excellent use of css to create tabs
http://cssvault.com/2005/02/index.php - Lots of sample css
http://cssvault.com/cat_layouts.phphttp://webhost.bridgew.edu/etribou/layouts/ - More layouts including Skidoo
http://webhost.bridgew.edu/etribou/layouts/2col_footer/index.html - Try this other skidoolayout, on the skidoo site it is 'Two Columns With Footer - v5'
http://www.redmelon.net/tstme/box_model/ - A Graphical Explanation of the CSS Terms (margin, padding, ...). Brilliant!
http://www.brainjar.com/css/positioning/default.asp - Links to the above web page. Another explanation of the CSS model
http://www.colorschemer.com/online.html - Another color scheme generator
http://www.wellstyled.com/css-photo-cards.html - More CSS for a nice photo placement style
http://wellstyled.com/tools/colorscheme2/index-en.html - Tool for web site colour generation
http://interglacial.com/~sburke/stuff/pretty_rss.html - Using both XSL and CSS to style a webpage.
http://www.xml.com/pub/a/2005/01/19/print.html - Why CSS is better for styling documents than XSL
http://www.javascript-page.com/css/step1.shtml - Basic CSS.
CSS Zen Garden - 1000s of CSS Samples based on a specific html page form
CSS PageMaker Template - A website that generates a web page template in CSS format from a set of options. Try the home page as well, theres alot of CSS advice
http://webmonkey.wired.com/webmonkey/98/15/index0a.html - Intro to Stylesheets
http://www.mako4css.com/TMat.htm - Good stylesheets intro
http://www.bluerobot.com/web/layouts/ - Basic 2 columnn layout style sheets
http://www.alistapart.com/articles/journey/ - Found the above link here
http://glish.com/css/home.asp - More css layouts without tables
http://www.thenoodleincident.com/tutorials/box_lesson/boxes.html - More layouts horrible colours
http://www.brainjar.com/css/tabs/default3.asp - Excellent use of css to create tabs
http://cssvault.com/2005/02/index.php - Lots of sample css
http://cssvault.com/cat_layouts.phphttp://webhost.bridgew.edu/etribou/layouts/ - More layouts including Skidoo
http://webhost.bridgew.edu/etribou/layouts/2col_footer/index.html - Try this other skidoolayout, on the skidoo site it is 'Two Columns With Footer - v5'
http://www.redmelon.net/tstme/box_model/ - A Graphical Explanation of the CSS Terms (margin, padding, ...). Brilliant!
http://www.brainjar.com/css/positioning/default.asp - Links to the above web page. Another explanation of the CSS model
http://www.colorschemer.com/online.html - Another color scheme generator
http://www.wellstyled.com/css-photo-cards.html - More CSS for a nice photo placement style
http://wellstyled.com/tools/colorscheme2/index-en.html - Tool for web site colour generation
http://interglacial.com/~sburke/stuff/pretty_rss.html - Using both XSL and CSS to style a webpage.
http://www.xml.com/pub/a/2005/01/19/print.html - Why CSS is better for styling documents than XSL
http://www.javascript-page.com/css/step1.shtml - Basic CSS.
CSS Zen Garden - 1000s of CSS Samples based on a specific html page form
CSS PageMaker Template - A website that generates a web page template in CSS format from a set of options. Try the home page as well, theres alot of CSS advice
April 1, 2005
Interlocked.Exchange Hazard
object box = (object)m_StitchState; System.Threading.Interlocked.Exchange(ref box, (int)StitchState.ImageProcessing); // WILL NOT work.The box copes the value type object into the box, it does not create a reference that points/refers to the location of the original value or at least we cant assume it does.
Subscribe to:
Posts (Atom)