Thursday, September 29, 2011

Create Header Row in Excel 2007

Every time I need to do this, I always have to look it up. I have the memory retention of a scratched CD. I paste something into Excel, I need to srot it, and I don't wnat the column headers to be included in teh sort. I figured since I'm stupid and have to look it up every time, there are probably a lot of other people who have to look it up to, so I'm posting it here:

View tab --> Freeze Panes --> Freeze Top Row

Baaaaaa-BAM!

As an aside, hey Microsoft, how about you put it in the right click menu? You know, I select the row, right click, and right there for all to see is an option Make Header Row.

After over a decade of Excel you'd think they could make this easier.

Tuesday, April 06, 2010

ASP: Determining Variable Types with TypeName Function

If you've been working in ASP for any length of time, you know you don't have to type variables. You just declare them using the DIM statement. Heck, you don't even have to declare them if you don't want to (but I don't recommend it).

But what if you're perofmring some sort of calculation on a variable, or you're doing some sort of boolean check after manupulating it or getting a value from a database? Or you want to put it into a database field that's been typed and you don't know if it matches and you need to convert it first?

Well here's a handy function you can use to determine what type of varient the actual value of the variable is: TypeName()

It works like this:
var = 1
Reponse.write TypeName(var)
In this case, the output would be
Integer
I've found this to be especially handy when dealing with values being returned from a database or when validating variable type to prevent an SQL injection attack.

Let's say I'm using a QueryString variable to pass a record id to a page, and then I use that id to pull a record from the database. So my URL might look like:
http://www.MySite.com/results.asp?rid=223
In this case I can validate it by
intRecordID = Request.QueryString("rid")
If TypeName(intRecordID) = Integer Then....
It's also handy when telling the differnece between NULL and an Empty String. Anyone who's done development knows that just because there's nothing in the variable doen't mean it's actually empty, since NULL and Empty are treated differently.
If TypeName(TheVar) = Empty then...
or
If TypeName(TheVar) = NULL Then...
Handy, especially whn doing some sort of conditional aggregate of data from a database pull where you're combining things.

Here's a list of all the different types than can come back:

Empty
Null
Integer
Long Integer
Single
Double
Currency
Date String
Object
Eror
Boolean
Variant
Byte
Array

Wednesday, March 31, 2010

Don't be a Programmer

My advice as a software engineer since 1999: Get out of programming as fast as you can. Go into Server Admin or Network Security.

Programmers are the ditch diggers of IT. In my experience, at least working in the large corporation world, they are treated like crap, constantly saddled with unrealistic expectations and time lines, and inevitably take direction from someone who has absolutely no experience or knowledge of programming. Even if your immediate manager is a Good Guy, his boss won't be, or his boss.... point being sooner or later as you go up the chain you run into that guy who thinks all programmers are liars and are way overpaid, and everything is easy and should only take 1 day. And testing? We don't have time to test! We need to DELIVER!

Sales people will promise the clients anything to get the sale, then dump it in your lap, take their fat commission, and go on vacation, leaving you to eat the shit sandwich they just made.

Customers will want more more more faster faster faster and, since they write the checks, that's what you'll have to produce. Scope creep? More like scope sprint. And forget about getting extra time. You don't need extra time! It's just a few additional features. How hard can it be?

You'll bust your ass for 8 months to build an in-house accounting system that saves the company 3 million a year and your bonus will be a shitty free breakfast with the CEO. And then the programmers start disappearing because guess what? The system is built and we don't need all those programmers any more!

That's right, programmers are the first to go. They're over paid and no one understands what they do anyway. Beside, you only need carpenters when you're building the house. Once the house is built....

But guess what. The Network still has to Network and be secure, and the Servers need to Server.....

So bail on programming NOW, before it's too late.

If you absolutely, positively are convinced things will be different for you (and they won't) and you want to stick it out, got for a hybrid like database development/admin. You can do database development and design to satisfy your desire to create, but when there's no development to do and all the programmers are getting fired, they'll still need a DBA to keep the Database up and running....

Tuesday, March 02, 2010

Google Keyword Competition Script

In addition to web development, I also do my fair share if Internet marketing and Search Engine Optimization consultation. One of the methods at the core of SEO is keyword research. There are plenty of tools out there for doing keyword research - Micro Niche Finder, Keyword Elite, Market Samauri, just to name a few - but I prefer to do it myself using the Google Adwords Keyword Tool (GAKT) and Google search.

I use GAKT to identify likly keywords related to whatever market I'm researching, and I then go straight to Google to check:

Broad competition (total number of results on a search performed without quotes)
Exact competition (total number of results on a search performed with quotes around the keyword)
AllInUrl (allinurl:keyword)
AllInTitle (allintitle:keyword)
AllInAnchor (allinanchor:keyword)
AllInText (allintest:keyword)

These searches bring back numbers that let me evaluate the competetiveness of the keyword - that is how easy it might be to get well ranked in Google's results.

As you can imagine, typing all that is a pain, so just yesterday I wrote a little ASP script that goes out and gets all the info for you:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Google Keyword Competition Stats </TITLE>
<style type="text/css">
body {font: normal 12pt arial}
</style>
<!--
If would be nice if you left in the below, but if you get some sort of savage glee by deleting it, then have at it.
Script by Dave, AKA Wedango on the WarriorForum
ASP blog: http://retrowebdev.blogspot.com/
He also does web sites and stuff: Webdango.com
-->
</HEAD>

<BODY>
Enter Your Keyword
<br><br>
<FORM METHOD=POST ACTION="goog-stats.asp">
<INPUT TYPE="text" NAME="keyword">
<INPUT TYPE="submit">
</FORM>
<%
Dim strKeyword

strKeyword = ""
strKeyword = Trim(Request.form("keyword"))

If strKeyword <> "" Then
Dim objXMLHTTP, strURL, iBroadComp, iExactComp, iAllInURL, iAllInTitle, iAllInAnchor

Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")

Response.write("Results for <b>"&strKeyword&"</b><br><br>")
'broad competition
Response.write("Broad Competition: "& fKeywordStats("broad",strKeyword) &"<br>")

'exact competition
Response.write("Exact Competition: "& fKeywordStats("exact",strKeyword) &"<br>")

'allintitle
Response.write("All In Title: "& fKeywordStats("allintitle",strKeyword) &"<br>")

'allinurl
Response.write("All In URL: "& fKeywordStats("allinurl",strKeyword) &"<br>")

'allinanchor
Response.write("All In Anchor: "& fKeywordStats("allinanchor",strKeyword) &"<br>")

'allincontent
Response.write("All In Text: "& fKeywordStats("allintext",strKeyword) &"<br><br>")

Set objXMLHTTP = nothing
End If
%>

<%
Function fKeywordStats(TheType, TheKeyword)
Dim strURL, strHTML, vStart, vEnd, vLength

vStart = 0
vEnd = 0
vLength = 0

Select Case TheType
Case "broad"
strURL = "http://www.google.com/search?hl=en&q="&strKeyword&""
Case "exact"
strURL = "http://www.google.com/search?hl=en&q="""&strKeyword&""""
Case "allinurl"
strURL = "http://www.google.com/search?hl=en&q=allinurl%3A"&strKeyword&""
Case "allintitle"
strURL = "http://www.google.com/search?hl=en&q=allintitle%3A"&strKeyword&""
Case "allinanchor"
strURL = "http://www.google.com/search?hl=en&q=allinanchor%3A"&strKeyword&""
Case "allintext"
strURL = "http://www.google.com/search?hl=en&q=allintext%3A"&strKeyword&""
End Select

objXMLHTTP.Open "GET", strURL, false
objXMLHTTP.Send
strHTML = objXMLHTTP.responseText

vStart = Instr(strHTML,"</b> of about <b>") + 17
vEnd = Instr(strHTML,"</b> for <b>")
vLength = vEnd - vStart

If vStart > 17 then
strHTML = Mid(strHTML,vStart,vLength)
Else
strHTML = "no results"
End If

fKeywordStats = strHTML
End Function
%>
</BODY>
</HTML>


The script has to be run on a Windows server with the Microsoft.XMLHTTP object enabled.

Name the script goog-stats.asp. If you name it something different, you have to change the name in the FORM ACTION value.

Happy keyword hunting!

Thursday, January 21, 2010

TextBroker.com Review

I've entered 2010 with a new-found determination to make some extra dough on the net, hence my post about doing sites site again (get yours starting at only $300!).

Part of the plan is to make some money building keyword optimized content sites and populate them with AdSense.

Of course the key to content is to actually have content. Rather than try to crank out 300 words or so on stuff I know nothing about, I've been using a content for hire service that , so far, I'm pleased as punch with.

TextBroker.com is pretty nifty. Sign up, add fund through PayPal, and commission articles. You add an order, specify the the title and what you want it to be about, and choose a quality rating . The higher the rating you choose, the more the article costs, with the choices being from 2 stars to 5 stars.

To put it into perspective, I ask for article from 250 - 300 words and they've been running my right around $5. I've only rejected one article out of the dozen or so I've commissioned.

I tried a couple of others (more about them later) but TextBroker.com is the best by a ling shot so far.

Webdango Tampa Web Development

For anyone who's interested, I'm trying to get some side work again setting up web sites for folks. I can do custom work (for a price) but right now I'm offering custom sites starting at only $300. And if you want an ecommerce site, I can do that too.

I can also host if you need it....

Yeah, it's listed as Webdango Tampa Web Development, but that's so I can get the keyword Tampa Web Development in there....

So if you're looking for a professional looking site, hie thee over to Webdango and contact me.

Monday, September 28, 2009

Null Links Best Practice

There have been instance were you want something to look like a link, but do something else when someone clicks is.

There are some various solutions out there, but here's the one I recommend.

Format your link like this
<a href="requirements.asp" onClick="javascript:YourJavascriptStuff;return false;">
Here's how this works: Make a page called requirements.asp, and on that page you list the minimum user requirements required for users to use your site. Obviously JavaScript is one of them.

When a user clicks the link, if they don't have a Javascript enabled browser, or have Javascript turned off, it will send them to the requirements page.

If they do have Javascript enabled, the 'return false' interrupts the HTTP call make by the href and executes the Javascript instead.

So it looks like a link, and will act like a link if there's no Javascript. If there is, the Javascript call will execute.

Friday, September 18, 2009

Add Widget to Header | Add Widget to Post in Blogger

I was working in blogger and wanted to add AdSense to it in specific places. By default, I can add a html/javascript widget to the side bar, but there was no way to add a widget to the header or to the post. Wassupwidat?

I tried editing the HTML directly, but the AdSense ads wouldn't show. I didn't want to use the built in AdSense monetize featured because that doesn't allow for channel tracking. So I poked around a bit and found they way to do it.

Add widget capability to the header

Go to the edit html and look for
<b:section class='header' id='header'>
There might be some other stuff in there, but regardless you want to edit it to read:
<b:section class='header' id='header' maxwidgets='3' showaddelement='yes' preferred='yes'>
After you do that, when you go to the layout screen you'll have an Add Widget section. Now you can put in a html/javascript widget and put your adsense in there (or anything else).

Same thing for the post section. Look for something like:
<b:section class='main' id='main' showaddelement='no'>
And replace it with:
<b:section class='main' id='main' maxwidgets='3' showaddelement='yes' preferred='yes'>
Use the maxwidgets setting to control how many widgets you want to add.

Thursday, August 13, 2009

Send Email using ASP from a Web Form in GoDaddy

I'm not really fond of GoDaddy, just like I'm not fond of WalMart, but I still shop there. When it comes to cheap hosting, especially in a combined ASP/PHP/.Net environment, they're pretty much it. For less than $10 a month I can get 25 MySQL databases, 5 SOL databases, and unlimited top level domains. Can't be beat, or at least I couldn't find a place to beat it after wasting about hours of my life looking around before picking GoDaddy as my solution.

So I've been moving some of my sites over. Why pay $5 a month (which is still cheap) when I can get hosting for pennies? I mean, $5 isn't much, but when you're hosting 11 sites, it adds up.

Many of the sites I host use contact forms or confirmation forms, or some other form that needs to send out an email. Simple enough, but I spent a good three hours this morning figuring out how to do it on GoDaddy, and not for the reason you think.....

Before I get to that, here's the code:

sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing"
smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver"

' Set the mail server configuration
Set objConfig = CreateObject("CDO.Configuration")
objConfig.Fields.Item(sendUrl) = 2 ' cdoSendUsingPort
objConfig.Fields.Item(smtpUrl) = "relay-hosting.secureserver.net"
objConfig.Fields.Update

' Create and send the mail
Set objMail=CreateObject("CDO.Message")

' Use the config object created above
Set objMail.Configuration = objConfig
objMail.From = "sender@coolexample.com"
objMail.To = "recipient@coolexample.com"
objMail.Subject = "subject"
objMail.TextBody = "body"
objMail.Send

Set objSendMail = Nothing
Set objConfig = Nothing

Replace the hardcoded values for subject, from, to etc. with your own values. Bear in mind GoDaddy will only send 250 messages a day, so if you need to do more, you'll have to come up with some other solution.

Now here's the kicker. Two kickers, really:

The first is GoDaddy doesn't allow detailed error messages for classic ASP. All you get is a 500 Internal Server Error. I wasted a good bit of the three hours trying to figure out how to turn on errors but came up with nada. So good luck troubleshooting your ASP code....

And this is related to the above: I couldn't get the damn thing to work (and I couldn't see the error). So I ended up stepping through it line by line and guess what the problem was?

GoDaddy doesn't allow you to use a GMail address as a from address.

That's right my friends, Read it again.

So say you have a site with some sort of Send to a Friend thing where you ask for the sender's email, so the message says something like YourFriend@HisEmail.com has sent you a link and the from address is actually the person's email.

Well, if your address happens to be a GMail (and maybe other free mail apps, I didn't check) you get an error. An error that you can't troubleshoot.

Once I figured that out, the code worked fine, although I had to update some of my forms to change the sent from value so it didn't use the submittor's email address anymore.

Monday, August 03, 2009

RetroWebDev's No Joke Guide to Making Money on the Internet - Part 1: Introduction

OK, this is it. I know, I know, there are a ton of guides out there, most of them wanting money and most of them promising financial independence and near-instant wealth. You too can earn $3,768.18 a day!

Well maybe you can, but if that's the type of program you're looking for, read no further, because that's not the type of program I'm going to talk about.

I'm talking about a real, working-as-I-type-this program that has, for the last year, earned me between $1,000 - $2,000 a month. At my peak in December 2005, I had over $10,000 in revenue and just over $9,000 in gross profit.

But that's another story, for another time, and in another time, before the search engines had their huge affiliate crackdown in early 2006 and I went from $300 a day to $30. Ouch! Good thing I hadn't quit my day job....

That's probably worth making a rule: Don't quit your day job.

The type of pay-per-lead and pay-per-sale marketing I'm talking about can be a finicky beast, with companies and offers and products coming in and out of the marketplace and marketing terms being changed all the time. Nothing hurts quite so bad as having a well performing offer pulled out from under you or the terms changed to prohibit your most profitable marketing channel, but it happens all the time, for any reason (or for no reason at all).

Example: In 2007 I was doing $5,000 a month of a very popular diet program, only to have the company change their affiliate terms to prohibit pay-per-click marketing, because--Iwas told--they felt I was stealing sales they would have been getting! Bye-bye $5k....

This isn't to say if you ever do reach $3,768.18 that you couldn't quit. If you did, and it was coming in spread acorss a large number of offers and sites, and you had been saving $3,468.18 a day (or more) for the last 6 months, you still need to work. In that case, you probably don't.

If you're still reading, I'll assume you aren't making anything, or at least not that much, and you want to know the secret. By the end of all this, I think you'll see this isn't much of a secret at all. It's a proven method (at least proven for me in that it works and I get checks), based on some pretty solid and repeatable actions.

In other words, anyone can do it. But there are some things you need to have in place before you can get started.

Stay Tuned for Part 2: What you Need to get Started