Google Webfonts Not Rendering in Chrome for Windows in Headers with Bootstrap Styling

Wow, it’s been awhile since I last posted about…ANYTHING. Anyways, had to resolve an issue last night with Google webfonts not rendering in the Chrome browser on Windows (ironic…). There’s tons of complaints about ugly rendering in Chrome but for me the font was rendering at all even though on Google’s Webfonts page it was fine.

After some finicking and comparing around, I discovered it was actually an issue related to how Twitter Bootstrap styles headers (h1, h2, etc, not the element). They specify the following CSS rule:

text-rendering: optimizelegibility;

For whatever reason, this causes the webfont not to render at all (again, only in Chrome on Windows). Change the value to auto or optimizespeed to get them to show up.

text-rendering: optimizespeed; /* or auto */

Didn’t find anyone else having this issue from my searching, so I thought I’d post it here and hopefully it helps other people who come across it!

Day 4, Another Productive Morning

This morning, I hacked together another bare-bones django app that does the same thing as the evernote one I wrote on Monday, except it integrates with google docs, where most of our existing word studies are. And yes, I created yet another github repo to share the oauth process involved.

Another nice thing about free mornings is I can take my time in praying and reading the Bible. It doesn’t mean I get epiphanies, but at least I can read a chapter slowly and multiple times.

On another note, one of the courses I’m taking is called Design Thinking Bootcamp (yay! I got into it!). We were assigned an interesting design challenge today that is due next week. I won’t say what it is since it’s possible I may interview you about it (“secretly” or explicitly), but I think it’s good that I’m being pushed out of my comfort zone to try to talk to people and find insight in uncovering a particular need.

Django Documentation on Writing a Custom Backend

Edit:

Today is a special day, because I forked my first github repo! +1 geek points.

https://github.com/leehsueh/django-janrain

——————————-

Another nerdy post which may be of some use to a random novice django developer like myself. Feel free to ignore unless you get a kick out of my programming frustrations.

One of the reasons why I love developing with django is because the documentation is excellent. I’ve almost never had trouble using it both as a reference and as a “how to do ____”. Almost, because of what happened today.

I was determined to implement sign-in using the Janrain Engage service for my django apps and after reading the documentation on it from both the Janrain side and the django side, it seemed pretty straightforward. Sample code is also a big help.

After a few hours of coding/testing/debugging (committing other stupid typos and errors), I had everything pretty much working in terms of interfacing with the Janrain API service, mapping django users to external accounts, and authenticating/logging in through django. The only problem was even after I was allegedly authenticated, every time I tried to access a page limited to “logged in users” it would still redirect me to the login page. WHY? I was using the development version of Django so I thought maybe it was a bug and I even tried downloading the latest stable release and testing again; still not working.

Turns out, this is what killed me. When writing an authentication backend, you only need to implement two methods: an authenticate(self, **kwargs credentials) method and a get_user(self, user_id) method. This is the line in the django documentation that killed me:

The get_user method takes a user_id — which could be a username, database ID or whatever — and returns a User object.

“Oh, okay. In that case I’ll just make the user_id parameter be the unique identifier that’s provided by the external service.” So I implemented that method treating user_id as such, and then moved on to the authenticate() method, which required more logic. In practice, I only ever saw the authenticate() method being invoked from the custom code I was writing so I thoughtlessly assumed that my get_user method was only needed for compatibility purposes or for implementing more advanced backend features. And of course, my thoughtless assumption was wrong.

The fix for my problem turned out to be that the get_user method was being invoked somewhere in the framework and it was supplying a user_id corresponding to the primary key of a django User object. After spending hours trying to pick out problems with my authenticate method and view logic, it turned out to be a problem with the 4 lines of code I wrote and never looked back on. Boohoo. Partially my fault for treating the user_id arbitrarily, and partially the documentation’s fault for not describing how the get_user method is used and how to know what the user_id corresponds to (since the documentation stated that it could be “whatever”!).

NYST, BibleDB –> Bible Tidbits

It’s been awhile hasn’t it?

