Posted by: Sean | September 6, 2010

If Facebook Existed Years Ago

(Disclaimer, no clue where this originated, but I stole it from TW)

abefb

shuttle[9]

titanicl[9]

godc

galeo[10]

trexfb

Posted by: Sean | June 23, 2010

C# – List of Exceptions

It never fails that I find myself fumbling through the Exceptions list to find the “right” Exception for the situation.  I’ve always wondered if someone had put together a listing of all available Exceptions in C#, apparently not.  Of course, the list is available in the MSDN documentation, but it’s just a little messy.  So let me present the sorted Exception list from C#.

System.Exception

System.SystemException

System.AccessViolationException
System.AppDomainUnloadedException
System.ArgumentException
System.ArithmeticException
System.ArrayTypeMismatchException
System.BadImageFormatException
System.CannotUnloadAppDomainException
System.ContextMarshalException
System.DataMisalignedException
System.ExecutionEngineException
System.FormatException
System.IndexOutOfRangeException
System.InsufficientExecutionStackException
System.InvalidCastException
System.InvalidOperationException
System.InvalidProgramException
System.MemberAccessException
System.MulticastNotSupportedException
System.NotImplementedException
System.NotSupportedException
System.NullReferenceException
System.OperationCanceledException
System.OutOfMemoryException
System.RankException
System.StackOverflowException
System.TimeoutException
System.TypeInitializationException
System.TypeLoadException
System.TypeUnloadedException
System.UnauthorizedAccessException
System.UriTemplateMatchException

Microsoft.SqlServer.Server.InvalidUdtException

System.Activities.ValidationException

System.Collections.Generic.KeyNotFoundException

System.ComponentModel.Design.Serialization.CodeDomSerializerException
System.ComponentModel.LicenseException
System.ComponentModel.WarningException

System.Configuration.ConfigurationException
System.Configuration.Install.InstallException

System.Data.DataException
System.Data.DBConcurrencyException
System.Data.OperationAbortedException
System.Data.SqlTypes.SqlTypeException

System.Deployment.Application.DeploymentException

System.DirectoryServices.AccountManagement.PrincipalException

System.Drawing.Printing.InvalidPrinterException

System.EnterpriseServices.RegistrationException
System.EnterpriseServices.ServicedComponentException

System.IdentityModel.Tokens.SecurityTokenException

System.IO.InternalBufferOverflowException
System.IO.InvalidDataException
System.IO.IOException

System.Management.ManagementException

System.Printing.PrintSystemException

System.Reflection.AmbiguousMatchException
System.Reflection.ReflectionTypeLoadException

System.Resources.MissingManifestResourceException
System.Resources.MissingSatelliteAssemblyException

System.Runtime.InteropServices.ExternalException
System.Runtime.InteropServices.InvalidComObjectException
System.Runtime.InteropServices.InvalidOleVariantTypeException
System.Runtime.InteropServices.MarshalDirectiveException
System.Runtime.InteropServices.SafeArrayRankMismatchException
System.Runtime.InteropServices.SafeArrayTypeMismatchException

System.Runtime.Remoting.RemotingException
System.Runtime.Remoting.ServerException

System.Runtime.Serialization.SerializationException

System.Security.Authentication.AuthenticationException
System.Security.Cryptography.CryptographicException
System.Security.HostProtectionException
System.Security.Policy.PolicyException
System.Security.Principal.IdentityNotMappedException
System.Security.SecurityException
System.Security.VerificationException
System.Security.XmlSyntaxException

System.ServiceModel.CommunicationException
System.ServiceModel.Dispatcher.InvalidBodyAccessException
System.ServiceModel.Dispatcher.MultipleFilterMatchesException
System.ServiceModel.InvalidMessageContractException
System.ServiceModel.QuotaExceededException

System.ServiceProcess.TimeoutException

System.Threading.AbandonedMutexException
System.Threading.SemaphoreFullException
System.Threading.SynchronizationLockException
System.Threading.ThreadAbortException
System.Threading.ThreadInterruptedException
System.Threading.ThreadStartException
System.Threading.ThreadStateException

System.Transactions.TransactionException

System.Web.Caching.DatabaseNotEnabledForNotificationException
System.Web.Caching.TableNotEnabledForNotificationException

System.Web.Management.SqlExecutionException
System.Web.Services.Protocols.SoapException

