C# Priority Queue Implementation for Silverlight

While writing some code for Silverlight, I realized that Silverlight does not include a PriorityQueue implementation in their libraries.  I searched around, but I couldn’t find any code that I thought was decent, so I wrote up something pretty quick.  I’ll be testing this some more in the near future, but for now, I think it has the basics.  This should be fairly quick for large collections, as the enqueue is logarithmic, while the dequeue is pretty much as fast as it can be. ...

October 20, 2008 · 3 min · filip

Very nice and flexible file upload control with progress

I needed a pretty quick way of displaying file upload progress in a ASP.NET project. In the past while working for a different employer, I’ve written my own code from scratch, and it was a complete pain in the ass.  Fortunately, after doing a bit of searching, I’ve ran across an open source control that works great.  The control is called NeatUpload and can be found at this URL: http://www.brettle.com/neatupload

October 18, 2008 · 1 min · filip

Server Side Includes (SSI) adding a blank/empty line to HTML page

While creating a page that used server side includes, I ran into some very strange behavior.  Right before each SSI, a blank line would appear on the page.  It didn’t have anything to do with margins or padding.  It was just like an empty line appeared right out of nowhere, messing up the layout.  First, I thought it was some problem with IIS and SSI, but I couldn’t find anything there. ...

August 28, 2008 · 2 min · filip

Using LoadVars sendAndLoad instead of WebService when calling web services with Flash ActionScript

I’ve ran into issues using the WebService object in Flash.  The thing is incredibly buggy.  In certain cases, it works just fine, but in other cases, it flat out does not work. In my last case, the web service loaded perfectly fine (onLoad was called), but the PendingCall would not return anything.  The onFault method was never called after I invoked my web service call, but the web service never returned either.  Examining the outgoing messages from Flash (using HTTP headers in Firefox) revealed that Flash was never even attempting to call the web service.  Flash did correctly acquire the crossdomain.xml file (which allowed access from all domains), and it did load the WSDL.  But, for whatever reason, it did not call the web method like it was supposed to. ...

August 14, 2008 · 2 min · filip

Can electronic drums be classified as drums?

We had a rather silly argument at work today. A co-worker claimed that electronic drums are not drums, but something entirely different. Now, I generally don’t post about all the silly arguments we have at work (there’s a new one every day it seems), but this one just is way over the top in my mind. My first method of argument was, basically, that the term “electronic” (or electric, I consider those to be the same in this particular context) is simply an adjective that describes something.  So, just like all red robins are a subset of robins, electronic drums are a subset of drums.  However, this was not satisfactory, and the co-worker brought up the term “straw man”.  He stated that a straw man is not actually a man.  Fine, I’ll give him this, although it is certainly a rather weak argument since the context must be entirely different for this to be valid. ...

July 22, 2008 · 3 min · filip

nJoy Electronic Cigarette Review (Part 2)

It has been 6 days since my nJoy Electronic Cigarette Review (Part 1). My biggest complaint in that review was the price of the refill cartiges.  Thanks to some help from very kind people at the e-cigarette-forum.com, I found out that e-liquid (smoke juice, whatever you want to call it) is actually available for purchase.  A couple sites that offer it, such as ePuffer and e-cig; however, both were out of stock (after researching this some more, I found out that e-cig.com has temporarily suspended shipping due to the Olympics and tightened security for sending liquids – they’re based in China).  Well, fortunately, we have eBay, and I was able to purchase my very first bottle of the liquid. ...

July 15, 2008 · 3 min · filip

nJoy Electronic Cigarette Review (Part 1)

A week or so ago I ordered the nJoy electronic cigarette.  I’ve tried to quit smoking before, and although I had no problems stopping (apart from the 1-2 day nicotine withdrawal), I’ve always felt like starting up again because the thing I was really addicted to doing was the action of smoking.  Well, over lunch one day I heard someone talking about electronic cigarettes, so I decided to look it up.  The fact that these seem to be relatively harmless (no tobacco, tar, carcinogens, etc.) was very appealing, and I could fulfill my desire to actually inhale something. In the past, I’ve tried nicotine patches (I actually got poisoned from one), but as I pointed out before, the thing I miss most when I stop smoking is the actual action of smoking, not the nicotine itself, so, needless to say, the patch didn’t work. ...

July 9, 2008 · 4 min · filip

IE8 and AjaxControlToolkit – Visibility bug

Well, I finally downloaded IE8 to see how some of the sites I’ve worked on behave.  Most things work just fine, however, I did find a pretty significant problem with the AjaxControlToolkit. I’ve been using the Tab control quite a bit, and I noticed that, when switching between tabs, the new tab was not showing up.  The old tab was hiding, though…  Debugging has led me to the setVisible method located in “Common/Common.js” in the AjaxControlToolkit.  Specifically, the problem existed in the following code: ...

June 18, 2008 · 2 min · filip

Using JavaScript methods in C#

I ran into a weird problem today.  I needed to escape a string in c# in such a way as to be able to unescape() it later with JavaScript into the original string.  JavaScript has an escape() method that is able to do this, but since I’m writing the code in C#, I can’t really access that method.  At first, I looked into HttpServerUtility.UrlEncode() and the HttpServerUtility.HtmlEncode() methods, but those are not equivalent to JavaScript’s escape() method.  ...

June 4, 2008 · 1 min · filip

Microsoft JScript runtime error: ‘null’ is null or not an object

Programming JavaScript can be fun, but sometimes when I get errors like this it can get a little frustrating… It happened on the following line, where the variable ‘o’ was null: o.onmousedown = Drag.start;

May 28, 2008 · 1 min · filip