Archive for January, 2010
In the saga of trying to figure out where this phantom page is coming from I decided to host the site on my local machine and see if it was ASP.NET MVC 2 itself or my host. If you are reading this I assume you already know how to use IIS and create a web application. The issue i was having is that I needed the external service Web-Sniffer to get my site as a GoogleBot. So you will need the following to open up your site. A word of caution, this opens a port on your machine and could potentially be a security hole if left open.
What You’ll Need To Start
- Your Router IPN
- Your Internal IP Address
- Your External IP Address
- Your Web Application Port Number
Forwarding Some Ports
First log into your router using the IPN address. It is usually something like 192.168.1.1. Log in and forward the Web Application Port to Your Internal IP Address. This depends on your router so consult your manual about the specifics.
Opening Some Ports
Although your ports are now forwarded to your machine, all traffic will be blocked by the Windows Firewall. This next step will open those ports.
1.) Open up Control Panel and click System and Security
2.) Next Click Windows Firewall
3.) Next click Advanced Settings on the left.
4.) In the new window click Inbound Rules, Then Click “New Rule…” on the right
5.) Then in the new window select Port and click Next
6.) Proceed to type in your Web Application Port Number in the textbox
7.) And then just keep clicking next until you are done.
Now To See The Site
Open up your favorite web browser and type your External IP Address followed by the Web Application Port. ex. 99.99.999.99:8080. You should see your site come up. If your site doesn’t come up make sure that you are forwarding ports and that your IIS web application is running. You can also enable and disable the rules in the Windows Firewall Advanced Security panel. Good Luck.
No this is not the newest nerd science fiction film directed by James Cameron, instead this is my current problem with ASP.NET MVC 2 and it is a huge one. I was recently reading Justin Etheredge’s blog CodeThinked and his complaints about his Google page ranking. So being curious to how my main site was doing, I began using several tools to get an SEO grade for my main site. The first tool I used was WebSite Grader to give me a grade on my SEO.
This grade was poop! But I read a little more and realized that the page Website Grader had read was not my main page. How do I know that? Well for starters, I wouldn’t be stupid enough to keep a page’s title “Index”.
So what is the page the GoogleBot is seeing? I decided to use Web Sniffer a tool that let’s you mimic different clients and this is what I got.
WHAT THE F@$*%!!!!!! Where is that coming from. The amazing thing is that a page with a title and an empty body get’s a score at all! Obviously, if you go to my site you’ll realize that this is not the main page. What is also strange is that nowhere in my current application does this view exist, well how could it?!?! So as I tried some other pages to see what I would get, and check it out.
Ok so I got one page getting a grade. But something strange is occurring. The crawler tried to traverse a page that doesn’t exist! On the good side it did find metadata.
So what is the culprit here? I have no clue, but I am leaning towards routing. The strange “Services/About” page is giving me a strong a hint that something is not right. But routing wouldn’t explain the phantom view that I am getting. Who wrote it? Is it from some lost civilization of MVC developers and I was lucky enough to find it? “I See You” phantom ASP.NET MVC view, now you need to go away so my real page can get indexed, UGGGGG!
So I’ve been playing around with Cu3er, a great flash component for websites. It gives you the ability to create dynamic looking slideshows with great transition effects. I highly recommend you go over to Cu3er site and check it out. What I don’t like about Cu3er is that you can’t point it at a directory and let it pick up the image files dynamically. So I decided to help the .Net crowd with this little speed bump. I’ve done all the tedious work of mapping Xml to objects (trust me, I dislike doing this).
The main goal was to be able to drop images into a directory and update the configuration. I didn’t want to exclude anybody using Asp.Net, regardless whether you are using WebForms or ASP.NET MVC. So I finally ended up going with an HttpModule. The code executes every time a request is made and checks to see whether the contents of the image folder have been updated. For me it isn’t quite ideal, because I am reading the file system every time a request is made. I attempted to to use FileSystemWatcher but I couldn’t seem to get it firing in an ASP.NET environment.
So what are the advantages to using this HttpModule?
- Minimal editing of Xml. Just setup the main settings node in the config.xml file and it will be preserved.
- Could add great functionality to a CMS or dynamic site.
- Configurable from a configuration section
So What are the disadvantages
- Can only define one type of transition for all images.
- It is an HttpModule that fires every request (not ideal in my mind)
How do you make it work better for you?
- If you are using Asp.Net WebForms, create a HttpHandler that creates the configuration every time the config.xml is requested.
- If you are using Asp.Net MVC, create a controller action that returns a ContentResult containing the config.xml every time it is requested.
This is still an initial start to what I think can be a great helper to an already great flash component. Maybe V2 of Cu3er will have this functionality already built in, so this could be obsolete by then as well. But until then you are welcome to use this library and modify this library. I consider the code I wrote as an Alpha, if that. Realize that there could be bugs. Their is no warranty or guarantee expressed or implied (a little CYA).
To make this solution work you will need to do the following.
- Add a reference to the Cu3er .Net Library or Project to your web project.
- Add the configuration section to your web.config
- define the directory path to watch, and the location of the config.xml
- define the Cu3er module in the HttpModules section
- import the Html and Swf into the page you’d like to use Cu3er.
Check out the example I included with the Cu3er .Net project to see how to accomplish the steps above, and be sure to read the Cu3er documentation (the example is in ASP.NET MVC, but doesn’t really use the features of ASP.NET MVC to accomplish the goal).
This is from my old blog “Monster’s Got My .Net.” I didn’t realize that there was link to this on the OpenFlashChart site, so I am reposting it here for anyone that would like to use the code. Hope I didn’t inconvenience anyone.
So if you have ever had to write a report of any kind, you know how much your clients are itching to have some kind of chart on the page, and something with a lot of pizzazz. Well the problem is that those charts usually can cost you a pretty penny. Companies like Telerik and Infragistics offer great products, but for those with a budget (you cheap bast’d) there are great open source alternatives. The problem with open source sometimes is that it usually written to support multiple web technologies and not just ASP.NET. Everybody knows ASP.NET is the best and obviously these open source projects are written with a lapse in judgement, but forgiveness is the best policy because these projects can be awesome (just kidding about the lapse in judgement).
What I found in my search was Open Flash Chart,which is amazing. So I downloaded the project and installed it, and it had a .NET example in there (in chinese) and it worked but I didn’t like how it worked. I then looked on CodePlex and found someone who implemented a cool version of Open Flash Chart, but it didn’t work with the newer Open Flash Chart build. The newer version uses JSON. I decided to take both projects and merge them together to make a better mouse trap.This project was written using some of the new features of C# 3.0, so if you need to run it in 2005 then you might need to modify some of the code.
There are three aspects to this project: the ASP.NET Control, the Charts, and an HttpHandler. If you want to see the details of the infrastructure I suggest you look at the original author’s post, I only take credit for fixing it, but he wrote the ASP.NET infrastructure originally.
If you are intereseted in an Open Flash Chart control you can download the assembly here. I will also try to contact the original author and get the latest version on codeplex.
Note: The HttpHandler solution utilizes cache, which works until you try to use it on load balanced machines without distributed cache. You can point the control to data pages as a work around. Play around and see what’s in the code. All credit goes to the original authors, I greatly respect their work and have included credit in the example project.
Update : How Ironic, the download to the fix didn’t work. I think it works now so you can download it.
I love using Google chrome for my daily browsing, it just loads fast and does the job I need it to do (although I love FireFox as a developer). Anyways, I love using the quick search feature they have built into the browser. If you don’t know what I’m talking about I’ll show you.
First you type in Google.com, like below.
Then you press the TAB key, and you get the search box.
Nothing new here if you are a regular chrome user, but check this out. What if you don’t like Google (I bite my tongue a little as I say this). What if you like Bing? What if you like Yahoo!? What if you want to search WordPress.com?
Well all you have to do is type the address and press tab. Pretty cool if you ask me. This trick only works with certain sites, so play around with a few and see if you can’t discover one that is search enabled through the Chrome awesome bar.
No longer waste time navigating to the front page of a search engine, you could use those extra seconds for something more useful.
So we are sitting on what is the precipice of a new year. We can either choose to change and evolve with the times, or we can stay stuck in our ways. I have decided to make some new year’s resolutions to make me a better person and developer.
1. Get Into Shape
As developers we can spend a lot of our time on our butts, up to 8 hours a day. That is why I need to make a strong effort to be active. My definition of active is a solid hour of exercise five to six days a week. Exercise is only part of the solution. Did you know your body expends more calories digesting food then it does when you exercise? That is why I have to make an effort to eat less calories. Now that the holiday season is over, the temptation of gorging is gone with it. And finally, cut out all high-sugar drinks. Developers live off of energy drinks but each can of energy drink can be as much as 400 calories. That is equivalent to the calories found in a bagel! Replacing those drinks with water can cut out a lot of unnecessary calories.
2. Work On My Communication Skills
I can talk to people, but sometimes I don’t fully get my idea across. This can cause frustration on both my part and the listener. That is why I have to work on my communication skills. I will do this by being more conscious of the words I say, listen deeply to my counterpart, and being less abrupt with my answers. I will also be working on my vocabulary. Adding words to my vocabulary can give me a more diverse set of words to express my ideas and intentions.
3. Swear Less
Swearing is a powerful tool when used properly. It can express frustration, anger, and happiness all in a couple words. There have also been studies that show swearing can lead to better rapport between co-workers. That being said, I have to remember that there is a place and time to use certain words and phrases. For example, a holy place is no place to start dropping the F-Bomb.
4. Be More Systematic
I am trying more and more to depend on systems to make me more efficient and dependable. This will help me reduce times where I am just thinking of what to do instead of doing what I need to do.
5. Be More Assertive
Over my life I’ve learned that people can take advantage of you if you let them. They can also mistake your kindness for weakness. Letting the other party know why I won’t do something, or the conditions on what I’ll do given a task will make my life much simpler.
6. Give Love to the People that Deserve It
There are a lot of important people in my life, and some not that important. Giving more preference to those I love will make everyone happier.
7. Read, Read, Read
It’s surprising how much more knowledgeable you get by just reading what other people are doing. So I am dedicating 2010 to reading more.
The year is early and things could change, but for right now these are my resolutions. Do you have any?