Post Crunch Mode

The previous weekend was a disaster.

I’ve been taking part in a project, immersing myself in SharePoint to better learn it. We had a production deployment deadline on the Friday, just before last weekend. It didn’t exactly go as planned – some bits weren’t as finished as we thought, others were altogether missing. I worked a 14-hour day on Friday, and then we came back on Sunday. That was even worse. We began working around one in the afternoon, and I got to bed around 6:15 in the next morning, after a mad 17-hour dash to force the thing together by sheer willpower.

I slept about five hours, then went back to work for a nominal four hours. On Tuesday, I was at the office for a full day, but I felt like my brain was drained. I was barely functioning. The same was true on Wednesday, at which point I decided to take Friday off altogether. Thursday was a national holiday, so all together it meant four days of rest, which did me a world of good. In addition to that, I went to TEDx Helsinki on Wednesday at noon, so it was a rather light week. Still, I kept feeling the effects of the all-nighter for a long time.

I’ve been reading “Pragmatic Thinking and Learning”, and I came across a passage that described this phenomenon rather well:

“Not only are you less creative when battling the clock, but there’s a sort of after effect: a time pressure ‘hangover’. Your creativity suffers on the day you’re under the gun and remains depressed for the next two days as well.”

Yeah, I can attest to that.

The twisted bit is, our work culture rewards this kind of behavior. There’s generous overtime pay, the appreciation of superiors, acknowledgement of the heroics by peers and what have you. It’s all geared towards working under time pressure. That is, towards working less effectively. Not to mention the time wasted recovering.

(Mind you, I’m not talking about timeboxes – it’s a good idea to limit the time you allocate for a single activity – but real time pressure is a different beast altogether.)

It’s curious, how after reading my “Slack” and “Peopleware”, I’m still just as susceptible to being pulled in as I ever was.

We can do better than this. The madness needs to stop.

Chapter 6: The Three Great Obstacles to Innovation

(This is part 6 in a series of posts where I document my progress through reading Becoming a Technical Leader: An Organic Problem-Solving Approach by Gerald Weinberg, answering the questions at the end of each chapter)

1. Knowing what you had for dessert is an application of general self-awareness to the question of health.

“How aware are you of your own health and how it affects your leadership style? How do you feel right now? Take an inventory of your physical condition, and describe how it currently affects your performance as a leader.”

I’m in poor shape, although I’ve been worse. I feel tired, and I’ve got all sorts of aches and pains all over the place. On occasion, it plays merry hell with my ability to focus, and I’m sure that if I were healthier, I’d also seem happier, which would certainly have a positive effect on people around me.

2. Poor health is an obstacle to innovation and just about everything else.

“How is your long-term health affected by your career? What is your health going to be like in the future? If you have a hard time answering that question, what makes you think your health is not under your own control? What are you doing to keep it under your own control? How will it affect your career in the future?”

Stress and longer work days affect the way I eat – the more tired I am, the less likely I am to prepare a proper meal. Instead, I tend to opt for a pizza. In the future, I’m going to go for less stress and a healthier diet. Keeping that in mind might affect the choices I make, career-wise.

3. In answering the previous two questions, did you respond that your health was “no problem”?

“What does that tell you about yourself?”

No, I didn’t. It tells me I’m not fooling myself. 🙂

4. Do you know your IQ?

“Do you let other people know? Does knowing your IQ affect your ability to lead? How?”

Not accurately, but I’ve done the Mensa online test, so I’ve got a rough idea. I don’t let other people know, because I’m fairly sure it would only serve to provoke feelings of either superiority or inferiority in others, neither of which seems beneficial. It’s been quite a while since I last thought about my IQ before reading this question, so I can safely say it doesn’t affect my ability to lead in the least.

Come to think of it, I tend to assess people based on their performance, attitude, competence and suchlike, instead of any perceived ‘intelligence’.

5. Do you like to take tests?

“If you knew you were assured of doing well, would you like to take a test? What if you were assured of doing poorly? What if you had to take the test, but were never to find out how well you did? What do these questions have to do with leadership style?”

Yes, I do. If I knew I’d do perfectly, I wouldn’t bother . In every other case, I’d do it just to confirm whether the assurances would hold.

If I wouldn’t have the chance to process how well I did, I wouldn’t see the point either.

If this says anything about my leadership style, it’s that I base my work on feedback.

6. Find some multiple choice quiz and go through it in the following way:

“Instead of picking one answer, take each answer in turn and give a good reason why that could be the answer. Then give a good reason for some answer that isn’t among the choices.”

7. Next time you’re in a meeting and several ideas are brought up, apply the technique of the previous question.

“That is, make sure you give a good reason to the meeting’s participants to explain why each idea could be the solution you’re seeking. Then offer at least one more.”

Both of the questions above ask me to do something, but not report the results. Instead of posting the answers, I’m going to go with what the exercise made me think.

In the multiple choice question, I felt like I was exploring the possibilities. It was the same with the meeting, except for one detail: with the other participants, it kind of made me feel like I couldn’t actually answer the question, for a while. Eventually, I did pick an option and put my (considerable) weight behind it, though.

 

