Kolletjie NET

Friday, June 11, 2010

WCE400 vs WCE500

Files in wce400 are designed to run on devices that are based on Windows CE 4.X such as Pocket PC 2003 devices. Files in wce500 are designed to run on devices that are based on Windows CE 5.X such as Windows Mobile 5.0 and Windows Mobile 6 devices.

Friday, May 7, 2010

Converting an Image to Base64 String

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void LinkButton1_Click(object sender, EventArgs e)

{

using (StreamReader sr = new StreamReader(MapPath("TestPicture.JPG")))

{

BinaryReader br = new BinaryReader(sr.BaseStream);

byte[] data = br.ReadBytes((int)br.BaseStream.Length);

string dataToSave = Convert.ToBase64String(data);

// show it

TextBox1.Text = dataToSave;

}

}

script>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Untitled Pagetitle>

head>

<body>

<form id="form1" runat="server">

<div>

<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">GetPictureAsTextasp:LinkButton>div>

<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Width="100%" Height="24em">asp:TextBox>

form>

body>

html>

Automatically open SQL Reporting report as PDF or EXCEL

Automatically open SQL Reports into PDF,EXCEL,CSV,Etc...

Add nunit to Visual Sutdio Project

To setup a nunit test do the following.

1. Download and install nunit 2.0
2. In your VS project add a reference to nunit.framework
3. In your VS project create a new class. Name doesn't matter.
4. Add using NUnit.Framework to your using statements for the new class
5. Prefix your new class with [TestFixture]. example [TestFixture] public class MyTest{}
6. Prefix a method to setup your class with [SetUp]. example: [SetUp] protected void setup() {}
7. Prefix your test methods with [Test]. example [Test] public void ThisIsATest() {}
8. In your ThisIsATest() method type Assert. (PS type Assert dot so you can see the auto-complete)
And then look at the list of options available to you. Each test method should have one assert method which does a test.

To run the test, first build your project, then find nunit on your start menu and open it up. Use it to browse for the dll or exe in your bin folder you just compiled.
Use NUnit to run the test.

NUnit will look for the classes in your project prefixed with [TestFixture] and execute all the [Test]s in it. It will then show you a summary of the results.

Thats all there is to it