Republicans Or Democrats: The Choice Comes Down To Competing Myths
An article about competing myths in politics.
The two sides of the coin representing what it means to be an American. I’ve got a foot on each side. It’d be better for our country if more of us were open to that.
Continue readingConcept: Always give the benefit of the doubt
Android accelerometer, getting a wake lock while phone is asleep
There’s a quirk with Android that renders a partial wake lock useless if you want to poll the accelerometer while the screen is off. The workaround is to acquire a screen-dim + acquire-causes-wakeup wake lock. The screen turns on while you’re polling, but that’s the only solution I’ve found.
I’ve implemented the workaround in my GPSing project. Hopefully this won’t cause a drastic change in battery usage.
Continue readingAndroid GPSing
The data hoarder in me is making an appearance. Been tracking my GPS coordinates more consistently for the past few weeks, but InstaMapper on Android is less than ideal for the task. Geoloqi as well. They consume too much battery. I’d rather not have to turn them off when I’m going to stay put for a while – I don’t enjoy fiddling with my phone in public.
Last weekend I began a project of my own that uses the accelerometer to determine when GPS should turn on. Every N seconds it checks the accelerometer for motion, and pulls GPS coordinates into an SQLite database if I’m moving. It doesn’t ping the accelerometer or GPS consistently, and it doesn’t transfer the coordinates to a remote server (though a conservative approach to this will come later).
Continue readingFalsehoods programmers believe about time
Writing code that works with time seems easy. But there are many time pitfalls.
Non-coders can skip this article …
Continue readingIt Starts with Florida
Just read the Nov/Dev 2011 Audobon magazine article, Life Support, about the improving state of Everglades since the author’s previous visit 10 years ago. I won’t go into the details of the article. Nor will I pretend to have a solution for that region. However, the article conjured up some environmentally-related memories from growing up in Florida, so here goes:
As a child I was frequently puzzled by the fact that nobody knew exactly what to do with their old engine oil. Most people I knew dumped it in some far-away back corner of their property. They’d even joke about it probably not being the best thing to do, but they’d then comment on the low quantity and low frequency. And of course, I’ve done the same on many occasions. After all, I was in charge of mowing the lawn, which necessitate oil changes and removal of old gasoline from the previous season. I’d dump it reluctantly, because there didn’t seem to exist any alternative.
Continue readingTag stripping not sufficient to prevent JavaScript injections
In the PHP world, solely relying upon PHP’s strip_tags() function to protect your web application from JavaScript injections is a bad idea. If you do, you may be vulnerable in even the most recent browsers (I tested in Chrome 17.0.963.83, Firefox 9.0.1 and Internet Explorer 9). There may be parallels in other languages too, so beware.
You’ll be vulnerable if the following are true:
- You’ve got a webapp that accepts user input
- You use strip_tags() or similar to sanitize fields
- You don’t explicitly remove less-than or greater-than characters from those fields (PHP’s
strip_tags()won’t remove a partial “<script” tag) - Values from two or more of these fields are printed close to each other in the output HTML, with little or no markup between them
The fourth item is tricky … The markup between the field values must not contain any quotes (the quotes would prematurely close the script tag injection attempt). In other words, it’s possible for an opening SCRIPT tag to be constructed using values from two subsequent user-input fields.
Continue readingHow to GitHub: Fork, Branch, Track, Squash and Pull Request
If you get confused by non-simple Git workflows, this how-to on git forking, branching, etc should help.
Oh thank god! Branching I understood, but was clueless when it came to pushing up a specific branch.
Rebasing too … reminds me of how we badly need a separate dev environment at work. Ugh.
In all, a wonderful tutorial that helps you play along with others while programming.
Continue readingWhy French Parents Are Superior by Pamela Druckerman - WSJ.com
Here’s a Wall Street Journal article on Why French parents are superior.
No, I’m far from having kids, but this was insightful nonetheless. Some noteworthy paragraphs:
Continue readingOne of the keys to this education is the simple act of learning how to wait. It is why the French babies I meet mostly sleep through the night from two or three months old. Their parents don’t pick them up the second they start crying, allowing the babies to learn how to fall back asleep. It is also why French toddlers will sit happily at a restaurant. Rather than snacking all day like American children, they mostly have to wait until mealtime to eat. (French kids consistently have three meals a day and one snack around 4 p.m.)