System.Windows.Automation.ElementNotAvailableException
System.Windows.Data.ValueUnavailableException
System.Windows.Markup.XamlParseException
System.Windows.Media.Animation.AnimationException
System.Windows.Media.InvalidWmpVersionException

System.Workflow.Activities.EventDeliveryFailedException
System.Workflow.Activities.WorkflowAuthorizationException
System.Workflow.Runtime.Hosting.PersistenceException
System.Workflow.Runtime.Tracking.TrackingProfileDeserializationException

System.Xml.Schema.XmlSchemaException
System.Xml.XmlException
System.Xml.XPath.XPathException
System.Xml.Xsl.XsltException

Posted by: Sean | June 15, 2010

C# – OpenFileDialog

Prelude: After finding that I was not using my blog at all I decided it was time for a change.  So going forward I’m going to be using my blog to post little pieces of code that I find useful, usually pieces that I can never remember how to implement without having to search for.  I’m sure from time to time I’ll still post some ramblings, but essentially this blog is going full nerd.

C# – OpenFileDialog

The OpenFileDialog, as you may have already guessed, is used to display the dialog for opening files in DotNet.  There are basically two ways to use it, the first is through the control, the second is through the object instance.

Control:

Pretty straight forward, just drag the control onto your form.

image

Once that is done the control will appear in the bottom control bar (in VS).

image

From there you can set all of the properties for the control in the Properties window.

image

Note: You can find a complete listing of the properties here.

Since all of the properties are set in the control, there is no need to set them in the code (although you still can of course).  Implementation from there is simple.

if (openFileDialog1.ShowDialog() == DialogResult.OK)
    MessageBox.Show(openFileDialog1.FileName);

The ShowDialog() method is what does the work and actually displays the Windows dialog, to which you’re looking for a return value of DialogResult.Ok.

That’s more or less it for the control, pretty simple.

Object:

Using the OpenFileDialog as an object only really requires one more line of code, the creation of the object itself.

OpenFileDialog openFileDialog = new OpenFileDialog();

However, since there is no associated properties window we need to set the object properties in the code.

openFileDialog.InitialDirectory = @"C:\Users\Sean Thomas\Documents\";
openFileDialog.Filter = "PDF files (*.pdf)|*.txt|All files (*.*)|*.*";
openFileDialog.FilterIndex = 2;

The InitialDirectory and Filter are probably the two most widely used properties for this class. InitialDirectory is pretty straight forward, just sets the directory displayed when the ShowDialog() method is called. The Filter

property on the other hand is used to control the file filter dropdown on the dialog. The basic form for the property is <Display Text>|<Extension>. Each extension set is separated with a pipe.

Note: You can find a complete listing of the properties here.

From there the implementation is virtually the same as the control.

if (openFileDialog.ShowDialog() == DialogResult.OK)
    MessageBox.Show(openFileDialog.FileName);

Again, you’re looking for the return value of DialogResult.Ok.

Summary:

The OpenFileDialog class is a very simple, yet powerful class with many ways to customize it for use.  Similar to the OpenFileDialog class is it’s sister class; OpenFolderDialog (I’ll assume you can guess what it’s for).

For the complete write-up on the class check the MSDN documentation here.

Posted by: Sean | November 25, 2009

Protection, it’s not just for sex.

As a general rule of thumb I can expect at least one phone call a month from a friend who has inevitably found themselves a nice new virus on the internet to download and run.  Of course it’s never intentional, but then again it’s avoidable.

Think of the internet as a fair or carnival.  Sure it can be a lot of fun; food, games, rides and nakkid chicks……ok, so maybe the last one you won’t find at the fair, but follow me on this…

Think of the food, games and rides as the “seemingly” safe places on the internet; online banking, Oprah.com, Wikipedia & Facebook.  Why seemingly safe?  Well that’s where the human variable comes into place; Did that guy wash his hands before he made your food?  Was that fat slimy disease infested grease ball in the same seats as you on the ride?  Where are my pants?  Same goes for “safe” internet sites, just because it looks safe doesn’t mean it is safe.

Take Facebook and its latest virus, sent as a message (or wall post) from one of your friends.  However the fact that your friend actually sent it is the furthest thing from the truth.  It has actually been sent by a computer virus you downloaded from, most likely, completely different site.

