“The Interaction of Value and Momentum Strategies” by Cliff Asness

http://quant.whatizit.com/wp-content/uploads/2011/04/1997-04-The-Interaction-of-Value-and-Momentum-Strategies.pdf

There is a longer version (40 pages) also, with some co-authors.

This guy: ChrisMurray has some interesting links to similar models and the intersection of Machine Learning and finance.

https://sites.google.com/site/cdmurray80/home

The precious redirect url for the app store

YEAH, You’ve got an app in the app store and you want to make it easy for people to download. How to get a direct url for quick access without 3 redirects on your iPhone?

Here is the trick: use the itms-apps: protocol.

 

For use to rate your app easily, here is a template.

itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID

Just make sure you are using the correct APP_ID

SVN merge from trunk to the branches

Say if you have a branch, and you need to update the changes from the trunk. Here is a quick help command for you.

Go to the local copy branch directory on your terminal,

$svn merge -r 1001:HEAD https://svn.foryourtrunk.com/pathfortrunk .

Now you should have all the changes from the trunk to your local copy of branch. Make sure all the changes are not going to break your project.

Then commit all the new changes to the branch URL

$svn commit -m “Merge changes from trunk to branch”

That’s all!

Xcode 4 duplicate a new target for iPad

When you try to duplicate the current target and upgrade it for iPad. You can go go Xcode 4, select project. Right click on the target, select duplicate. Then Xcode 4 pops up a dialog for either duplicate only or duplicate and transition to iPad. Let’s go for the iPad target. If your project has any lib linked, you might see a problem when you try to build the fresh duplicate target. I found it’s quite annoying that Xcode 4 adds little back slash “\” in the line of lib search path. You need to fix this problem manually.
When you are ready to build the new target. Make sure to edit the scheme and select the new target under Run>Build Target.

Day 1 Android for 100 developers @GoogleIO

Yep, I still don’t have tickets for GooleIO 2011 yet. Luckily there are still 100 seats available. Just finished round I for day 1. The topic is Android, time to finish is 30mins.

  1. Which class exists to support phone number input formatting?
  2. Each major release of Android has a method or constant whose name is amusing or just silly.  What’s the funny name in Honeycomb?
  3. What virtual machine does Renderscript target in Honeycomb?
  4. A density-independent pixel is equivalent to a physical pixel at what screen density?
  5. What connects Eyjafjörður, a fjord in Iceland, to Android?
  6. What is the name of the Android class that will attach a message queue to a Thread?

Step-by-Step, I got the blackberry web sdk working on my Mac

Ok, here is my to-do task this weekend. I wanted to finish a first app for blackberry tab web sdk. Well, in total I spent 5hrs just try to get things all downloaded and installed on my Mac. Now here is my step-by-step journey post.
1. Read the instructions on blackberry developer site.
2. Install AdobeAIR SDK to Mac
3. Install VMware Fusion to Mac
4. Download the BlackBerryWebWorks SDK
5. Download the BlackBerry Tablet Simulator and configure a virtual machine
6. Set up the debug mode on the BlackBerry Tablet Simulator.
7. Download the demo app skatchPadStandard.zip from the community website.
8. Compile the skatchPadStandard.zip with bbwp:
under bash or terminal, cd yourBlackBerryWebOS/bbwp
./bbwp <your path of skathPadStandard.zip>

With everything running smoothly, you will see a few lines of messages from bbwp and ending with:
[INFO] WebWorks application packaging complete

9. You should see the a new bin folder with a bar file under the app’s path.

10. Install this bar file on the simulator. With the simulator running with debug mode on, click the hammer icon on the home screen. You will see the IP address of the simulator.

11. Go to the path of BlackBerryWebOS/bbwp/blackberry-tablet-sdk/bin under bash or terminal

./blackberry-deploy -installApp -password <your simulator pssd> -device <the ip address from simulator> -package <the full path of sketchPadStandard.bar>

With everything running smoothly, you will see the result::success

Couple of tips:

  1. When you see any errors in the middle of the process, don’t give up too early. I didn’t think I could make it all the way to the end. Hey, I made it!
  2. In case redo or repeat the same step won’t solve the issue, just go to the blackberry community for developers and ask a question
  3. from the help of unix expert, it’s easy to add bbwp path to .bash_profile so you don’t have to go to that folder every time.
  • under home folder, vim .bash_profile or open -a TextEdit .bash_profile.
  • Add one line to your profile: export PATH=$PATH:/usr/local/bin:/Users/<your username>/<yourpathofbbwp>/bbwp
  • Save the changes.
  • Open a new window(it’s just the way it is.)
  • ./.bash_profile   (this will make sure the new changes are added)
  • echo $PATH to make sure the new path is added.
  • now you can access bbwp anywhere
  • Quick test: which bbwp

That’s all! Good luck on your own installation journey. Now I will start my coding.

mrjob Python MapReduce

I am a Python lover, in fact writing a book about how to do Machine Learning in Python. I am writing a chapter on how to do Machine Learning on big data, and I was writing stuff with Hadoop streaming, on Amazon’s Elastic MapReduce. Things were going well until 1. I wanted to include a file separate from the input data. 2. I wanted to do multiple sequential jobs. Like I had a stochastic gradient descent problem that converged in 20 iterations. These problems are not hard to solve in Hadoop in Java however they get mucky when you are using Hadoop Streaming to do jobs in other languages such as the royal Python language. You would need to learn Pig, or Oozie, or Cascading to automate sequential jobs.
Now mrjob released by Yelp allows you to write MapReduce jobs in Python and launch those jobs on Elastic MapReduce all within Python. I am going to investigate mrjob further then I will report back. Hopefully it will appear in my book.
https://github.com/Yelp/mrjob

