Mercurial tips & tricks for mac

Posted by kusno mudiarto at July 28th, 2008

I am collecting several useful mercurial tricks for me :

- See diffs when committing in vim
see : http://www.selenic.com/mercurial/wiki/index.cgi/DiffsInCommitMessageInVIM
but instead of using the instruction as is, I have to modify the string a little bit to work in my mac:
what I did is replacing :

 $EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $?

with

 vim "+e $HGTMP/diff" '+set nobl buftype=help filetype=diff' "+vsplit $HGTMP/msg"
 

I’ll add more tricks later if I find any

Tags:

Posted in idea / rant| No Comments | 

Reminder to self. Never set the permission of the /

Posted by kusno mudiarto at July 24th, 2008

In a lapse of judgment, I set my hard drive permission to disable readonly for all user, except myself & admin (Using hard drive get info - sharing & permission ). The reasoning was because I can see my root when I enable wireless sharing.

It turned out to be a very bad decision though, my computer won’t boot up anymore. Luckily, I found some helps in the internet.

* first go into single user mode (by pressing command-s during bootup
* mount -a
* mount -uw
* chmod 755 /
* halt

and then restart your computer.

I hope it will fix your problem.

Tags:

Posted in idea / rant| No Comments | 

batch file rename in mac

Posted by kusno mudiarto at July 23rd, 2008

I am missing batch renaming functionality that I used to have in windows -> “ren *.xxx *.xxx.orig” in my macbook. But using utility “mmv”, I finally can do the same in mac & windows.

You can download the utility from here :

http://www.joel.lopes-da-silva.com/articles/computer-science-technology/62-tips-tricks/79-mmv-under-mac-os-x-leopard-for-mac-intel.html

some example usage :

http://debaday.debian.net/2007/06/13/mmv-mass-moving-and-renaming-files/

Tags:

Posted in idea / rant| No Comments | 

IPhone simulator breakpoints problem

Posted by kusno mudiarto at June 12th, 2008

Sometimes I got problem settings breakpoints. I found this solution in apple discussions:
x
As saggymac said:
“The default setting for debugging libraries and frameworks is Load Symbols Lazily. On occasion this causes breakpoints to not be hit. Turning off this setting makes it take longer to start debugging, but hits breakpoints more reliably.”
may be you should set this option OFF… (XCode-Preferences-Debugging)

Tags:

Posted in idea / rant| No Comments | 

Objective-C simple command line program and compilation

Posted by kusno mudiarto at June 4th, 2008

I am trying to compile a simple command line for experiment, and it is somehow not as obvious as I thought.

Here is a the very simple program I copied somewhere from internet

#import <Foundation/foundation.h>

int main( int argc, const char* argv[])
{
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

  NSObject *object = [[NSObject alloc] init];
  NSLog(@"Created Object: %@", object);

  [pool release];
  return 0;
}

and here is how to compile it :

gcc main.m -o main -ObjC -framework Foundation

setting “-framework Foundation” is the one that threw me off. I couldn’t find it anywhere !

Tags:

Posted in idea / rant| No Comments | 

My os x nginx configuration

Posted by kusno mudiarto at June 2nd, 2008

First, to install nginx do this :

sudo port install nginx

then use this configuration - this is only for testing, with setting for my os x (for access log / pids). It also use proxy to merb

# nginx using macports installation
# for my local testing
user kusno staff;
worker_processes  1;

pid /opt/local/var/run/nginx.pid;
error_log  /opt/local/var/log/nginx/error.log  info;

events {
    worker_connections  16;
}

http {
  include        etc/nginx/mime.types;
  default_type   application/octet-stream;
  access_log /opt/local/var/log/nginx/access.log;
  sendfile        on;
  #tcp_nopush     on;
  keepalive_timeout  65;
  tcp_nodelay        on;
  gzip  on;
  gzip_min_length  1100;
  gzip_buffers     4 8k;
  gzip_types       text/plain;
  client_max_body_size 100m;

  upstream merb {
    server 127.0.0.1:4000;
  }

  server {
    listen       80;
    server_name  localhost;

    root /Users/kusno/ezify/public;

    index  index.html index.htm;

    location / {
      proxy_set_header  X-Real-IP  $remote_addr;
      proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_redirect false;
      #if (-f $request_filename/index.html) {
      #  rewrite (.*) $1/index.html break;
      #}
      #if (-f $request_filename.html) {
      #  rewrite (.*) $1.html break;
      #}
      if (-f $request_filename) {
        rewrite (.*) $1 break;
      }
      if (!-f $request_filename) {
        proxy_pass http://merb;
        break;
      }
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
  }
}

use this to restart nginx :

sudo launchctl stop org.macports.nginx
sudo launchctl start org.macports.nginx

Tags:

Posted in idea / rant| No Comments | 

DivX decoder problem during iPhone development

Posted by kusno mudiarto at June 2nd, 2008

I got a strange problem, and unable to play any kind of movies in my iPhone simulator. iPhone just gave a very unhelpful error messages - “The movie could not be played” if I try to play it from internet. Fortunately, if I play the movie locally, I can see some error message from the log :


[Session started at 2008-06-02 11:29:33 -0700.]
2008-06-02 11:29:43.933 TestMP[444:20b] forceGaplessRingtones = NO
2008-06-02 11:29:44.707 TestMP[444:4003] Error loading /Library/QuickTime/DivX Decoder.component/Contents/MacOS/DivX Decoder:  dlopen(/Library/QuickTime/DivX Decoder.component/Contents/MacOS/DivX Decoder, 262): Symbol not found: _SCDynamicStoreCopyConsoleUser
  Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration

It might be caused by DivX decoder that I installed recently. After removing DivX Decoder & Encoder component from /Library/QuickTime, now I can play the movie locally.

But there is still another problem when I tried to play from internet - from my local server; it still won’t play the movies ! .. I tried to download it manually with firefox, and it seems like this is the problem with the mime type. After fixing mime types in the server, voila .. finally I am able to see it running in my iPhone

Tags:

Posted in internet| 2 Comments | 

Perl breakpoint

Posted by kusno mudiarto at May 8th, 2008

Put :

$DB::single=2;

to enable breakpoint in the code. Don’t forget to run with -d

Tags:

Posted in idea / rant| No Comments | 

Merb 0.9.2 xml.builder problem

Posted by kusno mudiarto at April 24th, 2008

Somehow I cannot render .xml content type with merb 0.9.2; maybe I messed up something in my configuration. I keep getting this error :

No Template Found : ...... create.xml.*

although I’m pretty sure that I have create.xml.builder in the specified directory. It seems like the builder was not registered correctly. I was able to fix it by adding:

require 'merb-builder'

in the app/applications.rb

after that merb recognize create.xml.builder file that was in my views

update:

I think the better way is to do it in config/init.rb and add

dependency 'merb-builder'

somewhere in Merb::BootLoader.after_app_loads

Tags:

Posted in idea / rant| No Comments | 

Removing NGINX problem in ubuntu ( or debian )

Posted by kusno mudiarto at April 1st, 2008

I got some problem removing NGINX in my computer running ubuntu. It gave me this error :

Removing nginx ...
Stopping nginx: invoke-rc.d: initscript nginx, action "stop" failed.
dpkg: error processing nginx (--remove):
 subprocess pre-removal script returned error exit status 1
Starting nginx: invoke-rc.d: initscript nginx, action "start" failed.
dpkg: error while cleaning up:
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

Fortunately I found the fix to this problem in here : http://www.digitalsanctum.com/2007/11/07/uninstalling-nginx-via-apt-get-stopping-nginx-invoke-rcd-initscript-nginx-action-stop-failed/

Tags:

Posted in software / tools| No Comments | 

| Next Postings »