eWorld.UI - Matt Hawley

Ramblings of Matt

Centrall IL Dot Net User Group - Upcomming Events

March 16, 2004 16:43 by matthaw

I've been starting to put together a nice lineup for future events for the Central IL Dot Net User Group based out of Bloomington, IL.  Below is a brief summary of whats to come:

  • April 7, 2004 - Nick Lewis from Microsoft will be speaking about Web Hack
  • May 5, 2004 - Brian Bussing and Jason Wrage from Integrity Technology Solutions will be speaking on SIF, SOA, and Integration.
  • June 2, 2004 - Eric Sink from SourceGear will be presenting. His topic is undetermined still.
  • October 6, 2004 - Jeff Prosise, a speaker from INETA will be speaking about ASP.NET hacking and security.

I will be constantly updating our Upcoming Events page, so make sure you stay tuned if you're interested in our group.  Also, if you're in or around the Central IL area, and wish to speak, just contact me, and I'd be more than happy to coordinate a time when you can.



Snow?

March 16, 2004 15:11 by matthaw
EEEK! So I wake up this morning, go to my office, sit down in my chair... then I glance to my left - ITS WHITE OUT!  AHHH! Why does it have to snow in the middle March?  Well, I guess thats okay, because its supposed to be in the 60's by the end of the week.

Categories: General
Actions: E-mail | Permalink | Comments (3) | Comment RSSRSS comment feed

Thinking Toys

March 15, 2004 21:52 by matthaw

A coworker of mine was just complaining how the cleaning crew had thrown away his bent-up paperclip that he played with while thinking this last weekend.  This made me start to wonder what I play with when thinking about a problem while programming.  It turns out that I actually have 2 different items. 

My main "thinking toy" is a pen, funny enough.  I, for some reason, like to take the cap off & on many times during the day.  This has, unfortunately, led to the pen cap not staying on that well, and as such I've had many run-ins with the ink.  My second "toy" is a stress ball that looks like a car.  Most of the bumper paint has been worn off, so its obviously had some good use.

What types of "thinking toys" do you use, and have you actually stopped and thought - "Why am I playing with this?"



Categories: General
Actions: E-mail | Permalink | Comments (6) | Comment RSSRSS comment feed

"The http redirect request failed."

March 15, 2004 17:15 by matthaw

Ever got this message attempting to open a solution in VS.NET 2003? Well, the full error message is "The web server reported the following error when attempting to open or create the project at the following URL: The http redirect request failed." A co-worker ran across this multiple times on Friday, and got entirely fed up with the problem that he'd have to refresh the entire project from VSS or delete the /bin directory each time. I guess the root cause of this is something with the page named: "get_aspx_ver.aspx". After a call to MS, he came back with a solution:


protected void Application_BeginRequest(object sender, EventArgs e)
{
  string ver = Request.ServerVariables["URL"].ToString();

  if(ver.IndexOf("get_aspx_ver.aspx") >= 0)
    Response.End
}


After the previous code was added to the global.asax file, our solutions started opening without any problem.

[Previously Posted on old Weblog on August 18, 2003]



Categories: .NET
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Encode HTML - Have validateRequest = True

March 15, 2004 17:14 by matthaw

A co-worker and I had a situation today in which we wanted a particular TextBox control to allow HTML. The only problem, is that validateRequest must be done across the entire website, or for the particular page. Because of these restrictions, and the fact that the UserControl being built is placed in a dynamic page for a portal, we had to research ways to allow HTML posted entries but still keep validateRequest=True.

After doing a little bit of research, I came across the idea of replacing the character representation of common HTML elements via Javascript then decoding that information with Server.HtmlDecode.

