Friday, June 26, 2009

Turn Off Comment Section in WordPress Pages

I'm setting up a WordPress install with the primary intent of using it mainly as a content management system (CMS). I'm tinkering because a family member has started up a business and is looking for a web site. I want to give them something robust enough to meet their needs, yet simply enough that they don't have to call me every time they want to update or add something.

WordPress is cake to install, so I had an instance running in less than 10 minutes. I edited the included About page that comes with the default install, turned off Allow Comments and Allow Pings, then viewed the page. At the bottom of the page it was still tacking on the comments section:


Ug. I poked around and couldn't figure out how to turn it off, so I resorted to a handy-dandy Internet search and found the solution.

In your theme, you will have a page named single.php, or index.php. Use the editor to view the source code for the page. In the code, the comments template is called with:
<?php comments_template(); // Get wp-comments.php template ?>

Comment that code out:

<!--<?php comments_template(); // Get wp-comments.php template ?>-->

and add this:

<?
php if(is_page(array(27,32,56))){
//do nothing
}
else{
comments_template();
}
?>

Where the comma separated numbers correspond to the page_id.

The comment section will still show up on blog posts, but not on any of the pages you identify in the above code.

Tuesday, June 23, 2009

Taking the eCommerce Plunge

Phase 1: Affiliate Links
For almost 10 years now, I've been trying to earn a living online, enough so that I could work for myself and own my time. I've been very successful earning extra money, but I never made enough, and with enough consistency (the most important thing), to quit my 'real' job.

The most I ever made was almost $10,000 net in one month (December 2005). Up to that point, my revenue had been growing every month for the better part of a year. I was giddy.

In March 2005, just three months later, after a big affiliate link 'crack down' by the search engine, I made just under $400. I was no longer giddy. Good thing I hadn't quit my job!

Phase 2: Pay-per-sale and Lead Gen
I started tinkered with other affiliate marketing, pay-per-sale, and lead gen programs, this time looking for offers I could market through PPC, and thus have control over my fate: Pay the mony, show up in the results, thus elminating the organic component. I had success there as well, but once again learned that in such a system, my fate was not in my own hands. Driving the traffic was, but the offer itself.....

I would research the offers, register a domain, build a mini site, do keyword research, and drive traffic through PPC on Google, Yahoo and MSN. Some offers were successful, but most weren't. The ones that were I ran with, for the ones that weren't I simply stopped spening money on marketing.

The successful ones almost always ended up being retail offers for strongly branded products (think late night TV commercials). Time and again I would build the site and get the ads out only to be contacted after a month or two and be told that the terms had changed and I was no longer allowed to bid on trademark terms (usually the product name). Down came the ads, and away went the traffic.

As an example, I used to run an offer for Nutrisystem. My revenue was around $8,000 a month on $3,000 in spend for a profit of around $5k. I did this for three months and was then told to pull my ads. Bye-bye to $5K.

This scenario played out repeatedly and I finally gave up. Term changes (no more PPC!) or the offers being pulled unexpectedly, leaving me with a worthless site, finally wore me down. I pretty much stopped trying.

Most of my sites still sit out there since. I was hosting them myself on my own server and they don't cost anything. They'll stay until the domain names expire. Recently, some of the sites started picking up some significant organic traffic, mainly from Yahoo and Bing. I've since reworked these, found some good fitting offers, and currently make between $1,000 to $1,500 a month. Not much, but I'll take it. It gave me enough moeny to try....

Phase 3: Drop shipping
All this frustration ultimately led me to deciding I needed to have my own ecommerce site. No more depending on selling other people stuff. I'd sell it myself! I wanted to be as efficient and cost-effective as possible, so drop ship looked like the perfect solution.

After a bunch of boring research, I choose a niche, found a supplier, and went with a hosted cart solution. The niche I chose only had two drop shippers in it. I spoke to them both and did my due diligence. One was hopelessly disorganized and the other seemed to have their ducks in a row, so I went with them.

