Came across this on another blog and I have to say that the future according to Microsoft looks superb…
Category Archives: Tinterweb stuff
ColdFusion and IsapiRewrite Gubbins…
Had a minor issue today from a client using Open Mind Commerce that took a bit of time to track down and solve but the solution was quite simple so I thought I would share…
Open Mind Commerce uses ISAPI Rewrite to produce search engine sexy (I don’t like the word safe) URLs so www.domain.com/store/d1-my-department/ is rewritten server side so the template actually executes www.domain.com/store.cfm?deptid=1
Now this works great until the client changes the URL structure in their settings which although a great feature for setting the actual URL can lead to duplicate content in the SEs.
I had to find a way to look at the URL before it was rewritten, compare this to the real URL in the database and then redirect if it was different.
Enter CGI.HTTP_X_REWRITE_URL
This variable supplies you with the raw URL before it is rewritten server side, bonza! So pseudo code time…
<cfif cgi.HTTP_X_REWRITE_URL NEQ "my stored URL">
<cfheader statuscode="301" statustext="Moved permanently">
</cfheader>
<cfheader name="Location" value="http://www.new-url-indatabase.com">
</cfheader>
</cfif>
All we are doing here is comparing the incoming rewritten url with the one that should be in use (from our database) and then using the cfheader command to do a 301 redirect. The result? No more dupes…
You shouldn’t laugh but you will…
The amazing sleep walking dog 😉
Vertical Scollbar Jumping
Ever noticed how in some sites when a non-full width design is used, the design jumps slightly when the page is shorter than the full screen? This is because in Firefox, the vertical scrollbar tucks itself away when it is not needed i.e. the page is shorter than the screen display. This doesn’t happen in IE.
The result is a s lightly jarring effect but luckily there is a simple fix…
In your CSS statements, either in your style sheet or in the HEAD section of the page, add the statement:
html {height:100%;margin-bottom:1px;}
What this basically does is fool the browser into thinking that the page is filling the screen vertically so it will show the scroll bar. The result is that the design no longer shifts as the vertical scrollbar is always displayed.
In the words of the tic-tac advert, neat huh? 😉
How to Shrink MS SQL Server 2005 Log Files
Now any sysadmin know that MS SQL server can generate whopper log files for the databases especially if there are a large number of transactions taking place. It’s simple enough to shrink the logs periodically but I wanted to find a way to safely automate this.
A quick Google turned up this very informative post by Roni Schuetz. In essence it will loop through all of the DB logs and shrink them back to “normal” size:
CREATE TABLE #TDatabases(
DBName nvarchar(128),
DBLogicalName nvarchar(128)
)
INSERT INTO #TDatabases
SELECT db.name DBName, mf.name DBLogicalName
FROM sys.databases db join sys.master_files mf
on db.database_id = mf.database_id
WHERE db.name not in ('master', 'tempdb', 'model', 'msdb',
'distribution') AND type_desc LIKE 'log'
SET NOCOUNT ON
DECLARE @VarDBLogicalName nvarchar(128)
DECLARE @VarDBName nvarchar(128)
DECLARE @VarRowCount int
SELECT top 1 @VarDBName = DBName, @VarDBLogicalName = DBLogicalName
FROM #TDatabases
SET @VarRowCount = @@rowcount
WHILE @VarRowCount <> 0
BEGIN
EXEC(' use ' + @VarDBName + ' backup log '+ @VarDBName + ' with no_log
dbcc shrinkfile(''' + @VarDBLogicalName + ''', TRUNCATEONLY) WITH
NO_INFOMSGS')
DELETE
FROM #TDatabases
WHERE DBName = @VarDBName
SELECT top 1 @VarDBName = DBName, @VarDBLogicalName =
DBLogicalName
FROM #TDatabases
SET @VarRowCount = @@ROWCOUNT
END
DROP TABLE #TDatabases
SET NOCOUNT OFF
Now you can also automate this process by savin the above script into a SQL file and then creating a BAT file to run this command:
osql -E -i shrinkalldatabases.sql -o result.txt
where shinkalldatabases.sql is the above SQL script.
Set it to run once a week and Bob’s your Uncle. And yes I do have an Uncle Bob…
Accidentally deleted your cPanel cron jobs?
Well that s what I did with one slip of the command line. Instead of typing crontab -l for a list of the root cron jobs I used the -r switch by accident and poof, off went my root crons…
Dopey I know but I needed to reset the cPanel default cron jobs so after a bit of searching I found the following which should be suitable for anyone else who has fat fingers like me…
Access the root cron:
pico /var/spool/cron/root
And now add the following:
2 0 * * * /scripts/upcp
0 1 * * * /scripts/cpbackup
*/15 * * * * /usr/local/cpanel/whostmgr/bin/dnsqueue > /dev/null 2>&1
2,58 * * * * /usr/local/bandmin/bandmin
0 0 * * * /usr/local/bandmin/ipaddrmap
30 21 * * * /usr/local/cpanel/whostmgr/docroot/cgi/cpaddons_report.pl
--notify
0 6 * * * /scripts/exim_tidydb > /dev/null 2>&1
*/5 * * * * /usr/local/cpanel/bin/dcpumon >/dev/null 2>&1
Ctrl + X to save and you’re done.
Moral of the story: put your fingers on a diet and think before hitting enter 😉
WordPress permalinks are broken after upgrading to v2.6
The latest realease of WordPress (v2.6) has a rather odd bug that is not only annoying but a massive show stopper. I came across the bug myself when I recently upgraded the blog last month and it’s popping up all over the place so I though a quick post would help…
In essence, the problem lies with how the permalinks are rendered by the WordPress code. After upgrading to 2.6 your permalinks may simply go to a built in 404 page. The problem is within the rewrite rules to produce sexy links and the fix is very quick and simple.
Log in to your WordPress admin section and then go to:
Settings > Permalinks
Scroll down and at the bottom under the optional section simply add /category in the category field and /tag in the tag field.
Click save and your permalinks should then start working again with no change to the actual structure of the URL itself.
And that’s it. Next week, how to save the planet from global warming and also a 10 second guide to becoming irresistible to women…
Is Google becoming the new PayPal?
For the first time since its launch, traffic to the Google Checkout system has exceeded that of PayPals more established serviced.
According to reports from Hitwise’s Robin Goad, for the first time Google has taken a small lead in the battle to become the number one eCommerce software payment provider of choice. Although only launched in the UK in the last 18 months, Google checkout has already proved incredibly popular when compared against PayPal, partly for the strong brand behind it but also for the sometime poor history PayPal has had in the past. This doesn’t of course mean that more transactions are being processed by Google Checkout but that cannot be far away…
Unsurprisingly, the majority, some 59.1%, of traffic to PayPal comes from its parent company eBay, 12.4% from Google (irony is always amusing) and only 2.2% from shopping and classified ad sites. Conversely, Google gets the bulk of its own traffic from retailers, a whopping 45.3%.
Retention is also a lot higher for Google with 43.4% of users visiting another shopping site after checkout against just 26.7% for PayPal.
This basically means that there are more users abandoning their carts using Google Checkout than those using PayPal.
This in itself is surprising as both gateways offer a clear and simple interface for eCommerce software providers and a rapid checkout is essential. In addition, the implementation of Google Checkout for eCommerce software solutions is actually more complex than the simple PayPal “Buy Now” button.
So what does this mean for eCommerce software solutions, store owners and shoppers?
Well Google certainly has the brand and traffic to push their solution forward whereas PayPal is owned by the largest Auction site in the world so they both have solid sources of traffic. Developers may be snubbing the complex interface of the Google eCommerce offering band shoppers seem to prefer the simplicity of PayPal.
The best solution for eCommerce software providers therefore is to offer a choice to their users which is why Open Mind Commerce supports both gateways as well as over ten other payment options.
Choice is good, choice is important, shoppers shouldn’t be restricted to just one solution and should be given the freedom to choose.
As for the future it will certainly be interesting to watch the battle of the giants shape up…
Think this chap got a bit confused…
…over the true meaning of a bicycle pump…
http://news.bbc.co.uk/1/hi/scotland/glasgow_and_west/7095134.stm
Gotta love the beeb 😀
Domainrenewalonline.com – Scam warning!
Got an email this morning from a company called domainrenewalonline saying that one of my domains is due to expire in 90 days. The domain in question was indeed due to expire but it would be a clever trick as all my domains are through eNom.
Looking into this company a bit further, there is a scam email running round the net at the moment:
http://www.google.co.uk/search?sourceid=navclient&aq=t&ie=UTF-8&rlz=1T4GFRC_enGB218GB218&q=domainrenewalonline
The email looks pretty official and only gets tagged as a medium level of spam so it’s quite convincing.
The link in the email foes straight to their domain, I didn’t click it but at first glance it does all look legit..
Obviously ignore it and contact your registrar if you’re unsure…