So like any encounter with a circus midget, there is something you can do, get protection!

Depending on your level of dedication there are a number of options, but basically it comes down to if you want to pay for it or not.  Paying for software doesn’t mean it’s better, but it at least gives a bit more of a comfort level.

However there is a new option when it comes to free antivirus software now, and it’s actually a good one.  Microsoft, yes, I said Microsoft.  Queue tinfoil hats and MS bashing.

Microsoft has finally ponied up and created (or rather purchased) their own antivirus package; MS Security Essentials.  You can download it here.

If you want something a little more encompassing try Norton 360, I highly recommend it.  You can buy it here.

Posted by: Sean | September 10, 2009

Cool Flip-Style Clock Screensaver

I’ve been told that sometimes the simplest things in life are the best, and I can’t agree more.  Take for example; an Aston Martin, a vacation house in the Bahamas and a supermodel girlfriend, three simple things that would make me very happy.

Since I can’t quite afford any of those I have to compromise.

Screensavers are very simple and people love these things; fish tanks, fires, waterfalls and nakkid chicks!  Unfortunately we have this “policy” at the office about having nudity on our screensavers, geesh, losers.  Thankfully I’ve found the next best thing……ok, maybe not next best thing, but it’s pretty freaking cool.

Let me introduce you to the FLIQLO (no clue, don’t ask), it’s an old-school flip-style clock (as pictured below) and is available for download here.

Update: It appears as FLIQLO has updated the SS for Windows 7.

Enjoy.

cap_scr_fliqlo.jpg

Posted by: Sean | September 8, 2009

Why Live In The Frozen North?

Because shit like this only exists on the National Geographic channel! 

Screw world peace, screw global warming, screw H1N1, we need to band together as a planet and eliminate these things.  How do you even kill something like this?  Run it over with your car?  Pretty sure that would just piss it off, and it would find you, while you slept!  Clearly the only solution is to nuke it from orbit.

(It’s a Golden Orb Weaver spider found throughout the southern US, in case this thing isn’t freaky enough, they have been known to EAT BIRDS!)

Posted by: Sean | September 4, 2009

People of Wal-Mart

I really don’t know what to say, I thought Jackson Square was an interesting place to visit, apparently it has nothing on Wal-Mart. 

Enjoy, courtesy of www.peopleofwalmart.com (sadly they have a lot more pics).

69
71
83
64
54
53

38

22
20
17

 

Posted by: Sean | August 28, 2009

We are so screwed

SPL122148_001

Seeing bears scale walls on ladders puts us one step from living in “the Golden Compass”, where armoured bears form an army of indestructible killing machines, but at least their discovery of this Rosetta Stone, the key to unlocking new ways to catch and eat us, was a random accident that couldn’t be avoided.

A bear that got stuck in a skateboard park climbed up a ladder to make its escape. The animal had been stuck in the sunken skating bowl overnight and could not get up the steep-sided concrete walls on its own. Officials in the town of Snowmass, Colorado lowered down a long ladder, which the bear walked across before heading back to the woods. The bear was uninjured by its experience.

Well Jesus don’t teach the bears how to climb ladders! We need those walls, to separate the bears from our succulent arms and legs. What’s the second part of your plan, coat doorknobs in honey? Jesus Fuckin Christ, I’m scared to even turn around right now, one of these new Super Bears may have snuck up behind me.

(From What Would Tyler Durden Do [WWTDD rules, but does contain some not so work safe material])

Posted by: Sean | August 25, 2009

Does Microsoft Hate Black People?

Or maybe it’s just Poland that does, you decide for yourself.

Check out these two links, one is from the US Microsoft site, the second is from the Polish Microsoft site.

Seems Microsoft actually “Photoshopped” (badly I might add) out the black person on the Polish site.

Below is both images side by side for reference (or for when MS “adjusts” their site images).

Posted by: Sean | August 20, 2009

Nothing Like BBQ’d Babies!

Having the friends over this summer for a BBQ?  How about some BBQ’d babies!  Troubles finding the perfect grill for the occasion?  Try Sears under the category: Human Cooking > Grills to Cook Babies and More > Body Part Roaster.

Pic courtesy of Sears.com (of course they have since taken it down……probably sold out of em!)

Older Posts »

Categories

Follow

Get every new post delivered to your Inbox.