Tuesday 27 December 2011

Drupal taxonomy manager module

Introduction

I am going to start using this blog to record more technical stuff and ideas, particularly Drupal related, sometimes just random thoughts or comments sometimes, more heavyweight. Hopefully if I tag well and re-organise the blog it should be possible to keep track of various disparate threads and ideas.

Drupal admin is still somewhat awkward in areas, especially in areas like menus and taxonomy where an incredible amount of functionality and a strong api is hampered by administration difficulties in some cases. Managing taxonomies in the administration interface is prime example.

The Taxonomy manager module is a terrific administration module that brings the regular administration of taxonomies forwards in leaps and bounds.

The module

The module has worked well for me in two different scenarios so far, firstly in populating and administrating taxonomies it is far far easier to use than the default Drupal administration. In a few cases I have been able to use this module where I would normally consider populating a taxonomy programmatically. Secondly in the case of a programmatically populated taxonomy that had a huge number of entries normal Drupal admin crashed on display in my web-browser. The taxonomy manager module gracefully handled the display with paging.

Sunday 30 October 2011

Programmer working hours (is 9-5 enough?)

This is an old post pulled from another blog for preservation

Introduction




A while ago I heard the phrase "if they want to work 9-5 then why not just work in a shop?" applied to programmers, the implication being that programming is not a 9-5 kind of job. I have been thinking about this on and off and discussing with people when I get the opportunity, apart from the fact that many people in shops work very long hours there are a number of problems with what was being suggested here.

My thoughts


Computer programming is undoubtedly one of those professions where people are often expected to work long hours, usually without extra reward. A major problem is that we often don't know for sure how long something is going to take (more on why this is in a later post). Another problem is that there are many times where there is a shortage of staff. So many times programmers are expected to work long hours to address these two problems, and many programmers are prepared to put the time in. Sometimes however this doesn't work out, sometimes the programmer who is happily prepared to pull the occasional all-nighters in company X leaves company Y because of long working hours, what is the difference?
Here is one observation or possible reason: programmers like to feel they have some autonomy over what they are producing, they like to understand the reason they doing something and feel that it makes sense. Programmers don't like repeating their work for no good reason, spending long hours working on something that experience tells them will never be used or repeatedly patching and fixing something that they know full well (and will happily tell anyone who will listen) needs to be re-factored and repaired properly. Programmers may be resilient to a lot of the aforementioned woe if it occurs within normal working hours (somebody else is effectively footing the bill, and obeying orders is the path of least resistance), but if the wasted work that they cannot avoid means they also have to work extra hours then those hours hurt, that lost weekend bites deep.

My conclusion


I actually think that programming is a job that is hard to achieve with a 9-5 mentality, but that the hours outside the 9-5 are what people put in themselves, the things that programmers do for a hobby or to keep up to date with technology changes. Given the space many programmers will do things themselves and extend their own skills and knowledge in a way that ultimately benefits the companies they are working for. Sometimes programmers given appropriate autonomy will even extend part of what they do at work into this extra space.
Many programmers work in a challenging environment of constant change, it is hard to manage this kind of career on a 9-5 basis. You would assume that a language interpretor who gets paid 9-5 doesn't switch off and never use the foreign language outside of work (if he did it would be hard to maintain the level of skill required), I believe that programming is a similar profession.

MySql Definer problems

This is an old post pulled from another blog for preservation

Recently whilst moving a legacy application, I had to make it more secure. In trying to make the database more secure I ran into one particular error in some of our Java code java.sql.BatchUpdateException: The user specified as a definer ('root'@'%') does not exist

The definer ('root'@'%') is the root of my problem (pardon the pun). Our application was accessing MySql as root user (so a compromised application could take control of all the databases on the server), even worse having root@% as a user in the database means that root access is not just restricted to local access.

Having given the application it's own user and remove root access from anywhere everything was running fine until we hit a page activated a trigger. Definers appear in a number of places in MySql including triggers, stored procedures and views (not sure what if any problems occur with a view if the defined no longer exists but will make a point to find out). My problem was an easy fix there was just one trigger that needed altering.

Although I have not had to yet, next time I run into this problem I would be looking to take an approach more similar to this one somewhere in that post or the comments there should be a working solution there to remove the definers from a MySql dump. I assume (would check) that the default definer if set by MySql would be the user credentials used to load the database again.

Fortunately the problem was spotted on a test server first.

Sunday 21 August 2011

Turning Chinese, no such thing as a standard search?

