james d. low

live / work / play / worship

MySQL BIT in PHP

Ok, if you subscribe to my blog for personal reasons, this isn’t very relevant to you, but for those of you here for the programming, on a recent project I had some problems getting the BIT field in MySQL to be interpreted as a boolean in PHP. There are a couple of discussions on the net about it here and here, but I couldn’t find any simply stated solutions on the net. So here’s what I ended up doing. You can also download the file here, rename the file .php to use it.


function mysql_bit($bit) {
return ord($bit) == 1;
}

11:15am / Aug 12th / 08 7 Comments

Life Matters

When I quit my full time job so that I could do livewire, I wrote a post outlining some goals now that I had more time to do things. As it turns out 2007 was one of the best years of my life, and I learnt far more about life and about myself than I ever would have imagined. I highly recommend a year out for any of you, and that you don’t have to believe the lie that you need a career or conventional job to be happy. Still here’s a quick review of last years goals:

  • Read the bible more - definitely, not through more discipline, but seeing new things about God and wanting too.
  • Pray more - ditto
  • Get REAL good at guitar - I got better, but never got lessons
  • Practice trumpet - deferred (see below)
  • Get singing lessons - hmmm, might not do
  • Run twice a week - YES! and more
  • Pushups/Situps everyday - a bit inconsistent, but yes
  • I’m still wondering where my life is heading, and it looks like for at least another year I’ll be limited to doing one thing full time. While I don’t want a repeat of the last 6 months of trying to do EVERYTHING I possibly can, and feeling very exhausted and under appreciated in the process, there are a few things I want to make sure I do do:

  • Practice trumpet
  • See a councillor
  • Be cash positive
  • Program Zest
  • Spread certain church responsibilites
  • Love people (ok I’m going to fail, but we’ve all got to try)
  • 10:43am / Jul 23rd / 08 Comments

    Love the iPhone

    I know I’m obsessed with Apple products but the iPhone is seriously cool. So far I’m loving having email where ever I am and the facebook app is cool too.

    I’ve just installed the new wordpress app, and I’m blogging to you from my iPhone. The picture is taken with it as well. It’s us gate crashing a dance reversal at Sha Tin town hall. Very random!

    I’ve also started to use twitterific to update my facebook and adium status using http://apps.facebook.com/twitter and http://adiumxtras.com/index.php?a=xtras&xtra_id=3484

    photo

    3:35pm / Jul 22nd / 08 3 Comments

    What we all should be

    Gave a talk at SR about Love, how it should be with no preconditions or agendas, partly inspired by Donald Miller BLJ and this interview from Anberlin’s Steven Christian. I’m not like this, but we all should be.

    12:33am / Jul 22nd / 08 10 Comments

    No I will not fix your computer

    I’ve realised I need to finally make a stand on this: No I will not fix your computer. I especially won’t fix it over the phone. This to me is the most frustrating thing in the universe, and it is not good for me, or good for our friendship. There are worse things I could say, but if you really do want to ask me a question or fix your computer, I will do it for $200 an hour and that’s only if I know you. If you really want a computer that just works get a mac, SERIOUSLY!

    I was actually pretty close to burning out this year, and dropping everything and shouting at someone very loud. It was only that I was pretty drastic and was pretty decisive about stopping a lot of the things that were in my weekly schedule in order to spend time with friends and relax that I didn’t. Finally as things got really bad I got back to spending time with God, and taking Fridays off.

    The bible says to remember the sabbath and keep it holy, but so many Christians, especially those in ministry rush about making themselves so busy, there excuse being that there is all this good work to do, with maybe even people’s very souls at stake. But this in my opinion is a wrong view of Christian faith. What I see is that we’re supposed to be bringing the gospel, bring rescue to a broken world, and we can’t do that at the expense of causing brokenness in our own lives, or being so busy we don’t spend time time with God, making ourselves poor, sick or exhausted. Yes we should self sacrificial, but maybe dying to ourselves means we say everything doesn’t depend on me.

    I also recently watched Rob Bell’s latest Nooma, Shells. In it he talks about how busy we make ourselves, saying yes to everything and everybody. He finally makes the point that we need to learn to say no to things, not because they’re not good things, but because we’ve said yes to the one or few best things that we are meant to do.

    Why then does someone paying me make a difference? Its not because I want to get rich, its not because money drives me, it’s that if you do pay me, it means I can really work less at everything else I do just to support myself so I can do the things I feel I’m really supposed to do.

    Sorry that was written out of some frustration, but to end on a more light hearted note, I’m glad I don’t work here:

    9:26am / Jul 19th / 08 9 Comments

    These Pages

    Words that You didn’t say were haunting these pages
    Faces You didn’t make were all I was seeing
    The way that they painted You wasn’t a picture
    of one in control - and I don’t think they know who you are

    Mainstay

    3:04pm / Jul 2nd / 08 2 Comments

    Obama Endorsement

    In a small private press conference in Fo Tan, HK, political heavyweights James Low, Lillian Li and James Lewis added their name to the growing list of Obama endorsements.

    There were some fears that such a close political alignment could cause division in the Sunday Lunch Bunch special interest group, but the trio assured the public that there would be no conflict of interest and that Lewis and Low would not be changing their stance on Politico.

    And whatever you think of that you have to watch this:

    8:06am / Jun 21st / 08 21 Comments

    Business Ideas

    So, for those of you that know me know I think, ALOT, and in the process I come up with lots of ideas. I’m also the type of person that tries to do EVERYTHING and too much. After listening to my Pastor’s (excellent) latest sermon on time, I’ve decided I need to be free of feeling like I have to do so much, and just concentrate on the most important things, if I’m really going to be successful in life.

    So here I’m listing a load of the hair-brained business ideas I’ve had. They are now all public, so anybody can feel free to do them if they really think they’re good, and feel free to give a little of the profits if they make a lot :-P

    Finance

    Control Systems For Market Making
    During by time at DB I was involved in a lot of derivatives pricing and risk analysis. One of the ideas I had related to market making. In market making systems use programming logic to determine what price / spread / volume to apply to market making a security. It might be a good idea to model these as a control/feedback system (or even fuzzy logic) as applied in engineering to come up with stable yet fast acting pricing systems.

    Fuzzy Option Pricing
    There are a few papers published about this, but basically the idea is you model an option’s behaviour using a fuzzy logic system that is intuitive to people who know how options should perform given certain conditions. It might be faster than analytical methods, but maybe less accurate.

    Fuzzy Vol Models
    Again related to option pricing. While you might still calculate the price of an option using conventional methods, it might be a good way to construct a vol service using a fuzzy logic system. This would allow the construction of a smooth service, with no discontinuities using logic steps rather than adjusting parameters for skew / long vol / etc.

    China

    Snowboarding
    There must be snow in China, and its cheap to construct and employee in China. Would stand to reason that opening a ski resort for snowboarding and skiing might be really good way to attract tourists and make money, especially since within Asia, Korea and Japan are the main places and are both pretty expensive.

    Tailored Jeans
    There are places in Europe / America that will do tailored jeans for you, any style, custom fit, warn, new, etc. Thought Hong Kong / China would be a great place to do this too, due to the cheap labour and easy custom production that is available in China. Similar to the way HK is a prime destination for tailored suits and shirts at great prices.

    TV Aggregator
    There’s rise of having a ridiculous number of TV channels in Asia these days. In the US there are sites like Titan TV and Tv Tv in Europe which aggregate TV schedules from all the different networks so you can find out in one place what’s on. They also offer services so that DVRs like Elegato can query and programmatically record all of your favourite series like a Tivo.

    7:46pm / Jun 9th / 08 2 Comments

    Jesus And Domitian

    So those of you that know me, will know I say this a lot. But I just listened to this talk and it blew my mind. Never understood anything from relveation as clearly as the exposition on the part of revelation to the Ephisans. Its by Rob Bell (haha suprise suprise) speaking at Willow Creek. An awesome combination.

    You can get the whole video here.

    Or play it embedded here, but its much smaller.

    Enjoy.

    5:52pm / May 9th / 08 Comments

    Tuesdays

    All I have is a voice
    To undo the folded lie
    The lie of authority
    Who’s buildings grope the sky
    No one exists alone
    Hunger allows no choice to the citizen or police
    We must love one another or die,
    We must love one another or die

    WH Auden

    10:21pm / Apr 24th / 08 1 Comment
    « Previous Next »