Lojic Technologies

Archive for the ‘science’ Category

Precision Quadrotor Flying

leave a comment »

Wow – pretty amazing! HT Michael Hale via RT ๐Ÿ™‚

Written by Brian Adkins

May 28, 2010 at 11:09 am

Posted in amazing, robotics, science, technology, video

Tagged with ,

Retrieve Sunrise, Sunset & Twilight Info in Ruby

with 5 comments

Sunrise, Sunset & Twilight

TwilightI was curious about the exact time of sunrise & sunset at my location, so I found this US Naval Observatory site. In the process, I learned a more precise definition of twilight. I wanted to be able to automate the process of retrieving the information, so my first attempt was to simply put the query parameters used in the form in the URL as an HTTP GET request, but the server wouldn’t accept that, so I needed to issue an HTTP POST request.

Ruby Code

Ruby is a great language for this sort of task, so I put together the following simple program:

require 'net/http'

YOUR_ID    = ''    # A unique ID per comment above
YOUR_CITY  = ''    # The name of your city
YOUR_STATE = ''    # Two letter state abbreviation

now   = Time.now
month = now.month
day   = now.day + 1 # Tomorrow
year  = now.year

Net::HTTP.start('aa.usno.navy.mil') do |query|
  response = query.post('/cgi-bin/aa_pap.pl',
    "FFX=1&ID=#{YOUR_ID}&xxy=#{year}&xxm=#{month}&xxd=#{day}&st=#{YOUR_STATE}&place=#{YOUR_CITY}&ZZZ=END")
  if response.body =~ /Begin civil twilight[^0-9]*(d+:d{2} [ap].m.).*Sunrise[^0-9]*(d+:d{2} [ap].m.).*Sunset[^0-9]*(d+:d{2} [ap].m.).*End civil twilight[^0-9]*(d+:d{2} [ap].m.)/m
    puts "#{month}/#{day}/#{year}"
    puts "Begin Twilight: #{$1}"
    puts "Sunrise       : #{$2}"
    puts "Sunset        : #{$3}"
    puts "End Twilight  : #{$4}"
  end
end

You just need to edit the three constants that begin with YOUR_. The id used on the Navy web form is ‘AA’, but they have a comment in the HTML that requests you use a unique id of your own up to 8 characters to help them with tracking. You can find a more complete version of the code in my github profile.

Emacs Goodness

After writing the above Ruby script, I made it executable, ‘chmod +x sunrise.rb’, and placed it in my path so I could write a simple Emacs function to invoke it.

(defun bja-sunrise ()
  "Display sunrise, sunset & twilight information."
  (interactive)
  (shell-command "sunrise.rb"))

Imagine my surprise when I invoked the Emacs apropos help ‘C-h a’ to see my newly defined function and discovered that Emacs, naturally, already has several commands to display sunrise/sunset information!

calendar-mouse-sunrise/sunset
Show sunrise/sunset times for mouse-selected date.
calendar-sunrise-sunset
Local time of sunrise and sunset for date under cursor.
sunrise-sunset
Local time of sunrise and sunset for today. Accurate to a few seconds.

It doesn’t, however, display twilight information, so my simple function still has a purpose in life. Emacs is awesome ๐Ÿ™‚

Written by Brian Adkins

March 11, 2009 at 12:41 am

Dolphin Bubble Rings

leave a comment »

My uncle passed on a link he received from my cousin to an amazing video showing dolphins cleverly making sophisticated bubble rings and manipulating them in interesting ways:

Written by Brian Adkins

January 22, 2008 at 9:25 am

Posted in science, video

Tagged with , ,

Crayon Physics

with one comment

I found this video of a “crayon physics” game on Robert Scoble’s site – very cool!

Written by Brian Adkins

December 1, 2007 at 11:08 am

Posted in amazing, science, video

Tagged with ,

Best seats to survive a plane crash.

leave a comment »

Plane wreck

MYTH: It Doesn’t Matter Where You Sit

“It’s like a lottery to pick your seat.”
-Nora Marshall, passenger survival expert, National Transportation Safety Board

“One seat is as safe as the other.”
-Boeing Web site

“It’s an age-old question. There’s just no way to say.”
-Federal Aviation Administration spokesman

