Demon face
Sketch for one of the two characters talking in #2

So I’m writing a calendar app and was trying to figure out the weeks in the month for generating the display from a template.
Here’s my (assumedly clunky) response.
There’s a condensed version at the bottom that does the same thing:
<span style="color:#ffed8a; font-weight:bold">function</span> <span style="color:#ddbb00; font-weight:bold">getWeeks_in_month</span><span style="color:#ababab">(</span><span style="color:#dedede; font-weight:bold">$month</span><span style="color:#ababab">,</span> <span style="color:#dedede; font-weight:bold">$year</span><span style="color:#ababab">)</span>
<span style="color:#ababab">{</span>
<span style="color:#978345; font-style:italic">#get start date</span>
<span style="color:#dedede; font-weight:bold">$startDate</span> <span style="color:#ababab">=</span> <span style="color:#ffed8a; font-weight:bold">mktime</span><span style="color:#ababab">(</span><span style="color:#ffffff">12</span><span style="color:#ababab">,</span><span style="color:#ffffff">0</span><span style="color:#ababab">,</span><span style="color:#ffffff">0</span><span style="color:#ababab">,</span> <span style="color:#dedede; font-weight:bold">$month</span><span style="color:#ababab">,</span> <span style="color:#ffffff">1</span><span style="color:#ababab">,</span> <span style="color:#dedede; font-weight:bold">$year</span><span style="color:#ababab">);</span>
<span style="color:#978345; font-style:italic"># find empty days at stop of month</span>
<span style="color:#dedede; font-weight:bold">$emptyDays</span> <span style="color:#ababab">= (</span><span style="color:#ffed8a; font-weight:bold">date</span><span style="color:#ababab">(</span><span style="color:#ff0000">'N'</span><span style="color:#ababab">,</span> <span style="color:#dedede; font-weight:bold">$startDate</span><span style="color:#ababab">) ==</span> <span style="color:#ffffff">7</span><span style="color:#ababab">)</span> ? <span style="color:#ffffff">0</span> <span style="color:#ababab">:</span> <span style="color:#ffed8a; font-weight:bold">date</span><span style="color:#ababab">(</span><span style="color:#ff0000">'N'</span><span style="color:#ababab">,</span>
<span style="color:#dedede; font-weight:bold">$startDate</span><span style="color:#ababab">);</span>
<span style="color:#978345; font-style:italic"># add to days of month to get 'total'</span>
<span style="color:#dedede; font-weight:bold">$monthDays</span> <span style="color:#ababab">=</span> <span style="color:#ffed8a; font-weight:bold">date</span><span style="color:#ababab">(</span><span style="color:#ff0000">'t'</span><span style="color:#ababab">,</span> <span style="color:#dedede; font-weight:bold">$startDate</span><span style="color:#ababab">);</span>
<span style="color:#ffed8a; font-weight:bold">return ceil</span><span style="color:#ababab">((</span><span style="color:#dedede; font-weight:bold">$emptyDays</span> <span style="color:#ababab">+</span> <span style="color:#dedede; font-weight:bold">$monthDays</span><span style="color:#ababab">)/</span><span style="color:#ffffff">7</span><span style="color:#ababab">);</span>
<span style="color:#ababab">}</span>
<span style="color:#ffed8a; font-weight:bold">function</span> <span style="color:#ddbb00; font-weight:bold">getWeeks_in_month</span><span style="color:#ababab">(</span><span style="color:#dedede; font-weight:bold">$month</span><span style="color:#ababab">,</span> <span style="color:#dedede; font-weight:bold">$year</span><span style="color:#ababab">)</span>
<span style="color:#ababab">{</span>
<span style="color:#ffed8a; font-weight:bold">return ceil</span><span style="color:#ababab">((((</span><span style="color:#ffed8a; font-weight:bold">date</span><span style="color:#ababab">(</span><span style="color:#ff0000">'N'</span><span style="color:#ababab">,</span> <span style="color:#ffed8a; font-weight:bold">mktime</span><span style="color:#ababab">(</span><span style="color:#ffffff">12</span><span style="color:#ababab">,</span><span style="color:#ffffff">0</span><span style="color:#ababab">,</span><span style="color:#ffffff">0</span><span style="color:#ababab">,</span> <span style="color:#dedede; font-weight:bold">$month</span><span style="color:#ababab">,</span> <span style="color:#ffffff">1</span><span style="color:#ababab">,</span> <span style="color:#dedede; font-weight:bold">$year</span><span style="color:#ababab">))</span>
<span style="color:#ababab">==</span> <span style="color:#ffffff">7</span><span style="color:#ababab">)</span> ? <span style="color:#ffffff">0</span> <span style="color:#ababab">:</span> <span style="color:#ffed8a; font-weight:bold">date</span><span style="color:#ababab">(</span><span style="color:#ff0000">'N'</span><span style="color:#ababab">,</span> <span style="color:#ffed8a; font-weight:bold">mktime</span><span style="color:#ababab">(</span><span style="color:#ffffff">12</span><span style="color:#ababab">,</span><span style="color:#ffffff">0</span><span style="color:#ababab">,</span><span style="color:#ffffff">0</span><span style="color:#ababab">,</span> <span style="color:#dedede; font-weight:bold">$month</span><span style="color:#ababab">,</span> <span style="color:#ffffff">1</span><span style="color:#ababab">,</span> <span style="color:#dedede; font-weight:bold">$year</span><span style="color:#ababab">))) +</span>
<span style="color:#ffed8a; font-weight:bold">date</span><span style="color:#ababab">(</span><span style="color:#ff0000">'t'</span><span style="color:#ababab">,</span> <span style="color:#dedede; font-weight:bold">$startDate</span><span style="color:#ababab">))/</span><span style="color:#ffffff">7</span><span style="color:#ababab">);</span>
<span style="color:#ababab">}</span>
Holy oozing maggot cheese have I been wading through the molasses-in-December quagmire of a technology nightmare lately.
My printer suddenly started complaining about a phantom paper jam even though there’s no paper even near it. At first I thought it was simply faking it to garner attention since I haven’t been printing much lately. I checked to make sure that none of the cats puked in the paper feed. I cleaned, cleared, examined, prodded, poked, pleaded and yelled. I am now utterly convinced that, like the expensive ink cartridges that leak and smudge and ruin about twenty prints every time you print if you don’t use it every other day, this is just some hidden code built in to my Canon Pixma MP210 so that, if I don’t print at least 20 pages a month, it breaks itself. At the very least, I’ve wasted a brand new print cartridge and have to send this hunk of cursed plastic to the demons at the service center so they can charge me to reset a dip-switch. At most, I’m forced to buy a whole new printer. I’m thinking Epson.
Soon after that, my new Bluetooth headphones arrived from Newegg. I got the LG HBS-200s which are comfortable, cheap and sound pretty damn good. I didn’t know that until about thirty minutes ago since I couldn’t get the damn things to work with my phone, which was the main reason I had bought them. See, my old phone recently started acting like that guy at the party with the fake tan, gold chains and C. Everett Douche chinstrap beard, which is to say, an asshole. This was my T-Mobile Shadow, a phone that was touted as a cross between HAL 2000 and a Star Trek Communicator. Since my somewhat recent ‘upgrade’ to Vista I shouldn’t have been shocked to learn that any device running a flavor of Windows would be problematic. I didn’t think it would take three separate in-warranty replacements due to some of the weirdest, screwed up software failures before I decided to get a different phone. I won’t go into it here since I have a new phone to bitch about but let me just say that if you have the choice between a phone running Windows Mobile, like the Shadow, and a dung rimmed Dixie cup with a string in the end, I’d invest in some Q-Tips and Listerine. ↓ Read the rest of this entry…
Since Microsoft’s Xbox problem reporting tool only allows 500 characters, I left a brief message and a link to this longer plea for help. I’m sure they won’t read it. Here’s the wonderful story:
I got an Xbox 360, loved it, became addicted and bought too many games. I have been eyeing a PS3 lately but since I got one of the newer, ‘fixed’ consoles, I was content and put my money into the 360 instead of getting another console. I was careful: I bought a fan the day I purchased the Xbox and always ran it. I had no problems at all. Everything was great… until one day, a week or so after saving up and excitedly plunking down a wad of cash on Guitar Hero World Tour with the drums, a copy of Rock Band 2 and a bucket full of (paid for) downloaded songs, I got the dreaded Red Rind of Death of the 3 light variety. I scrounged around for my receipt and found it. The date was exactly 364 days from the date I turned it on. This was bad enough, but remember that this was also the leap year that temporarily killed almost every Microsoft Zune on the planet. ↓ Read the rest of this entry…
In my previous post , I went over a few of the theories that attempt to describe exactly why we celebrate Valentine’s day as a romantic celebration:
The world may never know the truth, at least until we invent an exciting, quantum-theory, nano-robotic, cold fusion based machine that allows us to view history through goggles that plug directly into our spines via a socket installed in the napes of our necks. Our best Hollywood screenwriters are on the case and we should see a badly written Michael Bay movie about this shortly, as soon as he can find an appropriate childhood hero of mine to completely wreck for the sake of a quick buck.
Today I want to talk about how to actually celebrate Valentine’s day with the minimum fuss and money without looking both too cheap or too lazy.