A Django site.
June 25, 2009

Kevin Kubasik
nonic
For Once I Oneder
» Django Windmill Tests – GSOC Progress Update

I feel that a status update is long overdue, but as the corpus of Windmill tests grows, so does the time it takes to run a complete instance of the regression suite. However, I do have some fun progress to report as well as a few questions/problems that are showing themselves now that all the fluff is over. First, let’s talk about the fun stuff!

I do have 3 of my major improvements/fixes/restructures to django.test somewhat complete. At the moment they are lacking most in documentation, a problem I intended to rectify later this week.

  1. Windmill Tests: Windmill test runners are nearly complete, threaded development server for AJAX widget testing complete.
  2. Code Coverage: Coverage.py support for runtests.py and management command. Extensible system is easily pluggable with other coverage systems.
  3. Test-Only Models: This is still a topic of discussion, but adding the property ‘test_models’ to a TestSuite will load and wipe the models. Has tests and limited docs.

My major TODO’s still outstanding:

  • Documentation!
  • Twill Runner Support (Utilizing the Windmill Threaded Server)
  • Windmill Admin Regression Tests (Healthy set of tests written, need to document and finish more)
  • Skip tests that are known to fail
  • Test new features/API’s

That’s it for now, more updates are available on the django-dev list!


Jeremy Robb
scothoser
Scothoser's Corner
» The Allure of Living Simply: Rethinking the Home

My household has become rather cramped of late with family living in a small(ish) home, and so my wife and I started floating ideas around on how to better manage our home.  Our own family was growing, and we felt cramped in the house. 

The first thought we had was to expand, and to expand radically.  I immediately pulled out my lab notebook and started drawing the house (more or less to scale), and adding on a radical extension that would almost double the square footage of our home.  I then took the plans to a good friend of ours that was also a general contractor, and got the crushing news:  not only would we have trouble getting a permit to build the monstrosity, but we would be looking at a cost that would be equal to what we still owed on our mortgage.  Defeated, he told me to think through it again, and get other opinions. 

So I started thinking what my requirements were, and what I wanted out of my home.  First and foremost I want more garden space, at least for a couple of peach trees and a cherry tree.  Currently I don’t have that, and I love both peaches and cherries.  I would also like to grow a number of other food products in the yard while still having a safe place for my boys to play.  I also need more space for my parents to live, as their health is starting to suffer. 

For those of you who are not familiar with the layout of my home, I have a 1,000 square foot home, with another 900 square feet in 90% finished basement.  I then have a 320 square foot covered back porch, which is attached to a 729 square foot garage (which was most likely built without a permit).  The garage collects clutter like mad because it’s easier to throw junk into the garage than throw it out, and once it’s out of sight, it’s out of mind, right? 

As it stands now, the garage is not up to city code, and as such the city will not let me make any more improvements to the property.  So what does this mean?  It means I need to tear down my garage full of clutter before I can even enclose the porch, or any other structure for more living space.  This doesn’t really bother me, though it will force me to get rid of some clutter, and make those decisions. 

My wife and I also started talking about the house itself.  Both of us realized that we will never move, and so we want to make the house as livable as possible.  With a few alterations, we could be remodel the home as is, and make it more simple.  Install radiant heating for the floors, and hardwood or tile instead of carpeting.  Both are easier to clean (particularly when trying to potty-train an autistic child), and you can make it really cozy with area rugs.  Add solar power to that, and no more need for a gas bill.  If it gets too cold, we have a fireplace and a wood stove that heats the house quite efficiently. 

Also, if we remove clutter from the rooms, the rooms will seem more open.  There are a lot of figurines, odds and ends, and bits of furniture that are just not needed in the home.  This will be a wrench for me, because I like to collect junk – you never know when you may need it later.  But it’s time I started to think about whether or not I will actually need it.  Currently I don’t, and I don’t see a foreseeable future when I would.  So, I need to just suck it up and throw out all the useless junk that I don’t need.

Anyway, both my wife and I came to the conclusion that we could save a lot of money and time by just making a few changes in how we see the space we need vs. the space we would like.  We don’t need a massive home, with 20 feet by 20 feet bedrooms, we just need to utilize our current space better.

And for my parents, I could build a simple little guest cottage for them in place of the garage, and a small workshop garage right next to it, and still have more garden space.  it all comes down to living simply, and managing the space more efficiently.


Ryan Byrd
no nic
Ryan Byrd's Tech Ramblings
» Browser Wars

firefox-girlThe browser war isn’t a real war with machine guns and artillery shells and breaking Geneva conventions, it’s more of a virtual turf war for the world’s web surfers. Let’s review the history of this nifty interweb of ours:

  • 1989: CERN researcher Tim Berners-Lee launches the first web server*. You can see that web server (and I have) because it’s just sitting on a table in one of the CERN lobby buildings. You could even steal it if you wanted (I considered it), because there is very little security– those silly Swiss!
  • Mosaic, the first graphical browser, came out a few years later, in 1993, followed by it’s cousin Netscape Navigator in 1994. Remember?
  • Microsoft, with their market-busting, monopolistic fervor, introduced Internet Explorer (IE) in 1995 and began shipping it with all version of Windows. Because it came pre-installed, it quickly grew to near complete market domination.
  • SEVEN YEARS passes with little change. Everyone had been using IE. Then, WHAMMO! Firefox (www.getfirefox.com). Firefox is available on Linux, Mac and PCs. It’s fast, has lots of awesome plugins and TABS!
  • A year or so passes and Microsoft plays catch up and finally releases a tabbed version of IE. Other browsers appear (like Google Chrome.)

browser_warHow goes the fierce, non-violent, nerdy war? As of May 2009, the browser market share looks like:
IE7 21.3%
IE6 14.5%
IE8 5.2%
FF 47.7
Chrome 5.5%
Safari 3.0%
Opera 2.2%

So, what’s the next step? Better tabs. So good ol’ Mozilla (makers of Firefox) are having a competition to redesign the tabbing experience.