Short but sweet, this one. I have already noticed the filtering bubble on one or two sites that I use, particularly I increasingly get the "Chinese influence". Because of my interest in Chinese language, language learning related things and particularly Chinese related things and people I get increasingly connected to Chinese things and Chinese people. This is actually starting to become a hindrance, from the point of view of some services the granularity of what I may be interested in Chinesewise is pretty low. For example I can usually work out why Linkedin is suggesting I want to link with most of its suggestions, however on more than one occasion now it throws in a random Chinese person, who I have not worked with, isn't interested in the same things as me (technology or otherwise) and isn't even geographically that close (although to be fair UK rather than China is somewhat closer than it could be).

How many ways, are decisions about what I see being influenced by what is on my profile? On one site in particular I seem to get a suspiciously high number of adverts regarding hair restoring products and eye-care/laser treatment/optician related links. I don't search for these things, but it wouldn't take much processing to target me based on my follically challenged, bespectacled profile picture.

Once we wrote content for people to read, then wrote content for machines to read, now write content for people that machines may decide they want to read.

The thing I find really interesting however is that, if you are considering search engine optimisation you also increasingly need to consider the profile of the person who is doing the searching, because all search results are not equal. Perhaps even more worryingly increasingly more of our lives are being determined by computer algorithms, we are moving closer to time when algorithms control the world.

Sunday 14 August 2011

Getting around DNS

This is an old post pulled from another site (for preservation)

Jotting this down really, because it is the type of related problem that crops up every now and again and sometimes if my brain is not firing on all cylinders I get stumped for a while.

The problem

Really wanted to check out an open-source project NOW yet svn checkout couldn't resolve the host for the repository. My PC can't find the DNS, other PCs on our network can't find it, it was there yesterday (or rather it was there for me at home).

The solution

First checked that the site was available for some people by checking on http://downforeveryoneorjustme.org/ apparently it is just me (and a few others I guess). Next I need an IP address so searched in Google for sites that give IP address if you know the DNS (because I can't do this for myself right now), first one couldn't find it (down for them also it seems), the second one gave me an IP address(phew) Next problem is that the IP address just takes me to the server for their hosting company, so I need to add an entry in my own hosts file (/etc/hosts) on my Linux system and another entry for the svn. address I was originally trying to use there. Bingo now my PC knows how to find their server and make the request in a way that takes me to the pages and data I want (using the expected host). In the past have also resorted to trying different DNS servers (opendns or googledns) Additional later note: and of course I could always get a command-line on a remote server somewhere (we have a client server in Hong Kong for example) and use that location to do my investigation from.

Saturday 13 August 2011

JavaScript

This is an old post pulled from another site (for preservation)

JavaScript has always been an important programming language for me, I use the term programming language rather than scripting language deliberately. Now I am taking the time to rationalise the technologies that I use and develop in (develop my skills in), I have to say that JavaScript is part of the core. JavaScript has often been associated with the web-browser and treated there as something to add a little bit of visual whiz-bang or tie together a few things that you might want to do in the browser that are not covered in standard HTML. bandwidth, performance, the danger of JavaScript being turned off, the single execution thread ("a script on this page appears to be busy") and other factors have contributed to a general feeling of "not wanting to do too much in JavaScript". These days performance appears to be much less of a problem, Linux on a PC emulator running in your browser for example. The single execution thread blocking problem is solved with HTML5 web workers. Various libraries from JQuery to Extjs allow you to create an interface entirely in JavaScript. You can build sophisticated mobile applications using Phonegap and Titanium. I feel that as more people develop for HTML5 factors like the scriptable video and SVG and going to drive a lot more development in JavaScript and of-course applications like node.js are continue to raise the profile of JavaScript in other areas. Something that has me really excited though and something I will definitely want to play with when I get a nice stretch of time is Quake2 in JavaScript. This project is based on Jake2 which was a Java port of the open sourced Quake2 code that did leave me with mixed feelings (the code very much looked like a conversion from C to Java mostly via implementing a bunch of static classes), however a long time ago I had some fun writing a mod and experimenting with the original Quake source code. The project looks like it needs a bit of effort to build but I am looking forward to enjoying that at some point.

Moving some posts in here

I recently started posting some random thoughts, comments etc, mostly about techie stuff else where. i think they are better posted here so I will drag those four articles into this blog shortly

Again the purpose of this blog is mainly just to collect together things I might want to come back to, being online it is accessible anywhere, and although nobody else reads it, it helps me to focus by knowing that in theory they can.

Saturday 25 June 2011

Dropbox, more cross appliance goodness

Another short but sweet, after my last post about the Kindle I reaslized I had forgot to mention dropbox. Definitely worthy of a mention in the same thought as again I have had a wonderful experience from the service. Not only does drop box keep files synced and available for me across a number of devices it also provides extra functionality on my Ipod Touch, I can choose to save files there of various different types, actually open them etc. etc.

