<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>Latest entries from francis.blog-city.com</title><link>http://francis.blog-city.com/</link><description></description><copyright>Copyright 2008 francis.blog-city.com</copyright><generator></generator><lastBuildDate>Sat, 02 Aug 2008 20:59:00 GMT</lastBuildDate><image><title>Latest entries from francis.blog-city.com</title><url>http://server1.blog-city.com/images/bc_v5_logo_small.gif</url><link>http://francis.blog-city.com/</link></image><ttl>360</ttl><docs>http://backend.userland.com/rss</docs><item><title>Writing</title><guid isPermaLink="true">http://francis.blog-city.com/writing.htm</guid><link>http://francis.blog-city.com/writing.htm</link><pubDate>Sat, 02 Aug 2008 20:58:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=writing</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p>I finished my radio play off today and will be sending it to the BBC next week. Quite excited about it but not really holding out a huge amount of hope because there isn&#39;t a lot of point getting too worked up about stuff.</p><p>I&#39;ve been reading <a href="http://www.numberwatch.co.uk/number%20watch.htm" target="_blank">number watch</a>  a lot recently. It fits with my world view very well, I started out my proffessional career in the 1980&#39;s with a degree in Applied Statistics and computing. Whenever I hear one of the meedja panics, most recently about chlorine, I know in my heart it is rubbish but don&#39;t have the energy or the time to look into it. The guy who runs this site does and presents a very good case indeed. I really recommend you look at <a href="http://www.numberwatch.co.uk/Stuff.htm" target="_blank">this presentation</a>  and have a think about what he says.CORRELATION IS NOT CAUSATION. I think a lot of people need to understand this properly. I think I&#39;ll buy his books when I&#39;m feeling less skint.</p><p>I&#39;ve been working my way through <a href="http://www.pragprog.com/screencasts/v-dtrubyom/the-ruby-object-model-and-metaprogramming" target="_blank">Dave Thomas&#39; video presentations on Ruby meta programming</a>, really interesting and putting all kinds of ideas in my head. I&#39;m probably going to buy most of the Pragmatic Programmer&#39;s videos. I was thinking of learning another programming language, as is advised in the <a href="http://www.pragprog.com/titles/tpp/the-pragmatic-programmer" target="_blank">Pragmatic Programmer</a>,  but think there&#39;s still a lot of Ruby to understand after seeing these. The first one is the best explanation of where object oriented programming comes from and how it works I&#39;ve ever seen. Also, as a Sun Certified Java whatsit it&#39;s even more obvious that Java is only half way there at best.</p><p>I&#39;m also going to resurrect&nbsp; an old project called pharmarketeer (already own the domain) and try and get it live using Rails. I&#39;ve recently opened a small account on <a href="http://github.com/">github</a>  to do my version control, probably going to start using it for my writing too. I used to use svnrepository and when I went there to cancel my account it was annoying to see that they do git too, but haven&#39;t bothered telling their customers. I probably wouldn&#39;t have gone to github if I&#39;d known, but they do allow 5 private repos against svn&#39;s one, but svn allow unlimited collaborators and were about half the price.</p><p>Deb is finally home after a month with whistlestop turnarounds before she went off to the next thing. Jon off to scout camp. I spent most of today working because I got behind working from home on Friday because of a long and boring saga about keys that don&#39;t work some times. I&#39;ve changed the lock for a new one. </p><p>Bed time, gotta get up and do my meditation practice. For some bizzare reason it seems to be harder to get it done at the weekend, even though you nominally have more time. Probably <em>because</em> you have more time, you waste it.</p><p>later. </p>]]></description></item><item><title>Men, women and society</title><guid isPermaLink="true">http://francis.blog-city.com/men_women_and_society.htm</guid><link>http://francis.blog-city.com/men_women_and_society.htm</link><pubDate>Sun, 27 Jul 2008 12:35:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=men%5Fwomen%5Fand%5Fsociety</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p style="margin-bottom: 0cm" class="western">Way back in the mists of time men were just men. They had the dominant role in society, at least in theory, and women couldn&#39;t compete with them in the workplace because they had other things to worry about. In some ways this was less of an issue than you&#39;d think for most of them. They weren&#39;t interested in competing particularly. There were two very different roles for men and women and each tended to follow their biology more.</p> <p style="margin-bottom: 0cm" class="western">Then we had the sexual revolution of the sixties, in particular reliable contraception. This blew away a lot of preconceptions about things on the back of a terrible war where women had started to do jobs that were nominally only for men. Women could have sex as much as they wanted without risking pregnancy. This meant that they could start to move away from their biology and start competing with men directly. It also blew away the myth that women are scared of sex, in fact they were scared of pregnancy, a much more difficult thing for them to deal with than some idiot leaving a trail of sperm everywhere.</p> <p style="margin-bottom: 0cm" class="western">This economic trend was the basis for the feminist movement. There were simply more women not being the housewife, and having jobs and careers of their own. More women were career minded, were limiting their families and so on. This meant that they wanted the closed doors and glass ceilings that men had put in their way removed. They were right, it was wrong and unfair. Of course, it wasn&#39;t a conspiracy by men, it was just the way things were, but that doesn&#39;t suit if you want to be <em>angry</em>.</p> <p style="margin-bottom: 0cm" class="western">There was also a vigorous and correct campaign to protect women from predatory men and exercising their right to dress and behave how they see fit. No-one argues with this, it was right and just. An unfortunate and dangerous sub current of this was that <em>all</em><span style="font-style: normal"> men were potential rapists and predators, and </span><em>all</em><span style="font-style: normal"><span style="text-decoration: none"> men should be watched carefully. A justified wariness and caution around men you don&#39;t know well, given that they are in general about half again as strong as a woman of the same size, was turned into an ideology. All men were rapists, and could not be trusted.</span></span></p> <p style="margin-bottom: 0cm; font-style: normal; text-decoration: none" class="western"> Let us pause here and restate that: All men were rapists, and could not be trusted. This is exactly what was being said in radical feminist magazines. Women should unite, become lesbians, and only use men for brief purposes of procreation. Men are now the enemy. The anger ran very deep, it was becoming hard to be a heterosexual man in certain radical circles. To be fair a lot of the radical men were unreconstructed sexist pigs who needed to marry their professed politics and their behaviour together. But were they some kind of dangerous, sex-crazed enemy? No. They were just men. Men who love and respect women, when you kick their soap boxes away and challenge them to think more deeply. We laugh at the alleged Victorian notion that table legs should be covered up in case it inflames men&#39;s &#39;base&#39; desires and then act like it&#39;s actually true.</p> <p style="margin-bottom: 0cm; font-style: normal; text-decoration: none" class="western"> It sounds completely crazy doesn&#39;t it, making an unavoidable biological division into a political platform, a basis for hatred? But it is the way radical feminists used to write and think. Interestingly, this was the hotbed that the student activists of the 80&#39;s and 90&#39;s lived inside. You have to ask yourself: who got involved in politics and eventually got themselves elected? Who took the political gauntlet away from the male cabals and trod the boards, knocking on doors and building political parties? Women, educated, articulate women. Good thing too! But, the dangerous thing was that they had been infected with at least some of this suspicion of men.  </p> <p style="margin-bottom: 0cm; font-style: normal; text-decoration: none" class="western"> A lot of laws, particularly those around divorce and child custody, were rewritten to be fair to the woman. They acknowledged her role in creating a family and that she should have half of the assets. This is not a bad thing. It might appear to hurt some men but it is very fair, compared to the way it was years before. But now men are denied access to their families, they are demonised when they try and ensure that cash is distributed fairly. They are a dangerous annoyance that needs to be kept away from the purity of the family. They are no longer allowed to be part of it. This is a caricature, of course, an aunt sally that you can throw rocks at if you want to. But it follows on from them being the enemy, in fact they are becoming the enemy of society at large.</p> <p style="margin-bottom: 0cm; font-style: normal; text-decoration: none" class="western"> It is utterly insane to say that, condemning half of society to being the enemy. But you look at the way a man can&#39;t take a photograph on the street, or pick his children up without being scowled at suspiciously, or be seen anywhere near a playground on his own. It&#39;s true, in some senses. When we had a friend and her child round recently I was shocked by feeling unable to give him a hug &ndash; where the hell did that come from?</p> <p style="margin-bottom: 0cm; font-style: normal; text-decoration: none" class="western"> The other thing about this is &ndash; what happens to boys? You will be a man, but while you are growing up men are something to be scared of unless they are your dad (assuming you know who he is). Even male teachers are suspect. Then you grow up and what? Become a bad person? It almost gives them a licence to behave how the hell they like because that&#39;s what&#39;s expected.  Think about it, think about the lack of authority and respect for men in general, for others, for anyone but your small circle of acquaintances. Is it surprising a lot of young men (and women too) are such dangerous idiots? They have been infantilised, they have had their role models replaced by selfish useless people idolised by airhead meedja for as long as it suits the editors.  </p> <p style="margin-bottom: 0cm; font-style: normal; text-decoration: none" class="western"> Where is the father or grandfather or whoever who commands respect and people listen to, who could intervene and knock sense into heads? Dead and gone. The same is true of the mother and grandmother too, the nanny state knows best, and is always fair in her dealings with people. Everyone has been infantilised &ndash; the big STOP sign stands across relationships between generations. Yes, it&#39;s stupid, it has created a generation of twenty-somethings with their teeth still in the teat who don&#39;t know how to behave towards each other. How do infants behave? Self-centred and quite often incapable of understanding others&#39; feelings &ndash; does this sound familiar? Seeing the other person&#39;s point of view, taking it into your heart when you deal with others, is part of growing up and yes, it hurts, but it hurts for a reason. No, let&#39;s just treat other human beings as onanistic aids on some hedonistic rush to death.</p> <p style="margin-bottom: 0cm; font-style: normal; text-decoration: none" class="western"> Now the state intervenes between men and women as a matter of course, it has to rake its lowest common denominator paws across families and decide for the parents how best to bring up children. It is extremely risk averse, this means that it&#39;s easier to say no to everything in case you become one of the vanishingly small number of problem cases. This causes great pain for a lot of people, and their children, for the sake of not a lot. Another STOP sign has been created between men and women when relationships break down.  Of course, this was originally justified because the state was supporting the families of &quot;absent fathers&quot;, sadly the families quite often don&#39;t have anything more than they did, except the legal bill landing at the door of the parent the state can find.</p> <p style="margin-bottom: 0cm; font-style: normal; text-decoration: none" class="western"> Then we have the rise of the CRB culture, another risk averse mentality. Men in general are not child molesters, they are as revolted and angered by it as anyone else. A vanishingly small number of them should be locked up and kept away from children. Instead of using common sense, assuming innocence until proven guilty, of making sure situations where accusations could arise (or misdemeanours actually occur) do not happen, we have a pile of rote behaviours and rules that protect no one and breed suspicion and distrust. The bad guys just go round them and protect themselves. A child goes missing and is spotted by a lone man who will not take it by the hand and try to return it &ndash; eventually it is kidnapped and murdered by someone else, someone evil. Is this good? Is this right? Never. But the guy who could have helped was afraid to, and twenty years ago he would have done so without thinking. That stinks.</p> <p style="margin-bottom: 0cm; font-style: normal; text-decoration: none" class="western"> Yes, teachers and people who deal with children a lot should be checked. But the guy or gal who checks your application forms for your driving licence? Or the one who takes the money in the post office? Why? Risk aversion. The guy walking down the street on his way home from work? Every guy or gal who&#39;s got past the age of 10? Where the hell does it stop? Tattoos or marks on the forehead saying you&#39;ve been checked &ndash; or the other way, like the branding of vagabonds in the seventeenth century?  </p> <p style="margin-bottom: 0cm" class="western"><span style="font-style: normal"><span style="text-decoration: none">Where does this lead? Licenced mothers and fathers, everyone has a CRB check, a biometric ID card and is recorded somewhere on a huge DNA database &ndash; the state pushing the barriers between people so far that every relationship is a subject of the barrier, the STOP sign, and a bunch of paper pushers control your life completely on the basis of some rules that are very </span></span><em><span style="text-decoration: none">fair, </span></em><span style="font-style: normal"><span style="text-decoration: none">but not even slightly compassionate. The state doesn&#39;t have compassion, it is scared of risk, it interferes where it shouldn&#39;t for the best of reasons. There are places where the state should not intervene and this is one of them.</span></span></p> <p style="margin-bottom: 0cm" class="western" align="left"><span style="font-style: normal"><span style="text-decoration: none">Yes kids, bad things happen, and no amount of laws and hand-wringing can stop it. Yes, often they hurt and are very hard to bear &ndash; it&#39;s called the human condition, sorry. You can minimise the danger by learning how to be an adult and where the limits are, but the pain that comes from falling out of your mother&#39;s womb can&#39;t be ducked, hard luck, there is no get out of jail free card in real life. A lot of the time there isn&#39;t anyone to <span style="font-style: italic">blame</span>, either, so don&#39;t bother looking. The bad guys should be punished when they are caught. Only a fool would argue with that, but politicians have to be seen to be doing something when the meedja gets all hysterical and quite often they should just say </span></span><em><span style="text-decoration: none">shit happens, sorry, if you can find some way to stop it happening I&#39;d love to hear it.</span></em><span style="font-style: normal"><span style="text-decoration: none"> But that would mean admitting to not being perfect or being able to do something about things that are actually unavoidable and we can&#39;t have that, can we?</span></span></p> <p style="margin-bottom: 0cm" class="western"><span style="font-style: normal"><span style="text-decoration: none">If you don&#39;t start from compassion, from a belief that everyone is entitled to happiness and the causes of happiness, if instead you start from knowing what&#39;s &#39;best&#39; for people and you attempt to force this on them even when they don&#39;t want it then the world is a cold, cold place. A place of rules and regulations that mediate </span></span><em><span style="text-decoration: none">everything, </span></em><span style="font-style: normal"><span style="text-decoration: none">where the default word is NO when you try and step outside or past them because that&#39;s the easiest course and it means no one has to think or admit to feeling. A place where burning the wrong person at the stake is OK because they will go to heaven anyway. A place where hedonism is the best path to follow because there is nothing beyond your own trivial pleasures, where no one else matters, where we are nothing but the sum of divisions and ignorance &ndash; but you </span></span><em><span style="text-decoration: none">dare</span></em><span style="font-style: normal"><span style="text-decoration: none"> to question the rules or step over them slightly, even out of ignorance, and you will end up in prison or on some register where you can&#39;t get a job. Seriously, think about it a little, and get the teat out of your mouth.</span></span></p> <p style="margin-bottom: 0cm; font-style: normal; text-decoration: none" class="western" align="left"> I&#39;m ready to be burned at that stake if I have to be to stand up for my beliefs. But let&#39;s just stop now, and not go there. Please? Men are just men. Women are just women. People are just people. 99% of us are decent, caring and honest, and that&#39;s the truth.</p>]]></description></item><item><title>Diary entry</title><guid isPermaLink="true">http://francis.blog-city.com/diary_entry_2.htm</guid><link>http://francis.blog-city.com/diary_entry_2.htm</link><pubDate>Sat, 26 Jul 2008 14:46:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=diary%5Fentry%5F2</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<strong>Deb</strong><br /><p>Deborah is back from China where her team came 20th in the search and rescue competition. There were a lot of Chinese teams and they were about 4th or 5th or so if you only included one of them, but rules is rules. The girls worked out that they had scored about the same points as last year in Atlanta where they finished 5th. They had a great time and the people were really hospitable.</p><p>Straight after this she went to Chemistry camp in Leeds and did projects about dying and forensic chemistry - had a good time there too. Now she&#39;s at guide camp!</p><p><strong>Jon</strong></p><p>Basically playing Warcraft as much as he can get away with and doing as little as he can get away with.&nbsp;</p><p><strong>Rosie</strong></p><p>Very busy having her holidays digging gardens and hurting her back. Then she&#39;s back for a week and then on holiday again. The joys of working flexitime - she has to use the holidays or lose them. </p><p><strong>Me</strong></p><p>I&#39;ve finished my radio play and an essay that I will publish here. Very busy at work but not working silly hours at the moment.&nbsp; </p>]]></description></item><item><title>Maintenance programming</title><guid isPermaLink="true">http://francis.blog-city.com/maintenance_programming.htm</guid><link>http://francis.blog-city.com/maintenance_programming.htm</link><pubDate>Fri, 20 Jun 2008 08:42:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=maintenance%5Fprogramming</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://www.codinghorror.com/blog/archives/001137.html" target="_blank">Comment left here</a> - it&#39;s also worth following some of the links in the article.</p><p>Never install the Java Decompiler, JAD, and look at the library code you are dependent on.<br /><br />Just don&#39;t.<br /><br />If you do, however, never run the FindBugs utility (which I recommend for all lazy code reviewers btw) against the decompiled code.<br /><br />Just don&#39;t.<br /><br />Or you will cry.<br /><br />I&#39;ve picked up lots of code in my time, and the hardest stuff was Java &quot;o-o&quot; code, because everything is buried so deep and bugs very hard to find. Oddly, Ruby is easy to debug once you&#39;ve understood how metaprogramming works and it *is* an o-o language. But most of the time you just write code to do what you need to do and write tests for that small thing.<br /><br />UML etc. etc. - guys you are working at the wrong level. UML blah ... once you&#39;ve gone past the initial system design it&#39;s another thing to maintain and it won&#39;t be. Throw it away and make the code base clean. I&#39;m very old fashioned - I tend to start from a clear data model and view the rest as just a layer on top of it. I don&#39;t care about the class model - it&#39;s usually not worth worrying about and a lot of code is procedural code hidden in static classes anyway - be honest, now. This is particularly true if you are using an o-o to relational mapper - that&#39;s where all the complexity is and you have decided that you want the mapper library to do the work. Data matters, the rest is fluff.<br /><br />I also recommend finding a formatter for the language you are using if you are trying to understand someone else&#39;s code. It&#39;s amazing how many bugs you find when the formatter changes the indentation to reveal what the compiler/interpreter will *actually do* with the code.<br /><br />Read Fowler&#39;s refactoring book, even if you are not a Java programmer, it repays close study.<br /><br />Old fart signing off now.</p>]]></description></item><item><title>Setting up to fail</title><guid isPermaLink="true">http://francis.blog-city.com/setting_up_to_fail.htm</guid><link>http://francis.blog-city.com/setting_up_to_fail.htm</link><pubDate>Tue, 17 Jun 2008 19:40:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=setting%5Fup%5Fto%5Ffail</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p>One of the consequences of meditating a lot over several years is you start to see how your own mind works. Obviously, this gives you insight into other people&#39;s too.</p><p>If you are feeling down and oppressed by the world, well, how about getting the world to confirm that it hates you? Or that things always go wrong in a drearily predictable way when you interact with certain people? </p><p>The game is simple:</p><ol><li>Take some task you do collaboratively with others often. Packing to go camping, or some project deliverable. It doesn&#39;t have to be work related at all: a lot of people do this in the comfort of their own homes.</li><li>Decide on your none-affirming goal, e.g. <em>I always do all the work for X,&nbsp;</em> or, <em>people won&#39;t take responsibility and be self-sufficient.</em></li><li>Change the unwritten rules of the social interaction very slightly so that you can catch them out, e.g. don&#39;t ask for any help (or ask when it can&#39;t be given because of some other constraint), or, don&#39;t pack the stuff (say towels) that you always pack for everyone.</li><li>Crucial part of the game here. <em>Don&#39;t tell anyone about 3.</em></li><li>Let the unsuspecting individual(s) make the &quot;mistake&quot;.</li><li>Shout a lot.</li></ol><p>Stop it, just stop it. Make sure everyone knows what is expected and check they still understand what it is as the process is running. No-one fails and no-one shouts, life is much easier. People are a little stupid sometimes, and they have short attention spans for stuff that bores them, and what&#39;s important to you may not be to them. Hard luck. I have been in several (failed) relationships where this game was played a lot. I think a lot of the so-called war between men and women is about this, it&#39;s silly manipulative stuff and should be avoided. It&#39;s an easy trap to fall into though, usually when you are down and want to prove something about the world. Keep it at arms length and smile when you catch yourself doing it. And stop it. </p><p>I&#39;ve also noticed that when people complain a lot I want to say things like &quot;well, at least you managed to find something to complain about, be grateful you are doing something you enjoy.&quot; Constant complaining is another setting up to fail in a different guise, and it&#39;s bad for your mind. Stop it, just stop it. </p>]]></description></item><item><title>Soap4r woes</title><guid isPermaLink="true">http://francis.blog-city.com/soap4r_woes.htm</guid><link>http://francis.blog-city.com/soap4r_woes.htm</link><pubDate>Tue, 20 May 2008 15:53:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=soap4r%5Fwoes</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[Just in case this burns someone else<br /><br />Talking to a web service that returns an array of mixed complex types (ooh goody!)<br /><br />soap4r returns a lot of SOAP::Mapping::Object<br /><br />These pretend to be a kind of hash (of hashes of hashes if you go really deep), so I could get my proposal back by the rather horrible<br /><br />response.submitResult.returnMsg[&#39;Proposal&#39;]<br /><br />(lots of console work required to get this far .. :))<br /><br />I needed the proposal&#39;s ID and it was nowhere to be seen. When I looked at the wire trace it told me that the proposal ID was being returned as an attribute of the Proposal XML node.<br /><br />Lots of pain and headscratching later discovered a blog post talking about the semi-hidden __xmlattr method, this is a proper hash but it is indexed using the qualified name class XSD::QName<br /><br />So, to get the ID out we end up with ...<br /><br />proposal_id_key = XSD::QName.new(nil,&#39;proposalID&#39;)<br />response.submitResult.returnMsg[&#39;Proposal&#39;].__xmlattr[proposal_id_key]<br /><br />Let the joy be unconfined ... SOAP is another unnecessary PIA. Most of the time you *could* just post XML direct using HTTP(S). I can&#39;t see any benefit for the additional complexity.<br /><br />If we didn&#39;t have soap4r I&#39;d still be banging my head on the desk so +1 for that ...<br /><br />Top tip, you can set $DEBUG=true in the console to get the wire trace.<br />]]></description></item><item><title>Meditation and Depression</title><guid isPermaLink="true">http://francis.blog-city.com/meditation_and_depression.htm</guid><link>http://francis.blog-city.com/meditation_and_depression.htm</link><pubDate>Fri, 16 May 2008 19:44:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=meditation%5Fand%5Fdepression</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://www.wildmind.org/applied/depression" target="_blank">Comment&nbsp;left&nbsp;here.&nbsp;</a></p><p>My lama says that you should allow your subjective pain to awaken compassion for others that also suffer from whatever condition you are suffering with. Then take the medicine!<br /><br />I no longer need to take antidepressants and I put this down to many years of practice. But Buddhist meditation is not therapy: it&#39;s goal is enlightenment. This is why the Dharma is taught. <br /><br />That said, calming meditation really helps to clear the mind of that nagging negative voice that informs depression and damages your chances of happiness in this life. I did this by learning to recognise it and then prevent it gaining energy and starting a loop in my mind. My personal experience is that it is like having a constant noise in your mind that spoils everything and makes it very hard to think and feel anything but despair that it will never end. Eventually you move on past it. Or I did, anyway. I also found the first Noble Truth, impermanence, a great help, because it meant that the was a light at the end of the tunnel and my pain would end. <br /><br />A friend said (probably a quote somewhere), &quot;if you are going through hell keep going until you get to the end&quot;. Good advice I think.</p><p><strong>Bootnote - here is another post against the same topic</strong></p><p>I don&rsquo;t need to focus on the pain - it&rsquo;s always there, constantly. I just don&rsquo;t give it any energy any more. I recommend the Tibetan practice of lo johng (not sure of spelling) - &ldquo;sending and taking&rdquo;, which the Dalai Lama describes in one of the &ldquo;Essential Teachings&rdquo; series - need to track the proper reference. </p><p>I also wouldn&rsquo;t embark on this without some instruction from a qualified teacher.</p> <p>Another thing that came to mind recently - and sending and taking starts with this - is to forgive and love yourself first, before you try to give things to others. If you hate yourself the taint of the hatred will devalue whatever you give to others, and make it hurt more too!</p> <p>Strongly recommend &ldquo;The Art of Happiness&rdquo; too, wonderful gentle book.</p><p>&nbsp;</p>]]></description></item><item><title>Rails: I can put together a simple database-backed app really quickly</title><guid isPermaLink="true">http://francis.blog-city.com/rails_i_can_put_together_a_simple_databasebacked_app_reall.htm</guid><link>http://francis.blog-city.com/rails_i_can_put_together_a_simple_databasebacked_app_reall.htm</link><pubDate>Fri, 25 Apr 2008 11:47:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=rails%5Fi%5Fcan%5Fput%5Ftogether%5Fa%5Fsimple%5Fdatabasebacked%5Fapp%5Freall</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://www.regdeveloper.co.uk/2008/04/21/bray_ruby_rails/">Comment left here</a> </p><p>... and that&#39;s why I use RoR. 90% of the &quot;anti&quot; opinions here don&#39;t get it. It&#39;s quick, it has a low entry barrier, and, if you want the Ajax stuff, it&#39;s very easy to do simple things. If you want stuff that scales to the moon then you use a technology that will do that - d&#39;oh!<br /><br />Ruby has also got lots of nice utilities to do SOAP and so on. It just works and it doesn&#39;t hurt. Integration with other services (.Net or Java) is a breeze and you can get help really easily from other people in the community. In general there is only one way to do something (because the language is young) and it does what you want. Compare with Java - 25 frameworks with alpine learning curves (XML or properties files - let&#39;s have both!) before you can do anything. It *used* to be simple and pretty easy to get things done but the signal to noise ratio is really painful now and getting worse with every &quot;improved&quot; J2EE implementation from the big vendors. Me no want no stinkin&#39; entity beans - they leave a stain on your teeth.<br /><br />I am a Java certified web developer and wouldn&#39;t go back, except for the cash. It used to drive me crazy: make a change, run Ant, deploy the WAR file, waste 20 minutes doing nothing. Get shouted at by PHB for reading El Reg while all this was going on. This is typical if you work on a legacy system.<br /><br />Now I can just get stuff done, and that&#39;s all I want. I&#39;m really keen on the whole JRuby thing, where the Rails app will just run from a WAR file and use all the sexy scalability stuff that the Java people have spent so much time and energy on - but I&#39;ll happily use it at one remove, thanks.</p>]]></description></item><item><title>Getting the number of months between two dates in Ruby/Rails - updated</title><guid isPermaLink="true">http://francis.blog-city.com/getting_the_number_of_months_between_two_dates_in_rubyrails.htm</guid><link>http://francis.blog-city.com/getting_the_number_of_months_between_two_dates_in_rubyrails.htm</link><pubDate>Wed, 02 Apr 2008 12:30:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=getting%5Fthe%5Fnumber%5Fof%5Fmonths%5Fbetween%5Ftwo%5Fdates%5Fin%5Frubyrails</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p>Here lies the one that works, not the old one I posted ages ago. It also uses dates instead of timestamp differences and should therefore not break if you ask it to go before the Epoch (some time in 1970 I think):</p><p>Also see Adrien&#39;s comment left here (he&#39;s much cleverer than me!) - it&#39;s really trivial:</p><p>s is the start date and e is the end date (s is lower than e) </p>
<p>(e.month - s.month) + 12 * (e.year - s.year)</p>
<p>See!</p>
<style type="text/css">
pre {
        background-color: #f1f1f3;
        color: #112;
        padding: 10px;
        font-size: 13px;
        overflow: auto;
        margin: 4px 0px;
		width: 97%;
		overflow-x: auto;
		overflow-y: hidden;
		margin-top: 12px;
}


