I had been hitting my head against the wall when I couldn’t get an edited XML file to save due to file permissions, even though I know that it was OK.
For some odd reason, when I went to save the XML file, it would try to write the file to the root directory, instead of the current working directory (where the file is read from).
As such, using realpath() to keep the complete system path to the XML file when you load it will make sure that DOM isn’t trying to save to the incorrect directory:
$myfile = 'myxml.xml';
$myfile = realpath($myfile);
$doc = new DOMDocument('1.0');
// Let's just add a couple of elements for good measure
$root = $doc->documentElement;
$title = $doc->createElement('title');
$title = $root->appendChild($title);
$text = $doc->createTextNode('This is a title');
$text = $title->appendChild($text);
That title is a mouthful, isn’t it?
Anyway – one of the recent issues I’ve had in my coding journey is using DOM and XPath in conjunction to navigate around an AML document. The problem came when the text values in an element would be wrapped in a CDATA tag: Continue reading
Content delivery networks are all the rage now, so I’m looking at creating a CDN that will work nicely with my WordPress installation.
Rather than just blindly use a plugin, I want to make the code trustworthy and reusable among other blogs that I manage. Certainly the easiest way to get a CDN working on your blog is to use the Jetpack plugin from Automattic. This transparently turns the content on your blog into a CDN-delivered bowl of web content.
Some people might not want the full weight of the Jetpack plugin or to use the WordPress CDN so here we go. I’m going to step through the process that I used to get a CDN working myself. Continue reading
A couple of times I’ve hit an issue whenever I install NetBeans on Ubuntu.
The fonts in the menu and explorers become bold. This is mostly not an issue, but when you are editing files the font changes from normal to bold so that you know that you have unsaved changes.
This appears to be a bug with the Oracle JDK, but it’s Ubuntu’s fonts that are triggering it. The easiest way to fix this until there is some proper resolution is to run the the following command to remove the fonts.
sudo apt-get remove fonts-unfonts-core
This will remove the fonts causing the issues. Restart NetBeans for the changes to take effect.
See the bug report at NetBeans for more information
I’ve been somewhat busy latey so this isn’t the typical technical blog post, but rather a pointer that my regular readers can find me posting semi-frequently on here but also in other places.
That’s right, I’ve joined the ranks of the unpaid professional blogger and so you can find me writing with my friends over at BlackBerryOS.com about BlackBerry news.
Keeping with the BlackBerry news, I’m also the co-host over at QuickBerryPodcast.com where we record weekly.
So, business should resume as normal over time here as I’m steering clear of posting more RIM or BlackBerry related content. Instead, I’ll be sticking with the dry technical ideas and how tos.
Maybe it’s because I’m what would be regarded as a ‘power user’ – but I find calendars on my phone and online with Google very, very useful. What is a seemingly simple tool is enabled and ready to make magical things happen.
A discussion that I raised with one of my BBM groups today was a question: Will BlackBerry 10 support multiple calendars? This is and always has been a big deal for me. Although I found myself explaining to one member why it is important. I hadn’t really considered that those who don’t use calendars wouldn’t see the benefits of multiple and shared calendars.
Read on to find out how amazing multiple shared calendars are. Continue reading