| Subcribe via RSS

Add Home Page Link to Menubar in WordPress Blog

October 11th, 2009 | Comments Off | Posted in HTML, WordPress

It is about the most basic thing in the world to start a menu navigation bar with a link to your home page, but for some reason many nice WordPress templates seem to have overlooked this essential element. It will list out your categories fine, but no go on getting you back to the beginning. Let’s fix that oversight. In your header file under Appearance > Editor (this file may be called something different depending on the template you are using), we’re going to look for a line of code that looks like this:

That is where these category options are getting inserted. Now to append a link to the home page to the beginning of these links simply precede the above line with the following code:

Reading Files from a Directory using C#

April 24th, 2009 | Comments Off | Posted in C#, General, HTML, IIS, Programming, VB.NET
So I had a project which I needed to find out what files were being held in a given directory and write those back to the browser. This is very helpful in automating posting of files to a website by your users without you being involved in tedious static html updates. The key here is the System.IO .NET class. We are going to access the DirectoryInfo class so we can iterate through and pull back all file objects contained within. In the code below, the DirectoryInfo looks in the current directory as we’ve defined through Server.MapPath(“.”). We could just have easily directed this through stepping up the directory (i.e. c:\intepub\wwwroot\directoryread\filestoread\). Next, we tell it to grab all the files that end with an .aspx extension which screens out any text or pdf files we may not be interested in. In the FileInfo class, we extract the name of each file to wire up the hyperlink and print this back to the user. I’ve taken it one step further to strip out the hyphens and the .aspx file extension that we print back to the user so the file name “Reading-files-from-a-directory-using-csharp.aspx” becomes “Reading files from a directory using cSharp”. Much cleaner and user friendly. That FileInfo class has lots of cool properties including LastWriteTime, CreationTime, Length (for a full rundown on the FileInfo properties checkout Microsoft’s .NET Framework Developer Center). Tags: , ,

Replicating Google Ad Formating:Fonts, Color, Layout

March 18th, 2009 | Comments Off | Posted in Google Adsense, HTML

I was talking with a client and they were wanting to ramp up the dollars they were bringing in via Google AdSense. They directed me to a homeschooling website that was making good money off Adsense and Amazon ads. The site looked like HTML 101 / My first website and the client said if this plain jane website could monetize that well imagine what her site could do. The obvious thing that was escaping her was that this site had been around for 10+ years and was loaded with content. Can you imagine having the foresight to get on the web 10 years ago? The one thing I did notice was the vanilla website actually gave her a big advantage from the Google Adsense perspective. Strip out all the fancy CSS and styles, and the links to her articles looked very similar to the Adsense. The way she interspersed the blocks of ads, it was next to impossible to tell when you were clicking on an article and when you were hitting an ad. While I have no desire to turn back the clock to the web styling of the mid-90s, there is something to be said for this approach.

Today I thought I would look at replicating the format of the Google Adsense. How to go about finding the font size, color scheme, general layout. Once I have that, I can format certain sections of my site to generally match these blocks. So to get at the formatting, we need to do a right click over the Google Ad (not a left click, this isn’t a lesson in how to commit click fraud) and scroll down to This Frame >> View Page Source. This tells you that the Google Adsense block is basically being drawn into a frame. Once you get to the HTML, you get a glob of code that writes out the styles and the rendering of Google Adsense. Taking the basic leaderboard I’ve reassembled it to house two of my own links.

For added fun I included the Google Ads logo, I’d probably leave that out if I were you. Anyway here is the end result. Nothing flashy just a replication of the leaderboard format. This can be done with any of the various ad blocks offered.

Find Sold Out Theatre Tickets
To the Hottest Shows in San Francisco
  
Find when Taylor will be in your town
Tour dates, tickets and information

Tags: , , ,