Thank God, two weekends ago the NYST was completed at Hillsborough church in NJ. This was the first time I’ve ever coordinated anything in church of this scale, so although it was a bit stressful, I learned a lot and feel blessed to have such reliable and diligent coworkers in NYM. I also gained a few powerful tidbits during the seminar which were really needed and they have renewed my sense of meaning and strength in serving God (lately I’ve been feeling a bit weary, including during the time I spent prepping for NYST). I guess I’ll just share a few that I remember off the top of my head.

  • Sometimes our zeal can cover up a hidden motive that we weren’t really aware of. In one of the classes we learned how Paul was truly zealous for God before his conversion, yet his zeal (and that of the Pharisees as well) actually stemmed from his desire to assert himself. The law of God is in essence good and holy and righteous; how can anyone who is so zealous for the law miss its very essence and become someone cruel who enjoyed punishing others? Zeal without true knowledge can become zeal with an ulterior motive. And even if it doesn’t, zeal without knowledge causes more harm than good.
  • A growing fellowship must know where its strength comes from. Likewise for the coordinator and for any worker of God. Paul says in 2 Corinthians 3:5 – “Not that we are sufficient of ourselves to think of anything as being from ourselves, but our sufficiency is from God” (emphasis added). I think more recently I’ve come to try to rely on my own strength without really entrusting to or having faith in God’s power. As a result I was always tired and reluctant to do work. But if we know where our strength comes from, we have the assurance that in whatever we have been entrusted to do, we can have sufficiency from God.
  • Be wary of becoming too task-driven or inflexible with deadlines, because it may lead to caring more about the smoothness of an event than the needs of the members who participate. Arguably it is necessary to be task or deadline driven because otherwise things just don’t get done. But we need to be careful not to become so efficient that we neglect the needs of the people and the purpose of holding such events (which are intended to meet those needs). I may have been guilty of this in preparing for the NYST so I need to think a little bit more on how to strike a good balance.
  • When dealing with weariness from holy work, it is important to pinpoint the cause of the weariness. Are we tired/burdened because our spirit is not being truly satisfied? I think this is commonly the case for me, and I believe this blog post on 5 loaves 2 fish summarizes the concept very well. If we’re not being satisfied in spirit, then it’s an indication that our service is more like busy-work and not something we do because it is fulfilling. Perhaps our servitude is not accompanied with the necessary cultivation. If we do not know the God whom we serve, how can that service be meaningful to us? Jesus set such a wonderful example for us. After every great work, like feeding the 5000, he retreated to pray. This teaches us that after we complete some holy work, whether it be an RE workshop or a seminar like NYTS or NYST, that is the time we need to pray the most. That prayer is needed for spiritual rest and renewal of strength. We often emphasize prayer in preparation for some event or special activity, but forget that prayer is just as important afterwards too.

During the fellowship on the last night, we had a few epic rounds of telephone charades (with like 20 people in each line). It was wildly funny to watch and I’m glad I was the designated photographer. Anyways, Pr. Hou had a really interesting observation from it which he shared during the closing ceremony.

He said that the game reminded him of how difficult it is to pass a message down sans variation and mutation. Indeed, in telephone charades the original message becomes beyond recognition by the 3rd or 4th person. When it comes to the truth, we are also tasked with passing down the gospel to those who come after us. It made me realize two things:

  • We need to really know what we believe in, and understand what we have been taught by those before us. In a game like telephone charades, it is extremely difficult to perpetuate the act if you don’t know what you are portraying, even if you mimic every movement mechanically.
  • Even when we think we know the message, we don’t realize our inadequacy until we’ve tried teaching it. “You don’t really know it unless you can teach it.” Sometimes in telephone charades people were able to recognize the answer, but their execution in communicating it to the next person left more to be desired. Thus, even if they knew what the answer was, it was still lost afterwards.

In the game it’s always funny to pick out who in the chain of people really messed it up, but when it comes to the truth of the gospel, we must certainly not be the generation that distorts it for those who follow us. Paul urged Timothy to guard the doctrine with the Holy Spirit, and to preserve the doctrine. As churches become increasingly liberal, the word “doctrine” takes on an increasingly negative connotation of narrow-mindedness and conservatism. But like it or not, doctrine is indisputably crucial to Christian faith – Paul’s exhortations to Timothy and the churches in general attests to that.

