Switching from iPhone to another brand – don’t forget to turn off iMessage first!

A girlfriend to one of my friends recently decided to leave the dark side and replace her iPhone with an Android (good decision!). However when she was using the iPhone she also had enabled the iMessage texting.

After switching to her new Android phone her friends, that still was using iPhones, tried to text her. Because her iMessage account was still enabled the texts ended up in the Apple void and didn’t reach her. To disable it the SIM-card had to be put into an old iPhone 3 in order to turn the iMessage off. The iPhone she replaced was using micro-SIM but the Android had normal SIM:s so she had a new larger SIM that wouldn’t fit in her old iPhone. The iPhone 3 works with normal SIM cards so that is why a iPhone 3 had to be used to disable it. 

So, if you decide to convert from iPhone to another brand, remember to turn iMessage off in the iPhone first!

 

Android mail token files fills up my SD card

I use a HTC Desire HD android mobile. My 8 GB SD card was getting full so I removed photos and videos that had already been copied to my PC. But I became a bit curious because of the 8 GB, the images and videos where not consuming the entire space.

To investigate further I connected the android phone using USB to my PC and used the PC:s explorer to dig into the SD-card.

I found out that the mail program stores images and other parts of emails in the Downloads folder on the SD card. After 1,5 years of use there where a significant amount of files there.  

After deleting them i noticed there was a folder called .Mail (i.e. Downloads/.Mail) which contained >21.000 files consuming some 700 MB of space. The filenames began with "token". After some Googleing it seemed by the discussions I found that these are temporary files created each time a message is pushed to the phone. I decided to take a shot and delete them.

After deleting all files in the .Mail folder I opened the mail app on the phone. For a short moment a text was displayed "Preparing SD card". Then my inbox showed up and everything worked normal with the only difference that the mail app seemed a bit quicker now.

My conclusion is that it is probably safe to delete the content of the .Mail folder once in a while to free up some space.

 

 

Error message in Apache log file: “Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden”

The error message "Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden" occured in my Apache logfile and the visitor was displayed an error 403 forbidden error page when trying to access a cgi-script written in Perl. The solution was to add the following for the directory in question to my Apache configuration file: 

<Directory /var/www/cgi-bin>
  <Files ~ (\.pl)>
  Options ExecCGI FollowSymLinks
  </Files>
  Options +FollowSymLinks +SymLinksIfOwnerMatch
</Directory>

 

Remmina on Ubuntu 12.04 problem to connect to Windows 7 with RDP ‘Unable to connect to RDP server’

Suddenly I couldn’t connect to my Windows 7 machine by RDP using Remmina on Ubuntu 12.04. It had worked before and suddenly stopped working. The error message displayed was ‘Unable to connect to RDP server’. Other RDP connections worked fine.

For some reason the problem was solved by editing the file ~/.freerdp/known_hosts and deleting the line with the server having the problem. When connecting again I was asked to accept the certificate and now the RDP connection worked again.

 

Err 310 ERR_TOO_MANY_REDIRECTS in Chrome and Firefox using Apache’s mod_rewrite

I used Apache’s mod_rewrite in order to direct a couple of domains pointing to the same website using the 301 moved permanently (to avoid duplicate content), i.e. something like this in .htaccess: 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.com$
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

I randomly got the error message 310 ERR_TOO_MANY_REDIRECTS when trying the different domains in both Chrome and Firefox (other browsers seemd to work). I had decided my site should be reached without "www", so http://www.example.com was redirected to http://example.com also. 

After a while of head scratching I found a couple of forgotten DNS entries. Two of them where outdated. My domain setup for example.com in DNS looked like this (sample IP-addresses): 

example.com zone:

@  IN  A  192.168.100.1
@  IN  A  192.168.100.2
@  IN  A  192.168.100.3

www  IN  A  192.168.100.1

But only 192.168.100.1 was valid and had a running web server on it.

I guess what happens is when Chrome/Firefox tries to talk to 192.168.100.2 or .3 and get no response, they add "www" in front of the domain name, i.e. http://www.example.com. Now it got a response from the webserver saying 301 redirect to http://example.com. Now trying to talk to example.com on 192.168.100.2 or .3 no response, adding "www" and there we have our loop.

Fixing the DNS entries (removed the invalid 192.168.100.2 and .3) fixed the problem. A bit odd and hard to find, and most of all stupid to have the outdated records still in the zone. 

 

Internal Server Error 500 when trying to install JCE 2.2.6 in Joomla 2.5

When trying to install the JCE content editor for Joomla version 2.2.6 in Joomla 2.5 it failed with HTTP Error 500 Internal Server Error. Directory permissions was not a problem and there was no problem installing other extensions. 

Solution: 

  1. Download the JCE 2.2.6 zip archive to your computer.
  2. Unzip it to a local folder, called for example "jce"
  3. Upload the folder to your Joomla! tmp directory
  4. In the Joomla! backend, go to Extensions -> Manage extensions and go to the box for installation from a folder on the server.
  5. Enter the path where the uploaded folder containing JCE is uploaded, i.e. probably something like /var/www/mysitename/web/tmp/jce and click install.

 

 

Remove or add www to URL using Apache mod_rewrite

To avoid a website being considered as "duplicate content" by Google (i.e. the same website appearing under different URLs) it is a good idea to make sure the website doesnt appear as both http://www.example.com and http://example.com. This can be achieved by using the mod_rewrite in Apache using the .htaccess file.

To remove "www" from the URL, i.e. the website’s URL should be http://example.com, your .htaccess should look like this: 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.com$
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

If you instead want to make sure "www" is added, i.e. the website’s URL should be http://www.example.com, your .htaccess should look like this: 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

 

postfix only listens on localhost (127.0.0.1)

On a newly installed VPS (Parallells Virtuozzo) running Ubuntu 12.04 LTS I also installed postfix as my MTA. However, it turned out that it only listened on localhost. I checked that "inet_interfaces = all" in main.cf and that my /etc/hosts was up to date with my server’s hostname. The reason was that the machine had sendmail preinstalled and running.

A netstat -an gives: 

tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN

To the solution to this is: 

sudo /etc/init.d/sendmail stop
sudo update-rc.d -f sendmail remove
sudo /etc/init.d/postfix restart

Now netstat -anp show that postfix listens to all interfaces: 

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 691/master

 

Avoiding a SSH client connection to timeout

If you’re behind a firewall you sometimes run into a problem where the SSH client connection times out after a period of time (typically when going out for lunch leaving your SSH sessions logged in). The easiest way to solve this is by changing the configuration of the SSH client (it can also be fixed through the server config but since the problem often relates to the firewall protecting the client it is a better solution to fix this in the client). 

Just edit the file ./ssh/config and add the lines: 

Host *
ServerAliveInterval 30

The above assumes the firewall drops inactive connections at an interval > 30 seconds.