“There is no safest seat.”
-airsafe.com

REALITY: It’s Safer In the Back.

The funny thing about all those expert opinions: They’re not really based on hard data about actual airline accidents. A look at real-world crash stats, however, suggests that the farther back you sit, the better your odds of survival. Passengers near the tail of a plane are about 40 percent more likely to survive a crash than those in the first few rows up front.

Popular Mechanics article

Written by Brian Adkins

July 21, 2007 at 1:29 pm

Posted in science

Tagged with , ,

Oregon Man Flies 193 Miles In Lawn Chair

leave a comment »

I learned about this lawn chair flight from Matt Promise’s blog.

Balloons suspend Kent Couch in a lawn chair as he floats in the skies near Bend, Ore., Saturday, July 7, 2007. Couch, on his way to Idaho, carried a global positioning system device, a two-way radio, a digital camcorder and a cell phone. He also had instruments to measure his altitude and speed and about four plastic bags holding five gallons of water each to act as a ballast, he could turn a spigot, release water and rise.

Couch is the latest American to emulate Larry Walters รขโ‚ฌโ€ who in 1982 rose three miles above Los Angeles in a lawn chair lifted by balloons. Walters had surprised an airline pilot, who radioed the control tower that he had just passed a guy in a lawn chair.

Here is an article on Fox News.

Written by Brian Adkins

July 11, 2007 at 10:33 am

Posted in amazing, science

Tagged with ,

Spider Car

with 2 comments

Three months to design, six months to build, $15,000 in parts…

Written by Brian Adkins

June 19, 2007 at 8:21 am

Posted in amazing, science, video

Tagged with

The Real Rain Man

leave a comment »

Who was the game winning pitcher in game three of the 1926 world series? Who were the four people in George Washington’s cabinet? When was Sir Walter Raleigh executed? What day of the week was that? Kim Peek has no trouble answering questions like these and thousands more from memory. He is the person the “Rain Man” character was based on. He reads eight books a day. A page that would normally take three minutes to read takes him eight to ten seconds. He reads the left page with his left eye and the right page with his right eye and retains 98% of it. The neurologist who originally diagnosed him only gave them five minutes of his time because he was late for a golf game; he said they should put Kim in an institution and forget about him.

Other parts of the series:

Part Two of Five

Part Three of Five

Part Four of Five

Part Five of Five

Written by Brian Adkins

May 4, 2007 at 12:47 pm

Posted in amazing, science, video

Tagged with

CFL Mercury Nightmare

leave a comment »

I came across a story on slashdot.org regarding one man’s “nightmare” from using a compact fluorescent lightbulb (CFL). I had no idea that CFL’s contained mercury! I did a little more research and found the following links:

CFL Bulbs Have One Hitch: Toxic Mercury
“But the bulbs contain small amounts of mercury, a neurotoxin, and the companies and federal government haven’t come up with effective ways to get Americans to recycle them.”

“Experts agree that it’s not easy for most people to recycle these bulbs. Even cities that have curbside recycling won’t take the bulbs. So people have to take them to a hazardous-waste collection day or a special facility.”

Exposure to Mercury From Fluorescent Light Bulbs
“The diagnosis was mercury poisoning, and an investigation of his environment disclosed that he had been exposed to mercury from broken fluorescent light bulbs.”

I also found some articles that attempted to minimize the risks of CFL’s, but they seemed to be primarily from companies that sell CFL’s. I would advise educating yourself on the pros/cons of CFL’s prior to using them.

While reading some of the articles, I came across Dimethylmercury (not in CFL’s). This nasty neurotoxin was responsible for killing a researcher who accidentally spilled a drop or two on her latex gloved hand! Absorbing a thousandth of a milliliter is fatal.

Written by Brian Adkins

April 30, 2007 at 11:46 pm

Posted in science

Tagged with , ,

Inner Life of the Cell

with one comment

SIGGRAPH award winning animation of the inner life of the cell. To see a version with narration, click the image below, then choose the version appropriate for your internet connection speed:

innerlife_super.jpg

Written by Brian Adkins

April 14, 2007 at 10:20 am

Posted in science, video

Tagged with