Project K on

Jul 5, 2009 | Published in Project

Dreamhost won't allow me to operate on my domain anymore, they pre-charged me a month's fee before notifying me to pay. When I tried to unsubscribe, they won't do it until I paid for that month, I was pissed, so I left my account to become suspended. It was a mistake to acquire a domain through them.

On the other hand, it gives me a fresh start. There's new project in my mind that I will start doing from now, and I've learn that the last thing to do is to register a domain name for it. I'm gonna call this project K-on :)

  • k-on

Haskell on iPhone

Jul 4, 2009 | Published in Haskell, iPhone

Essentially doing official iPhone development in Haskell seems to be possible, though still a bit painful. There isn't an Objective-C wrapper, so message passing has to be wrapped in plain C functions, called by Haskell's FFI. Haskell functions can also be called from C, thanks to FFI.

But this is actually pretty neat, whatever ObjC part you want to use, just wrapped it, no big deal.

iPhone ringtone hacks

Jun 23, 2009 | Published in iPhone

requires jailbreak and sshd

Ringtones

  • regular mpeg4 audio files with m4r extensions
  • can be exported from Logic
  • copy directly to

    /Library/Ringtones/
    

SMS tones

  • regular aiff audio files with caf extensions
  • can be directly exported from iTunes by enabling Preference -> General -> Import Setting -> Import Using:AIFF Encoder, then Create AIFF version
  • overwrite any

    /System/Library/Audio/UISounds/sms-received?.caf
    

iPhone dev note

Jun 21, 2009 | Published in iPhone

Associate an instance variable with an IB widget

  • open the resource xib which contains the widget
  • click File's Owner
  • Command + 3 for connection inspector
  • control drag the instance name to the appropriate widget

UIWebView

  • Add the instance variable to some controller

    IBOutlet UIWebView *webView;
    
  • Create a UIWebView instance in IB and associate with that variable

  • Do something in viewDidLoad

    /*
    // Example 1, loading the content from a URLNSURL
    NSURL *url = [ NSURL URLWithString:@"http://google.com" ];
    NSURLRequest *request = [ NSURLRequest requestWithURL:url ];
    [ webView loadRequest:request ];
    
    // Example 2, loading the content from a string
    NSString *HTMLData = @"Hello this is a test";
    [ webView loadHTMLString:HTMLData baseURL:nil ];
    */
    
    // Example 3, load from resource
    NSString *htmlFile = [ [ NSBundle mainBundle ]
                          pathForResource:@"sample" ofType:@"html" ];
    
    NSData *htmlData = [ NSData dataWithContentsOfFile:htmlFile ];
    
    [ webView loadData:htmlData 
              MIMEType:@"text/html"
      textEncodingName:@"UTF-8"
               baseURL:[ NSURL URLWithString:@"" ]
     ]; 
    

情绪

Jun 19, 2009 | Published in Life

一时任性删了 github 的账户,顺带30多个开源项目也一起带走。已经发布在 Hackage 上的自然有备份,没发布的我也懒得整理了,没什么实际用途,备份在硬盘上就够了。

有时候想是不是不要再这么情绪化了,代码放上就放上贝,又不少块肉。不过还是删了。。。

倒是没什么后悔的,可能已经意识到太执着于 Haskell 并不是一件正确的事情,还是应该集中精力在一些该做的事情上吧。

软弱到必须强制才能顺从么,可怜。

おはよう

Jun 19, 2009 | Published in 日文

终于开始学了,下了几个免费的 iPhone App,其中一个叫 Kana Stokes 的很适合记 kana 啊。虽然教材是横着讲的,我怎么感觉是竖着好记呢?看咱这个博客引擎还支持日文呢,嘿嘿。

Jun 18, 2009 | Published in Life

又是缓不过来,恐怖啊。都不敢摸团子大家族的旋律。看第一季时候就觉得背景乐不对劲,3和4之间的反复像是永远挣脱不开的命运,结局终究是这样。