Alas, appearances can be deceiving. After getting the site configured and the inventory loaded, I went out slow, slow, slow with the marketing to test the waters. The orders started coming in. Not much, maybe an average of 1 a day. But it was a enough to rapidly figure out that the supplier took anywhere from 2-6 weeks to fulfill an order.

Tip: when people order something, 2 weeks is about the longest they'll wait before they start asking you where it is.

Added to this was the manul process of passing the order to the supplier. No automated solution there; I had to send email(s) for every order, send email(s) to ask if they got the orders, then send follow-up email(s) for them to notify me when the order shipped, then send the tracking number to the customer. Not smooth, not easy, not efficient.

Turns out their primary business is manufacturing for retail stores, so drop ship items got tacked when ever they had to fulfill a wholesale bulk order, hence the wait. Order a blue widget? Have to wait until a retail store ordered 50, then they would make 51 and send yours out.

So after 4 months of operation, I shut it down. I ended up breaking even for the effort, but it was a lot of effort and a lot of emails.

Phase 4: Do It All Yourself
Still searching for some way to escape my corporate overlords, I once again forged into ecommerce.

My dealing with the supplier mentioned above led me to believe that although they hadn't worked as a drop shipper, they would as a wholesaler. I already had a decent relationship with them. It was OK to wait 4-6 weeks to get your stuff when you had stock on hand to do your own fulfillment, all you had to do was order ahead to keep your inventory level up.

The drawback here was the cash outlay for inventory. The benefit was you were in charge of getting the item to the customer and you got another 20% off pricing for wholeslae orders over a certain amount. That gave me a larger margin to work with for profit.

So I re-engaged with them and am currently getting things lined up for yet another effort to break free of my corporate bonds....

Wish me luck!

Thursday, May 21, 2009

Operation must use an updateable query

Microsoft JET Database Engine error '80004005'

Operation must use an updateable query.
I think every web developer has seen this error at one time or another, and probably more than once. When I see it now, I actually smile, because it's an easy one to fix. It happens when you try to add or edit a record in an Access database through your web site.

This isn't a database error per se, it's actually a permissions error. Without going into too much detail, it's cause when the Internet Guest Account on your IIS server doesn't have permissions to write to a folder.

The Internet Guest Account is the accout IIS uses by default for web site visitors. When you add or edit a record in Access, requires that the account editing or creating the record have write permissions to the folder the Access database it in.

If you have access to your server, open file exploere and navigate to the folder containing your Access databse. Right click, select Properties, then click on the Security tab. In the Groups or user name box, scroll until you see Internet Guest Account. Select it, then look in the Permission box underneath and make sure Write is checked.

If you don't have access to your server, you'll have to contact support at your hosting company and ask them to do it. Any hosting company wirth its salt with know exactely what you mean when you say "I need you to set write permissions for Internet Guest Account on the folder that has my Access database in it."

Thursday, May 07, 2009

Installing Visual Web Developer 2008

I haven't been doing much as far as advancing along the .Net development path. Procrastinating I guess. My cellmate at work suggested I go ahead and install the most recent version (2008) rather than the 2005 I already had, so I could use the 3.5 framework, since he said it had some "cool stuff". I figured why not? It's not as though I'd really started doing anything anyway.

So I downloaded the whole deal from the ASP.Net site and launched it. Three days of intermittent tinkering later, I finally had it installed. And Microsoft wonders why it has pretty much lost the hobbyist programmer....

The problem occurred right out of the gate. The install program hung on trying to set up the 3.5 framework, which was the second step of the install process. I tried all the standard solutions: uninstalling all the existing frameworks, reinstalling, even downloading the 3.5 framework separately and trying to get it set up that way. I thought maybe it just needed a long time to finish, so I let it sit overnight. Nope. It wouldn't install and, as a result, VWD 2008 wouldn't either.

As a last ditch effort, I tried Windows Update. I should have tried that first because it worked. The next time I ran the VWD 2008 install program, it went right over the 3.5 framework install with a green check mark and proceeded on.

I went through some similar contortions trying to get SQL Server 2008 Express and it's associated Management Studio installed, but I overcame that as well.

So now I've got Visual Web Developer 2008 on my machine. All that's left is learning to use it!

