|
NOTE PAGES*
Sql Server: Filtering based on given number of
days prior today
Escape Characters Microsoft Access
Escape Characters MS Access
Escape Characters VBA
Escape Ampersand VBA
Escaping Ampersand VBA
Escape Ampersand C# ASP.NET
Escaping Ampersand C# ASP.NET
Ampersand Escape Character VBA
Ampersand Escape Character MS Access
Escape & Microsoft Access
Escape & MS Access
| Microsoft Access Visual Basic for Applications uses a
doubling of the ampersand to escape it for use in Labels, etc. Such as
&& in design view, gives you
& in Report
view
You'd think one could find this info easily at MSDN wouldn't you? Thank
goodness for google.
|
Nonbreaking Space C# ASP.NET (more)
Nonbreaking LineBreak C# ASP.NET (more)
Ampersand C# ASP.NET (more)
More Escape Sequences C# ASP.NET (more)
[C#]
use such as: \u0022 (for double quote)
EscapeSequence:
\ b /* \u0008: backspace BS */
\ t /* \u0009: horizontal tab HT */
\ n /* \u000a: linefeed LF */
\ f /* \u000c: form feed FF */
\ r /* \u000d: carriage return CR */
\ " /* \u0022: double quote " */
\ ' /* \u0027: single quote ' */
\ \ /* \u005c: backslash \ */
OctalEscape /* \u0000 to \u00ff: from
octal value */ |
Changing normal.dot
File/Page Setup
Click the 'Default' button to be given opportunity to use the current document
as the new 'normal.dot' in Microsoft Word.
Yes, I know. It makes no sense
at all to have 'Default' refer to "changing" the default, but that's how it
works.
Secret Code
[C#]
<asp:TemplateColumn HeaderText="Photo">
<ItemTemplate>
<font face="Arial" size="1"><p align="right"
<b>
<a target="_top" href="getHorseAutoPhotoListing.aspx?RecHld=
<%# DataBinder.Eval(Container.DataItem, "HorseID") %>">
<img src="getHorsePhoto.aspx?HorseID=
<%# DataBinder.Eval(Container.DataItem, "RecHld") %>" border="1"
height="55"
</a>
</b>
</font>
</ItemTemplate>
</asp:TemplateColumn> |
Although there is an obvious and
glaring error, this is what it took to both display a SQL Server image, then
align it to the right. However, it doesn't matter how you say it: Storing images
in SQL Server, using SQL Server to store images, using SQL Server to
display images, databinding images with ASP.NET and SQL Server, or browsing web
enabled database images with ASP.NET and SQL Server, this little trick took a
long fucking time to find, then futz into working order.
BTW: the mistake is that <p align="right" is not closed with an /p tag,
nor (as of 09/28/05) have I found any authority that would say the syntax is
correct, but this is the only way I could get it to work??! Of course, none of
this makes any sense whatsoever out of context, and without viewing the "getHorsePhoto.aspx"
code behind, but the results can be viewed at:
http://www.equipoise.com/search/select/getHorseAuto.aspx
Endico
Scan/Print Procedures
Pre-press scan and prep submittal process for
print service providers - Endico haute conduite watercolors.
Web Enabled Database Test
04/27/05: updated "Page" directive
in all non-forms aspx files to:
<%@Page Language="c#"
Debug="False" EnableSessionState="False" %>
per: asp.netPRO Magazine
May 2005, p. 19
re: tuning performance by disabling the default Session State
Manager where not needed
K4 Bogus Hit Counter
MDAC 2.8 download: Developers (not casual users), unless you update all your computers with this Microsoft
download you are going to have immense trouble getting your data connections to
work with any reliability.
Ports
Windows Server Port Requirements
Microsoft download site listing of
default port usage in Excel spreadsheet format.
Unicode
http://www.unicode.org/
Legend
The following table indicates
which modifiers are indicated by Icons found on the
MSDN Library.
|
public method |
|
static |
|
protected method |
|
public property |
|
protected property |
|
public event |
C# Best Practices
UTF-8 encoding provides best
portability for source text files
World's Simplest C# Program (aka: Simple C# Programming
Guide)
Here is the world's simplest C# program.
[C#]
class Simplest
{
static void Main()
{
System.Console.WriteLine("namespace.class.method");
}
} |
Just copy/paste the above text, beginning with the
word 'class' to and including the final '}' into a pure text file (using
Notepad set the "Save as type:" to "All Files" and set "Encoding" to UTF-8),
then save it with a name of your choosing to compile. Information about compiling from the command prompt is found in:
Liberty, Jesse. Learning C#. Cambridge:
O'Reilly, 2002., pp. 8-9.
Be aware the figure '[C#]' above is not part of
the program but merely points out that the language is C#. You will find this is
a standard convention used to present code
examples online.
Unfortunately a large number of published examples,
such as the one that the above snippet was abstracted from, lead to confusion by including extraneous code in order to allow for expansion
later in the text. The original Liberty example (p. 4), which the above code is
based on, adds a namespace definition that is not
required for the code to run. The code above has been simplified from the Liberty
snippet to assure the true essence of C# stands out.
Another example of such misdirection can be found
in:Cooper, James W. C# Design
Patterns: A Tutorial. Boston: Addison-Wesley, 2003., p. 17
Point number 2 states:
The program starts from a function called Main, and it must have
exactly the following form.
static void Main(string[] args)
Of course my "World's Simplest C# Code"
proves that 'string[] args' is not necessary, and also reveals the italics
used for 'exactly' is an overstatement of misguidance.
If you are working your way through Liberty, be
aware that there are numerous such errors and misdirections. For example, page
17 shows a use of the keyword 'private' which is not possible in the position
shown. Also 'string' (a
C# keyword) is capitalized
by mistake. The VS.NET IDE
catches the first mistake, while the second one is allowed inside the IDE but
does not work if coded, compiled and run outside it.
In a French version of an O'Reilly book, I found a
dubious procedure given as a coding example. It's on page 4 of:
Drayton, Peter, Ben Albahari, and Ted Neward. C#: Précis & Concis.
Trans. Yannick Aristidi. Paris: O'Reilly, 2002.
In any case the code example above is the simplest
possible functional program that can be written using C# and the .NET Framework.
Beginning with the line "class Simplest," each element is absolutely necessary
for the code to run.
However, you can change two of the elements to
suit your taste.
The word "Simplest" is just the name that I gave
it. Plus it is capitalized only because that is a standard convention for words
in that place. You might want to call it "tiny" or "Genius" or "pure," whatever
pleases you. The words 'namespace.class.method' can also be anything you want—from
"a" to 新年好 or anything in between, plus the dots (.) are not required. Using the
string 'namespace.class.method' was done here to make the result of running the code somewhat instructive.
The instructive aspect is that the result that is written to your screen shows
the keywords for the first two positions of the previous code statement with the
name of the structural unit for the last position. That is to say 'System' is the namespace,
'Console' is the class, 'WriteLine' is the method. Be mindful that the statement
'System.Console.WriteLine' does in fact require the dots (.) plus
the capitalization, but the characters within the double quotations
("namespace.class.method") can be any.
For more about defining the basic C# language
constituents see: C#
Morphology.
NOT PSEUDO-CODE
Below are two snippets of code that appeared to be pseudo-code on first glance,
but in fact (taken together) they compile, run perfectly, and provide incredible insight into
the inner workings of C#.
Copy/Paste, Save and Compile both snippets
using the simple directions following them.
| [C#]
using System;
namespace Acme.Collections
{
public class Stack
{
Entry top;
public void Push(object
data) {
top = new Entry(top, data);
}
public object Pop() {
if (top == null) throw
new InvalidOperationException();
object result = top.data;
top = top.next;
return result;
}
class Entry {
public Entry next;
public object data;
public Entry(Entry next, object data) {
this.next = next;
this.data = data;
}
}
}
} |
| [C#]
using System;
using Acme.Collections;
class Test
{
static void Main() {
Stack s = new Stack();
s.Push(1);
s.Push(10);
s.Push(100);
Console.WriteLine(s.Pop());
Console.WriteLine(s.Pop());
Console.WriteLine(s.Pop());
}
} |
Copy paste the text beginning with the "using System;" line into a
Notepad document, then save as a plain text file. Name the first snippet
"acme.cs" and compile it thus:
csc /t:library acme.cs
Name the second snippet "test.cs" and compile it thus:
csc /r:acme.dll test.cs
You do not even need to type the csc commands. Highlight and copy each
from this page, then right click your DOS compiler's top border and choose
"Edit/Paste."
The first snippet will be compiled to "acme.dll" while the second will be
compiled to "test.exe" which may be run from the command line.
This example comes from:
Hejlsberg, Anders, Scott Wiltamuth, and Peter Golde. "The C#
Programming Language". Boston: Addison-Wesley, 2004. ISBN: 0-321-15491-6
(pp. 5-6)
Buy the book.
Online this book exists as an
English Version, a
French Version, a
German Version, an
Italian Version, and a
Spanish Version
among others (probably), but much of the helpful elaboration found in the
hardcopy
English version of the book is missing.
For leads to more languages see
MSDN
Worldwide.
I wish the Hejlsberg book had been available when I started
studying C#.
It would have saved me a lot of effort when putting together my C#
Morphology.
Displaying Microsoft SQL Server
Images with C# and ASP.NET
Here it is, clear and simple. See
the Online links below. You will have to know a little bit about C#.
Then you can just copy paste the
code samples into NotePad, save each page as a text file with the suggested
names into any web folder, set up a SQL table as indicated, alter your NotePad
copies of the code's SQL connection strings to match your own server address,
user id (user name), password, and the name of your database where you put the
new table. Afterwards open the aspx pages in your browser. The code works.
Please use online version.
If unavailable, this
archive version has been maintained in case online resource disappears.
The only thing I don't like about the
superdotnet.com site, where these articles come from, is the anonymity of the
writers. I can deal with the flashing pop-ups and banners, since the quality of
information is so high, but I would like to know who (not what) to credit.
However, this bit of information about viewing
images in a SQL Server database is certainly worth the trouble and also seems to
be something that should be addressed in every book about the subject of C#,
ASP.NET, and web enabled databases. It isn't.
Here is a link to a database that works the way it
should. It has simple controls and fast returns from 4341 files. Unfortunately
it is not done with SQL Server but with FileMakerPro, or so I gather from the
URLs that always mention "FMPro":
Botanical Image Database,
University of Basel.
Circular Logic Oddity
In C# a class may sometimes call itself, from
within itself with no ill effects.
This next snippet of code points out an illogical
aspect of C# programming. This code runs without incident, but the logic implies
an infinite loop could result.
[C#]
using System;
namespace StaticTester
{
class Tester
{
public void Run()
{
Console.WriteLine("Hellow World!");
}
static void Main()
{
Tester t = new Tester();
t.Run();
}
}
} |
From inside the class Tester, Main() instantiates
a new instance of class Tester which would logically also call its own instance
of Main() which in turn would instantiate a new Tester(), again, again, and
again. However, this does not happen. The code runs, and C# has taken care of
another problem for you.
The snippet above was simplified by removing the
comment lines from an example in:
Liberty, Jesse. Learning C#. Cambridge:
O'Reilly, 2002., pp. 105-6.
Time Stamp C# ASP.NET
06/27/03: VS .NET does not provide a simple TimeStamp in the
manner of FrontPage, a
Google search found a snippet of code
on the
Visual Studio Magazine Site that did the trick. However the VS.NET IDE makes
using this code a complex issue. So...
10/05/03: A better solution to the Time Stamp problem
was found in
"Beginning ASP.NET with C#," Goode et al., p. 50, but an even more trivial
answer was derived by simply trying a variation on the code sample given in the
book. Here's my variation:
[C#]
time.Text = DateTime.Now.ToString();
<asp:label id="time" runat="server"/> |
Place the first line in your C# <script> block and the second
line anywhere in your html that you wish the time stamp to appear.
Note: The
"[C#]" comment is merely a convention to indicate the programming language used. It is not part of the code.
BTW: If you want more than one Time Stamp on a page, you must copy both lines
with a new id, such as "time2.Text" for the first line and "label id=time2" for
the second.
See also
HOWTO: Prevent Caching in Internet Explorer, a microsoft.com article that addresses keeping pages
current, or you may View/Source on this page and check out the headers .
VS.NET
Logical placement of created files for New
Projects:
1) in IIS MMC create virtual directory using
proposed project name (e.g., myName)
2) create project (myName) in VS allowing
localhost location
3) myName.sln & myName.sou files will be
automatically placed in new browsable localhost folder (myName) while remaining
VS files will be placed in physical location of your pre-named (myName) virtual
directory
In addition to the *.sln and *.sou files mentioned
in item 3 above that are placed in the browsable localhost root directory, for
New Projects VS creates and automatically places default files in the physical
location of your named (myName) virtual directory. These files are:
[bin] (empty folder)
AssemblyInfo.cs
Global.asax
Global.asax.cs
Global.asax.resx
Web.config
WebForm1.aspx
WebForm1.aspx.cs
WebForm1.aspx.resx
myName.csproj
myName.csproj.webinfo
myName.vsdisco
However, only the following files are viewed in
Solution Explorer from within VS:
AssemblyInfo.cs
Global.asax
Web.config
WebForm1.aspx
WhatIsWhere4.vsdisco
the remaining *.cs files are available through
context sensitive clicking "View Code" links such as "WebForm1.aspx.cs" displays
when clicking "View Code" (F7) while focus is on WebForm1.aspx.
ASP.NET
For coding aspx (web pages) 'Page_Load()' is
essentially equivalent in usage to the code blocks with ID 'Main()' used in
Console and Windows Applications. The server will begin with the "Page_Load()"
code block, and if the ID (Page_Load) is misspelled the C# code will be
broken—even though the remaining html will display normally.
Pages 39 & 55 of Goode et al. 2003 shows folder
permissions set to: "Scripts and Executables" when, in fact, "Scripts Only" is
all that is necessary. Furthermore, if set as shown, Front Page will refuse to
allow publication of files stating "/" is and executable directory and
downloading files is not permitted.
Per Goode et al. 2003 p. 29: using "127.0.0.1" is synonymous with "localhost"
in the context of "http://localhost/"; but, oddly, on my
computer "127.0.01" and "127.001" functions in the same way. Otherwise, "127001"
is refused as would be expected.
Files Downloaded for
Academic Archive†
Natural vs. Programming Languages
Chat re:
Port 80
blocked (chat file found re: Optimum blocking Port 80)
06/09/03: After much confusion regarding
inability to serve web pages from home, found the chat room thread linked above using
Google search: "optimum
online" "blocking port 80"; reassigned links and server to Port 9003 per
IAIA
statement that 9003 is "Unassigned."
For assistance checking connectivity and working through the
Port 80 problem thanks to: Katherine
Doob, Ian Duke, Katherine Endico, Rob Fichter,
John Mitchell.
Time Stamp C#: Visual Studio Magazine article (find code at "see
Listing 1") Reading Notes††
Kennedy, 1998
Archival Copy of early
KeyTap®
Following are links outlining
early KeyTap, and my involvement in the Sugar Loaf Community.
First is a description of
Sugar Loaf circa
1996 that is abstracted from the KeyTap web site. Second is a pdf copy of
the document
that offered free membership to the
Sugar Loaf Guild in June of 1997. This document describes
benefits and services, offered at no charge, for artisans living and working in
the hamlet. Third is a link to the full
early KeyTap site with its
sub-links to other aggregations such as the sites of members of the
Artisan's of Sugar Loaf
that resulted from the KeyTap offer.
Brief
History of Sugar Loaf Guild
This link opens a brief
description of Sugar Loaf village of Artisans at the time the invitation to join
the Sugar Loaf Guild (see link below) was presented to the various organizations
within the community.
[pdf] Invitation to Sugar
Loaf Guild Membership (June 1997/92 kb)
This is a PDF copy of the original document that offered
free membership and outlined the benefits of joining the Sugar Loaf Guild.
Unfortunately the Internet
plus electronic tracking/communications in general were new concepts and not well
understood, so a standard response was, "Ok...but what's in it
for us?" Yes, I was as shocked as you.
Despite the lack of understanding I kept the offer open, in conjunction with the
Artisans of Sugar Loaf (a committee of the Sugar Loaf Foundation),
for the next four years hoping enough people would come online to see what this
computer stuff was all about. They may get here someday yet.
For a time KeyTap also hosted
gratis the official web site for the Town of Chester, NY. That site never
achieved actual content due to an aggressive proactive stance on the part of the
Town Board and other local government agencies to "hide all information possible
from the public." But that is another story and one I didn't quite understand at
the time, even though I served eight years on the Planning Board. Here's the
brief.
One person who was supposed to be
one of my liaisons was subsequently convicted of embezzlement, plus another was
removed from their position by the Department of Environmental Conservation.
Those events define the tip of a very deep iceberg which was itself not even slightly
thawed by the heat directed on it. I personally considered my last official duty
as Planning Board member to be the 2 hours and 45 minutes spent in a private
meeting with an FBI agent, handing over a wealth of information I gathered and
begging for something to be done. Those events gave me a refined sense of how it
comes about that some people may find it necessary to fly big jets into tall
buildings. I absolutely do not condone such action, but I sure do understand it.
KeyTap®
Early Years
When following this link, be aware that
a unique use of straight HTML, plus a clever use of directory naming conventions
extended from DNS
functions available at the time (1996), combined in a way that allowed each site of the Sugar Loaf Guild
Members and Artisans of Sugar Loaf to function discretely, separating
each individual site from
from all others as well as the remaining KeyTap
content. At the same time the whole of KeyTap was easily browsed from a central
aggregation on three levels. Individual sites were named for easy typing,
because domain names were expensive, but subdirectories were free.
Early KeyTap presaged Internet
portals, but it went a step further by providing mediation. It remains a glimpse
at the good that may come.
this page was last updated:
07/31/2007 01:41:24 AM
|