Skip to content

Category: Tutorials

An easy fix for missing exercise minutes on Apple Watch

The Apple Watch is a nice little device, and it’s known to have motivated even lazy people into taking better care of themselves through the “gamification” of exercise. However, it can happen that the Workout app doesn’t properly track exercise minutes (and, to a lesser extent, burned calories), and while Apple provides an official checklist for improving workout calibration, sometimes the issues persist. TL;DR: If you wear the Watch low on your arm, move it higher. Seriously, that fixed it for me. One very peculiar problem I had myself was that indoor walking workouts were not always being recorded properly: calories mostly worked, but I could walk half an hour and yet only a few minutes would be recorded as exercise, even if I walked fast. (Yes, I do walk around he house when it’s too cold to do so outside; a book or a friend on the phone are…

Get rid of those apps in iTunes that you never sync anymore

If you’re like me, you’ve had an iPhone, iPod Touch and/or iPad for a few years now and have probably amassed a fairly big collection of apps, both free and paid. Until last year’s iOS 5, this meant having to keep a local copy of each and one of them on the computer you used to sync your iOS device. My “Mobile Applications” folder contains 924 items, weighing a whopping 18.78 GB. iTunes only lists 920 apps, so something is out of sync already. Obviously, I do not use that many apps. My iPhone 4 only has 163, and I could delete many of those as I don’t use them. My father’s iPad, which uses my Apple ID to get apps so that he doesn’t have to purchase the same ones I have already paid for, has about 250, most of them being games he tried once or twice and…

Printing in grayscale with AirPrint

Did you all think I was dead? Unfortunately for you, I am not. I’ve just been fairly busy with work and with my renewed interest in photography. Speaking of which, all of you should follow my Flickr photostream, which I update daily.

So, you’ve got the shiny new iOS 4.2 on your iPhone 4 and you have enabled AirPrint sharing on your Mac, using either the free Hacktivator or one of the commercial packages. You are very satisfied (albeit a bit doubtful about actually using it in the future), except for one thing: it prints in color, and you really wish it could print in grayscale, because toner is not cheap.

How to use resizeTo in Safari (if it doesn’t work)

Many people are probably familiar with the fact that most browsers allow Javascript code to be entered in the address field. That’s the magic behind bookmarklets, which simply spare the user the hassle of manually typing long, convoluted and obfuscated Javascript statements. While it’s usually pointless to do so, there is one case in which it makes perfect sense: resizing the browser window to an arbitrary size, in order to test what a website looks like. Essentially, by setting the browser window to a size such as 1024 x 768, one can have a relatively reliable idea of what the current website would look at that screen resolution. In truth, one would have to take the graphical elements of the operating system in question, but it’s usually a fine way to get an idea. The code to do so is very simple: window.resizeTo(width, height); Therefore, if we want to set…

Manual duplex printing on a laser printer

My laser printer, a Samsung CLX-3175, does not have any tool for automatic duplex printing. Achieving such result manually is not difficult, but may take some trial and error in order to get the settings right. That’s exactly what I’ve done, and I’m writing this post as a note to myself. Should it be useful to anybody else, however, by all means let me know with a comment. Keep in mind that this is for my own printer, and that I use OS X 10.6 “Snow Leopard.” Results may vary with different printers and/or operating systems, so make your own tests. If your printer outputs pages “face down,” this will probably work as it is. Most ink-jet printers on the other hand output prints “face up,” so some adjustments will be necessary. In any case the steps for my own printer are very, very easy (once you’ve figured them out…

Prettifying URLs with fake subdirectories using mod_rewrite

Lately, I have been trying to define a common basis for most of my web projects, since I often end up reinventing the wheel every time. I have tried a few PHP frameworks, but none of them tickled my fancy, but I have complicated tastes. I am known for reimplementing something from scratch rather than wasting time adapting other people’s code to my needs, and it’s often much faster too. Therefore I have been working on JBFW, my very own PHP/Javascript framework. One of the key components of it is pretty URLS and a centralized index.php to handle most of the things. If you access http://mysite.com/news?lang=en, the server will transparently route that to http://mysite.com/index.php?pagename=news&lang=en. At that point, index.php runs the news module if it’s present, and then loads the news template (possibly showing the result of what was done in the module, if it was called at all.) I find that…

20 tips to run a business without committing suicide

Starting earlier this year, I have been a “professional” IT consultant (libero professionista in Italian.) In practice I mostly deal with web development and computer repairs. It’s what I’ve been doing for over a decade now, since I was still in school, only now I get to pay my own taxes (yay) and therefore I get angrier when people try to rip me off. So, here’s a collection of tips about running a business I put together based on my experience. Note that I refer to the client as a “he,” but that’s just for simplicity. Befriend a lawyer. You will need one sooner or later. Most likely sooner. Assume the client doesn’t have any clue on the details of your job. Listen to his ideas, make a mental note of how you’ll approach the problem in practice, and be ready to explain to him why his “perfect” solution just…

Fix broken IMAP attachments in Mail.app

I have recently started getting broken images in Mail.app. Often, when someone sent me relatively big pictures (over 1 MB in size), the image ended up being corrupted, with a smaller file size that one would expect. This results in a picture that’s visible up to a certain point, and then rest is usually filled with solid grey by the viewer. While this could happen because the attached image is indeed broken — that is, if the sender is attaching an image that’s already corrupted on his/her machine —, it’s unlikely that the file gets mangled during the transit. To begin with, the base64 encoding adds lots of CRC (1/3 of the file size, and this alone explains why it’s a very bad idea to send big files through e-mail). In addition to that, no MTA will accept a malformed message: MIME parts must be completed with an extra boundary…

Chords for “Soft Kitty,” from The Big Bang Theory

One of the funniest “inside jokes” of The Big Bang Theory is the song that Sheldon’s mom used to sing to him when he was sick. It’s featured in three episodes, as you can see here: httpvh://www.youtube.com/watch?v=lqSmzGj_sQc The song is, like most lullabies, very simple. I came up with the chords earlier today, while jamming with my ukulele. Here they are, for all my musically-inclined nerdy readers. Corrections are welcome. [G] Soft kitty, [C] warm kitty, [G] little ball of [D] fur; [G] happy kitty, [C] sleepy kitty, [G] purr, [D] purr, [G] purr. Interesting trivia: they are almost the same chords as The Lion Sleeps Tonight, except for a minor difference in the last verse that shouldn’t prevent the most creative among you to fit one into the other. Should you prefer so, you could play it as C F C G / C F C G C or…

Speed up connections to IRC servers

I have recently gone back to IRC — specifically Freenode — and among the delicious problems of the old days, such as the inability to easily establish DCC transfers (more on that later), I have been presented with the inevitable ident check delay during the connection to server. Ident is essentially a protocol that lets the server know what user is effectively connecting from the client machine. It can be very handy, but most people are behind NAT and/or do not run any ident daemon. This translates to a delay while the server patiently waits for an ident reply before giving up and adding a tilde to the username in the hostmask, which effectively means “this user claims to be called foobar, but I could not verify it.” In practice, this doesn’t change anything at all.