05 Jan 2013

# 2012 ManicTime review

History / Edit / PDF / EPUB / BIB / 8 min read (~1572 words)

As 2012 ended, I wanted to take a look back at this year and review my computer usage/consumption in order to reduce time wasting activity. That time should be channeled into more meaningful activities like learning a new language, improving my current skills, practicing piano and more.

The following data has been collected from August 11, 2012 to December 31, 2012. There is about 14 days which do not have any data (application was closed).

The data covers my computer usage with over 966.21h of active usage. During the period for which I collected data, the computer was also powered off for 1686.30h and left unused (away) for approximately 58.04h.

If we account 2 months of 31 days + 2 months of 30 days + 20 days (August) - 14 days without data = 128 days of data. This would average to 7.55h/day of active computer usage. The way it is currently "structured" however is that computer usage during the week is about 4-5h/day while on the week-end, it is about 12h/day.

This sounds a bit high, but there's a reason to this. I'm not ACTIVELY using the computer for all that time. In ManicTime, the computer is considered active if the computer is being used at least once within a 60 minutes time frame. This means I could potentially be using the computer for 1 minute (or less) every hour and it would count as an active usage of 1h. But for the sake of this review, I'll consider myself as a computer addict (which I am) and will count every minute as an active minute.

The following top 10 items accounts for 876.18h out of the 966.21h of active usage of the computer.

 Application Hours Google Chrome 457.76 Remote Desktop Connection 179.11 League of Legends (TM) Client 72.69 VLC media player 62.9 HexChat 35.81 Free Alarm Clock 15.02 mRemote 14.9 Sublime Text 2 14.56 Windows Explorer 12.13 Torchlight II 11.3

On first sight we can see that I spend a lot of time browsing the web. I do various things on there and since it is the biggest chunk of my time, it is worth looking at what I do exactly on the web. The following table is the top 10 websites I've spent time on.

#### Web activity

This covers 259.15h out of 457.76h (56.6%) spent in Chrome. This means that I have a long-tail (a list of many different websites which I visit for a brief period) of 198.61h. The major time consumer here is www.reddit.com, which accounts for 36.2% of my time browsing. Even though reddit is a news/media website (useful for staying up to date with world events, not sure I do that...), it also contains a lot of content which I would categorize as time wasters: funny pictures, pictures of cats, videos as well as discussions about topics of interests (computer science, software engineer, robotics, electronics, etc.). I spent about 1.3h/day during the 128 days for which I collected data, which I find to be quite a lot.

As for the other sites, here's a couple of notes:
www.jolteon.net: This is a bug tracker I use to track new features/bugs where I work. It serves as a personal system for me to track these issues. I use it frequently to update task statuses as well as enter anything that I may have forgotten to add during the day. I also like to review it frequently to remind myself of what is left to work on (and let my mind figure that out while I sleep)
www.youtube.com: I often get on youtube because of reddit. I enjoy watching documentaries which last from 30-45 minutes on average.
docs.google.com: I've spent some time writing documents in Google Docs simply because it allowed me to share them with others so they could review my work.
-confidential-: This is a website I use to manage "things" for work. I generally go there every day and it takes me from 5-15 minutes on average.
www.twitch.tv: Watching streamers of Starcraft 2 and LoL for a while.
www.google.ca: Looks like I spend a lot of time searching...
en.wikipedia.org: Whenever I don't know something about a subject of interest, wiki is a good source (generally...)
www.facebook.com: Checking that everyone I know is still alive

#### Back to the apps

If we go back to the applications I use, the next in the list is Remote Desktop Connection. I use Remote Desktop Connection to connect to my PC at work so that I can do some work from home. As you can see, I have spent almost 1.44h/day working remotely. Considering that I am not a "work at home" employee, I find this to be outrageously high. I would like to see this be as close as possible to 0h/day.

Next is League of Legends (TM) Client. I've recently been interested in the game and started to play it on a more regular basis. I would like to keep this at around 1h/day or lower.

I've used VLC media player to watch series as well as movie on my PC. Series are 20-45 minutes while movies varies from 1h40 to 3h40. I'd say that about 225h/year looks like an acceptable amount of time spent on this.

I've stopped using MSN to chat with friends. My main communication channel is now through IRC, for which I use the HexChat client. I want to spend a maximum of 1h/day on communication though.

I'm not too sure why Free Alarm Clock is part of the top 10. I believe this has to do with the note I wrote at the beginning mentioning that ManicTime would consider a program active if there was some movement on the screen in the last 60 minutes. Since Free Alarm Clock was set to show up (and take focus) every hour, it is quite possible that it simply appeared from time to time while I was away and "sucked" the time out of whatever was running in the background.

mRemote is another application I used briefly to do remote desktop. Since it doesn't support multiple monitor remoting, I've stopped using it.

Sublime Text 2 is my text editor of choice. I haven't spent a lot of time in it since August mainly because I haven't been doing any coding at all in the past few months.

Windows Explorer Some time spent searching for files on my PC!