In light of all this, it is truly a marvel that the doctrines of True Jesus Church have been preserved since her establishment in 1917. Across borders, cultures, and generations, our basic beliefs have been kept intact. By the grace of God, may we continue in the pattern of sound words which we have heard.

Now onto a completely different topic, I’ve been thinking about what to do with BibleDB. The site’s been inactive and I would venture it’s because of these reasons:

  • people are simply too busy
  • it seems like you’re supposed to write some long and insightful reflection (in this respect it has become something quite different from the original intention of categorizing verses)
  • even if someone did want to get around contributing, the password is long forgotten

A redesign has been swimming around in my head for a little and I’ve gotten around to developing it. I call it “Bible Tidbits” because the purpose of it is to jot down “tidbits” or bite-size notes/annotations, rather than fully developed reflections or devotionals. These tidbits are generally the short little notes you might squeeze within the tiny margins of your Bible, but often record some interesting observation or thought associated with a passage, or with a set of cross references.

Thus, the semantics for the content in this redesign is different from the existing BibleDB. Instead of “Context notes” and “Reflection,” there is “Tidbit” and “More,” for cases where you do want to put down more elaborate thoughts. Typically, however, only the “Tidbit” will be populated and the “More” will be hidden by default unless the person wants to specifically write more stuff. The design is meant to feature the tidbit prominently, so no more need to click on a single record to view its content.

I also removed categories altogether, and just left the organization to tagging. This lets users organize their notes themselves rather than enforcing some categorical scheme.

And the most important enhancement, in my personal opinion, is cross references. Tidbits can be associated with multiple verses/passages instead of just one.

I will say, however, that I’m not developing this app and trying to push it so that many people will want to use it. Ultimately, I’m kind of developing it for myself and tailoring it to the way I work, and if it appeals to other people, great! But for now, I’m just hoping it can be a useful tool for me, a place to perhaps centralize all my Bible margin scribbles and inspirations that can be retrieved later for further development.

Some things I would like to put in place before “releasing it” for general use are authentication/login with existing services (most likely google or facebook) so people don’t have to maintain another special account, and a way to query a passage reference and bring up all the tidbits associated with that range (this is already possible in BibleDB, but because the underlying data model is different, doing it in the redesign is a little more involved).

<begin shameless plug>Anyhow, if you’re interested in checking out the preview, let me know! It’s a fun (although somewhat time-consuming) project for me as it is also an opportunity for me to work with HTML5, CSS3, and Javascript even more. It would be great to get some feedback though, especially in relation to how it should be different from BibleDB so that it can be more useful/more convenient to add content. So again, if you’re interested or just curious to see it, let me know and give me suggestions! </end shameless plug>

I’m not publishing the url since what I have now is basically a prototype and it could very well be so inefficiently fetching too much data in each request that if even a few people play with it my very limited memory quota will be exceeded, causing my webhost to terminate my process.

Life with a CR-48

It’s been 1-2 months since I got the CR-48 (a prototype laptop/netbook that runs Google’s Chrome OS). How has it fit into my habits and workflow?

When It Has Come in Handy

  • Productivity on the BART; 100MB of free 3G data per month for 2 years is a pretty sweet deal. 100MB doesn’t seem like much, but most of the time I’m using wi-fi anyways and I haven’t yet used up the monthly quota. Incidentally, sending emails and editing google docs doesn’t use that much data.
  • Taking sermon notes at church; thanks to the SSD, there’s no more lap burns or noisy fans blowing. The battery life is also sufficient for use throughout a whole day (with wifi and 3G turned off), with more juice to spare.
  • Taking my computer downstairs while I “cook”/prepare my dinner
  • Lying down on my bed to read something without risk of setting my sheets on fire
  • Checking the weather after I’ve shut down my computer
  • I can type in Chinese using pinyin!

