Archive for the 'lifehack' Category

Time Logging Script

Friday, August 11th, 2006

I think I found this tip at Lifehacker at some point and decided to implement it. The idea is simple - you set up a script that will ask you what you are currently doing every hour or so, and collect the information in a text file. Then you can parse the file later to see how much time you spend on a given task, or how many things have you accomplished that day.

If the boss asks you what did you do all day yesterday, you can immediately produce a detailed hour by hour activity log. This also comes in handy when the company wants you to long your time in a very detailed way.

I vaguely remember that someone posted a VB script to do that on Lifehacker. I didn’t feel like digging out the post so I just decided to implement it myself. You can go as simple or as complicated as you want with this. I opted for simplicity. I hacked up this nice little shell script:

#!/bin/bash
echo What are you doing right now?
read -e what
echo `date` - $what >> timelog.txt

I really don’t think this can get any simpler than this. For a while I was toying with the idea of using XDialog. But then again I just wanted something quick, easy and robust. So I opted for pure bash.

Now I just needed to create a cron job. Unfortunately, by default cron will run shell scripts in the background. I actually wanted my script to pop up on the screen, get in my face and prompt me for input. So I used kstart to pop up a konsole window on all the desktops:

0,30 * * * * /usr/bin/kstart --windowclass "Konsole" --alldesktops --activate --ontop /usr/bin/konsole -e /home/lmaciak/track

I set my script to annoy me every half an hour. It gives me a better idea of how am I spending my time during the day. But if that’s to much for you, just delete “,30″ from the line, and it will bother you once every hour.

One thing you have to remember is that cron daemon does not really know, or care about X environment. So you need to explicitly state which display should be used for the job. Add this somewhere in your cron file:

DISPLAY=:0

I added it above my cron jobs, but I don’t see why you couldn’t place it below them.

If you look in the timelog.txt code you will see nice grep-able output like this:

Thu Aug 10 15:00:15 EDT 2006 - responding to Bob’s email
Thu Aug 10 15:30:10 EDT 2006 - php class
Thu Aug 10 16:00:27 EDT 2006 - looking into setting up another demo
Thu Aug 10 16:30:15 EDT 2006 - php class coding
Thu Aug 10 17:00:17 EDT 2006 - coding eval.class.php
Thu Aug 10 17:30:19 EDT 2006 - replying to an email from ACE project (timesheet)

Most of these are very brief statements. For example, I can always go back and see what did I write to bob on August 10 around 3pm.

As an added benefit, that nag-window usually jolts me back to work. If I was idling, or wasting time, it forces me to concentrate on what I was supposed to do, and reminds me to get back to work. mrgreen

Fixing your Dell Axim X5 Pocket PC

Friday, July 14th, 2006
Fixing your Dell Axim

Here is a tip for owners of a Dell Axim X5 PocketPC. With time the screen alignment on your device may deteriorate. Especially if you are like me, and you usually carry it in your pocket without a case. Mine got so bad, that I could not operate the device properly. Taps in the middle of the screen were detected as bottom, and so I could not even reach the start menu to get to the screen alignment program.

The only thing I could do was to hard reset the machine, and then re-sync it, and re install all my programs. Unfortunately, reset did not seem to fix my problem. I was greeted by the familiar screen alignment exercise, which makes you tap on the target that appears in 4 corners of the display. Usually a single cycle is enough, but on some occasions you might need 2 or 3 runs to get straightened out.

If the PocketPC just keeps cycling, and never lets you get out of the alignment screen, here is what you do. If you are using a screen protector, take it off. Take a credit card, and run it around the edges of the display (see the picture). Try to get into the crack between the screen and the case and clean out all the dust in there. Chances are, the dirt that builds up in there is creating phantom pressure on the screen and throws off the alignment software. Finally, wipe the screen with a soft dry cloth. Turn it on, and try aligning the screen again.

This worked for me. Try it before you call tech support, decide to spend money on a display replacement, or throw the device out the window.

