So, at work, we’re building a mobile website using JqueryMobile. The app has a bunch of publicly visible pages however, other pages require the user to be authenticated. We didn’t want the user to be forced to login on the first page. Instead, whenever a protected page is accessed, and if the user insn’t logged into the app, we’d like to take him to the login page. Once he’s successfully authenticated, then take him to the page he was navigating to.
Is it worth it? Definitely seems to be. I’ve looked at VIM in the past, tried it out too a couple of times or more, failed miserably(mostly within a day or two) and then wondered Why nutheads use VI. This would usually be followed with going back to the comfort of Emacs. I think over the years, I’ve spent more time customizing Emacs than actually getting any work done with it.
Running ubuntu 10.10 here and ubuntu repos have only vim 7.2. I’m sure there’s a ppa out there that has 7.3, but thought that compiling vim from source would be a good exercise - plus I get to compile it with the options that I’d like rather than relying on someone’s build. Here’s the options that I enabled: CONF_OPT_PERL = --enable-perlinterp=dynamic CONF_OPT_PYTHON = --enable-pythoninterp CONF_OPT_RUBY = --enable-rubyinterp CONF_OPT_GUI = --enable-gui=gtk2 CONF_OPT_FEAT = --with-features=huge BINDIR = /usr/bin DATADIR = /usr/share Here’s hte other dependencies I had to install
So now I’m in Vim land and this is the first time I’ve gotten far enough to feel a bit comfy. Decided to dust off my blog and start at it again - what better to do it in than in VIM. So - TA-DA - here’s the first post - courtsey VIM on ubuntu. However, as usual, it was rougher than it’s supposed to be. IN any case, I’ll forget how I got this far the next time so the next few posts will be around recording how to get VIM to post to WP.
Have been having all sorts of weird problems with Nandroid backup/restores. Essentially, here’s the symptoms of the problem - I’d get a nandroid and restore it successfully (Amon RA/CWM would report success) - however either will get stuck at boot or if it boots successfully, will have tons of FCs and/or data loss. In most cases, I would dread seeing the green Android on boot up asking me to log in to my google account :(
Force stop market and clear data Launch market again - it will ask you to accept terms. Do so. Should force it to rebuild the database and you should see all your apps linked to market again.
nandroid backup - amon ra recovery Reboot recovery, install zip Install Link2SD-preinstall.zip (only on cyanogen based ROMs) Boot Play around…make sure things work. Install other niceties/Troubleshoot Link2SD - database error.Just uninstall and reinstall. /etc/gps.conf - change to sg.pool.ntp.org Charge to 100% Reboot into recovery wipe battery stats
Back after a long time…saw something strange today and think it deserves a post. I was cranking through Problem 47 on Project Euler. As I was optimizing the solution, the optimization actually increased run time – and I’m at a loss to explain it. So here goes: def problem_47(maxlen = 4): found = False i = 2*3*5*7 + 1 while not found: # facs = [len([j for j in uniq(prime_fac(i+k))]) for k in xrange(0,maxlen)] d = 4 for t in range(i+3, i-1 , -1): k = len(list(uniq(prime_fac(t)))) if k < 4: i = t + 1 break else: d -= 1 if d ==0: found = True print list(xrange(i, i + maxlen)) # if i % 1000 == 0: # print i The run time is about 1m2s.
Was in need of a utility function that can retry an arbitrary function a few times before giving up. Essentially something like Gmail or Google Readers behavior when there’s no network connection. Thought it would be a few minutes job to cook up a decorator utility in Python. Boy! was I wrong! I mean, the basic use case is definitely trivially easy with Python – however, once you want something that’s more useful than that and resembles something that you’d actually use in production, the complexity goes over the top!