AKA Marketing.com Logo            VISIT THE BLOG            

Blogged thoughts, is our web blog. Expect views, opinion, rants and tirades about everything and anything 

« Home / Forums »        

 


Subscribe to our SEO / IT related blog by entering your email address below

Blogged thoughts

| by the www.akamarketing.com team

Archive for the 'IT' Category


Is 02 mobile broadband worth it for a fiver a week?

Thursday, August 14th, 2008

I’m a laptop user these days, so to keep with the whole ‘work anywhere’ gig I’m trying to perfect I decided to invest in one of the mobile broadband offerings from 3G, O2 or Vodafone. Truth be told 3G were out before they were even in… I’ve heard a lot of negative things about their overall (speed, reliability & customer care) service, in both the online and offline worlds so I wasn’t going there. As for Vodafone well reliability is meant to be top notch, however it’s €30 a month and has a data cap is 5GB which 02 beats on both counts, so I said I’d look into 02 more…

While I was researching the mobile broadband offering from 02, one of the most important things for me was speed, reliability too of course… but that’s a given. I needed decent download speed but perhaps as important (well not quite) for me was upload speed as being a developer I’m uploading this, that and everything via FTP on a daily basis. 

Speed for the 02 mobile broadband service is currently listed as 7.2Mbps for download and 2.0Mbps for upload although they must have upgraded upload capabilities within the last few days because when I ordered last week upload speed was listed as 1.4Mbps, which is good in itself. Those speeds where more than adequate for my needs. I was aware however that these listed speeds are the theoretical max speeds one can achieve given absolutely perfect network conditions, so I wasn’t expecting to get anywhere near them in reality. The truth however is that higher theorectical speeds generally mean higher ‘in the wild’ speeds too so considering it has a 10GB data cap and after a little checking on it’s reliablity I said I’d give 02 mobile broadband a go.

I bought it online (by the way - no sim pin number is included when the modem is bought online for security reasons - you need to call, email or post in their support forum to get it) and it cost €49 for the E270 (the E220 is less powerful upload speed wise) modem and then €20 a month as part of a 12 month contract. I got it the other day and am very happy with it so far, below is some snapshots I got from Speedtest.net. The 1st one is the max I’ve achieved so far while the 2nd one is what I got earlier today.  

Both are decent results in terms of download and upload speed. I found 2.5-3.0MB is usually average territory for download speed, while upload average is about 800-900kbs mostly. Quality of service is good too - I’ve made about five long Skype calls since getting this lad in and no problems at all, call quality was as good as DSL based calls. By the way Blacknight have a nice VOIP simulation test at http://www.irishisptest.com/runmyspeed.php which you can use to check how your Internet connection will perform (roughly) using VOIP. As far as I’m aware VOIP call quality has a lot to do with Ping speed (as well as upload/download speed obviously), which above is 159ms and 162ms respectively from left & top which is good for mobile broadband. Call quality on Skype etc. may be a bit hairy on Ping speed of I’d say 270+.

Although I haven’t had it long I’m very happy with it to date, I’ve heard it can be very location dependant (I’m based in Santry, North Dublin) though so depending on where abouts in Ireland you are it might not work as well for you as it is doing for me. On that note check out the Speed Test Thread on the 02 support forum for a load of Speedtest.net result snapshots from various parts of the country. You’ll notice that some of them are not that flattering, but most are decent and considering that mobile broadband is still really new in this country ‘decent’ for five euro a week should be good enough for most people. Word on the wires is that they have plans to upgrade to 14.4Mbps sometime in the next year or so which when it happens should really stir things up.

I wonder though will us Irish ever have it as good as our UK counterparts, the variety of packages and special offers for home, mobile and other broadband services is massive, for instance (and since we’re talking about 02) check out this deal from 02 in the UK which offers free home broadband when you buy mobile broadband.

Resources:
Apparently the software that comes with the 02 modem does not accurately track data usage, I’ve yet to notice but Shane O’ Sullivan has written a tool which logs in to the 02 website and gets your 100% accurate figures.

Another recent review which includes figures from a couple of different locations around Ireland by Conor O’Neill.