Positive Reinforcement

Monday, July 3rd, 2006
Nagging Sucks

I find it funny that when people want to get a stranger to do something for them, they usually try to be super nice when they ask for it. And if they get what they wanted, they thank the helpful stranger profusely, promise to repay in kind, and shower them with praise and compliments.

On the other hand, when they need something from a close one (a spouse, a son/daughter, etc…) they try to get it by being downright nasty and hurtful. When they get it, they get ever more nasty complaining that it was not done fast enough, well enough and etc… And the close one fulfilled the request in the most desirable, perfect way, they pull out the old insult disguised as praise: “how come you couldn’t do it this way the last time!”

Phrases such as “thank you” and “I really appreciate this” are really important. If you want to elicit specific behavior, use them combined with a smile, and you will be surprised how well will they work. On the other hand, if you want to pick a fight, and make yourself feel superior by poisoning your loved ones’ life with hateful resentment, go ahead and nag.

I think most naggers will agree with me, that their technique is far from perfect. Usually people build up immunity to it really quickly, and either shut you off while rolling their eyes, or start nagging back. So every time you need to increase your nag strength and frequency just to get the same results. It’s a vicious cycle.

But there is a better way. It’s called positive reinforcement. You reward desired behavior, and completely ignore the undesired stuff. It works - that’s exactly how you train animals to do circus tricks. And that’s how you can train your loved ones to do your bidding.

The linked article talks about “training” your spouse, but it is a good advice for everyone. Positive reinforcement works because it is beneficial both for you and the person you try to influence.

Nagging sends mixed messages. It is very easy to mistake it for personal attack or venting. The person on the receiving end may feel hurt, unappreciated, put down and etc. When you nag, you usurp a dominant position in the relationship, and try to bully others into submission by torpedoing their self esteem. People who find themselves on the receiving end of nagging usually just get angry and/or resentful instead of thinking about correcting their behavior.

But if you use positive reinforcement, the message is crystal clear. You communicate that behavior x pleases you, and you are willing to reward it. Just the way you would reward a stranger for doing you a favor. Instead of forcing a dominant/submissive type relationship, you build up their self esteem and create a feeling of partnership or comradeship.

Everyone likes to be praised, complimented and shown appreciation. Exploit this, and you will usually get what you want in a relationship.

Worst Advice Ever

Tuesday, June 27th, 2006
Brush in the Can

Don’t you love when someone posts a piece of really, really bad, clueless advice on a popular blog, all the cool kids repeat it over and over again? Instructables made a silly suggestion that you should keep your pait brushes in your paint cans. Make, picked it up and reposted it on their blog. Cory Doctorow found it there and then reposted it on Boingboing. By the evening it will probably hit hundreds of other blogs.

To bad that this is a horrible advice. You will most likely completely destroy your brush like this. Here are the reasons why:

  1. You should never store brushes with the bristles down. The weight of the tool will bend them and you will end up with a spoon, forked or an octopus brush that will be unusable
  2. You should never allow paint to hit the base of the bristles. It will gather there and dry into small globs that are nearly impossible to get out. These globs will push your bristles appart creating gaps in the bristle edge eventually leading to forking and “crazy hair” that will simply stick out at random angles.
  3. Paint left on a shelf separates. The dense pigment and adhesive substances deposit on the bottom while the semi-transparent liquid thiner floats on top. This is why painters shake the can, or mix the paint before starting to work. Otherwise you end up with a glue that is too dense to paint with, and water which has no pigment. The most important part of your brush - the bristle line will slowly be encased in that densest, most glue like paint on the bottom of the can. You will have to wash it anyway before you sart painting

So why do these alleged professional painters store brushes this way? Most likely because they will come back the next day and finish the job. Or perhaps they will toss both the can, and the chepo brush they already charged you for on their way home. Who the hell knows. I can tell you one thing - they do not do that to the good brushes.

