Quantum Loop Gravity

Monday, August 17, 2009

Re-Re-Ressurection

Ok, seriously. I must either toss this thing, or really use it.

Monday, April 07, 2008

Time to resurrect the blog...

Ok, I haven't been the most up to date blogger around. I figure blogspot depends on repeat business, so that is why I am posting before the two year anniversary of my last post.

There will be some more posts in the future, hopefully.

Monday, September 04, 2006

Disable Right Click on images

Recently a client asked me to disable right clicks on their images, as they are copyrighted.
A quick search revealed one solution that I'm outlining below.

Place the following in a javascript script:


var disableclickmessage = 'Copyright company.\nAll rights reserved.';
function disablerightclick(event) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(disableclickmessage);
}
}
} else if (document.layers) {
if (event.which == 3) {
alert(disableclickmessage);
}
} else if (document.getElementById){
if (event.which==3&&event.target.tagName=="IMG"){
alert(disableclickmessage)
}
}
return false;
}



Usage:

img style="width: 93px; height: 24px;" src="test.jpg" onmousedown="disablerightclick(event)"

Tuesday, August 08, 2006

Winforms Datagrid Resources

In my search for specific help with datagrid behaviors, I came across some resources that have become indispensable:

http://www.codeproject.com/csharp/PracticalGuideDataGrids1.asp
http://www.codeproject.com/csharp/PracticalGuideDataGrids2.asp
http://www.codeproject.com/csharp/PracticalGuideDataGrids3.asp
http://www.codeproject.com/csharp/PracticalGuideDataGrids4.asp


http://www.eggheadcafe.com/articles/20060202.asp

http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q708q

Tuesday, July 18, 2006

ASP.Net Redirect based on referer

This code snippet is for anyone that is trying to do something like handle multiple domains on one
hosting account. Just checking for the server variable HTTP_REFERER is not enough, as they
can type in the url directly in their browser, or select a link from a bookmark. So, this will check
those conditions first:

if(!Page.IsPostback)
{
ViewState["URLReferrer"] = Request.UrlReferrer;
}

// when you want to direct
if(ViewState["URLReferrer"] != null)
{
Response.Redirect(Convert.ToString(ViewState["URLReferrer"]))'
}
else
{
Response.Redirect("~");
// ~ redirect to current application's default page
}

Tuesday, October 04, 2005

Code Snippet - MD5 encryption in C#

private string encryptString(string strToEncrypt)
{
System.Text.UTF8Encoding ue = new System.Text.UTF8Encoding();
byte[] bytes = ue.GetBytes(strToEncrypt);

// encrypt bytes
System.Security.Cryptography.MD5CryptoServiceProvider md5 = new
System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] hashBytes = md5.ComputeHash(bytes);

// Convert the encrypted bytes back to a string (base 16)
string hashString = "";

for( int i=0; i < hashBytes.Length; i++ )
{
hashString += Convert.ToString(hashBytes[i],16).PadLeft(2,'0');
}

return hashString.PadLeft(32,'0');
}

Code Snippet - MD5 Encryption in C#

private string encryptString(string strToEncrypt)
{
System.Text.UTF8Encoding ue = new System.Text.UTF8Encoding();
byte[] bytes = ue.GetBytes(strToEncrypt);

// encrypt bytes
System.Security.Cryptography
.MD5CryptoServiceProvi der md5 = new
System.Security.Cryptography
.MD5CryptoServiceProvi der();
byte[] hashBytes = md5.ComputeHash(bytes);

// Convert the encrypted bytes back to a string (base 16)
string hashString = "";

for(int i=0;i {
hashString += Convert.ToString(hashBytes[i],16).PadLeft(2,'0
');
}

return hashString.PadLeft(32,'0');
}

Wednesday, July 20, 2005

Cornish Pasty Company

I've recently visited the Cornish Pasty Company, located at 960 W. University, on the northeast corner of Hardy and University (website: http://cornishpastyco.com). This is more or less a specialty restaurant, selling pasties. If you don't know what a pastie is, then read the following, quoted from their web site:

"The Pasty originated in Cornwall (Southwest England) and can be traced back as far as the 1200's. The Cornish Pasty was baked by wives and mothers of tin miners during what was once a thriving industry. Pasties were made with a thick crimped edge along one side for holding onto while eating. This was useful because oftentimes a miner's fingertips would be covered in arsenic from the mines. The crimp, or handle, so to speak, could simply be discarded when they were done."

As the website will tell you, all the pasties are made from scratch and are baked fresh daily by Dean, who was raised in Gunnislake Cornwall. I spoke with Dean on and off while I was there, as he was preparing the pasties right in front of me. What they lack in space they more than make up for in character, as I was taking to the lad about the old country the whole time. It was a great way to pass the time, as the food takes a bit to prepare. Oh, but it was worth it! I opted today for the Portobello Chicken, made with Chicken Breast, Balsamic Marinated Portobello Mushroom, Fresh Mozzarella, Roasted Red Pepper, Fresh Basil. Served with a side of chilled Marinara. Yum!

Other menu items that I must try include the Oggie, Philly Cheesteak, and the Philly Chicken. Oh, and they also sell these creations half-baked, for your at-home enjoyment.


Casey Moore's Oyster House and Seafood Restaurant

My first entry is for Casey Moore's Oyster House and Seafood Restaurant, located at 850 S. Ash, in Tempe. (Their website is http://virtual-showcase.com/llc/casey_moore's/casey's.html). I went to lunch (7/19/05), anticipating some good seafood, and I wasn't disappointed. There were several tasty sounding items on the menu, but I chose the dozen oysters on the half shell, and their fish and chips. The oysters came with fresh garlic and cocktail sauce on the side. I tried several oyster/garlic/sauce combinations, and was impressed. The fish and chip order came later, and came with a very light battered cod. The french fries had what I think was a parmasean cheese sprinkle. I was delighted, and had an overall favorable impression of the whole meal.

Note to self: The outdoor area had some lush vegitation and a quiet ambiance about it, and as soon as it cools off outdoors, this would be worth a visit, just to be seated outdoors.