Previously: Chapter 5: But I Can’t Because…  Next up: Chapter 7: A Tool for Developing Self-Awareness

PowerShell quickie: expanding the properties of a variable inside a string

Here’s something that gave me a bit of trouble: I was attempting to run a script to upgrade a bunch of SharePoint solutions, and I wrote it like this:

dir –Recurse –Filter *.wsp | %{ stsadm –o upgradesolution –name $_ –filename $_.FullName –allowgacdeployment –local }

Now, that actually works, but since I hadn’t tested it before, I figured I’d echo the command out first, so I tried this:

dir –Recurse –Filter *.wsp | %{ echo "stsadm –o upgradesolution –name $_ –filename $_.FullName –allowgacdeployment –local" }

Which is all well and good, except it echos out something like the following:

stsadm –o upgradesolution -name Foo.wsp -filename Foo.wsp.FullName -allowgacdeployment -local

The reason this happens is that the string expansion in PowerShell has no way of knowing that I meant to expand the property instead of printing out the literal characters. Having figured this out, the next thing I tried was:

echo "${_.FullPath}"

Which doesn’t work either. Crap. I’m not familiar enough with the PowerShell syntax to explain why that is, but after a moment of pondering I finally figured out something that does work – expressions:

dir –Recurse –Filter *.wsp | %{ echo "stsadm –o upgradesolution –name $_ –filename $($_.FullName) –allowgacdeployment –local" }

The $() syntax allows us to evaluate any arbitrary expression, which is then inserted into the string. Yay!

Get assembly files from GAC using PowerShell

A while ago I found myself in an unfortunate situation where I had to use Reflector to figure out what I was doing wrong when interacting with third-party components. Unfortunately, a large part of the third-party code was in assemblies that were installed in the GAC, and I was unable to find them anywhere else.

Here’s a quick PowerShell one-liner that helped me out:

dir C:\Windows\Assembly -Recurse -Filter "VendorName*.dll" | foreach { copy $_.FullName C:\Temp\assemblies }

That was pretty quick and easy to come up with, and it makes me very glad I decided to learn the basics of PowerShell. 🙂

Protocol-relative HTTP URLs

If you’re visiting a web page over an SSL encrypted connection, you might sometimes get an annoying “mixed content” warning. In essence, the browser is telling you that yes, the page itself was delivered over HTTPS, but other bits were not, and that may or may not mean that you’re in danger.

From the developer point of view, having to build every URL so that the protocol is taken into account can be tedious. It might equally well be the case that your framework of choice already handles this. If so, good for you.

However, there’s another escape hatch not known to most people: protocol-relative URLs. You write the url without the protocol and following colon, and the client will choose whichever protocol was used to retrieve the page, like so: //server:port/path/to/resource.html

Not sure how often this is actually necessary, but there you go. 🙂

Power to the people

My esteemed colleague Jouni Heikniemi is a speaker at this year’s TechDays Finland. His topic is “PowerShell for Developers”. We had a chance to hear his presentation beforehand this morning. I’ve been meaning to do so for a few years now, but after the presentation I finally found the motivation to try and write an actual PowerShell script for myself.

The problem

I wanted a simple script to bundle an ASP.NET web application in a directory – basically, copy all the files that are essential to running the app, and nothing more. Something I’d typically use a NAnt or MSBuild task for.

The solution

image

So I fired up PowerShell ISE (I assume that’s Integrated Scripting Environment) and after a few attempts, came up with this:

$targetPath = "deploy"
if (Test-Path $targetPath) { Remove-Item $targetPath -Recurse -Force }

New-Item $targetPath -type directory

Copy-Item -Path .\App_Data -Destination $targetPath -Recurse 
Copy-Item -Path .\App_GlobalResources -Destination $targetPath -Recurse -Filter "*.resx"
Copy-Item -Path .\bin -Destination $targetPath -Recurse -Filter "*.dll"
Copy-Item -Path ("*.as?x", "*.js", "*.gif", "*.jpg", "Web.config") -Destination $targetPath

Since it creates a directory that can be deployed as an application, I saved the snippet as Deploy.ps1 (in hindsight, Build.ps1 would have been a better name, but I’m too lazy to take another screenshot).

This bit of script is very specific to my needs, so don’t take it as a textbook example of good PowerShell scripting. 🙂

The snag and the resolution

As it turns out, PowerShell scripts aren’t allowed to run, at all, by default. Fortunately, the default is relatively easy to change. Fire up PowerShell or the ISE with administrative privileges, and type:

Set-ExecutionPolicy RemoteSigned

RemoteSigned means you’re free to run unsigned scripts as long as they’re locally created, but scripts downloaded from other sources need to be signed. In case you’re curious, downloaded scripts are identified based on Alternate Data Streams.

PowerShell will ask you to confirm this. In the case of ISE, by means of a really, really long-ass dialog text:

image

Once you confirm the change, you can restart PowerShell with limited privileges, and scripts will work.

For more info on PowerShell, visit Jouni’s series of blog posts on the topic.

SharePoint web part lifecycle