I've played through the whole campaign of Torchlight II, which was pretty awesome! I'd be really happy to try multiplayer with some willing friends to see what the end content is like (single player end of game content was pretty funny, but playing it alone wasn't very satisfying for me).

#### Conclusion

The important part of this process, other than reviewing what time was spent on this year, is to decide new objectives going forward. This means deciding what should be cut down, reduced, increased or added. For each application I've already determined what was my goal/limits thus I simply need to make sure I follow them. A monthly review should be sufficient.

#### Recommendations

• Reduce reddit usage below 1h/day
• Reduce/cut time spend doing remoting for work
• Redistribute free time on learning activities and skills improvement
05 Jan 2013

# Short SSD setup guide

History / Edit / PDF / EPUB / BIB / 1 min read (~143 words)

Backup everything. First rename, then remove when you confirmed it worked. Better safe than sorry.


REM Set the new root location
REM Ex. NEW_ROOT=D:
REM     NEW_ROOT=D:\Data
REM     NEW_ROOT=D:\MyStuff\MyComputer
set NEW_ROOT=D:

REM (Make sure that C:\Users doesn't exist anymore)
move C:\Users C:\Users.Backup

REM DO NOT DO THE FOLLOWING
REM (Rename C:\ProgramData before creating the link)
move C:\ProgramData C:\ProgramData.Backup

REM Update the TEMP folder at system level
setx /m TEMP %NEW_ROOT%\Windows\Temp
setx /m TMP %NEW_ROOT%\Windows\Temp

move C:\Windows\Temp C:\Windows\Temp.Backup
REM END DO NOT DO

05 Aug 2012

# PHPUnit - No coverage report

History / Edit / PDF / EPUB / BIB / 2 min read (~387 words)

I was trying to get PHPUnit to give me some coverage report for a project I had not worked on for a long time. I had received a github pull request from someone and I wanted to see what the coverage was on the project to see if the submitter had done a good job of covering his code, but I couldn't get PHPUnit to generate a report that contained any data. All I would get was a couple of empty directory folders pages, which was useless.

I had code coverage work on another project in the same environment I was in, so I was pretty sure that my problem had to do either with how I had setup PHPUnit for that particular project, or that something else was interfering with the report generation.

I tried a couple of things, starting by calling phpunit from the command line using different arguments:


--coverage-html report test\symbol_test.php


Would generate some report with data in it, good!


-c test\phpunit.xml (logging set in phpunit.xml)


Would generate an empty report, not good...


--coverage-html report -c test\phpunit.xml


Would generate an empty report, not good...

So at that point I saw that it was working correctly and that something was definitely wrong with my phpunit.xml configuration file. I went back to the phpunit.de manual, specifically on the configuration page, and tried to figure out my problem.

For code coverage to be included in your report, you have to add a filter, be it a blacklist or a whitelist, but you have to have a filter.

So I quickly added a filter such as


<filter>
<whitelist>
<directory>../</directory>
</whitelist>
</filter>


which would whitelist everything that is in the project (my project root is one level above test). Ran phpunit in the test folder and I finally got a report with data!

26 Nov 2011

# PHPUnit - PHP Fatal error: require_once(): Failed opening required 'PHPUnit/Util/Filter.php'

History / Edit / PDF / EPUB / BIB / 2 min read (~330 words)

A friend of mine was trying to install PHPUnit on his mac (OS X Lion), but unfortunately, he got stuck during the process.

At some point, he was faced with this error being displayed. We both looked at the problem and first made sure that said file existed. It was the case, weird...

A bit of googling will reveal that this is frequently fixed by appending the path to the pear folder to your php include_path (defined in your php.ini). But in his case, that was already done and it still wasn't working.

Next up was to check permissions problem. Not having read permissions on the file would of been an easy one to fix, but again, this was not the cause of the problem.

At this point you might be asking yourself, how come the file exists, you have permission to read it, but yet, you can't...

Well, the actual problem was that his OS was set up such that the maxfiles was set to 256 and PHPUnit had already reached that amount of open files.

To check if you have the same problem, try running phpunit using sudo dtruss -f -t open phpunit (Linux users will want to use strace -e open phpunit). In your output, you should see the files being opened. At some point, you'll find Err#24, which indicates "To many file descriptors opened". If you have this problem, then the following should help you fix it.

The solution to this problem is quite easy. What you'll want to do is increase the maximum number of descriptors that can be used by a process. You can do it temporarily with ulimit -S -n 1024 (to use 1024 instead of 256). Another way is to edit it and keep those settings (until you change them again) is to use launchctl limit maxfiles 1024 unlimited.

25 Oct 2011

# PHPUnit not outputting coverage-html

History / Edit / PDF / EPUB / BIB / 2 min read (~262 words)

I've been using PHPUnit recently to test a Kohana application I'm developing as my last semester project for my bachelor's degree.

At some point during the development, code coverage generation decided to stop working on my desktop (my remote CI still had no problem).

I started diagnosing the problem, being on Windows, I thought it could be due to the "poor job" I had done on installing php, pear and phpunit. I didn't want to go through the trouble or reinstalling everything though and just did the minimum: uninstall and reinstall phpunit. No success at that point.

I decided to go back a week or two in my SVN revisions, have it generate code coverage and get to the point were code coverage generation would fail. Took around 2 SVN "update to" to get to that point. After that, I tried updating the tests, but the new tests were using new features. So I updated the code first, then started updating the test files one by one. After a couple of files, I hit an interesting message:

ErrorException [ 1 ]: Allowed memory size of 134217728 bytes exhausted (tried to allocate 543278 bytes) ~ C:\php\pear\Text\Template.php [ 134 ]

I never had that message show up before, which is kind of strange. I would have expected PHP to tell me that same message everytime it tried to generate the documentation but couldn't...

So, quick fix was for me to edit my php.ini so that the memory_limit = 256M instead of 128M.