Closed for now

Trying to clean up all my social media/blogging/email locations as it’s just too much to keep track of.

So there will be no more posting over here for the time being.

I will be moving everything to my Blogger account (for simplicity sake) and Tumblr.

 

Tumblr Account

Hey all. I’m thinking of moving to using tumblr for blogging over my two current blogs (Thank you work for blocking word press logins!).

I’m just trying to consolidate and simplify my posting since I do not post often, no one really reads these anyways (>.<), and I am playing around to see what I like the best.

You can see my new posts here: http://jebrewer.tumblr.com/

Learning new things Update.

Previously I posted about working with the MVC Music Store Tutorial.

I have recently finished it and now I wish I picked up MVC earlier!

It was a great start to learning how MVC works and it’s structure. It reminded me of my Java Programming classes and how we built in class sites using MVC design pattern that I learned last year.

It is my goal in the next year to be able to build a few work projects in MVC once we upgrade and get permission to use .Net 3.5 or 4.0. (The company I work has been moving very slowly but things are in the works to push us forward.)

I will defiantly be visiting the MVC Site more often now.

-Jason

Learning new things.

Learning something new is important to being a good developer. If you keep sticking with only what you know and never learn something new you become pretty worthless to any company that moves forward with technology.

The problem is that when you look at all that is out there new to learn it can be very daunting and overwhelming to pick what to learn first. This is something that I’ve been facing for a few months now myself.

At work I am a “Jack-of-all Trades” type of person. I build and maintain web apps, work with SQL and SSIS packages for making simple reports and spend a lot of time trying to figure out what my predecessors did and why they choose to build several overly complex applications that are a mix of a C# windows app, Classic ASP3.0  and non intuitively named SQL database that either tie into some Frankenstein Crystal report generator or massive data migrator application between separate SQL 2000 & 2005 servers to mirror data.

When I was trying to think of what I wanted to focus my learning efforts on I didn’t’ know if I should focus on web, database or even just drop those and try my hand at project management.  While I would like to enhance my skills in all three areas I knew full well I needed to pick one now to move forward in first. So I choose to focus on being a better web developer and take time learn .Net MVC.

Of course this seems daunting in itself as well. Thankfully to get started there is this a nice tutorial that cover all the basics while letting you be hands on in learning ASP.NET MVC. It is the MVC Music Store (link below) and from their codeplex page:

Project Description
MVC Music Store is a tutorial application built on ASP.NET MVC 2. It’s a lightweight sample store which sells albums online, demonstrating ASP.NET MVC 2’s productivity features and data access via Entity Framework 4. See what you can do with MVC 2 in under 1000 lines of c# code!

Overview
•    Demonstrates ASP.NET MVC 2 Templating, Data Annotations, and Validation
•    Shows Client-Side Validation, jQuery, and use of AJAX helper methods
•    Includes store browse, shopping cart, checkout, and membership
•    Shows data access via Entity Framework 4
•    Illustrates use of ViewModels
•    This tutorial requires Visual Studio 2010 and ASP.NET 4.0

I hope to post more about how this tutorial goes and how easy it was to learn from in the future.

MVC Music Store

-Jason

Simple "Access List" authentication for internal website.

I often have to build small “one-off” apps to do updates to the database for my company’s mortgage software. Due to the way the software was built by our vendor direct SQL updates to change a value in a loan application are not allowed as you have to update several tables in order to trick the many constraints to “think” the software is running in memory with the loan in question open. This reason for this type of security is that when you update specific field in the system there can be several other scripts firing to update other data points within the loan (recalculation interest, changing documents, and other validation type checks).

To get around this problem I have created a VB.Net Web script that is embedded into a web service that will open the loan in memory and update a specified field then close the loan to commit the changes. (More about this service in a different post.)

Often these one-off applications I make are only used by the internal support group and never by end-users. To make things a bit easier for our support people I have made a simple authentication checker that takes the windows user ID the system is logged in as and runs it through a list of valid users that are listed in a XML document and allows access to these little tools I build. If you are not on the list it will return false and won’t let you in.

This methos should go into the Session Start method of global.asax of your web application.

Here is a sample of the XML Document:

<?xml version=”1.0″ encoding=”utf-8″ ?>
<!–This is a list of users authorized to preform actions is this webpage.–>
<userlist>
<user name=”Jason Developer” id=”JD8564″/>
<user name=”Joe Tester” id=”JT9877″/>
<user name=”Jane BA” id=”JB0251″/>
</userlist>

Here is the method I built*:


protected void Session_OnStart()
{
Session["isValid"] = false; //Assume they are not authorized

IIdentity WinId = HttpContext.Current.User.Identity; //Read the window's ID of the person logged into the machine connecting to the site
string userid = WinId.Name.Substring(WinId.Name.ToString().IndexOf('\\') + 1);

Session["LoggedInUser"] = userid; //just for testing to see what is being captured

Hashtable userTable = new Hashtable();//Hash Table to store a User list (ID and Names)

XmlDocument xmlDoc = new XmlDocument();

xmlDoc.Load(Request.ServerVariables["APPL_PHYSICAL_PATH"].ToString() + "UserList.xml");//Load the XML Doc that is a list of "Allowed users"

XmlNodeList xmlNode = xmlDoc.GetElementsByTagName("user");

//Put the XML List into the HasTable
for (int i = 0; i < xmlNode.Count; i++)
{
XmlAttributeCollection xmlattrc = xmlNode[i].Attributes;
userTable.Add(xmlattrc[0].Value.ToString(), xmlattrc[1].Value.ToString());
}

//Verify the person logged in is allowed to access site
//Loop through the hashtable, get names and id of user and set them into session for use
foreach (DictionaryEntry ent in userTable)
{
string Key = ent.Key as string;

if (ent.Value.ToString().Equals(userid))
{
Session["isValid"] = true;
Session["UserName"] = Key.ToString();
Session["UserID"] = ent.Value.ToString();
break;
}
}
}

* Note: You will need the following references:

using System.Security.Principal;
using System.Xml;
using System.Collections;

*Update: Fixed code to actually work when deployed on a server.

Scott Guthrie’s Blog on ASP.NET

There are many places to get information about .Net and developing the different technologies supported in the .Net framework. One in particular I’d like to bring attention to is Scott Guthrie’s Blog.

If you do not know who he is there look at his about page for just one of the many reasons to follow him if you are a .Net developer.

He is very informative and gives examples and explanations on what is coming from Microsoft and how to use the changes for developers that want to stay ahead.

Additionally he put out a list of links periodically to sites where you can get great information about ASP.NET, Visual Studio, .NET, MVC, Ajax, and jQuery.

I highly suggest heading over there and set your RSS feed to include his posts.

-Jason

Changes…

I’m still learning WordPress and feeling out the best theme that I like and is easy to read. So the look of the blog may change for a bit for the next few days.

-Jason