Ah, the library grows once again. I either need less books, or a bigger shelf. Its even starting to bow from the weight. And its out of room. Damn….

Ah, the library grows once again. I either need less books, or a bigger shelf. Its even starting to bow from the weight. And its out of room. Damn….

So first off, let me say, I’m pretty neutral about the different major Operating Systems. I like Windows for surfing, programming, and basic stuff.
I like Macs for their power with photo and video editing and unique and creative features.
I like linux for programming, and using as a server. It’s quite good at those things.
So now we can see some of the nice things about each. Now for most of my computers I’m running windows. (except 2 that are running ubuntu server) The reason for this is because I’ve been doing so much programming in the last few weeks. I’m putting out about 300-400 lines of code a day. Thats a lot. Now, at this point you probably know that I’m going to talk about the .NET framework and the Visual Studios IDE’s. I really REALLY hate the .NET framework because it is Microsoft only, just like everything else Microsoft makes. Though with programs like Mono, which I talked about two or three posts ago, I don’t really have to worry about the portability of the .NET framework. So that is one thing that makes me happy about Microsoft; It is still portable despite the fact that they don’t want to be.
Despite those things, I still like the simplicity of most of Microsoft’s programs. Microsoft stuff like Office and Visual Studios are quite nice. They hog memory, but other than that they are very nice. I love Visual studios. It makes programming in any .NET language so much easier and the form designer is probably the best thing about it. Choose the things you want, and drag and drop them. The IDE is so great also for people like me who just wan to experiment. The intellisense in Visual Studios is very nice, and makes it easy to just explore the language itself so you don’t have to go looking through man-pages to find out how to use a function, and that is so convenient. Hooray, Microsoft made something that I really like for once :]
I still hate Microsoft’s web site. It’s impossible to navigate…
Heres a little bit of code for making random strings. I’m sure someone will find it useful. I used to use it a lot in web development. Not sure how useful it would be for software development but use it if you’d like to
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ruf
{
public static class StringGnerator
{
public static Char[] charArray = { ‘-’, ‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’, ‘m’, ‘n’, ‘p’, ‘q’, ‘r’, ’s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’, ‘1′, ‘2′, ‘3′, ‘4′, ‘5′, ‘6′, ‘7′, ‘8′, ‘9′, ‘0′, ‘_’ };
public static string RandomStr()
{
String returns = “”;
Random r = new Random();
for (int i = 0; i < 11; i++)
{
returns += “” + charArray[(int)(r.NextDouble() + 1.0 * 38.0)];
}
return returns;
}
public static string RandomStr(int Length)
{
String returns = “”;
Random r = new Random();
for (int i = 0; i < Length; i++)
{
returns += “” + charArray[(int)(r.NextDouble() + 1.0 * 38.0)];
}
return returns;
}
public static string RandomStr(int Seed, int Length)
{
String returns = “”;
Random r = new Random(Seed);
for (int i = 0; i < Length; i++)
{
returns += “” + charArray[(int)(r.NextDouble() + 1.0 * 38.0)];
}
return returns;
}
}
}
I’ve been working on Fizzure A LOT recently. I made a FizzSrvLight that is not a distributed system like the regular one, which therefore allowed me to write one effectively in about 3 hours. On the way I decided to make a few of my own methods and then realized, hey these can be used in other projects too!
So I made a class library (.dll – Dynamically Linked Library ) with a few methods that have to do with TCP Data transmition. The most important of which is the Send method that I made. Now this is really only useful for the client. Anyway, heres the snippet:
public static void Send(TcpClient Client, String Command)
{
Console.WriteLine("Opening Server Stream");
NetworkStream n = Client.GetStream();
String send = Command;
String receive = null;
byte[] msg = System.Text.Encoding.ASCII.GetBytes(send);
n.Write(msg, 0, msg.Length);
Console.WriteLine("SENT: {0}", send);
}
this method is meant for console programs, but if you are using a GUI all you really need to do is delete the Console.WriteLines()’s in there and replace it with wherever you want the output.
Hope this is helpful to everyone!
Ok, this is just a quick snippet of code I wrote to get a working server up. Obviously theres more commands I could put in there in plenty of different ways, but I really just wanted to keep things simple for now. This took me about 2 hours.
This snippet is the main body of code that controls everything. If you go through it and read you’ll see that I made a struct to hold the information on files named File, in the namespace Structure. So you would access it by saying in this [MainNamespace].Structure.File; or you can just use Structure.File. I’ll paste the code for the struct at the end.
I didn’t leave too many comments because I used a lot of Writelines to tell me what it was doing, and for debugging purposes. Those kind of tell you what things do what.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace FizzSrvLight
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(“FizzSrvLight :: Non-Distributed Fizzure Serving Capabilities”);
System.Threading.Thread.Sleep(1000);
Console.Write(“Loading…”);
Console.WriteLine(“!”);
Console.WriteLine(“Initiating Server Variables…”);
System.Net.IPAddress localaddr = System.Net.IPAddress.Parse(“127.0.0.1″);
Console.WriteLine(“Constructing Server Objects…”);
System.Net.Sockets.TcpListener MainServer = new System.Net.Sockets.TcpListener(localaddr, 9000);
Console.WriteLine(“Starting Server…”);
MainServer.Start();
Byte[] bytes = new Byte[1024];
String data = null;
String send = null;
while (true)
{
Console.WriteLine(“Waiting for connection…”);
// Accept Requests
System.Net.Sockets.TcpClient client = MainServer.AcceptTcpClient();
Console.WriteLine(“Client Connected!”);
// Clear Buffers
data = null;
send = null;
// Get Stream Object for reading and writing
System.Net.Sockets.NetworkStream stream = client.GetStream();
int i;
// Initialize File Holder
System.Collections.ArrayList CurrentFiles = new System.Collections.ArrayList();
// Loop to recieve all data sent from client
while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
{
// Clear buffers again
data = null;
send = null;
string message = “OK”;
// Get data as string
data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
Console.WriteLine(“FIZZ_RCV: {0}”, data);
String[] command = data.Split(‘ ‘);
// Insert Possible Commands Here
if (command[0] == “FIZZ_ADDFILE”)
{
FizzSrvLight.Structure.File file = new FizzSrvLight.Structure.File(command[1], command[2], command[3], command[4], command[5], command[6]);
CurrentFiles.Add(file);
}
else if (command[0] == “FIZZ_RMVFILE”)
{
FizzSrvLight.Structure.File file = new FizzSrvLight.Structure.File(command[1], command[2], command[3], command[4], command[5], command[6]);
CurrentFiles.Remove(file);
}
else if (command[0] == “FIZZ_AUTH”)
{
string username = command[1];
string password = command[2];
}
else
{
Console.WriteLine(“FIZZ_INVALID_INPUT”);
Console.WriteLine(“Error Handled”);
message = “ERROR”;
}
send = message;
byte[] msg = System.Text.Encoding.ASCII.GetBytes(send);
// Send back an OK response;
stream.Write(msg, 0, msg.Length);
Console.WriteLine(“FIZZ_SND: ” + message);
}
System.Threading.Thread.Sleep(1000);
}
}
}
}
Now, time for the struct.
namespace FizzSrvLight
{
namespace Structure
{
public struct File
{
public string FileName;
public string FilePath;
public string FileType;
public string SharedBy;
public string IPAddress;
public string Blacklist;
public File(string name, string path, string type, string user, string ipaddr, string blacklisted)
{
FileName = name;
FilePath = path;
FileType = type;
SharedBy = user;
IPAddress = ipaddr;
Blacklist = blacklisted;
}
}
}
}
Well, there you have it. A very simple TcpListener Serve. Obviously theres better ways to do it but this is pretty simple, straight forward, and just all around easy. Please leave comments if you find bugs in it or see errors or even if you just don’t understand what some of it does.
If I could find my camera, I would have some funny pictures to go along with this. but I don’t.
You know you’re a geek when:
Well, I could go on probably but i think I’ll stop here. 95% of these apply to me. I guess I’m a geek. Who else is?
I saw a post yesterday about what someone would do with a million dollars. He said he would buy some crazy macs of course. The specs were amazing. Reading that post got me thinking though – What would I do with a million dollars?
After about a good 30 seconds or so, the answer was quite clear. I would make my own data center, duh!
And of course I would save several servers for my own private use for research on Distributed Computing. Because I think that is really interesting and would love to do work with it in the future.
Anyways, I immediately set out to find some hardware that I would use in my new Data Center.
The first thing that you would need obviously is for a Data Center would be a place to hold data. So I found this:
LACIE 300961 2TB Gigabit Ethernet Shared Hard Drive