The code is as follows:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="Test.WebForm1"
validateRequest="true"%>
<html>
   <body>
      <form runat="server">
         <script language="javascript">
            function encodeMyHtml(toEncode) {
               return toEncode.replace(/&/gi, '&amp;').replace(/\"/gi, '&quot;').replace(/</gi, '&lt;').replace(/>/gi, '&gt;');

            }
         </script>

         <asp:TextBox Runat="server" ID="tbEncodedText" TextMode="MultiLine" Columns="100" Rows="10" >
         <asp:Button Runat="server" ID="btnSubmit" Text="Submit My HTML" OnClick="btnSubmit_Click"/>
         <hr>
         <asp:Literal Runat="server" ID="outputHTML" />
      </form>
   </body>
</html>
Then in my code-behind I have this in my Page_Load function to add the onclick attribute:
private void Page_Load(object sender, System.EventArgs e)
{
   if(!Page.IsPostBack)
   {
      btnSubmit.Attributes.Add("onclick", "this.form." + tbEncodedText.ClientID + ".value = encodeMyHtml(this.form." + tbEncodedText.ClientID + ".value);");
   }

}
Then my button event, I have:
private void btnSubmit_Click(object sender, EventArgs e)
{
   outputHTML.Text = Server.HtmlDecode(tbEncodedText.Text);
   tbEncodedText.Text = Server.HtmlDecode(tbEncodedText.Text);
}


Overall, this provides a nice solution to not having your entire web application or page allow HTML elements.

[Previously Posted on old Weblog on July 17, 2003]



Categories: .NET
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Reading Eventlog Entries

March 15, 2004 17:12 by matthaw

I was asked by my boss the other week, in my spare time at work, to create a script or windows service that would read all entries in the Application Event Log for that day. He pointed me to a link that used VBScript and some wacky dll named "winmgmnts". This seemed like a pain, and I was like...I know you can write to Event Logs with .NET, why couldn't you read them...sure enough, you can. The following code is used to read all entries for the current day of 3 defined logs. This, obviously, can be expanded further...which is what I intend to do.


using System;
using System.Diagnostics;

public class MyClass
{
  public static void Main()
  {
    int month = DateTime.Today.Month;
    int day = DateTime.Today.Day;
    int year = DateTime.Today.Year;

    string[] logNames = new string[] {"Application", "Security", "System"};

    foreach(string log in logNames)
    {
      EventLog appLog = new EventLog(log);

      foreach(EventLogEntry entry in appLog.Entries)
      {
        if(entry.TimeGenerated.Month == month && entry.TimeGenerated.Day == day && entry.TimeGenerated.Year == year)
        {
          Console.WriteLine("-----------------------------------------");
          Console.WriteLine(entry.EntryType.ToString());
          Console.WriteLine(entry.Message);
        }
      }
      Console.ReadLine();
    }
  }
}

[Previously Posted at old Weblog on October 1, 2003]



Categories: .NET
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Tab Key Emulation

March 15, 2004 17:09 by matthaw

Today, in the project I'm currently working on, I had to figure out a way of emulating the tab key by pressing the Enter key. I had found a very complicated script that required you to know the next id/name of the textbox or control that would need focus next...and since I'm creating 4+ textboxes in a datagrid, plus the ability of dynamic columns (all containing textboxes), this just wasn't going to be an easy task. As I set out, Google pointed me to a very helpful thread post. All you had to do is capture the enter key code and return the tab key code...simple, and works excellent!

[Previously Posted on old Weblog from October 9, 2003]



Categories: General
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Links 2004 Players?

March 15, 2004 02:10 by matthaw
Well I just purchased Links 2004 for the XBox yesterday, and the game is great.  I know about a month ago, there was a lot of hoopla about .NET community geeks, like myself, were getting together regularly to play a few rounds.  I unfortunately don't remember who you were, but if you want to add me to your friends list to catch me online playing sometime, my username is MHawley

Categories: General
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

BlogJet 1.0.0.15 Beta Released

March 15, 2004 02:02 by matthaw

BlogJet has released 1.0.0.15 Beta. Download it from here.

BlogJet 1.0.0.15 Beta Release Notes
March 13, 2004

FEATURES
* FeedDemon's "Blog this" support.
* Gutter for code editor.
* Enabled FTP settings for dasBlog.

BUG FIXES
* Fixed bugs with custom images paths.
* Normal/Code tabs blinking eliminated.
* Unable to remove links fixed.
* Fixed bug with voice upload.
* Fixed shortcuts in code editor.
* Other bug fixes.



Categories: General
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

.NET Framework 1.1 SP1

March 12, 2004 16:08 by matthaw
I had downloaded XP SP2 Beta last night to install on my Virtual PC so I could try out Whidbey.  Well, after I tried running the installer for Vault, I realized I didn't have the 1.1 framework installed, so the installation couldn't continue.  I figured, why go re-download, when I know I have the .NET framework on the SP2 Beta CD.  To my suprise, it installed the 1.1 framework, as well as SP1 for the 1.1 framework.  Does anyone have any info pointing to the changelog for this SP?  I'm intrigued to find out what was fixed.

Categories: .NET
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed


Copyright © 2000 - 2024 , Excentrics World