John Graham-Cumming

Web Name: John Graham-Cumming

WebSite: http://blog.jgc.org

ID:50675

Keywords:

John,Graham,Cumming,

Description:

If you ever look at pictures of clocks and watches in advertising they are set to roughly 10:10 which is meant to be the most attractive (smiling!) position for the hands. They are actually set to 10:09.14 if the hands are truly symmetrical. CC BY 2.0image by Shinji I wanted to know what all the possible symmetrical watch faces are and so I wrote some code using Processing. Here s the output (there s one watch face missing, 00:00 or 12:00, because it s very boring): The key to writing this is to figure out the relationship between the hour and minute hands when the watch face is symmetrical. In an hour the minute hand moves through 360 and the hour hand moves through 30 (12 hours are shown on the watch face and 360/12 = 30). The core loop inside the program is this: for (int h = 0; h = 12; h++) { float m = (360-30*float(h))*2/13; int s = round(60*(m-floor(m))); int col = h%6; int row = floor(h/6); draw_clock((r+f)*(2*col+1), (r+f)*(row*2+1), r, h, floor(m One of the problems/perks of having written a book about GNU Make is that people ping me with questions. This morning someone said to me: Especially curly braces vs parentheses is something that always confuses me . As always the first port of call with GNU Make questions should be the FSF s manual. It says the following: To substitute a variable s value, write a dollar sign followed by the name of the variable in parentheses or braces: either $(foo) or ${foo} is a valid reference to the variable foo. And that seems to work well: $ cat Makefile foo := hello.world $(info $(foo)) $(info ${foo}) $(info $(foo:world=everyone)) $(info ${foo:world=everyone}) $(info $(foo:hello.%=good morning.%)) $(info ${foo:hello.%=good morning.%}) $ make hello.world hello.world hello.everyone hello.everyone good morning.world good morning.world make: *** No targets. Stop. You can see that simple variable references work, as do substitutions (where I changed world to everyone) using substitution re I grew up with Advent Calendars, and they are very common in the UK. Shops across the country sell calendars with typically 24 doors on them, one for each day from December 1 to December 24. Behind each door is a small gift (usually chocolate or something similarly sweet and edible). The numbers on the doors of the calendar are usually arranged somewhat haphazardly. Part of the fun each day is finding the next door to open. It s the search for the chocolate that makes the calendars enjoyable. Here s an example layout from an Advent Calendar that I bought in Paul in London: This is an example of a very common 6x4 (and sometimes 4x6) layout for calendars. In this blog I m going to develop code to find pleasing Advent Calendar layouts in the 6x4 shape. But first, here s a little animation of the Paul calendar in action. What makes it pleasing is that the numbers don t cluster together (mostly). So, that calendar isn t bad but it would be n If you ve read my blog in the past you ll know I like to make ambient devices: mixtures of electronics and physical objects that blend into a home and provide a useful service. I have, for example, a model bus that shows the live times of buses near my home, and a Totoro that shows the weather forecast, and an old candle mug turned into a breathing nightlight using sea glass gathered on a beach.The Totoro uses an ESP8266 in the form of a NodeMCU for a useful combination of WiFi connectivity, HTTP and GPIO for controlling physical devices like the LEDs in its eyes.One of the challenges with working with these devices is updating the software on the NodeMCU when new functionality is implemented. Every code change has to be uploaded via a USB cable. For a new project I decided to make use of Cloudflare s Workers product to provide a simple API that tells an ambient device what to do.By creating an API that just controls the physical aspects of the device (in this case a m I was persuaded by buddy Mr H to make a YouTube channel out of my Source Code in TV and Film Tumblr. The Tumblr shows the source code that flashes by on computer screens in films and TV programmes and look at its heritage.This is sometimes surprising, funny, or relevant, and often ridiculous. For the first experimental episode I looked at what I believe is an Easter Egg in the original Iron Man film:I would be interested to hear people s thoughts on this format.The second episode is a forensic examination of the opening sequence of the Doctor Who episode The Bells of Saint John:Regular readers may know that I like ambient devices: devices that fit into the environment unobtrusively and provide information at a glance. One such device is my bus monitor that shows times of buses at the stop near my house. Recently I decided to solve the problem of answering the question Do I need an umbrella? when I leave the house. For this I chose to use an ESP8266 in the form of a NodeMCU running Lua and display the coming weather by illuminating the eyes on a small Totoro figure. This was my first NodeMCU/ESP8266 project and there s definitely a bit of a learning curve. I ended up using luatool to upload my Lua code to the device, and esptool to flash the firmware using a custom firmware build from this wonderful website with the following modules present: cjson, file, gpio, http, net, node, tmr, uart, wifi, and ws2812../esptool.py --port /dev/cu.SLAB_USBtoUART write_flash -fm qio 0x00000 nodemcu-master-10-modules-2017-04-08-20-28-08-integer.binThe first

TAGS:John Graham Cumming 

<<< Thank you for your visit >>>

Websites to related :
Big Lists of Website | Download

  BigListofWebsites.com is a tool that allows you to search for websites by their title tag, meta description, meta keywords, and H1 tags.The list of we

theregisteremails | Just another

  Here s the leaked names and emails from Theregister.co.uk blunder.Typically it was the fault of the marketing department! The emails were sent out fro

Miguel Stanley

  How Slow Dentistry® can transform your practice into a premium medical dental businessWebinar WATCH NOW Dr. Miguel Stanley presents National Geogr

Krastase - Hair Products, Hair C

  98643A93-384E-4765-A081-790A4C331DEA5B818C3D-4335-48D4-8520-4ADB6252DFC2GroupFill 3icon instagramSubscribeSubscribeFill 8E338661C-C6F6-423D-8C9C-2BB7E

Home | Dole.com

  You can update your YOU+ DOLE filters here to get the most tailored experience. GOT IT Get products, recipes, articles and more tailored just to you!

Auto Detailing Products | Auto D

  Since 1953, Malco Products has been providing professional car detailers, car washes, car dealerships and more with the powerful cleaning and detailin

Florida Keys Electric Cooperativ

  To see if you are owed an unclaimed FKEC capital credit refund, check the online list of names now. Claims must be made within 60 days of August 27, 2

Home - AdaptHealth Patient Care

  What you need.When you need it.Get medical supplies shipped to your doorstep.We want to hear your feedback. Starting May 1st, customer service agents

Chemist Warehouse: Australias

  Nature s Way Beauty Collagen 40 Gummies $9.99 $10.00 Off RRP! QCPP accreditation details: Chemist Warehouse Virginia. 1806 Sandgate Rd, Virginia Qld

Uncle Dans® Salad Dressings, Di

  Enter your email address below to join our mailing list and have our latest news and member-only deals delivered straight to your inbox.

ads

Hot Websites