Date: August 24th, 2012
Category: ICT
Tag:
be the first to comment

Adding Feature Image to WordPress RSS

So, I wanted to pull in the feature image to a WordPress RSS feed. It took me a little while to figure it out but it was easy enough in the end. The finished product looks like this:

add_filter('the_category_rss', 'add_feature_image');

function add_feature_image( $content ) {
	global $post;
	if(has_post_thumbnail( $post->ID )){
		$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
		return $content . '<featureimage>' . $image[0] . '</featureimage>';	
	}
	else return $content;	
}

So, I first add a filter to the category rss output. Why category I hear you ask, because when you look at /wp-includes/feed-rss2.php you’ll see that the category output in the rss is the only one that outputs it’s own tags. For example, the link tag looks like this:

<link>< ?php the_permalink_rss() ?></link>

So it’s no good for adding tags to. the_category_rss() outputs returns the category names in a tag called category. With me?

Then the filter runs a function (add_feature_image()) which checks to see if there is a feature image and if it does, appends a featureImage tag with the image’s url to the end of the categories.

The above is simply packaged up into a plugin and enabled in the admin section.

Easy!

Date: August 23rd, 2012
Category: Politics
Tag:
be the first to comment

Privacy

I’ve been trying to write a post on the importance of privacy because I feel like it’s been forgotten but I just can’t get it to come out right. The crux of the point I want to make is that privacy is a civil right and it’s an important one. It protects us, as individuals and members of a community for the excess of government and business and is one of the things that allows people to scrutinise government without fear of reprisals. If governments know everything they can make life very difficult for those that disagree with them… you know, like in Syria, China, Iran, and a whole bunch of countries it’s very easy for us in the west to wave our finger at.

But that’s the thing, we do a lot of finger wagging because, for the most part, we live in a democracy and can take a certain amount of free speech for granted. Moreover no one fortunate enough to live in most western democracies (or at least the anglosphere – one can always think of examples to counter these blanket statements about geographical regions can’t they) has a living memory of anything other than what can globally be considered a fairly high level of freedom.

So we don’t value it. We don’t think anything bad could happen here because for most of us it hasn’t ever happend. We’ve lived during peacetime and have never really had to watch what we say. We trust government too much – an institution that has (or should have) built in checks on it’s power because it is so easy and tempting to abuse.

So these days we just hand over all our personal information to reasonably unregulated corporations – at least as far as protection of private information is concerned – and assume that everything will be fine. I don’t have anything to hide, I haven’t broken any laws, what could possibly go wrong?

So I want to yell from the roof tops: “Don’t take this for granted. We need to protect our privacy so we remain free. Give them an inch and they’ll use it to take the next inch.”

But instead I feel like I’m being conspiratorial when I even try to say that legislation around cookies is important and all these ‘cyber security’ laws that have been implemented since 2001 are dangerously eroding rights that took centuries of fighting to gain. But instead I log back into my google account so that one of the richest companies in the world can keep an eye on my every move to sell me things that I don’t want, I was just looking them up for a client at work.

*sigh*

Date: April 27th, 2012
Category: ICT
Tag: ,
be the first to comment

Getting shipment tracking number from order object in Magento

I’ve been pulling my hair out for a few hours trying to figure this one out so I thought it was probably worth writing a quick post about it.

I’d installed the Webshopapps Premium Order Export Module for a client which worked perfectly as expected. However the client wanted shipment tracking information included in the report so I had to modify it slightly.

Getting the Shipment Method was straight forward enough:

$order->getShippingDescription()

However the Tracking number proved to be much more difficult. This is how I ended up doing it:

$tracking = Mage::getResourceModel('sales/order_shipment_track_collection')
	->setOrderFilter($order)
	->getData();
$trackingNumber = $trackings[0]['number'];

Easy enough – I just had to cross reference a few forum posts to figure it out so I thought it was worth mentioning here.

Please note that I’m assuming there is only one tracking number, you might want to modify this if you want the most recent tracking number.

If you’ve got a better way of doing it, please leave a comment.

Date: February 9th, 2012
Category: ICT, Me, Politics, Travel
Tag:
2 comment

Today I Quit Facebook

Today I quit Facebook. I’ve been mulling over it for quite some time now and, in a moment of impulsiveness, I clicked the delete button.