What’s Not So Great

  • As I mentioned in an earlier post, it’s weak in terms of processing power. Any video-related activity chokes and lags at least a little bit; video-chatting in particular.
  • Not optimal for local development. Switching on developer mode potentially makes it possible if you install a text editor and manage to get your programming language of choice compiled on it, but without developer mode, it’s not possible.
    • Alternatively, one can SSH into a development server, but again, not possible without developer mode
    • Cloud-based development is a new trend that’s starting to gain some traction. Recently I started using github with cloud9ide, which is very promising, but cloud9 currently can only run javascript, even though it supports creation of python and ruby files. Git integration still makes it useful for non-javascript development, but again, still not optimal yet.
  • The wi-fi antenna seems a bit weaker compared to my dell xps. My room does not have the strongest signal reception, but my xps can still maintain a consistent and stable connection. The CR-48 though, not so much.
  • Chrome’s native PDF reader is pretty inadequate; no bookmark support, no facility to jump to a certain page; workable, but not convenient. Other PDF reader plugins can’t be used either.
  • Chinese pinyin input is only supported for simplified :(

So this post is probably pretty boring to everyone except for those curious about the CR-48, but I said I would post more about it and so this is my attempt at following up on that claim.

In other news, I decided to go to Stanford for graduate school, and ordered an iPad 2 as well as a 13 inch Macbook Pro, marking the beginning of my transition to the apple ecosystem. I’ll try to “justify” these purchases in a later post.

I Finally Learned the Official Term for “Interactive Shell”

Apparently it’s called a REPL (Read, Evaluate, and Print Loop). A REPL is an imperative tool for software development and is an awesome way to play, experiment, and become familiar with a programming language.

The first time I used one was freshman year at Cornell, in CS100. We learned Matlab which makes extensive use of the REPL. When we first learned Java, we used a program called DrJava which has a REPL. Seemed like a really nice way to learn the language.

More recently I’ve come to appreciate the REPL even more in picking up Python/Django and Ruby. When trying to implement a logical code block, I always go to the REPL first to try out individual lines to make sure each one is doing what I expect it to do. Without it, it’s like coding in the dark until you run your entire application.

Which brings me to one of the things that frustrates me at work. No mainstream Java IDE (Eclipse, Netbeans, JDeveloper) comes with a REPL! Oh the irony – something as simple and elementary as DrJava has something so crucial that the big-shot IDE’s don’t have (there may be plugins, but nothing standardized like the way it is with Python and Ruby). In order to figure out what’s wrong with the code, I usually have to run the application in debug mode and use watches. If I could cut out the overhead of starting up the server and deploying by just typing in the line of code into a REPL and seeing what gets spit out, that would save me a lot of time.

Anyways, glad I know the official term for the thing that I always wish I could use.

First Ruby App! Biblia API Demo

Not too long ago I became aware of a micro-framework called Sinatra (yes, as in Frank Sinatra). The original article that I read was promoting it for developing quick and functional prototypes. I was intrigued, and since I had always wanted to start learning Ruby, I decided to give it a shot.

All the troubles and quirks of setting up ruby, git, heroku (for quick deployment), and PuTTY/SSH junk on Windows aside (I think on a unix-based system this process is much easier), development is pretty rapid and fun. I’m completely new to all of this so getting up and running was relatively smooth. Although, there is a weird quirk on my machine where I have to use both cygwin and the Git bash shell to do all the necessary tasks, but it’s tolerable for now.

So what have I been doing with this all? Well first I did a couple of tutorials, including the Twitter tutorial from A List Apart, and then I decided to try to whip up a demo app for using the Biblia web service API that SKU showed me some time ago.

It’s taken a lot longer than it probably should have (but considering I was learning Ruby concurrently, I think it’s forgivable), I finally have something usable worth showing, I hope. You can check it out at http://biblia-demo.heroku.com!

On the index page you can test any request to the API by manually typing in a URL request. I’ve also implemented more specialized forms for the content and search services, which are also ajax-ified using jquery. The search page also makes use of the latest version of jquery which supports the beta jquery templating plugin (check out a tutorial for jquery templates on nettuts)!

The presentation is crude, I know, but I think it should serve as a handy helper for developers wanting to use the Biblia API. It helps (at least for me) to be able to try out requests and see what the raw response is.

Anyways, it would be pretty cool to use this web service in a compelling way, so if you have any ideas for something that could leverage it, let me know!