Live Chat

Live chat is all the rage now with websites. These allow you to instantly chat live with a real human being via the website. Being an IT Geek (or Professional as we like to be called), I could write one, but with the prices so low, I don’t really see the reason to. As they say, why invent the wheel?

To install, simply copy and paste the supplied code into your website and your pretty much up and running. The user interface allows the chat to be themed to match your website.

I’ve tried a few, and settled on Website Alive. Not only is it one of the cheaper options out there, it also allows you to view users live as they are on your site, giving you key information on what pages they are currently viewing, how many pages they have visited etc. Although it’s not as detailed as the de-facto standard – Google Analytics, it does allow you to push prompts to those users to start a chat session. Personally I find these quite annoying, but I guess in some industries a friendly prompt which is not too overwhelming can increase sales.

Before diving in and paying, I’d definitely recommend signing up for a free trial of the software you wish to use and see if there is benefit before you start coughing up any money.

Selective Reindexing of Indexes in SQL Server

I’ve wrote many scripts over the years to selectively reindex indexes and update statistics on Microsoft SQL Server. However more recently I’ve been using Hallengren’s SQL reindex script as it’s very powerful and pretty easy to use and schedule via SQL Agent.

Hallengren’s SQL Reindex Script

I currently use the following script run daily as it reorganises indexes with fragmentation of between 5% and 20%, and performs an online rebuild if over 20%. Fragmentation under 5% is ignored (it’s not worth doing anything with these). It also updates statistics on records which have been modified.

EXECUTE dbo.IndexOptimize @Databases = 'USER_DATABASES',
@FragmentationLow = NULL,
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 20,
@SortInTempdb = 'Y',
@MaxDOP = 0,
@UpdateStatistics = 'ALL',
@OnlyModifiedStatistics = 'Y'

Joys of Telesales

I’m starting to get a bit fed up of all the telesales calls which I get at work. There’s only so many companies which can bid for landlines/mobile phones/stationary/printer ink etc. All are very similar in price and although may save you 10p on your monthly line rental.. Is it worth it for your time spent messing about? Usually not!

For the usual telesales calls, I usually tell the truth and say that we get everything through the sister company, on some occasions be blunt and say that I’m not interested – but usually they ring back up a month later trying to get your business..!

On odd occasions I use the following Anti Telesales / Telemarketing script and see how far I can get. Using the script, strangely I rarely ever get them ringing back. The furthest I’ve ever got is asking about the toothpaste they use, but on most occasions after a few questions the person on the other end gets the picture and makes a note never to ring you again.

I’m not the original author of this document, not sure who the original author is.

EDIT: Here’s the original author.

Telesales Counter Script

Monitoring Azure SQL Database CPU Usage

Sometimes there is a need to monitor Microsoft’s Azure SQL database usage, but your after the raw figures rather than an impressive looking graph.

Running the following SQL against the master database will give you the recent information:

DECLARE @DatabaseName nvarchar(50);
SET @DatabaseName = '*databasename*';

SELECT getdate() AS [Current Server Time];

SELECT start_time AS [Start of Period],
end_time AS [End of Period],
active_session_count AS [Sessions At End of Period],
avg_cpu_percent AS [Average CPU Usage %],
avg_physical_data_read_percent AS [Average Log Reads %],
avg_log_write_percent AS [Average Log Writes %]
FROM sys.resource_stats

WHERE start_time > DATEADD(minute, -240, GETDATE()) AND database_name = @DatabaseName
Order By start_time DESC;

Here’s an example of the results:
Azure SQL Database Processor Usage

Remote Vulnerability in BASH

There’s been a report of a new code injection attack in Linux, using environment variables. In order to test to see if your system is vulnerable, run the following code from SSH:

env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

If your OK, you should get something like this:
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
bash: warning: x: ignoring function definition attempt
bash: error importing function definition for `x'
this is a test

If not, you will get something like this:
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
this is a test

BASH Screenshot

If vulnerable, it’s recommended to patch the BASH installation.

Further Information

Common SQL Queries

Frequently I use SQL with the work I do with Orbis Taskcentre.

There’s some queries which I use quite a lot and have to always look up on the internet or work out how to do, so to save time, here’s my list:

Date Part of Date Time

First Day of This Month

First Day of Last Month

First Day of Next Month

Last Day of Current Month

Last Day of Last Month

Last Day of Next Month

Select Text Before Space
This also checks to see if a space exists, if there’s no space it returns the full text in order to prevent an error
LEFT(@Column, CASE WHEN charindex(' ', @Column) = 0 THEN LEN(@Column) ELSE charindex(' ', @Column) - 1 END)

Count Workdays Between Two Dates
(DATEDIFF(dd, @StartDate, @EndDate) + 1)-(DATEDIFF(wk, @StartDate, @EndDate) * 2)-(CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 ELSE 0 END)-(CASE WHEN DATENAME(dw, @EndDate) = 'Saturday' THEN 1 ELSE 0 END)

Get paid to shop

Dont really like using blogs for advertising, however a few friends and family have not heard of this, so here goes…

Services such as Top Cashback, Quidco etc allow you to get cash back when ever you buy something online.

There’s no guarantee that you will get paid, but every little helps. Typically you get like 5% back off what you buy.

Sometimes you can even get more cash back than your initial investment. For example depositing £25 on William hill got me £57 cash back.

Big wins are things such as sky, virgin media and insurance.

%d bloggers like this: