eWorld.UI - Matt Hawley

Ramblings of Matt

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

Whidbey Timing

March 11, 2004 23:32 by matthaw
This is the best darn news I've heard all day concerning Whidbey.  I can't wait to see the new bits, even though I haven't really played with the PDC bits yet.

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

DevDays - Chicago, Wrapup

March 11, 2004 18:19 by matthaw

DevDays was definately worth the wait.  I had a wonderful time learning about security in web applications as well as a brief intro into SmartClients. 

Now for the wrapup...

The opening keynote was geared more towards marketing.  It was such a pleasure to see the different applications that are new and revolutionary - which included VS.NET 2003, InfoPath, BizTalk 2004, and WhiteHorse.  Well, as you can probably tell theres a bit of sarchasim in that statement, but seeing the integration of InfoPath and BizTalk 2004 was pretty cool.  I felt that the speaker (Todd Kimble) hit a lot of "duh" points with VS.NET - this is DevDays for pete's sake, not a marketing blitz - we know what VS.NET is and how to use it!

I then attended the first SmartClient session, where Jon Rauschenberger dissed all web developers - in pure humor of course, so I'm not offended.  This was a great session for me, mainly because I didn't exactly know what SmartClients were, so having it explained to me was a great plus.  I didn't have enough interest, however, to stick around for the other 3 sessions - I was more interested in the ASP.NET Security going on in the other room.

The next session was led by Todd Kimble again, who did a MUCH better job than the opening key note.  It was, obviously, more technically oriented, and basically scared the crap out of everyone in the audience.  He all of us how SQL Injection attacks, Cross Site Scripting (XSS), and input tampering can cause major security risks for all web applications.  This session actually was the highlight of the day for me, as it opened my eyes to what can actually happen, and what data hackers can obtain...very scary stuff.

The third session was led by Jacob Cynamon.  I felt that this session wasn't a bad session, however, it wasn't as breath taking as the last one, so it was hard for me to actually concentrate.  The content Jacob showed was very valuable, though I think I may have to review it at a later date to get the full effect.

The last session was led by Nick Lewis, which basically showed Microsofts OpenHack.  As he stated in his first few minutes, it was kind of a wrapup of the last few sessions - and it was.  The content was great, Nick showed us a TON of code and how to do things, but like the 3rd session - I'm just going to have to delve into the OpenHack source code to get the full effect.

The closing keynote was great! Jon Raushenberger demo'd Whidbey, and this was the first time I actually go to see it in action.  Jeff Key and I were just sitting there picking apart the bugs as they popped up, which was fun.  There were some irks that I noted during this presentation that I didn't like about Whidbey, but I really need to get in and start playing with it before I express my views openly.  That, and it could just be a limitation of the pre-beta release bits too.

So, overall DevDays was great.  It was awesome to meetup with Jeff Key (we actually hung out the entire day), Adam Kinney, Erik Porter, my coworker Brian Bussing, and Ryan Rinaldi. It was a great time at the brewery to just sit back, geek it out, and talk .NET/Longhorn/work and much much more.

Update: Thanks to Ryan, his name is now in the listing!  I tried finding your website, but I was using .com instead of .net



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


Copyright © 2000 - 2025 , Excentrics World