Oct 12 2011

Bad Word Blocker Extension for BlogEngine 2.5

Category: BlogEngineBrian Legg @ 15:26

After writing the AdSense widget and extension I decided to try writing another one that I've seen requested on a number of blogs/forums. This is simply a word replacing extension which is most likely usefull for replacing curse words in user comments. The extension is just a list of words which must be replaced and words to replace them with. You may add, edit, or remove them at any time. I could also see this being usefull for other things as well such as adding your own comment markup or whatever else you can think of that you would like to replace in the comments text.

I also wanted to try writing my extension to work with the new BlogEngine 2.5 features. So, the settings for the BadWordBlocker are unique to each blog instance it's configured/enabled for. There are also 187 predefined curse words and replacements initially loaded to hopefully save you some time. If you don't like the initial list you may edit or remove them as needed. I gathered the list of dirty words from here. More...

Tags: ,

Oct 6 2011

AdSense Extension and Widget for BlogEngine 2.0 - 2.5

Category: BlogEngineBrian Legg @ 12:13

BlogEngine is a great tool for writing Blogs, and I use it to run this site. One of the great features about BlogEngine is that you can write your own extensions for just about anything you can think of. One of the things I wanted to add to my blog was a way to easily integrate AdSense ads. AdSense is a program provided by Google to generate a bit of income from your blog in the form of advertisements. If you haven't created an AdSense account you can do so at Google AdSense.

After signing up for Google AdSense you will need to create 1 or more Ad Units. Each of these will give you set of code to insert into your website. The code will look similar to the following based on your selections:

<script type="text/javascript"><!--
google_ad_client = "ca-pub-xxxxxxxxxxxxxxxx";
/* AdUnit Name */
google_ad_slot = "xxxxxxxxxx";
google_ad_width = 160;
google_ad_height = 600;
<script type="text/javascript"

I wanted my Google Ads to show up in 2 places: my sidebar on the right (which is a collection of widgets) and I wanted them to show up in the middle of my longer blog posts where the right side bar would no longer be in view. To do this I needed to create 2 extensions to Blog Engine: a widget and an extension. Here's how they work. More...

Tags: , , ,

Sep 30 2011

First .NET User Group Presentation

Category: GeneralBrian Legg @ 11:20

I gave my first presentation tonight to the Omaha .NET User Group (OmahaMTG) covering an introductory look into XNA 4.0. The presentation followed very closely to my previously posted tutorial an introduction to XNA. The entire presentation took only about 30 minutes but I didn't get to cover nearly as much as I would have liked to. I was originally planning to write an entire (small) demo game from scratch as part of the presentation but it would have ended up taking too long. I ended up writing the game ahead of time and then commenting all of the code. I then uncommented a section at a time to demonstrate different aspects of the game. This ended up working out pretty well as far as presentations go. I was able to cover a lot more concepts then I would have otherwise given the time saved by not having to code it on the spot. Still, I wish I could have covered XBox 360 controller support and the use of timers.

For those interested, I've provided a link below to the presentation slides and code. This is the exact same code I used during the presentation which lacks a lot of the features I wanted to cover. If you find this helpful or interesting make sure to visit my full post which covers this same material in more detail and also includes many other features I couldn't get to. More...

Tags: , ,

Sep 26 2011

WCF Certification - Achieved!

Category: GeneralBrian Legg @ 11:02

I took my Windows Communication Foundation (WCF) Development with Microsoft .NET Framework 4 exam today and passed with 850/1000. This was Exam 70-513 and is 1 out of 4 tests needed to obtain the Microsoft Certified Professional Developer (MCPD). I haven't decided yet if I'm going for the Windows or Web MCPD but they both require test 70-513, so I figured I'd start with that. If I can make any suggestions to anyone else trying for this certification I would recommend reading "Essential WCF for .NET Framework 3.5" and "Pro WCF 4 Practical Microsoft SOA Implementation (Apress)". The Essential book was very heavy reading but it got me very comfortable with the terminology and language of services. I favor the Apress book more for practical reasons but it's not enough by itself to pass the exam in my opinion. For those who are planning to get certified here is a brief overview of getting your MCPD. I am not affiliated with Microsoft so please check back on their official site for possible changes to the program. More...

Tags: , ,

Sep 19 2011

Introduction to XNA 4.0