It was time to stop complaining and put my money where my mouth is (was?). I’d actively withdrawn from it anyway, so why not take the final step and leave?

Of course my account won’t actually be deleted for another fortnight, that’s just how FB rolls. They’re worried that I might change my mind in that time so have, very thoughtfully, decided need a bit of a cooling off period.

So why did I do it?

We all know Facebook are essentially a company that trades in a very valuable commodity – highly targeted marketing. Facebook know a lot about you and sell that information to anyone that wants it. Like any of these services, that’s the trade off. You get access to the world largest social media service with a user-base of around 800 million and in return Facebook sells information about you to advertisers. (So why do I keep getting weight loss ads served to my Facebook page?)

So the question is: do I feel that is a fair trade. Is it worth commodifying my personal information so that I can keep up to date with what my friends just ate for dinner? Truthfully, it is up to a point, and up until today I’ve been happy to pay that price. I’m living in London at the moment and the vast majority of the people I know and love are living in Melbourne so I want to see pictures of them and their kids.

I’m also someone that likes to think of themselves as an activist. Whist I’m not as active as I used to be, Facebook is a really handy tool for an activist. When I put together martinfergusonisaratbastard.com it got about 300 hits in the first day – most of which came from Facebook. So I’m reluctant to let that go.

Finally, as far as my reluctance to leave Facebook goes, I’m a web developer. Facebook is central to the online world so I feel like I should do my best to keep up with what is happening on Facebook, at lease from a technological perspective.

So, with all these good reasons to stay on Facebook, why would I leave?

Ownership, commodification and privacy, to name three. Facebook has never really been satisfactory in any of these areas and I’ve finally had enough.

Ownership
I’ve always disliked iPhoto and iTunes. Their default status (and I know you can turn this off) has the program managing your files. That bothers me. They are my files and I’ll do with them as I please thank you very much. My first MP3 player was a 40 Gig iAudio that was essentially just a hard drive. It would simply play every song in the folder you navigated to. It had a horrible interface and was quite clunky but I loved it. It played every format under the sun (critically, including ogg) and I could move files on and off it as I pleased without a program or anything like that. They were my files, why wouldn’t I be able to?

The same can be said for Facebook. I can’t just take my data and go home. I can’t just get a copy of every photo and video I’ve uploaded and do with it as I please.

In contrast, I’m heavily integrated with Google. They aren’t perfect either but at lease with Google I can take my data and go elsewhere whenever I wish. Ironically, it will be when Google take this capacity away from me that I’ll feel the need to leave.

There are also intellectual property issues here that are probably beyond the preview of this post. But who owns the copyright over a photo that I upload to Facebook or a status update? What can the images I’ve uploaded be used for? I don’t have control over that and, fundamentally, I should.

All of this combined with Facebook’s persistant changing of the rules and defaulting everything to public has eroded my faith.

Commodification
Of course Google commodifies my personal information as well, but with Facebook it seems far more intrusive. The information is less anonymised, more readily available for sale and just seems more insidious than other services. Surely this will only get worse with it multi-billion dollar Initial Public Offering

I don’t think it is necessarily problematic to sell things in a targeted manner to users of a service if they have opted in. It’s something I would consider exploiting for Sommelier.net.au. But Facebook take this too far. The information that can be bought by advertisers is far more detailed than I am comfortable with a corporation having.

Which ties into my final point.

Privacy
Facebook knows a lot about you. A lot. A terrifying amount. More than I am happy for any one person, let alone corporation, to know.

I’m a strongly libertarian sort of person. Civil liberties are central to everything I believe in and key to protecting one’s rights is privacy.

Facebook knows too much about me already and has a tendency to broadcast that information whenever it can. It’s key to their business model.

In addition, I don’t have enough trust in a corporation like Facebook to protect my privacy. It isn’t in their interest to do so. I think it’s safe to say that there isn’t a government department in the world that knows as much about me as Facebook and they are far less accountable. Hell, the FBI have admitted to being able to make staffing reductions due to the amount of information they can now get just by looking someone up on Facebook.

Moreover, Facebook track you by stealth when you’re away from the site. Every ‘Like’ button on a website is another little spy for Facebook. And Facebook aren’t playing fairly in this realm. You simply shouldn’t be able to track someone once they have left that site. But Facebook do it incessantly, even once you’ve logged out. Hell, they keep ‘shadow’ profiles of people that don’t have Facebook accounts. To quote George HW Bush, “this aggression will not stand.”

