utils
| A zip file containing my utils library of helper classes. Includes Tidy, Transform, HTTPS, etc.
| C#
|
Pretty Print XML
| Format your XML to look nice
| C#
|
| CleanXML | Stryle Sheet to use to clean empty nodes/attributes out of XML | C# |
| Serialization of XML | This code allows you to read/write XML and utilize it cleanly via classes instead of the typical DOM nightmare. | C# |
Simple Events
| I have this mental block that prevents me from remembering how to do a simple event in C# ... use this code if you're similiarly aflicted. :)
| C#
|
SaveFormToINI
| Saves a form and controls to an ini file...
| C#
|
UDP/Sockets/Asynch
| This class monitors an ip:port for a message and times out on in a input time period. Had to do it for work and it was kind of tought to figure out so I thought I'd share.
| C#
|
| Simple Transform | Transform some XML through some XSLT | C# |
| Split | For some reason they made it overly complicated to do a simple Split in .NET (C#) | C# |
| stringToFile | Write a string to a file | C# |
| fileToString | Get a string from a file | C# |
| getRequest | .NET freaks when you try to use a request item that doesn't exist... pain in the ass | C# |
| appPath | AppDomain.CurrentDomain.BaseDirectory; or System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase ).Replace(@"file:\",""); | C#
|
| cookies | wrapper class for cookies | C# |
| fileUtils | a file util class | C# |
simple fileLog
| private void fileLog(string message) { string p = System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase ).Replace(@"file:\",""); fileUtils f = new fileUtils(); f.stringToFile(System.IO.Path.Combine(p,"log" + Guid.NewGuid().ToString() + ".txt"),message); }
|
|
| config | class that allows you to easily read from an XML (config) file. To Do: add something that allows you to update it. | C# |
| database ole | a class of DB (OLEDB) utils | C# |
| database sql | a class of DB (SQL Server) utils | C# |
| text constants | text constants I frequently use (class) | C# |
| RegX | Some Regular Expression Utils (class) | C# |
| Request Vars | Debug Print Query/Form | C# |
| open File Dlg | Open file dialog code. | C# |
| save File Dlg | Save file dialog code. | C# |
error to string
| Simple function to convert an error message to string
|
|
convert bitmap to black and white
| Converts bitmaps to 1 bit per pixel black and white bitmaps
|
|
vb asc
| the vb asc function
|
|
vb chr
| the vb chr function
|
|
ServerObjects
| How to use Server object (Server, Request, Reponse) from class libraries
| C#
|
force download of file
| Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=\"" + System.IO.Path.GetFileName(this.TextBox1.Text) + "\""); Response.WriteFile(this.TextBox1.Text);
|
|
Windows Service
| A simple windows service that wraps a class that has a timer in it. Also included: MSI install app for service.
|
|
MySQL and .NET
| Tutorial on how to use MySQL with .NET
|
|
Random Numbers
|
private int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
} |
|
Crop an Image
| Bitmap fullImage = new Bitmap(fileSpec); Rectangle rectangle = new Rectangle(0, (fullImage.Height / 4) * j, fullImage.Width, fullImage.Height / 4); Bitmap cutVersion = fullImage.Clone(rectangle, fullImage.PixelFormat); cutVersion.Save(desDir + fileNames[i] + "-" + j + ".png", ImageFormat.Png); cutVersion.Dispose(); fullImage.Dispose();
Where (fullImage.Height / 4) * j is the height at which to make the crop And (fullImage.Height / 4) is the total height that I want the final cropped image
|
|