Sending emails with groovy from xml file

If you have an xml file containing people’s emails like:

1
2
3
4
5
6
7
<!--?xml version='1.0' encoding='UTF-8'?-->
 
    Mikko Mallikas
    mikko@null
 
    Minni Muodikas
    minni@null

You can easily send simple email messages to them with Groovy:

1
2
3
4
5
6
7
8
9
10
11
def doc = new XmlParser().parse("/tmp/emails.xml")
 
doc.person.email.each {
  doCommand("echo \"Body text here \" | mail -s \"Subject here\" " + it.text())
}
 
def doCommand(command) {
  String[] cmd = ["/bin/sh", "-c", command]
  def proc = Runtime.getRuntime().exec(cmd)
  proc.waitFor()
}

Note that this works only on linux, due the mail program used not found in Windows OS.

My customer experience saved!

The pink Smart Cover arrived today with the regular mail, so no need to call or rant about it. Hooray! But, it would have been nice if there had been some clearer (for dummies) indication of two separate shipments.

iPad for the family

I ordered our first iPad (16GB + wifi + 3g) on Wednesday, and it was delivered directly to home on Friday! Within two days, which is awesome. However, the pink iPad Smart Cover was not. I hope it will be delivered on Monday, or my customer experience with Apple plummets from the sky. And I need to start to do some customer service calls, which I hate.

The problem is that there were no notifications that those two items are going to be delivered seperately or together. However, it has been marked online as delivered, but Apples delivery instructions suggest that items might be delivered with different delivery dates anyhow.

The device? It’s totally cool. It has the approval of the Wife for reading emails, without using the desktop computer. Retina display truly allows me to read my roleplaying PDFs one page at the time, and really be able to read the text like a printed product. Of course the children have fought over it, to play with it. Althought, my son said that Samsung Tab would have been better, with more excessive amount of free games. But, I went for the retina display. 😀

Oh, and this was written with it.

Coding is just copying?

My old friend, who has only done some compulsory coding as part of a programming course, said not long ago that; “Coding as a work is is easy – You just use Google and copy – paste the code”. I think he was little bit provocative, but I was not keen to take the challenge and prove him wrong. The debate died before it got started. However, he got me thinking about my trade as whole.

Years ago when I started coding, and went into a company to do some coding with PHP and Java, it was pretty straightforward. You had a task, and you coded it until it was done. You might have searched the internet for a solution, or parts of solutions to be combined into your specific solution. Nobody cared how elegant it was, it only had to work. Just as my friend postulated.

Now, years later environments are more complex than before. The are numerous frameworks, databases, languages, version control systems – old and new, to be aware of. Years ago there were only a few. Coders just need to know more about technologies than previously. The possibility to do your work wrong has escallated.

Then there are new methodologies how to do one’s work as a team. Earlier it was just a collaboration between co-workers in a strict waterfall, heavily documented and manager run project. You did, what you were told to do. No excessive hustle with intraoffice personalities and social mingling.

More agile aproaches are now preferred, which actually means empowerment of the coders. They get to decide by themselves how they do their work, what gets to be done, at what order, define when its done, and most importantly how it’s done. Well, the agile manifesto postulates these principles in a manner which opens doors for interpretation and enables discussion.

This agile trend has caused also interesting results. Just to name a few: I have been in a team where two hired coders spent couple of months just talking how we should code and organize ourselves as a team, without actually coding anything. Our productivity has actually suffered, because we have have spent more time planning/discussing/evaluating changes into the legacy system, than just following the directions of the senior developers/architects, who simply knows their system best. Usually one of the coders have been elevated to scrum master position, which in the end means one coder less.

The coders have been given the right to disagree in every part of their job, and to pull this through requires good social skills, which many sadly lack. It does not help that many coders have big egos, and have great expectations of their capabilities and their level of professionalism of their trade. This is also sociological copy-pasting in agile circles of what works and what not.

But copy-paste coding? Yes, it is still there. You see a fragment of a code and you reuse it. Classes, modules and code snippets can be considered libraries to be reused. It does not matter wether it is a block of code, a called method of an object/framework or an injected Class. Your trade turns into an art, when you know how to do it elegantly by refactoring, combining, dissecting, performance improving, coding more tests to cover all possibilities. Loving it, being proud of it, been able to pair-code it with someone. Only after you have embraced this you are no longer a novice.

And still, all of it can be done so horribly wrong, which gets the next coder who touches it, to experience the WTF effect…

Numenera’s first short story

The Monte Cook’s Kickstarter project is still going strong, and now he has published a Numenera based short fiction story The Amber Monolith – as promised. It finely conveys the feeling of lost knowledge, gives hints of the Ninth world environment, and the current state of the civilization. And it makes more questions than answers any – you ought to read it by yourself.

It feels somewhat odd, that I am one of those who have made possible his creativity to bloom, by a financing pledge. Couple of days ago I raised it to Patron level (70$+10$ for shipping). The story itself is not long as an investment, but is a very promising start for this franchise.