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 http://clinicaltrials.gov/ct2/show/NCT01929837.
I have seen the news about rTMS not working on patients or working only as good as placebo treatment, for example http://www.reuters.com/article/2013/04/22/us-magnetic-therapy-idUSBRE93L14120130422.
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).
Monday, February 10, 2014
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:
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: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html
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.
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 http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html
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:
- using invalidation object
- renaming the files
- setting the time-to-live (TTL) value for distribution origin and Cache-Control value for each individual file
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: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html
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 http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html
Tunnisteet:
Amazon,
AWS Console,
Cache-Control,
CloudFront,
S3,
Time-To-Live,
TTL
Wednesday, January 8, 2014
Can not see Install button in Adobe Flash Player download page - solution
This post's subject may be obvious and trivial to most of the people, but I for example searched the solution with the title from this post as a search phrase (and couldn't find help)... Really, I just could not see the install button what the instructions told me to click!
But the solution was easy, I found it eventually by mistake: in Windows 8.1, you can not install software, or in this case you can not even see the install button, unless you are using the Administrator's account!
So, just change the user from guest/kids/family/etc to your Admin user, browse to Adobe Flash Player download page and you will see the big yellow "Install now" -button.
But the solution was easy, I found it eventually by mistake: in Windows 8.1, you can not install software, or in this case you can not even see the install button, unless you are using the Administrator's account!
So, just change the user from guest/kids/family/etc to your Admin user, browse to Adobe Flash Player download page and you will see the big yellow "Install now" -button.
Tunnisteet:
Adobe Flash Player,
button,
Install,
install now,
missing
Windows 8 does not load web sites correctly - solution
I recently started using a Windows 8 laptop, and installed the suggested Windows 8.1 version in to it. For a brief moment everything seemed to be fine, until I noticed that from time to time some web sites did not load at all or loaded only partially, like the CSS styles were missing or some Flash content was missing. The web site loading succeeded randomly: the same site could load nicely after first reload but not anymore after second reload.
I spent hours trying to diagnose the problem and finally found the solution: change or add the DNS servers from your network card settings to use Google DNS servers. Crazy, I know, but it worked for me.
What is really strange is that I already had the Google DNS servers in my wireless D-Link router's settings. This was not enough on my Windows 8.1 laptop, I really had to add the DNS servers directly to the wireless network card settings! Maybe someone could explain to me how this can change the situation, I mean, what is the effective difference between DNS settings on the router and on the network card, if the servers are same (other than just the value location)?
Links:
https://developers.google.com/speed/public-dns/docs/using
http://www.eightforums.com/browsers-mail/33778-windows-8-1-not-loading-some-random-websites-correctly-2.html
I spent hours trying to diagnose the problem and finally found the solution: change or add the DNS servers from your network card settings to use Google DNS servers. Crazy, I know, but it worked for me.
What is really strange is that I already had the Google DNS servers in my wireless D-Link router's settings. This was not enough on my Windows 8.1 laptop, I really had to add the DNS servers directly to the wireless network card settings! Maybe someone could explain to me how this can change the situation, I mean, what is the effective difference between DNS settings on the router and on the network card, if the servers are same (other than just the value location)?
Links:
https://developers.google.com/speed/public-dns/docs/using
http://www.eightforums.com/browsers-mail/33778-windows-8-1-not-loading-some-random-websites-correctly-2.html
Tunnisteet:
connection,
loads web sites partially,
loads web sites randomly,
problem,
Windows 8,
Windows 8.1
Thursday, November 21, 2013
Detect if uploaded file is saved to the temporary folder using Django
When uploading a file to the Django server, using HTML form and POST method, it is not always clear what is the used upload handler and if the file is saved to the temporary folder or just kept in the memory.
Here is one way to detect if the file is stored to the temporary folder or not.
def upload(request):
uploaded_file = request.FILES['file']
if isinstance(uploaded_file, TemporaryUploadedFile):
# file has exceeded the value FILE_UPLOAD_MAX_MEMORY_SIZE
# and it has been saved to the temporary folder
print uploaded_tile.temporary_file_path()
# closing the file will delete the file
uploaded_file.close()
return "file too large"
else:
# file is instance of InMemoryUploadedFile
# handle file
return "ok"
Other comparison function that can be used is:
if hasattr(uploaded_file, 'temporary_file_path'):
Links:
https://docs.djangoproject.com/en/dev/topics/http/file-uploads/
http://stackoverflow.com/questions/11835274/django-control-time-of-temporaryuploadedfile-life
Here is one way to detect if the file is stored to the temporary folder or not.
def upload(request):
uploaded_file = request.FILES['file']
if isinstance(uploaded_file, TemporaryUploadedFile):
# file has exceeded the value FILE_UPLOAD_MAX_MEMORY_SIZE
# and it has been saved to the temporary folder
print uploaded_tile.temporary_file_path()
# closing the file will delete the file
uploaded_file.close()
return "file too large"
else:
# file is instance of InMemoryUploadedFile
# handle file
return "ok"
Other comparison function that can be used is:
if hasattr(uploaded_file, 'temporary_file_path'):
Links:
https://docs.djangoproject.com/en/dev/topics/http/file-uploads/
http://stackoverflow.com/questions/11835274/django-control-time-of-temporaryuploadedfile-life
Tunnisteet:
delete,
django,
python,
temporary file,
upload
Wednesday, November 20, 2013
How to start using South database migration tool in your Django project
If you are working with Django application using database, at some point you may need change your database schema. In my projects, when working with extreme style, the database changes are frequent.
The 'syncdb' handles new tables, but it does not update changes to the existing tables. One solution is to start using migration tool 'South'.
A lot of documentation for the South exists, but for some reason I was not able to get it up and running as easily as I thought I would. So I wrote the steps you have to take when starting to use South. I hope it helps.
How to start using South in your Django project
1. start using south by setting it to
- add 'south' to INSTALLED_APPS in your settings.py
2. create needed databases, if you are starting from the scratch
- python manage.py syncdb
3. create initial migration files
- python manage.py schemamigration APPNAME --initial
4. make the first migration, use parameter --fake to avoid "table already exists error"
- python manage.py migrate APPNAME --fake
5. create migration file for fixtures (if you have any)
- manage.py datamigration APPNAME load_fixtures
6. edit the fixture file "000x_load_fixtures.py", search the file from "migrations" folder
- edit the function forwards() to include json fixture of your own
def forwards(self, orm):
from django.core.management import call_command
call_command("loaddata", "my_initial_data.json")
7. run the migration to import the fixtures
- python manage.py migrate APPNAME
Links:
http://south.readthedocs.org/en/latest/index.html
http://south.readthedocs.org/en/latest/installation.html#installation
http://stackoverflow.com/questions/5687627/django-south-error-with-initial-migration
http://south.readthedocs.org/en/latest/fixtures.html
The 'syncdb' handles new tables, but it does not update changes to the existing tables. One solution is to start using migration tool 'South'.
A lot of documentation for the South exists, but for some reason I was not able to get it up and running as easily as I thought I would. So I wrote the steps you have to take when starting to use South. I hope it helps.
How to start using South in your Django project
1. start using south by setting it to
- add 'south' to INSTALLED_APPS in your settings.py
2. create needed databases, if you are starting from the scratch
- python manage.py syncdb
3. create initial migration files
- python manage.py schemamigration APPNAME --initial
4. make the first migration, use parameter --fake to avoid "table already exists error"
- python manage.py migrate APPNAME --fake
5. create migration file for fixtures (if you have any)
- manage.py datamigration APPNAME load_fixtures
6. edit the fixture file "000x_load_fixtures.py", search the file from "migrations" folder
- edit the function forwards() to include json fixture of your own
def forwards(self, orm):
from django.core.management import call_command
call_command("loaddata", "my_initial_data.json")
7. run the migration to import the fixtures
- python manage.py migrate APPNAME
Links:
http://south.readthedocs.org/en/latest/index.html
http://south.readthedocs.org/en/latest/installation.html#installation
http://stackoverflow.com/questions/5687627/django-south-error-with-initial-migration
http://south.readthedocs.org/en/latest/fixtures.html
Thursday, October 3, 2013
Eclipse autocomplete not working - solution
Suddenly the autocompletion in my Eclipse PHP-project was not working anymore. I tried to restart Eclipse, clean and rebuild my projects but nothing worked. Until I found out the brute force solution: remove the index files autocomplete uses!
1. Just delete folder in from your workspace: /.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2
2. Restart Eclipse
Note: If the autocomplete has never worked in your setup, perhaps you have not enabled it? To check and enable autocomplete, go to Eclipse menu: Window > Preferences > PHP > Editor > Content Assist and select "Enable auto activation".
1. Just delete folder in from your workspace: /.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2
2. Restart Eclipse
Note: If the autocomplete has never worked in your setup, perhaps you have not enabled it? To check and enable autocomplete, go to Eclipse menu: Window > Preferences > PHP > Editor > Content Assist and select "Enable auto activation".
Tunnisteet:
auto fill,
autocomplete,
Eclipse,
enable,
not working,
solution
Subscribe to:
Posts (Atom)