Now I am starting to sound like an advert for Kindle and Dropbox, have to think of something a bit gloomier and more negative for my next post.

Sunday 12 June 2011

Whispersync and Kindle

Short but but sweet post this one, a while ago I bought a Kindle for my wife, she loves reading and loves books and always said she wasn't interested in Ebook readers. Well she grudgingly decided to try her new present and now a few months later there is no going back. The Kindle2 was a big big hit.

I don't have a Kindle of my own but have played with one a bit (when I am allowed ;)) and it is an excellent device in my opinion. Something else has impressed me even more though and that is the Whispersync technology. Our Kindle is attached to our Amazon account and I bought a few books for myself and installed the kindle application on my Ipod touch and Android Phone.
I haven't worked out exactly what the syncing does, I don't need to it just works. Very occasionally I pop-up just confirms that I want to jump to the last place I was in a book on another device but that is usually reference books where I am jumping around a lot. Basically it just works, nice one Amazon.

I am not suggesting that reading a book on a phone or Ipod is as good as reading it on the Kindle but it is very nice to be able to pick up reading where you left off if you miss or bus or for some other reason you suddenly have some unexpected free time on your hands and not many options.

Be interesting to see whether Apples new cloud thing works as smoothly, even if it does though Amazon where there first in my humble opinion.

Monday 30 May 2011

Fractured Identities

I am back again, I think this blog is going to be updated much more frequently, I have a building pressure of thoughts to offload in this private (mostly) space. I re-read some of the material I posted a long time again and it is a very useful review process, so time to start dumping more half-baked thoughts and seeing what happens in my head.

Something that has bothered me for a long time and something I am going to think about in more detail for a while is on-line presence of the individual. A couple of weeks ago I went back to the place where I went to school and met up again with some guys I originally knew from over two decades ago. We meet up approximately once a year or so and have one or two shared interests in common even though we have all lead very different lives. Careers, interests, lifestyles, philosophy, outlook, are all very different. Every time we meet up we have a great time, but between times we communicate very little and know very little about each other. I am sure that the person we present to each other is relevant to the situation and that this is in part what makes it such a pleasure to meet again. We have little connection on-line (apart from the occasional email to make arrangements). The people we are when we meet are in many ways shaped by and relevant to the situation and the history we share.

I have multiple twitter accounts including twitter like accounts in Chinese etc. I struggle with Facebook, the concept that there is a single me that can be represented, distilled and relevant to all the real people I know. How can the various circles in which I move, the various persona's and interests, the professional links converge on one spot in a meaningful way? If I am interested in someone on a language learning basis, I want to read a blog or follow a twitter feed that is mostly relevant to this aspect, not filter through the chuff that is the rest of their lives or get asked if I want to connect with friends of theirs that they go diving with. Perhaps I will meet them and connect more fully (and then be interested in more aspect) but perhaps they will lose interest (even if only online) in languages and the feed will dry up (effectively vanishing from my radar).

I don't want to connect with my teenage sons on Facebook, I should be connecting with them in real life, I am pretty sure that connecting with them on Facebook would dilute the experience on both sides.

Ex-coworkers have largely nothing to do with people I meet to learn foreign languages, my messages to them, links for them, information I share with them (hey I might want to work with them again some time) should not mix. In fact it would seem that in a lot of cases the only reason to mix is to say to one group "hey look how well rounded I am" by exposing them to the edited highlights of the rest of my life. Regardless of tagging etc. I don't have many good ways to separate the life-streams without spending too much time organising (organising something that works better if spontaneous) or expecting people following me to somehow organise theirs. So we are polluting each others lives with spam. No better than inviting someone around in the 1970's to watch the 4 hour sideshow of your holiday (unless there is special interest after the first 10 mins they don't really care).

If I follow the public, social feed of some guy who is known for developing a cool programming platform, anything not related to that platform is spam to me, time wasting spam, we are not related, we are not friends, I don't have a reason to be interested.

Maybe this seems a little harsh, maybe a little extreme, and there are some focused feeds out there, and people who are not afraid to set-up multiple focused on-line presences. Perhaps I could be accused of not being interested in people? Nothing is further from the truth, I enjoy finding out about people, I just find that face to face, with all the feedback mechanisms we have evolved to gauge interest the experience is order of magnitude better.

Facebook of course is a harder place to fracture, or even linkedin (which is admittedly more focused on fabricating an image for yourself that may make you more employable). Maybe I am over reacting, a lot of the information requires some action to pull it out, but it seems to me that there is still too much I have to actively ignore or too many distractions.