May 2004 - Posts
I've recently taken on the development of the ASPAlliance.com site along with RegexLib.com and a few other smaller sites on the side; this has led to a large TODO: list. I've been keeping track of my TODO's on various medium - primarily in OutlookExpress. This morning I had a brainwave... why not use the IssueTracker starter kit!
http://www.asp.net/Default.aspx?tabindex=9&tabid=47
I already had the installer for it so I re-installed it and fired it up. By the time I arrived at work (on the bus) I had already created 3 projects and had about 20 or so issues assinged to them. I had also added a few new features, here's my IssueTracker enhancements for the day:
|
Add a SelectedIndexChanged handler to the Project control on the IssueList page |
Issue Tracker |
New Features |
Darren Neimke |
|
| |
Display custom fields in IssueList. |
Issue Tracker |
New Features |
Darren Neimke |
|
| |
Set defaults for Project Items |
Issue Tracker |
New Features |
Darren Neimke |
|
| |
Show Issues for all Projects |
Issue Tracker |
New Features |
Darren Neimke |
|
Today I had a request regarding the ContextMenu. The person wanted to know how to change the text appearance when the user moves their mouse over a menu item. Each MenuItem item is rendered inside a DIV as text, here is the code for emitting a MenuItem:
var s = "<div class=\"MarkItUp_ContextMenu_MenuItemBar MarkItUp_ContextMenu_MenuItem\" "
+ " onClick=\"javascript: MarkItUp_ContextMenu_HandleItemClick( this, " + delegateFunction + ", '"
+ this.Menu.LinkArgument + splitChars + this.CommandArgument + "' ) ; "
+ " event.cancelBubble = true ; \""
+ " onMouseOut=\"javascript: MarkItUp_ContextMenu_MenuItemOver(this, 'out') ; "
+ " document.onmousedown = MarkItUp_ContextMenu_HandleDocumentClick ;\" "
+ " onMouseOver=\"javascript: MarkItUp_ContextMenu_MenuItemOver(this, 'over') ; "
+ " document.onmousedown = null;\""
+ ">" + this.DisplayName + "</div>" ;
... as you can see, there is a handler hooked up to the onMouseOver and onMouseOut events of the DIV. That handler is contained in the .js file which comes with the project and contains the following code:
function MarkItUp_ContextMenu_MenuItemOver( e, dir )
{
if(dir == "over" )
e.className = "MarkItUp_ContextMenu_MenuItemBar_Over MarkItUp_ContextMenu_MenuItem_Over" ;
else
e.className = "MarkItUp_ContextMenu_MenuItemBar MarkItUp_ContextMenu_MenuItem" ;
}
Therefore, to affect the text on a mouseover, you can simply change the styles in the MarkItUp_ContextMenu_MenuItem_Over class definition.
I read Frank's post today -
http://weblogs.asp.net/frankarr/archive/2004/05/24/140951.aspx - and when I got home I discovered that my package has already arrived! As Frank said... Woohoo! :-)
Mark posted a nice article titled: "Maths Beginnings" which encapsulates and builds on some of the stuff which he and I were tossing around in e-mails the other day:
http://zhurnal.net/ww/zw?GatewaysToMathematics
Yesterday I mentioned the series of articles which Justin has been writing on language processing. This series has really opened my eyes to a few techniques which will improve several of my parsing techniques and provide me with the ability to produce high-performance language parsers in a shorter period of time.
Firstly, Justin introduced a basic lexer which will tokenize a source input into a fairly generic array of tokens. He then implemented several enumerator classes to read through a token stream and return application specific, typed tokens. Moving forward these 2 objects will be the staple items of all my future language processors; the lexer probably wouldn't change much and the enumerator would only require a minor alteration to the kinds of typed tokens which it returns.
By the time you get to writing a parser you already have all of the common functions for reading and moving through input stored away in these 2 classes allowing you to focus on implementing the grammar parsing and state transition algorithms without having to bother with the plumbing. The added bonus is that, while the common plumbing functionality - such as ReadNextChar(), IsSpecialChar() and IsEndOfStream() - are monotonous they are undoubtedly a potential source of errors; having common classes to carry forward (the lexer and enumerator classes) means that future parsers are working atop tested code, thus eliminating those silly errors - such as "out by one's" and stuff.
My key learnings to this point have been:
- Lexing into tokens simplifies the amount of parsing logic
- Implementing the enumerator pattern is an elegant way of reading through an input stream
- Separating the functions of language processing can improve performance, re-use, maintainability and performance
I'm still working through some of the more recent articles which deal with state transition graphs, state machine algorithms and recursive descent, top down parsing. I'll post another summary about the learnings and cool features of this stuff when I've covered it well enough.
There's a pile of stuff sitting on my desk at the moment which absolutely *must* get blogged - RedGate software, creating detailed architecture documentation, music, maths and language processing... alas time is short and life is juicy!
For now I should at least mention the great work which Justin has been doing with his series on language processors/compilers. In his latest installment he offers some code samples to help me with mark-up processing:
http://weblogs.asp.net/Justin_Rogers/archive/2004/05/20/135667.aspx
If you are at all interesting in language processing, lexing, parsing, etc. then I'd highly recommend Justin's series. You can view all articles in the series here:
http://weblogs.asp.net/justin_rogers/category/4927.aspx
The 4 most important articles are:
http://weblogs.asp.net/justin_rogers/archive/2004/05/15/132693.aspx
The lexer, more compact, and some test code.
http://weblogs.asp.net/justin_rogers/archive/2004/05/16/132974.aspx
Examining state/transition graphing to extend BasicParse (or rather rewrite it)
http://weblogs.asp.net/justin_rogers/archive/2004/05/18/133874.aspx
Introducing symbol tables with a C# example using 'get' as the point of interest.
http://weblogs.asp.net/justin_rogers/archive/2004/05/20/135667.aspx
How hard/easy is an HTML parser using the BasicLex/BasicParser design?
Thanks Justin!
Following on from my post the other day regarding Maths, I've had a couple of revelations...
First, I've decided that my medium term goal is to gain a decent understanding of Set theory.
Second, I've found a site which provides a way to navigate down the branches of Mathematics:
http://hyperphysics.phy-astr.gsu.edu/hbase/hmat.html#hmath
So, given that I know I need strong algebra skills to understand set theory I can use that page to drill down on the various streams of algebra theory. That would ultimately lead me down to the Golden Rule of algebra!
http://hyperphysics.phy-astr.gsu.edu/hbase/alg2.html#ag
I also found this interesting article on the history of set theory:
http://www-gap.dcs.st-and.ac.uk/%7Ehistory/HistTopics/Beginnings_of_set_theory.html
Which I got to from this superset of higher level links:
http://www.harcourtcanada.com/school/math/geometry/links.htm
I sent some correspondance to an online friend the other day whom I know is a dabbler in many intellectual pursuits. I wrote to him because I've started to get interested in learning mathematics - I have to admit that I'm a dummy at maths. I'm quite good with numbers and simple creative numerical analysis but, when it comes to some of those "math sciences" I have no idea. What I wanted to know is... Is Mathematics similar to computer programming languages?
He returned my correspondance with some useful pointers as to where I might head to find out more about maths and also chimed in with a listing of some of the different streams of maths:
number theory ... probability and statistics ... complex analysis ... calculus and differential equations ... game theory ... real analysis ... cellular automata ... set theory ... logic ... numerical methods ... combinatorics ... geometry ...
The problem with Maths is that it seems so damned big! Surely maths is like learning a massive programming language - you learn the keywords, the syntax, the loops and conditionals, variable usage, and the common algorithms. In fact, I also imagine that the different Math streams which I've shown above could probably be compared to different streams of programming within a language...
database programming ... game programming ... windows applications ... web applications ... framework building ...
Each particular stream has it's own "objects" and terminology but each one uses the core features of the language and "the framework" to solve different problems."
I guess the trick to learning Maths is that, like programming, you need to know where to start. Let's see, I can count... I know my simple times tables... I sorta remember long division and Pythagoras' theorem; hrmmmm let's see I think that I'll start with set theory!
One of the first .NET tricks I learnt was from IBuySpy; they showed me how I could sneakily use Request.ApplicationPath so that my sites could seamlessly work when I'm developing against different domains (such as Localhost in development). To perform the "trick" you simply prepend <%= Request.ApplicationPath %> to the beginning of any paths in your pages, such as:
<img src='<%= Request.ApplicationPath %>/Images/Foo.gif' ... />
The problem is that, when a file is requested, it is returned "root-relative" without a trailing slash. This means that when a page is requested from the root folder of a Website, Request.ApplicationPath returns '/'. In the above example the following string will be written out:
<img src='//Images/Foo.gif' ... />
This wouldn't be picked up when developing against localhost because the application will be one level under the root of the Website meaning that the virtual directory name will be returned after the slash '/':
<img src='/ApplicationName/Images/Foo.gif' ... />
However, if a page is requested from a page in a sub-folder, then the path is returned as "/FldrName" and the above example will resolve correctly as:
' From the root
<img src='/FldrName/Images/Foo.gif' ... />
' In a virtual directory
<img src='/ApplicationName/FldrName/Images/Foo.gif' ... />
So, is there a single answer for developing on root and virtual directories - I'm not sure. The easiest way is to simply add all of your pages under a sub-folder (which I believe is done in the case of IBuySpy). That's too bad if you've already got a site with all of its pages in the root folder though :(
The other day I was trying to fix a problem on a website. The problem was that, whenever I tried to load a file from the filesystem, I received a NullReferenceException being thrown from "GdipLoadImageFromFile"!
Anyways, I got straight onto Justin Rogers who showed me a hack for fixing the problem - just throw in a line which creates a dummy Bitmap and then continue on. Apparently there's a high probability that GDI+ wasn't being loaded correctly with the simple call to LoadFromFile but, initializing a Bitmap forced it to.
Here's a post from Justin which discusses the problem - and the hack workaround.
http://weblogs.asp.net/justin_rogers/archive/2004/05/13/131664.aspx
More Posts
Next page »