14. July 2012

How to fix incorrect Cygwin permission in Windows 7

Cygwin started to behave quite strangely after recent updates. I was not able to edit files in vim, because it was complaining that files are read only. Even cp -r didn’t work correctly. Permission of new directory was broken and I was not able to remove it. Pretty weird behavior.

E.g. ls -l

total 2
----------+ 1 georgik None 34 Jul 14 18:09 index.jade
----------+ 1 georgik None 109 Jul 14 17:40 layout.jade

Hm. It is clear that something is wrong with permission. Even owner has no permission on those files.

Output of mount command:

C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)

I found a solution at cygwin forum. It’s quite easy to fix it.

Open /etc/fstab and enter following line:

none /cygdrive cygdrive binary,noacl,posix=0,user 0 0

Save it. Close all cygwin terminals and start new terminal.

Output of mount:

C: on /cygdrive/c type ntfs (binary,noacl,posix=0,user,noumount,auto)

Output of ls -l

total 2
-rw-r--r-- 1 georgik None 34 Jul 14 18:09 index.jade
-rw-r--r-- 1 georgik None 109 Jul 14 17:40 layout.jade

17. June 2012

How to solve some problems with Drupal after upgrade to PHP 5.4

I’ve found several interesting issue after upgrading PHP 5.3 to PHP 5.4 on Drupal 6 and Drupal 7 sites.

The first biggest problem was that Drupal was displaying Access denied message on all web pages. It was not possible to login to system. Even http://localhost/?q=admin didn’t work.

I had to create temporary session. It is quite easy when using Drush:

drush user-login

Drush displayed one time session for admin. This solved the problem with admin login.

The other issue was that there was Access denied message on every page. There were also other very useful messages flooding each page:

Notice: Undefined index: access in function _menu_link_translate() …

I spent some time searching for any hint how to resolve this weird behavior. It was necessary to delete all Drupal’s caches.

Configuration -> Development -> Performance -> Delete cache

After this clean up Drupal was working correctly.

Then I checked one older Drupal 6 site and there was nice big red warning:

Warning: strtotime() [function.strtotime]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.

The problem was that there was no default timezone in php.ini. It was sufficient to add timezone to /etc/php5/apache2/php.ini to section

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Europe/Prague"

You can find more info about timezones at php.net/date.timezone.

After reloading Apache configuration everything was ok.

9. June 2011

Connect Android to Internet via PC with WiFi

Imagine situation: you have only PC or Notebook with Windows connected to the Internet and you also need to connect Android device to net. There is no WiFi device arround.

First approach is to create just ad-hoc wifi network. The only problem is that Android does not support ad-hoc networks.

Some folks suggest to use VirtualRouter. Unfortunately I had some problems to connect to the network created by this software. This solution doesn’t work for me.

Then I found solution that works like a charm – Connectify.me.

Just turn-on sharing on the device connected to the Internet and choose Home network with virtual interface.

Then start Connectify.me and set up network.

I found another issue related to Lenovo Internet Connection tools. WiFi was shutting down after few minutes. It is quite easy to fix it, when you know where to find right checkbox.

Just open “Lenovo – Internet Connection”, go to Tools. Open Global Settings. Uncheck “Allow wireless radios to be turned off when inactive”. Click ok.

Enjoy WiFi and Android 🙂

30. January 2011

Developer’s problem: Windows 7 – apostrophe does not work

I found something strange. New default installation of Windows 7 had quite weird behavior of keyboard. Apostrophe, quotation mark, tilde didn’t work properly. I had to press apostrophe and then space bar to write single apostrophe.

The reason is that keyboard layout United States – International treats those keys as special. Here is quote from Microsoft support web page:

When you press the APOSTROPHE ( ‘ ) key, QUOTATION MARK ( ” ) key, ACCENT GRAVE ( ` ) key, TILDE ( ~ ) key, or ACCENT CIRCUMFLEX,. also called the CARET key, ( ^ ) key, nothing is displayed on the screen until you press a second key:

  • If you press one of the letters designated as eligible to receive an accent mark, the accented version of the letter appears.
  • If you press the key of a character that is not eligible to receive an accent mark, two separate characters appear.
  • If you press the space bar, the symbol (apostrophe, quotation mark, accent grave, tilde, accent circumflex or caret) is displayed by itself.

The following table shows the keyboard combinations that you can use to create the desired character.

Solution for developers and sys-admins is quite easy. Change keyboard layout from United States-International to something different. E.g. US.

26. January 2011

IntelliJ Idea – Windows – Git – The remote end hung up

I was trying to clone git repository. I had brand new Windows with Cygwin version of git. Intellij Idea displayed nice helpful error message:

fatal: The remote end hung up unexpectedly

I found article at grublesmurf.org that pointed me to solution.

Problem was that Cygwin was using directory c:\cygwin\home\georgik\.ssh, but Intellij Idea was trying to read c:\Users\georgik\.ssh. I moved .ssh directory to c:\Users\georgik and set HOME variable to %USERPROFILE%.It is also worthy to modify /etc/passwd in cygwin to match that directory.