Archive for the ‘ tips ’ Category

Dreamhost – PROMO CODE!

I’ve just recently switched all of my personal sites to Dreamhost. Dreamhost offers unlimited everything at a very low price. I’ve been with them for one year now and have never had any major complaints. I had trouble importing a 70mb sql file and the support staff responded to my ticket within the hour with helpful and correct steps to import my database using SSH.

Since I switched and think everyone should enjoy unlimited services at an awesome price I’ve going to give you an AWESOME deal!

GO HERE

Sign up for 1 year (Normally $119!) Enter MY promo code LIFEOFAJACKASS and receive a free domain registration for LIFE and $40 off the first year! Thats only $79 for 1 year of hosting AND a free domain for LIFE!

Why? It’s UNLIMITED! Why not?

Popularity: unranked [?]

uStream.tv Status (Java Script)

I was called upon today by a new friend to write a small script to detect the streaming status of a uStream.tv channel. I thought I”d share the script with everyone.

****OK OK, My CodeBox plugin is not working, please be patient.****

<!--Place this code where you want the status to appear. -->
<font color='red'><span id="status">status</span></font>

<!--Place this code anywhere in the page. -->
<script type="text/javascript">
function set_status(status)
{
if (status == "offline")
{	<!-- replace the img html with any html that you need -->
document.getElementById("status").innerHTML = "<img src='http://lifeofajackass.com/offline.png'/>";
}
else if (status == "live")
{	<!-- replace the img html with any html that you need -->
document.getElementById("status").innerHTML = "<img src='http://lifeofajackass.com/online.png'/>";
}
else
{	<!-- Let's do this just in case the service is down or something. You could show an error image as well -->
document.getElementById("status").innerHTML  = "Error getting stream status!";
}
}
</script>
<!--Make sure to replace the channel name and API key. -->
<script type="text/javascript" src="http://api.ustream.tv/json/channel/CHANNELNAME/getValueOf/status?key=YOURAPIKEY&callback=set_status">
</script>

Popularity: unranked [?]

There are a lot of beginner and even intermediate level developers that have no idea how to access/modify a forms objects/methods from within a different class. I’ll show you the easiest practice of this.

First we have to make a reference. We must use the ‘protected’ keyword. I use the same name as the windows form that way it is easy to keep track of variables.

capture2 C# Access A Forms Controls Within A Class

Once that is done you must set each method and object you want to access to public. You do this from the Forms Designer Class.

capture C# Access A Forms Controls Within A Class

And that’s it. With just 2 lines of code you can now access you forms controls and methods.

[Sorry for the images of the code, my code-box plugin is broken]

Popularity: unranked [?]

What’s Going On?

Got some emails asking what’s been going on. I know I haven’t posted in a while. Some people miss my daily code snippets and short tutorials. I’ve been working hard on an anti-cheat system for BHD with http://cheatsense.com

I haven’t completly neglected the site. I’ll post some code tutorials tonight on a few more hashing techniques and string encryption. I will also be posting soon a tutorial on how to control a forms events and controls from within a different class. Unlike VB.NET, C# does not automatically inherit the forms methods and control methods.

I’ll also talk about obfuscation and .Net application security, secure string and anti-debugging methods.

Popularity: unranked [?]

.NET Gravatar Library

I’ve updated my Gravatar source. I am no longer working on the control version. I have focused my attention to a library model. With the library you are able to manipulate the image more then you could with the control. The image is stored in memory as passed as an image. I am working on arrays that will allow you to pass an overload containing a list of emails and return the Gravatar in the given order.

You can find out more here!

Popularity: unranked [?]

FBI: Cool People.

Did you guys know that you can go to your local field office with emails, chats, websites; etc? Why? To have them tracked to the source. Maybe you’ve been getting threatening, bullying or disrespectful emails. This is a CRIME now. Ever since that little girl in Saint Louis killed herself over MySpace, it is now a FELONY to do this! This is not a matter to be taking lightly. Bullying can lead to depression, suicide, altered behavior, paranoia, poor grades and can ruin families/friends lives! 

If you have ANY emails, chats or IM’s like this I urge you to report it to your local field office or county office. Portraying to be someone else to bully is not only a felony for cyber bullying, it’s also a felony for cyber terrorism, wire fraud and identity theft.

 

Check back later for a more detailed report.

Popularity: unranked [?]

GravatarGet: Source Code

I’ve updates the GravatarGet page. I’ll be explaining the source code and releasing a major portion of the code. There’s already been over 5,000 downloads and the number is growing everyday. There are reports of bugs and what not, I will address them here.

Default Icon Struct:
I did this so we wouldn’t have to remember the names of the 3 fallback icon sets Gravatar offers.

Rating Struct:
Sure, there are only 4 ratings(G, PG, R, X) but maybe someone don’t know that. So I created a struct for this as well.

Some people are having trouble returning an image into memory. I recommend using MemoryStream for this. You can also attach the Gravatar to a listbox, combobox,textbox and almost any other control applicable.

So check out the Gravatar page and enjoy!

Popularity: unranked [?]

Rcon & C#

As some of you know, I’m working on an Rcon Manger for COD4/5. Some of you want to know how I am parsing/prepping the command to be sent. I’ll share with you my method of parsing the command. I don’t want to divulge too much information as I’m not done with the project yet.

public byte[] prepCommand(string command)

{

byte[] bufferTemp = Encoding.ASCII.GetBytes(command);

byte[] bufferSend = new byte[bufferTemp.Length + 4];

//intial 5 characters as per standard

bufSend[0] = byte.Parse("255");

bufSend[1] = byte.Parse("255");

bufSend[2] = byte.Parse("255");

bufSend[3] = byte.Parse("255");

//copying bytes from rcon to send buffer

int j = 4;

for (int i = 0; i < bufferTemp.Length; i++)

{

bufferSend[j++] = bufferTemp[i];

}

return bufferSend;

}

Popularity: unranked [?]

C# Convert Decimal to Integer

Having trouble converting your decimals into integers? A lot of people are. It’s actually pretty easy. Bellow is a short example!

Here I am using a Numeric Up/Down control and need to convert the value to an integer to pass it to my picturebox control.

picturebox1.Width = Convert.ToInt32(Math.Ceiling(numericUpDown1.Value));

Using ToInt32.Ceiling() it will return the smallest integer greater then or equal to the decimal passed.

Hope this helps with your decimal to integer problems!

Popularity: unranked [?]

TimesURL & .NET

I’ve got a few emails regarding http://timesurl.at. If you want to use this service you can still the use code from [TinyURL & .NET]. All you have to do is change one line of code.

Change

http://tinyurl.com/api-create.php?url=

to

http://timesurl.at/api/rest.php?url=

And there you have it. This also works with most other URL shortener sites. If not, just email me and I”ll write up some code for the site you need.

Popularity: unranked [?]