Keith Bohanna’s review of 02 mobile broadband from September 07 includes more sample speeds from various different locations, notice the sometimes huge differences between location A and location B so do your research before investing.


Using Wordpress? Check the text only version of Google’s cache for hidden spam links

Thursday, July 31st, 2008

I’m up to my eyes programming another adwords API system at the moment so when I discovered that my Wordpress installation had been hacked, I wanted to strangle someone (ideally the person responsible) because I really didn’t have time for this.

Wordpress hidden spam links hack
The hack didn’t shutdown my blog but it might as well have because it made all my posts unfindable on the major search engines for any of their related keywords (and exact string searches). The hack I fell victim to involves some waste of space making secret changes to Wordpress source files and the Wordpress database enabling him to output a tonne of hidden links on all blog pages via a hidden Wordpress plugin. The links were complete keyword stuffed spam with anchor texts such as ‘viagra’, ‘xanax’ and ‘teeth whitening’ common among them so needless to say the search engines don’t like my blog pages anymore.

What makes this hack hard to detect is that fact that the links only get outputted when a major search engine visits a page from an ‘infected’ Wordpress installation so blog readers will likely not notice until a lot of damage is already done to your Google, MSN and Yahoo rankings. I myself only stumbled upon it earlier today when I seen all the links near the bottom of Googles’s text only cache of my last post about converting to PDF from within PHP so it was by pure chance. The links where present on the regular cache too, however they where contained in a hidden div so could not be seen by anything except the search engines… unless you viewed the page source.

Want to see an example? Well right now there a lots of cached examples on Google of what this hack did to my pages, but I’m hoping they will be gone soon so here’s a copy of the text only cache of http://www.akamarketing.com/blog/109-php-to-pdf-conversion-with-tcpdf.html from today (31st July 2008).

How can I tell if my Wordpress blog has been hit with this?
Easiest thing to do is to just visit Googles text only cache page for a couple of your blog posts (and perhaps your main blog page) and keep an eye out for about 50 spam links towards the end of the page. If you have caching by search engines disabled you can use something like Curl and ‘fake’ your user agent string to appear as if your Google (and then check the page source). I’ve done it already for you though with a iamgoogle.php script, visit http://www.akamarketing.com/iamgoogle.php?url=http://www.akamarketing.com/blog/&google=1 while replacing my URL ‘http://www.akamarketing.com/blog/‘ to the URL of one of your blog pages. When the parameter google is equal to 1 the user agent is ‘Googlebot’, when it’s anything else a regular ‘human’ user agent is used. If your checking your blog main page be sure to add the trailing slash after your blog folder as Wordpress implements a redirect from the non slashed URL version to the slashed URL version so you’ll just get a ‘Moved Permanently’ message without the trailing slash. The code of iamgoogle.php is available for those of us that are ‘into’ PHP.

If I’ve been hit with this hidden link hack how to I get rid of it?
After discovering this hack my first port of call was Google to try and search for some good information. I found three particularly good articles about what this hack is and how to get rid of it so I’ll just point you in the direction of a couple of existing posts if you don’t mind (it’s been a long day) rather than go through how to remove this in detail. The posts below all helped me:

Wordpress exploit giving backlinks, redirects and headaches but no visitors ;)

Wordpress exploit: we been hit by hidden spam link injection

Has Your WordPress Been Hacked Recently?

The above links will fill you in on the complete story but in essence fixing this hack for me involved doing a bit of fiddling with the Wordpress database, deleting some files with strange extensions and upgrading Wordpress from version 2.0.2 to 2.6. On that note I must say hats off to the Wordpress development team, it was pretty much the most pain free web application upgrade I’ve ever be done… (although I did backup everything twice just to be safe). If you already have the latest version of Wordpress I’d still recommend replacing your source code with ‘fresh’ code just in case it’s been edited (which is very likely for this hack).

How can I detect something like this in the future?
After I upgraded Wordpress I was pretty certain that my installation was now clean, however I asked myself how can I detect something like this more quickly (I have a hunch that this hack was ‘active’ since April) in the future if it happens again? I came to the conclusion that I needed some sort of file integrity checker similar to Tripwire to alert me when any of my www space files change. 