As part of my discontent with Facebook’s surveillance techniques, I will also be removing ‘Like’ Buttons from any website I run. Especially Your Voice in House so people can use the service without a fear that they will be tracked by a corporation. It’s only ego-metrics anyway.

So that’s it. I’m sick of being sold, I’m sick of being spied on and I’m sick of not being able to control my own data. I cannot tolerate this social compact any longer. I quit. I’ll miss knowing what my friends are up, but they’ve all got my email address, they all know my blog and they are all welcome to follow me on Twitter. Hell, Google me if you need.

So who knows. Maybe I’ll utilise that 14 day window and reactivate my account. Maybe I create a new account with a nom de plume so i can continue to spy on ex-girlfriends friend’s children as they grow. But for now at least, I’m feeling quite liberated.

Date: January 5th, 2012
Category: Me, Politics, Travel
Tag:
be the first to comment

The year ahead

I started the new-year well. On New Year’s Day I drove form Antwerp in Belgium, across the Netherlands to Aachen, just over the German boarder. It’s home to the ‘Imperial Cathedral’ and I had wanted to see it ever since seeing the list of the original 1978 inductees to the UNESCO World Heritage list on the wall of a salt mine just outside Krakow Poland (which also happens to be on the list). Its an astonishing building, was well worth the drive and I can now say I have been to all three European sites granted World Heritage listing in the initial round of allocation. Tick.

So 2012 is feeling pretty good for me on a personal level at least. I’ve got pretty high hopes for the year. While last year was one of great adventure, it was also one of extraordinary loss.

I was tempted to follow in the footsteps of more than one blogger and bemoan ‘the state of the union’ – rightly so I might add, this shit isn’t getting any better – but I’m left with a great sense of optimism for the year ahead. Having relocated to London, established a pretty sweet crew and have the rest of Europe on my door step things are looking good. Between now and Summer, I’ve got 3 confirmed overseas trips and up to 5 on the cards.

I’ve got a good job which has cemented a career change that has been on the cards for some time now and there are no shortage of possibilities for what the year may hold.

In 2012, as the shit hits the fan with the welfare state being dismantled in the UK, the eurozone collapsing and Australian politics desperately searching for yet another way to assert its irrelevance, I fully intend to milk this puppy for all it is worth.

Oh yeah, and while I’m at it, ‘tip of the hat’ to the Occupy movement and any other general shit stirrers that don’t have a rightwing or nationalist agenda. I hope you guys keep it up in 2012 – someone has to.

Date: October 28th, 2011
Category: ICT
Tag: , , ,
be the first to comment

Gallery Only Update (version 1.1)

The first update for Gallery Only is now available.

It makes some minor changes to the layout on both the HTML and CSS side which means that anything appearing below the gallery is spaced out a little better.

We’ve added a new class, .go_clear which adds this spacing and could be edited for the purposes of customisation if needed.

Date: October 19th, 2011
Category: ICT, Travel
Tag: , , ,
2 comment

Gallery Only

I’m pretty excited to demonstrate by new Gallery Plugin for WordPress. It’s the first one I’ve generated from scratch and uploaded to the WordPress site.

The plugin replaces the default gallery with clean looking gallery Carousel which utilises the Moodular jQuery plugin

To demonstrate it here are some photos taken by Ariane Barton on our recent holiday:

I’ll update this article once you can download the plugin from the WordPress Site.

Update: You can download the plugin from here.

Update: and it’s now up on the WordPress Plugin Directory site.

Date: October 14th, 2011
Category: Energy, Politics
Tag: , , , , , , ,
2 comment

Coal or Nuclear: something has to fuel our march towards a renewable energy future

I was lounging by a friend’s pool in the South of France a couple of weekends ago, enjoying a last minute surge of summer.

The issue of our energy future was raised and our gracious host stated in a matter-of-fact manner that nuclear energy was clearly the only option left available to service out energy needs. What struck me more than anything else about the statement was that there was an assumption that I had naturally adopted this position – it was the only logical conclusion.

My gut reaction to nuclear is a steadfast ‘no’. You just don’t mess with something that has the potential for destruction on the level that nuclear does. But the problem with nuclear goes beyond that.

