Thursday, July 14, 2011

AS400 / iSeries Fun

Where I work we still have some Cobol programs in use and I am the only one that supports them.  I decided that I needed an easy way to pull the source code to my PC so I could use a slightly more friendly way to review the code and figure out what it does (so I could replace it with C# code).

Turns out that old school is the way to go.  I FTP'd into the server, changed into the appropriate library and did a get on the source file I wanted.  Very nice and easy.  Then I decided why not just pull it all so I did an mget and it worked.  Very nice!  Dropped all the source onto a Linux box so I could grep it anytime I wanted.  Did a WC on it and found that we had about 1.5 million lines of code spread across 7000 programs.

Wanted to share how I did it for others:

cd (some folder here to store the source files)
ftp servername
Enter Username & Password
cd (library here)
prompt (to turn off prompting for each file)
mget source.*
(wait for it to finish)
quit

Enjoy!

Saturday, July 9, 2011

Finished TARDIS Piggy Bank

Thought I would share pictures of the TARDIS "Piggy Bank" I made for Sam.  He chose the color.  It is 17" tall by 7.25" wide (square).  The light on top is a single LED bulb that cycles through 7 different colors and flashes.  It can also show any one of the individual colors (by pressing the black button).  Josh's is very similar but blue and a little bit shorter.


Saturday, July 2, 2011

Old but still great code

I decided to resurrect some old 3D dot rotation code (1993). It was in C so I converted it to C# (not a big stretch) and it works pretty good. The key was double buffering.

Right now I am working on a whole 'font' that will allow me to rotate just about any string.

(these are predefined elsewhere but thought I would include them so you could see how the are created)
offScreenBmp = new Bitmap(this.Width, this.Height);
offScreenDC = Graphics.FromImage(offScreenBmp);
backBrush = new SolidBrush(Color.Lime); // i set the form transparency key to this
this.TopMost = true;

the 'display' code looks like this (I will be cleaning it up later):

private void DoDotAnimation()
{
while (! ClosingIt)
{
MoveDots(); // never guess what this does...
Graphics clientDC = this.CreateGraphics();

offScreenDC.FillRectangle(backBrush, 0, 0, this.Width, this.Height);

Color newColor = System.Drawing.Color.Red;

for (i = 0; i < PointsN; i++) // run through the dots array and draw them { if ((TheNewDots[i, 0] > -1) && (TheNewDots[i, 1] > -1))
offScreenDC.DrawEllipse(new Pen(newColor, 2), TheNewDots[i, 0], TheNewDots[i, 1], dotSize, dotSize);
}
clientDC.DrawImage(offScreenBmp, 0, 0);

Application.DoEvents();
}
}
Copyright Realm Laboratories, LLC