Tripwire and many other similiar systems are not usually available on shared hosts but they all essentially take a sha1 (or md5) hash of all watched files, store the hashes and then periodically compare the stored hashes against regenerated ones to check if any files have been edited so writing something custom specific to my needs wouldn’t be that hard to do.

OK that’s enough rambling for today, here’s hoping you have a had a better day than me.


PHP to PDF conversion with TCPDF

Friday, July 25th, 2008

Recently I had a development client which as part of a larger system had a requirement of creating a PDF based report from his clients metrics, KPI’s etc. which he could then forward onto them. It was simple numerical data but for presentation purposes it was needed in PDF… you know to look good.

In the past when budget was less of an issue I used PDFLib, a commercial library which these days is available as part of the core PHP package. This project however required me to look for a free alternative. I found TCPDF on Sourceforge. It had almost 80,000 downloads, good documentation, lots of examples and was being used by applications such as Joomla, Drupal, Moodle and phpMyAdmin so I said I’d give it a go.

Installation was easy, basically I just needed to copy the TCPDF folder to my www space and require() the main class file from PHP scripts that needed to create PDFs on the fly.

I have to say I found it quite a slow & tedious process to create the more complex dynamic PDFs with this library, however this is because of what I was trying to do in the overall sense and was not the libraries ‘fault’, after all creating PDFs dynamically is quite different than creating webpages dynamically. I found having to work out all the ‘maths’ for positioning elements and the fact you can’t just press refresh to see if your latest line or two outputted as intended the most frustrating.  

OK to give you a feel for how the TCPDF class library can be used I’ll go through how I actually created the PDF report which my client wanted by providing a striped down version of the code. The two interesting things about the report was that it had to have a table with all the data and the page the table was on had to be presented in landscape style (because the table was wide). The table I output is related to Golf and is very simple, but hopefully it will be a good TCPDF starting block for you. 

Creating a table with TCPDF
Within the TCPDF class there are a couple of useful methods which enable me to output a nice table with DB data embedded in the cells. These are writeHTML(), writeHTMLCell()Cell() & MultiCell(). I had to rule out Cell() for the most part as it does not support putting HTML into the cell data. Although I could have outputted a standard HTML coded table using writeHTML() I went with MultiCell() in the end. The code below is similar to what I used, it produces this PDF (please right click and save as… otherwise your browser might crash). Be sure to change the line that says ‘FIX THIS LINE’… I had to remove the HTML because Wordpress was acting the goat again. The full not-messed-up-by-wordpress version is available too.

