Martin Downton
PHP Web Developer working at "Fluid Creativity", a creative design company based in Manchester, UK
http://martindownton.eu for more info
Updates
-
Brilliant, my @contikiuk travel document holder is the perfect fit for my Kindle! http://t.co/qLaSrIIM
-
I'm so tempted to offset that ride with chippy tea...
-
Lovely cycling weather :-) #ManchesterSun
-
Was out cycling 13.50 miles with #Endomondo. See it here: http://t.co/M1hDUUgB
-
Spare ribs, couscous and chocolate milkshake for my dinner, outside in the sunshine of course! #ManchesterSun
-
@phpcodemonkey It felt like it wasn't far off!3 days ago from web | Reply, Retweet, Favorite
-
I just walked back from the supermarket (1.5 miles) with £35 of shopping on my back. That's my workout for the week!3 days ago from web | Reply, Retweet, Favorite
-
Nothing like a terrible busker to ruin a sunny day
-
@Steve_Worsley What did you think?
-
@Steve_Worsley Yer, absolutely brilliant. Was amazed by the first stint but the "encore" was just awesome. One of the best goods I've seen!
-
Best support I've seen in a while!
-
@Inoperante2 Congratulations Ben, all the best for the future!
-
Pre Amon Tobin drink in Brew Dog :-)
-
@Steve_Worsley It's not been easy!5 days ago from web | Reply, Retweet, Favorite
-
I'm glad not everyone is as ignorant as the PHB http://t.co/7y5l3PIF #Dilbert5 days ago from web | Reply, Retweet, Favorite
-
@Steve_Worsley I'll be there! I've been trying to resist watching the show on YouTube, keep it a surprise like.5 days ago from web | Reply, Retweet, Favorite
-
Rick Stein's in Malvern!5 days ago from web | Reply, Retweet, Favorite
-
@hollipher_x Ah brilliant! Not a bad line up for Bromyard!6 days ago from web | Reply, Retweet, Favorite
-
@hollipher_x good to know, wish I could do without mine once in a while!6 days ago from web | Reply, Retweet, Favorite
-
@hollipher_x Are they for wearing everyday or just when you need them?6 days ago from web | Reply, Retweet, Favorite
Recent tracks
-
Oregon by {u'mbid': u'7c158ea8-c0aa-410e-bdc1-20bba9759577', u'#text': u'The Cinematic Orchestra'}31 hours ago
-
Everyday by {u'mbid': u'7c158ea8-c0aa-410e-bdc1-20bba9759577', u'#text': u'The Cinematic Orchestra'}31 hours ago
-
All Things to All Men (feat. Roots Manuva) by {u'mbid': u'7c158ea8-c0aa-410e-bdc1-20bba9759577', u'#text': u'The Cinematic Orchestra'}31 hours ago
-
Man With the Movie Camera by {u'mbid': u'7c158ea8-c0aa-410e-bdc1-20bba9759577', u'#text': u'The Cinematic Orchestra'}31 hours ago
-
Evolution (feat. Fontella Bass) by {u'mbid': u'7c158ea8-c0aa-410e-bdc1-20bba9759577', u'#text': u'The Cinematic Orchestra'}31 hours ago
-
Flite by {u'mbid': u'7c158ea8-c0aa-410e-bdc1-20bba9759577', u'#text': u'The Cinematic Orchestra'}31 hours ago
-
Burn Out by {u'mbid': u'7c158ea8-c0aa-410e-bdc1-20bba9759577', u'#text': u'The Cinematic Orchestra'}32 hours ago
-
All That You Give (feat. Fontella Bass) by {u'mbid': u'7c158ea8-c0aa-410e-bdc1-20bba9759577', u'#text': u'The Cinematic Orchestra'}32 hours ago
-
The Last Remaining Light by {u'mbid': u'020bfbb4-05c3-4c86-b372-17825c262094', u'#text': u'Audioslave'}2 days ago
-
Ára bátur by {u'mbid': u'f6f2326f-6b25-4170-b89d-e235b25508e8', u'#text': u'Sigur R\xf3s'}3 days ago
Top artists
Top tracks
-
26 plays
-
21 plays
-
20 plays
-
20 plays
-
19 plays
-
18 plays
-
18 plays
-
18 plays
-
18 plays
-
18 plays
-
17 plays
-
17 plays
-
17 plays
-
17 plays
-
16 plays
-
16 plays
-
16 plays
-
16 plays
-
16 plays
-
15 plays
-
15 plays
-
14 plays
-
Flux by Bloc Party14 plays
-
14 plays
-
14 plays
-
13 plays
-
13 plays
-
13 plays
-
13 plays
-
13 plays
-
12 plays
-
12 plays
-
12 plays
-
11 plays
-
11 plays
-
11 plays
-
11 plays
-
11 plays
-
11 plays
-
11 plays
-
11 plays
-
11 plays
-
10 plays
-
10 plays
-
10 plays
-
10 plays
-
10 plays
-
10 plays
-
10 plays
-
10 plays
Posts
I was researching the Twitter search API the other day when I came across quite a nice web standard that I wasn’t aware of before.
I had been searching for “twitter search xml” to try and access the search feeds that twitter provides (post on how to make a spam bot coming soon!) when I saw a link to http://search.twitter.com/opensearch.xml, which it turned out wasn’t what I was after.
After a little digging it turns out that providing an opensearch.xml file on your site is a way of telling modern browsers that there is a search functionality. The user can then add it to their browsers quick search bar, along with Google, Bing, Amazon, Wikipedia etc. so that they can search your site at a later date.
“So how do I put this on my site?” I hear you cry… There are two steps you will need to follow to get this to work.
1. Define your XML file
This is Twitter’s XML file:
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Twitter Search</ShortName>
<Description>Realtime Twitter Search</Description>
<Url type="text/html" method="get" template="http://search.twitter.com/search?q={searchTerms}"/>
<Image width="16" height="16">http://search.twitter.com/favicon.png</Image>
<InputEncoding>UTF-8</InputEncoding>
<SearchForm>http://search.twitter.com/</SearchForm>
</OpenSearchDescription>
Obviously you will need to replace these details with your own. One key point is that you must be using GET data to pass your search term from your search form to your results page. This means that your search term will be in the address bar after you have submitted it. This needs to then be replaced with {searchTerms} as in the example above.
2. Add a meta-tag to the <head> of your document
Add the following meta tag to the head of your page, again replacing the details with your own.
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Twitter Search">
And that’s it! So now when someone goes onto your site their current search icon should go blue and when clicked it will give the user a link to add the custom search.
Best Uses
As you can imagine this might not be something that many users are going to install, especially on a simple website like a blog or portfolio, but it would be a great addition to an e-commerce store and might be the difference between a user coming back and purchasing a product from you rather than someone else.
#postaweek2011 2/52
The first thing I do when I log in to the Admin on a fresh install of Magento is delete all of the message notifications, or at least mark them as read to remove the banner from every page. Imagine my annoyance when I installed a fresh copy of version 1.4.2.0 to find this:
So basically there’s no way to mark the messages as read.
There is an issue for this in the bug tracker as well as a basic solution; the solution isn’t obvious for a beginner so here’s a step by step guide on how to fix it, as well as a reminder on how to edit core files without actually editing core files:
- The code that is causing the error is located in the “Template.php” file which is located in “app/code/core/Mage/Core/Block/Template.php”.
- If we were to edit the file directly then it would be overwritten when we next upgrade Magento. Whilst in this instance it is probably OK for this to happen, it’s not good practice so what we do is replicate the file in our local code base and then make the changes. The easiest way to do this is to mimic the file structure above but change the highlighted “core” to “local”, giving us ”app/code/local/Mage/Core/Block/Template.php”.
- Open the file and add this block of code to the end:
public function getRowUrl($row){ return $this->getUrl('*/*/edit', array('instance_id' => $row->getId())); }…making sure that you put this before the curly bracket that closes the class.
- Delete all of the annoying messages… and relax.
There is another method detailed on the bug tracker page in post 3 but the same principles apply regarding the file structure you should use.
#postaweek2011 1/52
What? Commit to posting once a week, every week for a whole year? Hey that’s not a bad idea. The problem for me is going to be sticking to it – I’m terrible at sticking to things – but that is the whole point I suppose.
Just in case you haven’t heard about this WordPress are encouraging us all to fill up their servers!
I figure I’m not going to be able to post something big every week so it’ll most likely be something smaller, probably just how to solve a problem or achieve a piece of functionality in WordPress or Magento.
And finally… It will hopefully encourage me to finally get around to finishing off my portfolio website and blog.
So, Happy new year and here’s to some more frequent blogging…
Fact: AutoHotKey is Awesome
If you haven’t heard of it then I would encourage you to check it out as it makes doing anything in windows a whole lot more tolerable. The program basically automates keypresses in windows, but can access all sorts of actions within windows, such as resizing windows and accessing your clipboard. There is a great article on AutoHotKey on Lifehacker.com.
There is a bit of a learning curve but the documentation on the site is very good and the official forum serves as a good fallback if you are struggling to do something.
What I wanted to do in this post is show you how easy simple scripts can be. This is a script that enables your mouse to perform an AltTab using the right click and mousewheel:
Rbutton & WheelDown::AltTab
Rbutton & WheelUp::ShiftAltTab
RButton::SendInput {RButton}
To Break this down:
;This line triggers an "AltTab" when the right mouse button is held down and the mousewheel is scrolled down and the next triggers "ShiftAltTab" when the wheel is scrolled up
Rbutton & WheelDown::AltTab
Rbutton & WheelUp::ShiftAltTab
;This line re-assigns the right mouse button to trigger a right click as it is overwritten above
RButton::SendInput {RButton}
Simple.
You can also trigger a Ctrl + Tab to switch between tabs in your browser using the following:
RButton & MButton::SendInput ^{tab}
RButton & LButton::SendInput ^+{tab}
You will need to make these the 3rd and 4th lines to make sure the right click is remapped.
Running your AutoHotKey Script
Once you have finished a script it can be run in several ways. The most simple is to install AutoHotKey, rename your script with an .ahk extension and double click. This will put a green icon with a white H in your Notification Area which can be suspended or exited when you want to stop your script.
You can also compile your script into an .exe but have a look on the AutoHotKey website to see how to do this.
Enjoy!