Friday, January 23, 2004
Recusive properties
Look close!
public int CurrentLine
{
get
{
return GetLineFromIndex(caretindex);
}
set
{
if (value < 0)
{
CurrentLine = 0;
}
else if (value < Count)
{
int ci = LineColumnIndex;
CaretIndex = GetCaretIndexFromLine(value);
LineColumnIndex = ci;
}
else
{
CurrentLine = Count - 1;
}
}
}
Saturday, December 13, 2003
Top secret Sneak preview
Sunday, November 30, 2003
A glimpse of things to come
I normally dont do UI's but this came to mind. A decent code highlighter, with dynamic lexer/parser input and many goodies normally found in commercial IDE's.
Saturday, November 29, 2003
Abusing C#
int c = file.ReadByte();
switch (c)
{
case -1:
Console.WriteLine("EOF");
break;
case '\n':
curline++;
curcol = 1;
goto case -2;
case -2: // i will be shot
feed.Append((char) c);
break;
default:
curcol++;
goto case -2;
}
Friday, November 21, 2003
Hooray, it's holiday
Now its time to enjoy those things you never have time for. I love pretty code.
Sunday, October 26, 2003
Monthly Lobster awards
I have decided to make a monthly award for certain developers that can be described as lobsters (think Zoidberg right about now).
Seeing this is the 1st ceremony I have decided to name a few to get things going.
1. Lutz Roeder - does his email even work? does he even read feedback? Not much I guess! And the time I did get a response, he put all the ideas down... see Reflector for a more painfull experience.
2. Werner "I cant say much, I'm under a NDA" Moise - well, well, well, your news is mostly old. You keep argueing without checking your facts. And it is not grammatically correct to start every sentence with 'I'. And repeating your self consistantly makes you look like an idiot. All of us can read.
Gay C# error messages
Overloaded shift operator must have the type of the first operand be the containing type, and the type of the second operand must be int.
Enough said...
Monday, October 13, 2003
Slow times
I have started a new personal project called Xacc. More info can be found at xacc.sourceforge.net. Comments welcome.
Saturday, August 30, 2003
GCC beats MS VC7.1 pants off
I have just finished the lexer/parser part of my project due on Monday. I thought some benchmarking would be nice. What I didnt realize was the advantage GCC has over VC in a C environment. The implementation only makes use of some of the core CRT libraries.
Tuesday, August 26, 2003
My latest invention/contraption/experiment
Sunday, August 24, 2003
#dev 0.96 - TextEditor still junk
Compare this to what I would like to see (below) from a quality perspective. Also, it still takes the memory of a small country (60-80mb) , and I swear I saw the street lites dim when I loaded it.
When things go wrong...
Saturday, August 23, 2003
Dont you love C compiler error messages?
Here's the Error OTD:
error C2064: term does not evaluate to a function taking 26386312 arguments
Lexical analysis speed
Tokens a second?
Lines a second?
Here is some performance specs for a toy Oberon language (given to us), consisting of 39 keywords and operators, 16-bit numbers, variable length variable names, and nested commenting. Test file is 2.4MB is size and is lexically correct.
Timer(Start) SCAN (context free)
Timer(Stop ) 30294 ms 24353 tokens per second
Lines per second: 6608 (200179 lines)
Total tokens read: 737760
(on an AMD 1600+, 640mb PC133 RAM, statically linked, release mode)
How can one measure the acceptability of ones implementation?
Here comes C
OK. I like C, but learning programming from an OO perspective has killed my ability to write effective C code. O well, easy come, easy go.
Monday, July 28, 2003
Lame C# compiler error of the day
Compiler Error CS0553'conversion routine' : user defined conversion to/from base class
User-defined conversions to values of a base class are not allowed; you do not need such an operator.
The following sample generates CS0553:
// CS0553.cs
namespace x
{
public class ii
{
}
public class a : ii
{
// delete the conversion routine to resolve CS0553
public static implicit operator ii(a aa) // CS0553
{
return new ii();
}
public static void Main()
{
}
}
}
But now I need one, what now?
Problem solved. Solution: RTFM
From MSDN (dope):
Use IsNaN to determine whether a value is not a number. It is not possible to determine whether a value is not a number by comparing it to another value equal to NaN.
Saturday, July 26, 2003
OK, can someone please explain to me the meaning of this?
Wednesday, July 23, 2003
Something new
Hmm, I really need to stick to one thing, but I just had an inspiration today. Nice feeling when you get 600+ productive lines of code in an afternoon/evening. The following image (GDI+) is rendered from the following code:
Variable x = "x";
Function f = new Function(x, ((x-2)^2) - 2*x);
Function g = new Function(x, (2/x+(3^x)));
Function h = new Function(x, (((x)/3)^3) + ((x/2)^2));
Function i = new Function(x, x);
Function j = new Function(x, -x);
Function k = new Function(x, 3 * new UserExpression(x/2, typeof(Math),"Sin"));
Function l = new Function(x, 2 * new UserExpression(0.5/x, typeof(Math),"Cos"));
Function m = new Function(x, (new UserExpression(x, typeof(Math),"Exp") - 6)/2);
All these functions gets added to a Graph object that handle the drawing for a GraphControl, all with designer support and no flickering. Colors are assigned using a hash thingamagik.
int hash = f.GetHashCode();
gp.Color = Color.FromArgb(hash*61%256,hash*37%256,hash*53%256);
I dont know much of hashing, but with a bit of trial and error this seems to create the best variations.
Friday, July 04, 2003
Hide and Seek champion fails at 13 months
Ah well, look what I found today. I little "hidden" button in the text editor. At first I thought it was a graphical glitch as VS.NET has started looking all misaligned since I have turned on ClearType font smoothing. This something I have been looking for a year. Well here it is!