Saturday, August 17, 2013

Run Tomboy with Mono 3.2 on Mac

Compiling it from scratch based on http://xmemory.tompium.com/2012/06/running-tomboy-note-taking-app-on-mac.html doesn't work anymore. Here are the additional instructions:-
  • After getting the latest version of Tomboy (1.15.3),  replace "flush(true)" with "flush()" in Note.cs to fix a compile error. Not sure why the compiler complained about this line. Anyway, using just "flush()" fixes the problem but it may not write everything to disk straight away.
  • After building Tomboy, running it caused an exception:- 
Missing method System.Reflection.Assembly::op_Equality(Assembly,Assembly)
To fix it, modify a script file called Tomboy in Tomboy.app -> Contents/MacOS/Tomboy by changing the last line to
exec -a "Tomboy" "$MONO" --runtime=v4.0 --debug $ASSEMBLY $@
Refs
https://bugs.launchpad.net/ubuntu/+source/mono/+bug/882501

http://xmemory.tompium.com/2012/06/running-tomboy-note-taking-app-on-mac.html

Tuesday, August 13, 2013

Offline Maps on New Google Maps for iOS (v2) and Android (v7)

To download an area on the map, type 
ok maps
in the search box.

To clear the cached map, go to
Settings -> About, terms & privacy -> Terms & privacy 
and select
Clear application data
Refs
http://www.idownloadblog.com/2013/07/17/offline-maps-in-google-maps-2/

Sunday, August 11, 2013

System.Object is not defined or imported when building PCL project in Xamarin Studio 4.0.12

There're also a bunch of similar errors:-

: error CS0518: The predefined type `System.Object' is not defined or imported
: error CS0518: The predefined type `System.ValueType' is not defined or imported
: error CS0518: The predefined type `System.Attribute' is not defined or imported
: error CS0518: The predefined type `System.Int32' is not defined or imported
: error CS0518: The predefined type `System.UInt32' is not defined or imported
. . .


To fix this, go to References -> Edit References -> .Net Assembly then add mscorlib.dll from /Library/Frameworks/Mono.framework/Libraries/mono/4.5

Refs
https://bugzilla.xamarin.com/show_bug.cgi?id=12845

Friday, June 28, 2013

Enable Xdebug in MAMP

Uncomment the zend_extension line and modify the /Applications/MAMP/bin/php/php5.x/conf/php.ini file to look like this:-
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
 
; On my machine, the default port 9000 has already been taken by something else.
xdebug.remote_port=9099
 
; Recommended when using Symfony
xdebug.max_nesting_level=250
Then restart the servers in MAMP.

Refs

Show print history on Mac

When I opened the web based CUPS admin interface to show print history:-
http://localhost:631/jobs?which_jobs=completed
I got the "Internal Server Error" message.

To fix it, I used the following commands
sudo cupsctl --debug-logging
sudo cupsctl --no-debug-logging
Refs

Wednesday, June 26, 2013

Custom php.ini on shared hosting

  • Find the default php.ini path. Mine is /usr/local/lib/php.ini
<?php phpinfo() ?>
  • Copy the default php.ini to the user's home folder and customise it.
<?php copy("/usr/local/lib/php.ini", "/home/username/php.ini") ?>
  • Create a .htaccess file in the user's home folder with the following content.
SetEnv PHPRC /home/username/php.ini
# The following lines are important if the php.ini file is put in the document root.
<Files php.ini>
order allow,deny
deny from all
</Files>
Refs

Monday, June 24, 2013

List processes and ports on Mac

  • Show listening ports
lsof -i -nP | grep LISTEN
or with all processes
sudo lsof -i -nP | grep LISTEN
  • Show ports with any state, e.g. ESTABLISHED, CLOSE_WAIT, CLOSED, LISTEN
sudo lsof -i -nP | grep TCP
or
sudo lsof -i -nP | grep UDP
Switches
-i select IPv[46] files
-n no host names
-P no port names

Refs
http://hints.macworld.com/article.php?story=20070425165628961