Debug with Xcode

Let’s face it, you don’t like debugging. Well, neither do I. However, either because you need to clean up the messy code or because you want to get going with your current cool project. It’s almost inevitable to learn how to debug.
With iOS development, you need to use Xcode debug Objective-C. There might be limited resource out there so I would like to share two cents here in my blog.

  • The most easy one: use the console window.
  • Where you are adding the new function to the project, you want to monitor the value. Console window is great for this usage. Inside your code, add in anything like this:
    NSLog(@"%@", mystring);
    In that case, while your app is running, the mystring will get print out on the console window. It’s handy like the printf under c.

  • Trace value step-by-step
  • Add a breakpoint in the Xcode by click in front of the line number. Xcode will add a blue arrow indicating the new breakpoint is added to your code.
    Xcode debugger
    When you hit “Build and Debug” under Xcode, the app will pause at the breakpoint, so you can trace the code or bug step-by-step. While you are under bug tracing, you can print out the object in the console window by typing
    po yourobject
    This will be helpful for custom object value checking because there is no value display under debugger. I guess “po” means print object. :)

  • Memory….
  • Whenever there is anything funky in your app, i.e. the object was released automatically because you didn’t retain it. From time to time, you might see the view disappearing under simulator after a few seconds. It’s funny that there is no error or any hint under the console window. So debugging will be tricky. Generally speaking, the key is to retain the subview, it won’t hurt to try it out.
    Ok, hope this will be helpful.

    Twitter Bot

    We noticed that one person we follow on Twitter posts very regularly and some of his posts appear to be repeats. This guy runs a news site and is always trying to get people to view news through his portal. So we wondered if he was perhaps using an automated system to post to Twitter.

    I looked into doing it and it was pretty easy, within an hour I had my own bot Tweeting for me while I was watching “The Stoned Age.”

    Here is the code

    import twitter
    from time import sleep
    from numpy import random
    
    CONSUMER_KEY = 'get when you create an app'
    CONSUMER_SECRET = 'get when you create an app'
    ACCESS_TOKEN_KEY = 'get from Oauth, specific to a user'
    ACCESS_TOKEN_SECRET = 'get from Oauth, specific to a user'
    
    api = twitter.Api(consumer_key=CONSUMER_KEY,
        consumer_secret=CONSUMER_SECRET,
        access_token_key=ACCESS_TOKEN_KEY,
        access_token_secret=ACCESS_TOKEN_SECRET) 
    
    #print api.VerifyCredentials()
    
    tweetList = ['Too many markets not enough time',
                 'sorry to be negative but G.I. Joe the movie was awful',
                 '#Dell totally screwed up my Dads order',
                 'Using http://runzalot.com to track my running']
    
    for tweet in tweetList:
        status = api.PostUpdate(tweet)
        print 'just posted: %s' % status.text
        sleep(300+random.randint(1, 300))
    
    print "all Done master"
    

    You first have to register an application with Twitter, do that here: http://dev.twitter.com/, don’t worry there is no approval process it’s very quick. Twitter lists a number of libraries for your language of choice but since we all know Python is the greatest language for prototyping an idea I decided to use Python. I used the intuitively named: python-twitter project. The documentation lists three dependencies but I ended up installing four the fourth one was setuptools.

    After all the dependencies are installed you can install twitter-python. Before you start tweeting you need two sets of security credentials. The first one is consumer_key and consumer_secret, which you get from the Twitter Dev site when you register your applications. The second set access_token_key, and access_token_secret are specific to a twitter user. To get these you need to check out the get_access_token.py file that comes with the the twitter-python install. This is a command line python script that uses Oauth to tell Twitter that this application has the right to post on behalf of this user. Once that is done you can put those values into the code above and get moving.

    I just have a time-randomized list of tweets to send out. You could do a lot more with this API like get a list of your friends and get a list of their tweets. If you wanted to generate a lot of tweets you could simply randomly pick a friend and then randomly pick a tweet and retweet it. Or you could search people outside of your network. If you are into generate a lot of tweets.

    Back to our friend who was posting the same stuff over and over. Twitter will not allow you to post duplicate tweets. If you were interested in posting the same stuff over (I am not) and over say cycling between five tweets you would need to make them different. You could add a random character to the end of each tweet, or you could use synonyms.

    Universtiy Rank Vs. School Endowment


    I heard somewhere that the best schools keep getting better because they have money and successful alumni donate money to the school and the cycle completes. I wanted to see if this was true so I took some data. I took the top 50 schools from the US News and World Reports and then looked up their endowment. I was surprised at how well the results turn out.
    This is a plot of school ranking vs. the school’s endowment, then I made a best-fit line to these data points. The schools to the left have a smaller endowment than similarly ranked schools, and the schools to the right have a larger one. The school with the worst performance was for it’s endowment was UT Austin, and University of Michigan was also a poor performer. Tech-centric schools like Caltech and Carnegie Mellon have small endowments but are ranked high.
    I would like to see what this looked like with more data. If anyone wants to continue my work, send me an email and I can give you the data for this plot.

    Return top