//reference the class so you can use it
 require_once(’../tcpdf/tcpdf.php’);

 // create new PDF document
 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);

 //do not show header or footer
 $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false);

 // add a page - landscape style
 $pdf->AddPage(”L”);

 // set font
 $pdf->SetFont(”freeserif”, “”, 11);

 /////////////////////////////////////////////
 //  START TABLE HEADER
 /////////////////////////////////////////////
 
 //Colors, line width and bold font for the header
 $pdf->SetFillColor(11, 47, 132); //background color of next Cell
 $pdf->SetTextColor(255); //font color of next cell
 $pdf->SetFont(”,’B'); //b for bold
 $pdf->SetDrawColor(0); //cell borders - similiar to border color
 $pdf->SetLineWidth(.3); //similiar to cellspacing

 $cols=array(’Rank’,'Player’,'Pts. Avg.’,'Total Pts.’);//Column titles
 $width=array(20,50,40,30); //amount of elements must correspond with $header array above

 for($i = 0; $i < count($cols); $i++)
{
     //void Cell( float $w, [float $h = 0], [string $txt = ''], [mixed $border = 0],
     //[int $ln = 0], [string $align = ''], [int $fill = 0], [mixed $link = ''], [int $stretch = 0])
     $pdf->Cell($width[$i],7,$cols[$i],1,0,’C',1);
 }

 $pdf->Ln(); //new row

 ////////////////////////////////////////////////
 //  START TABLE BODY
 ////////////////////////////////////////////////

 //styling for normal non header cells
 $pdf->SetTextColor(0); //black
 $pdf->SetFont(”,”);

 //the data - normally would come from DB, web service etc.
 $rank = array(’1′,’2′,’3′);
 $player = array(’Tiger Woods,  USA’,'Phil Mickelson,  USA ‘,’Padraig Harrington,  Irl ‘);
 $playerWWW = array(’http://tigerwoods.com/’,'http://philmickelson.com/’,'http://padraigharrington.com/’);
 $avgPts = array(’10′,’9′,’8′);
 $totPts = array(’100′,’90′,’80′);

 //create & populate table cells
 for($i = 0; $i < count($rank); $i++)
 {
       if($i == "2")//highlight Harrington because he Irish...
      {                //in reality you might highlight profits/losses etc.
          $pdf->SetFillColor(89, 239, 152); //green
      }
      else
      {
         $pdf->SetFillColor(255); //white
      }
     
       //link the players name to his website

      $playerANDlink = “a href=\”$playerWWW[$i]\”>$player[$i]/a”; //FIX THIS LINE
 
     //int MultiCell( float $w, float $h, string $txt, [mixed $border = 0], [string $align = 'J'],
     //[int $fill = 0], [int $ln = 1], [int $x = ''], [int $y = ''], [boolean $reseth = true],
     //[int $stretch = 0], [boolean $ishtml = false])
     $pdf->MultiCell($width[0],7,$rank[$i],1,’C',1,0,”,”,1,0,1);
     $pdf->MultiCell($width[1],7,$playerANDlink,1,’C',1,0,”,”,1,0,1);
     $pdf->MultiCell($width[2],7,$avgPts[$i],1,’C',1,0,”,”,1,0,1);
     $pdf->MultiCell($width[3],7,$totPts[$i],1,’C',1,0,”,”,1,0,1);
 
     $pdf->Ln(); //new row
 }

 //output the PDF to the browser
 $pdf->Output(”./pdfs/example.pdf”, “F”); //F for saving output to file
 

PDF creation and setup
OK I’ll briefly go through this code then. The first couple of lines really just sets up the PDF document or pages within the document, please refer to the TCPDF class documentation for more information. The only real item of note here is the method for creating a landspaced PDF page. The default AddPage() method takes no parameters and with this a page is created with the default page style (as per the overall TCPDF config file) which is usually portrait style, so pass in an ‘L’ for landscape pages. It is possible to have some pages landscape and some portrait style in a single PDF document.

Table Header
The TCPDF class has a lot of methods for setting the style of elements. The styles set will correspond to the next cell/element drawn. Most of them are obvious. SetFillColor() sets the background color of a cell when that cell is set to be painted or filled. The fun begins though when you actually start outputting cells (retangles). The header is just plain text so I used cell(). Cell() is well documented on the TCPDF site and it is easy to use. Parameters in order from left to right are, width, height, cell text, border true or false, where next cell should go, cell alignment, fill in cell true or false, optional link and stretch options.

The $ln - where next cell should go parameter, is useful if you want to build your tables vertically rather than horizontally. Leave it at 0 to go to the right and then call Ln() (kind of like what tr does in HTML table) to start a new row is what I suggest. If the fill parameter is set to true the cell background will be the color set by SetFillColor() as mentioned above, if no fill color has yet be set, the background will be grey. My header is built by using a loop to create the four required cells. The first iteration in the loop will be:

$pdf->Cell(20,7,”Rank”,1,0,’C',1);

which means create a cell of width 20 and height 7 with its value set to “Rank”. It should have a border, have its value centered and should have its background filled in.

Table Body
The main body of the table is very similar, but uses the method MultiCell() as we want the ability to output HTML as the cells’ value. A couple of arrays of data are created and populated. These will slot into the cells we are about to create. In reality the values of the cell will likely come straight from a DB or webservice but hardcoded arrays is fine for this sample.

MultiCell() has a lot of the same parameters which we have come across when using cell() above so I won’t mention them again. It also introduces a couple of new parameters including, X and Y for setting the positional coordinates of a cell, Reseth which resets the height of the last cell (without setting this to true your likely to get crazy looking tables… leave it to true and forget about it) and ishtml which determines if the cell value can hold HTML or not. MultiCell()’s full definition is below.  

int MultiCell( float $w, float $h, string $txt, [mixed $border = 0], [string $align = 'J'], [int $fill = 0], [int $ln = 1], [int $x = ''], [int $y = ''], [boolean $reseth = true], [int $stretch = 0], [boolean $ishtml = false])

It’s pretty simple to use. It provides power by allowing you to set the exact X and Y coordinates of a cell, but also ease of use in the sense that if you don’t specify values for X and Y it will just output at the current position (just like cell() does) so you don’t have to do any logic to get suitable X & Y values… in most cases anyhow.

After four calls to MultiCell() which printed one row of cells, we call Ln() to move to a new line. In fact we didn’t even need to do this to be honest, we could have just changed the $ln parameter value from 0 (to the right) to 1 (to the beginning of the next line) on our fourth cell in each row. The code then would change from this:

$pdf->MultiCell($width[2],7,$avgPts[$i],1,’C',1,0,”,”,1,0,1);
$pdf->MultiCell($width[3],7,$totPts[$i],1,’C',1,0,”,”,1,0,1);
 
$pdf->Ln(); //new row

to this:

$pdf->MultiCell($width[2],7,$avgPts[$i],1,’C',1,0,”,”,1,0,1);
$pdf->MultiCell($width[3],7,$totPts[$i],1,’C',1,1,”,”,1,0,1);

Personally I prefer the first way of doing things as it’s more obvious that a new line/row is being outputted. 

Before the call to MultiCell() I changed the fill colour of the cells related to Padraig Harrington (for those that don’t know who he is… he’s a two time Golf Major champion from Dublin), I set them back to white for all other rows. Of course that’s more hardcoding, in a ‘real world’ scenario you might highlight your good figures in green and your bad figures in red.

Outputting the final PDF
When you’ve finished creating all required cells, images, links, text etc. you have to call the Output() method to actually get your hands on your dynamically created PDF. This can take no parameters in which case the PDF is sent to the browser, more commonly though, developers specify the filename and the destination of the generated PDF. The destination can be one of four values, these are:

I: send the file inline to the browser.
D: send to the browser and force a file download with the name given by name.
F: save to a local file with the name given by name.
S: return the document as a string.

You can see my code sets the destination value as F:

$pdf->Output(”./pdfs/example.pdf”, “F”);

this is telling TCPDF to save the dynamically generated PDF document in the pdfs folder with the name example.pdf. On Windows it’s not needed but on Unix based machines you will need to set appropriate permissions on the pdfs (or whatever) folder to allow TCPDF to write the pdfs to it.

A little tip when your developing locally (as opposed to directly on your webhost) and using ‘F’ for the destination parameter is to create your PDFs with a random filename so you can simply press refresh on your script that does the PDF creation logic. If you have a static filename as I do in this example (called example.pdf) and you have the last generated PDF file (also example.pdf) open TCPDF will not be able to write the PDF (as it is aleady open, so a sharing violation error will occur internally). What I often use for random filenames during development is sha1(microtime()), this means to check changes I just need to press refresh on my PHP script and then visit my PDFs folder without having to close previous versions of my PDF.

S is useful if you want to sent the PDF as an attachment in an email without first saving it to disk somewhere.

Both I and D allow you to access the PDF quickly via the browser. A note about these two lads is this… Internet Explorer often looks at the extension of the file, (which will be .php) and assumes that the output will be HTML and thus will not present you a PDF, it will likely present a load of binary data in the webpage itself which obviously is not what you want. Firefox handles both I and D perfectly so I recommend using this during development, you obviously need to keep this in mind when you go into production too as your users might have the same problem too. It might be an idea to save to disk first, provide a link to the pdf and then periodically purge your temp PDFs folder.

Conclusion
I guess you could say that was kind of an introduction to TCPDF, my own introduction to it came from the TCPDF examples page. Thanks to Nicola Asuni for all her hard work on the examples and on TCPDF itself of course.

At this stage I’m really only learning TCPDF myself too so at the moment so I can’t really comment on its real power yet. I’ve come across a couple of issues using it so far but none were without workarounds, I imagine the commercially available libraries will out do it but for a library that’s free and relatively easy to use I offer my closing statement as… so far so good.


Off to sunny Algarve on an extended working holiday

Friday, March 14th, 2008

Well folks, it’s long been touted that my company will eventually not have a requirement for inhouse application development skills and when the final release of the new IT Strategy contained the following sentences & excerpts I pretty much knew that sooner or later the curtains would come down on my three year (circa) software development role with ESB International.

In accordance with the target Application Architecture IT & BP Function will not invest in the development of Application Development skills.

Buy Not Build - Purchase application software unless a substantial business case can be made for the development of a system in-house.

Minimise the Level of Application Development - An overall application architecture objective is to minimise the level of application development.

Rather than wait around until the development work completely dries up (and not wanting to move into the ‘Business’ side of things) I made a decision to resign and move over to the Algarve for nine or so months on an extended working holiday, in fact I’m ‘working’ (cough…) my notice as we ’speak’ and will be finished in ESBI on the 4th of April.

As for the Algarve, well the family have an apartment over there and I’ve managed to get a small bit of part time work with a Faro based web development company which should give me two-three days of work a week, of course I’m going to be looking after my usual quota of SEO work too. Additionally I’ve also got some Dublin based contacts keeping an eye out for any SEO/dev work which I may be able to take care of remotely so I should have enough bits and bobs work wise to keep me going.

On the three or four days I’m not working well what can I say… the place has 3000 hours of sunshine a year, full course meals (with wine) can be gotten for 15 euro-ish, bottles of decent beer cost about 30 cent, the beaches are magnificant, the females are magnificant and best of all the place is full of us Irish.

All the fun begins when I arrive on the 9th of April courtesy of a €12.99 Ryanair flight (thanks Michael…) so if anyone happens to be over in the Algarve anytime from mid April to the end of the year look me up.  If not don’t worry I’ll send you guys a postcard. :-)


What’s up with some recruitment sites not being able to handle IT search strings?

Friday, February 8th, 2008

The IT industry like most industries has its fair share of abbreviations, jargon, keywords and general ’shop talk’. With that in mind it surprises me how many recruitment websites can’t handle searches for simple IT strings like ‘c#’, ‘c++’, ‘asp.net’, ‘.net’ etc. I think the IT industry in particular makes extensive use of the web for job searching so all recruitment sites should facilitate say a c# developer who wants to search for ‘c#’. Have a look at recruitment sites like elanIT.ie, CPL.ie, EmployIreland.com which were some of the sites I spotted which couldn’t handle most if not all of the above search strings.


Optimizing PDF files for the search engines

Thursday, January 31st, 2008

Google and the others can handle them pretty well these days, but there are certain things you can do to make the lives of the search engines ever so slightly easier. The main things which pop into my mind at the moment include the below, which incidentally are not in any particular order of obviousness.

Use Keywords in the PDF filenames
Having keywords in your filename helps the search engines to better understand the contents of your PDF.

Don’t create PDF files from scans
If you scan a document and save it as a PDF. The document will be an image which search engines cannot understand. Create your PDF from textual content.

Use well structured keyword rich content
This is a given for information stored in any format. Use your main keywords a couple of times throughout the body of your content. Split the content into well defined paragraphs and headings. Give special attention to the first line or two of text on page one of your PDF.

Complete the ‘Document Properties’ information for all PDFs
When creating a PDF go to File > Properties to update it’s information. Updatable information includes title and description fields. It is widely believed that Google and perhaps many of the other search engines can read this information and may be using it for a) determining ranking and b) displaying listing snippets.

Link to your PDF with its Keywords and or Title
Don’t ever have ‘Click here’ as the actual link text pointing to a PDF. If your PDF is about gardening, business loans, soccer or whatever well then put them keywords into the anchor text.

There are a couple of good blog posts and articles which cover this topic in a fair bit of depth, if you have the time I recommend throwing the eye over the following pages:

Make your PDFs work well with Google (and other search engines) located @
http://www.acrobatusers.com/articles/2006/02/pdf_for_google/pdf_for_google.php

Eleven Tips For Optimizing PDFs For Search Engines located @
http://searchengineland.com/070912-095906.php

HOME | ABOUT US | CONTACT US | SITEMAP | GOOGLE SITE SEARCH | TOP
12 Lorcan Crescent, Santry, Dublin 9, Ireland +353 87 9807629