<$BlogRSDUrl$>

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!


Thursday, July 03, 2003

Be thankful you dont live in a 3rd world country



This is what us lucky ones has to bare with. Obviously this clown has not even attempted Networking 101 else he would know the difference between bandwidth and latency (did I mention I have ISDN, so pings of 30ms are expected). Here follows the "conversation":

hello,

Please be informed that by the nature of your querie this seems to be a
dialup issue.I therefore regret to inform you that there is no
guaranteed bandwith for dialup.The network seems to be busy and therefore
you are experiancing latency.I have check with our network operations
centre and they have confirmed this.

Thanks

Wayne D'sa

Customer Service Centre

UUNET SA

08600 UUNET (0860088638)

Email :support@uunet.co.za

-----Original Message-----
From: leppie
Sent: Wednesday, July 02, 2003 10:27 PM
To: support@ataris.co.za
Subject: Very high latency

Hi Support

|------------------------------------------------------------------------------------------|
| Host - % | Sent | Recv | Best | Avrg | Wrst | Last |
|------------------------------------------------|------|------|------|------|------|------|
| 192.168.0.1 - 90 | 1002 | 109 | 0 | 0| 10 | 0 |
| lo1.nas1.cpt1.alter.net - 1 | 1002 | 999 | 30 | 221 | 741 | 220 |
| e1-0.dr2.cpt1.alter.net - 8 | 1001 | 929 | 30 | 213 | 651 | 200 |
| vlan9.hr1.cpt1.alter.net - 8 | 1001 | 927 | 30 | 212 | 601 | 190 |
| rl1.phantom.ataris.co.za - 6 | 1001 | 942 | 30 | 216 | 681 | 170 |
|________________________________________________|______|______|______|______|______|______|

I think that tells the story. What is going on with the lines?

Regards

leppie


Nothin to see here! Move along people!




Tuesday, July 01, 2003

Major Tip of the Day


This will help you manage all those brushes and pens you so relentlessly create withou disposing of them correctly. YES YOU!!!


public class GDIBuffer
{
static Hashtable pens = new Hashtable();
static Hashtable brushes = new Hashtable();

public static Brush GetBrush(Color color)
{
if (!brushes.Contains(color))
brushes.Add(color, new SolidBrush(color));
return brushes[color] as Brush;
}

public static Pen GetPen(Color color)
{
if (!pens.Contains(color))
pens.Add(color, new Pen(color));
return pens[color] as Pen;
}

public static Pen GetPen(Brush brush)
{
if (!pens.Contains(brush))
pens.Add( brush, new Pen(brush));
return pens[brush] as Pen;
}

public static Pen GetPen(Brush brush, int width)
{
Tuple t = new Tuple();
t.left = brush;
t.right = width;

if (!pens.Contains(t))
pens.Add( t, new Pen(brush, width));
return pens[t] as Pen;
}

struct Tuple
{
public object left;
public object right;
}
}