Connects through a 10/100/1000 Ethernet port, and each has a 2TB capacity. VIA C3 800Mhz processor and 256MB of RAM.
Price Per Unit: $859.99
Quantity: 100
Total Cost: $85,999.00
After buying these i would now have $914,001.00 left to play with. Time for some processing power.
I put together a custom rack. Quite powerful in my opinion. Heres the specs:
Custom Rack Unit
CPU:
2 x Intel Xeon X5450 Harpertown 3.0GHz Quad-Core Processor
2MB L2 Cache
1333 Mhz FSB and 64 bit support
Motherboard:
TYAN S5397AG2NRF Dual 771 Extended ATX Server Motherboard

Dual 771 CPU Sockets
1600/1333/1066 Mhz FSB
16 x 240 pin DDR2 Memory Slots
1 PATA / 6 SATA II
3 x On-Board Gigabit LAN
RAM:
Kingston 2GB 240-pin DDR2 SDRAM PC-5300 Server Memory
2GB Capacity
PC-5300 Speed
Power Supply:
iStarUSA TC-350R2U 2 x 320w Server Power Supply

24 Pin Power Connector
2 x 350 Watts
2 Fans
Of course, to wrap it all up, I need a case…
Case:
iStarUSA D-200-PFS Black Steel 2U Server Case

