Skyrim!!!

that is all.

Posted in Random | Leave a comment

blah blah blah ponies

Posted in Random | Leave a comment

Supercard SD and Last Window

Found out the sequel to Hotel Dusk was released in English recently and wanted to try it. If anyone still uses Supercard SD and tries this game out with the patch it still freezes after you open the door once returning home.

Just found that if you set RealCardPatchMode to Mode3 it fixes this issue and I was able to play thru the beginning scene and talk to Tony! Yay.

Thanks claudee013.
http://forum.supercard.sc/thread-7864-1-1.html

Posted in Csharp | Tagged | Leave a comment

using ‘this’ keyword

Any time an object uses the this keyword, it’s referring to itself.  It’s a reference that points to the object that calls it. huh.

public void TellMe(string message, Elephant whoSaidIt)
{
    MessageBox.Show(whoSaidIt.Name + " says: " + message) ;
}

public void SpeakTo(Elephant whoToTalkTo, string message)
{
    whoToTalkTo.TellMe(message, this);
}
/*
Lloyd.SpeakTo(Lucinda, "Hello");
runs
 whoToTalkTo.TellMe(message, this); //this references Lloyd as the Elephant whoSaidIt object!!
which becomes
 Lucinda.TellMe(message, [a reference to Lloyd]); //this is replaced with a reference to Lloyd's object */

After writing this out and like an hour I finally get it. The resulting output will be “Lloyd says: Hello” because this is referencing the object that executed the method (in this case it was Lloyd executing the SpeakTo() method).  something something, may add more practical insight later.

On a side note I now use http://www.megatome.com/syntaxhighlighter/ for my source code examples. yay.

Posted in Csharp | Leave a comment

Converting String to Integer

Use the Convert.ToInt32(string) method to convert a string to integer.

int startingMileage;

startingMileage = Convert.ToInt32(txtStartingMileage.Text);

This however doesn’t confirm if textbox is an integer or text so it’s not effective as is.

Posted in Csharp | Tagged | 2 Comments

C# Code: Remote Database Connection

So I want to create a database connection to my work database using Visual C# 2010 Express, but I come to find out that express editions don’t have remote database connections setup (wtf) so here is what I did to at least get a working connection.  I don’t believe this is complete so for now this is here for reference.

I found connection strings from http://www.connectionstrings.com/sql-server-2005 and am using the following:

Connect via an IP address

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;

DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.
This allows me to login via the IP address of my DB and assign what db and user to connect as.  I don’t think this is too secure, but I’ll have to look at it in the future when it matters.
I am using the System.Data namespace with the following:
Declared within the base of the class

System.Data.SqlClient.SqlConnection con;

DataSet ds1 = new DataSet();

System.Data.SqlClient.SqlDataAdapter da;

Within the Form_Load

con = new System.Data.SqlClient.SqlConnection();

con.ConnectionString = "Data Source=1.2.3.4,1433;Initial Catalog=DB;User ID=readonly;Password=ro1;";

txtPartNumber.Text = "";

//con.Open();

try

{

con.Open();

richTextBox1.Text = "Connection Success!";

}

catch(Exception exp)

{

Console.WriteLine("Connection Failed! {0}", exp);

}

//MessageBox.Show("Connection Open!");

sql = "SELECT * From Product";

//MessageBox.Show(sql);

da = new System.Data.SqlClient.SqlDataAdapter(sql, con);

da.Fill(ds1, "Product");  //DataAdapter populated called Product

richTextBox1.Text = "PART NUMBER  NAME\n ===========================================";

//DisplayResults();

con.Close();

// MessageBox.Show("Connection Closed!");

con.Dispose();
Posted in Csharp | Leave a comment