.NET Discussion

.NET Issues, Problems, Code Samples, and Fixes

BlogEngine.NET: The First Stumbling Block

Let me start off by saying that BlogEngine.NET is a fantastic piece of software with a ton of awesome features and is relatively easy to use.

That said, I’ve spent nearly all of my free time in the past month building a custom site using the BE.NET framework as a base, and while it’s been frustrating at times (I basically had to teach myself C#), I learned a lot about programming just by getting into the core and messing around and seeing how things are linked up and organized. It’s been working great on my local machine (first hooked up to my local MySQL database and then hooked up to the hosted MySQL database) and I was really excited to upload it and get it going.

I fired up good ol’ FileZilla, took a deep breath, and hit “Upload” and watched with mounting anticipation as the 700-some files in the queue slowly (actually, really quickly, but it seemed slow) dwindled. Finally, it was time! I opened my browser, typed in my URL, and held my breath as IE7’s thinking circle went round and round.

That’s when disaster struck.

The YPOD popped up with an unfamiliar error message: “Unable to find the requested .Net Framework Data Provider.  It may not be installed.” Exqueeze me? What does that even mean?? My first instinct was that there was something wrong with my Web.Config file, so I checked there. Some idiot (read: me) forgot to change over the local DB string to the hosted DB string. Fixed. Uploaded. Ta-da!….. ? What? Still not working? Oy… this is going to be a long night…

Well, I did some digging and found out that my instincts were correct and that there is probably an issue with my Web.Config. I found a CodePlex thread by someone who got the same error and tried their solution, but to no avail. I also created my own thread, but as of this writing, no one has responded to my cry for help. I found this tutorial by Al Nyveldt and my spirits were raised again because he is one of the authors of the damn software, but again they were dashed when his tips were also unable to help me out. I even downloaded his sample Web.Config and applied it to my own.

I downloaded the latest MySQL/ASP.NET connector (5.2.3.0 as of now), placed it in my /bin folder and modified the versions in the Web.Config to match (they are 5.1.6.0 in the Web.Config). Still nothing.

With frustration and utter lack of any idea where to turn, I emailed both Mads Kristensen and Nyveldt beseeching them for advice on what to do. I don’t expect an answer (as I’m sure they get 290352268 emails a day from guys like me who are too dumb to figure out their software), but hopefully they will help me out.

Unfortunately, there is no happy ending to this story as of yet… no magical fix that I can present to you that will get you out of the same rut. But maybe I’ve pointed you in the right direction where someone’s suggestions may help you.  If you have any ideas, please please please post them or email me. If it works, I will definitely post your solution with a link to whatever site you want. I would not be surprised if it’s a one-line fix in my Web.Config that makes me smack my forehead. With a hammer.

Thanks in advance for any help you can provide!

EDIT: I’ve received a bit of help from the wonderful nberardi and we (he) came to the conclusion that my host is running a pre-5.1 MySql/ASP.NET connector (they are running an outdated MySql.Data assembly) [5.0.5.0, to be exact]). The 5.1 release included support for Roles and Memberships, so anything older than that will not work with this engine. Should they update it (or I go elsewhere) I will keep you posted.

8/30: SOLVED! But you’ll never guess what the problem was. You ready for this? My hosting company had a stray character in their Machine.config file that was right by the DbProviderFactories node… no, I’m not kidding. Everything is working fine now… I will post more on this tool later.

August 27, 2008 Posted by | BlogEngine.NET, Bugs, C#, Errors, MySQL | 5 Comments

AutoHotKey: The Greatest Program of All Time

Ok, so I know that this is a .NET blog, but people reading this are most likely programmers anyways, so I figured this would be at least somewhat relevent. If you missed the title of the post, AutoHotKey is the greatest program of all time.

If you are unfamiliar with what it does, basically you can create little shortcuts for yourself using their very simple and well-documented series of symbols and functions that will perform repetitive tasks for you.  For instance, I send a lot of emails every day to customers. Rather than type out “[Columbus Supply] Order: X[whatever] Thank you for buying from Columbus Supply!” into the subject line every time, I have created what’s called a “HotString” that types all that for me automatically! All I do is type “psubj” (a HotString I came up with) and it will type all of that out and then move the mouse to the left right in front of the X. This saves me maybe 10-15 mins a day, which may not seem like a lot, but it does a few things: it ensures there are no misspellings/typos, it reminds you to put the correct order number in, and it ensures consistency in subject lines. I have almost 20 of these scripts ranging from simple to complex (one script I have loads my entire purchase response letter into an email!). With all of these scripts used in a day, I’ve shaved a good 2-3 hours a day off of how long it takes me to process orders (and my typing is pretty good for the most part). Think about what you could do with an extra 2-3 hours a day.