1 External 5.25″ Drive Bay
1 External 3.5″ Drive Bay
2 Internal 3.5″ Drive Bays
3 Expansion Slots
2U Form Factor
2 x 80mm Fans
Price Per Unit: $3,875.82
Quantity: 100
Total Cost: $387,582.00
Ok, so now at this point, I have $526,419.00 left to spend. Haven’t even spent half yet.
What is the next thing that any Data Center needs? Internet of course. The data center is no good if no one can access it.
If I were to get 30/15Mbps service, It costs $239.99/month for a 2 year agreement. which comes out to be $5,760 for two years. leaving me with $520,659.00
Now that seems like a large amount of money, but if you really think about it. I would probably use the rest for an office/building, utilities, and repairs and maybe some employees. So now that I look at it, starting a Data Center would be hard because you end up spending more money on other things and less on actual computers. That’s disappointing.
I know for most professional programmers and really anyone else in general it isn’t much of an accomplishment, but for me this is – I got the basic TCP connection working between the Fizzure client and server.
The server is just a lightweight console application. So far all it really does is accept connections. But for now I guess thats good enough. Today, I need to work on the XML usage of both the client and the server, and then the interaction with XML between the two. For efficiency I think I will do a lot of caching data. But I guess I need to figure out how to do that as well. I’m going to have to do a little more planning and deciding before I do too much programming.
Also though, I need to work on the GUI for the client. I’m thinking about making it kind of skinnable. Or at least it will have different like color themes you can choose from. But eventually, I want it to be skinnable. People do seem to like that, it makes you feel like your program is just that much more personalizable.
I have decided that my peer to peer application, Fizzure, will be open source! Exciting, I know.
However, I don’t think that I will open the source until I have a working beta build. Right now its still in core development. And it has a long way to go. Only the client will be open source. The central server that all will keep the information organized will be private and closed source. Sorry fellas. Out of luck on that one.
Fizzure will be the first application that I will publish officially, so I’m not completely sure how to go about doing so. My friend suggested that since I’m opening the source I should put it under the GPL. Sounds like a good idea, but, how do I do this? If anyone has suggestions for a n00b like me on how to go about doing such that would be great. If not, I’m going to ask again later anyways, once it is closer to an actual release.