/* Syntax highlighting */
pre .normal {}
pre .comment { color: #005; font-style: italic; }
pre .keyword { color: #A00; font-weight: bold; }
pre .method { color: #077; }
pre .class { color: #074; }
pre .module { color: #050; }
pre .punct { color: #447; font-weight: bold; }
pre .symbol { color: #099; }
pre .string { color: #944; background: #FFE; }
pre .char { color: #F07; }
pre .ident { color: #004; }
pre .constant { color: #07F; }
pre .regex { color: #B66; background: #FEF; }
pre .number { color: #F99; }
pre .attribute { color: #5bb; }
pre .global { color: #7FB; }
pre .expr { color: #227; }
pre .escape { color: #277; }
</style>
<pre>
<span class="keyword">module </span><span class="module">DateUtils</span>

  <span class="keyword">class </span><span class="punct"><<</span> <span class="constant">self</span>
    <span class="keyword">def </span><span class="method">months_between</span><span class="punct">(</span> <span class="ident">date1</span><span class="punct">=</span><span class="constant">Time</span><span class="punct">.</span><span class="ident">now</span><span class="punct">,</span> <span class="ident">date2</span><span class="punct">=</span><span class="constant">Time</span><span class="punct">.</span><span class="ident">now</span> <span class="punct">)</span>

      <span class="ident">date1</span> <span class="punct">||=</span> <span class="constant">Time</span><span class="punct">.</span><span class="ident">now</span>
      <span class="ident">date2</span> <span class="punct">||=</span> <span class="constant">Time</span><span class="punct">.</span><span class="ident">now</span>

      <span class="keyword">if</span> <span class="ident">date1</span> <span class="punct">></span> <span class="ident">date2</span>
        <span class="ident">recent_date</span> <span class="punct">=</span> <span class="ident">date1</span><span class="punct">.</span><span class="ident">to_date</span>

        <span class="ident">past_date</span> <span class="punct">=</span> <span class="ident">date2</span><span class="punct">.</span><span class="ident">to_date</span>
      <span class="keyword">else</span>
        <span class="ident">recent_date</span> <span class="punct">=</span> <span class="ident">date2</span><span class="punct">.</span><span class="ident">to_date</span>

        <span class="ident">past_date</span> <span class="punct">=</span> <span class="ident">date1</span><span class="punct">.</span><span class="ident">to_date</span>
      <span class="keyword">end</span>
      <span class="ident">years_diff</span> <span class="punct">=</span> <span class="ident">recent_date</span><span class="punct">.</span><span class="ident">year</span> <span class="punct">-</span> <span class="ident">past_date</span><span class="punct">.</span><span class="ident">year</span>

      <span class="ident">months_diff</span> <span class="punct">=</span> <span class="ident">recent_date</span><span class="punct">.</span><span class="ident">month</span> <span class="punct">-</span> <span class="ident">past_date</span><span class="punct">.</span><span class="ident">month</span>
      <span class="keyword">if</span> <span class="ident">months_diff</span> <span class="punct"><</span> <span class="number">0</span>

        <span class="ident">months_diff</span> <span class="punct">=</span> <span class="number">12</span> <span class="punct">+</span> <span class="ident">months_diff</span>
        <span class="ident">years_diff</span> <span class="punct">-=</span> <span class="number">1</span>

      <span class="keyword">end</span>
      <span class="ident">years_diff</span><span class="punct">*</span><span class="number">12</span> <span class="punct">+</span> <span class="ident">months_diff</span>
    <span class="keyword">end</span>

  <span class="keyword">end</span>

<span class="keyword">end</span>
</pre>]]></description></item><item><title>Email sent in response to the vision thing geekup email</title><guid isPermaLink="true">http://francis.blog-city.com/email_sent_in_response_to_the_vision_thing_geekup_email.htm</guid><link>http://francis.blog-city.com/email_sent_in_response_to_the_vision_thing_geekup_email.htm</link><pubDate>Mon, 31 Mar 2008 09:08:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=email%5Fsent%5Fin%5Fresponse%5Fto%5Fthe%5Fvision%5Fthing%5Fgeekup%5Femail</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://visionthing.vagueware.com/index.php/Main_Page" target="_blank">Start&nbsp;here&nbsp;to&nbsp;see&nbsp;what&nbsp;this&nbsp;is&nbsp;in&nbsp;response&nbsp;to</a>.&nbsp;</p><p>... how many of you go back to the pre-web days? I do - graduated in 1987, I&#39;ve had to practically start again 3 or 4 times in the last 20 years - Unix before Linux, X-windows, dumb terminal to client-server, pre-javascript web tech, javascript, hand crafting your own stuff in raw html, Java, PHP, Java again, Rails. All I&#39;ve ever wanted to do was deliver systems that work and meet real-world problems in a usable way. Be able to go home at the end of the day feeling I&#39;ve achieved something and the people who use the stuff I wrote can do their jobs more effectively and not be dehumanised by it, hence my dislike for techie arrogance, which I see all the time.<br /><br />2.0 is a Tim O&#39;Reilly marketing thing, because he saw a lot of problems with the current technology and wanted to have some kind of dividing line to help people distinguish between things. But like the man at ucov says: no business model, no idea what people want, groovy idea that recycles some stuff other people have already failed at = failure. I&#39;m with Paul Graham on this one - work on something boring and painful (for the punters) and you will see the rewards. Shiny isn&#39;t necessarily good[1]. You seem to have bought the marketing hype. <br /><br />I applaud people&#39;s enthusiasm - I want technology to work and help us get out of the social and cultural ruts we&#39;re beginning to die from (a rut is a grave that hasn&#39;t had the ends filled in yet). Debate is healthy and really useful. The best &quot;manifesto&quot; is something people find useful and the culture that coheres around it. I&#39;d rather work on that than an essay, any day.<br /><br />F<br /><br />[1] for some reason line from &quot;venus in furs&quot; started going through my head when I wrote that, must get new prescription for meds.<br /></p>]]></description></item><item><title>Phorm are those 121 timewasters? Great! Now I know who to send the bill to!</title><guid isPermaLink="true">http://francis.blog-city.com/phorm_are_those_121_timewasters_great_now_i_know_who_to_se.htm</guid><link>http://francis.blog-city.com/phorm_are_those_121_timewasters_great_now_i_know_who_to_se.htm</link><pubDate>Mon, 17 Mar 2008 12:39:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=phorm%5Fare%5Fthose%5F121%5Ftimewasters%5Fgreat%5Fnow%5Fi%5Fknow%5Fwho%5Fto%5Fse</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://www.theregister.co.uk/2008/03/17/bt_phorm_lies/" target="_blank">Comment left here</a> &nbsp;</p><p>Didn&#39;t realise that phorm were the timewasting bastards who were behind 121 - spent many a happy hour trying to get rid of their viral nonsense from a machine my then 10 year old son was using (no idea how they got past him not being an administrator). <br /><br />Can I send them a bill? I think they also managed to hijack firefox a while ago by putting in a bogus (and invisible) add on so I had to trash everybody&#39;s settings directory to get rid of it.<br /><br />DEFINITELY send them a bill, and then a summons through the county court for my time. Anyone else want to join in?</p>]]></description></item><item><title>The Met have gone mad - glad I live in Merseyside</title><guid isPermaLink="true">http://francis.blog-city.com/the_met_have_gone_mad__glad_i_live_in_merseyside.htm</guid><link>http://francis.blog-city.com/the_met_have_gone_mad__glad_i_live_in_merseyside.htm</link><pubDate>Wed, 12 Mar 2008 12:36:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=the%5Fmet%5Fhave%5Fgone%5Fmad%5F%5Fglad%5Fi%5Flive%5Fin%5Fmerseyside</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://peterc.org/2008/49-the-polices-disturbing-new-campaign-if-you-suspect-anyone-of-anything-dob-them-in-for-being-a-terrorist.html" target="_blank">Comment left here&nbsp;</a> </p><p>Bloody hell! Although I suppose it might save us from tourists (joke, definitely joke, I hope). Is there any forum you can have a go at them about wasting public money? There&#39;s an idea - why not get off your backsides and do your job preventing it? Maybe pay for some police officers with the cash you just threw down the bog?<br /><br />It&#39;s like the &quot;ID cards stop terrorism&quot; argument - how exactly? Unless you are going to start something like the pass laws like they had in South Africa under apartheid? And we all know who will have their movements restricted, don&#39;t we? All of the guys on 7/7 were UK citizens and would have had valid ID. No-one suspected anything or they would have done something about it. Gah!<br /><br />The authorities have to be seen to be doing something so they spend money on paranoid crap like this. </p>]]></description></item><item><title>DHH the windows hater - or maybe needs to think a bit before he spouts off?</title><guid isPermaLink="true">http://francis.blog-city.com/dhh_the_windows_hater__or_maybe_needs_to_think_a_bit_before.htm</guid><link>http://francis.blog-city.com/dhh_the_windows_hater__or_maybe_needs_to_think_a_bit_before.htm</link><pubDate>Fri, 07 Mar 2008 09:25:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=dhh%5Fthe%5Fwindows%5Fhater%5F%5For%5Fmaybe%5Fneeds%5Fto%5Fthink%5Fa%5Fbit%5Fbefore</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://www.codinghorror.com/blog/archives/001065.html" target="_blank">Comment left here</a> &nbsp;</p><p>I am a Rails developer who uses a proper IDE (Netbeans for Ruby) and Windows. Installed Cygwin to give me the bash shell and the other tools I need to talk to our Linux server backbones. I started on Unix/Sun workstations, went to client/server stuff then on to web. DHH is a kid, bless him, and hasn&#39;t yet lived through the next big change that will make him realise he has to start again. I&#39;ve done it maybe 5 times in the last 20 years. Experience of one&#39;s own ignorance makes one humble. He&#39;s on a high now. Losing your job is a great and unwelcome teacher, believe me.</p>  <p>I don&#39;t get the Mac thing, either. If you don&#39;t want windows Ubuntu is fine, has the sexy desktop thing and runs on more powerful kit that costs a quarter of the price.</p>  Don&#39;t get me started about TextMate - it&#39;s a word processor with a bunch of arcane key combinations to run a pile of bundled bash shell scripts. I could probably do something similar with Vim or Emacs but don&#39;t need to because the nice guys from Sun have written very good free tool. Can&#39;t split a view of the same file - just like a word processor all you can see is the few lines around where you are working. <a href="/debugging_rails_applications.htm">http://francis.blog-city.com/debugging_rails_applications.htm</a>]]></description></item><item><title>Java is bad for your brain talk at Barcamp Manchester</title><guid isPermaLink="true">http://francis.blog-city.com/java_is_bad_for_your_brain_talk_at_barcamp_manchester.htm</guid><link>http://francis.blog-city.com/java_is_bad_for_your_brain_talk_at_barcamp_manchester.htm</link><pubDate>Mon, 03 Mar 2008 21:25:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=java%5Fis%5Fbad%5Ffor%5Fyour%5Fbrain%5Ftalk%5Fat%5Fbarcamp%5Fmanchester</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p>Following on from the talk I gave on <em>why Java is bad for your brain</em> at Barcamp I thought I&#39;d dig out some of my old blog posts and present them here - try and explain the argument&nbsp;(which&nbsp;is&nbsp;more&nbsp;of&nbsp;a&nbsp;feeling&nbsp;of&nbsp;disquiet&nbsp;than&nbsp;anything&nbsp;else) better.</p><p><a href="http://files.blog-city.com/files/aa/1899/b/java_bad_for_brain.mm" target="_blank">download mind map here (save as)</a></p><p> I tried to embed the map in an applet - but the downloaded applet doesn&#39;t work and locks the site up. There is a Flash reader but I lost the will to live Java, eh?</p><p><a href="http://freemind.sourceforge.net/" target="_blank">You&nbsp;can&nbsp;get&nbsp;freemind&nbsp;here.</a>&nbsp;</p><p>Defensive programming</p><p><a href="/what_defensive_programming_is_and_isnt_logging_the_right_t.htm" target="_blank">http://francis.blog-city.com/what_defensive_programming_is_and_isnt_logging_the_right_t.htm</a><br /><br />This one&#39;s about &#39;C&#39;:<br /><br /><a href="/at_the_feet_of_the_master.htm" target="_blank">http://francis.blog-city.com/at_the_feet_of_the_master.htm</a></p><p>Java&nbsp;is&nbsp;the&nbsp;new&nbsp;&#39;C&#39;&nbsp;parts&nbsp;1&nbsp;&amp;&nbsp;2&nbsp;</p><p><a href="/at_the_feet_of_the_master_1.htm" target="_blank">http://francis.blog-city.com/at_the_feet_of_the_master_1.htm</a></p><p><a href="/at_the_feet_of_the_master_1htm.htm" target="_blank">http://francis.blog-city.com/at_the_feet_of_the_master_1htm.htm</a>&nbsp;</p><p>J2EE&nbsp;is&nbsp;incoherent</p><p><a href="/cohesive_libraries.htm" target="_blank">http://francis.blog-city.com/cohesive_libraries.htm</a>&nbsp;</p><p>Java&nbsp;schools</p><p><a href="/java_schools.htm" target="_blank">http://francis.blog-city.com/java_schools.htm</a>&nbsp;</p><p>Java&nbsp;as&nbsp;a&nbsp;text&nbsp;processing&nbsp;language&nbsp;-&nbsp;note&nbsp;the&nbsp;comment&nbsp;about&nbsp;merely&nbsp;trying&nbsp;to&nbsp;open&nbsp;a&nbsp;file</p><p><a href="/java_as_a_text_processing_language.htm" target="_blank">http://francis.blog-city.com/java_as_a_text_processing_language.htm</a>&nbsp;</p><p>Java&nbsp;and&nbsp;XML</p><p><a href="/java_finding_nodes_with_xpath_and_how_to_dump_out_xml_dom_as.htm" target="_blank">http://francis.blog-city.com/java_finding_nodes_with_xpath_and_how_to_dump_out_xml_dom_as.htm</a>&nbsp;</p>]]></description><category>northpack</category></item><item><title>SOAP calls make activerecord stop working, oh my</title><guid isPermaLink="true">http://francis.blog-city.com/soap_calls_make_activerecord_stop_working_oh_my.htm</guid><link>http://francis.blog-city.com/soap_calls_make_activerecord_stop_working_oh_my.htm</link><pubDate>Fri, 29 Feb 2008 17:22:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=soap%5Fcalls%5Fmake%5Factiverecord%5Fstop%5Fworking%5Foh%5Fmy</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p>Create an active record object, retrieve some stuff from a soap service and then get this:</p><p>NoMethodError: You have a nil object when you didn&#39;t expect it!<br />The error occurred while evaluating nil.has_key?<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2172:in `has_attribute?&#39;<br />&nbsp;</p><p>If you&#39;re having trouble with active record suddenly throwing exceptions it&#39;s <strong>probably</strong> because of a namespace collision with your Soap classes defined in the generated file called default.rb, or YourClassName.rb depending upon what arguments you gave to the wsdl2ruby command.</p><p>You need to put the data transfer classes into their own module by adding</p><p><strong>--module_path MySoap</strong></p><p>to the end of the command line. So you have something like this:</p><p>wsdl2ruby.rb --wsdl my.wsdl --type client --classdef My --module_path MySoap&nbsp;</p><p>(remember to delete the old files!)&nbsp;</p><p>I last fixed this by hand editing the files and adding in the module definition - so this is by far the easier way. &nbsp;</p><p>Another problem is you get this:</p><p>NameError: uninitialized constant SOAP::Mapping::EncodedRegistry&nbsp;</p><p>Just put </p><p>gem &#39;soap4r&#39;</p><p>in the mapping registry file&nbsp;</p>]]></description></item><item><title>SQL is dead?</title><guid isPermaLink="true">http://francis.blog-city.com/sql_is_dead.htm</guid><link>http://francis.blog-city.com/sql_is_dead.htm</link><pubDate>Tue, 19 Feb 2008 17:23:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=sql%5Fis%5Fdead</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://www.regdeveloper.co.uk/2008/02/18/stonebraker_dbms_outdated/" target="_blank">Comment left here.&nbsp;</a> </p><p>XML - sigh<br /><br />I read Oracle&#39;s early papers on XML DB - &quot;we store the schema and the data separately, with pointers into the data&quot;<br /><br />Codasyl in disguise. The same with the o-o databases, hierarchical databases - none of this is new at all.<br /><br />Personally I can write SQL, I understand the syntax and have been using it for over 20 years. Once you realise you&#39;re really working with sets it&#39;s pretty easy to understand.<br /><br />RDBMS is now just another commodity. I&#39;m happy to use whatever comes next, I currently develop in Ruby on Rails / MySQL and hardly ever have to see the database directly. Interestingly, the people who designed Active Record made 90% stuff really easy and then allow you to drop into raw SQL for the complex, instead of retrofitting the kitchen sink.<br /><br />I&#39;ll use whatever comes down the pipe, as long as it meets my needs - that&#39;s it.</p>]]></description></item><item><title>Deep merge a Ruby hash, the joys of recursion</title><guid isPermaLink="true">http://francis.blog-city.com/deep_merge_a_ruby_hash_the_joys_of_recursion.htm</guid><link>http://francis.blog-city.com/deep_merge_a_ruby_hash_the_joys_of_recursion.htm</link><pubDate>Fri, 15 Feb 2008 17:23:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=deep%5Fmerge%5Fa%5Fruby%5Fhash%5Fthe%5Fjoys%5Fof%5Frecursion</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p>I was doing some hacking with lists of valid phone number codes (3,4,5 digits depending upon various factors). I used hashes that could be walked down because of the key lengths. Now we&#39;ve decided to do it&nbsp; differently because the data file wasn&#39;t up to date ...</p><p>This gets the phone number as an array of integers: </p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; code_pieces = code.to_s.split(//).collect(&amp;:to_i) rescue []</p><p>(note the Rails &amp;: thing)</p><p>This takes a list of keys and a value, pops the value off the beginning of the array and when the array is done then puts the value in with a hash key of -1:</p><p>&nbsp;&nbsp;&nbsp; def hash_for_digits(n_array,value)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; n = n_array.delete_at(0)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if n<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the_hash = {}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the_hash.merge({ n =&gt; hash_for_digits(n_array,value) })<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { -1 =&gt; value}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br />&nbsp;&nbsp;&nbsp; end</p><p>This is a merge of a hash of hashes with another - warning - it blows up&nbsp; without the -1 markers from the previous function. </p><p>&nbsp;&nbsp;&nbsp; def deep_merge_hash(hash1,hash2)<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; hash2.each_key do |k1|<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if hash1.key?(k1)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; deep_merge_hash(hash1[k1],hash2[k1])<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hash1[k1] = hash2[k1]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br />&nbsp;&nbsp;&nbsp; end<br />&nbsp;</p><p>Hope others find this some use - I might return to this another day and make it work with arbitrary hashes but now too busy and didn&#39;t want to throw the code away ...&nbsp;</p><p>The return from the function looked like this:</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top_number = get_code_ref[code_pieces[0]][code_pieces[1]][code_pieces[2]] rescue nil<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if top_number<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ok = top_number[code_pieces[3]][code_pieces[4]][-1] rescue nil<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ok = top_number[code_pieces[3]][-1] unless ok rescue nil<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ok = top_number[-1] unless ok rescue nil<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ok</p><p>I realised I could probably have speeded things up by having the first 3 as a hash key in their own right but too late now - reimplementation with a different data set on the way ...&nbsp;</p>]]></description></item><item><title>Global Warming - the problem with it</title><guid isPermaLink="true">http://francis.blog-city.com/global_warming__the_problem_with_it.htm</guid><link>http://francis.blog-city.com/global_warming__the_problem_with_it.htm</link><pubDate>Thu, 14 Feb 2008 17:29:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=global%5Fwarming%5F%5Fthe%5Fproblem%5Fwith%5Fit</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://www.theregister.co.uk/2008/02/14/climate_comment/" target="_blank">Insightful few paragraphs here.</a> &nbsp;</p><p>If John and others are right, the climate change folks look like tools, if they are wrong we might be in deep trouble.<br /><br />That&#39;s the problem.<br /><br />That said, I agree that we can overcome difficulties with technology and ingenuity, and the Green fascist types (who want at least 60% of the human race dead and the rest living on cardboard) tend to see the world as static and unchanging don&#39;t get this. But then the whole racist Malthusian project always becomes fashionable when the economy&#39;s in trouble. It&#39;s quite likely that global warming will become another one of their arguments for sterilising people who happen to have a skin colour they don&#39;t like.<br /><br />I was sent a &quot;reasons to go veggie&quot; leaflet by someone who seemed to think that forcing subsistence farmers to grow and eat what vegetarians think is a good idea is ok. Another complacent fat westerner telling people what to do and what they can and can&#39;t eat. It was sickening, and the author of the pamphlet didn&#39;t even realise how racist it was. I think the global warming thing is going the same way - there&#39;s a lot of anti-Chinese and Indian sub currents when you read the articles. Interesting, eh?</p>]]></description></item><item><title>Labelling young people - sigh</title><guid isPermaLink="true">http://francis.blog-city.com/labelling_young_people__sigh.htm</guid><link>http://francis.blog-city.com/labelling_young_people__sigh.htm</link><pubDate>Tue, 12 Feb 2008 12:52:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=labelling%5Fyoung%5Fpeople%5F%5Fsigh</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://www.theregister.co.uk/2008/02/12/buzz_off_mosquito/" target="_blank">Response&nbsp;to&nbsp;one&nbsp;of&nbsp;the&nbsp;comments&nbsp;left&nbsp;here&nbsp;by&nbsp;Stuart Luscombe</a>&nbsp;&nbsp;</p><p>&quot;when I was a teenager a mere 10 years ago there just weren&#39;t the kind of problems you keep seeing today. If anything I think school&#39;s, parents and the law in general is still too soft on young people who think that because of their age they can get away with anything they like.&quot;<br /><br />I left school in the late 70&#39;s with 7 &#39;O&#39; levels and a broken nose. Stuff just didn&#39;t get reported then. If anything things are better now because schools at least *try* to deal with bullying, even if they sometimes fail.<br /><br />My wife is a Guide leader, and I also used do a lot of work helping her and friends who run scouts. Most youngsters are decent, hard working folk just like their parents. They dislike the chav scallywags as much as you obviously do, we&#39;re talking about maybe 5% of the population here, but they get the headlines because it suits our lords and masters to demonise them and frighten the rest of us.<br /><br />Stuff gets into the Daily Mail because it doesn&#39;t happen very often - if it were happening all the time then it wouldn&#39;t be news,  d&#39;oh?<br /><br />Get a grip.</p>]]></description></item><item><title>Strange error with ActiveRecord in Rails</title><guid isPermaLink="true">http://francis.blog-city.com/strange_error_with_activerecord_in_rails.htm</guid><link>http://francis.blog-city.com/strange_error_with_activerecord_in_rails.htm</link><pubDate>Thu, 31 Jan 2008 17:24:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=strange%5Ferror%5Fwith%5Factiverecord%5Fin%5Frails</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p>&nbsp;</p><p>I was getting this: <br /><br />undefined method `to_f&#39; for {}:HashWithIndifferentAccess<br /><br />This was happening in the after_create method. We have a table that lists fields and what validation is needed, we use this to pick out the value in the record so we can apply the validation function to the value if one has been given.<br /><br />field_value = self.send(field_name) # Error was thrown here<br /><br />I fixed this by calling self.reload at the beginning of the method that does the field scanning. I think that ActiveRecord doesn&#39;t refresh its attributes hash after save and the error came from it expecting the value to be of a particular type... I don&#39;t like calling reload, but can&#39;t find a method that will refresh the attributes hash.</p><p><strong>Bootnote</strong></p><p>Discovered&nbsp;that&nbsp;this&nbsp;was&nbsp;the&nbsp;result&nbsp;of&nbsp;sending&nbsp;nils&nbsp;in the hash passed into&nbsp;the&nbsp;create&nbsp;method, as it came over the wire as XML and was then incorporated into the <strong>params</strong>&nbsp;array, unlike the conventional post method, which puts empty strings in there. I wrote a one-liner to remove the hash elements with nil in them and everything started working. There was also another nasty bug which was putting the HashWithIndifferentAccess thang into any empty strings.</p><p>params.delete_if{&nbsp;|k,v|&nbsp;&nbsp;v.blank? }</p>]]></description></item><item><title>Presentations</title><guid isPermaLink="true">http://francis.blog-city.com/presentations.htm</guid><link>http://francis.blog-city.com/presentations.htm</link><pubDate>Mon, 21 Jan 2008 17:25:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=presentations</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://www.codinghorror.com/blog/archives/001040.html" target="_blank">Comment left</a> &nbsp;</p><p>Eschew bullet points - they are there to prompt the speaker<br /> Use diagrams and pictures - people think in pictures<br /> Give handouts - That&#39;s where screeds of text belongs.  </p><p>I read a paper that says one of the shuttle disasters was indirectly caused by powerpoint bullet points. A key engineering point about checking for damage was hidden in a 6 point font on a slide about 15 slides in. The engineering company was ruled by salesmen and the only way they could communicate was using it. Instead of producing a proper technical report that everyone could read and discuss at a proper meeting NASA were handed a BS powerpoint full of tiny fonts and missed this - it cost a lot of lives and money. I *hate* bullet points.</p>  <p>Also, the font size should be half the age of your target audience - another reason to use pictures.</p> <span class="comments-post" style="margin-left: 20px"></span>]]></description></item><item><title>Back to the Dharma</title><guid isPermaLink="true">http://francis.blog-city.com/back_to_the_dharma.htm</guid><link>http://francis.blog-city.com/back_to_the_dharma.htm</link><pubDate>Thu, 17 Jan 2008 20:51:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=back%5Fto%5Fthe%5Fdharma</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p>Recontacted my Dharma teacher last year after a long time of being unable to practise. It was because I was trying too hard and strained myself. He told me that it&#39;s very common for westerners to do this: we&#39;re taught by our education system that we  have to be perfect and whatnot, instead of aspiring to be like the buddha and working with what we have at hand we think we have to  be the buddha right now and either give up because it&#39;s impossible or do ourselves an injury.<br /><br />I&#39;m very happy now, have been meditation regularly again, but this time not trying to sit beyond a reasonable amount. Also studying again. I&#39;m trying very hard to write things down and systemetise them this time using things like mind maps. Ultimately it doesn&#39;t matter much, but I think it would be good to be able to remember things like the Four Noble Truths, and the <em>four thoughts that turn the mind to Dharma</em>, without having to get a book out. Memorising some of this stuff is good, it will give me a grounding to understand other things better.<br /><br />I tend to jump off to the complex shiny stuff (Buddha nature, the madhyamaka etc.) because it&#39;s interesting and way beyond the everday view of things. Then details trip me up and I realise the shiny stuff isn&#39;t that important. So I&#39;m trying to get a firm grounding in the key concepts and ideas. This should stop me falling off the end of the pier again. The spiritual consequences of leaving Dharma are extremely severe, particularly if you&#39;ve entered the vajrayana.</p><p>Blessings&nbsp;to&nbsp;you&nbsp;all.&nbsp;</p>]]></description></item><item><title>Sign up to the data breach petition (UK)</title><guid isPermaLink="true">http://francis.blog-city.com/sign_up_to_the_data_breach_petition_uk.htm</guid><link>http://francis.blog-city.com/sign_up_to_the_data_breach_petition_uk.htm</link><pubDate>Tue, 18 Dec 2007 17:26:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=sign%5Fup%5Fto%5Fthe%5Fdata%5Fbreach%5Fpetition%5Fuk</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p>&nbsp;</p><p> <a href=" http://petitions.pm.gov.uk/databreaches/BNNaxVBItj5pAYGDpTAAoCg" target="_blank">http://petitions.pm.gov.uk/databreaches/BNNaxVBItj5pAYGDpTAAoCg</a>&nbsp;</p>]]></description></item><item><title>Office 2007 Adoption Barriers</title><guid isPermaLink="true">http://francis.blog-city.com/office_2007_adoption_barriers.htm</guid><link>http://francis.blog-city.com/office_2007_adoption_barriers.htm</link><pubDate>Wed, 12 Dec 2007 17:26:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=office%5F2007%5Fadoption%5Fbarriers</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p><a href="http://www.channelregister.co.uk/2007/12/12/microsoft_office_sp1/" target="_blank">Posted&nbsp;here.</a>&nbsp;</p><p>I&#39;ve been using it for a while now, moved because of incompatibility issues.<br /><br />Perhaps the complete redesign of the interface? Try finding &quot;save as&quot; in Excel - the File menu no longer exists FFS! It is there, but nowhere obvious.<br /><br />Perhaps the &quot;ribbon&quot; that takes up half your screen if you&#39;re on a low-res machine?<br /><br />Perhaps the redesign of formatting in Word, which was way better than Open Office, to be almost unusable and no longer number headings properly?<br /><br />I think XP was the terminal release.<br /><br />I also read that MS have got rid of a lot of their testers and gone in for automated testing of everything - so the whole usability thing they spent billions on has gone out of the door.<br /><br />Open Office is more compatible with XP than Office 2007 - wtf were they thinking? I recon OO will really take off now. <br /><br />Thanks, guys, for wasting my time. Can I send you a bill?</p>]]></description></item><item><title>Debugging Rails Applications</title><guid isPermaLink="true">http://francis.blog-city.com/debugging_rails_applications.htm</guid><link>http://francis.blog-city.com/debugging_rails_applications.htm</link><pubDate>Tue, 11 Dec 2007 17:27:00 GMT</pubDate><comments>http://francis.blog-city.com/console/comments/popup/?f=debugging%5Frails%5Fapplications</comments><dc:creator>Francis Fish</dc:creator><description><![CDATA[<p>I&#39;ve said that I use <a href="http://deadlock.netbeans.org/hudson/job/ruby/" target="_blank">netbeans</a> on this blog a few times but never really gone into why.</p><p>First, I can park all of the class/project browsers and output windows in the margins of the page and they only pop-up when I click on them.<br /><br />Second, I can tear off editing windows so I can look at, e.g. Rspec&#39;s and the code next to each other. I can also have multiple views of the same file.<br /><br />Third, it has book marks, which the &quot;poor man&#39;s Textmate&quot;, &#39;e&#39;, doesn&#39;t.<br /><br />Fourth, ^B will take me to where a function is defined so I can look at the framework and work things out. ^K is a cool key too.<br /><br />Fifth, I can map everything to key presses if I want.<br /><br />Sixth, it does indentation properly (which the Eclipse-based Ruby environments don&#39;t and it annoys me too much to use them) - it will also re-indent at a key press, which Textmate doesn&#39;t seem to do.</p><p>Seventh, I can move and copy lines without having to use the mouse: Ctrl-Down copies the current line or selection, Alt-Shift-Up/Down moves the current line or selected lines in the direction you need. This is great.  Plus rename of variables inside a method ...</p><p>Eighth, you can start mongrel inside the IDE with a keystroke, or start it against the current page.<br /><br />But best of all, it allows me to debug my Rails apps. You set your break points, start up the debug version of Mongrel and it drops you into a full symbolic debugger. I hadn&#39;t realised that lots of people haven&#39;t got this facility until I heard a podcast from David HH, the inventor of Rails, when he was saying that debug is back in Rails 2.0. If you use Netbeans it never went away, and you don&#39;t have to put breaks in your code.<br /><br />Plus all the generators and whatnot are visible in the GUI.</p><p>The learning curve isn&#39;t flat, but not very steep, and it&#39;s a good tool that runs on any platform that supports a Java VM.</p><p>Enjoy&nbsp;</p><p>&nbsp;</p>]]></description></item></channel></rss>