goban

Ruby: What is at_exit and how to write tests for it.

Ruby has a neat feature called at_exit which takes a block and then executes the contents of this block when the program ends. There are a couple of VERY important details:

  1. It takes a block and converts it into a Proc object at the time of parsing. This means that the data has to be available in the binding, or you’ll run into errors. Example: instance variables need to be set before you can use them in that block. Better idea: don’t use instance variables in there at all.
  2. You can ‘chain’ at_exit calls, and they will be resolved in a First In, Last Out (FILO) order.

Once you know this, using at_exit and writing tests for it becomes a little easier:

class Piddler
   def initialize
     create_pid_file
   end

   private

   def create_pid_file
     pid_file = "/tmp/piddler/my_pid" #Simplified for example purposes
     File.new(pid_file, 'w')
     at_exit { FileUtils.rm_f pid_file }
   end
end

What you’ll notice is that the at_exit block is defined RIGHT AFTER I create what I will need to resolve/undo/finish – not separately, right inside the method.

 

def test_clears_pid_file_when_it_exits
   at_exit { assert_equal 0, Dir['/tmp/piddler/*].size}
   Piddler.new
end

The advantage of that is that I know exactly when it gets defined. For this example, it gets defined at the end of the ‘initialize > create_pid_file’ call. This means that any at_exit blocks defined BEFORE that will be resolved AFTER.

 

Mirrored from Seven steps.

goban

Art of Agile Planning / Art of Agile Delivery, by James Shore and Diana Larsen

The Art of Agile Planning (#aoap on Twitter, and AOAP from now on) is a 2-day course. The focus is on understanding the higher-level constructs of Agile and how they imbricate. In the course, one learns how the ideal Agile team is composed (hint: it’s cross-functional and co-located) and what practices and techniques will be used to organize at all levels, from the developers’ standup to the customers’ research for the next best value-delivering feature, including how to properly create a feature that developers can work on and how to best break it down into stories (and then into tasks).

The Art of Agile Delivery (#aoad on Twitter, and AOAD from now on) is a 3-day course. The focus expands from AOAP, both into further details in the iteration (how do developers best produce quality code without defects) and into further details for customers (how do we figure out who we seek and who we need to interact with).

Both courses feature activities and mini-games to help accelerate and cement learning. Both courses, of course, feature James and Diana, whose presence is invaluable. It took me a day or two to get accustomed enough to start asking questions – don’t wait, you only have those few days, and they can both bring great insight into whatever questions or problems you may have. Their first answer may be a little idealistic or snarky (I heard a once or twice “don’t do that”), but after the chuckles die down, they go into further detail and, asking for clarifications where needed, they explain the ideal of the practice(s), skill(s) and/or technique(s) involved and how to try and rectify or adapt to a less-than-ideal situation. Among the small things that make this course great: there are slidebooks given, where the slide is on the left and there is room to take notes on the right, and there are ‘facilitational aids’ (as Diana Larsen put it, “because toys aren’t tax-deductible”) for those of us who need to fiddle with something to learn better.

It is my understanding that both courses can be taken separately. I would probably not recommend doing so, as AOAD truly does build on top of AOAP. I will, however, echo James Shore’s recommendation. Take care of yourself. Don’t leave after each day and drink/party/work. Get some air, see your family, sleep. Give your body and your mind a rest. This course is five days and very intensive.

I’ve tried my best to give you the essence without the substance. Any description of the substance would simply be sub-par and ruin the experience. This course has to be lived. Besides, the course evolves based on the feedback it receives, so hopefully when you take the course, it’ll be even better than when I took it!

AOAD and AOAP together show that Agile truly is an organizational-scale operation, and can only have limited success if not applied at the manager and customer level.

A last note – this course set can be taken with total strangers, but I took it as a training course with my entire company. They were people with whom I am used to working, people with whom I’ll be talking about this course for long after it is over, and it allowed some slightly different dynamics to permeate the courses – in my eyes, for the better, but I’m clearly biased.

Send to:
Add 'Art of Agile Planning / Art of Agile Delivery, by James Shore and Diana Larsen' to diggAdd 'Art of Agile Planning / Art of Agile Delivery, by James Shore and Diana Larsen' to redditAdd 'Art of Agile Planning / Art of Agile Delivery, by James Shore and Diana Larsen' to TechnoratiAdd 'Art of Agile Planning / Art of Agile Delivery, by James Shore and Diana Larsen' to Newsvine
Add 'Art of Agile Planning / Art of Agile Delivery, by James Shore and Diana Larsen' to Stumble UponAdd 'Art of Agile Planning / Art of Agile Delivery, by James Shore and Diana Larsen' to SlashDotAdd 'Art of Agile Planning / Art of Agile Delivery, by James Shore and Diana Larsen' to FaceBookAdd 'Art of Agile Planning / Art of Agile Delivery, by James Shore and Diana Larsen' to MySpace

Mirrored from Seven steps.

goban

Rooting Incredible 2 with 2.3.3

If Revolutionary 0.4pre4 –
Use WINDOWS! Broken on Linux.
Follow this process: http://forum.xda-developers.com/showthread.php?t=1219246

revolution, for me, said “oh sure, I’ll install CWM for you” and rebooted to Fastboot USB but did NOT actually install it. So you manually push it, then you choose ‘bootloader’, then ‘recovery’ and THEN you are in CWM. And then Bob’s your uncle.

Send to:
Add '' to diggAdd '' to redditAdd '' to TechnoratiAdd '' to Newsvine
Add '' to Stumble UponAdd '' to SlashDotAdd '' to FaceBookAdd '' to MySpace

Mirrored from Seven steps.

goban

HTC messed up (Incredible 2, missing Clock app)

I have a Droid Incredible 2 – and I’m really enjoying it. I got an OTA update to 2.3 right about the time I was going to root it, so I thought, what the heck, I’ll get Gingerbread. It’s all I really wanted anyway.

Last week, at some point, the clock app disappeared. I noticed because the alarm stopped ringing. It didn’t really bother me, because sometimes I sleep through it — but then I checked and it’s … not there. I mean, in “Manage Apps” it’s there, with a size of 0, but it’s not the app drawer.

… There’s a bug that causes the clock app to randomly appear / disappear. And it’s been happening for about two months, based on the research I’ve been doing.
Someone on a forum said that if this happened on an iPhone, it’d be in all the newspapers. They’re right. iPhones are held to a different standard — and the standard should be the same. If Android wants to be taken seriously, then it’s time to get some real development going behind it.

And don’t give me that crap about a single platform versus many platforms (different phones, etc). You’re a distributor, you know your hardware. How come other ROMs are stable on YOUR hardware? Hmmmm ?

Send to:
Add '' to diggAdd '' to redditAdd '' to TechnoratiAdd '' to Newsvine
Add '' to Stumble UponAdd '' to SlashDotAdd '' to FaceBookAdd '' to MySpace

Mirrored from Seven steps.

goban

Grepping a single file for ‘dynamic’ content

You can use xargs to grep the same word through different files. But how do you use xargs to grep different words through the same file?
Like this:

echo “your fancy word finder stuff here” | xargs -i bash -c ‘grep -n “{}” your/file/here’

Not something that’s useful every day, but when you want it, hot damn is it nice to have.

Send to:
Add '' to diggAdd '' to redditAdd '' to TechnoratiAdd '' to Newsvine
Add '' to Stumble UponAdd '' to SlashDotAdd '' to FaceBookAdd '' to MySpace

Mirrored from Seven steps.

goban

Gentoo Prefix on Lion: gettext problem

So, you can’t install gettext?
Here’s a hack to get you past it.
do your
$ emerge –oneshot gettext

When it’s all unpacked, Ctrl+z (this will pause the job), go to the work directory, something like this:
/Users/you/Gentoo/var/tmp/portage/sys-devel/gettext-0.18.1.1-r2/work/gettext-0.18.1.1

From there, go in here:
cd gettext-tools/gnulib-lib
and in here..

edit “stpncpy.c” with your favorite text editor, find
“# define __stpncpy stpncpy”
And add // at the beginning of the line, like so:
“//# define __stpncpy stpncpy”

Save and quit, then type “fg 1″ and return, this will resume the job.

This hack bypasses the stpncpy problem. Someone more serious than me needs to create a new ebuild for this though…

Send to:
Add '' to diggAdd '' to redditAdd '' to TechnoratiAdd '' to Newsvine
Add '' to Stumble UponAdd '' to SlashDotAdd '' to FaceBookAdd '' to MySpace

Mirrored from Seven steps.

goban

Matt Damon’s Speech at the Save Our Schools Rally

I flew overnight from Vancouver to be with you today. I landed in New York a few hours ago and caught a flight down here because I needed to tell you all in person that I think you’re awesome.
I was raised by a teacher. My mother is a professor of early childhood education. And from the time I went to kindergarten through my senior year in high school, I went to public schools. I wouldn’t trade that education and experience for anything.
I had incredible teachers. As I look at my life today, the things I value most about myself — my imagination, my love of acting, my passion for writing, my love of learning, my curiosity — all come from how I was parented and taught.
And none of these qualities that I’ve just mentioned — none of these qualities that I prize so deeply, that have brought me so much joy, that have brought me so much professional success — none of these qualities that make me who I am … can be tested.
I said before that I had incredible teachers. And that’s true. But it’s more than that. My teachers were EMPOWERED to teach me. Their time wasn’t taken up with a bunch of test prep — this silly drill and kill nonsense that any serious person knows doesn’t promote real learning. No, my teachers were free to approach me and every other kid in that classroom like an individual puzzle. They took so much care in figuring out who we were and how to best make the lessons resonate with each of us. They were empowered to unlock our potential. They were allowed to be teachers.
Now don’t get me wrong. I did have a brush with standardized tests at one point. I remember because my mom went to the principal’s office and said, ‘My kid ain’t taking that. It’s stupid, it won’t tell you anything and it’ll just make him nervous.’ That was in the ’70s when you could talk like that.
I shudder to think that these tests are being used today to control where funding goes.
I don’t know where I would be today if my teachers’ job security was based on how I performed on some standardized test. If their very survival as teachers was based on whether I actually fell in love with the process of learning but rather if I could fill in the right bubble on a test. If they had to spend most of their time desperately drilling us and less time encouraging creativity and original ideas; less time knowing who we were, seeing our strengths and helping us realize our talents.
I honestly don’t know where I’d be today if that was the type of education I had. I sure as hell wouldn’t be here. I do know that.
This has been a horrible decade for teachers. I can’t imagine how demoralized you must feel. But I came here today to deliver an important message to you: As I get older, I appreciate more and more the teachers that I had growing up. And I’m not alone. There are millions of people just like me.
So the next time you’re feeling down, or exhausted, or unappreciated, or at the end of your rope; the next time you turn on the TV and see yourself called “overpaid;” the next time you encounter some simple-minded, punitive policy that’s been driven into your life by some corporate reformer who has literally never taught anyone anything. … Please know that there are millions of us behind you. You have an army of regular people standing right behind you, and our appreciation for what you do is so deeply felt. We love you, we thank you and we will always have your back.

Send to:
Add '' to diggAdd '' to redditAdd '' to TechnoratiAdd '' to Newsvine
Add '' to Stumble UponAdd '' to SlashDotAdd '' to FaceBookAdd '' to MySpace

Mirrored from Seven steps.

goban

L’inventaire – Jacques Prevert

Une pierre
deux maisons
trois ruines
quatre fossoyeurs
un jardin
des fleurs

et un raton laveur

une douzaine d’huitres un citron un pain
un rayon de soleil
une lame de fond
six musiciens
une porte avec son paillasson
un monsieur décoré de la légion d’honneur

et un autre raton laveur

un sculpteur qui sculpte des Napoléon
la fleur qu’on appelle souci
deux amoureux sur un grand lit
un receveur des contributions
une chaise trois dindons
un ecclésiastique un furoncle
une guepe
un rein flottant
une écurie de courses
un fils indigne deux frères dominicains
trois sauterelles un strapontin
deux filles de joie un oncle Cyprien
une Mater dolorosa trois papas gateaux deux chèvres de
Monsieur Seguin
un talon Louis XV
un fauteuil Louis XVI
un buffet Henri II deux buffets Henri III trois buffets
Henri IV
un tiroir dépareillé
une pelote de ficelle trois épingles de sureté un monsieur
agé
une Victoire de Samothrace un comptable deux aides-
comptables un homme du monde deux chirurgiens
trois végétariens
un cannibale
une expédition coloniale un cheval entier une demi-pinte
de bon sang une mouche tsé-tsé
un homard à l’américaine un jardin à la francaise
deux pommes à l’anglaise
un face-à-main un valet de pied un orphelin un poumon
d’acier
un jour de gloire
une semaine de bonté
un mois de Marie
une année terrible
une minute de silence
une seconde d’inattention
et…

cinq ou six ratons laveurs

Send to:
Add '' to diggAdd '' to redditAdd '' to TechnoratiAdd '' to Newsvine
Add '' to Stumble UponAdd '' to SlashDotAdd '' to FaceBookAdd '' to MySpace

Mirrored from Seven steps.

goban

Tryo - Le Petit Chose

Tryo - Le Petit Chose (The Little Something)

http://www.youtube.com/watch?v=JxTlvoisfy8

We all have our internals, our little things

What makes, inside of us, that we're something anyway:

The thing that itches or squirms,

The thing that sleeps or gets dressed,

The little thing inside its soul

Which understands us or peacocks around!

Stop and come get a drink with me

We're gonna talk, and you'll talk, and undo

The sly knots you've sowed

Bad nettles well rooted!

Come on, let's get inside our labyrinth

Come! I need some help!



I know you, you know, you come from my family

I see you in mom's eyes when they shine

If they had untied the knot,

The thing wouldn't be in my eyes anymore

It's incredible to feel oneself

Passing our hand towards the future!


We all have our internals, our little things,


That make it so that a battle can be something

Often I was expecting myself,

Telling myself you have to come!

You have to come by yourself, you know,

I have other things to do!

So I evacuate you, with a gesture of the hand,

Bring you back to the door, show you the way out,

But you came back over and over!

And I went from hatred,

From hatred to indifference, from indifference to wandering

And you know, the day life let me go,

I felt his presence, he accompanied me back...

I understood it was for the next one,

That in the next life I was taking my problem with me

I remember this girl

Who was learning to tell me "I love you" !



There are some who sweat, who work on themselves,

Sailors on the sea, alone with their problems,

Who would like to never come back,

Afraid, alas, to reproduce,

To reproduce the same thing, their only example on earth!



There are some who sweat, who work on themselves,

Sailors on the sea, alone with their problems,

Who would like to never come back,

Afraid, alas, to reproduce,

To reproduce the same thing!
goban

Dreams

On mornings when I can sleep in, it's not unusual for me to alternate between sleep and wake, usually because I like my dream. This Saturday fit the pattern - I had a nice dream about a girl I've known for a few years. I've sort of asked her out and it's been sort of delayed (I didn't get a feeling of rejection, anyway). Saturday morning's dream involved her asking about one of my interests, rock-climbing, and it was this nice feeling that she was leading into me asking her to spend time with me -- you know, rock-climbing, for instance.
... If that makes sense.

Yeah, I didn't really want to wake up, I enjoyed that dream.