My good buddy, Grady, a world-class graphic designer, has created a new paradigm for tabbing, he calls it favitabs, (http://www.favitabs.com). Today starts the voting for the people’s choice award, and anyone can vote: http://design-challenge.mozilla.com/summer09/showcase.php

The voting ends of July 5th, so if you want to be part of history, if you think Favitabs is an awesome idea, then click on over to the design challenge and vote.

* Sir Tim also came up with the crazy http:// prefix for web addresses. He is said to regret that decision.

June 23, 2009

Kevin Kubasik
nonic
For Once I Oneder
» Wordpress Upgrade

I just upgraded to the latest Wordpress release (2.8!) let me know if you have any issues viewing the site!

June 22, 2009

Ryan Byrd
no nic
Ryan Byrd's Tech Ramblings
» Load Balancing for Fun and Profit

If you’re like me, and goodness who isn’t?!?, you probably run a few high bandwidth sites. You probably worry a lot about reliability and scalability and fault tolerance. You’ve maybe looked into hardware load balancers (like F5’s BigIP), only to be discouraged by the hefty price tag: 15k and up. Don’t misunderstand– if you’ve got the cash, you can’t beat the BigIP in terms of reliability and features and ease of use. But if your blog isn’t exactly paying for itself yet, you’ll need to consider other options. A lot of people like the idea of DNS load balancing. That’s where you add a bunch of A records for your domain to different IP addresses. The DNS server will then serve out the IPs in a round-robin sort of manner. It’s a good way to spread the web traffic to a group of web servers. But if a server goes down, you’ll have to remove it from your DNS and wait for the TTL to expire before things are back up (of course, you could power down the machine and alias the IP address to another server in the same network…)

But it’s clunky because the only balancing is round robin and there are no health checks involved. Fortunately, you have alternatives. I’ll present one of those options here: load balancing with mod_proxy. mod_proxy is an apache module. In the diagram to the above-right you can see my setup. I have two load balancers, two web servers and two databases. On the two load balancers, I’m running apache with the mod_proxy and mod_proxy_balancer. There is a UDP heartbeat between the two. Apache is started on only one of those servers and the virtual IP (VIP) is aliased to that one. If that machine goes off line, the second load balancer will grab the VIP and start up apache.

And then we have the web servers. The active load balancer will round robin serve up pages to the web servers. If one of the web servers goes off line, the load balancer detects that and will take that web server out of the rotation.

And, yes, I set it all up and it works splendidly. Yes, you can put the load balancers and web servers on two machines instead of four. Yes, you’ll need to keep sessions in MySQL to prevent loss of session info during a failover. You can check which load balancer is active by watching ifconfig or ps -aux|grep httpd. If things aren’t working, check /var/log/ha-log, and if there are errors, it will tell you the command it’s trying to run. run that command to see the error message.

I haven’t talked about how to scale the MySQL tier. There are a number of solutions: master/slave, mysql proxy, active/active or mysql cluster. More about that later.

There are a number of conf files you’ll need to set up to get this working:

authkeys

auth 2
2 sha1 TOPSECRETWORD

ha.cf

logfile /var/log/ha-log
bcast eth0
keepalive 2
warntime 5
deadtime 10
initdead 20
udpport 694
auto_failback yes
node lb1
node lb2
uuidfrom nodename
respawn hacluster /usr/lib/heartbeat/ipfail

haresources (Must be EXACTLY the SAME ON BOTH lb1 and lb2!!!)

lb1 10.1.1.19 httpd

http.conf

Listen 10.1.1.19:80
…
ProxyRequests Off
 
<Location /balancer-manager>
SetHandler balancer-manager
Order deny,allow
Allow from all
</Location>
 
<Proxy balancer://mycluster>
# cluster member 1
BalancerMember http://10.3.1.31:80 route=lb1
# cluster member 2
BalancerMember http://10.3.1.32:80 route=lb2
</Proxy>
 
ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/ lbmethod=byrequests
ProxyPassReverse / http://10.3.1.31
ProxyPassReverse / http://10.3.1.32
#ProxyTimeout 10
 
<VirtualHost *:80>
ServerName intranet.example.com
UseCanonicalName On
 
DocumentRoot /var/www/html
<Directory "/var/www/html">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
 
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^(127.0.0.1)
RewriteRule ^(/server-status) $1 [H=server-status,L]
 
# Proxy the rest to the load balancer
RewriteRule ^/(.*)$ balancer://mycluster%{REQUEST_URI} [P,QSA,L]
 
ErrorLog /var/log/httpd/http_log_error
CustomLog /var/log/httpd/http_log combined
 
# Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
 
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
</VirtualHost>

iptables

...
-A RH-Firewall-1-INPUT -m state –state NEW -m udp -p udp –dport 694 -j ACCEPT
…

ldirectord.cf

checktimeout=10
checkinterval=2
autoreload=no
logfile="/var/log/ldirectord.log"
logfile="local0"
quiescent=yes
 
virtual=10.1.1.19:80
       fallback=127.0.0.1:80
       real=10.1.1.21:80 masq
       real=10.1.1.22:80 masq
       service=http
       request="index.html"
       receive="Test Page"
       scheduler=rr
       protocol=tcp
       checktype=negotiate

These reference pages are very useful:

June 16, 2009

Hans Fugal
no nic
The Fugue
» Why I chose Facebook over Google

May was a busy month, and not in a “fast-track-to-finish-dissertation” kind of way. I zoomed to Florida for a family reunion, then zoomed across the country to San Fransisco for an interview at Facebook, then the next week zoomed over to NYC for an interview at Google in their Manhattan office. Then, lest the last week in May should feel left out, I zoomed up to Utah for an interview with AST. As May drew to a close and June entered the scene, I found myself with four offers of employment, including Google and Facebook (Boeing just did a phone interview). Wow! I was feeling pretty pleased with myself.

Now dear casual reader from yonder internet, I know what you’re thinking. It’s exactly what I would have thought a few months ago. “No-brainer. Work for Google.” But I found myself perplexingly unable to decide between Google and Facebook. It didn’t help that Google was in New York and my wife wasn’t keen on New York, and that the Google position offered was a Site Reliability Engineer (SRE) which is, to grossly oversimplify, a glorified systems programmer. Not faced with an attractive competing offer like the one from Facebook, I’d have been headed to Manhattan to be an SRE in a heartbeat. But as it was I was torn.

I applied for the Facebook position on a whim. I had been on Facebook only a month or two and I noticed an ad on the side about how they were hiring. I clicked on it, looked at their careers page for awhile, liked what I saw, and decided to apply for a Machine Learning Engineer position. I came home and told my wife, who was instantly convinced I had lost my marbles. She is not a programmer, so how could she know that although I’m not a big social network guy and had only grudgingly signed up for Facebook a month or two before, I could be intensely interested in working on such a site.

Theoretically speaking, I love networks, and that includes graph theory, computer networks, and yes even social networks. I knew Facebook problems would be about networks and about scale. They would be hard problems. They would be fun problems. The perks page looked good, and I think it would be fun to be in Silicon Valley. So I applied.

Facebook called and had me do one of their pre-screening programming puzzles (you can enjoy them even if you’re not being considered for employment). I got a little obsessed and did 3 over the better part of a week. Then there was a phone screen, and then the invitation to interview on-site (This all happened over several weeks time, of course, and more or less in parallel with a similar process for Google, except that Google didn’t have a puzzle step).

I’ll skip to the end, lest I bore you. Facebook continually impressed me the more I interacted with them and the more I saw. I was similarily surprised at how enjoyable, useful, and private Facebook was as a user since I had signed up. Facebook skyrocketed from just another one of those pesky social networking sites to a daily habit and potential employer in a few short months.

Still, it can’t compare to Google right? Well, actually they try very hard to compare to Google. It’s quite obvious that most of the perks and benefits are directly inspired by Google’s, compensation was comparable, and I found that they have smart people working on hard problems just like Google. In addition, there are two things they have that Google doesn’t anymore: they’re still small and they’re pre-IPO. Of course, Google has more smart people and Facebook is more-or-less a one-trick pony. Publishing would probably be easier at Google. Here I go again… I was back and forth for a solid week. It drove me and my wife crazy. I talked to people at Facebook who had been at Google (at my request). I talked to people at Google. I talked to friends and family. I tried every decision making trick in the book. Both sides sweetened the deal a bit to make it easier for me to choose them (Google switched the offer to be in Mountain View as a Software Engineer, Facebook offered a bit more money). I just couldn’t make up my mind.

Well finally I did, and this is what it came down to: time off, impact, and stock.

Although both were generous with paid time off (PTO) compared to most US companies, Facebook offered more, especially in the area of paternity leave (my wife is expecting). As much as I anticipate enjoying either job, I enjoy being at home or on vacation with my family more.

Facebook is small—they’re hiring like crazy because they’re smaller than they want to be. Because of that, I feel that my wacky background in system administration, agileish pragmatic open-source programming, and high-brow CS theory and research would be more broadly brought to bear than in some team at Google responsible for some small part of one of the many wonderful Google products. I would have more impact—not on the world at large but on the thing that we are doing. Then there’s also the draw of quick seniority in a small and fast-growing company.

Finally, although both companies offered restricted stock units to vest over 4 years, Facebook’s offering has the potential to be worth several times what Google’s offering would. Or, Facebook’s offering could be worth about what Google’s would be. Or, in a really really bad scenario, worth less. I ran the numbers, pulled some probabilities out of the air, and decided at least as good as Google and possibly much better was the most likely scenario. Since they’re RSUs and not options, the only risk is in making less extra cash than I would have made at the other company. Google was the safer choice, Facebook the more potentially lucrative. I tried to leave this out of the decision making process as much as possible, because I didn’t want my decision to be about money. I wanted it to be about the work. But I have to admit there’s a draw here.

I believe more strongly now than I did before that Google is a fantastic place to work, and I would reapply there in a heartbeat down the road if my path takes me there. I wish I could just be in two places at once and work at both, at least long enough to know for sure where I really want to be. But life doesn’t work that way. I’ve decided to take the path that seems the most exciting and unsure out of a sheer sense of adventure. Google will be there in a few years if I want to reapply, and they may even want me then as they do now. The time to really make a difference at Facebook is now, while they’re small.

You may think I’m crazy to turn down Google. I think that sometimes too. One thing is certain: the next few years will be an amazing adventure that I never dared dream would come to me. Thanks to everyone who has helped me to this point in my life, especially my loving and supportive wife and kids, my parents who taught me to love learning, and my brothers who “let” me hog the computer when we were young (ha!).

Well, I think I have a dissertation lying around here that needs finishing.

» Firefox book-like bookmarks

Can anyone point me to a trick or extension that makes bookmarks more like, um, bookmarks? You know, in the real world, when you’re reading a book and you decide to stop reading so you can go get a drink of water or go to bed or something, you put in a bookmark. That bookmark is only good until the next time you read—then you’ll put the bookmark in a different place. Web “bookmarks” are more like gluing tongue depressors to the book to help you find the book later.

Use case: you’re reading a web comic, or an online book, or some other serial content that takes days or months to go through. You want a very simple way to update the bookmark whenever you stop. Ideally, it would be automatic.

June 15, 2009

Jeremy Robb
scothoser
Scothoser's Corner
» Cream Crowdie: A Scottish Parfait

At the Scottish Festival on Saturday, I had a chance to try a tasty Scottish dessert that turned out to be very easy to make.  It’s called a Cream Crowdie, and is a parfait, that is a layered dessert with alternating fruit and cream layers.  The cream was whipped to hard peaks, and sweetened with honey instead of sugar.  Also in the cream was oatmeal, adding a layer of flavor and texture that took me by surprise.  The fruit layer was actually a raspberry topping that turned out to be too rich for me. 

It was so good that my wife and I decided to try to make it ourselves.  Instead of raspberry topping we made raspberry Jell-O, which made less of a sugar rush than the topping.  I made the Jell-O according to the typical recipe, and it set up as any Jell-O would. 

The cream I made this way:

1 cup heavy whipping cream
1 tbsp honey
1/4 cup oatmeal

I first combined the honey and the whipping cream together, and whipped it to hard peaks for stiffness.  I then folded in the oatmeal.  The cream was good, but the oatmeal hadn’t absorbed much of the liquid as I had hoped.  Next time I make it I’ll soak the oatmeal in the cream first for a few hours, and then whip up the cream with the oatmeal. 

Anyway, the proportions above would make four or five small Crowdies in a small container.  You can easily substitute the gelatin for real fruit if you like.  I would have this time around, but my raspberries haven’t yet ripened.

» Fear and Autism

The Examiner had a really good article outlining the prevalence of fear within the autistic mind.  Quoting Temple Grandin, perhaps the most well known scientist with autism, they mention that daily tasks fill the autistic mind with fear.

Imagine, if you will, you are in a closed room with a lot of people.  Then, suddenly, one of the guests tell you they let loose several hundred snakes in the room.  Instantly you would be constantly distracted and aware of any slither, movement, or irregularity in the room.  Because of this, you will be distracted, and possibly even considered rude by other people in the room. 

That, according to Temple Grandin, is exactly what autism is.  Autism is all about the detail, but as an autistic person experiences the world around them, the details of every day tasks become at once overwhelming.  Walking becomes a complicated process of moving the joints just right, keeping balance by moving other joints and shifting weight, and the reaction of nerves to let you know you have accomplished your step.  Putting an object away becomes a complicated process of grasping the object with just enough pressure to keep from damaging it, lifting it with just enough force to still keep a grasp on it, and then walking with that same complex process to the place to put it away.  Then once you start the process of putting it away, how should it be placed?  The details becoming quickly overwhelming, filling a person with autism with a fear of attempting something so complicated. 

This is why an autistic person does not become "cured", whether through intensive therapy or magically with drugs or chants.  The human mind can work around that fear, manage it and overcome it, and as such appear to be normal, but the threat of panic attacks and failing at the task is ever present. 

When I was growing up, particularly when I moved from elementary to junior high school, I started experiencing panic attacks regularly.  I didn’t know what they were, or what they were caused by, until I graduated from high school.  It was then that I realized that the panic attacks came when I would over-think a task.  I would break it down into several pieces.  All of a sudden doing homework became so overwhelming I couldn’t start.  Studying for a test was so complicated, because of the unknown variables, I couldn’t focus.  It wasn’t until I learned some relaxation techniques that took me away from the task for a minute that I learned I could deal with the fear, and accomplish the task.  If it were that bad for me as not being diagnosed on the spectrum, how bad can it be for someone on the spectrum?

So how to we help those with Autism overcome the fear?  Repetition, routine, and a supportive environment.  Once they know they can accomplish a task, they can feel comfortable with it.  Specialization is perfect for someone with Autism because of the focus in detail and process.  Help them identify the process, and each part of the process, within a comforting and safe environment.

June 12, 2009

Jeremy Robb
scothoser
Scothoser's Corner
» June 12th and 13th: Utah Scottish Association Highland Games & Scottish Festival

Tonight and tomorrow mark the Annual Utah Scottish Association Highland Games & Scottish Festival being held at Thanksgiving Point in Lehi.  This is an annual event for my family, as we go to walk the vendors, hear the pipes, watch the events, get free stuff, and eat haggis (okay, so I’m the only one that eats the stuff, but it’s still cool!).  If you are interested in connecting with your Scottish side, come to the festivities!  More details can be found at http://utahscots.org. 

You may even see me there, by the MacFarlane clan booth, or around about.  While there, eat some haggis, get a strawberry and clotted cream tart, and a good bottle of ginger beer.  If you have a kilt, wear it! 

See you there, and Loch Sloy, MacFarlanes!  Loch Sloy!


Scott Morris
nexangelus
OpenSUSE Linux Rants
» Reset MySQL root Password in Linux

Stolen From Here

Reset Forgotten MySQL Root Password

Have you ever forgotten the root password on one of your MySQL servers? No? Well maybe I’m not as perfect as you. This is a quick h00tow (how to) reset your MySQL root password. It does require root access on your server. If you have forgotten that password wait for another article. Original article posted on reset mysql root password.

First things first. Log in as root and stop the mysql daemon. Now lets start up the mysql daemon and skip the grant tables which store the passwords.

mysqld_safe –skip-grant-tables

You should see mysqld start up successfully. If not, well you have bigger issues. Now you should be able to connect to mysql without a password.

mysql –user=root mysql

update user set Password=PASSWORD(’new-password’) where user=’root’;
flush privileges;
exit;

Now kill your running mysqld, then restart it normally. You should be good to go. Try not to forget your password again.

May 27, 2009

Kevin Kubasik
nonic
For Once I Oneder
» Google Summer of Code 2009 - Django Testing - Coding Day 1

Among all the excitement of the past few weeks, the start of GSOC appears to have snuck up on me! Started work today on the coverage runner. My progress is easily followed on my GitHub Django fork (until we get real SVN branches). Can’t wait to start posting some real results!

April 30, 2009

Jeremy Robb
scothoser
Scothoser's Corner
» Last Day of Autism Awareness Month: In the News and My Son’s Progress

This month has been amazing.  Not only have more people been aware of Autism through the news and events, but my son’s life has been significantly changed this month in my eyes. 

First, the news.  I have posted many times my assertion that Autism is caused by genetics, and that the genetic link will be established.  Well, as of this week, the Children’s Hospital of Pennsylvania, along with UCLA, Penn State, and a number of other institutions, reported two papers that has found one specific genetic marker that is common within autistic people, and another paper marking 13 other more rare genetic markers that are also strongly linked with Autism.  I was previously aware of 10, but it seems that another 4 has been added to the mix. 

It’s great news, because now perhaps the Autism community can unify and become strong enough to get proper legislation through Congressional Committees.  It also means that genetic therapies may be coming down the pipe sometime in the next few decades. 

Also in the news, celebrities have been spreading their opinions regarding the causes of Autism, and how they feel the community could be best served.  I’m glad they feel so strongly regarding the theories that have been thrown about by people with no medical or neuropsychological backgrounds.  It’s a great opportunity to learn and share, perhaps to get them on the side of Science and research instead of anecdotes and unproven therapies. 

But now to the more important detail (for me at least):  My son’s progress.  To date he has been reluctant to be verbal, preferring to communicate through looks and by independently working out a solution for himself.  While I’m proud that his brain works so well in the problem-solving area, I would like him to start focusing on speaking. 

Just last night, he was playing with some plastic golf balls.  I wanted me to pull them out for him, so as I did I would hold one up and say "ball".  I then made a song out of the one word while bouncing the ball in the air, to help him connect the word with the object.  Within a few minutes, he said "ball", prompting excitement between my wife, my son, and me. 

Later that night my son decided to undress himself.  This usually means that his pull-up has been soiled, and he needed a change.  But the pull-up was still clean and dry, so I took him to the bathroom and stood him in front of the toilet.  It took a couple of tries, but he used the toilet, shut the lid (a little loudly, but I’ll take what I can get), and flushed.  I was so proud!  He is in the process of being potty trained, and I think we may have him trained by the time he starts Kindergarten. 

These are all really huge events in my son’s life, both the scientific discoveries being made for Autism, and his progression to mainstreaming within society.  He will always be apart from society at some level, and I’m fully embracing that fact.  He will instead have a different way of approaching ideas and concepts.

So that is the news for the end of the month.  I had hoped that some serious Autism legislation would have come from the US Congress, but it seems those bills are all still in Committee.  It’s disappointing, because with the growing need for real action in helping parents manage autism in their lives during this critical time, Congress hasn’t acted soon enough.  Well, there are more months in the year, let’s see if anything does happen. 

April 28, 2009

Jeremy Robb
scothoser
Scothoser's Corner
» Testing Qumana for Mac

I’ve found myself wanting to find a decent blogging program out there that will allow me to manage the blogs that I currently have and write blog posts offline.  It’s helpful in that I am able to provide more review time to my blog posts while also having several pending. 

There are quite a few offline editors for the Mac, though most are paid apps.  Being the good Scot that I am, I like to find those services that are free.  Hence, the reason why I am testing out this particular application.  We will see how it goes. 

» Youth Program Still Looking for Dark Basic Programming Instructor

The University of Utah’s Youth program is looking for an instructor for Dark Basic programming.  The class is for students between the ages of 13 and 17, all in the afternoon. The details are here: 

Video Game Programming I with Dark Basic (Age 13-17)

If you’ve always wanted to create your own video games and never knew how, this class is for you, even if you’ve never programmed before! DarkBasic is an introductory-level computer programming language that focuses on basic concepts and 2D games. Learn the fundamentals of computer programming, such as bitmaps, sprites, input devices, sound effects, music, and movies. Course cost includes a DarkBasic book with a CD-ROM trial version of the language compiler.

YETEC 115-001 • MTWThF, Jul 27-31 • 1:00-4:00 PM
LOCATION: Annex 2169, Campus • SLC 

 

YETEC 115-002 • MTWThF, Aug 3-7 • 1:00-4:00 PM
LOCATION: Annex 2169, Campus • SLC

 

 

Video Game Programming II with Dark Basic (Age 13-17)

Expand your video game programming skills. This advanced class will focus more on game planning, code management, and 3D games. Learn the more challenging aspects of programming and use your imagination to create a variety of fantastic games.

 

YETEC 116-001 • MTWThF, Aug 10-14 • 1:00-4:00 PM
LOCATION: Annex 2169, Campus • SLC

If you have any interest at all, or know of anyone that would be interested and needs a little extra cash, please contact Claire Turner: cturner at aoce dot utah dot edu.  Thanks!

April 24, 2009

Hans Fugal
no nic
The Fugue
» Crunch Time

I’ve been writing my dissertation in earnest for a couple of months now, for some definition of in earnest. As expected, things have come up to slow the process down—research that after closer scrutiny needed refinement, job hunting, sickness (my family and then I got the flu), presenting at a conference (remotely), some procrastination and writer’s block, and a general inability to write faster than is humanly possible. Just in case you were wondering, the rule of thumb to multiply coding estimates by 3 applies to writing as well.

That said, I’m still on track to graduate in August and making good progress. But because I don’t want that to change, and because I don’t know how the next few months will pan out with the job hunt and potential on-site interviews, I am going into super crunch mode. It’s like when they tried to make Knight Rider more exciting by modifying the car by adding extra drag so it would go faster. But not as glamorous.

This means that during the day when I should be working I won’t be haunting the usual haunts: IRC, Instant Messenger, email. I will of course check my email at least a few times a day, but when I’m writing my MUA will be closed. I will keep at least Jabber (Google Talk) online, set as away, as I have done previously. All this is not because I want to hide from you but because I want to minimize the event-based distraction mode I sometimes find myself in—constantly jumping between IRC, IM, email, social networks, RSS, etc. looking for the next communication task. If you do need to contact me urgently don’t hesitate to hit me up where you find me, or in the worst case talk to Erin, who will know how to get ahold of me.

While I’m on the subject, I’ll bore you with the methodology I’m employing in the never-ending battle against procrastination. First and most importantly, I have a goal to write 15 minutes every day, as a bare minimum. Even on otherwise-unproductive days (whatever the reason) I can squeeze in 15 minutes which means at least a little progress. More importantly, it means my mind keeps engaged on the problem and my dissertation doesn’t get swapped out. I’ve been doing this since January and it has made a huge difference in my productivity. I highly recommend it to anyone. For more information, check out the workshop homepage, read the summary, or grab the book. Or just write 15 minutes a day and let your success speak for itself.

15 minutes a day is great, but when you’re writing a dissertation and nothing else, it’s not sufficient. So I’ve had to kick it up a notch. Eddie Jung has some good advice: “Don’t get distracted. Keep starting. That’s all.” We’ve already talked about the public face of my efforts to not get distracted. I also have a plan for doing the “keep starting” part, which is I think the hardest part. Once I’m started and in the zone, you could be screaming my name in IRC or calling me on the phone and I won’t even notice let alone be distracted. So I think it boils down to “Keep starting. That is all.”

So how does one keep starting something that is frequently uninviting? “Just do it,” I can hear you say. That’s easy for a construction worker or someone doing something physical, but it’s hard for those of us who work with our brains, especially creative work. Because the very instrument we are trying to bring to bear is the instrument that is so easily distracted.

I like the metaphor of a train getting started. It’s big, it’s heavy, and at first the wheels spin and things move very slowly. Some glorious days, I wake up already rolling down the tracks. Maybe I went to sleep at the top of a hill, I don’t know, but I’m off and running before I’ve finished rubbing my eyes and the day is an outstanding success. Other days I sit down and keep trying to start without ever starting.

My plan to keep starting is to set up a ritual. A personal algorithm, if you will, for beginning to write. Just as the dog turns around three times before lying down to sleep. It has to be something that I can consciously do to trigger myself to begin writing. It has to be a trigger, and facilitate writing. It has to be portable—I have to be able to do it on my couch, in my “office” (the rocking chair in the kid’s room), at school in my real office, in the library (sometimes when I’m having a hard time focusing going to the library for a change of scenery helps), a café (ditto, but close to home), or just about anywhere. It has to be quick, like turning around three times and not like doing 30 minutes of yoga and upside-down meditation or something.

I have no idea if it will work, but here’s what I came up with: prep, timer, visualize. By prep I mean close my email client, IRC, etc., get situated, and get my water bottle filled if necessary. Minimize distractions and optimize the environment. By timer I mean grab my timer and set it for 15 minutes or whatever minumum chunk of time I feel up to. When the timer goes off, I can take a short break if I need to. It’s my sanity escape hatch—you can do anything for 15 minutes, even write. It’s also my distraction safety net—if the timer goes off and I am not writing, I got distracted and it’s time to start over. The visualization step is to close my eyes and engage my brain on the task, and not open my eyes until I have an action to perform. With my eyes closed, none of my distractions can reach me even if they made it through the cracks.

I have high hopes for my new plan. I know some parts work already, and I’m optimistic about the rest. I think it’s simple enough to actually work. Maybe my sharing it with you will inspire you to refine your process a little bit.

How do you avoid distractions and keep starting?

April 23, 2009

Jeremy Robb
scothoser
Scothoser's Corner
» Migration Failure: Blog is Back Up

Obviously, because you can read this, you know that my blog is back in service.  I tried migrating the blog to another host, and the old saying, “you get what you pay for” rung true.  The free host site, Hostrator.com, is completely down, taking my new blog location with it.  So, I’m back with Dreamhost, humble and repentant, and I was able to talk my wife into letting me renew my services with them.  

So, everything will be working as normal, and for those of you waiting for new posts, their will be another couple coming today (I’ve been saving up ^_^).  I have one for Autism Awareness Month, and one for Apple WebMail management.  Until then, let me just say how nice it is to be back.  ^_^

April 21, 2009

Hans Fugal
no nic
The Fugue
» HeadBlade

Reports of me regrowing my hair have been greatly exaggerated. Fact is, I went about a week or maybe two and decided I really like being bald, and haven’t looked back since.

Not long after I really got the hang of using the HeadBlade, and shaving every day if I so choose isn’t a big deal. I sometimes skip a day or even two, but usually I shave every day.

If you’re getting started with the HeadBlade, or thinking about it, here’s some tips.

First, prep is important. I get my head wet with hot water when I first step into the shower, and keep it wet with an occasional splash while I do the whole washing thing. Then I lather up some shaving soap (rubbing it right on my pate) until it’s good and slick.

Using the HeadBlade is basically like they say in HeadBlade 101. I would just mention that if you have been shaving your face with a safety razor or a straight razor, “no pressure” is actually an overstatement. You need some pressure on the front—just enough to keep contact with the skin, no more—otherwise you don’t shave anything. Compared to how most guys shave, this really does feel like “no pressure.” If at any time you get razor burn or uncomfortable chafing, you probably used too much pressure. If you go over and over your head and nothing happens, you used too little.

The real key to the HeadBlade is not using the blades they sell for it. Because of the way the HeadBlade works, which is very similar to properly using a safety razor (it’s all about angle), the more blades you have the worse shave you get. Your head is bumpy, and to fit the curves you need a VW bug not a Cadillac. More blades will just make the shave rougher and less close. It’s also important to steer clear of those rubber things they put on most fancy cartridge blades because they act like brakes forcing you to use more pressure on the front.

They don’t make cartridges with just one blade, that I have been able to find, so you’ll have to use two blades. Fortunately the ones that work best are also the cheapest. There are two options: the Atra blades and the Sensor blades (not Sensor Excel). The Atra are cheaper (especially the knock-offs, like the Personna, which works fabulously) but they tend to clog easier (the back isn’t open) and the blades don’t flex like the Sensor blades do. But they work much better than the fancy rubber bumper triple blade cartridges. I’ve had good luck with the Sensor blades but my sensor adaptor broke and I have to order a new one, and the Personna Atra-compatible blades are so cheap I had to see how they worked. They give me an excellent close shave with little effort, just like the Sensor blades, and they’re cheaper.

So if you found the HeadBlade lacking, try another blade. Any Atra or Sensor compatible blade works (with the adaptors included in the HeadBlade package), and if you have a favorite for your face try it in the HeadBlade, but do try one with only 2 blades and no rubber bumper because I think you’ll be amazed.


Kevin Kubasik
nonic
For Once I Oneder
» Google Summer of Code 2009: Django Testing Updates!

So my Google Summer of Code: 2009 project proposal was accepted! I will be working on a 2 phase project revolving around Django’s testing framework, and regression suite. Most notebly, I plan to:

  • Implement Windmill test coverage for Django’s Infamous contrib.admin
  • Provide several missing features/conveniences to the Django testing tools

While it may not be the most glamorous project, I’m excited for it! When paired with my epic mentors, (the ever-infamous Eric Holscher and notorious George Song) it looks to be a solid summer. You can expect me to post weekly status updates here, as well as anything else relevant to the project. As my ‘get to know Django and make sure I can conform with coding standards etc.’ ticket, I’m planning to add an assertion which checks for dead links after template rendering. Or, as its better known, Django Ticket #5418.

I want to also give a quick thanks to Jacob Kaplan-Moss, Eric Holscher, Jannis Leidel and all the other PyCon 2009 Sprinters who helped me create the proposal.


=Utah Open Source=
Utah Open Source
Utah Open Source Blog
» Hello world!

Welcome to Utos.org. This is your first post. Edit or delete it, then start blogging!

April 10, 2009

Hans Fugal
no nic
The Fugue
» Kill your Kids

Not literally, of course. This is programming talk, those of you who aren’t programmers can let your eyes glaze over.

I wanted a script to start a bunch of little servers, then wait around for them to finish or when the user interrupts with Ctrl-C, clean up the servers instead of orphaning them. I wanted to propagate the SIGINT to the child processes. I wanted to kill the kids.

The simple way, if you just want to make sure the kids are killed and you don’t care how:

sleep 300 &
# etc.
trap "kill $(echo $(jobs -p)) 2>/dev/null" EXIT
wait

If you only want to trap SIGINT and want to make sure you send SIGINT (not SIGKILL) to the children, then you want to do something like:

trap "kill -INT $(echo $(jobs -p)) 2>/dev/null" INT
wait

Update: I was asked by a shell scripting guru why I needed to do $(echo $(jobs -p)) and not just $(jobs -p). I intended to cover that but forgot. The reason is that $(jobs -p) has newlines and while that’s not usually a problem it is in a trap statement, because it’s evaluated at creation time not at run time. It also means that processes created after you create the trap wouldn’t be killed. Then, he suggested a function instead. Pure brilliance. Where does he come up with these things? Here’s the improved version:

function killkids() { kill $(jobs -p); }
trap "killkids" EXIT

You can still redirect stderr if you want to, but the reason I was directing stderr was because some of the kids may have already died (early evaluation remember) and then kill would needlessly complain. This way, it kills all the kids that are still alive, none more none less.

April 8, 2009

Nathan Blackham
nonic
Dark Pork
» Looking for New Blog Software

So I am going to be moving my blog to the “cloud.”  As such I am looking which blog software to use.  I would need something that is light weight and doesn’t do a whole lot of processing (thus having cheaper hosting).  Anyone done any comparisons or have any recommendations, Let me know.

Thanks.

April 2, 2009

Hans Fugal
no nic
The Fugue
» DFT Magnitude/Power Spectra

I often get confused about the scaling of magnitude and power spectra. I think I’ve worked it out so I’m puttin it here for my own benefit, and maybe the benefit of someone on the internet. If I’m wrong, please tell me.

Let’s take a unit-amplitude sinusoid at 100 Hz, and do a Fourier transform. If we look at the amplitude we’d get two components at 100 Hz and -100 Hz, each with amplitude 1/2. Something like this.

Now, if we do the same with a DFT we will get basically the same thing, except we’ll see the effects of discretization of course. But depending on which variation of the DFT you’re using, the magnitude of the components will be either about 1/2 or about N/2. The difference is, of course, the 1/N factor that you included or left out. In the case of the fft function in Octave (and I assume MATLAB), it’s without the 1/N factor.
max(abs(fft(x,1024)))
ans = 443.23

The power spectrum is the magnitude spectrum squared. abs(fft(x)).^2 or (abs(fft(x))/N).^2. Why would you want to square it? Well there are of course many reasons but the nature of audio signals makes most of the ones I know about moot. Furthermore the relative shape of the power spectrum and the magnitude spectrum is the same.

Try this. Take an audio signal (something more interesting than a single sinusoid) and plot the magnitude spectrum in dB, then plot the power spectrum also in dB, e.g.
plot(20*log10(abs(fft(x))))
figure
plot(20*log10(abs(fft(x)).^2))

They have a different scale, but they have the same shape. If you were doing something like peak-picking, it wouldn’t matter which you used if you’re working in dB.

March 26, 2009

Ryan Byrd
no nic
Ryan Byrd's Tech Ramblings
» More great snippets from resumes

The open position is for a senior technical engineer. Requirements include a bachelors in CS or IT and 5 years experience in enterprise development.

I got a resume today from an individual applying for the position, with the following:

Skills & Training:

  • Hostage Negotiations Training
  • Security Officer Basic Training Course
  • Tactical Site Survey team member
  • Massage Therapy Training
  • Electrocardiograph Technician
  • Survivalist & Emergency Preparedness Instructor
  • Primitive Skills Specialist (bow making, pottery, tanning, weaving, etc )
  • Published a fishing news letter and report that I emailed to over 200 people

Interests:

  • Singing and song writing
  • Studying plant, animal, survival, and medical reference materials
  • Martial arts and weapons study
  • Ancient weapons collecting
  • Handicrafts (leatherworking, woodworking, metalworking)
  • Writing poems and stories

March 23, 2009

Ryan Byrd
no nic
Ryan Byrd's Tech Ramblings
» Resume Building

I’ve been interviewing technical people for an open support engineer position these last few weeks. As a consequence, I’ve scanned through at least a hundred resumes, searching for good candidates. Today I found these two lines on a resume and I thought I’d include them below for your benefit:

(under Expertise/Certifications)

  • Programming Languages: BASIC (similar to C++), PERL, C++, ObjectRexx
  • Database web programming (WEBWIZARD)

Thoughts?

March 22, 2009

Hans Fugal
no nic
The Fugue
» An English Muffin Investigation

Recipe writers of the world, pay attention! This is an English Muffin (Thomas brand):
TopBottomSideCrumb

See those big holes? (”Nooks and crannies”) See how they’re not just holes, they’re big holes? It ain’t an English Muffin unless it has those big holes. I’ve tried a few recipes and passed on others that look like more of the same. I get results that range from “thick pancakes” to “bread”. Some had a few itty bitty bubbles. None were anywhere close to the real thing. This photo is typical of the results I’ve gotten (the ones that ended up edible in the first place). The ones on the left are real, the ones on the thick sweet pancake things I made.

Side-by-side

Now, I’m going to do something unheard of right here on this very blog. I’m going to apply science! We’re going to figure out what a successful recipe would have to look like. In part two, I will share with you the recipe that actually works.

Look at those pictures again. I want to point out a few important features. First, the bottom of the muffin is flatter than the top, and evenly brown. Also, it’s coated with farina. Second, the top is uneven but also browned. Third, the muffin is not perfectly round, and the sides are not neatly vertical. Finally, there’s some creases on the side that almost look like folding.

Here’s what these clues tell me. The imperfect circle and sloping sides rule out a batter baked in a ring. Sorry, AB. The flat bottom and browned but not flat top tells us they’re cooked on a griddle not baked in an oven—this is one thing most recipes get right. (Actually, this article about Thomas’ oven alludes to a brick oven—perhaps they were cooked in a brick oven and flipped. That wouldn’t be entirely unlike cooking on a griddle but it could have implications. Something to keep in mind.)

The fact that they are good circles and the bottom is so neatly flat, and not too tall, tells me the dough is quite slack. Maybe even a thick batter. But the farina coating I think is a telling sign. I bet they proof the dough and the farina makes it easy to get the muffin onto the griddle without collapsing it (similar to what you do to keep pizza from sticking to the peel). Of course the biggest hint for a slack dough is the big holes. You don’t get holes like that from a stiff dough, and probably not easily from a batter. Holes in a batter, e.g. introduced by baking powder, give you pancake-like texture. These holes are more like artisan bread holes. These are holes you get from gluten structure and yeast. Another good hint is this quote from the Thomas FAQ:

What is on the bottom of our Thomas’ English Muffins?
The small white particles on the bottom of THOMAS’® English Muffins are farina. This is used to prevent the doughball from sticking to the oven plate and also to give the product its unique taste.

The creases are probably from when they’re flipped. The uneven texture means the top wasn’t liquid, but the creases mean it wasn’t quite cooked through when turned.

Finally let’s consider taste. (You’ll have to take my word for it, I can’t take pictures of taste.) They taste more or less like bread. Not a sweet bread, not a rich bread, not a sour bread. Just bread. They’re a little chewy but not like a bagel. Although they’re not sour, there are some subtle sour notes especially when toasted. This isn’t surprising if you look at the ingredients list:

INGREDIENTS: UNBLEACHED ENRICHED WHEAT FLOUR [...], WATER, FARINA, YEAST, SUGAR, SALT, SOYBEAN OIL, PRESERVATIVES (…), GRAIN VINEGAR, MONOGLYCERIDES, NONFAT MILK, SOY FLOUR, WHEY.

So we have a little vinegar for sourness, but it’s not much. Nor do we have much sugar or oil or even milk. Mostly just flour and water. Remember the ingredients list is in order of quantity, and salt is on the order of 2% of the flour quantity, and the only farina is what you find on the bottom of the muffin.

The nutritional information indicates not very much fat (1g per muffin), nor sugar (1g per muffin). The milk is probably there simply for its help in giving a nice golden brown color, and the little bit of sugar to encourage the yeast.

That said, as long as they’re not a sweet or rich bread I’m not concerned about the taste. It’s the texture that matters. I think sourdough English Muffins would be superb.

So there you have it. My disclaimer is that I haven’t yet made a decent English Muffin, only bad ones. Some people seem to be very happy with the recipes I’ve tried, even claiming they have nooks and crannies. I don’t know if their standards for bubble size are lower, or if I just fail. What do you think?

March 13, 2009

Hans Fugal
no nic
The Fugue
» Beauty in Nature

I was walking home yesterday and walked past a girls soccer team practicing. The coach blew his whistle and they all started running around the circumference of the field. Naturally this brought up unpleasant memories of doing the same thing in basketball practice. But then I noticed something I hadn’t noticed in basketball practice. I wish I had my camera with me.

As they ran, they began to strew out—that annoying short girl with boundless energy in front, a pack of normal girls in the middle, and the tall and/or not-very-fit girls in the back (you can guess where I usually fell). What struck me is that even with a sample size of only about 15 girls, it was almost immediately very obviously a normal distribution. As they continued running, they got more strewn out, but the bell curve remained essentially intact. (It got a little bimodal for a bit, but give them a break—they’re only middle school girls.)

Is it sad that I think beauty in nature is noticing statistical truths everywhere?

» Parens

I’m a little let down this morning. I learned somewhere in college (probably from a classmate) that the singular of parentheses was paren. Certainly a lot easier to say, anyway. But when I looked it up in the dictionary this morning…

pa·ren·the·sis |pəˈrɛnθɪsɪs|
noun ( pl. -ses |-siːz|)

  • (usu. parentheses) one or both of a pair of marks ( ) used to include such a word, clause, or sentence.

The singular is parenthesis, and it all but condones using the plural for a single mark. But all is not lost!

paren |pəˈrɛn|
noun (usu. parens) Printing
a parenthesis.

ORIGIN early 20th cent.: abbreviation of parenthesis.

I don’t know about you, but I’m sick and tired of saying parentheses (we say that a lot in programming). I propose that we usher in the shift from parentheses to parens. In programming, at least, let’s use the word paren for singular and parens for plural. Will you join me?

P.S. The British tend to call parens “brackets,” which is short for “round brackets.” I was teaching a class on C and had a British student, and I had her totally confused because to me “brackets” meant square brackets. When I said brackets (meaning square brackets) she thought parens. When she said brackets (meaning round brackets by default) I thought square brackets. When I said braces I meant curly braces (what other kind are there on the keyboard?), but to her braces was a synonym for brackets…

March 12, 2009

Jeremy Robb
scothoser
Scothoser's Corner
» Pi Day Passed in the House: March 14th to be Recognized

One of the benefits of having a Representative in Congress on Twitter, is that you get some pretty up to date information quickly.  Today, in the House of Representatives, among other things, they had a vote on the designation of National Pi Day to be March 14th.  

While there are so many other important things out there that need attention by our Government, these little things are things that are bipartisan and should be celebrated.  

So, everyone out there in the world, Feel free to celebrate National Pi Day on March 14th, 2009!  How do you best celebrate pi day?  You could try having a contest on who can recite the most decimal points from Pi, or you could just simply eat a piece of pie.  It’s your choice.  ^_^


Kevin Kubasik
nonic
For Once I Oneder
» Making Silverlight Applications Available Offline

Ok, so I am a huge fan of the Silverlight development environment, C# and XAML represent one of the best UI design paradigms in computing today. Needless to say, I cannot thank the Moonlight project enough for bringing Silverlight support to Linux. The problem is, Microsoft either want’s me to develop a desktop application or a web-based application…. And only one of those is cross platform. Needless to say, if I restrict my WPF application to exclusively Silverlight-available libraries, I can get it to run on Linux. This is far from seamless, but in a pinch, it can be an option.

However, a far better solution would be to load Silverlight in the browser, while offline. (Taking advantage of the Silverlight plugin and its packaging). Utilizing Google Gears, I was able to serve up the compiled .xap file and run the Silverlight app in Firefox without a connection to the server hosting it. I haven’t had a chance to test how IsolatedStorage behaves under these conditions, or how Moonlight handles it (couldn’t get the latest 2.0 to build), but here is the VS2008 solution I used to get everything working.

Offline Silverlight Via Gears Demo


Hans Fugal
no nic
The Fugue
» Microwave Duty Cycle

As you may know, when you change the power setting on most microwaves, it doesn’t change the power output of the magnetron. It changes the duty cycle, i.e. when the magnetron is on and when it is off.

In a bout of curiousity I sat down with my microwave today and figured out exactly what those duty cycles are (you can hear when the magnetron switches on and off). My microwave apparently has a cycle period of 32 seconds. High is power level 100 and the magnetron is on all the time. Power level 50 is on 18 seconds and off 14 seconds. Power level 40 is on 16 and off 16 (which I would have guessed would be the case for power level 50). Power level 10 (the lowest setting) is on for 6 seconds and off for 26 seconds. Here’s a graph with all 10 settings:

Microwave Duty Cycle

As you can see it’s more or less linear, which is nice because it makes mental visualization easy.

Now you know.


Kevin Kubasik
nonic
For Once I Oneder
» Finally! A Django IDE with Real Code Completion and Template Support

Now it seems like forever ago, but I have been on the hunt for a good Django IDE for a very long time. I have tried PyDev, Aptana, Komodo, TextMate, Vim, Emacs, Wing IDE and every variation in between, but was never satisfied with the featurset. I wanted complete python language support and completion, complete support for Django Templates, total HTML support, as well as complete Javascript (specifically jQuery) support. Most editors made the mistake of having support for some of those individually, but I can’t get javascript support inside of a Django Template etc.

The magical and awesome app that represents the first real attempt at a complete Django development environment? Netbeans!

I know it sounds crazy, but progress is being made, and while its a boatload of effort to get it built, and even then, not much of the promised featureset actually works. But those are just details, examination of the code available at:

http://code.google.com/p/netbeans-django/

shows some real work being done towards a Django project type. Moreover, a recent blog post from someone at Sun alludes to this support being available as soon as Netbeans 7.0.

Perhaps this is just another let down waiting to happen, but the existing Python code support is fantastic, and significant strides appear to already have been made towards the goal of total Django integration. If you want to try out the existing language support, just grab the Netbeans 7M2 build and install the Python plugin!

March 4, 2009

Hans Fugal
no nic
The Fugue
» Observations in Data Models

Martin Fowler has an excellent article on contradictory observations and data models, which I think should be required reading for everyone who even thinks about writing genealogical software.

I had never thought about the specific examples that he brings up in the health care profession, though they make perfect sense. I have thought about these very issues quite a bit in the realm of genealogical data and it is my firm belief that software that doesn’t allow for building up a “web of belief” from evidence (or observations as he calls them here)—including contradictory and rejected evidence—is fundamentally broken. That means almost every piece of genealogical software ever written. Certainly all of the commercial ones. Thankfully we’re seeing some progress on this front. The new.familysearch.org site gets us part of the way there—you have separate observations that are merged and disputed and give a view of the data. Unfortunately there are still holes in the conclusions drawn from observations, especially contradictory ones. Hopefully this will get worked out, so that if I have solid evidence that rejects someone else’s entry (which may have been based on no evidence at all, or weak evidence), the view should update to reflect that automatically. Likewise, if I have weak evidence that contradicts someone else’s strong evidence, it should by no means change the view to my new data, but I should be able to record it for posterity (that rejection is important to record so that when someone else stumbles on the same weak evidence they can see that it was given full consideration). Also the new.familysearch.org merging stuff is both not transparent enough and too transparent—you have to really dig to figure out where each bit of data came from and yet every single alternate spelling or date is right there in your face whether the differences are important or not. But these issues are things that can incrementally improve. The important thing is that they’re fundamentally on the right track.

I have a book on genealogical evidence (thanks Mom!) that I’m reading. When I finish it I plan to pontificate in depth about data models and genealogy, and maybe even put some code where my mouth is.


Jeremy Robb
scothoser
Scothoser's Corner
» Gastrointestinal Problems and Autism: A Genetic Link for Some

USA Today posted this article regarding the link with brain development, gastrointestinal repair, autism, and the gene MET.  It seems that in 118 of 214 cases, the MET gene variation was identical for those with both autism and gastrointestinal problems.  This could account for nearly 30% of autistic patients who also suffer from gastrointestinal problems, and about 10% of non-autistic people.  

While this is great news, it is not by any means the smoking gun for the cause of autism, but it is a piece of the puzzle as it effects brain development and connections within the brain after development.  As many have posted in my comments in other posts, many autistic children suffer from gastrointestinal disorders, as well as seizures, and a number of other health problems.  

Some of these disorders can be associated with life in and of itself.  Just because you have cancer doesn’t mean you can’t die of a heart attack.  The same is true with autism.  Just because you are autistic doesn’t mean you can’t have allergies, poor vision, diabetes, or other disorders.  But this research specifically linked gastrointestinal disorders with brain development.  That’s huge.  

What I really found interesting about this report is that USA Today was not touting it as the smoking gun, but rather said right off the bat that it does not account for all instances of autism.  This, to my mind at least, is ground-breaking journalism.  After reading article after article regarding “cures” for autism by treating another disorder like Fragile X Syndrome, it’s nice to see the admission that a discovery is not the end all beat all in the quest to learn about the most diverse spectrum that is Autism.


Kevin Kubasik
nonic
For Once I Oneder
» Oh No! Hacked!

I wanted to apologize, my Wordpress install was compromised. I’m restoring a backup now.

March 3, 2009

Jeremy Robb
scothoser
Scothoser's Corner
» Wanted: Graphic Artist Instructor for Drawing with Technology Class

Hello again!  Claire just passed on another contract instructor position they are looking for this summer: 

Graphic Art I-Drawing with Technology (Age 10-12 & 13-16)

Want to see the art of the future? Look no further than your computer. This interactive course teaches you how to use technology like scanners and software like PhotoShop and Illustrator to create your own art. Enhance hand drawn works or design entirely on the computer — it’s up to you. You will even learn how to modify photographs of your friends and family (picture your best friend with elf ears and bug eyes.) Graphic artists use computers to create company logos, CD covers and even framed images hanging in local art galleries — what will you create? 

YETEC 050-001 • MTWThF, Jun 15-19 • 9:00 am-12:00 pm 
LOCATION: Annex 2169, Campus • SLC

NOTE: This section is for ages 10-12.

YETEC 050-002 • MTWThF, Jun 29-Jul 2 • 9:00 AM-12:00 PM
LOCATION: Annex 2169, Campus • SLC

NOTE: This section is for age 13-16.

 

Graphic Art II-Drawing with Technology (Age 10-16)

 You love drawing with a computer. You have taken Graphic Art or have used Photoshop and Illustrator at home. But, you are having too much fun to end it now! In this three-day extension course get further questions answered and hone your skills to realize what professional quality work you can do using Photoshop and Illustrator. Explore more advanced features including time-saving shortcuts, color-based selections and correction. Learn how to modify your own drawings, designs, and photographs. Expand your computer creativity to the max! 

 

 YETEC 051-001 • MTWTh, Jul20-Jul 23 • 1:00-4:00 PM
LOCATION: Annex 2169, Campus • SLC

NOTE: Prerequisite: Beginning Graphic Art - Drawing with Technology or previous experience with Photoshop and Illustrator.
NOTE: This section is for age 12-15

If you have any questions, feel free to contact Claire Turner at cturner at aoce dot utah dot edu.

» Need for Dark Basic Trainer this Summer

Hello All!  Our Youth program here at the University of Utah is looking for a contract instructor to teach Dark Basic to youth ages 13 to 17.  Here is the description: 

Video Game Programming I with Dark Basic (Age 13-17)

If you’ve always wanted to create your own video games and never knew how, this class is for you, even if you’ve never programmed before! DarkBasic is an introductory-level computer programming language that focuses on basic concepts and 2D games. Learn the fundamentals of computer programming, such as bitmaps, sprites, input devices, sound effects, music, and movies. Course cost includes a DarkBasic book with a CD-ROM trial version of the language compiler.

YETEC 115-001 • MTWThF, Jul 27-31 • 1:00-4:00 PM
LOCATION: Annex 2169, Campus • SLC 

YETEC 115-002 • MTWThF, Aug 3-7 • 1:00-4:00 PM
LOCATION: Annex 2169, Campus • SLC

Video Game Programming II with Dark Basic (Age 13-17)

Expand your video game programming skills. This advanced class will focus more on game planning, code management, and 3D games. Learn the more challenging aspects of programming and use your imagination to create a variety of fantastic games.

YETEC 116-001 • MTWThF, Aug 10-14 • 1:00-4:00 PM
LOCATION: Annex 2169, Campus • SLC

If you have any questions, please contact Claire Turner at cturner at aoce dot utah dot edu.  She can let you know what they are looking for, which book they are using, and how much the contract instructor pay would be. 


Ryan Byrd
no nic
Ryan Byrd's Tech Ramblings
» programming interview question of the day

write a pseudocode function that implements the following:

  • when passed in a number that is evenly divisible by 3, return “wiz”
  • when passed in a number that is evenly divisible by 5, return “bang”
  • when passed in a number that is evenly divisible by both 3 and 5, return “wiz bang”
  • otherwise, return the number passed in

here are two solutions:

string function DumbWizBangCheck(int number)
{
	string output=‘’;
	if (number%3==0) output=‘wiz’;
	if (number%5==0) output=‘bang’;
	if (number%5==0&&number%3==0) output=‘wiz bang’;
	if (output==‘’) output=(string) number;
	return output;
}
string function BetterWizBangCheck(int number)
{
	if (number%15==0) return ‘wiz bang’;
	if (number%3==0) return ‘wiz’;
	if (number%5==0) return ‘bang’;
	return (string) number;
}

» Constructing a Computer-Controlled Mill

Maybe you’re thinking you’d like to cut stuff out of a big piece of plastic. or metal. or wood. You’d like a computer controlled milling machine. Well, you could go out a buy a ready-made version for a few thousand, but that would be ENTIRELY too easy. You’d like to build your own, wouldn’t you?

Part list:

  • Two-Speed Variable Bench Mill/Drill Machine — $621.23 (harborfreight.com)
  • Mini Mill CNC kit #4 — $559.00 USD (cncfusion.com)
  • CNC 3 Axis Package with 425 oz-in motor and KL-4030 Bipolar Driver with 36V /8.8A Power Supply — $404.49 (kelinginc.net)
  • Male-male 25 pin parallel cable
  • Hookup wire, 12 gauge & 18 gauge (radioshack)
  • Mach3 and LazyCam software — $150.00 (machsupport.com)
  • Starter Kit, Mini Mill — $79.95 (littlemachineshop.com)
  • Heat shrink tubing
  • Plastic wire tubing
  • Die grinder $20

Steps:

  1. Install CNC kit onto Mill
  2. Install/wire CNC 3 Axis package
  3. Configure Mach3 software

Useful reading: http://littlemachineshop.com/info/MiniMillUsersGuide.pdf

February 26, 2009

Hans Fugal
no nic
The Fugue
» Why does DPMS hate me?

More specifically, why do gnome-screensaver and gnome-power-manager hate me? (But that was too long for a headline.)

I have had terrible luck with these punks doing what they’re designed to do for at least 2 years now. Bugs get filed (usually someone else has filed it already), developers say “works for me” and they continue to fail to do the simple task endowed to them.

People familiar with my bashing of these two punks know that I blame it primarily on NIH syndrome and the twisted desire to remove all useful configurability from gnome. Plain vanilla DPMS has worked in X11 for a long time. xscreensaver got things ironed out too. Now gnome has to come along and redo everything because the user has too many options and the user might be able to get the screensaver to do what he actually wants.

I haven’t complained about it publicly (i.e. here on this blog) before, because I thought I was a corner case. I have a dual screen setup where one screen is a TV, mythtv and mplayer enable and disable the screensaver regularly, etc. I figured I was just pushing it too far and it broke.

But then I set up this linux box here at school. It has one screen. I don’t do anything special. I just want the screensaver to come on after N minutes and then to power off after M minutes. Even for gnome this should be an acceptable level of configuration right? And indeed the gnome-screensaver/gnome-power-manager configuration guis give me the illusion of being able to configure it this way.

But it doesn’t work. At least, not all the time. I don’t know what the problem is. I don’t even know what the pattern of misbehavior is. Sometimes it works fine. Other times the power management never kicks in. At home, the screensaver itself often doesn’t even kick in. When it does, the power management doesn’t kick in half the time.

Today I woke up to find my desktop monitor at home had stayed on all night, displaying flying toasters for the cockroaches that have showed up early to the summer party. I sighed, but I wasn’t surprised. Then I got to school and the desktop here was displaying the screensaver too. Double fail.

Please share your horror stories. Let’s raise awareness. Let’s pick a color and make ribbons. And if you happen to know how to fix these punks so that they invariably do what they’re supposed to do—for the love of electrons please send a patch to the gnome developers.

February 18, 2009

Hans Fugal
no nic
The Fugue
» git GUIs

One of the nice things about git is due to its UNIXy design and its massive and ever-growing popularity, there are a lot of really nice bells and whistles, and I think we can expect to see even more. For example, GitHub.

While most git interaction is with simple commands in the terminal, it often pays to be able to get a birds-eye view of the revision history, or what I will call the DAG. The original tool for this is gitk. Gitk is functional, but it’s really really unpleasant. It’s written in Tcl/Tk—what did you expect? Some of us have higher standards for usability.

I tried out a few git GUIs and I have settled on two that I think are best of breed. The first is tig. Tig is an ncurses program, so it excels for remote operation over ssh, for quick dives into the repository without reaching for the mouse, and in keyboard use. Think of it as mutt for git. It’s a fantastic program and I use it most frequently.

I have customized my tig setup slightly:
$ cat /Users/fugalh/.tigrc
set show-rev-graph = yes
color cursor white blue
$ alias | grep tig
alias tiga='tig --all'

The second is GitX. It’s a mac app in every good sense, and it’s an excellent git GUI. As you can tell from the screenshot, it’s a bit easier on the eyes for visualizing complicated DAGs (not that this screenshot is of a complicated DAG).

If you use GitX be sure to “Enable Terminal Usage…” so you can start it on the current repository on the terminal by typing gitx.

February 14, 2009

Hans Fugal
no nic
The Fugue
» ssh tricks

Dennis Muhlestein posted a quick ssh tip, and then a couple of really neat gems emerged in the comments. For the sake of those who didn’t click through, and my non-Utah readers, I repeat them here:

  1. ssh-copy-id is a little utility to copy your public key to a remote server. Passwordless authentication has never been easier to set up!

    ssh-keygen -t rsa
    ssh-copy-id $remote_host

  2. ControlPath reuses the same connection for subsequent logins, so if you ssh into the same server from several terminals the logins after the first happen much faster. This is a really neat trick.

    # in ~/.ssh/config
    Host *
    ControlMaster auto
    ControlPath ~/.ssh/master-%r@%h:%p

February 13, 2009

Ryan Byrd
no nic
Ryan Byrd's Tech Ramblings
» Stick it to the man

thx, xkcd


Hans Fugal
no nic
The Fugue
» Why vimdiff?

I love Vim and vimdiff, but vimdiff is pitiful for doing 3-way merges. So I wonder why git’s search for a merge tool prefers vimdiff over opendiff (which launches OS X’s fantastic FileMerge program).

git config --global merge.tool opendiff

February 12, 2009

Hans Fugal
no nic
The Fugue
» Initialize a remote git repository

So you create a git repository (repo) on your local machine (foo) and begin hacking away. Then, you want to push a backup copy of that repo to another box (bar). What’s the best way to do that? There are many ways to do it, but some ways are dangerous and some are just cumbersome.

Ideally, git would have an option to push that instructs it to initialize the remote repository and just do the right thing. I hope this is in our future, but for now we have to do some dancing around.

The canonical way is
bar:~/repo$ git clone --mirror local:repo
...
foo:~/repo$ git push bar:repo --mirror

but that’s not always feasible due to firewalls and nasty NATs.

Unwise methods include copying the working tree with rsync or scp, doing something like the above without --bare or --mirror (which implies --bare), and other methods that would have you pushing to a non-bare repository.

The best method I’ve found is this:
bar:~$ git --git-dir=repo init --bare
foo:~/repo$ git remote add --mirror bar bar:repo
foo:~/repo$ git push bar
...

We set up a bare repository on bar, then set up a “remote” for bar which automatically mirrors (you could do that with the canonical method described above too), so it sends the whole shebang. After that, we push as we normally would.

» Why I switched to Git

I love it when someone else writes what I’ve been meaning to write, so I don’t have to write it.

This article covers the reasons why I switched from mercurial to git, about as well as he could possibly hope to without consulting me, reading my mind, or being me. It’s a bit creepy.

He explains it very well (probably better than I would) and has more insight into the technical details than I do.

While we’re on the subject, you should all go read git for computer scientists so you can think like a git. If you already have a CS background, it’s quite painless I assure you.

February 9, 2009

Kevin Kubasik
nonic
For Once I Oneder
» Using Linq to Sqlite Providers: Updated

So, I still get hundreds of hits each day looking for my linq to sqlite provider, which is quite outdated. To prevent anyone else from falling prey to bitrotten code, I have taken down the link, and created this brief walkthrough. 

For starters, you need to download sqlite for ADO.Net here: http://sqlite.phxsoftware.com/

You will also need the ADO.Net Entities Framework and Visual Studio 2008.

  • First, install the Sqlite Provider that you downloaded, and when prompted, choose to install DesignTime support for Visual Studio 2008. 
  • Now, open Visual Studio and create a new project.
  • Expand the Server Explorer on the left and add a new connection. 
  • Select the Sqlite provider.
  • Once you have a Sqlite Connection, create your schema.
  • Next, Create a new ADO.Net Entities Model, and choose to generate models from a database. Select your Sqlite Connection.
  • Viola! We now have objects representing our SQLite database that can be queried and modified!

I’ll upload a screencast in a few days when I can get my hands on a screencast recorder for Windows. I’m also working on the means to generate those ADO.Net entities under Mono, but I am still researching what is out there.

» Code Review in Rietveld with bzr/Bazaar

I like bzr. Those of us that do (like bzr) aren’t quite as popular as the git lovers and as a result, we don’t see tools as fantastic as Rietveld, Github and Git-CL being spread around on domains outside of launchpad.net. While this isn’t the end of the world, it certainly represented a hurdle when I decided that I was going to formalize my code review process for internal projects. 

While most applications have some form of bzr support, its generally pretty broken or outdated. Given that I was going to have to write code no matter what application I chose, I figured I would use my favorite: Rietveld. Rietveld already had a tool supporting Git and Hg, so expanding it to support bzr was a straightforward task. The initial patch is awaiting review at http://codereview.appspot.com/14053  so please share your thoughts/opinions. If there are others who start to use this, then I might consider packaging this functionality into a bzr plugin! 

If you just want to take advantage of bzr support, then download the file here: Upload.py

February 5, 2009

Hans Fugal
no nic
The Fugue
» Pimping Screen

GNU Screen is a fantastic tool. It gives you detachable terminal sessions with multiple screens. Most Linux types are familiar with that basic functionality, for which you need to know a very few things: screen starts a screen, C-a c to create a new screen, C-a n and C-a p to navigate, C-a d to detach, and screen -r to reattach.

But when I’m really in the zone, C-a n/p is too many keystrokes. And I’d like to have a nifty “tab bar”, and I’d like to not get lost. Well, I just pimped my screen and now I’ll walk you through it.

First, let’s get some status information to keep us from getting lost. Add this to ~/.screenrc:

shelltitle "$ |bash"
hardstatus alwayslastline "%{= dg}%Lw%=%H"

The first line assumes your prompt ends in a ‘$ ‘ like mine does. Now, to complete the effect, put this in ~/.bashrc:

export PROMPT_COMMAND='echo -ne "\ek\e\\"'

There, a nice “tab bar” that tells you your tabs and the host on which this screen session is running. And it’s green. What else could you ask for?

Now, let’s set up some awesome keybindings. We’ll use C-left and C-right:

# ctrl-left/right to switch windows
bindkey "^[[5D" prev # osx
bindkey "^[[5C" next
bindkey "^[[1;5D" prev # linux
bindkey "^[[1;5C" next
# ctrl-T to start a new 'tab' (c-a c)
bindkey "^T" screen

What would you expect to pay for a screen that can do all this? $50? $100? $19.95? But wait, there’s more!

Now wouldn’t it be nice if you knew which host you were ssh’d into (and your editor or some other program is running so there’s no prompt to tell you)? Sure, and I’ll show you how. I’ll do better than that though. I’ll also show you something else you didn’t know you wanted:

# in ~/.ssh/config
Host *
PermitLocalCommand yes
LocalCommand /usr/bin/printf '\ek%h\e\\'
# in ~/.bashrc
alias ssh='screen -- ssh'

The alias causes us to start a new screen for any ssh connection, which keeps your local screen pristine. That’s kind of neat.

Update: If you use the LocalCommand thing in ssh, it can break rsync with a cryptic message about protocol versions. The solution is to do this in ~/.bashrc:
export RSYNC_CONNECT_PROG='ssh -o PermitLocalOption=no '

February 4, 2009

Hans Fugal
no nic
The Fugue
» Midisport redux

I blogged about setting up my Radium keyboard in Ubuntu 8.04. Now in Ubuntu 8.10 the problem is the same but the solution is different (but easier).

Install the midisport-firmware package, and then add this line to /etc/fstab:

none /proc/bus/usb usbfs devgid=46,devmode=664 0 0

Mount it, or reboot. Once usbfs is mounted, then it will work as advertised for a midisport 2×2, at least. It doesn’t work for my Radium, I imagine because the udev rules aren’t sufficient. But since I have a midisport 2×2 sitting here, I’m not going to bother figuring it out. Sorry, but I bet you can figure it out with that head start.

» Identification in PDFs

If you need to create a PDF with no embedded identification it may not be enough to simply refrain from typing your name. For example:

$ strings foo.pdf | egrep -i '(hans|fugal)'
/PTEX.FileName (./0_Users_fugalh_research_foo_fig1.pdf)
/Author (Hans Fugal)
/PTEX.FileName (./1_Users_fugalh_research_foo_fig2.pdf)
/Author (Hans Fugal)
/PTEX.FileName (./2_Users_fugalh_research_foo_fig3.pdf)
/Author (Hans Fugal)
/PTEX.FileName (./3_Users_fugalh_research_foo_fig4.pdf)
/Author (Hans Fugal)
/PTEX.FileName (./4_Users_fugalh_research_foo_fig5.pdf)
/Author (Hans Fugal)

The /PTEX lines are from pdftex and the /Author lines originated from gnuplot

/Title (fig1.pdf)
/Author (Hans Fugal)
/Creator (gnuplot 4.2 patchlevel 4 )

Removing the offending lines didn’t hurt the PDF in this situation. So if you must anonymize a PDF (e.g. to submit a paper for blind review), be sure to check for hidden identification. Of course, most reviewers wouldn’t go digging for it, but you will rest easy knowing it’s truly anonymous.

January 31, 2009

Hans Fugal
no nic
The Fugue
» Qorset

Once upon a time I gave a QoS presentation to at least one LUG. I showed off my little homebrew QoS script that I call qorset, and promised to make it available. I think I may have quietly made it available, but it had some bugs and I was never really comfortable with it even for an alpha release. I just had this nagging feeling that something was very wrong.

Well I found that something and I fixed it. I also modified the framework slightly to work on Linux in general not just OpenWRT. It’s still rough around the edges but it’s ready for you to try out. I’m hosting it at github. I’d love for you to try it out, tell me how it failed, and perhaps even submit a patch.

January 22, 2009

Kevin Kubasik
nonic
For Once I Oneder
» Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!


Jeremy Robb
scothoser
Scothoser's Corner
» The Roundup: Stories and Events of Note

Because I haven’t posted a lot lately (getting ready for some new classes starting soon), I’ll quickly mention some news articles and events of note that I found interesting.  

  1. The Inauguration of President Barack Obama:  Like other inaugurations, I didn’t watch this one.  Why?  Because it’s a show full of pomp and circumstance, with no real action at all.  For me it’s the actions of the administration, and not the actions at the inauguration that makes the difference.  I’m interested in the success of President Obama because it means success to the nation.  Now that he’s at work I’m ready for the events. 
  2. GovTrack.us:  I’ve finally signed up to GovTrack.us to track the happenings of the US Legislature.  It’s amazing what goes on in the House, as I get updates every day on the new bills that are presented, and who presented them.  I also track the Senate, which so far has accomplished little other than forming leadership and committees.  The House, on the other hand, has been quite busy with various bills that seem rather trivial.  I didn’t realize the detail House Bills got into, nor the amount of time dedicated to minor matters.  It will be even more interesting to see how the Legislature moves forward in the coming months.  
  3. Autism on Top of Healthcare List:  President Obama has listed Autism as his top concern for Healthcare research in his administration.  Cancer and AIDS didn’t even get a mention, but Autism was mentioned specifically.  I am surprised (pleasantly, of course) that such a course was taken.  I’m currently following the Administration’s official blog at Whitehouse.gov (not .com).  The bullet points are well chosen, particularly when it comes to screening.  The cost of screening will be covered, and it will be mandatory for all children to go through the screening process.  Hopefully this will make the screening process part of the covered screenings provided by health insurance.  
  4. Salt Lake has been named as the area with the most polluted air in the United States.  The cause is actually the inversion process that happens to all nestled cities in the Mountains.  The warm air above creates a cap on the cold air below, which has no place to move.  This causes health risks with the trapped air, until a nice storm moves in to blow the gunk out of the air (yes, gunk is a technical term ^_^).  Today a storm is moving in, and should have the majority of the air cleared out by tomorrow.  Thank goodness!  
  5. Utah Legislature to Cut Autism Preschool Funding:  Yes, the Legislature in their infinite wisdom has felt the need to slash education yet again, and this time for children that desperately need it.  While this should not effect public preschools managed by the individual school districts, it will effect specialist schools that provide the best care for those children who cannot be mainstreamed well.  It’s a slap in the face of every parent who needs to find more affordable schooling for their autistic child.  My sincere hope is that the Utah Legislature rethinks this policy, even if it means cutting a little more into another budget.  I can tell you that if my State House Representative or Senator were to vote to kill this funding, they would not get my vote again.

So that’s about it.  I know there is a lot more going on in the world, but that is what has effected my little corner of the planet.  Hopefully I will have more information about the points regarding Autism that the new Administration would like to accomplish, such as more concrete timelines (as they are developed), and any evidence on the House floor that such moves are being made.

January 21, 2009

Hans Fugal
no nic
The Fugue
» Log-frequency Spectrograms

Tensai asked me how I made my graphs in my ringtones post. I’d like to blather on about the graphs and why they’re cool and how you can make them, because that’s the sort of thing I’m good at.

In the olden days, the spectrogram was invented.

spectrogram of speech

Originally greyscale, they are now usually portrayed in color, with “hot” colors meaning higher amplitude and “cool” colors meaning lower amplitude.

While there are myriad ways to view and/or generate spectrograms, the most convenient for me right now is to do it in Octave. If you’re not familiar with Octave, it’s a MATLAB clone. Octave is libre, MATLAB is insanely expensive. Obviously, I use Octave. I have used MATLAB previously (I had a beta copy, until it left beta), and for the most part they are quite comparable. Octave is a bit slower for some things (less optimized) but I’ve seen Octave outperform MATLAB on some specific tasks. The biggest impedance mismatch is in user interface stuff (MATLAB has sophisticated dialog support) and graphing. Octave has most of the essential graphing functionality (it uses gnuplot to render graphs).

So how do we generate a spectrogram in Octave? First we need to read in the WAV file, then we generate the spectrogram.


[x,sr] = wavread('logchirp.wav');
specgram(x,8192,sr);

8192 is the size of the FFT. I find 8192 is a nice compromise between time and frequency resolution (and computation time), but other powers of 2 (especially 1024) are common as well. Here’s the chirp spectrogram:

chirp spectrogram

Notice how the chirp is logarithmic. To our ears, this sounds like a steadily-rising tone. For this reason when dealing with music it’s often better to look at a log-frequency spectrogram. Otherwise all the low frequencies are scrunched together and the relationships between different pitches (and harmonics) aren’t constant. Here’s a log-frequency spectrogram of the same chirp:

log-frequency spectrogram of chirp

This was generated by the Octave code

logfsgram(x,8192,sr); title('logchirp.wav');

Notice the bleed on the low frequencies, this is because we need a longer FFT in order to get more frequency resolution at low frequencies. This is a tradeoff in time resolution though, and processor time. Experiment with different FFT lengths for extra credit.

To use these functions you’ll need to put the specgram and logfsgram “m-files” in your octave search path (current directory or whatever else you specify in your ~/.octaverc).

» Y Tick Labels in Octave

I struggled with this on and off for a couple of months. Finally I stumbled on the magic needed to get it working.

Dan Ellis has some MATLAB code for log-frequency spectrograms, but in Octave the graph lacks the custom y tick marks. Here’s the original code:

    yt = get(gca,'YTick');
    for i = 1:length(yt)
        ytl{i} = sprintf('%.0f',logffrqs(yt(i)));
    end
    set(gca,'YTickLabel',ytl);

This code gets the existing tick marks and labels them with the log frequency (instead of the frequency bin).
The problem is that Octave doesn’t populate YTick unless it was manually set already.

Here’s the working code:

    % octave doesn't populate YTick with its tick marks, so we have to set
    % our own. Besides, this way we get nice octave intervals.
    set(gca,'YTick',1:12:M);
    yt = get(gca,'YTick');
    for i = 1:length(yt)
        ytl{i} = sprintf('%.0f',logffrqs(yt(i)));
    end
    set(gca,'YTickLabel',ytl);

» Ringtones

This new phone is unique in all the cell phones I’ve owned or played with in that it isn’t actually difficult to mp3s onto it and use them for ringtones. It’s a Motorola V195. It supports Bluetooth (which is how I get the mp3s on it), but it also has a regular old USB port through which it charges and I take it allows transfer of files (if you don’t have Bluetooth)—though I haven’t confirmed that.

There must be an unwritten rule among cell phone companies that included ringtones must sound like they were written by a drunk adolescent pelican. So we want to put an mp3 ringtone on, but let’s make it a good one. There are good mp3 ringtones and there are really bad mp3 ringtones, and there’s very little middle ground.

Before I give you my criteria for a good ringtone, let’s cover some background theory. Cell phone speakers are little and cheap. They’ve improved some over the years, but they’re still a far cry from a good pair of desktop speakers let alone audiophile gear. So your mp3 will sound different on the phone than it does on your computer or even your headphones. How will it sound? That depends on the frequency response of the speaker in the cell phone. Since that’s not likely included in your cell phone manual, let’s see how we can measure it.

I whipped up this chirp in Audacity. It goes from 20 Hz to 20 kHz (the audible range) with a second of white noise on either side so you know when the thing starts and ends (since 20 Hz and 20 kHz are both out of the hearing range of most people). Its log-frequency spectrogram looks like this: (ignore the bleed at the low frequencies, it’s an artifact of the log-frequency analysis)

logchirp.wav

The astute among you will have realized that encoding this as an mp3 may change the spectrum. (I use the default settings to lame throughout this post.)

logchirp.mp3

It looks like the only relevant change is that encoding to mp3 cuts off the frequencies above about 17 kHz, which most people don’t hear well or at all. So the experiment is still a go.

Now I put the chirp on my phone and played it back, recording it into Audacity on my laptop. The astute among you will again realize that the frequency response of my microphone makes a difference. Luckily my microphone has a decent frequency response from 30 Hz to 20 kHz. Even if it didn’t though, as long as the mic has a better frequency range than your phone you can still glean some important information. Here’s the result:

Motorola V195

Notice that there’s basically nothing below about 250 Hz. To give you some perspective, 262 Hz is middle C (each tic mark on the Y axis is an octave, and the scale is logarithmic). So anything below middle C is severely attenuated, and the octave between middle C and high C is moderately attenuated.

For comparison, here is the chirp recorded on my desktop speakers.

Speakers

See how it goes lower and also how it is flatter. There’s not an appreciable peak at 8 kHz like there is with the cell phone. That means your high frequencies are going to stick out on a cell phone too.

Ok, so what does this mean for picking ringtones? It means steer clear of things that rely on low frequencies to sound good. Less obviously, it also means to try to steer clear of wide-band sounds that rely on lots of frequencies including low ones to sound good. That means drums! You also want something that is intelligible even across the room or in your pocket, and that means simplicity. Look for fun riffs on one or two instruments at the beginnings of songs, steer clear of human voices, bass, and thick mixes. If you want an approximate preview of what it would sound like on your phone, run it through a high-pass filter in Audacity and set the cutoff about 400 Hz. (Of course your phone may have a slightly different frequency response than mine, but the principles apply for almost all phones).

I won’t go into a lot of detail about how to make a ringtone in Audacity, but I’ll give you some general pointers. First, the length should be about 20–30 seconds (after trimming silence). If you want, time the time it takes to go to voicemail. Second, you should normalize the sound to peak at -3 dB (this might actually attenuate some overloud music). If the clip has a lot of dynamic range (louds and softs) you may want to run it through a compressor before normalizing, otherwise the soft will be lost on the bad speakers and noisy world. Penultimately, mix it down to 1 channel—your phone doesn’t ring in stereo and while stereo files will probably work just fine it’s just a waste of space. Finally, pick a medium quality encoding, too high a bitrate will probably be rejected by the phone and you don’t need it.

January 20, 2009

Hans Fugal
no nic
The Fugue
» Pun Intended

One of my pet peeves is when people write “no pun intended.” This phrase is fine in realtime communication, like speech or IRC or instant messaging, because you may indeed have not intended the pun.

But when you’re writing something like an email or a blog post, you simply cannot honestly say “no pun intended.” If the pun truly escaped your intention, then you would not have had a chance to put “no pun intended.” If you’re trying to be funny by intentionally making a pun and/or drawing attention to your clever pun, then the pun was indeed intended, and if you say “no pun intended” you’re a big fat liar.

Don’t stop making puns. I love puns. Just leave them to be discovered by the reader, or put “pun intended” if you feel the need to draw attention to it. A pun is a beautiful thing. Never be so ashamed of your puns that you feel the need to pretend you didn’t intend them!

In the interest of full disclosure, the abhorrent lack of puns in this post was not intended. I tried halfheartedly to think of one but failed. Oh well.

January 15, 2009

Hans Fugal
no nic
The Fugue
» Mental UTC Conversion

I do a lot of UTC conversions, more than most, and I am dismayed that after perhaps a year of relatively frequent mental UTC conversions it’s still no faster than firing up a terminal and typing date -u. Even with Quicksilver and fleet fingers my mind should win that race every time.

No one step is difficult, but there are too many steps. First you have to load in the reference time (might be a UTC time or local time) then maybe convert it to 24-hour time then remember whether DST is in effect or not and whether that means -7 or -6, then figure out whether to add or subtract that 7 or 6 hours, then do the actual subtraction, then wonder if you did that right and possibly wonder whether that’s the same date as today or not… Clearly the brute force method is not the way to go.

If Richard Feynman can calculate square roots in his head instantly, I’m sure I can convert time zones. Anyone have any suggestions on how to gain this skill? I think I’ll add Mental Math for Pilots to my wishlist.

» VPN DNS

I have a VPN and a DNS server that serves up forward and reverse DNS for my VPN hosts, which zone I call wan. When I want to look at my Cacti graphs, I go to gwythaint.wan and as long as my laptop is on the VPN I can see them wherever I am. In theory anyway. In practice, getting this to work without screwing up other things is harder.

I’ll leave out the myriad permutations that I tried over the past couple of weeks and show you the one that actually works well. That is to have a caching and forwarding name server on your laptop, and to add localhost to your list of nameservers. For best results, you would have it forwarding to the name server your DHCP server gives you, with an explicit forward over the VPN for the wan zone (and its reverse). resolvconf on Linux can do this. Your situation may warrant a static forwarder for non-wan addresses, in which case you just set that forwarder and be done with it. If your various DHCP nameservers are a bit more subtle—perhaps serving up internal domains of their own—then you may have to not forward and/or recurse except explicitly for wan.

I just took the default BIND9 configuration on my system and tweaked it thus:

// local/vpn stuff
zone "wan" {
    type forward;
    forwarders { 172.17.77.1; 172.17.0.1; };
};
zone "17.172.in-addr.arpa" {
    type forward;
    forwarders { 172.17.77.1; 172.17.0.1; };
};

On most systems the default named.conf is already some reasonable caching setup, so you wouldn’t have to tweak it beyond that. Then I added localhost to the nameserver list (/etc/resolv.conf on Linux, in the network preferences pane on OS X) and checked that it works with a dig @localhost gwythaint.wan.

Things got tricky because dig and host on my laptop were taking forever to
return when I queried localhost—6 seconds or so. I chased this wild goose for
awhile and in the end I didn’t find the reason (it still does it), but I
verified that it’s not a problem. If you use the -v flag to host you notice
that the actual queries took <1ms, so whatever else host and dig are doing may
not be relevant. Even stranger, if you do host -v gwythaint.wan and don’t
specify to query localhost, everything resolves instantly and yet it reports
that it queried localhost (which you can verify with the non-traffic on repeat
requests via tcpdump). It hasn’t slowed down any other applications (a 6-second
slowdown on DNS lookups would be very obvious), so I chalk it up to “who
cares?” If host and dig on OS X return the right answer, and you verify they’re
querying the right server, then you’re good to go.