Thursday, March 26, 2009

Showing the Date and Time in .Net

I like the concept of master pages, they seem sort of like includes on steroids. In Classic ASP, I would build my template and use includes for those items that would be global to the site: header, footer, navigation, etc. master pages in .Net let you do the same sort of thing.

So I get my master page created and I want to put the copyright notice on the footer. But how to dynamically insert the year?
d, day of month: System.DateTime.Now.ToString(" d") // can't use just "d"
dd, zero-padded day of month: System.DateTime.Now.ToString("dd")
ddd, abbreviated day of week: System.DateTime.Now.ToString("ddd")
dddd, full day of week: System.DateTime.Now.ToString("dddd")
h, hour: System.DateTime.Now.ToString(" h") // can't use just "h"
hh, hour, zero padded: System.DateTime.Now.ToString("hh")
H, hour, 24-hr: System.DateTime.Now.ToString(" H") // can't use just "H"
H, hour, 24-hr, zero padded: System.DateTime.Now.ToString("HH")
m, minute: System.DateTime.Now.ToString(" m") // can't use just "m"
M, month: System.DateTime.Now.ToString(" M") // can't use just "M"
MM, month, zero padded: System.DateTime.Now.ToString("MM")
MMM, month abbreviated: System.DateTime.Now.ToString("MMM")
MMMM, month full name: System.DateTime.Now.ToString("MMMM")
y, year (omits century): System.DateTime.Now.ToString(" y") // can't use just "y"
yy, 2-digit year, zero padded: System.DateTime.Now.ToString("yy")
yyyy, 4-digit year, zero padded: System.DateTime.Now.ToString("yyyy")
So to actually use this in a page, you'd do:
Copyright <%= System.DateTime.Now.ToString("yyyy") %> 
This will write the full four-digit year.

Here's a full list of all the Date and Time formats.

Visual Web Developer 2005 and ASPNETDB.DBF

I've decided to initiate my .Net journey with the free Visual Web Developer 2005 Express Edition, mainly because the couple of books I have are for Visual Studio 2005 and the .Net 2.0 framework. I choose SQL Server 2005 Express as well for the database backend.

I'm not sure how easy it is to get VWD-2005-ED anymore. Microsoft released VWD-2008 about 6 monmths agao and it's all that's available from the official .Net website. I had a CD with it that had come with the Dummies book I bought a few years back. I bet you could find it on PirateBay or some other torrent sharing site though. It's free, so that's not stealing AFAIC.

It's taken me some time to figure out the nuances of getting a new web site project up and running. The main issue I was having was with VWD-2005-ED creating the membership database the way is was supposed to. Sometimes the membership database got created and sometimes it didn't.

After much trial and error, I hit on a sequence of actions that seems to work. I assume you have VWD-2005-ED and SQL Server 2005 Express installed, and have started the VWD program. Do:

File-->New WebSite-->ASP.Net Web Site - I'm working in C# and using the File System as the location

Once the program has created the site:

Build-->Build Website

Once the site has been built, hit control (Ctrl) F5 to launch the site preview in Internet Explorer. Close the browser after it finishes launching and then, back in VWD:

Website-->ASP.Net Configuration

This brings up the browser again with the configuration stuff loaded. It might take a minute or two. Once it's done, the ASPNETDB.DBF should have been created.

RetroWebDev Blog Update & Social Bookmarking Tool

With my intent to chart my progress through the Sargasso Sea of .Net development, I decided to update my blog with the new templates/features now offered by Blogger. I'm now taking advantage of the hand-dandy gadgets that are so easily installed, and have integrated the AdSense ads between the posts. (Not that anyone ever clicked on the old AdSense ads, but hope springs eternal.)

One of the things I wanted, and operating under the delusion that people might actually find certain posts here interesting and want to share, was an easy way for visitors to do the social bookmark submission thing.

A quick search took me to AddThis, where I quickly and easily got hold of the handy bookmark button now seen below all posts. You do have to register to get the tool, but heck, I'm registered on a gajillion sites already anyway. What's one more?

So welcome to RetroWebDev's slight new look.