My favorite new script that I came up with is a huge time-saver. I use Excel a lot to keep track of orders and I have several tabs in a templated order form. If you are an Excel user, you may well know that moving between tabs is not as easy as ctl+Tab, as that will simply move you between open Excel files. You actually need to hit ctl+PgUp/Dn to move between tabs. This is a bit awkward on the keyboard (especially on a laptop w/no easy NumPad), so I built a script that will move between tabs when I type ctl+right/left arrow key. I say “built” but it was really really simple. Here’s the whole script:

#IfWinActive ahk_class XLMAIN
^left::^PgUp
^right::^PgDn

Yep, three lines of code to create immensely easier tab paging that only works in Excel when Excel is the active window. The possibilities are literally endless.  There is some minor setup involved, but if you are somewhat computer-inclined (ie, you understand what’s going on in the contents of this blog), it should be fairly simple and straightforward.

What scripts have you come up with that have made your life incredibly easier?

August 26, 2008 Posted by | Tips & Tricks | | 2 Comments

State of the Coder: Code Complete 2, Promo Codes, BlogEngine.NET

I just recently purchased Code Complete 2 by Steven McConnell, and am quite excited to read it, especially after all the coding I’ve done recently.  I’ve heard some great things about the book, and being a self-taught programmer, I’m pretty excited to learn the right way to do and think about some things.  I can’t really review it yet (as I’ve read maybe 4 paragraphs in the preface as of this writing), but I will share some of the tips that I glean from this work as I get through it (more regularly than I have been doing).

I’ve been working on a few projects here, some for business and others for pleasure, and they’ve kept me busy. One of which is the building of a Promo Code engine into my site at www.columbussupply.com. Let me tell you, it’s no easy task, especially since PayPal does not accept negative amounts (pretty hard to apply a discount!), but I’m sure I’ll figure it out in time.  The problem has three parts: 1) how to display the discount to the user (easy), 2) how to track the promo/prevent it from being abused (harder), and 3) how to transfer the information to PayPal/Google Checkout so that the transaction appears seamless to the user (hardest).

This third part has gotten me stuck a little. I don’t want to change the display to the user, but I need to find a way to transmit the discount to PayPal. One idea was apply the discounted amount to the last item in the cart (that has a price higher than the discount) with a note on it that mentions the promo code. That may work, but it may be confusing and is definitely kludgy. Anyone have any ideas how to combat this?

As for my pleasure work, I’ve been hacking away furiously at the newly released 1.4.5.0 version of BlogEngine.NET, which has been pretty fun, for my Ultimate Frisbee team’s website, www.madcowultimate.com (as of this writing, there’s nothing there, but there will be very soon). BE.NET is a great open-source blogging framework that is very well-designed and somewhat easily customizable. The official version is in C#, but there’s also a VB.NET version floating around. I considered the VB.NET version for a bit, but I decided to stick with the C# version for a few reasons, the main being I realize I need to learn C#, and that some of the techniques they use in this app are so advanced that I wouldn’t know what they were in VB.NET or C# or even English. So far I’ve had pretty good success and I’ve learned a whole bunch about the language as well as good coding practices. I would suggest that even if you don’t want to use it, you should download it just to look at how it was built (how often do you get to peek at the work of professional .NET coders?). 

I’ve discovered (reported, and corrected!) a few bugs, added some new features, built my own theme, and created my own widgets (somewhat) successfully. I’ve also opted to use the MySQL option included with the app, which has been awesome for me because that’s the DB I’m most comfortable with.  Overall, I’d rate this app very highly because there are a ton of features that you can use (even though I probably won’t use half of them) and it is so easy to modify.  Occasionally you may have to dip into the Blogengine.Core if you REALLY want to customize things (such as create your own data access methods), but so long as you don’t mess around too much, you should be fine.

Anyone else having a good ol’ time with BE.NET? I’d like to see your work!

August 15, 2008 Posted by | ASP.NET, Books, C#, Google, MySQL, PayPal, Tips & Tricks | | Leave a comment