Good brushes need to be washed with soap and water (and a paint thinner for oil based crap) and cleaned with a brush comb. How do I know this? I used to do contracor work with my dad for a long time. I painted allot of walls, and cleaned allot of brushes.

So remember kids - not everything you find on BoingBoing or Make is good advice.

Update Sat, July 01 2006, 07:32 PM

Fixed spelling and grammatical mistakes. Thanks, Henke.

How to pull an all-Nighter?

Monday, April 10th, 2006

I was reading Lifehacker, and I found this article about pulling all-nighters. It’s all nice and dandy but there is nothing in that article that wouldn’t be common sense, and self explanatory.

What is the point of giving advice such as: when you are sleepy, don’t lie down, take a cold shower, walk around or drink coffee/tea. No shit sherlock!

The truth is - pulling an all-nighter is not difficult. Staying up should not be all difficult unless you are 5 and it’s Christmas Eve P

What is difficult is coping with prolonged sleep deprivation and sleep debt. When you pull an-all nighter, you most likely need to go to school/work the next day. Hell, you might be forced to work late night hours the very same day. Thus you may not be able to “catch up” on sleep till the weekend or something like that.

You will likely accumulate sleep debt, and you will get progressively more exhausted and fatigued every day.

It all really depends on your natural resistance, physical condition and etc. Everyone is affected differently. A stand alone all-nighter is usually harmless, especially if you are young and fit. But when it is followed by several late night coding sessions (or another all-nighter down the road), even the toughest, meanest hard core coffe chugging hacker can start to suffer from sleep deprivation symptoms.

First, and most important tip for those who pull an all-nighter is: try not to not drive the next day. Especially in the evening. Beware of the microsleep lapses. They can be extremely dangerous when you are behind the wheel. The worst part is that you can’t control these - your brain simply switches off for a moment.

Most people are not even aware they fall asleep this way. You go from fully awake, to out cold to fully awake again in under a minute. To you it may seem like you “spaced out” for a second but most likely you just had a microsleep lapse. A minute is enough time to drive into a ditch, or hit a tree. So be careful.

Second, be aware of the “Undead” syndrome. This is where you turn into a living zombie and you sit at your desk staring at your monitor for a good hour or two. Your mind will wander, and generally work in low gear. Are sharp like a razor in the morning, chances are that by lunchtime you will turn into a barely coherent, spaced out lump of flesh. Your concentration will suffer, and getting into “the zone” will be twice or three times as difficult as usual. Every time you get interrupted you will be knocked out off the flow, and it will take you a while before you can resume work at your normal pace. This is normal.

Third, Caffeine rush is to be expected. See, you were up all night drinking coffee and soda. Now you are at work/school drinking more of it to keep yourself awake. You should expect to be unusually hyper. You may also be moody, fidgety, irritated or even anxious. And you will crash eventually. Caffeine crash may range from a total physical shutdown to a mild downer. It usually manifests itself as energy drain. At some point you just stop fidgeting, and you slump down into a near coma. You may experience extreme fatigue, muscle pains, dry mouth, headache and etc. The severity of the rush, and subsequent crash of course depend on the amount of caffeine you ingest. If you just drink coffee or soda you will likely experience only a mild crash.

If you are into Jolt Cola, energy drinks, caffeinated mints and Caffeinated soap - and you use them in excessively during your all-nighter and the day after… Well, you will feel like shit when you crash.

I recommend sticking to your regular amounts of caffeine. You really don’t need 7 coffees, and 10 Red Bull’s and a pack of coke to stay awake all night. If you don’t go overboard you may avoid the caffeine rush, and the subsequent crash.

And lastly, long term abuse of your circadian rhythms will affect your sleep patterns. If you pull many all-nighters, your body will try to adapt to all this late night activity. So once you go back to normal sleeping pattern, you may find it difficult to fall asleep even when you are very tired. You may find yourself tossing and turning till 4am for few days/weeks until your cyrcadians return to normal. This is to be expected P

Please note that IANAD - most of this is from personal experience, and stuff that I heard from others.

Tags: , , , ,