To be able to produce as much energy as we are currently producing then our choice is basically either coal or nuclear. But we in the west need to reduce our carbon emissions my something in the order of 90% to 95% of 1990 levels by yesterday at the latest which would naturally lead us to the conclusion that nuclear is the only answer. After all, Global Warming is probably the most serious issue humanity has ever faced so we must stop emitting greenhouse gases immediately.

I’m not sure that I entirely agree with the assertion that nuclear could meet all our energy needs, or that coal and nuclear are our only two choices, but it is certainly fair to say that we cannot produce the amount of energy we are currently using use of renewables. There’s just no way.

The issue for has always been, not how the energy is produced, but how much we use. In a sense I don’t care if we’re using coal or nuclear providing we reduce our energy consumption by 90% to 95% (possibly even more). However if we only need to produce 5% of what we are currently producing then sourcing our energy from renewables is suddenly feasible and should be done for a wide range of health and environmental reasons.

Needless to say, such a drastic change in energy consumption means massive changes in the way the world operates going far beyond major infrastructural changes.

To create a low-carbon world we need to continue to produce enough energy to do the work necessary to reduce the amount of energy we use, keep as many people as possible from starvation and start building the required renewable energy generators. Activities such as the construction of a wind farm requires time and energy which is why we’ve left all this far too late. For now, the only way we can generate that energy is through existing sources of energy, ie coal (or nuclear if you’re in the USA, Japan or France).

Which is why all this nuclear business bothers me. Even if we could, hypothetically, mine uranium in a manner that doesn’t destroy the environment and had a genuine solution to the storage of nuclear waste, the lead time for a nuclear power plant is at least a good 15 to 20 years, probably more. And the lead-time only gets longer when you start talking about wide spread rollout. In 15 or 20 years, it’s all too late.

Where are you going to put all these plants? I don’t want them in my backyard and I’m pretty sure you don’t, but they need to be close to urban centers where most of the energy is consumed. They also need to be near fresh water supplies. Similar problems exists for the storage of nuclear waste. Sorting all this out takes time – lots of time – and then you have to actually build a nuclear power plant which is a time consuming task unto itself.

The pro-nuclear argument also seems to assume significant technological advancements in the breakdown and storage of nuclear waste – technologies which may be available but remain largely untested because very few nuclear power plants have been built of late.

But ultimately what bothers me about nuclear is that it is very 19th Century, industrialist thinking. It’s a ‘science will save us’ or ‘we command nature’ sort of position. It’s a technological fix to a problem caused by an over reliance on technological solutions.

Our energy future has to be low tech. Windmills are reasonably low tech. Mirrors focusing the sun’s rays to heat something up is low tech. We need to use the technologies that are available to us now and nuclear just isn’t one of those.

This leaves me in the awkward position of supporting a coal fired renewable energy future.

My brief, overly simplified and factually inaccurate history of how we ended up in this mess

It’s the late 50s/early 60s, things are good! Taxes are high, wages are high, inflation is high unemployment is almost non-existant and everyone is happy. We’ve never had it this good.

Oil is cheap, the population is booming, there is disposable income and the war is a distant memory for a young generation who are enjoying a level of prosperity with a wide base – the likes of which we haven’t known before. Take off your clothes, smoke lots of weed, go on a road trip with no money, it’s a revolution you know.

Working class people can own a house and a car, health and education are free, there is a massive expansion of the welfare state. And it’s all affordable because everyone is earning a good wage, the population is still quite diminished (although rapidly growing) so less people are placing demands on the service.

Tax and government are highly centralised thanks to the war effort, the top marginal income tax rate is just below 70% and there is loads of money to throw around. Lets make tertiary education free!

Then the mid-late 70s happen. The brutalised and over simplified version of Keynesian economics
we’d grown so used to fails us. Stagflation! And just when it couldn’t get any worse: Oil Crisis!! God damn it, it’s expensive to drive places now. How am I going to get to work if I am lucky enough to even have a job?

Quick, someone pick up that book written by Hayek, something about surfing, he said this would happen!

Roll on the 80s, a time of excess. Business is booming but everyone I know is still unemployed.

Globalisation! Deindustrialisation! Off shore the shit out of that industry! I’m rich!!

