Recent Updates Page 2 RSS Toggle Comment Threads | Keyboard Shortcuts

  • kusno mudiarto 11:33 am on October 12, 2008 Permalink | Reply  

    OS X Leopard DNS performance problem – enabling local name server 

    Lately I have been having problem with slow DNS lookup while browsing. You can see it when I browse, it took some time in the “looking up for youtube.com …” for example.

    I googled around and tried several solutions as suggested by others.

    1. Using Open DNS (208.67.222.222, 208.67.220.220) and verizon? (4.2.2.1, 4.2.2.2, 4.2.2.3) as my dns server.
    2. Disable Apple IPv6 in System Preference -> Network -> Advanced -> Configure IPv6
    3. Change firefox dns preference in about:config -> network.dns.disableIPv6

    All of those doesn’t seem to fix my problem. I tried the DNS Performance Test and it looks like it is ok, not too fast, but not too slow either; but even though DPT is running correctly, I still see that annoying problem.

    I saw there was a suggestion on turning on local DNS server from macosxhints.

    I followed it, and it works very good in my case, it fixes all my problems, and now I can browse very fast. There are several things that tripped me when I was installing this, so this is my notes for other brave enough to follow the direction.

    Notes :

    • on step 2 (Set up your machine to run BIND server), you have to put forwarders inside the options section. At first I thought I should put it in the end of file, but it didn’t work, I just found it out after careful examination
    • You have to do step 3 (Create StartupItem for DNS). There are 2 files that have to be created there.
    • on step 6, you can start the DNS right away, or you can also try to start the dns server manually first by using this command (without quote): “/usr/sbin/named -f -g” . -f & -g is to  run the server in the foreground, not as a daemon. It is useful if you want to test your configuration
    • There is also a software “named-checkconf” that can check if your named configuration is correct or not.
    • Before switching your network settings to use the local dns, you can test it up by using nslookup like this (without quote): “nslookup yoursite.com – 127.0.0.1″. If your server is set up correctly, nslookup should return the ip address for yoursite.com

    I hope this helps other who have the same problem like me.

    Tags:

     
    • Raphae Halim 6:55 pm on August 29, 2009 Permalink

      Hey, thanks for your post. I wanted to improve my network performance. I found the same article but didn’t know if it would work well on Leopard. You article gave me the confidence to try it out. :-)

  • kusno mudiarto 10:09 pm on July 28, 2008 Permalink | Reply  

    Mercurial tips & tricks for mac 

    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:

     
  • kusno mudiarto 9:04 am on July 24, 2008 Permalink | Reply  

    Reminder to self. Never set the permission of the / 

    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:

     
  • kusno mudiarto 3:25 pm on July 23, 2008 Permalink | Reply  

    batch file rename in mac 

    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:

     
  • kusno mudiarto 3:47 pm on June 12, 2008 Permalink | Reply  

    IPhone simulator breakpoints problem 

    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:

     
    • nicolas 2:28 am on January 17, 2009 Permalink

      yep, was the same here.
      once eagerly loaded, the breakpoints would work

    • Murad Juraev 12:25 am on April 15, 2009 Permalink

      Thank you for the solution so much! Before I couldn’t force Xcode to stop on breakpoints while running my iPhone app on Simulator.

  • kusno mudiarto 5:20 pm on June 4, 2008 Permalink | Reply  

    Objective-C simple command line program and compilation 

    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:

     
  • kusno mudiarto 4:07 pm on June 2, 2008 Permalink | Reply  

    My os x nginx configuration 

    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:

     
  • kusno mudiarto 1:23 pm on June 2, 2008 Permalink | Reply  

    DivX decoder problem during iPhone development 

    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:

     
    • Niall Roche 6:53 am on July 8, 2008 Permalink

      I have the same problem, I tried with many different video types and codecs h.264 and mpeg. Did you find a solution to this?

    • kusno mudiarto 2:27 pm on July 8, 2008 Permalink

      I fixed playing movies problem by :

      1. removing DivX encoder & Decoder from /Library/Quicktime folder
      2. Set the mime type in the server
      3. Make sure the server support the partial content (http 1.1 spec). Apache & Nginx supports this. I know mongrel, webrick (from ruby) doesn’t seem to support this feature.

      2 & 3 applies only if you want to stream from the server.

    • Sameer Kellion 5:04 pm on December 21, 2008 Permalink

      I had the same problem and the fix mentioned above worked for me too… Thanks for posting.

    • Shoaibi 4:19 am on April 26, 2009 Permalink

      Thanks, worked like a charm…

    • Matt MacDonald 4:15 pm on May 22, 2009 Permalink

      Same fix worked for me too.

    • Sudha 3:40 am on November 23, 2009 Permalink

      It really helps me lot. Thanks for the post.

  • kusno mudiarto 1:20 pm on May 8, 2008 Permalink | Reply  

    Perl breakpoint 

    Put :

    $DB::single=2;
    

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

    Tags:

     
  • kusno mudiarto 4:52 pm on April 24, 2008 Permalink | Reply  

    Merb 0.9.2 xml.builder problem 

    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:

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel