tag:blogger.com,1999:blog-34446715391107154112024-03-19T15:55:18.886-07:00..:: geekademy ::..Geekademy prepares young geeks for benevolent world domination.Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.comBlogger50125tag:blogger.com,1999:blog-3444671539110715411.post-41780328527159371672017-08-18T13:03:00.001-07:002017-08-18T13:03:06.797-07:00°H, A Human-Centric Temperature ScaleHere’s a somewhat silly idea that has been bouncing around in my head for a few
years.
It’s a new temperature scale.
Not aware of anyone else having this idea,
but it must have been thought of before, no?
Perhaps with a different name.<br />
<br />
Why would such a thing be needed?
Well, a little backstory…<br />
<a name='more'></a><br />
<div class="section" id="fahrenheit">
<h2>
Fahrenheit</h2>
Growing up in California,
we used and continue to use the
<a class="reference external" href="https://en.wikipedia.org/wiki/Fahrenheit">Fahrenheit<span class="t"></span></a>
temperature scale,
unfortunately keeping us out of sync with the rest of the world.
On the surface,
it is a bit nonsensical and occasionally a cause for others to poke fun at those
“backwards Americans.”
Let’s take a closer look:<br />
<ul class="simple">
<li>32°F, is the freezing point of water</li>
<li>98.6°F, is body temperature</li>
<li>212°F, the boiling point of water (at standard atmospheric pressure)</li>
</ul>
Weird, huh?
Thirty-two degrees feels arbitrary and hard to remember.
It doesn’t make much sense for the
freezing point of water (nor its boiling point).
On to the warmer temperatures.<br />
<div class="section" id="weather">
<h3>
Weather</h3>
One handy feature of Fahrenheit however is that it is great for describing the
weather,
a fact likely unappreciated by metric-only users.
First,
it has more “resolution” without resorting to decimals since the degrees are
smaller.
Second and more importantly,
each ten degrees or so describes a useful block:<br />
<ul class="simple">
<li><input type="color" value="#0000ff" /> 50s and below - cold!</li>
<li><input type="color" value="#00cccc" /> 60s - Cool, need a light jacket or sweater</li>
<li><input type="color" value="#ddcc00" /> 70s - Perfect for typical activities</li>
<li><input type="color" value="#ee9900" /> 80s - Getting warm, shorts preferred</li>
<li><input type="color" value="#ee6600" /> 90s - Summertime baby! Sandals. Too hot to be inside w/o AC.</li>
<li><input type="color" value="#f00000" /> >= 100 - Insufferable (without countermeasures)</li>
<li><input type="color" value="#000000" /> 110-120 - Death imminent, or what I like to call “Vegas in August”</li>
</ul>
Keep in mind these may shift a bit depending on whether a person is very
large or small,
their current internal temperature
(say they just ran up a flight of stairs, or sitting at a desk under AC),
current humidity etc,
but you get the idea.
Nice “round” numbers for everyday activities.<br />
Third,
and perhaps most useful,
100°F and over describes an unbearably hot day.
(Unless in a tank-top and flip-flops, in the shade with a cold-drink,
etc.)<br />
<br />
This makes for a convenient mental model,
and is more “metric-like” than it has previously been given credit for.
Stay with me, metric peeps!</div>
<div class="section" id="fahrenheit-recap">
<h3>
Fahrenheit Recap</h3>
<ul class="simple">
<li>32°F - Freezing point of water - ✗ <i>Arbitrary</i></li>
<li>~50-99°F - Intuitive on a daily basis - ✔ <b>Useful</b></li>
<li>98.6°F, is body temperature - ✗ <i>Arbitrary</i></li>
<li>100°F+ - Unbearably hot - ✔ <b>Useful</b></li>
<li>212°F - Boiling point of water (at standard pressure) - ✗
<i>Arbitrary</i></li>
</ul>
</div>
</div>
<div class="section" id="celsius-aka-centigrade">
<h2>
Celsius, aka Centigrade</h2>
In contrast,
<a class="reference external" href="https://en.wikipedia.org/wiki/Celsius">Celsius<span class="t"> </span></a>is much more logical:<br />
<ul class="simple">
<li>0°C, The freezing point of water</li>
<li>10°C-40°C, Typical day</li>
<li>37°C, Body temperature</li>
<li>40°C+, Unbearably hot day</li>
<li>50°C - Death imminent, aka “Vegas in August”</li>
<li>100°C, The boiling point of water (at standard pressure)</li>
</ul>
Or, at least it seems that way.
In general,
I’m a big fan of metric and its simpler calculation abilities,
but Celsius is my least-favorite part.
Let’s take a closer look at why.<br />
<div class="section" id="freezing-point-of-water">
<h3>
Freezing Point of Water</h3>
Despite what you just read,
I have to admit 0°, for the freezing of water is pretty damn useful,
impacting everything from the selection of proper footwear in the winter to setting the freezer
in the kitchen.
Wouldn’t want to lose that.</div>
<div class="section" id="id1">
<h3>
Weather</h3>
Meh.
As a “gringo” that’s been lucky enough to travel somewhat extensively.
Weather is why Celsius is less impressive,
and it’s a pretty big use case.
From my stint in New Zealand,
I learned that:<br />
<ul class="simple">
<li>9°C is pretty darn cold
(houses there have little insulation).</li>
<li>Comfortable weather was from ~17 to 25 degrees Celsius or so.</li>
</ul>
During my times in Brazil,
I learned that:<br />
<ul class="simple">
<li>From 30° to 40°C, the weather becomes increasingly unbearable, and 40 lead me to start humming an ol'
<a class="reference external" href="https://www.youtube.com/watch?v=RAApJ1nHX2w">Ozzy favorite</a>.</li>
</ul>
Sure, with a few years of familiarity these figures become second nature,
but it's hard to argue these numbers are intuitive in a
numerical sense. Also, every day temps get squeezed into an narrow band around 20°.</div>
<div class="section" id="boiling-water">
<h3>
Boiling Water</h3>
100° for the boiling point of water is logical too, right?
Well, let me ask you a question,
when was the last time you cared about the exact boiling point of water?
Don’t know about you—but—I’m struggling to think of a <i>single time in my entire life.</i><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCzlV9vd-GbVaF7vW4LzDmczaqIZvHTpf8aDTPFd4JeXMMuX9RTz9apDhGG3YJ9yr38Z4omH22zQdqM9Ezt2wnOrxsN_fHduFz1bARmDjJe0XzAGTzaqnkrOVCA_tKxe__nNeGrD8jQ9w/s1600/interesting_man_boil.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCzlV9vd-GbVaF7vW4LzDmczaqIZvHTpf8aDTPFd4JeXMMuX9RTz9apDhGG3YJ9yr38Z4omH22zQdqM9Ezt2wnOrxsN_fHduFz1bARmDjJe0XzAGTzaqnkrOVCA_tKxe__nNeGrD8jQ9w/s320/interesting_man_boil.jpg" width="255" /></a>I don’t boil water often,
but when I do,
I turn the heat up on the stove and walk away for ten minutes,
and later determine the progress of the boiling process not by thermometer,
but by eyeball—looking in the pan to see what size the little bubbles are.
This gives the needed information, no need for a thermometer. The actual number of degrees is never a factor and so could be just about
anything really.<br />
<br />
Perhaps you work in a laboratory or Japanese noodle house,
and the situation is different for you. Ok, but for the rest of us,
the feature of 100 degrees for boiling water is less useful than has been
billed by metric advocates.<br />
<br />
(Note also that as the atmospheric pressure is a factor,
it is likely to not even be 100 degrees exactly at your elevation, <i>shrug.</i>)</div>
<div class="section" id="celsius-recap">
<h3>
Celsius Recap</h3>
Interestingly, the pros and cons of Celsius are opposite of those of Fahrenheit:<br />
<ul class="simple">
<li>0°C, Freezing point of water - ✔ <b>Useful</b></li>
<li>10°C-40°C, Every day temps - <i>✗ Arbitrary</i></li>
<li>37°C, Body temperature - ✗ <i>Arbitrary</i></li>
<li>100°C, Boiling point of water - ✗ Not particularly useful.</li>
</ul>
</div>
</div>
<div class="section" id="kelvin">
<h2>
Kelvin?</h2>
Perhaps when we colonize Pluto,
<a class="reference external" href="https://en.wikipedia.org/wiki/Kelvin">Kelvin<span class="t"></span></a>
will be more useful ;-)
Absolute zero is not a big factor day to day for most people on Earth.
Moving on.<br />
<br /></div>
<div class="section" id="analysis">
<h2>
Analysis
</h2>
So, these temperature scales have been bouncing around in my head for years and something always seemed off about them.
Neither of the two most widely used seems to be fully optimized for humans
living on Earth. A bit odd, don't you think? How can we solve that?
Could we combine the best parts of Celsius and Fahrenheit somehow?<br />
<br />
You may have noticed (like I did) that the round numbers of 100°F and 40°C are
quite <a class="reference external" href="https://encrypted.google.com/search?hl=en&q=100F%20in%20C"><span class="t">close</span></a>,
in that they both describe an unbearably hot day at approximately the same temp. Great, next note that there is a factor of 2.5 (100/40) between the two quantities.<br />
<br />
My next thought was that,
if we keep Celsius for its useful anchor at 0 degrees and multiply the rest by 2.5 to stretch a hot day out to 100° like Fahrenheit,
might we get the best of both scales?
That is, 0° for freezing and 100° for unbearable?<br />
<br /></div>
<div class="section" id="introducing-h">
<h2>
Introducing °H!</h2>
That's it. Suppose we could call it Degrees Human or Humano,
to give it a Latin flair, haha.
It’s basically <code class="docutils literal"><span class="pre">H = Celsius</span> <span class="pre">×</span> <span class="pre">2.5</span></code>, and has the following properties:<br />
<ul class="simple">
<li>Granular enough to ignore decimals most of the time - ✔ <b>Useful</b></li>
<li>0°H - Freezing point of water - ✔ <b>Useful</b></li>
<li>10°H-99°H - Every day temps as percent - ✔ <b>Useful</b></li>
<li>92.5°H - Body temperature<i> ~ Arbitrary</i> (a wash)</li>
<li>100°H+ - Unbearably hot day - ✔ <b>Useful</b></li>
<li>250°H - Boiling point of water ~ <i>Arbitrary</i>, though mostly irrelevant
(but easy to remember at least)</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFdWgV4ebcJWj-psiq01yufJG5apKkZtbqLtrx0cg3OlM9zRYtqkjovwsTGA-vz1WvGM5H_mLkqBWxfYvib2Vij8ImM7vxURnUzmTBMXUk1lYqqyo0eV6_KYrMwhxKaO7MR9mzAI4jNuI/s1600/tempw.svg.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFdWgV4ebcJWj-psiq01yufJG5apKkZtbqLtrx0cg3OlM9zRYtqkjovwsTGA-vz1WvGM5H_mLkqBWxfYvib2Vij8ImM7vxURnUzmTBMXUk1lYqqyo0eV6_KYrMwhxKaO7MR9mzAI4jNuI/s640/tempw.svg.png" width="384" /></a></div>
<br />
<br />
In short, <b>°H</b> is optimized for humans living on Earth!
What do you think?<br />
<br />
(Thermometers above courtesy <a href="https://commons.wikimedia.org/wiki/File:Fahrenheit_Celsius_scales.svg">wikimedia</a>. This idea and post is donated to the public domain. Looking forward to seeing it on the news one day, haha, as unlikely as that may be.)</div>
Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com1tag:blogger.com,1999:blog-3444671539110715411.post-56623887540732392902016-07-11T20:58:00.000-07:002016-07-26T17:51:22.049-07:00Professional Software Development - New Ebook!Whew! Just finished the first part of a new ebook on software engineering that I've been writing in my spare time. It shares its title with this post. I'm feeling relieved but also a bit frustrated at the state of tools and incompatibilities among e-readers. <br />
<a name='more'></a>The book is aimed at Computer Science students, traditional engineers, and self-taught programmers, to give them the understanding and tools necessary to succeed as software engineers. You may be familiar that many of the necessary skills are not taught at university, and often missed by the autodidacts among us. This situation often leads to <a href="http://spectrum.ieee.org/computing/software/why-software-fails" target="_blank">software project disaster</a>, as untrained inmates run the asylum. Sadly most of the common mistakes were discovered and understood by the 1970s (ever heard of the Mythical Man-Month?), but few organizations can be bothered to look up the solutions.<br />
<br />
To that end, <i>Professional Software Development (For students)</i> promises, "everything you’ll need to know to 'hit the ground running.'" I believe it delivers… partially. Unfortunately parts II and III are not yet finished and still in progress. Part I is pretty hefty though, ten long chapters, so I think you'll get your money's worth and be kept busy for a while.<br />
<br />
Did I mention there's a free version? Woot! Yessiree, its hosted over at bitbucket, thank you:<br />
<ul>
<li><a href="http://mixmastamyk.bitbucket.org/pro_soft_dev/">http://mixmastamyk.bitbucket.org/pro_soft_dev/</a></li>
</ul>
The ebook version is
<a href="https://gum.co/psdbook">
available at Gumroad</a>
now! Goodbye and good riddance, Amazon and iTunes stores.<br />
<br />
<!--
<ul>
<li><a href="https://www.amazon.com/dp/B01HQOFF5W/?tag=geekademy--20">amazon.com/dp/B01HQOFF5W</a> (affiliate link)</li>
<li><a href="http://itunes.apple.com/us/book/id1132744420" target="_blank">itunes.apple.com/us/book/id1132744420 </a></li>
</ul>
-->
There are two issues I've not yet solved with the Kindle version however—it is not working with <a href="http://fontawesome.io/" target="_blank">Font Awesome</a>, which I used for a quite a number of items from graphics to icons to bullets. Hope it doesn't interfere with your enjoyment much, since my searching to date has turned up no solutions.<span style="font-family: "courier new" , "courier" , monospace;"><span style="font-family: "courier new" , "courier" , monospace;"> </span>:-/</span> Alternatively, you could click over to amazon with one of <a href="https://www.amazon.com/?tag=geekademy--20">these links</a> and purchase an item, which should sent a tip of a few cents my way, thank you!<br />
<br />
It is amazing the amount of work is necessary to write a book, quite impressive; authors, please give yourselves a collective pat on the back. I now understand why Jeff Atwood (of stack-overflow fame) advises against it <a href="https://blog.codinghorror.com/do-not-buy-this-book/" target="_blank">so strongly</a>. Thankfully I've avoided his hard-copy curse. Also, this book is timeless in general, i.e. not about Classic ASS.net-v3.0™ thankfully, so I'm not as pessimistic as he.<br />
<br />
From the tech-angle I used <a href="http://www.sphinx-doc.org/" target="_blank">Sphinx</a>, the documentation program written in Python, as it is powerful and was familiar to me. While very good at technical documentation, you'll have to dig in deep to get it to work well on different media such as ebooks. For sanity (in markup) I had to write/improve some custom extensions and modify the standard themes quite a bit to get things looking decently.<br />
<br />
Conclusion: definitely not turn-key! It has taken me many months to get to this point, and we're just getting started. I hope you'll find it worth it.<br />
<br />
Btw, despite the mundane title, I've tried to liven up the text and occasional dry part with commentary, comics, music and references, and a bit of sarcasm. Enjoy.<br />
<br />
<b>Update</b>: there's been some quite interesting discussion and suggestions on <a href="https://news.ycombinator.com/item?id=12079573">Hacker News</a> that I'm following up on.<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com6tag:blogger.com,1999:blog-3444671539110715411.post-16540895956886651622015-11-16T18:34:00.002-08:002015-12-22T09:48:31.735-08:00Early Warning Signs You're About to be Laid-OffIf you've been around for a while, the time will eventually come when a company you work for is in unfortunate shape and will need to "downsize." Having witnessed this at a client of mine this week, I've noticed a pattern and a few warning signs you may find useful…<br />
<a name='more'></a><br />
Here are several warning signs you're about to be laid-off. If you've noticed more than perhaps one of these, your <a href="https://en.wikipedia.org/wiki/Spider-Man's_powers_and_equipment#Spider-sense" target="_blank">Spidey-Sense</a> should be tingling—it's time to start polishing that resume/CV!<br />
<h3>
I. Backups</h3>
<i>"Have you backed-up all your work to XYZ?" </i><br />
<br />
Unless you're a sys-admin, this is probably the first time you've ever heard the company mention the word backup during your entire contract. Variations on this theme: <i>"let's get all outstanding code checked-in ASAP!"</i><br />
<br />
Oddly enough, this will tend to make you happy when you hear it. "It's about time they started taking this stuff seriously," you might think.<br />
<h3>
II. Training</h3>
<i>"Please train your co-worker on X, we need everyone up to speed on these components."</i> Hard to argue with that, right? *shrug*<br />
<h3>
IV. Important Project or Person MIA</h3>
Just like the old Christmas movie, <a href="https://en.wikipedia.org/wiki/It%27s_a_Wonderful_Life" target="_blank">It's a Wonderful Life</a>, where the very existence of the main character is erased from history, a similar fate will happen to <span style="font-family: "courier new" , "courier" , monospace;">$BIG_PROJECT</span> or important people. Despite last month's "death-march" to hit an important milestone, no longer is anyone requesting status or asking questions about it. "Hmm, things have become quiet around here," you'll ponder… ((Cue crickets chirping))<br />
<h3>
III. Mandatory Meeting</h3>
<tt>Subject: Moving Forward in $YEAR+1</tt><br />
<br />
Content-free meeting invitations or email focused on date periods, especially late-in the year (a nod to tax purposes). <i>"Let's discuss our plan for 2016."</i> **gulp**<br />
<br />
That's my list for now, please chime in with any others you can think of.Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com5tag:blogger.com,1999:blog-3444671539110715411.post-63564611633837109282013-12-21T20:17:00.002-08:002013-12-27T17:12:46.743-08:00Loading a Video on iOS w/o iTunesHard to believe this was as hard as it was. Just needed to move a video to my iPad for family viewing... should be simple, no? Only problem is that the last computer we have here with iTunes on it died several months back. Zero desire to get Windows or iTunes running again, unfortunately.<br />
<a name='more'></a><br />
Most how-tos I've found on the subject (even stack-exchange) recommend some crappy-looking $3.99 App from a "fly by night" operation. Looked a bit too sketchy/dodgy to me for something that should be built-in, sorry.
<br />
<h3>
Solution: VLC</h3>
After quite a bit of searching, the most elegant solution of course was <a href="https://www.videolan.org/vlc/download-ios.html" target="_blank">VLC</a>, the well-loved <a href="http://en.wikipedia.org/wiki/Free_and_open_source_software">floss</a> media player now with a professional, (if not beautiful) <a href="https://itunes.apple.com/us/app/vlc-for-ios/id650377962" target="_blank">App on iOS</a>.<br />
<br />
VLC has a number of features that are very helpful on an otherwise intentionally crippled Apple product: <br />
<ul>
<li>Streaming. You can stream the video directly from a URL, such as HTTP or FTP, home or cloud if you have enough bandwidth.<br /> </li>
<li>Second, you can download a video over wifi to the device from a URL as well. I tried this on a large 2.6GB file and unfortunately the iPad put itself sleep just as it hit about 90% completion. :/ Grrr, best for smaller files I guess.<br /><br />By the way, I used the python command-line server for this which is fine for smaller videos:<br />
<tt>python -m SimpleHTTPServer</tt></li>
<br />
<li>The third and <i>best</i> option, is to mount the iPad and copy it over to the VLC folder! I don't know how available this route is outside of Linux. Yes, I just plugged the iPad cable into my Ubuntu laptop. It mounts iOS devices as a filesystem, and you'll find a folder under Documents called VLC. That's the one you want! Drop your video in there and it will transfer over at full speed!</li>
</ul>
VLC will then have an icon from the new video right under the files tab. Tap it to start playing.<br />
<h3>
No sound?</h3>
This should have been the end of the post, however I promptly hit the next roadblock. No sound. What? I found the solution in a <a href="https://forum.videolan.org/viewtopic.php?f=12&t=112386#p380789" target="_blank">vlc forum post</a>... but didn't want to believe it. In fact I avoided the solution for another half hour or so. Finally, I gave in. Yes, change your timezone to a city in Canada, it works. <i>((facepalm))</i><br />
<br />
Go into the iPad Settings App, General, Date/Time, and set the timezone city. I chose Vancouver as it corresponds to Pacific time in California. I then exited Settings and double-tapped the home button to go into app kill-mode (for want of a better term) and killed VLC by swiping its window up and off the screen. Run a fresh VLC and it will stop avoiding patent issues and play the damn audio!<br />
<br />
Everything now works, but I have to admit I cried a bit inside before falling asleep last night. <br />
<br />
<ul>
</ul>
Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com1tag:blogger.com,1999:blog-3444671539110715411.post-27082842956680034152013-07-04T11:56:00.002-07:002013-12-21T18:43:18.808-08:00Remembering the Fourth Amendment on this Fourth of JulyOur focus today is on US Government surveillance. What does the Constitution have to say on the subject?
<h3>Amendment IV.</h3>
<blockquote>
<i>
"The right of the people to be secure in their persons, houses, papers,
and effects, against unreasonable searches and seizures, shall not be
violated, and no Warrants shall issue, but upon probable cause,
supported by Oath or affirmation, and particularly describing the place
to be searched, and the persons or things to be seized."
</i></blockquote>
Clearly, the <a href="http://www.guardian.co.uk/world/the-nsa-files" target="_blank">US Government</a> (with world-wide assistance) is <a href="http://www.theguardian.com/world/2013/dec/16/nsa-phone-surveillance-likely-unconstitutional-judge">overstepping its bounds</a> in regards to electronic surveillance.
<br />
<br />
What are your thoughts? Do the ends justify the means? I'd like to ask in advance that you please refrain from complaining about local PD looking for weed. ;)<br />
<br />
You may also enjoy my previous post on a proper <a href="http://www.geekademy.com/2010/07/thoughts-on-independence-day.html" target="_blank">Independence Day</a>.<br/>
<br>Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-43109698523699247752012-11-06T21:07:00.000-08:002013-11-21T11:04:34.084-08:00Enforcing Strong Passwords in Django AdminAfter googling the subject for hours and getting nowhere I decided to turn to the #django channel on freenode. If you'd like to enforce a minimum password strength in the Django Admin app you're in the right place.<br />
<a name='more'></a><br />
Generally, you'll want to follow the <a href="https://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin">steps here</a>. The final missing ingredients are two attributes to the UserAdmin class you won't find in the docs... <tt>.add_form</tt> and <tt>.change_password_form</tt>.<br />
<br />
Thanks to mattmc on irc for pointing me in the right direction. The attributes appear to be undocumented, but are there if you
know exactly where to look. Like Mr. T I've got no more time for jibba-jabba.<br />
<br />
<table class="highlighttable"><tbody>
<tr><td class="linenos"><div class="linenodiv">
<pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre>
</div>
</td><td class="code"><div class="highlight">
<pre><span class="kn">from</span> <span class="nn">django.contrib.auth.admin</span> <span class="kn">import</span> <span class="n">UserAdmin</span>
<span class="kn">from</span> <span class="nn">django.contrib.auth.forms</span> <span class="kn">import</span> <span class="p">(</span><span class="n">UserCreationForm</span><span class="p">,</span>
<span class="n">AdminPasswordChangeForm</span><span class="p">)</span>
<span class="kn">from</span> <span class="nn">django.contrib.auth.models</span> <span class="kn">import</span> <span class="n">User</span>
<span class="kn">from</span> <span class="nn">django.contrib</span> <span class="kn">import</span> <span class="n">admin</span>
<span class="kn">from</span> <span class="nn">django.forms</span> <span class="kn">import</span> <span class="n">ValidationError</span>
<span class="c"># password enforcement:</span>
<span class="k">class</span> <span class="nc">myUserCreationForm</span><span class="p">(</span><span class="n">UserCreationForm</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">clean_password1</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">passwd</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">cleaned_data</span><span class="p">[</span><span class="s">'password1'</span><span class="p">]</span>
<span class="k">if</span> <span class="n">passwd</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">passwd</span><span class="p">)</span> <span class="o"><</span> <span class="mi">6</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span><span class="s">'password too short.'</span><span class="p">)</span>
<span class="k">return</span> <span class="n">passwd</span>
<span class="k">class</span> <span class="nc">myAdminPasswordChangeForm</span><span class="p">(</span><span class="n">AdminPasswordChangeForm</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">clean_password1</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">passwd</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">cleaned_data</span><span class="p">[</span><span class="s">'password1'</span><span class="p">]</span>
<span class="k">if</span> <span class="n">passwd</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">passwd</span><span class="p">)</span> <span class="o"><</span> <span class="mi">6</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span><span class="s">'password too short.'</span><span class="p">)</span>
<span class="k">return</span> <span class="n">passwd</span>
<span class="k">class</span> <span class="nc">myUserAdmin</span><span class="p">(</span><span class="n">UserAdmin</span><span class="p">):</span>
<span class="n">add_form</span> <span class="o">=</span> <span class="n">myUserCreationForm</span>
<span class="n">change_password_form</span> <span class="o">=</span> <span class="n">myAdminPasswordChangeForm</span>
<span class="c"># registration</span>
<span class="n">admin</span><span class="o">.</span><span class="n">site</span><span class="o">.</span><span class="n">unregister</span><span class="p">(</span><span class="n">User</span><span class="p">)</span>
<span class="n">admin</span><span class="o">.</span><span class="n">site</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">User</span><span class="p">,</span> <span class="n">myUserAdmin</span><span class="p">)</span>
</pre>
</div>
</td></tr>
</tbody></table>
<br />
Add this to an admin.py file. This should be enough to get you started. <br /><br />
To answer the question below (comments not working right now?):<br />
1) I was told the name by the guy on IRC. It could probably be found by checking the source as well, if you knew where to look.<br />
2) Override by subclassing the object. Import it and create a class as done above.
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com2tag:blogger.com,1999:blog-3444671539110715411.post-25977341921223444582012-08-15T17:39:00.001-07:002012-08-15T17:47:01.827-07:00"Sticky" blocks in Pure JavascriptI needed a "sticky div" on a website I've been working on. In other words a block that sticks to the top of the window when the page is scrolled down, so that it will remain visible at all times. Unfortunately, all the examples I found required jQuery. Scouring the 'net I found nothing in pure javascript...
<br /><a name='more'></a><br />
It's a shame that something a few lines long needs an external library to accomplish nowadays. Eventually, after digging and digging I did <a href="http://netprogramminghelp.com/javascript/how-to-create-sticky-divtop-positioned-using-javascript/">find this example</a> straight out of the predotcombrian era. Horrible markup and code. The block also snapped back into place only when the window is scrollled all the way to the top. But, you've got to hand it to the guy, it worked.<br />
<br />
So, I updated some of the ancient constructs, refactored a few things, and did a bit of an all-around cleanup. It undoubtedly could be modernized further, but I'm stopping here.<br />
<br />
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85</pre></div></td><td class="code"><div class="highlight"><pre><span class="cp"><!DOCTYPE html></span>
<span class="nt"><html></span>
<span class="nt"><head></span>
<span class="nt"><meta</span> <span class="na">charset=</span><span class="s">"utf-8"</span><span class="nt">></span>
<span class="nt"><title></span>Sticky DIV<span class="nt"></title></span>
<span class="nt"><style </span><span class="na">type=</span><span class="s">"text/css"</span><span class="nt">></span>
<span class="nt">body</span> <span class="p">{</span>
<span class="k">background-color</span><span class="o">:</span> <span class="m">#222</span><span class="p">;</span>
<span class="k">height</span><span class="o">:</span> <span class="m">2000px</span><span class="p">;</span>
<span class="p">}</span>
<span class="nc">.stickydiv</span> <span class="p">{</span>
<span class="k">border</span><span class="o">:</span> <span class="m">2px</span> <span class="k">solid</span> <span class="m">#800</span><span class="p">;</span>
<span class="k">color</span><span class="o">:</span> <span class="m">#aaa</span><span class="p">;</span>
<span class="k">font-family</span><span class="o">:</span> <span class="n">arial</span><span class="p">;</span>
<span class="k">height</span><span class="o">:</span> <span class="m">15em</span><span class="p">;</span>
<span class="k">padding</span><span class="o">:</span> <span class="m">1em</span><span class="p">;</span>
<span class="k">width</span><span class="o">:</span> <span class="m">31ex</span><span class="p">;</span>
<span class="p">}</span>
<span class="nt"></style></span>
<span class="nt"><script></span>
<span class="kd">var</span> <span class="nx">origypos</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="kd">function</span> <span class="nx">byid</span><span class="p">(</span><span class="nx">idname</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="nx">idname</span><span class="p">);</span>
<span class="p">}</span>
<span class="kd">function</span> <span class="nx">get_pos</span><span class="p">(</span><span class="nx">obj</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">pos</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">];</span>
<span class="k">while</span><span class="p">(</span><span class="nx">obj</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">pos</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+=</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">offsetLeft</span><span class="p">;</span>
<span class="nx">pos</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">+=</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">offsetTop</span><span class="p">;</span>
<span class="nx">obj</span> <span class="o">=</span> <span class="nx">obj</span><span class="p">.</span><span class="nx">offsetParent</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">return</span> <span class="nx">pos</span><span class="p">;</span>
<span class="p">}</span>
<span class="kd">function</span> <span class="nx">get_offset</span><span class="p">()</span> <span class="p">{</span>
<span class="c1">// supports for < IE9</span>
<span class="kd">var</span> <span class="nx">top</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">scrollTop</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="nb">window</span><span class="p">.</span><span class="nx">innerHeight</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">top</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">pageYOffset</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="p">(</span>
<span class="nb">document</span><span class="p">.</span><span class="nx">documentElement</span><span class="p">.</span><span class="nx">clientHeight</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">top</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">documentElement</span><span class="p">.</span><span class="nx">scrollTop</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">return</span> <span class="nx">top</span><span class="p">;</span>
<span class="p">}</span>
<span class="nb">window</span><span class="p">.</span><span class="nx">onscroll</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">sticky</span> <span class="o">=</span> <span class="nx">byid</span><span class="p">(</span><span class="s1">'sticky'</span><span class="p">),</span>
<span class="nx">pos</span> <span class="o">=</span> <span class="nx">get_pos</span><span class="p">(</span><span class="nx">sticky</span><span class="p">),</span>
<span class="nx">off</span> <span class="o">=</span> <span class="nx">get_offset</span><span class="p">(),</span>
<span class="nx">ypos</span> <span class="o">=</span> <span class="nx">origypos</span> <span class="o">||</span> <span class="nx">pos</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span> <span class="c1">// > 0</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'pos:'</span><span class="p">,</span> <span class="nx">pos</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="s1">' / off:'</span><span class="p">,</span> <span class="nx">off</span><span class="p">,</span>
<span class="s1">' / oyp:'</span><span class="p">,</span> <span class="nx">origypos</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">off</span> <span class="o">></span> <span class="nx">ypos</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">sticky</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">position</span> <span class="o">=</span> <span class="s1">'fixed'</span><span class="p">;</span>
<span class="nx">sticky</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">top</span> <span class="o">=</span> <span class="s1">'.2em'</span><span class="p">;</span>
<span class="nx">sticky</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">boxShadow</span> <span class="o">=</span>
<span class="s1">'1ex 1ex 2ex rgba(0,0,0,.5)'</span><span class="p">;</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'pop-out!'</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="nx">sticky</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">position</span> <span class="o">=</span> <span class="s1">'static'</span><span class="p">;</span>
<span class="nx">sticky</span><span class="p">.</span><span class="nx">style</span><span class="p">.</span><span class="nx">boxShadow</span> <span class="o">=</span> <span class="s1">'none'</span><span class="p">;</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'in'</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">origypos</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// reset only when zero</span>
<span class="nx">origypos</span> <span class="o">=</span> <span class="nx">pos</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nt"></script></span>
<span class="nt"></head></span>
<span class="nt"><body></span>
<span class="nt"><br></span>
<span class="nt"><br></span>
<span class="nt"><br></span>
<span class="nt"><hr></span>
<span class="nt"><div</span> <span class="na">id=</span><span class="s">"sticky"</span> <span class="na">class=</span><span class="s">"stickydiv"</span> <span class="nt">></span>
I am always on top.
<span class="nt"></div></span>
<span class="nt"></body></span>
<span class="nt"></html></span>
</pre></div>
</td></tr></table>
<br />
Comment out those console.logs when satisfied. If you don't need to support older IE releases you could replace the whole <tt>get_offset()</tt> function with <tt>window.pageYOffset</tt>. <br /><br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com1tag:blogger.com,1999:blog-3444671539110715411.post-55238529226501686572012-06-10T16:48:00.003-07:002012-06-13T22:44:56.315-07:00Well, Actually ...Being a little too smart for their own good, geeks often find themselves correcting others in a pedantic manner. Unfortunately and unwittingly, we build walls between ourselves and others when we focus on unimportant details in this way. Over the years, through trial and error I've learned to avoid this more often than not, but it is something I need to work at and keep mindful about.<br />
<a name='more'></a><br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://imgs.xkcd.com/comics/duty_calls.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="http://imgs.xkcd.com/comics/duty_calls.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Courtesy <a href="http://xkcd.com/386/" target="_blank">xkcd</a></td></tr>
</tbody></table>
<div style="text-align: right;">
</div>
Here is an important <a href="http://tirania.org/blog/archive/2011/Feb-17.html" target="_blank">post on the subject </a>by Miguel de Icaza where he explains elegantly and concisely the problem and how to avoid it. This one hit a little close to home.<br />
<blockquote class="tr_bq">
As we mature as developers, finding logic errors and
incomplete solutions becomes our way of life. It defines us.
<br />
<br />
But our engineering strength is also our social weakness.
Countless times as engineers you will find yourself
interrupting someone telling a story, an anecdote or a joke
to correct a false assumption, provide an extra fact that the
narrator overlooked, give a bigger perspective on the problem
or point out that the joke premise is actually flawed.
</blockquote>
Most misconceptions, or slight errors in communication are simply not important enough to derail conversation. If one makes a habit of interrupting people take notice. As such, I plan to put this it in my yearly reading list and recommend detail-oriented geeks everywhere do too.<br />
<br />
Do you have the "Well, actually ... " problem, and any techniques to avoid it?<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-11020478367235320122011-10-28T17:58:00.000-07:002012-01-16T02:14:32.710-08:00On Startups and Starting Your Own BusinessOther than having a child, little is as difficult and fulfilling as starting your own business. I haven't posted lately because I've been preparing for my first attempt, and there is <i>plenty</i> to do.<br />
<a name='more'></a><br />
As I don't yet have that million-dollar idea, I've been working on getting an "example" web startup off the ground, a prototype if you will. Not a project to make me rich, but one I will have fun building while simultaneously getting my technical chops up to snuff. The idea is to be ready and hit the ground running when the right opportunity presents itself. That includes getting familiar with modern web frameworks, cloud hosting providers, payment processing, etc. More on the project later.<br />
<br />
In this post I'd like to share some of the research I've found on the subject of entrepreneurship over the past year.<br />
<h3>
On Why</h3>
If you've read <a href="http://en.wikipedia.org/wiki/Rich_Dad_Poor_Dad">Rich Dad/Poor Dad</a> by <span class="st">Robert Kiyosaki you'll appreciate the concept of trading job security for potentially greater returns of both money and freedom. In a way the book is a rehash of the old adage, "you'll never get rich working for someone else." While not ground-breaking it resonated with me as I grew up in two households post-divorce. One a household of entrepreneurs, one of employees; his general observations are spot on why some get rich while others don't.</span><br />
<br />
<span class="st">Exploring this theme further, a great resource is the "<a href="http://thisweekin.com/thisweekin-startups/">This Week in Startups</a>" podcast. In episode 40, Jason Calacanis describes his upbringing and the difference between <a href="http://thisweekin.com/thisweekin-startups/twist-40-bonus-interview-with-penn-state/">Samurai and rice-pickers</a>. Which do you want to be?</span><span class="st"> It gets going about 2 mins 30 seconds.</span><br />
<br />
<span class="st"><span style="font-size: x-small;">As a side note, if pressed for time consider watching the videos below <a href="http://2011/10/doubling-your-podcast-efficiency.html">at higher speed</a>. While all compelling, they are lengthy.</span></span><br />
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/eteKxftz_Y4" width="560"></iframe><br />
<br />
I highly recommend the first 40 or so episodes of the podcast, they are just jam packed full of great info on starting a business and courting Venture Capital, if that be your strategy. If not that's great too, I offer <a href="http://thisweekin.com/thisweekin-startups/twist-46-with-david-heinemeier-hansson-2/">episode 46 with DHH</a> as counter point on why you should bootstrap (shun large investment and build from a shoestring) instead.
<br />
<br />
<h3>
On What to Work On</h3>
In the entrepreneurial world, it doesn't get more inspiring than the late Steve Jobs and his dedication to quality via "insanely great" products. If you're looking <a href="http://en.wiktionary.org/wiki/swing_for_the_fences">to swing for the fences</a>, Guy Kawasaki explains Steve's approach from what to work on to how to present it. Gets going about 3:35.<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="360" src="http://www.youtube.com/embed/DR_wX0EwOMM" width="480"></iframe>
<br />
<br />
Twelve Lessons:<br />
<blockquote>
1. Experts are clueless<br />
2. Customers cannot tell you what they need<br />
3. Biggest challenges beget the best work<br />
4. Design counts<br />
5. Big graphics, big fonts<br />
6. Jump curves, not better sameness<br />
7. "Work" or "doesn't work" is all that matters<br />
8. "Value" is different than "price"<br />
9. A players hire A players<br />
10. Real CEOs demo<br />
11. Real entrepreneurs ship<br />
12. Some things need to be believed to be seen.</blockquote>
<br />
<h3>
On How</h3>
I'm currently digging into the <a href="http://www.startuplessonslearned.com/2008/09/lean-startup.html">lean startup movement</a> by Eric Ries. Here's a talk of his, outlining the concept at the "Buisiness of Software Conference."<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="432" src="http://blip.tv/play/AYLM1wMC.html?p=1" width="550"></iframe><embed src="http://a.blip.tv/api.swf#AYLM1wMC" style="display: none;" type="application/x-shockwave-flash"></embed>
<br />
<br />
TL;DR - In short, get customer feedback right away. Reminds me a lot of the advice from one of Robert's mentors in Rich Dad/Poor Dad. When asked why his business wasn't successful and how to improve it the mentor replied with "you aren't failing fast enough." ... Huh?<br />
<h3>
<i>You aren't failing fast enough.</i></h3>
In other words, the faster you can learn and iterate around failure the faster (and more likely) you'll find a path to success.<br />
<br />
My notes from the talk:<br />
<ul>
<li>
Stop wasting people's time
</li>
<li>
Most startups fail
</li>
<li>
startup == experiment
<ul>
<li>Not just can it be built, but SHOULD it be built?
</li>
<li>Need process geared to extreme uncertainty
</li>
<li>Pivot as you learn
</li>
<li>Speed wins
<ul>
<li>Reduce time between pivots
</li>
<li>increase odds of success
<ul>
<li>before running out of money
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Making Progress
<ul>
<li>Unit: <b>validated learning</b> against real customers
</li>
<li>Engineers trained to achieve goals at lowest cost
<ul>
<li>What if it is a goal no one wants? This strategy is
backwards.
</li>
</ul>
</li>
<li>To turn ideas into code, instead minimize TOTAL time through
the loop:
<ul>
<li>ideas → BUILD → code → MEASURE → data → LEARN →
ideas
</li>
<li>Build
<ul>
<li>Continuous deployment
</li>
<li>Minimum Viable Product (MVP)
</li>
</ul>
</li>
<li>Measure
<ul>
<li>metrics, split testing
</li>
</ul>
</li>
<li>Learn
<ul>
<li>Ask the five why's
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<br />
<h3>
On How, Part II</h3>
Coming back down to the level of us mere mortals, how can we find a niche in this crowded economy? Here's how to take a routine business and make it fun and compelling by focusing on customer delight. Here is <i>How to design web apps users love</i> by Kevin Hale of Wufoo.<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/L_jippEyLyk" width="560"></iframe>
<br />
<br />
<h3>
On the Nuts and Bolts</h3>
If you're a python fan like me, and even if you're not, you'll likely enjoy this talk from <a href="http://djangocon.us/">DjangoCon</a>. Find out how easy it is to get started these days w/o having to know or do everything yourself. There is an incredible amount of help from frameworks like Django, managed cloud platforms, and online communities and resources. Believe it or not you can learn as you go! Just ask Tracy of weddinginvitelove.com.<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="396" src="http://blip.tv/play/AYLUi0sC.html" width="550"></iframe>
<br />
<br />
<h3>
Finally, to Finance or Not To?</h3>
While the idea of bootstrapping a company to success makes sense for most, bringing on investors is the best strategy to take when creating a new market or building a capital intensive business. In future articles I'll explore the subject more deeply.<br />
<br />
Perhaps you are a startup founder or employee that needs to understand equity grants? Via Hacker News I came across this accessible guide that explains in clear language what you'll need to know about stock and options.<br />
<br />
<i>An Introduction to Stock & Options for the Tech Entrepreneur or Startup Employee,</i> by David Weekly<br />
<ul>
<li><a href="http://ospflor63.stanford.edu/upload/An-Introduction-to-Stock-Options-for-the-Tech-Entrepreneur-or-Startup-Employee.pdf">Stanford copy</a></li>
<li><a href="http://www.scribd.com/vacuum?url=http://ospflor63.stanford.edu/upload/An-Introduction-to-Stock-Options-for-the-Tech-Entrepreneur-or-Startup-Employee.pdf">Scribd viewer</a> (no extra reader needed)</li>
<li><a href="http://news.ycombinator.com/item?id=3252290">HN Discussion</a> </li>
</ul>
<br />
What are you favorite books, blog posts, and talks on the subject?<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-33824686030141888572011-10-28T14:44:00.000-07:002012-01-19T10:08:28.428-08:00Doubling Your Podcast EfficiencySelf improvement is so easy these days. Geeks already know podcasts can assist learning and keep your mind sharp when working out, walking to work, or even cleaning the house. However, the number of quality podcasts and online talks is only increasing which means it's important to stay efficient. In this post I'll explain how.<br />
<a name='more'></a>As mentioned above, auditory learning can be a great supplement to other techniques; it hits different parts of the brain and can therefore aid in more complete understanding. Another benefit is you can build expertise or be entertained while utilising otherwise available time.<br />
<h3>
2x, Baby </h3>
While I have been using <a href="http://www.videolan.org/vlc/">VLC</a> for years and occasionally watching DVD's at 1.2x to add a little pep to plodding or too-long movies (why are they all so looong these days?), it wasn't until Apple added the 2x feature to its iOS iPod app that I became hooked.<br />
<br />
As we can listen a lot faster than we can speak, this increase really cuts down on the BS and time required to crank through a show. Umms, hmms..., uhhhs, and advertisements are zipped right through.<br />
<br />
I've found 95% of the time I can keep up just fine, and can drop back or repeat with the @30s button if needed during a meaty discussion.<br />
<br />
Tips:<br />
<ul>
<li><b>Mobile</b>: Hit the 1x button (top-right) on the iOS Music Player until it turns into a blue 2x. Similar features are available on other products.</li>
<li><b>Desktop</b>: Use <a href="http://www.videolan.org/vlc/">VLC</a> or a media player which makes it easy to speed things up. The [ and ] hotkeys are at your disposal and can be varied during playback.</li>
<li><b>Web</b>: Use a video downloader:</li>
<ul>
<li><a href="http://rg3.github.com/youtube-dl/">youtube-dl</a> is a command line downloader with support for more sites than just youtube. It's also in the debian/ubuntu repos under the same name, though it might be out of date. If so, grab the github version.</li>
<li>A site or product like the "<a href="http://keepvid.com/">Keep Vid</a>" <a href="http://en.wikipedia.org/wiki/Bookmarklet">bookmarklet</a> to get direct links to Youtube videos and the like, (right click the banner and choose Bookmark). There are many alternatives here and they change frequently. </li>
<li>Download videos your hard disk and watch them at 1.5x or more with VLC. Don't worry, it can start playing the incomplete/temp file right away.</li>
</ul>
</ul>
Another side-effect is you'll notice is everyone sounds more intelligent at high speed. ;)<br />
<br />
What are your tips to improve the information signal to noise ratio?<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-41710898803264421792011-08-01T13:15:00.000-07:002011-11-25T18:21:40.040-08:00Export Notes from Ipod Touch or Iphone / IpadHere's how I exported the notes from the Notes app on my Ipod Touch. Unfortunately this time you'll have to be a pro to follow along.<br />
<a name='more'></a><br />
First, I needed to find the file where the information is stored. The notes are kept in a single sqlite3 database file.<br />
<br />
While my Linux box can mount the ipod as a filesystem, it seemed to be mounted to a subfolder on the ipod where I couldn't get access to other folders above. After googling for a half hour for a solution I gave up and plugged it into my Windows box instead.<br />
<br />
In iTunes I made a backup of the ipod, right-clicking it in the list on the left and selecting "backup" from the context menu. You'll probably want to disable encryption if you are using it. Next I found the backup files here with Explorer:<br />
<pre>C:\Documents and Settings\USERNAME
...\Application Data\Apple Computer\MobileSync\Backup</pre>You will find several folders here, choose the one with the latest Date Modified set to a few minutes ago. Inside there will be hundreds of .mdddata files inside. There are a few ways to figure out which file is the one we are looking for. At first I poked around with the find command:<br />
<pre>find "SQLite format 3" *.mddata</pre>This was helpful, but then I realized I had entered a few notes recently. So I sorted the files in Explorer, again by Date Modified. I looked at the most recent files with <a href="http://notepad-plus-plus.org/">Notepad++</a> (which will open them without issue, even though they have many nonprinting characters inside.)<br />
<br />
On the third file, I found the "SQLite format 3" header, and after scrolling down the text of my Notes. Now we're getting somewhere. I copied off the file and renamed it to notes.db.<br />
<br />
Here is a <a href="http://codepad.org/6qJn9WZc">python script I found</a> online purporting to export the data, but it didn't work. Maybe it is for a different version? This is a first generation ipod touch with iOS v3.x on it.<br />
<br />
I then decided to copy the file back to the Linux box and investigate it there, as it is so easy to get sqlite installed. Installing sqlite and running the script could probably be done on Windows without too much trouble. To install:<br />
<pre>sudo apt-get install sqlite3
sudo apt-get install python-pysqlite2</pre>After investigating the db file in sqlite I was able to fix and improve the script and have included it below. Save it as export_notes.py and give it your notes.db file as an argument.<br />
<br />
<table class="highlighttable"><tbody>
<tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39</pre></div></td><td class="code"><div class="highlight"><pre><span class="s">'''</span>
<span class="s"> Extract notes from an iphone or ipod touch.</span>
<span class="s">'''</span>
<span class="kn">import</span> <span class="nn">sys</span><span class="o">,</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">sqlite3</span>
<span class="n">invalid_chars</span> <span class="o">=</span> <span class="s">r'<>:"/\|?*'</span>
<span class="n">html</span> <span class="o">=</span> <span class="s">u'''<html><head></span>
<span class="s"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></span>
<span class="s"></head></span>
<span class="s"><body></span>
<span class="si">%s</span><span class="s"></span>
<span class="s"></body></html></span>
<span class="s">'''</span>
<span class="n">outdir</span> <span class="o">=</span> <span class="s">'out'</span>
<span class="k">def</span> <span class="nf">valid_fname</span><span class="p">(</span><span class="n">fname</span><span class="p">):</span>
<span class="k">return</span> <span class="s">''</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">c</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">fname</span> <span class="k">if</span> <span class="n">c</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">invalid_chars</span><span class="p">)</span>
<span class="c"># make dir</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">outdir</span><span class="p">):</span>
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">outdir</span><span class="p">)</span>
<span class="n">c</span> <span class="o">=</span> <span class="n">sqlite3</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span>
<span class="k">else</span> <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s">'Filename param required.'</span><span class="p">)</span> <span class="p">)</span>
<span class="n">titles</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s">'select rowid, title from Note order by rowid;'</span><span class="p">))</span>
<span class="n">bodies</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">c</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s">'select note_id, data from note_bodies order by rowid;'</span><span class="p">))</span>
<span class="k">for</span> <span class="n">note_id</span><span class="p">,</span> <span class="n">data</span> <span class="ow">in</span> <span class="n">bodies</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="n">title</span> <span class="o">=</span> <span class="n">titles</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">note_id</span><span class="p">,</span> <span class="s">'id_</span><span class="si">%s</span><span class="s">'</span> <span class="o">%</span> <span class="n">note_id</span><span class="p">)</span>
<span class="k">print</span> <span class="s">'exporting:'</span><span class="p">,</span> <span class="n">title</span>
<span class="n">fname</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">outdir</span><span class="p">,</span> <span class="n">valid_fname</span><span class="p">(</span><span class="s">'</span><span class="si">%s</span><span class="s">.html'</span> <span class="o">%</span> <span class="n">title</span><span class="p">))</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">fname</span><span class="p">,</span> <span class="s">'wb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">outf</span><span class="p">:</span>
<span class="n">outf</span><span class="o">.</span><span class="n">write</span><span class="p">(</span> <span class="p">(</span><span class="n">html</span> <span class="o">%</span> <span class="n">data</span><span class="p">)</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span> <span class="p">)</span>
<span class="n">c</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div></td></tr>
</tbody></table><br />
Upon execution, it will create an out folder, which will contain an html file for each note. I never used formatting in any of my notes (not even sure how) but unfortunately they are stored as html. I would prefer plain text, but not going to bother to write a scraper. Hope this helps someone out there.<br />
<br>Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com5tag:blogger.com,1999:blog-3444671539110715411.post-50331272391444736582011-07-22T11:39:00.000-07:002011-07-22T11:39:12.528-07:00History of ComputingToday I'm watching this interesting talk on the history of computing by Douglas Crockford.<br />
<a name='more'></a><br />
<br />
<div>
<iframe frameborder="0" height="324" src="http://d.yimg.com/nl/ydn/default/player.html#vid=17957562" width="576"></iframe></div>
<br />
It's amazing to think about how people once had the patience to write a program on punched cards and waited hours to find out "a comma was missing." I had a taste of this myself <a href="http://www.geekademy.com/2010/01/authors.html#more">as a kid</a> when retrieving programs off cassette tapes, but looks like I had it easy. ;)<br />
<br />
If you found this video interesting there are additional chapters that <a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-1">discuss javascript</a>.<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-51632489741539662312011-05-03T10:04:00.000-07:002011-05-03T10:11:40.257-07:00Understanding Free Software LicensesIf you're like me software licenses bore you to tears. No really, I can barely get to the second paragraph before my eyes glaze over and start to droop. As such, a reasonable business idea might be to gather them all together into a book and market them as a cure for insomnia. ;)<br />
<a name='more'></a><br />
Thankfully, I recently ran across this <a href="http://pbagwl.com/post/5078147450/description-of-popular-software-licenses">infographic by Paul Bagwell</a> that helps sort out the differences between the most popular free(dom) software licenses:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://pbagwl.com/post/5078147450/description-of-popular-software-licenses" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="307" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPjwoeahH1_R0bT5FL0A955aKu9KNsdcXzpIr1uHPnCO_RrJs162uxyFwCc41D_oxaleS7mIfzuTZ96wypjTv2I7a9JDC_dUOYDK1hqXBNwtxmS_eCTFa0yVX0fJiPuNmvy4xn0GCc9hk/s400/software_lic.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://s3.amazonaws.com/data.tumblr.com/tumblr_lkhe2jxnXS1qguzn1o1_r7_1280.png?AWSAccessKeyId=AKIAJ6IHWSU3BX3X7X3Q&Expires=1304527622&Signature=xgnGwxqpONuQ6AHGTP2fO3bBOgk%3D" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
A copy can be found <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPjwoeahH1_R0bT5FL0A955aKu9KNsdcXzpIr1uHPnCO_RrJs162uxyFwCc41D_oxaleS7mIfzuTZ96wypjTv2I7a9JDC_dUOYDK1hqXBNwtxmS_eCTFa0yVX0fJiPuNmvy4xn0GCc9hk/">here</a>, in case the original is lost.
<br><br>
Most importantly, the graphic does not cause drowsiness, at least in this subject. Read on to the <a href="http://news.ycombinator.com/item?id=2501536">discussion at Hacker News</a> if you'd like to read a few suggestions on how to improve it.<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-71827920755204326872011-03-07T23:15:00.000-08:002011-05-14T23:19:30.708-07:00MonoPriceI know this is old news, but I was surprised to encounter a young guy today who didn't know about monoprice. One of the important things we geeks have learned over the years is to never buy computer or AV cables from a "Big Box Retailer." As anyone stuck buying a $20 ethernet cable at BestBuy or Radio Shack in an emergency knows ... it's an eff'ing rip-off.<br />
<a name='more'></a><br />
A salesman acquaintance of mine explained to me that the huge markup is the only way an one of these outfits can squeeze out a bit of profit. They sell the big TVs at cost+change to get you in the door, then score 80%+ profit on cables and accessories (worth a buck twenty-five) to connect them. Alright, so I understand why they do it. Unfortunately, while I don't buy many TVs, I do buy cables somewhat frequently. It's not my responsibility to prop up their fragile business model.<br />
<br />
So, if you haven't heard yet, please allow me to introduce you to <a href="http://monoprice.com/">monoprice.com</a>. This probably sounds like a sales pitch, but I've really got nothing to do with them except being a satisfied customer.<br />
<br />
Examples:<br />
<ul>
<li>Display Port to DVI adapter - <a href="http://accessories.us.dell.com/sna/products/Cables_Hubs_Adapters/productdetail.aspx?c=us&l=en&cs=19&sku=330-2915">Dell </a>($23.99) - <a href="http://www.monoprice.com/products/product.asp?c_id=102&cp_id=10246&cs_id=1024608&p_id=6014&seq=1&format=2">Monoprice</a> ($7).</li>
<li><a href="http://www.monoprice.com/products/product.asp?c_id=108&cp_id=10831&cs_id=1083111&p_id=7104&seq=1&format=2">iPhone Case</a> ... 83 cents!!! <br />Apple sells this shitake for $39.</li>
<li>Cable <a href="http://www.monoprice.com/products/department.asp?c_id=102">Heaven</a>, Video Gamer <a href="http://www.monoprice.com/products/subdepartment.asp?c_id=108&cp_id=10830">Heaven</a></li>
<li>10 <a href="http://www.monoprice.com/products/product.asp?c_id=102&cp_id=10208&cs_id=1020804&p_id=2132&seq=1&format=2">Ethernet Cables</a> ... $6.50!!</li>
<li><a href="http://www.monoprice.com/products/subdepartment.asp?c_id=102&cp_id=10240">HDMI Cables</a>, starting at under two f'ing dollars. :D </li>
<li>More, more, more.</li>
</ul>
Disclaimer: monoprice had a <a href="http://www.databreaches.net/?p=11216">security breach</a> a year or so ago, which I take seriously. However, I believe they have learned their lesson.<br />
<br />
If you're not in North America, look for similar outfits in your area.<br />
<h3>
Upgrade your laptop at Kahlon.com</h3>
Another place I've found that was very helpful was <a href="http://kahlon.com/">Kahlon.com</a>. While perhaps not 90% off like monoprice, it has great deals on hard to find parts. For example, a while ago I needed to replace the power supply and battery on a trusty ol' aging laptop. Sony of course wanted $100 each, but <a href="http://kahlon.com/rm610214_Sony_VAIO_PCG-TR2A.html">at Kahlon</a> the <b>total</b> was only $69.95 (before tax).<br />
<br />
<h3>
Further Reading:</h3>
<ul>
<li><a href="http://www.pcmag.com/article2/0,2817,2385272,00.asp">Slaying the Cable Monster: Why HDMI Brands Don't Matter</a><br />
<i>The second thing to know about HDMI cables is that they are almost
always expensive when you buy them at brick-and-mortar stores. If you
walk into a Best Buy or Radio Shack, you can expect to pay at least $40
for a 6-foot HDMI cable. Even at discount stores like Wal-Mart and
Target, the cheapest, most generic HDMI cables retail for $15 and more.
Online, you'll do a lot better on prices. Amazon.com and Monoprice.com
(the "ancient custom installer's secret") slash even Wal-Mart's HDMI
cable prices into tiny bits. Both sites sell several models of HDMI
cables for as little as $1.50. </i><br />
</li>
</ul>
<br />Go forth and save money, young geek!<br />
<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com3tag:blogger.com,1999:blog-3444671539110715411.post-9284650441193027362011-01-17T17:34:00.000-08:002011-03-07T23:20:31.763-08:00Aiming HigherOn this day off of work and school in America, let's take a moment to gain a bit of insight on freedom and its history. If you've never heard this speech on the subject by <a href="http://en.wikipedia.org/wiki/Martin_Luther_King,_Jr">Martin Luther King, Jr</a>., you've come to the right place as it is one of the best ever given.<br />
<br />
Conversely, if you've been bored to tears from <a href="http://www.ted.com/talks/ken_robinson_says_schools_kill_creativity.html">its treatment at school</a>, this is a great opportunity to forget all that and listen. Just listen to what this particular group of people, who had traveled from far and wide despite hardship, came to say from their hearts. On this hot summer day, they stood up for dignity and respect, their thoughts and emotions channeled through the speaker.
<br />
<a name='more'></a><br />
I've included the transcript below so one can read along.<br />
<br />
<object width="480" height="385"><param name="movie" value="http://www.youtube-nocookie.com/v/PbUtL_0vAJk?fs=1&hl=en_US&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/PbUtL_0vAJk?fs=1&hl=en_US&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object><br />
<br /><br />
<h2>I Have A Dream</h2>
Martin Luther King, Jr.<br/><br/>
<div style="font-family: Georgia,"Times New Roman",serif; font-size: 110%;">
I am happy to join with you today in what will go down in history as the greatest demonstration for freedom in the history of our nation.
<br/><br/>
Five score years ago, a great American, in whose symbolic shadow we stand today, signed the Emancipation Proclamation. This momentous decree came as a great beacon light of hope to millions of Negro slaves who had been seared in the flames of withering injustice. It came as a joyous daybreak to end the long night of their captivity.
<br/><br/>
But one hundred years later, the Negro still is not free. One hundred years later, the life of the Negro is still sadly crippled by the manacles of segregation and the chains of discrimination. One hundred years later, the Negro lives on a lonely island of poverty in the midst of a vast ocean of material prosperity. One hundred years later, the Negro is still languished in the corners of American society and finds himself an exile in his own land. And so we've come here today to dramatize a shameful condition.
<br/><br/>
In a sense we've come to our nation's capital to cash a check. When the architects of our republic wrote the magnificent words of the Constitution and the Declaration of Independence, they were signing a promissory note to which every American was to fall heir. This note was a promise that all men, yes, black men as well as white men, would be guaranteed the "unalienable Rights" of "Life, Liberty and the pursuit of Happiness." It is obvious today that America has defaulted on this promissory note, insofar as her citizens of color are concerned. Instead of honoring this sacred obligation, America has given the Negro people a bad check, a check which has come back marked "insufficient funds."
<br/><br/>
But we refuse to believe that the bank of justice is bankrupt. We refuse to believe that there are insufficient funds in the great vaults of opportunity of this nation. And so, we've come to cash this check, a check that will give us upon demand the riches of freedom and the security of justice.
<br/><br/>
We have also come to this hallowed spot to remind America of the fierce urgency of Now. This is no time to engage in the luxury of cooling off or to take the tranquilizing drug of gradualism. Now is the time to make real the promises of democracy. Now is the time to rise from the dark and desolate valley of segregation to the sunlit path of racial justice. Now is the time to lift our nation from the quicksands of racial injustice to the solid rock of brotherhood. Now is the time to make justice a reality for all of God's children.
<br/><br/>
It would be fatal for the nation to overlook the urgency of the moment. This sweltering summer of the Negro's legitimate discontent will not pass until there is an invigorating autumn of freedom and equality. Nineteen sixty-three is not an end, but a beginning. And those who hope that the Negro needed to blow off steam and will now be content will have a rude awakening if the nation returns to business as usual. And there will be neither rest nor tranquility in America until the Negro is granted his citizenship rights. The whirlwinds of revolt will continue to shake the foundations of our nation until the bright day of justice emerges.
<br/><br/>
But there is something that I must say to my people, who stand on the warm threshold which leads into the palace of justice: In the process of gaining our rightful place, we must not be guilty of wrongful deeds. Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred. We must forever conduct our struggle on the high plane of dignity and discipline. We must not allow our creative protest to degenerate into physical violence. Again and again, we must rise to the majestic heights of meeting physical force with soul force.
<br/><br/>
The marvelous new militancy which has engulfed the Negro community must not lead us to a distrust of all white people, for many of our white brothers, as evidenced by their presence here today, have come to realize that their destiny is tied up with our destiny. And they have come to realize that their freedom is inextricably bound to our freedom.
<br/><br/>
We cannot walk alone.
<br/><br/>
And as we walk, we must make the pledge that we shall always march ahead.
<br/><br/>
We cannot turn back.
<br/><br/>
There are those who are asking the devotees of civil rights, "When will you be satisfied?" We can never be satisfied as long as the Negro is the victim of the unspeakable horrors of police brutality. We can never be satisfied as long as our bodies, heavy with the fatigue of travel, cannot gain lodging in the motels of the highways and the hotels of the cities. We cannot be satisfied as long as the negro's basic mobility is from a smaller ghetto to a larger one. We can never be satisfied as long as our children are stripped of their self-hood and robbed of their dignity by signs stating: "For Whites Only." We cannot be satisfied as long as a Negro in Mississippi cannot vote and a Negro in New York believes he has nothing for which to vote. No, no, we are not satisfied, and we will not be satisfied until "justice rolls down like waters, and righteousness like a mighty stream."
<br/><br/>
I am not unmindful that some of you have come here out of great trials and tribulations. Some of you have come fresh from narrow jail cells. And some of you have come from areas where your quest -- quest for freedom left you battered by the storms of persecution and staggered by the winds of police brutality. You have been the veterans of creative suffering. Continue to work with the faith that unearned suffering is redemptive. Go back to Mississippi, go back to Alabama, go back to South Carolina, go back to Georgia, go back to Louisiana, go back to the slums and ghettos of our northern cities, knowing that somehow this situation can and will be changed.
<br/><br/>
Let us not wallow in the valley of despair, I say to you today, my friends.
<br/><br/>
And so even though we face the difficulties of today and tomorrow, I still have a dream. It is a dream deeply rooted in the American dream.
<br/><br/>
I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident, that all men are created equal."
<br/><br/>
I have a dream that one day on the red hills of Georgia, the sons of former slaves and the sons of former slave owners will be able to sit down together at the table of brotherhood.
<br/><br/>
I have a dream that one day even the state of Mississippi, a state sweltering with the heat of injustice, sweltering with the heat of oppression, will be transformed into an oasis of freedom and justice.
<br/><br/>
I have a dream that my four little children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character.
<br/><br/>
I have a dream today!
<br/><br/>
I have a dream that one day, down in Alabama, with its vicious racists, with its governor having his lips dripping with the words of "interposition" and "nullification" -- one day right there in Alabama little black boys and black girls will be able to join hands with little white boys and white girls as sisters and brothers.
<br/><br/>
I have a dream today!
<br/><br/>
I have a dream that one day every valley shall be exalted, and every hill and mountain shall be made low, the rough places will be made plain, and the crooked places will be made straight; "and the glory of the Lord shall be revealed and all flesh shall see it together."2
<br/><br/>
This is our hope, and this is the faith that I go back to the South with.
<br/><br/>
With this faith, we will be able to hew out of the mountain of despair a stone of hope. With this faith, we will be able to transform the jangling discords of our nation into a beautiful symphony of brotherhood. With this faith, we will be able to work together, to pray together, to struggle together, to go to jail together, to stand up for freedom together, knowing that we will be free one day.
<br/><br/>
And this will be the day -- this will be the day when all of God's children will be able to sing with new meaning:
<br/>
<blockquote>
My country 'tis of thee, sweet land of liberty, of thee I sing.
<br/>
Land where my fathers died, land of the Pilgrim's pride,
<br/>
From every mountainside, let freedom ring!
<br/>
And if America is to be a great nation, this must become true.
<br/>
And so let freedom ring from the prodigious hilltops of New Hampshire.
<br/>
Let freedom ring from the mighty mountains of New York.
<br/>
Let freedom ring from the heightening Alleghenies of Pennsylvania.
<br/>
Let freedom ring from the snow-capped Rockies of Colorado.
<br/>
Let freedom ring from the curvaceous slopes of California.
<br/>
But not only that:
<br/>
Let freedom ring from Stone Mountain of Georgia.
<br/>
Let freedom ring from Lookout Mountain of Tennessee.
<br/>
Let freedom ring from every hill and molehill of Mississippi.
<br/>
From every mountainside, let freedom ring.
<br/>
</blockquote>
And when this happens, when we allow freedom ring, when we let it ring from every village and every hamlet, from every state and every city, we will be able to speed up that day when all of God's children, black men and white men, Jews and Gentiles, Protestants and Catholics, will be able to join hands and sing in the words of the old Negro spiritual:
<br/><br/>
Free at last! Free at last!
<br/><br/>
Thank God Almighty, we are free at last!
<br /><br/>
</div>Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-1177992434460665672011-01-03T18:45:00.000-08:002011-01-04T19:07:13.343-08:00Handling Unicode in a NutshellAs a "global citizen in a worldwide economy," (groan) it can only make sense to properly handle multiple languages in the software you develop. That is, unless you'd prefer to ignore what might be the majority of potential users and/or profits. Accordingly, for many years I've done my best to accommodate that goal in the programs I write or contribute to. <br />
<a name='more'></a><h3>
Understanding Unicode</h3>
Over the years I've studied up on Unicode and read the important pieces on the subject with enthusiasm as they came up. For example:<br />
<ul>
<li><a href="http://en.wikipedia.org/wiki/Unicode">Unicode</a> pages at Wikipedia</li>
<li>Tim Bray's: <a href="http://www.tbray.org/ongoing/When/200x/2003/04/06/Unicode">On the Goodness of Unicode</a> and <a href="http://www.tbray.org/ongoing/When/200x/2003/04/26/UTF">Characters vs. Bytes</a></li>
<li>Joel's: <a href="http://www.joelonsoftware.com/articles/Unicode.html">The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode ...</a></li>
<li>Dive into Python's <a href="http://diveintopython.org/xml_processing/unicode.html">Unicode</a> Chapter</li>
</ul>
Ok great, sold. So now we know a lot about Unicode. All good reading of course, but what now? How do I correctly write a Unicode-aware program? No clue ... as usual references bury you in mind-numbing detail, and articles and essays never seem to get that far, assuming you'd continue on in the language of your choice. Metaphorically, we have been provided steps one through ten, but seven through nine have been (in)conveniently left out and left to the reader to figure out.<br />
<h3>
Handling Unicode Errors in Python 2.x</h3>
Best to look at the language specific docs in that case, right? As a budding pythonista, I headed here: <br />
<ul>
<li><a href="http://docs.python.org/howto/unicode.html#python-2-x-s-unicode-support">Python 2.x’s Unicode Support</a></li>
</ul>
Ok, it's getting clearer. Around this time I start putting Chinese or Russian UTF-8 into test cases and am able to work around and patch the ensuing exceptions. I guess we'll call these steps seven and eight. ;)<br />
<br />
So far so good, although true understanding of what <i>should</i> be done was still muddy. While there were plenty of nuts and bolts to handle issues as they arose, there wasn't yet a mental framework available to latch onto about how it all works, <i>why</i> I am trapping these exceptions, nor how to avoid them in the first place. Perhaps I'm a dufus (although surely not the only one), but it wasn't until a few years later when answers started permeating my thick skull, (through osmosis I'd gather).<br />
<br />
Coincidentally, about the time these ideas were solidifying through rote repetition, I read this fantastic yet short presentation, whereby I had the proverbial "aha" moment. The problem and solution are described more elegantly than I could below.<br />
<ul>
<li><a href="http://farmdev.com/talks/unicode/">Unicode In Python, Completely Demystified</a>,<br/> courtesy Kumar McMillan</li>
</ul>
If you haven't had that moment yet, I'd like to condense the piece above further into the following nutshell for my own benefit as well as any others in need.<br />
<br />
<h3>The Missing Link</h3>
<div class="separator" style="float: right;">
<img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrkHJmdXNxZsRs10CXyB_-F-PU-6YXiuPdfbeP3MobxC8F5vb6OQI4RCuV816FZI-uNSyH11OFYoka9umHqFbtI0dH7o5CmCrSqLMRyF6jls_UUP8wPCzHJuycZqXHpm1RbjoqpWX9e3k/s1600/link.jpg" /></div>
How do I write a Unicode program properly in Python 2.x? The answer:<br />
<ol>
<li><b>Decode</b> early</li>
<li><b>Unicode</b> everywhere</li>
<li><b>Encode</b> late</li>
</ol>
By early, he means "at first encounter," late meaning, "just before output." <br />
<br />
To expand on this a bit, Unicode in Python is not text, but rather a text-like object in memory. Codecs like "UTF-8" and "latin-1" allow a Unicode object to be encoded for transport, for example to disk files or across the network. To work with them correctly, we simply decode them to Unicode on input, manipulate them (in their "natural" state), and encode them on output! Simple to understand and code.<br />
<br />
Below is a minimal example:<br />
<table class="highlighttable"><tbody>
<tr><td class="linenos"><div class="linenodiv">
<pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18</pre>
</div>
</td><td class="code"><div class="highlight">
<pre><span class="c"># read in data from files, network, user, etc.</span>
<span class="n">infile</span> <span class="o">=</span> <span class="nb">file</span><span class="p">(</span><span class="s">'input.txt'</span><span class="p">,</span> <span class="s">'r'</span><span class="p">)</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">infile</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
<span class="n">infile</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="c"># decode immediately to Unicode</span>
<span class="n">unicode_text</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="c"># manipulate in memory, add smiley</span>
<span class="n">unicode_text</span> <span class="o">=</span> <span class="n">unicode_text</span> <span class="o">+</span> <span class="s">u'Hello World! \u263B\n'</span>
<span class="c"># re-encode before transport or storage</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">unicode_text</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'utf-8'</span><span class="p">)</span>
<span class="c"># save it</span>
<span class="n">outfile</span> <span class="o">=</span> <span class="nb">file</span><span class="p">(</span><span class="s">'ouput.txt'</span><span class="p">,</span> <span class="s">'w'</span><span class="p">)</span>
<span class="n">outfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">outfile</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre>
</div>
</td></tr>
</tbody></table>
Of course Python 3 will make this easier more of the time as it uses Unicode strings and sets the system encoding to UTF-8 by default. I'm still using Python 2.x for work projects however, and the nutshell above is still valid under non-default cases.<br />
<br />
With this newfound understanding, I found the very good "nuts and bolts" page below more helpful than it was before:<br />
<ul>
<li><div class="name">
<a href="http://evanjones.ca/python-utf8.html">How to Use UTF-8 with Python</a></div>
</li>
</ul>
What tips do you have about how to handle Unicode that haven't gotten enough attention?<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-63508845660062446972010-10-15T18:40:00.000-07:002012-11-15T19:17:37.856-08:00Creating a Hashed Password for VNCFor an automated installation project at work I needed to set the password to an <a href="http://www.uvnc.com/">UltraVNC</a> server running on Windows. <a href="http://en.wikipedia.org/wiki/Vnc">VNC </a>is a remote desktop protocol and very handy. For good reason the server's password is not stored in the clear, but rather a (now weakly) encrypted version.<br />
<a name='more'></a><br />
Unfortunately, while the admin GUI of the program will gladly create the result for you and save it to the ultravnc.ini file or registry, what if you need to do it without human intervention? Even trained chimps are expensive these days and tend to <a href="http://www.youtube.com/watch?v=cg2AezJo8aQ#t=0m10s">throw crap</a> around when bored. No one will be around to bring up the window and type it in by hand.<br />
<br />
It's a shame to waste time on such a thing because the program really should support it at the command line. After a few hours of googling, combing forums and <a href="http://ultravnc.svn.sourceforge.net/viewvc/ultravnc/UltraVNC%20Project%20Root/UltraVNC/winvnc/winvnc/vncauth.c?revision=580&view=markup">source code</a> for answers, I gave up and hacked together something myself. Instead I used <a href="http://python.org/">Python </a>to create the "cypher text", which can then be saved to the .ini file or to the Windows registry in whatever manner is easiest. Since you can choose where to put it, supporting other VNC products is possible too.<br />
<br />
I'll squeeze the good parts in here.<br />
<br />
Steps:<br />
<ol>
<li>Install a modern Python 2.x if you don't have it.</li>
<li>Download this module that handles the nuts and bolts of the encryption algorithm:<a href="http://vnc2flv.googlecode.com/svn-history/r2/trunk/vnc2flv/vnc2flv/d3des.py"> d3des.py</a></li>
<li>Copy the code below to a file named something like "vnc_enc.py" and save to the same folder:<br />
<table class="highlighttable"><tbody>
<tr><td class="linenos"><div class="linenodiv">
<pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16</pre>
</div>
</td><td class="code"><div class="highlight">
<pre><span class="kn">import</span> <span class="nn">d3des</span> <span class="kn">as</span> <span class="nn">d</span> <span class="c"># for brevity - narrow column</span>
<span class="k">def</span> <span class="nf">get_vnc_enc</span><span class="p">(</span><span class="n">password</span><span class="p">):</span>
<span class="n">passpadd</span> <span class="o">=</span> <span class="p">(</span><span class="n">password</span> <span class="o">+</span> <span class="s">'</span><span class="se">\x00</span><span class="s">'</span><span class="o">*</span><span class="mi">8</span><span class="p">)[:</span><span class="mi">8</span><span class="p">]</span>
<span class="n">strkey</span> <span class="o">=</span> <span class="s">''</span><span class="o">.</span><span class="n">join</span><span class="p">([</span> <span class="nb">chr</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">d</span><span class="o">.</span><span class="n">vnckey</span> <span class="p">])</span>
<span class="n">ekey</span> <span class="o">=</span> <span class="n">d</span><span class="o">.</span><span class="n">deskey</span><span class="p">(</span><span class="n">strkey</span><span class="p">,</span> <span class="bp">False</span><span class="p">)</span>
<span class="n">ctext</span> <span class="o">=</span> <span class="n">d</span><span class="o">.</span><span class="n">desfunc</span><span class="p">(</span><span class="n">passpadd</span><span class="p">,</span> <span class="n">ekey</span><span class="p">)</span>
<span class="k">return</span> <span class="n">ctext</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s">'hex'</span><span class="p">)</span>
<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">'__main__'</span><span class="p">:</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span>
<span class="k">print</span> <span class="n">get_vnc_enc</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">print</span> <span class="s">'usage: </span><span class="si">%s</span><span class="s"> <password>'</password></span> <span class="o">%</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
</pre>
</div>
</td></tr>
</tbody></table>
</li>
<li>To print the result to the console:<br /><pre>C:\> vnc_enc.py foo
2a4180b2e31f5790
</pre>
</li>
<li>Here's a batch file to take a password and write it to the UltraVNC registry area. This is what I needed for work. It could be saved to the registry directly with Python, but I've opted to keep these parts of the program separate. Name it pass2reg.cmd or similar:
<table class="highlighttable"><tbody>
<tr><td class="linenos"><div class="linenodiv">
<pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17</pre>
</div>
</td><td class="code"><div class="highlight">
<pre><span class="p">@</span><span class="k">echo</span> <span class="k">off</span>
<span class="k">setlocal</span>
<span class="k">if</span> <span class="s2">"%1"</span> <span class="o">==</span> <span class="s2">""</span> (
<span class="k">echo</span> usage: <span class="nv">%0</span> ^<span class="p"><</span><span class="n">password</span>^><span class="p"></span></pre>
<pre> <span class="n">exit</span> <span class="n">/b</span>
)
<span class="k">set</span> <span class="nv">regkey</span><span class="o">=</span>HKLM\SOFTWARE\ORL\WinVNC3\Default
<span class="k">set</span> <span class="nv">valname</span><span class="o">=</span>Password
<span class="c">rem clumsy cmd way to set value to env var</span>
<span class="k">for</span> <span class="n">/f</span> <span class="s2">"delims="</span> <span class="nv">%%H</span> in (<span class="s1">'vnc_enc.py %1'</span>) <span class="k">do</span> <span class="k">set</span> <span class="nv">ctxt</span><span class="o">=</span><span class="nv">%%H</span>
<span class="k">echo</span> VNC Text is: <span class="nv">%ctxt%</span>
<span class="k">echo</span> Writing to: <span class="nv">%regkey%</span>\<span class="nv">%valname%</span>
reg add <span class="nv">%regkey%</span> <span class="n">/v</span> <span class="nv">%valname%</span> <span class="n">/t</span> reg_binary <span class="n">/f</span> <span class="n">/d</span> <span class="nv">%ctxt%</span>
<span class="k">echo</span> Writing to: <span class="nv">%regkey%</span>\<span class="nv">%valname%</span><span class="m">2</span>
reg add <span class="nv">%regkey%</span> <span class="n">/v</span> <span class="nv">%valname%</span>2 <span class="n">/t</span> reg_binary <span class="n">/f</span> <span class="n">/d</span> <span class="nv">%ctxt%</span>
</pre>
</div>
</td></tr>
</tbody></table>
</li>
<li> If you need to write the result to an ini file instead, try Python's <a href="http://docs.python.org/release/2.6/library/configparser.html">ConfigParser </a>module. It is easy to use.</li>
</ol>
<br />
That's it. Python saves the day again. I'm sure a few minutes from now I'll find someone already solved it. Happy weekend!<br />
<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com9tag:blogger.com,1999:blog-3444671539110715411.post-22168245476635759062010-07-16T14:52:00.000-07:002010-07-26T00:46:37.993-07:00Friday TipsWelcome to <a href="http://www.geekademy.com/2010/05/tips-friday.html">another installment</a> of tips on Friday. First up is my own.<br />
<br />
Yesterday while preparing to register my car, I remembered one tip I learned as a young lad and it has been helpful ever since. At the time it was very California-centric, but it's likely the same bureaucracy has now reached much of the world.<br />
<a name='more'></a><br />
The subject is how to all but guarantee that your car will pass a <a href="http://en.wikipedia.org/wiki/Smog_check">smog-check</a> inspection in order to get registered at the DMV (Department of Motor Vehicles). While young and poor, sometimes you may need another month or two to scrape up enough cash to get your car tuned up. This tip can give you some breathing room. Assuming of course, that the car is in running condition and not having major problems, billowing smoke etc.<br />
<br />
The tip is to let your tank empty, then fill up completely with the EC (Emission Control) Unleaded at an <a href="http://en.wikipedia.org/wiki/ARCO">Arco station</a>. It is also one of cheapest gasoline stations too, so savings all around. So get that car tuned up ASAP, use EC gas, save money, reduce your negative effects on the environment, and feel good about it.<br /><br />
<h4>
Stuff No One Told Me (but I learned anyway)</h4>
If you haven't seen it before, there is a great blog called <a href="http://stuffnoonetoldme.blogspot.com/">Stuff No One Told Me</a>, where artist Alex Noriega shares his lessons in life in cartoon form. Great work and highly recommended.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://stuffnoonetoldme.blogspot.com/" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRCpX2S6R_1bYK6PMsy1dZmx5FE0tTqxX7bqZos6blQBfKVTQR_HVNsiVHrnfk4yvHV5S5ViEu6OPHIscUcyhpXCFmlYij6DeD7Rp9L5Zm3E-09nXVrIoO7YMzLEJxBn6BX_E-kupUvVo/s400/QzG4V.jpg" width="400" /></a></div>
<br />
<br />
<h4>
More tips from the Reddit Community</h4>
Finally, we again draw on the collective wisdom of the Reddit Community. A few favorites highlighted below:<br />
<ul>
<li><a class="title " href="http://www.reddit.com/r/AskReddit/comments/c7wby/ok_reddit_lets_make_itthe_list_of_real_life_cheat/">The
List of Real Life Cheat Codes</a></li>
<ul>
<li><i>Walk on the sides of
stairs to avoid/reduce creaks.</i></li>
<li>
<div class="usertext-body">
</div>
<i>Try to put yourself in as many socially awkward situations as possible.
You will be desensitized to it which makes you more outgoing.</i></li>
<li><i>If you find yourself
running late for work, pick up some donuts or breakfast burritos. Then
you're not the guy who's late, you're the guy who brought breakfast! //Whataburger</i></li>
<li><i>Never bring anything in to work. That way, when you leave (ie, earlier
than usual) it doesn't look like you're leaving for the day.<br />
<br />
</i></li>
</ul>
<li> <a class="title " href="http://www.reddit.com/r/AskReddit/comments/c90ip/everything_youve_learned_in_life_in_five_words_go/">Everything
you've learned in life. In five words.</a></li>
<ul>
<li><i>"Have a backup plan,
bitch!"</i></li>
<li>
<div class="usertext-body">
</div>
<i>always finish what you</i></li>
<li><i>Don't be afraid to fail.</i></li>
<li><i>Never promise crazy a
baby.</i></li>
<li>
<div class="usertext-body">
</div>
<i>Happiness equals reality minus expectations.</i></li>
<li><a href="http://www.geekademy.com/2010/02/no-sex-in-champagne-room.html"><i>No sex in Champagne Room.</i></a><br />
<br />
</li>
</ul>
<li><a class="title " href="http://www.reddit.com/r/AskReddit/comments/c86wg/hey_reddit_can_you_recommend_some_good_sex_music/">Can
you recommend some good sex music?</a></li>
<ul>
<li>Can't believe <a href="http://www.amazon.com/Best-Sade/dp/B00005AWMF/ref=ntt_mus_ep_dpi_2">Sade</a> was so low on the page.</li>
<li><i>Massive Attack</i>, +1.</li>
<li><i>Al Green, Marvin Gaye</i>, etc.</li>
</ul>
</ul>
What are some of your best tips?<br /><br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-58758379545434122442010-07-02T20:36:00.000-07:002011-06-09T23:46:23.632-07:00Thoughts on Independence DayThis year as the fourth of July approaches I’ve been thinking a lot about my wild yet enlightened uncle Charlie. Although I have several agreeable uncles, Charlie was the coolest of the bunch and as a young lad I looked up to him.<br />
<a name='more'></a><br />
Born in the ‘50s into a musical family, Charlie aka “Chuck” grew up in the ‘60s and ‘70s, riding motorcycles, playing baseball and the electric guitar. He listened to classic rock—always at maximum volume of course, later introducing me to the Beatles, Pink Floyd, and other musical greats. He also introduced me to the great philosophers, such as Socrates, Plato, and <a href="http://en.wikipedia.org/wiki/Age_of_enlightenment">Enlightenment</a> thinking in general ... plopping five-hundred-page books on my desk as an “assignment.” He always lived life to the fullest and unfortunately passed away last year at a young age, perhaps related to living it so fully.<br />
<br />
<div class="img_group" style="margin: 0px; padding: 0px;">
<img border="0" height="306" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrIBe1xNycBhSBL-6U4r53ejhOiS3NZcw6FA-8IJLaNfDarJHmtJA100ly30RIik4zIMGZEQlo0hmiS94K_j4U0kdh0fWZWsta4nJUVgao1M8YgNPbhOvMcc2SOmdZioFT97YMQk8bIck/s1600/easyrider_510.jpg" width="510" /><br />
<div class="img_caption">
Lookin’ for Adventure ... Easy Rider</div>
</div>
<br />
What does this have to do with the coming weekend? Well, if you’re not familiar with holidays of the United States, July fourth is more importantly known as <a href="http://en.wikipedia.org/wiki/Independence_Day_%28United_States%29">Independence Day</a>. Roughly, the anniversary of the day thirteen American colonies declared themselves free of the tyranny of the British Crown and therefore able to choose their own destiny.<br />
<br />
One of the clearer memories of my early years as a young teenage punk, was a summer afternoon (Journey probably playing in the background) when my uncle said:<br />
<blockquote>
<i>“Oh yeah ... you’ve gotta read the Declaration of Independence and the Constitution. You’ll be amazed at the crazy *** you’ll read in there! Politicians today would think you’re a lunatic if you brought up the ideals of the founding fathers.”<br />
<span style="font-size: smaller;">(*** stuff/shit/things - Memory fuzzy on that point.)</span><br />
—Uncle Chuck, circa 1983<br />
</i> </blockquote>
Hmm ... the documents I learned about in history class? Ok I thought, I don’t have them handy (and won’t be on the internet for another full decade at least). But, Chuck is pretty cool—I’ll file the observation away for later.<br />
<br />
Eventually a few years passed, and I did get around to them. It turns out they’re not as long (or boring) as you might think, just two or three pages for the Declaration, double or triple that for the Constitution. That’s pretty damn concise for the definition of a new country and a new experiment in government in general. And guess what, I <i>was </i> amazed. <br />
<h4>
Life, Liberty, and the Pursuit of Happiness<br />
</h4>
<img height="305" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUzIUr0ka3WWUpl8Djv8WnZT5TFfmCoydEcgJ4j9_Iqokj2TuRSNml81hncPJUryzgR_ayImTImwYESv3EU9tKjrtGTh4krBt7yPT-OWS8GJjbWsV2M3NFW9UMSM5_-1FS1OFsvE4-APw/s1600/Us_declaration_independence_sm.jpg" style="float: right; margin: 4px 0px 4px 4px;" width="250" />
So this weekend, I call on you to put that second burger down a moment and take a look at the <a href="http://www.ushistory.org/declaration/document/">Declaration of Independence</a> yourself. Here’s my amateur take:<br />
<blockquote>
<i>When in the Course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature’s God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.</i>
</blockquote>
A very elegant way of saying it’s over and here’s why, wouldn’t you agree? It gets better ...<br />
<blockquote>
<i>We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. — That to secure these rights, Governments are instituted among Men, deriving their just powers from the consent of the governed, — That whenever any Form of Government becomes destructive of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness. <br />
</i> </blockquote>
These are the “<a href="http://memory.loc.gov/ammem/collections/jefferson_papers/mtjessay1.html#n7">magic words of American history</a>,” as described by historian, Joseph J. Ellis. Some of the most well-known and important words that have ever been written. <br />
<br />
These first paragraphs speak heavily of <a href="http://www.u-s-history.com/pages/h1206.html">Natural Rights</a>, the idea that freedom is a gift from nature and/or one’s creator, and can’t simply be taken away by a government. The idea wasn’t new at the time, and are in fact borrowed in part from <a href="http://en.wikipedia.org/wiki/United_States_Declaration_of_Independence#Influences">John Locke</a> and other <a href="http://en.wikipedia.org/wiki/Age_of_Enlightenment">Enlightenment</a> figures. <a href="http://en.wikipedia.org/wiki/Thomas_jefferson">Thomas Jefferson</a>, the primary author and his <a href="http://en.wikipedia.org/wiki/Founding_Fathers_of_the_United_States">contemporaries</a>, John Adams, Ben Franklin, and others in the Continental Congress therefore built upon the <a href="http://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants">shoulders of giants</a> before them in authoring the document. What <i>was </i> new was that the future American union would be the first direct implementation of many of these ideals. The French Revolution would come soon afterward, becoming the second.<br />
<br />
Wait a minute, did they just say that a government that doesn’t meet the needs of its citizens should be destroyed? Yes they did. <br />
<br />
Continuing on:<br />
<blockquote>
<i>Prudence, indeed, will dictate that Governments long established should not be changed for light and transient causes; and accordingly all experience hath shewn that mankind are more disposed to suffer, while evils are sufferable than to right themselves by abolishing the forms to which they are accustomed.<br />
<br />
But when a long train of abuses and usurpations, pursuing invariably the same Object evinces a design to reduce them under absolute Despotism, it is their right, it is their duty, to throw off such Government, and to provide new Guards for their future security.<br />
</i> </blockquote>
We don’t take these actions lightly, have suffered a long time, and will not comply any longer.<br />
<blockquote>
<i>The history of the present King of Great Britain is a history of repeated injuries and usurpations, all having in direct object the establishment of an absolute Tyranny over these States. To prove this, let Facts be submitted to a candid world.</i> </blockquote>
A list of grievences follows (left for the reader to discover), including an unfortunate passage about Indian savages. In short—we haven’t the benefits of representation, but only the burdens and <a href="http://en.wikipedia.org/wiki/American_Revolution#Incendiary_British_legislation">malicious punishments</a> of the Empire.<br />
<blockquote>
<i>Nor have We been wanting in attentions to our British brethren. We have warned them from time to time of attempts by their legislature to extend an unwarrantable jurisdiction over us. We have reminded them of the circumstances of our emigration and settlement here. We have appealed to their native justice and magnanimity, and we have conjured them by the ties of our common kindred to disavow these usurpations, which would inevitably interrupt our connections and correspondence. They too have been deaf to the voice of justice and of consanguinity. We must, therefore, acquiesce in the necessity, which denounces our Separation, and hold them, as we hold the rest of mankind, Enemies in War, in Peace Friends.</i> </blockquote>
Our questions and complaints to our friends in the British public and parliament have fallen on deaf ears.<br />
<h4>
Conclusion<br />
</h4>
The Declaration goes on to declare that the Colonies are now Free and Independent States. The reasoning is clear: <br />
<ul>
<li>Citizens have the right and duty to change their government when it fails to meet their needs.</li>
<li>The British Monarchy and Parliament have created this very situation.</li>
<li>Therefore, all political connection between them and the State of Great Britain, is and ought to be dissolved. </li>
</ul>
From the perspective of today the decision to declare independence seems obvious, but it is important to remember how vulnerable and dependent the American colonies were on Great Britain for <a href="http://en.wikipedia.org/wiki/French_and_Indian_War">protection</a> and trade at the time. There were many difficult decisions to be made and there were many <a href="http://en.wikipedia.org/wiki/American_Revolution#Loyalists_and_neutrals">dissenters </a> who disagreed that it was a good idea. (See the Further Reading section for more details.)<br />
<br />
So, not very long was it? The U.S. Constitution is of course is the more substantial document, and includes more numerous ideas that might be considered “crazy” by the today’s standards.<br />
<h3>
<br />
Back to the Present<br />
</h3>
Every year or two I read these documents again, and every year experience affirms my uncle’s theory a bit more. Numbskull politicians never rest in their attempts to butt into your business, spend your money, and legislate morality. They eschew <a href="http://en.wikipedia.org/wiki/Republicanism_in_the_United_States">republicanism</a> (not the party) while wrapping themselves up in the flag and constitution as if they have even a tiny bit in common with them. Wherever you grew up on the political landscape you’ve encountered this. <br />
<br />
The most egregious example of the current status quo that comes to mind was a televised debate for the 2008 Republican nomination for president, where the panel of candidates (backed up by the media) did their best to insinuate that Congressman Ron Paul in <a href="http://www.youtube.com/watch?v=rKzteUs_vto">his calls to return to the ideals of the Constitution</a>, was unelectable and perhaps should even put in an asylum.<br />
<br />
So, on this Independence day, let’s remember uncle Chuck’s advice. Take a few minutes, read and ponder the Declaration of Independence. It’ll give you something to do besides downing hot dogs and risking the loss of your extremities to explosion. Join me in making it a tradition. And if an ignoramus gives you shit about it, just call ‘em a communist, like uncle Chuck would’ve. Should shut ’em right up, hehe.<br />
<br />
Finally, let’s remember that the important part of the holiday is the independence and freedom, not that it was declared on a Thursday in July. Now back to the regularly scheduled concerts and BBQ.<br />
<br />
<object height="385" width="480">
<param name="movie" value="http://www.youtube-nocookie.com/v/q-BknAz9kIE&hl=en_US&fs=1?rel=0">
</param>
<param name="allowFullScreen" value="true">
</param>
<param name="allowscriptaccess" value="always">
</param>
<embed src="http://www.youtube-nocookie.com/v/q-BknAz9kIE&hl=en_US&fs=1?rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed>
</object><br />
<div class="img_caption">
Neal Schon - Star Spangled Banner (Saw this live once w/ U.C.)</div>
<br />
<br />
Further Reading:<br />
<ul>
<li> <a href="http://library.thinkquest.org/26466/history_of_democracy.html">The History of Democracy</a> </li>
<li>Social and Political developments of the <a href="http://en.wikipedia.org/wiki/American_Revolution">American Revolution</a>.</li>
<li> <a href="http://www.ushistory.org/documents/constitution.htm">The US Constitution</a> </li>
<li> <a href="http://en.wikipedia.org/wiki/Declaration_of_the_Rights_of_Man_and_of_the_Citizen">Declaration of the Rights of Man and of the Citizen</a> <br />
</li>
<li>theOnion - <a href="http://www.theonion.com/articles/area-man-passionate-defender-of-what-he-imagines-c,2849/">Area Man Passionate Defender Of What He Imagines Constitution To Be</a> <br />
</li>
</ul>
<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com1tag:blogger.com,1999:blog-3444671539110715411.post-56372215521242344302010-06-01T12:01:00.000-07:002010-06-01T12:51:22.304-07:00Corporate Influence on U.S. Government and PoliticsBy now if you pay even modest attention to current events in America you've probably heard a lot about lobbyists, “special interests”, and PACs. These are the levers in which corporations and industry groups influence and often control the US Government, as we will discuss below.<br />
<a name='more'></a>
<br />
This is part of a <a href="http://www.geekademy.com/2010/05/finding-bit-of-truth-in-ocean-of.html">series</a> on recognizing and managing misinformation in the media named, “Finding A Bit Of Truth In An Ocean Of Garbage.”<br />
<br />
<h3>Lobbyists, Special Interests, and PACs</h3>
<blockquote>“I hope we shall... crush in its birth the aristocracy of our moneyed corporations, which dare already to challenge our government to a trial of strength and to bid defiance to the laws of their country.”<br />
—Thomas Jefferson,<br /><a href="http://blsciblogs.baruch.cuny.edu/brianmurphy/2010/02/03/thomas-jefferson-to-george-logan-12-november-1816/">Letter to George Logan. November 12, 1816</a> </blockquote>
How exactly does this all work? Well, a lobbyist is a person who is hired to influence legislation on behalf of a special interest group. In 2009, the Senate Office of Public Records <a href="http://www.opensecrets.org/lobbyists/">estimates there were</a> 13,754 lobbyists, who spent a collective $3.49 Billion in support of their activities. Lobbyists <a href="http://www.opensecrets.org/revolving/index.php">tend to be former federal employees</a>, as their government contacts give them an advantage. This practice is sometimes called the “revolving door.”<br />
<blockquote>“Whether lobbyists work for a large organization, a private individual, or the general public, their goals and strategies are the same. First and foremost, lobbyists must be adept at the art of persuasion, which is the mainstay of their job. They must figure out how to sway politicians to vote on legislation in a way that favors the interest they represent. This means tailoring appeals to specific individuals as well as to group voting blocs, such as Southerners or pro-choicers. .... Sometimes, lobbyists will even sit down and help a politician draft legislation that is advantageous for their interest.”<br />
—Excerpted from “<a href="http://www.princetonreview.com/Careers.aspx?cid=88">A Day in the life of a Lobbyist</a>”,<br />The Princeton Review<br />
</blockquote>
Special Interests are the <a href="http://en.wikipedia.org/wiki/Advocacy_group">advocacy groups</a> that lobbyists organize themselves under to influence public opinion and legislation, while <a href="http://en.wikipedia.org/wiki/Political_Action_Committee">Political Action Commitees</a> (PACs) focus on electing the candidates they support. Both are largely sponsored by corporations and industry groups. The reason these third party groups exist is that regulations have historically barred corporations from direct lobbying and/or campaigning for candidates.<br />
<br />
The film, <a href="http://www.imdb.com/title/tt0427944/">Thank You For Smoking</a>, is a satirical dramatization of the <a href="http://en.wikipedia.org/wiki/Modus_operandi">modus operandi</a> of lobbyists from unsavory industries. Although fictional, it helps one to appreciate their goals and motivations. I had to be be encouraged to watch it, as I don't care for smoking ... but the film has little to do with it and is quite funny. Recommended as it will help this dry subject come alive.<br />
<br />
<div style="overflow: visible;">
<object width="560" height="340"><param name="movie" value="http://www.youtube-nocookie.com/v/iBELC_vxqhI&hl=en_US&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/iBELC_vxqhI&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>
</div>
<h4>Benefits of Lobbyists</h4>
Despite what you may have heard, there are a few benefits to lobbyists. In economist Thomas Sowell's book, “<a href="http://en.wikipedia.org/wiki/Knowledge_and_Decisions">Knowledge and Decisions</a>,” he defends corporate lobbying as simply an example of a group having better knowledge of its interests than the public at large. Additonally, industries are able to share their expertise and are given a voice into issues that affect them, which is fair. The relevant commitee of the UK House of Commons has argued the same points.<br />
<blockquote>“The practice of lobbying in order to influence political decisions is a legitimate and necessary part of the democratic process. Individuals and organisations reasonably want to influence decisions that may affect them, those around them, and their environment. Government in turn needs access to the knowledge and views that lobbying can bring.”<br />
—UK House of Commons PASC, <br /><a href="http://www.publications.parliament.uk/pa/cm200809/cmselect/cmpubadm/36/36i.pdf">Lobbying: Access and influence in Whitehall</a> </blockquote>
Therefore, lobbyists don't completely deserve the negative image the term has come to represent. The problem however, is that much of the time lobbyists and their employers make the final decisions on legislation rather than voters. <br /><br />
Understandably, industry profits aren't nearly as high a priority to the general public than they are to industry. Nor should they be.<br />
<br />
Further reading:<br />
<ul><li> <a href="http://www.amconmag.com/article/2006/feb/13/00006/">Republic for Sale</a> <br />
More background on “K Street” by the American Conservative.</li><li>Resources from OpenSecrets.org:</li><ul><li> <a href="http://www.opensecrets.org/industries/index.php">Which industry contributes to who?</a> </li><li> <a href="http://www.opensecrets.org/pacs/index.php">Campaign Contributions by PAC</a> </li><li> <a href="http://www.opensecrets.org/orgs/index.php">Largest Contributers</a> <br />
</li></ul></ul><ul></ul><h3><br />
Management of Political Opinion</h3>
In order for an industry to lobby effectively, that is to introduce favorable bills and defeat unfavorable ones, they must manage public opinion as well. We've seen how that is accomplished in the <a href="http://www.geekademy.com/2010/05/on-media-ownership-and-campaigns.html">previous post</a> on Media Campaigns. This section will now examine the process from a political perspective. Let's look a few examples.<br />
<br />
<h4>Net Neutrality</h4>
The topic of net neutrality is a good place to start as it is a current issue, simple to understand, and therefore theoretically shouldn't get bogged down in a lot of politics. Unfortunately, since the basic concepts are not widely familiar to non-techies, groups are working to exploit that lack of knowledge.<br />
<br />
If you are not familiar with the subject, it simply prohibits discrimination of traffic by internet providers, which is how the internet has functioned historically.<br />
<blockquote>Network neutrality is a principle proposed for ... the Internet that advocates no restrictions by Internet Service Providers or governments on content, sites, or platforms, on the kinds of equipment that may be attached, and on the modes of communication allowed.<br />
—Wikipedia, “<a href="http://en.wikipedia.org/wiki/Net_neutrality">Network Neutrality</a>”<br />
</blockquote>
Doesn't sound very controversial, does it? After all if you had internet from Time Warner, you wouldn't want them to be able to slow down Youtube, would you? Or if you had AT&T Internet, you wouldn't want them <a href="http://www.tgdaily.com/mobility-features/41939-showdown-carriers-threaten-to-ban-skype-from-cellular-networks">to be able to ban</a> Skype, right? Hulu <a href="http://arstechnica.com/tech-policy/news/2010/05/senate-antitrust-leader-fears-comcast-will-kneecap-hulu.ars?">crippled on or by Comcast</a> ? According to their actions so far, that's just what they'd like to do. Thanks to <a href="http://www.geekademy.com/2010/05/on-media-ownership-and-campaigns.html">media consolidation</a>, this idea has become feasible and/or desirable.<br />
<br />
While there are some <a href="http://en.wikipedia.org/wiki/Net_neutrality#Arguments_against_network_neutrality">decent nuanced arguments</a> against net neutrality, you won't find these in the popular media. Instead a group named <a href="http://en.wikipedia.org/wiki/Americans_for_prosperity">Americans for Prosperity</a> have <a href="http://nointernettakeover.com/">embarked on a campaign</a> to characterize the FCC anti-discrimination rule as a “big government take-over of the internet.” Seemingly in oposition to the spirit of the law. How effective it will be remains to be seen.<br />
<br />
We'll revisit this topic in a future post to note to see how it is covered by large news organizations.<br />
<br />
Biased sources:<br />
<ul><li>AFP Launches $1.4 Million Advertising Blitz - <a href="http://news.yahoo.com/s/usnw/20100511/pl_usnw/DC02568_1">Press Release</a> </li><li> <a href="http://stopthecap.com/2010/05/11/americans-for-prosperity-backed-by-big-telecom-is-back-with-more-net-neutrality-opposition/">Americans for Prosperity, Backed By Big Telecom, Is Back With More Net Neutrality Opposition</a> <br />
</li><li>freepress.net: <a href="http://www.freepress.net/press-release/2010/5/12/industry-front-group-plans-campaign-lies">Industry Front Group Plans Campaign of Lies</a> <br />
</li></ul>Further Reading:<br />
<ul><li> <a href="http://arstechnica.com/tech-policy/news/2010/05/senate-antitrust-leader-fears-comcast-will-kneecap-hulu.ars?">Senate antitrust leader fears Comcast will kneecap Hulu</a> </li><li> <a href="http://www.infoworld.com/d/the-industry-standard/att-and-apple-needlessly-shackle-skype-users-826">AT&T and Apple needlessly shackle Skype users<br />
<br />
</a> </li></ul>
<h4>Healthcare Reform</h4>
I'd have preferred not to touch the healthcare debate with a ten-foot poll but this show on the topic cut through the bullshit like nothing I've seen in a long time. I'll ask that you suspend any opinions on the subject for a moment and watch this former insurance executive describes how the industry framed the political debate for so many. Whether for or against the legislation, you'll find it interesting.<br />
<blockquote>“It does offend me that the vested special interests, that are so profitable and so powerful, are able to influence public policy in the way that they have, and the way they've done over the years. And the insurance industry has been one of the most successful in beating back any kinds of legislation that would hinder or affect the profitability of the companies.”<br />
—Wendell Potter on Bill Moyers Journal (@ 20:17)</blockquote>
<object width="480" height="385"><param name="movie" value="http://www.youtube-nocookie.com/v/7QwX_soZ1GI&hl=en_US&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/7QwX_soZ1GI&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
<br /><br />
Another quote in reference to the “revolving door.”<br />
<blockquote>BILL MOYERS: Why is the industry so powerful on both sides of the aisle?<br />
WENDELL POTTER: Well, money and relationships, ideology. The relationships— an insurance company can hire and does hire many different lobbying firms. And they hire firms that are predominantly Republican and predominantly Democrat. And they do this because they know they need to reach influential members of Congress like Max Baucus. So there are people who used to work for Max Baucus who are in lobbying firms or on the staff of companies like CIGNA or the association itself.<br />
BILL MOYERS: Yeah, I just read the other day in “The Washington Post,” that Max Baucus's staff met with a group of lobbyists. Two of them had been Baucus's former chiefs of staff.<br />
—Wendell Potter on Bill Moyers Journal (@ 16:27)<br />
</blockquote>
I highly recommend watching the full program from the beginning. In it you'll learn what the public needs to know about how the industry managed the debate and was able to get the legislation that it wanted. <br/>
The result: No public option, and rules to require everyone to acquire insurance. Incredibly effective.<br />
<br />
Further resources at the Journal site:
<ul><li> <a href="http://www.pbs.org/moyers/journal/07312009/profile.html">Introduction and Strategy Memos<br />
</a> </li><li> <a href="http://www.pbs.org/moyers/journal/07312009/watch.html">Video</a> hosted at PBS</li><li> <a href="http://www.pbs.org/moyers/journal/07312009/transcript1.html">Transcript<br />
<br />
</a> </li></ul><h3>Campaign Finance Reform</h3>
You might also be aware of the attempts to reform the process of campaign finance, or rather their failures. The financing of election campaigns is a large burden to politicians and therefore very important to them. If they do not raise the large amounts of money necessary for advertising they are likely not able to get elected. This is where PACs and their benefactors, corporations and industry groups come in. They provide the massive amounts of cash necessary for successful campaigns, ensuring politicians are dependent on them.<br />
<br />
The reform movement was and is an attempt to reduce this powerful influence on the government. There have been several bills over the years and a few have been made into law. The most famous of which, the <a href="http://en.wikipedia.org/wiki/Campaign_finance_reform_in_the_United_States#Bipartisan_Campaign_Reform_Act_of_2001">Bipartisan Campaign Reform Act of 2001</a> sponsored by Senator(s) McCain/Feingold was passed after many years of struggle although in watered-down form. Important provisions of it were recently <a href="http://en.wikipedia.org/wiki/Campaign_finance_reform_in_the_United_States#2010_Supreme_Court_Ruling">struck down by the Supreme Court</a> in 2010. Senator McCain later remarked that “<a href="http://abcnews.go.com/Business/wireStory?id=9649150">Campaign Finance Reform is dead</a>.”<br />
<br />
I leave it to the reader to decide why effective campaign finance reform never seems to happen.<br />
<br />
<h3>Motives</h3>
<blockquote>“<i>I like money.”<br />
—Frito Pendejo, Idiocracy (2005)</i></blockquote>
While it costs many millions of dollars to herd the public and
government in various directions the outcomes may be worth billions and
sometimes trillions. See <a
href="http://www.costofwar.com/index.html">unending wars</a>, <a
href="http://online.wsj.com/article/SB123319689681827391.html">bank
bailouts</a>, healthcare & bankruptcy legislation, etc, etc, for
examples. Motive established.<br />
<br />
In the next post we'll draw some conclusions and look at the consequences of this unfortunate situation.<br/><br/>Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-91767434010330055252010-05-28T13:35:00.000-07:002010-07-16T12:30:22.232-07:00Friday TipsEvery day on the net I run across a great many tips to make life easier,
and I'd like to start collecting and recording the best so they aren't
lost or forgotten. Here is the first batch from the archives, I'll post newer ones each week until I run out.<br />
<a name='more'></a>
<h4>
From <a href="http://lifehacker.com/">Lifehacker</a>, a favorite:</h4>
<ul>
<div class="img_groupr">
<img border="0" height="141" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6MIrOvLPUwkAwJjwjmR4RAxOI-qMUOXRhX4hACXJNlWqkpWGbl0VY1sZ4eYNwzTaxiwVG2a-E9-jOgZRNqrafGZQHLfiS0MMvhiQjMa57E6ZfeAO8_NL5Na0BOfqJ93dGrMeEsWPcs1I/s1600/binder_clip.jpg" width="250" /></div>
<div class="img_groupr">
<img border="0" height="170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglyXRr5TB8B2ailZS2SvdUxTI3CxBt9ZhCiQUl35U38sWV5STDDRLYKxjJ8A8cXQTDSNGJ7mqGBrRffSn61J2XGt2uOOcciq4XCiIaaL7EqC6sVY3OEKF_Xo6K1msFFGgK3y4PweyVKkc/s1600/6pd9C.jpg" width="250" /></div>
<li>Here is a stroke of brilliance: <a href="http://lifehacker.com/5499838/binder-clips-as-cable-catchers-redux">Attach binder clips to the rear edge of a desk</a> to prevent
falling cables. On the bottom is a shot of an alternate version, for the
small clips and/or when the desk is too thick.<br clear="all"/>
</li>
</ul>
<ul>
<li><a href="http://lifehacker.com/5501942/how-i-mastered-the-power-nap">Helpful
Tips on Power Napping</a> (Cliff Notes):</li>
<ul>
<li><b>You don't have to actually fall asleep to nap</b>
– it's enough to drift off to a half-sleep state.</li>
<li><b>Even if it normally takes you 30+ minutes to fall
asleep, you can benefit from 20 minute power naps</b>. First,
learn what you're aiming for, for example by using something like Pzizz
Then, practice reproducing that feeling – plan for a few months before
you get good at it.</li>
<li><b>Don't over-sleep when power-napping</b>, it will
only make you feel groggy.</li>
</ul>
</ul>
<br />
<h4>From <a href="http://wondermark.com/601/">Wondermark</a>:</h4>
<ul>
<li>I don't eat many Cheetos, but the idea of using chopsticks could
be useful for eating anything messy.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://wondermark.com/c/2010-03-05-601chopsticks.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="152" src="http://wondermark.com/c/2010-03-05-601chopsticks.gif" width="400" /></a></div>
<br />
</li>
</ul>
<h4>Youtube:</h4>
How to close a back of chips without a clip or tie. Check out the
related how-to videos as well.<br /><br />
<object width="480" height="385"><param name="movie" value="http://www.youtube-nocookie.com/v/AdhUifjOahs&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube-nocookie.com/v/AdhUifjOahs&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
<br /><br />
<h3>On Self Defense</h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://i.imgur.com/duT2j.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="307" src="http://i.imgur.com/duT2j.jpg" width="400" /></a></div>
<br />
<h4>From Reddit:</h4>
<a href="http://www.reddit.com/r/AskReddit/comments/bi1xh/reddit_what_are_your_best_lifehacks/">What
are
your best lifehacks?</a> Selected favorites:<br />
<ul>
<li><i>If you are charged with
writing a lengthy research paper, find one very solid source that
directly pertains to your thesis, and then you can use that source's
bibliography to back into locating new sources. <br />
AKA, "Raping the Bibliography"</i><br />
</li>
<li><i>Putting my clothes in my closet
with the hangers reversed once a year. As I pull clothes out, I reverse
the hanger. Every year I give away any clothes that I never took out.</i><br />
Great Idea. Remember <a href="http://www.goodwill.org/">Goodwill</a>.</li>
<li style="font-style: italic;">Cut negative people out of your life.</li>
<li><i>To talk to people all you have to do
is just ask questions. just let them talk.</i></li>
<li><i>Pressing your tongue against the roof
of your mouth cures brainfreeze.</i><br />
I tried this one, it worked a bit.</li>
<li style="font-style: italic;">rediscovered the fun (and benefits) of walking to the office. I'm lucky
my office is 2 miles from home.</li>
</ul>
<br />
Here's one of my own:<br />
<ul><li>If the buttons are backward, you're wearing women's clothes.<br />
(reverse if female of course).</li></ul>
What are your favorite tips?<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-72818040493820279232010-05-14T07:06:00.000-07:002010-05-14T07:20:58.853-07:00"We'll Tell You Any Shit You Want to Hear!"This is part two of a <a href="http://www.geekademy.com/2010/05/finding-bit-of-truth-in-ocean-of.html">series</a> on recognizing and managing misinformation in the media named, "Finding A Bit Of Truth In An Ocean Of Garbage."<br />
<br />
You might be surprised to know that the trend of the American media becoming less and less trustworthy has been recognized for a long time. As such, I'd like to introduce you to <a href="http://www.imdb.com/title/tt0074958/"><i>Network</i></a>, a film that a majority of readers here are likely not familiar with. Amazingly, over thirty years ago in 1976 this ground-breaking movie saw the future, described it perfectly, and gave us all a clear warning about what happens when society starts believing its own fantasies.<br />
<a name='more'></a><br />
Howard “Mad as Hell” Beale, a character from the film delivers this frantic yet insightful monologue that resonates even more clearly today. The speech is important enough, that below I've linked to the clip and transcript (for the bandwidth impaired).<br />
<br />
<div style="overflow: visible;">
<object height="340" width="560"><param name="movie" value="http://www.youtube-nocookie.com/v/MTN3s2iVKKI&hl=en_US&fs=1&rel=0">
</param>
<param name="allowFullScreen" value="true">
</param>
<param name="allowscriptaccess" value="always">
</param>
<embed src="http://www.youtube-nocookie.com/v/MTN3s2iVKKI&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></div>
<br />
Text:<br />
<blockquote>
<i>Howard Beale: [arms outstretched to the heavens] Edward George Ruddy died today! Edward George Ruddy was the Chairman of the Board of the Union Broadcasting Systems, and he died at eleven o'clock this morning of a heart condition, and woe is us! We're in a lot of trouble!</i><br />
<br />
<i>[calmly strolling toward the audience] So. A rich little man with white hair died. What has that got to do with the price of rice, right? And *why* is that woe to us? Because you people, and sixty-two million other Americans, are listening to me right now. Because less than three percent of you people read books! Because less than fifteen percent of you read newspapers! Because the only truth you know is what you get over this tube. </i><br />
<br />
<i>Right now, there is a whole, an entire generation that never knew anything that didn't come out of this tube! This tube is the Gospel, the ultimate revelation. This tube can make or break presidents, popes, prime ministers... This tube is the most awesome God-damned force in the whole godless world, and woe is us if it ever falls in to the hands of the wrong people, and that's why woe is us that Edward George Ruddy died. Because this company is now in the hands of CCA - the Communication Corporation of America. There's a new Chairman of the Board, a man called Frank Hackett, sitting in Mr. Ruddy's office on the twentieth floor. </i><br />
<i>And when the twelfth largest company in the world controls the most awesome God-damned propaganda force in the whole godless world, who knows what shit will be peddled for truth on this network?</i><br />
<br />
<i>[ascending the stage] So, you listen to me. Listen to me: Television is not the truth! Television is a God-damned amusement park! Television is a circus, a carnival, a traveling troupe of acrobats, storytellers, dancers, singers, jugglers, side-show freaks, lion tamers, and football players. We're in the boredom-killing business! So if you want the truth... Go to God! Go to your gurus! Go to yourselves! Because that's the only place you're ever going to find any real truth.</i><br />
<br />
<i>[laughing to himself] But, man, you're never going to get any truth from us. We'll tell you anything you want to hear; we lie like hell. We'll tell you that, uh, Kojak always gets the killer, or that nobody ever gets cancer at Archie Bunker's house, and no matter how much trouble the hero is in, don't worry, just look at your watch; at the end of the hour he's going to win. We'll tell you any shit you want to hear. We deal in illusions, man! None of it is true! But you people sit there, day after day, night after night, all ages, colors, creeds... We're all you know. You're beginning to believe the illusions we're spinning here. You're beginning to think that the tube is reality, and that your own lives are unreal. You do whatever the tube tells you! You dress like the tube, you eat like the tube, you raise your children like the tube, you even *think* like the tube! This is mass madness, you maniacs! In God's name, you people are the real thing! WE are the illusion! So turn off your television sets. Turn them off now. Turn them off right now. Turn them off and leave them off! Turn them off right in the middle of the sentence I'm speaking to you now! </i></blockquote>
<br />
Though the film was thought to be a bit melodramatic at the time, it unfortunately describes the American media situation in 2010 with near perfection. Less than fifteen percent of you read the newspaper? I hope that's not accurate, since chances are you'll never have made it this far into the article, much lest the next. A post in which we'll look deeper into the how and why this situation came about.<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-8292383536822396312010-05-12T08:03:00.000-07:002010-05-25T18:38:36.145-07:00Finding A Bit Of Truth In An Ocean Of GarbageAs you may have already noticed, one of the most frustrating developments of recent years is the difficulty in obtaining reliable news and information from media sources, especially in the United States. Paradoxically, while this would be expected in far-off lands with totalitarian governments, it certainly wouldn't be in those with a free press. Yet I submit that keeping informed today is harder than ever, as we are inundated with information from every angle, the majority of it garbage. I'll be examining this regrettable topic in a series of posts here at Geekademy, in hopes it will help others recognize the problem and avoid its consequences.<br />
<a name='more'></a><br />
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNHSFrCxTb53vWK5vjWVAbnK5AEx8fDMBJs8IW5P51qKKYqxlfIUBxAthH0r_GnJ2UtNJ0lC91gJ5PcAKOduUUVLRcAytvVWnT23dgCNurhndyepiiWgj0pt45aAdMahZ15mk3vL1WCdY/s1600/ocean_garbage.jpg" width="505" height="379" /><br />
<br />
To use a metaphor, if low-quality food is thought of as “junk-food”, might we also call low-quality media “junk-programming?” Junk-news? And, just as junk-food has adverse consequences <a href="http://en.wikipedia.org/wiki/Super_Size_Me">for our bodies</a>, this “junk-info” has detrimental effects on our <a href="http://people-press.org/report/606/trust-in-government">blood-pressure and happiness</a>. Taken to its logical conclusion, might it even be a threat to democracy?<br />
<br />
What prompted me to consider the subject was a comment a few months back from a friend from high-school. She had mentioned via social-net that she had been debating on whether her kids would receive flu-shots last season. Now that she had seen an exposé from <a href="http://en.wikipedia.org/wiki/Inside_Edition"><i>Inside Edition</i></a>, (wherein it was claimed a teenage girl developed a horrible disease as a consequence of the shot), she was now sure that refraining was the right decision.<br />
<br />
<object height="385" width="480"><param name="movie" value="http://www.youtube-nocookie.com/v/oGT0r-udstQ&hl=en_US&fs=1&rel=0">
</param>
<param name="allowFullScreen" value="true">
</param>
<param name="allowscriptaccess" value="always">
</param>
<embed src="http://www.youtube-nocookie.com/v/oGT0r-udstQ&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object><br />
<br />
Happening upon the thread, I took a second and thought to myself, “Is she making a critical decision regarding her children's welfare based on a spot from <i>Inside Edition</i>?” I don't want to single her out for harassment, after all the shows do their best to appear legitimate and authoritative.<br />
<br />
Yet as I had expected, about a month or two later it <a href="http://www.theness.com/neurologicablog/?p=1152">came out that the diagnosis and resulting spot were wrong</a>. <br />
<blockquote>
<span style="font-size: smaller;"><i>
Today, we live in a connected virtual community, and YouTube, Twitter, Facebook, and blogs, in addition to traditional media, are the medium through which community panic and delusions spread ...<br />The panic over the vaccine, however, is entirely manufactured, primarily by dedicated conspiracy theorists and anti-vaccinationists, and then aided by irresponsible media. <br />—Steven Novella, MD, 2009</i></span></blockquote>
There was enough scrutiny on the piece that IE ran a follow-up, possibly in an attempt to undo the tangible <i>damage</i> they had caused to families across the country. Sadly, few people were likely around at exactly the right time to see it.<br />
<br />
<object height="385" width="480"><param name="movie" value="http://www.youtube-nocookie.com/v/Kpe1u4cKbTk&hl=en_US&fs=1&rel=0">
</param>
<param name="allowFullScreen" value="true">
</param>
<param name="allowscriptaccess" value="always">
</param>
<embed src="http://www.youtube-nocookie.com/v/Kpe1u4cKbTk&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object><br />
<br />
But the bogus story itself wasn't the biggest problem here. Rather, the fact being that one shouldn't have enough confidence in such a TV show to decide where to eat for lunch, much less whether to vaccinate your kids! These types of shows (as seen above) simply aren't credible or reliable, as I shall attempt to demonstrate further.<br />
<h4>
What's going on here?</h4>
It appears many have forgotten, or perhaps never learned that TV is make-believe. Yes, even the news to a large extent! In the U.S., you'll hear many complaints about a particular news channel getting things <a href="http://www.youtube.com/results?search_query=fox+news+lies&aq=f">wrong on purpose</a>. Others <a href="http://www.afa.net/Detail.aspx?id=2147483794">complain about TV having an agenda</a>, pushing shitty values, violence, sex, and the occult. I've noticed the errors and odd agenda myself. As an aside, I'd add that if it were up to me, I'd rather see 10x fewer murders, and 10x more nipples—for the sake of the children of course. The term “boob-tube” would then be even more appropriate, right?<br />
<br />
Boobs aside, the point I will attempt address is that, as many suspect, the media <i>is</i> biased. Contrary to popular belief however, the bias is isn't necessarily a “liberal” bias or a “conservative” one. While individual organizations do choose angles they can exploit, I submit that as a whole <a href="" name="profits"></a>ultimately they are biased simply in favor of <i>profits</i>. Meaning short-term quarterly corporate profits, in this world of modern finance. Now profits in themselves are not a problem, but rather the pressure that comes every quarter to get the numbers up, <a href="http://online.wsj.com/article/SB107826184536344429.html">by any means necessary</a>. An excerpt from the article:<br />
<blockquote>
<span style="font-size: smaller;"><i>Recent corporate-governance reforms, including the Sarbanes-Oxley Act, fail to address the root cause of accounting scandals: a wide spread obsession with earnings that drives companies to push accounting standards to the limit and, in extreme cases, to engage in outright fraud.<br /><br />Analysts fixate on quarterly earnings at the expense of fundamental research. Corporate executives point to the investment community's behavior to rationalize their own preoccupation with earnings. To meet Wall Street expectations, managers make decisions to increase short-term earnings --even at the expense of long-term shareholder value -- and may employ accounting gimmicks. The resulting misallocation of resources short changes everyone -- investors, employees, and consumers alike.<br />—A. Rappaport, Wall Street Journal, 2004</i></span></blockquote>
Bias is not the whole story, of course. Sometimes simple incompetence or sloppiness rules the day. Occasionally as we shall see in a future post, media corporations, just like their financial brethren, consciously decide to lie outright when it suits their needs.<br />
<br />
I've been investigating this subject over the last few weeks, and have found there is a lot here, more than I had originally imagined. My findings will be delivered shortly in several future posts on the media. In addition I'll describe ways of protecting yourself from misinformation, so hang in there and don't give up without taking a look.<br />
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-87001862746837891972010-05-07T07:39:00.000-07:002010-05-07T08:44:06.750-07:00A Symphony of ScienceCreations such as the <a href="http://symphonyofscience.com/">Symphony of Science</a> make a geek feel all warm and fuzzy inside. Enjoy this combination of great science, philosopy, music, and innovative techniques in creation of these fun videos. Thankfully there are so many imaginative people in the world to keep things interesting.<br />
<a name='more'></a><br />
<a href="http://en.wikipedia.org/wiki/Carl_sagan">Carl Sagan </a>is your host. You'll have to wait for it, but MC <a href="http://en.wikipedia.org/wiki/Steven_hawking">Hawking </a>makes his entrance at 2:18. I recommend turning off the annotations, but leaving the subtitles on. The controls are found at the bottom right corner of the video.<br />
<br />
<object height="385" width="480"><param name="movie" value="http://www.youtube-nocookie.com/v/zSgiXGELjbc&hl=en_US&fs=1&"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube-nocookie.com/v/zSgiXGELjbc&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
<br />
<blockquote>
<i>If you wish to make an apple pie from scratch,<br />
You must first invent the universe.</i></blockquote>
<br />
Further viewing:<br />
<ul>
<li> Make sure to check out all the videos at <a href="http://symphonyofscience.com/">Symphony of Science</a>.</li>
</ul>
<br />Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0tag:blogger.com,1999:blog-3444671539110715411.post-23319329173552780732010-05-04T09:18:00.000-07:002010-05-07T08:32:36.884-07:00Why don’t my floating-point numbers add up?Recently happened upon this friendly site explaining the issues regarding floating-point math on binary computers and thought it useful. As I'm sure you're aware it takes special talent to take a complicated subject and present it in an easy to understand fashion. <br />
<a name='more'></a><br />
The article may be found below:<br />
<ul>
<li style="list-style-type:square"><a href="http://floating-point-gui.de/">What Every Programmer Should Know About Floating-Point Arithmetic</a></li>
</ul>
Since there is no page specifically for Python at the site, I thought I'd whip up this complement to the piece. Below is an example for the language. Note, that first half illustrates standard floating-point math and its associated issues. The second half uses the decimal module to alleviate them. The drawback, as always a cost in performance.
<br />
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
</pre></div></td><td class="code"><div class="highlight"><pre><span class="n">Python</span> <span class="mf">2.6.2</span> <span class="o">...</span>
<span class="o">>>></span>
<span class="o">>>></span> <span class="o">.</span><span class="mi">1</span> <span class="o">+</span> <span class="o">.</span><span class="mi">2</span>
<span class="mf">0.30000000000000004</span>
<span class="o">>>></span> <span class="o">.</span><span class="mi">33</span><span class="o">*</span><span class="mi">3</span>
<span class="mf">0.98999999999999999</span>
<span class="o">>>></span> <span class="kn">from</span> <span class="nn">decimal</span> <span class="kn">import</span> <span class="n">Decimal</span>
<span class="o">>>></span>
<span class="o">>>></span> <span class="n">Decimal</span><span class="p">(</span><span class="s">'.1'</span><span class="p">)</span> <span class="o">+</span> <span class="n">Decimal</span><span class="p">(</span><span class="s">'.2'</span><span class="p">)</span>
<span class="n">Decimal</span><span class="p">(</span><span class="s">'0.3'</span><span class="p">)</span>
</pre></div>
</td></tr></table>
<br />
Further Reading:<br />
<ul>
<li style="list-style-type:square">The most commonly forwarded link on the subject is Sun's much more detailed, though accessible piece. Study this one and earn your black belt (1st Dan):<br /><a href="http://docs.sun.com/source/806-3568/ncg_goldberg.html">What Every Computer Scientist Should Know About Floating-Point Arithmetic</a><br /><br /></li>
</ul>Gringo Suavehttp://www.blogger.com/profile/17499617559270771372noreply@blogger.com0