So on through the 80s and 90s: cut spending, lower tax rates and flatten them out while you’re at it. How did we get so bloated, sell everything! Business can run telecommunications infrastructure more efficiently than a government. Business is good, government is bad. Oh look, selling everything has meant that we’ve now got a pile of cash. We can still afford schools and hospitals, especially since we’ve cut all their funding as well.

Come to think of it people should really pay for the services they use, let’s cash in our future and start charging for a tertiary eduction. All these Art’s Degrees are just costing us money. Everyone I know got a free education, why should I care if ‘the kids’ get one or not – particularly kids whose parents didn’t go to university and can’t pay for their kids to attend. How did we get so carried away with upward social mobility in the first place?

Fast forward to the last five years: Debt crisis! The pursuit of growth has left the economy significantly over stretched. There are skills shortages. Our universities are propped up buy foreign students whose parents undergo extraordinary financial hardship to send one child to university in Australia giving Australian Universities enough revenue to function.

Unemployment rates spike, there’s a housing bubble created by baby boomers that decided to cash in on the 1960s boom period they grew up in and spend our inheritance investing in the now bloated property market. And who can blame them?

The population keeps growing at ever increasing rates despite birthrates being below replacement level. As it turns out it is much cheaper to have people in the majority world absorb the cost of training a doctor and then letting them immigrate to Australia. Poor countries pay for their education, we reap their fruitful and taxpaying years!

And we can do this for any trade with a skills shortage! I knew it was a good idea to cut spending on education. Importing the future of other countries is much easier.

So tax rates a low, the population is growing faster and faster – we need it to, how else do we ensure that the economy keeps growing. But how do we pay for the growing demands on public services? We can no longer afford to fund the services that people have become so accustom to.

Austerity measures! Cut public spending, it only benefits those that are still reliant on public services anyway. Pass on the burden of debt to those that struggle to get by while the wealthy hid behind tax loopholes. Come to think of it, the rich wen’t paying much tax in the first place, so why don’t we cut their taxes some more – that’s sure to stimulate growth.

So now the people are getting angry and taking to the streets. They’re occupying Wall Street! Their rioting in Athens!

Where to from here?

Tax the rich.

Solutions to energy consumption

Reading The Guardian today (from my new abode in London) I came across an article about a group of British academics that were starting trials on a hot air balloon ‘the size of Wembley stadium’ that would float 20km above Earth and pump ‘hundreds of tonnes of minute chemical particles [sulphates and other aerosol particles] a day into the thin stratospheric air to reflect sunlight and cool the planet.’

That sounds pretty hi-tech to me. And just think, we’d be able to keep burning up fossil fuels and pumping as much carbon dioxide into the atmosphere as we want!

Am I the only one that can see this going wrong? Since when has pumping chemicals into the stratosphere been a good idea? Not to mention the fact that I’m sure it requires a huge amount of energy (hence more carbon pollution) to get the balloon up there as well as producing the chemicals and then pumping them up 20km of hose.

When will we stop trying to come up with these high-tech fixes to the problem of global warming? Technology will not save us, we just need to use less energy.

Meanwhile, back in Australia, the newly elected Victorian Baillieu Government has introduced new planning laws that will destroy the feasibility of Wind Farms in Victoria.

Wind farms are a low tech solution to our energy needs which, if coupled with a huge increase in energy efficiency across the state of Victoria, could provide enough energy to ensure we all lead comfortable, carbon free, lifestyles.

There are many concerns about the new planning laws: they will retard the growth of wind power in Victoria; thousands of vital rural and regional jobs won’t be generated; and so on. But perhaps the most concerning thing is that it would seem that the government is adopting the policies of the Australian Environment Foundation and the Victorian Landscape Guardians – both essentially front groups (AEF is funded by the right-wing corporate funded think tank the Institute of Public Affairs).

It’s also concerning the journalists aren’t picking up on these well established links.

It all reminds me of an Arch Druid Report article from 2009. The article compare’s the viability of two potential renewable energy sources: Fusion reactors which have had billions of dollar spent trying to development and are yet to produce one kilowatt of usable energy; and micro-hydro systems built from recycled washing machines which required very little research and development and are currently producing small amounts of energy with a high level of efficiency.

So let’s get behind Beyond Zero Emissions, Friends of the Earth and others like them and develop an low-energy future that doesn’t need balloons spraying chemicals into the stratosphere.