For various reasons, I’ve found myself doing Web Part development for SharePoint 2007. While I suspect I’ll be blogging more thoroughly about it later (possibly even via SharePoint Blues, who knows) , I thought I’d contribute my first useful SharePoint link: The lifecycle of SharePoint Web Parts.

My WebForms experience is rather limited, but on the surface, the list looks a lot like a WebForms control’s life cycle. The reason I needed this list specifically is that I wanted to know the point at which I could safely assume that other web parts would be connected and their data would be available.

Chapter 5: But I Can’t Because…

(This is part 5 in a series of posts where I document my progress through reading Becoming a Technical Leader: An Organic Problem-Solving Approach by Gerald Weinberg, answering the questions at the end of each chapter)

1. Do you know someone whose leadership style you particularly admire?

“Try to create a short career biography of this person, characterized in MOI terms. If possible, interview the person to check your perceptions.”

I can’t really name anyone for this exercise. This has been the primary reason I’ve been sitting on this blog post – the rest of it has been ready for quite a while now. I’ll just have to move on, unfortunately.

2. When was the last time you made a major change in your career?

“Which do you remember best, the factual details, or the feelings?”

I think the one and only major change so far has been leaving my first job after nearly seven years. I was primarily anxious, and afraid that I wouldn’t be good enough for the “real world”. Definitely feelings.

3. How did you react the last time someone you know well made a major career change?

“What else does that tell you about yourself?”

I was happy for that person, and a little envious. I felt like they were going somewhere, while I wasn’t. It’s mostly an issue of low self-esteem.

4. What change in your career have you made that you still don’t fully accept?

“don’t fully admit to others? to yourself? Can you now let go of it? Why?”

I’m not sure what this question is asking. A change that I wasn’t actually fully aware of, and hence don’t accept it, or a change that was forced on me? Either way, I don’t think I have any good examples.

5. Can you remember the first major decision point in your career?

“Can you still recall your feelings? Were you afraid to take the step? Was your fear justified? Was it worth it anyway?”

See question 2. Yes, I was afraid. Yes, I think the fear was justified, because I didn’t think we had ever assessed our actual competence level realistically. It was worth it, though. The next time I moved to a new job, I wasn’t anxious, and I think I made a point of looking at the right things when making the decision. I also got valuable experience from that job.

6. What are your choices for the next major decision point?

“What happens to your body as you contemplate each possible alternative? What messages pop into your mind?”

More or less direct responsibility. More or less of time in the spotlight. Less seems comfortable, but a bit boring. More makes me nervous and excited. The messages are along the lines of “do you want to make a difference or not?”

7. Have you ever been appointed Leader of anything?

“Did people begin to assume that you, as Leader, would now handle situations that they could perfectly well handle themselves? How did you deal with these situations? Were you so taken with your new status that you tried to handle them yourself, rather than delegating them where they belonged? How did your actions affect the group’s later reactions to you as Leader?”

Worse. I was so taken with my status, that I tried to handle things even when nobody asked me to! It lead to tension, bad decisions and me realizing that I wasn’t anything close to a real leader.

8. Next time you are appointed Leader of some group, keep a list of situations …

“… in which people assume that you as Leader will come up with the crucial ideas, but in which you exercise leadership by changing the environment so as to encourage them to do it. Keep going until you have at least ten items.”

Um, OK.

9. Have you ever felt when appointed Leader that you were essential to the group?

“What did the group do when you were not around? What did they do when you eventually left? Could there have been some sort of self-fulfilling prophecy in operation?”

See question 7.

10. For some group you work with, consider ho much of your influence in that group derives from your appointed position.

“How much comes from your idea power? How much from enhancing the idea power of others? Are you satisfied with this mix?”

Influence from appointed position is something I’d like to mostly do without. Most of my influence tends to come from my own actions and ideas. So far, I haven’t been very good at enabling others, except when paired with someone who is a good match with me.

11. Tomorrow morning change your traditional breakfast in some way.

“Notice if your day changes.”

I seemed to be a bit more focused in the morning, having a routine-breaking thing I needed to do.

12. For the next two weeks, change your breakfast each day according to some new idea each day

“(such as fewer or more calories, faster of slower preparation, more or less wholesome, more interaction with other people, less interaction with others, more appealing to look at, thirty minutes later, thirty minutes earlier, in a different place, using different utensils, hot instead of cold, cold instead of hot, more liquid, less liquid). Note what, if anything, is happening to you, and summarize the effect at the end of the two weeks.”

After a couple of days I settled into a mode, where I expected that my morning routine, while being routine, would change every day. I tried to avoid planning too much in advance, so I had to think on my feet to respond to the changes. I’d go as far as to say I was a bit more prepared for routine things to change in other areas of my day.

13. Tomorrow change the way you interact with some person you see frequently.

“Try to do it in such a way as to improve your interaction. Note the results.”

A tiny bit of conscious effort daily can have a huge positive impact on interaction, at least when both parties are naturally inclined to get along anyway. 🙂

 

Previously: Chapter 4: How Leaders Develop  Next up: Chapter 6: The Three Great Obstacles to Innovation

1 2 3 4 5 6 14