Articles in the Computers Category
PHP, regular expressions »
Problem
I have a ton of date strings in the stupid US style dd/mm/yy format. i.e. 12/24/09 being 24th September 2009. I need to convert them to the UK style dd/mm/yy.
Solution 1
As a string in PHP is really just an array of characters, the simplest fix was to address the individual number characters by their positions within the sting, and rearrange them into the format I wanted:
$d = “12/24/09″;
$d = $d[3].$d[4].”/”.$d[0].$d[1].”/”.$d[6].$d[7];
echo $d; // displays “24/12/19″.
Solution 2
I posted my solution on twitter (@hutchings) and asked for comments and @londonhackspace organiser Jonty came …
Flash »
Problem
I’m doing some freelance Flash development, and it’s been a while. I have just created a dynamic text field that I wanted to fill via actionscript, then fade in via an alpha tween. This wasn’t working, even if I set _alpha = 0 on the movieclip containing the text field.
Solution
You can only set _alpha on a Dynamic Text field if the font has been embeded (with the embed button).
Works now! wohoo! Simple stuff that I’ve known in the past, but forgot.
Networking »
Problem
We’re building a website in Business Catalyst and need to provide the client with a test site during the design, build and testing phases. This test site needs to be accessible on a sub-domain of the client’s main domain. At the same time we want to retain DNS control of the parent domain, and stick a small holding site there.
For example:
‘mydomain.com’ has a small holding site on it, and mail services etc work as usual for that domain.
‘test.mydomain.com’ needs to be delegated to the Business Catalyst nameservers.
Solution
Turns out this is …
Joomla!, Windows »
Problem
When trying to add a Plugin, Component or Module in Joomla’s Extension Manager, you might get the following error:
JFolder::create: Could not create directory
Warning! Failed to move file.
Shown here:
This is likely – but not definitely – to be after the site has been moved from location to another, a change of directory, or server.
Solution
When a Component, Plugin or Module is added, the Joomla system attempts to copy the installable zip to a temporary directory, called ‘tmp‘. From there, PHP extracts the files and installs them. The error above usually occurs for …
Day to Day, Google Chrome, Mozilla FireFox »
Problem
I need to send a mate a link to an item on eBay after breaking his strimmer. The nice people at eBay have reworked their URL structure recently to improve SEO, so a link to a single item now looks something like this:
http://cgi.ebay.co.uk/Medium-duty-bump-head-for-Kawasaki-brushcutter-strimmer_W0QQitemZ190302614007QQcmdZViewItemQQptZUK_Home_Garden_GardenPowerTools_CA?hash=item2c4eeb71f7&_trksid=p3286.c0.m14&_trkparms=65:12|66:2|39:1|72:1686|293:1|294:50
..which is not exactly Twitter, Live Messenger or email friendly. Long URLs break often in email and instant messengers when they ‘wrap’ at the end of a line (like the above is doing).
Solution
Here’s the old style linking system that still works: http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=190302614007
So you can use that structure for a …
Networking »
Problem
I’m now using ZoneEdit to handle the zone record for new domains. It gives far more control over the zone, and is very quick with updates etc. I needed to setup one particular domain so that all traffic to that it – and any subdomains – went to one IP address. A ‘catchall’ if you like.
For example: ‘myquickfix.co.uk’ and ‘www.myquickfix.co.uk’ have A records pointing to 82.109.178.44. If I needed the subdomain ‘pants.myquickfix.co.uk’ to point to that IP also, I could add a CNAME record, or another A record. But if …
Windows »
Problem
Every so often when I’m typing, usually when I’m coding because I use so many shortcuts, the at sign ‘@’ and double quotes (“) get swapped. Annoying!
Solution
When this happens it’s because I’ve accidentally pressed ‘Shift + Alt’. THis key combo causes Windows to switch my keyboard (input) language to US. The easiest way to stop this happening, is disable the ‘Shift+Alt’ shortcut:
1) From ‘Control Panel’, open the ‘Regional and Language Options’.
2) In ‘Regional and Language Options’ window, select the ‘Languages’ tab, and click the ‘Details’ button inside the ‘Text services and …
CSS »
Problem
I’ve just had to convert a photoshop visual to a wordpress template. The designer wanted a bulleted list where the bullets themselves were very close to the list items, and were small dashes. Cross browser support for list item and bullet styling is ropey at best, and to make things perfect I’d have to resort to browser specific styles.
Solution
The solution I think I’ll be using for the rest of my ‘web’ career will be this. JUST FORGET THE BULLET ITEM, and use positioned background images instead.
In the stylesheet, add styles …
Adobe Premiere »
Problem
A colleague was having trouble getting a DVD imported to Adobe Premier for some overlay edits etc and asked me to take a look.
Solution
VOB files are MPEG-2 files with a different coat on. Rename the .vob file to .mpg and it should work. This also works in Sony Vegas and probably other software. No idea how copy-protection on some disks might effect this?
That really WAS a quickfix and probably not worth posting. If you have any questions, thoughts or corrections please post a comment below.
Internet Explorer, Tools »
Problem
While doing web development, I frequently need to insert lorem ipsum into a text field or textarea. To do this – bearing in mind that I don’t really like or use bookmarks, too messy – I tend to google “lorem ipsum”, hit lipsum.com, select/copy the block of text, and then return to my form field and paste it.
I wanted a quicker solution, and as I find myself using IE more and more to develop in now (thanks to the excellent ‘Developer Tools’ extension – never thought I’d say that!) my lorem …
Add to My Yahoo!