Find Intersection of Two Date Ranges
Say you have a database of events that span multiple days and you want to filter all events between a certain date range. At first I had this giant mess of this AND that OR this AND that... until I found this:
NOT (range1_start > range2_end OR range1_end < range2_start)That freakin' rules.
Receiving Faxes in OSX
Today I setup a shared Fax modem on our OSX Server. Attached a USB modem and it recognized it just fine. Sending faxes was working great, but I couldn't get it to receive. No matter what I tried, it just wouldn't recognize that the phone line was ringing. According to Google a few other people had the same problem, but there were no solutions. So I dug around and found the problem. My modem was showing up as /dev/tty.usbmodem246802461. However, OSX expects it to be at /dev/tty.usbmodem. I couldn't find anywhere to configure it. I tried creating a symlink to it, but that didn't work. So what I ended up doing was modifying /usr/bin/fax and changing lines 37-38 from:
DEV=cu.usbmodem DEVANSWER=tty.usbmodem
To:
DEV=cu.usbmodem246802461 DEVANSWER=tty.usbmodem246802461
Then killed the efax process and now it works. WTF Apple?
Green Acres is the place for me
I've been neglecting this blog. Main reason? I've turned into a farmer. srlsy :)
MyFolia.com is an excellent website, btw. Highly recommended. Excuse me, I have to go turn my compost pile.
MacBookPro "clunk" Solved! 2
Ever since I got this MacBookPro (15" Rev A. 7200 RPM HD) I had noticed the harddrive makes a "clunk" sound. Not really a click, it almost sounds like a marble dropping on a table. Coincidentally, some things like youtube videos would periodically freeze for no reason. I had tried all kinds of things over the years and nothing helped. People in forums have talked about it, some said it's normal, some said your drive is about to die. Well I just found hdapm!
I used that to set the APM (power management) to max performance and all my problems have gone away. Some tasks even seem a little faster, but it could be my imagination. Apparently, the OSX power management "better performance" doesn't really set true max performance on some hard drives. What was happening is the read head was periodically trying to park even when disk access was happening. So it was parking and then unparking right away. It does that to try and save power. Well my laptop is almost always plugged in, so I don't really need that.
Couchville = EvokeTV 2.0?
The King is dead. Long live the King?
Something looks strangely familiar here...


No, I'm not involved with Couchville. (and neither is TV Guide) Yes, the UI and features are nearly identical to EvokeTV. All it's missing are the personalized rss and ical feeds of favorite shows.
Oh look, Techcrunch featured them saying "they’ve nailed the most important feature - the guide itself". Where was Michael Arrington when I needed him?
Yes, I am feeling a little bitter. I wish them luck though, hopefully they will be able to survive. (the money behind Snapstream will surely help)
ruby-nxt in MacTech Magazine
Check this out, MacTech did an article on using the LEGO MINDSTORMS NXT on a mac and talked about ruby-nxt. Even linked to my website. Unfortunately, they spelled my name wrong! :)
Ruby 1.8.6 and Oniguruma on OSX
I'm working on a project that requires some complicated regexes and for the first time actually needed to do a look-behind. Unfortunately, ruby 1.8.6 doesn't support it. You can accomplish it using Oniguruma and Ruby 1.9 will come with it. There's a gem but then you have to specficially reference it and might require code changes when 1.9 comes out(?), not to mention the fact that it's a pain in the ass to install on osx. So I set out to figure out how to recompile ruby with it patched in. The only info I could find in english was for ruby 1.8.5. Finally figured it out, here's how (also works on linux, not just osx):
curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.gz
tar xzvf ruby-1.8.6.tar.gz
curl -O http://www.geocities.jp/kosako3/oniguruma/archive/onigd2_5_9.tar.gz
tar xzvf onigd2_5_9.tar.gz
cd oniguruma
./configure --with-rubydir=../ruby-1.8.6
make 186
cd ../ruby-1.8.6
./configure --prefix=/usr/local --enable-pthread --with-readline-dir=/usr/local --enable-shared
make
sudo make install
ruby -e "puts Regexp::ENGINE" # should return OnigurumaSolar Power Revolution?
I just found out about this fascinating new company called Citizenre which is starting a service in 2008 called REnU. Despite the unfortunate choice of naming, it looks so awesome it's almost too good to be true. Basically, they are going to offer to install solar panels on your roof for free and charge you a fixed rate based on usage (I think... there's some confusion on this point) which should be equal to or less then you pay now from your utility!? You're basically renting the equipment, but there's nothing to buy, no installation cost, no maintenance fees, and just a $500 deposit. They also have a very moving video (if you're a tree hugger... ok, maybe I'm just a dirty hippie) describing it all with Ed Begley, Jr (hehe) and some narration by Morgan Freeman.
I emailed them the following questions, hopefully they'll get back to me soon:
The FAQ says you pay for the energy you produce, not the energy you actually use, however the Net-Meetering page says that excess energy produced is sold back to the power company and is used as credit for times when you do not produce enough energy to meet your needs? The Overview page says "Performance-based contract means you only pay for what is delivered". This is confusing. Also, the Net-Meetering page says a map of existing net-meetering laws is given below, but there is no map on that page?
How does the controller send reports? Is a phone line required? I don't have a phone line, I have cable modem and Vonage VOIP phone service. Will this be a problem? Can it send the reports using a regular internet connection? One page says a phone line is needed, but then this page says it reports daily via a simple ISP connection.
The How Solar Energy Works page seems to suggest it mostly gathers power during the day and sends most of it back to the power company for credit and then at night it draws power back out of the power company. Why not store most excess power in batteries to draw from when needed? Seems like I would end up losing money because I doubt the rates the power company buys from me would equal what they charge me?
I'm curious about the 25 year contract option. Solar panels will undoubtedly see many advancements over the next 25 years. Will there be an option to upgrade the system and at what cost?
Probably a stupid question, but I don't know much about solar panels. I'm wondering how it handles snow. Must snow be cleared off the panels? I thought it was funny how one of the pictures at the top of one of the pages shows a house covered in snow, but the solar panels are perfectly clear.
I'm also curious why there's no contact email address listed anywhere on the REnU website. The link to Locate an Associate doesn't work and I'm not quite ready to register to reserve a system. I had to goto the main Citizenre website to find an address to email, which is pretty annoying.
UPDATE
I actually got a response quite a while ago, but didn't get around to posting it until now. Just for the record here it is:
1) The page the FAQ refers to (Net Metering) is actually accessible on the home page - as well as the rest of the site - labelled "Service Territory and rates. Thank you for pointing out the error; it will rectified soon.
2) The controller needs to use a phone line to send data. You do not need a dedicated (separate) line and VOIP as well as broadband internet also qualifies.
3) We are not offering energy storage at this time. Although useful, battery packs are not sufficiently friendly to the environment. The system are engineered to meet up to 100% of the historical consumption, so it is higly improbable that there will be an excess.
4) Yes, upgrade options will be available as new technology is implemented.
5) Snow can be cleared off the panels if necessary in the very same way that dust is washed off in the SW. Performance guarantee states that they do not pay a rent if the system is not generating for them. A heating device might be supplied (33 degrees) that could clear off the snow.
I'm still a little confused as to if a phone line is really required. His answer to #2 makes me thing the person doesn't really know what they're talking about. VOIP and broadband != a phone line to send data if it uses a plain old modem.
I'm still very interested in REnU, however I will probably wait until they start to roll it out and people start sharing their experiences. I really hope it succeeds!
EvokeTV.com May Soon Return
Things are still developing and I can't say for certain when or even if EvokeTV will be back online, or if I'll be involved in future development, but cross your fingers. I must say it makes me feel good to know that something I created was purchased by a TVGuide! Unfortunately, no, this doesn't mean I'm filthy rich, but it looks a lot better to have a startup that got bought out by TVGuide than having a typical failed startup on my resume.
I sure hope it will be a triumphant return like Mashable says. ;)
Update: Looks like someone posted it to digg, so show your support and go digg it too!
Juju