Monday, February 10, 2014

Transcranial magnetic stimulation for tinnitus

I have tinnitus. I have had it for 20 years already, but it really got a lot worse almost exactly six years ago.

Recently my local university hospital contacted me and offered me a possibility to take a part in their new study about using "repetitive transcranial magnetic stimulation" (rTMS) for alleviating my tinnitus symptoms.

Sadly, I had to refuse from the offer. I refused because I have found a state of mind where my tinnitus does not bother me too much, or sometimes not at all. During the study I should have kept a diary about my tinnitus sounds and levels, and my fear was that the constant "listening" to my tinnitus, would have made me more aware of my tinnitus and thus completely ruin my progress in my habituation.

I contacted the study assistant and explained my situation to him and he said my choice was probably best for me. Also my current tinnitus intensity level is somewhere around "4", maybe a little less, and the study participants must have the tinnitus intensity level at least 4.

Still, as I was interested in the study, I asked from the assistant that if the treatment really works. His answer really made me happy, he said: "Sure, it works."

The assistant told me, that if I someday feel that my tinnitus is getting too loud and I am not coping with it, I could always come by to take a treatment. Just the thought of having my tinnitus sound diminished even a little bit gives me hope and relief.

You can see more details about this rTMS study from

I have seen the news about rTMS not working on patients or working only as good as placebo treatment, for example

But looking at the results of this prior study, the tinnitus intensity and also the annoyance levels were reduced using rTMS, link to the pdf: link (see page 20 for results, only in Finnish, sorry).

Wednesday, February 5, 2014

Setting TTL to Amazon CloudFront

Do you want to clear the CloudFront cache? Don't want to wait 24 hours to see the new file? Don't want to rename your files?

By default Amazon CloudFront checks only once in 24 hours if the source files in the "origin" have changed. It means that if you upload a new version of the file, for example "index.html", it may take up to 24 hours until the new file is visible for browsers and users. Meanwhile CloudFront keeps serving the old file.

There are several ways to speed up the update:
  1. using invalidation object
  2. renaming the files
  3. setting the time-to-live (TTL) value for distribution origin and Cache-Control value for each individual file
1. Using invalidation object
After you have uploaded a new version from your file, you can make an invalidation request. The documentation says that it takes 10-15 minutes to clear the CloudFront cache for the given file, but in practice invalidation request handling may take up to 30 minutes (or even longer!). You can read more about invalidation requests from:

2. Renaming the files
New files are pushed to the CloudFront automatically. So if you don't mind that the file name changes for example from index.html to index_2.html, you can always upload a file which has completely new filename. Those files are visible in the CloudFront immediately.

3. Setting the TTL value and using Cache-Control
The most flexible and I think also easiest method is to set up the TTL value for the distribution origin to 0 (zero) and then add Cache-Control header to all your files at the moment of upload.

Setting TTL value using AWS Management Console

Follow these steps to set the TTL value:
1. Login to the AWS Management Console
2. Select CloudFront
3. Tick the check box from the distribution you want to manage
4. Select "Distribution settings"
5. Select "Behaviours" tab
6. Tick the check box from the origin you want to manage
7. Click "edit"
8. Set "Minimum TTL" to 0 (zero) and select "Object caching" value to be "Use Origin Cache Headers"
9. Save changes by clicking the button "Yes, Edit"

Follow these steps to set the headers for the uploaded file:
1. From the AWS Management Console, choose "Services" -> "S3"
2. Choose the bucket you are going to upload your file or files
3. Click "Upload"->"Add files" and use the file browser to search your file to be uploaded
4. Click "Set details"
5. Click "Set permissions" -> tick the check box "Make everything public" (if you want so)
6. Click "Set metadata"
7. Click "Add more metadata"
8. For the key, select from the drop-down menu "Cache-Control"
9. For the value, type in: max-age=[SECONDS_1], s-maxage=[SECONDS_2], for example: max-age=60, s-maxage=60
10. Click "Upload"

Done! Browsers will now check every [SECONDS_1] if the file has changed in the CloudFront, and  CloudFront will now check every [SECONDS_2] if the file has changed in the origin.

Note: If the original file did not have the Cache-Control value set, you need to invalidate it first!

Read more about Cache-Control and file expiration from