Category: Novice | XNABrian Legg @ 09:49

If you're already familiar with .NET (either VB or C#) and you want to start creating video games for the XBox 360, Windows Phone, or Windows PC then XNA is exactly what you're looking for. This post is not intended to be the all-encompassing learn everything about XNA tutorial. I'm creating this as a starting point for those who have never used XNA before and want to jump in quickly and also as a reference point for those (like me) who frequently forget some of the basic things you set once and forget about. I like to keep explanations short and prefer to demonstrate things using code, so if you want to know more about how XNA works internally you'd be better off getting one of the many books out there on the topic. On the other hand, if you just want to start coding a game right now to see how XNA works you've come to the right place.

What this post will cover

  • Full screen game
  • 2D graphics
  • Keyboard, Mouse, and XBox 360 controller support
  • Sound effects
  • Collision Detection
  • Sprites
  • Keeping score and using Fonts

What this post will NOT cover

  • The installation of XNA Game Studio 4.0
  • Proper game architecture
  • 3D game design
  • Animation
  • Models
  • Asset Creation

The only prerequisite for beginning this tutorial is the XNA Game Studio 4.0 which is available from Microsoft's website. I intend to keep this game extremely simple and it will NOT be anything worth keeping. However, I hope you learn a lot while writing it. Here's a brief description of what we'll be making - A mouse and keyboard (or XBox 360 controller) controlled dinosaur which can roar and eat meat. Each time he eats a piece of meat it will be replaced somewhere else on the screen and a score will be kept in the top right corner. Without further ado, let's get started. More...

Tags: , , , , ,

Sep 11 2011

Heartland Developers Conference 2011

Category: GeneralBrian Legg @ 11:04

The Heartland Developers Conference was held in Omaha, NE this year. This was my first year attending and I have to say it was a great experience. There were sneak peaks into new stuff Microsoft will be releasing soon such as MVC4 and Visual Studio 2011. I'm sure I'll blog about some of these things once they're released. There were also quite a bit of presentations related to proper UI design and looking at applications through the eyes of a user. One really good example they gave was how LinkedIn gives you a score based on how complete your profile is. This gives the user an indication of how much they have left to do and actually motivates the user to use your site more. There were also a few presentations related to jQuery and RESTful services. I attended the OpenRasta jQuery hands-on lab but had to leave early due to a production issue at work. More...

Tags: , ,

Sep 10 2011

Rubik's Cube Challenge

Category: GeneralBrian Legg @ 14:11

I just completed competing in the first Omaha .NET User Group code challenge and I took second place together with my friend Dustin Horne. The challenge was to solve 5 rubik's cubes in the fewest number of moves in the least amount of time. MattB took first place but I can feel good knowing we gave him a run for his money. We basically went back and forth beating each other until the very end.

Scoring for this challenge was very interesting. You start with 100,000 points and you lose 1,500 points for every move you make along with another point for every millisecond your code executes. Each cube you solve is given its own score and then these 5 scores are averaged out to come up with your final score. The 5 cubes you are passed are in fixed positions to prevent scores from changing after multiple runs and the 5 cubes are passed in a random order to prevent cheating. Our final score was 63,659. Here is a break down of our code results: More...

Tags: , ,

May 9 2011

Implementing your own RoleProvider and MembershipProvider in MVC 3

Category: Intermediate | MVCBrian Legg @ 15:34

At some point you probably realized that users will need to log into your website. Identifying who your users are is known as authentication. You may also need the added ability to know what resources each user is allowed to access. This is accomplished in the form of roles using authorization. This functionality is built into the MVC framework right out of the box in the form of the Login control and the ASP.NET default membership and role providers. If you're like me you may want more control over what data is stored for a user and how it is stored. Towards this end we'll be implementing our own method of authorizing and authenticating users in this post. There are several different ways to do this depending on the level of control needed. We'll begin by doing the bare minimum and we'll add on more complexity and specialization as we go. Feel free to implement the parts you need and use the out-of-the-box features that do not need custom implementations. I'll try to keep these sections separate from one another to make following along easier.

For the purposes of this tutorial we'll use the following scenario: Our website supports a local bank. There will be two available roles for users: Member and Administrator. When storing customer information we will be interested in thier name, username, email, password and their role of course. More...

Tags: , , ,