Tuesday, August 12, 2003 6:44 PM Jan Tielens

Remembering code snippets (eg. Global Error Handler)

Today I was searching for a code snippet that I had used some time ago. But I couldn't find it! I knew I had used it before in a project, but ofcourse I hadn't the source code with me. I work on different locations (customer's office, office, home) on different machines (customer's pc, laptop, desktop) and I don't copy all my projects to each pc. My next thought was: “No problem, just use Google!”. But when you really want to find something, the chances are high that you can't remember the exact title of the article or website you've read (Murphy's law). So no luck with Google today. Finally I went home and looked up the snippet in my old project...

This experience has happened quite some times to me (am I the only one?). So I started wondering if there is a solution for this problem. Here are some requirements:

  • Code snippets must be stored together with a description and title.
  • A nice UI has to provide functionality to store and search code snippets.
  • The data needs to be stored somewhere on the web so it can be accessed from different locations.
  • Optional: Code snippets are shared between different people.

Does anyone has an idea if such an application exists? Or do I have to make one myself? ;-)

Btw, here is the code snippet I was looking for. It adds a global error handler, that catches all unhandled exceptions


Public Sub New()

MyBase.New()
InitializeComponent()

AddHandler System.Windows.Forms.Application.ThreadException, AddressOf Me.GlobalErrorHandler
End Sub

Public Sub GlobalErrorHandler(ByVal Sender As Object, ByVal t As System.Threading.ThreadExceptionEventArgs)
MsgBox(t.Exception.ToString)
End Sub


Comments

# re: Remembering code snippets (eg. Global Error Handler)

Tuesday, August 12, 2003 2:48 PM by Steven Smith

My solution to this when I first ran into it was to write a quick article about it on my ASPAlliance column. You'll note that my first articles at http://aspalliance.com/stevesmith/articles/ are REALLY basic ASP stuff. This is because I was a consultant learning and bouncing around between client locations, so this provided me with a central repository for such snippets that I wanted in my virtual toolbox, and had side benefits of helping others and providing me with great exposure. You might use the articles feature here, your own site, or sign up to become an ASPAlliance columnist and get free space there plus a lot of exposure in the community.

Steve

# re: Remembering code snippets (eg. Global Error Handler)

Tuesday, August 12, 2003 4:25 PM by Jeremy

Most of what I have seen requires a desktop app that uses a web service to get updates.

http://www.vb2themax.com/codebox
http://www.fmsinc.com/dotnet/SourceBook
http://www.artifactsoftware.com
http://www.artifactnetwork.com

# re: Remembering code snippets (eg. Global Error Handler)

Wednesday, August 13, 2003 1:23 PM by kryp

http://dotnet.4all.cc/ freeware :>