SlideShare uma empresa Scribd logo
1 de 47
Baixar para ler offline
Building an alarm clock
                         with node.js
                                 or


                     Hacking vs. Engineering
 Felix Geisendörfer                       29.09.2011 (v1)
Donnerstag, 29. September 2011
Text
                                  Welcome to the Siesta
                                 right-after-lunch Session!
Donnerstag, 29. September 2011
Building an alarm clock
                         with node.js
                                 or


                     Hacking vs. Engineering
 Felix Geisendörfer                       29.09.2011 (v1)
Donnerstag, 29. September 2011
@felixge

                                 Twitter / GitHub / IRC


Donnerstag, 29. September 2011
My Problem

                    • Getting up early in the morning

                    • That means before 12:00 (noon)


Donnerstag, 29. September 2011
This talk

                    • How I solved this problem

                    • Hacking vs. Engineering the solution


Donnerstag, 29. September 2011
Patient History

                    • 23 years

                    • Working from home

                    • Can work any hours

Donnerstag, 29. September 2011
So why get up early?


                    • To get more stuff done ...



Donnerstag, 29. September 2011
Previous attempts



Donnerstag, 29. September 2011
Text

                                 Behavioral Conditioning
Donnerstag, 29. September 2011
Text

                                 Flying alarm clock
Donnerstag, 29. September 2011
Text

             Circadian rhythm app (Sleep Cycle)
Donnerstag, 29. September 2011
Text

                                 Many alarms
Donnerstag, 29. September 2011
Nothing was working



Donnerstag, 29. September 2011
Text



Donnerstag, 29. September 2011
Donnerstag, 29. September 2011
Donnerstag, 29. September 2011
Donnerstag, 29. September 2011
Donnerstag, 29. September 2011
VLC
Donnerstag, 29. September 2011
pmset
Donnerstag, 29. September 2011
The Script


       https://gist.github.com/1a40a207cf6132f77efa




Donnerstag, 29. September 2011
sudo ./alarm.js 7 30


Donnerstag, 29. September 2011
Donnerstag, 29. September 2011
Result

                    • Reliably waking up at any time

                    • Get to choose different music every night


Donnerstag, 29. September 2011
Hacking vs. Engineering



Donnerstag, 29. September 2011
(Software) Engineering


                     “Rigorous application of science”




Donnerstag, 29. September 2011
Hacking


                                 “Playful cleverness”




Donnerstag, 29. September 2011
Hacking vs. Engineering
           this project


Donnerstag, 29. September 2011
Tests?

                                 Engineering: Yes


                                 Hacking: Maybe



Donnerstag, 29. September 2011
Airtunes?
                                    Engineering:

                                 Implement protocol

                                      Hacking:

                            Piggyback on iTunes or VLC
Donnerstag, 29. September 2011
Code
   var file = '/my/music/file.mp3';
   var vlcPath = '/Applications/VLC.app/Contents/MacOS/VLC';
   var vlc = spawn(vlcPath, [
     '-R',
     '--sout=#transcode {acodec = alac channels = 2, samplerate =
   44100}: raop{host=10.0.1.13,volume=255}',
     file
   ]);

   vlc.stdout.setEncoding('utf8');
   vlc.stderr.setEncoding('utf8');
   vlc.stdout.on('data', process.stdout.write);
   vlc.stderr.on('data', process.stderr.write);

   vlc.on('exit', function(code, signal) {
     console.log('vlc exit: %i %s', code, signal);
   });

Donnerstag, 29. September 2011
Wakeup from Sleep?
                                 Engineering:

    pmset schedule wakeorpoweron <datetime>

                                  Hacking:

     pmset schedule wakeorpoweron MTWRFSU
                      <time>
Donnerstag, 29. September 2011
Code
   var powerCmd = sprintf(
      'pmset repeat wakeorpoweron MTWRFSU %02d:%02d:00',
      powerHour,
      powerMinute
   );

   exec(powerCmd, function(err) {
     if (err) throw err;
     process.setuid('felix');
   });




Donnerstag, 29. September 2011
Turn off speakers?
                                      Engineering:

                   Install speakers in unreachable place.


                                      Hacking: ?


Donnerstag, 29. September 2011
Text

                                 Duct Tape
Donnerstag, 29. September 2011
Duct Tape of Concurrent I/O
Donnerstag, 29. September 2011
Engineering Solution for Concurrency
Donnerstag, 29. September 2011
Why am I talking about this?



Donnerstag, 29. September 2011
JS has a very hacker-driven
                                 culture


Donnerstag, 29. September 2011
Text

                                 Duct tape of the web
Donnerstag, 29. September 2011
Text

                                 Duct tape of the DOM
Donnerstag, 29. September 2011
• Hacking is lots of fun, go do it!

                    • Hacking can be a good solution!

                    • But be aware that many problems call for
                           an engineering approach.




Donnerstag, 29. September 2011
Where we need more
                                    engineering:

                    • Libraries

                    • Domain logic

                    • Performance

Donnerstag, 29. September 2011
TL;DL

                    • Hack when in doubt

                    • Engineer when clear


Donnerstag, 29. September 2011
Hacking Engineering




Donnerstag, 29. September 2011
Questions?




                                    @felixge
Donnerstag, 29. September 2011

Mais conteúdo relacionado

Destaque

Digital Alarm Clock 446 project report
Digital Alarm Clock 446 project reportDigital Alarm Clock 446 project report
Digital Alarm Clock 446 project report
Akash Mhankale
 

Destaque (11)

Change RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDBChange RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDB
 
Firebase slide
Firebase slideFirebase slide
Firebase slide
 
Forensic Tools for In-Depth Performance Investigations
Forensic Tools for In-Depth Performance InvestigationsForensic Tools for In-Depth Performance Investigations
Forensic Tools for In-Depth Performance Investigations
 
Digital Alarm Clock 446 project report
Digital Alarm Clock 446 project reportDigital Alarm Clock 446 project report
Digital Alarm Clock 446 project report
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
HOME AUTOMATION USING ARDUINO
HOME AUTOMATION USING ARDUINOHOME AUTOMATION USING ARDUINO
HOME AUTOMATION USING ARDUINO
 
Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907
 
The Enterprise Case for Node.js
The Enterprise Case for Node.jsThe Enterprise Case for Node.js
The Enterprise Case for Node.js
 
Home automation using android mobiles
Home automation using android mobilesHome automation using android mobiles
Home automation using android mobiles
 

Semelhante a Building an alarm clock with node.js

Scaling websites with RabbitMQ A(rlvaro Videla)
Scaling websites with RabbitMQ   A(rlvaro Videla)Scaling websites with RabbitMQ   A(rlvaro Videla)
Scaling websites with RabbitMQ A(rlvaro Videla)
Ontico
 
Html5 episode 2
Html5 episode 2Html5 episode 2
Html5 episode 2
Eric Smith
 
TAG Recruiting Atlanta - 3 Phases of Mobile Recruiting Strategy
TAG Recruiting Atlanta - 3 Phases of Mobile Recruiting StrategyTAG Recruiting Atlanta - 3 Phases of Mobile Recruiting Strategy
TAG Recruiting Atlanta - 3 Phases of Mobile Recruiting Strategy
Kane Cochran
 
AmbientTalk, a scripting language for Android devices - Dries Harnie, VUB - d...
AmbientTalk, a scripting language for Android devices - Dries Harnie, VUB - d...AmbientTalk, a scripting language for Android devices - Dries Harnie, VUB - d...
AmbientTalk, a scripting language for Android devices - Dries Harnie, VUB - d...
tcs digital world
 

Semelhante a Building an alarm clock with node.js (20)

Scaling websites with RabbitMQ A(rlvaro Videla)
Scaling websites with RabbitMQ   A(rlvaro Videla)Scaling websites with RabbitMQ   A(rlvaro Videla)
Scaling websites with RabbitMQ A(rlvaro Videla)
 
Html5 episode 2
Html5 episode 2Html5 episode 2
Html5 episode 2
 
AudioSIG28Nov2011
AudioSIG28Nov2011AudioSIG28Nov2011
AudioSIG28Nov2011
 
BDD For Zend Framework With PHPSpec
BDD For Zend Framework With PHPSpecBDD For Zend Framework With PHPSpec
BDD For Zend Framework With PHPSpec
 
Teletrain liever geen mensen om service te geven
Teletrain liever geen mensen om service te gevenTeletrain liever geen mensen om service te geven
Teletrain liever geen mensen om service te geven
 
TAG Recruiting Atlanta - 3 Phases of Mobile Recruiting Strategy
TAG Recruiting Atlanta - 3 Phases of Mobile Recruiting StrategyTAG Recruiting Atlanta - 3 Phases of Mobile Recruiting Strategy
TAG Recruiting Atlanta - 3 Phases of Mobile Recruiting Strategy
 
Distribute the workload, PHPTek, Amsterdam, 2011
Distribute the workload, PHPTek, Amsterdam, 2011Distribute the workload, PHPTek, Amsterdam, 2011
Distribute the workload, PHPTek, Amsterdam, 2011
 
Smartphones: The 21st Century Teacher Toolbox
Smartphones: The 21st Century Teacher ToolboxSmartphones: The 21st Century Teacher Toolbox
Smartphones: The 21st Century Teacher Toolbox
 
Node Stream
Node StreamNode Stream
Node Stream
 
web标准化交流会上海站bobby分享
web标准化交流会上海站bobby分享web标准化交流会上海站bobby分享
web标准化交流会上海站bobby分享
 
web标准化交流会bobby分享
web标准化交流会bobby分享web标准化交流会bobby分享
web标准化交流会bobby分享
 
How to Install, Use, and Customize Drush
How to Install, Use, and Customize DrushHow to Install, Use, and Customize Drush
How to Install, Use, and Customize Drush
 
Titanium setup
Titanium setupTitanium setup
Titanium setup
 
開発者のためのiPhone⇔Androidアプリ移植のポイント
開発者のためのiPhone⇔Androidアプリ移植のポイント開発者のためのiPhone⇔Androidアプリ移植のポイント
開発者のためのiPhone⇔Androidアプリ移植のポイント
 
videocourse
videocoursevideocourse
videocourse
 
Distribute the workload, PHP Barcelona 2011
Distribute the workload, PHP Barcelona 2011Distribute the workload, PHP Barcelona 2011
Distribute the workload, PHP Barcelona 2011
 
clrh56
clrh56clrh56
clrh56
 
Video For Real Estate
Video For Real EstateVideo For Real Estate
Video For Real Estate
 
Future Tense
Future TenseFuture Tense
Future Tense
 
AmbientTalk, a scripting language for Android devices - Dries Harnie, VUB - d...
AmbientTalk, a scripting language for Android devices - Dries Harnie, VUB - d...AmbientTalk, a scripting language for Android devices - Dries Harnie, VUB - d...
AmbientTalk, a scripting language for Android devices - Dries Harnie, VUB - d...
 

Mais de Felix Geisendörfer

Mais de Felix Geisendörfer (14)

Nodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredevNodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredev
 
How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)
 
How to Test Asynchronous Code
How to Test Asynchronous CodeHow to Test Asynchronous Code
How to Test Asynchronous Code
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
Nodejs - A quick tour (v5)
Nodejs - A quick tour (v5)Nodejs - A quick tour (v5)
Nodejs - A quick tour (v5)
 
Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?
 
Nodejs - A quick tour (v4)
Nodejs - A quick tour (v4)Nodejs - A quick tour (v4)
Nodejs - A quick tour (v4)
 
Node.js in production
Node.js in productionNode.js in production
Node.js in production
 
Nodejs - A-quick-tour-v3
Nodejs - A-quick-tour-v3Nodejs - A-quick-tour-v3
Nodejs - A-quick-tour-v3
 
Dirty - How simple is your database?
Dirty - How simple is your database?Dirty - How simple is your database?
Dirty - How simple is your database?
 
Node.js - A Quick Tour II
Node.js - A Quick Tour IINode.js - A Quick Tour II
Node.js - A Quick Tour II
 
Node.js - A Quick Tour
Node.js - A Quick TourNode.js - A Quick Tour
Node.js - A Quick Tour
 
With jQuery & CakePHP to World Domination
With jQuery & CakePHP to World DominationWith jQuery & CakePHP to World Domination
With jQuery & CakePHP to World Domination
 
ActiveDOM
ActiveDOMActiveDOM
ActiveDOM
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Building an alarm clock with node.js

  • 1. Building an alarm clock with node.js or Hacking vs. Engineering Felix Geisendörfer 29.09.2011 (v1) Donnerstag, 29. September 2011
  • 2. Text Welcome to the Siesta right-after-lunch Session! Donnerstag, 29. September 2011
  • 3. Building an alarm clock with node.js or Hacking vs. Engineering Felix Geisendörfer 29.09.2011 (v1) Donnerstag, 29. September 2011
  • 4. @felixge Twitter / GitHub / IRC Donnerstag, 29. September 2011
  • 5. My Problem • Getting up early in the morning • That means before 12:00 (noon) Donnerstag, 29. September 2011
  • 6. This talk • How I solved this problem • Hacking vs. Engineering the solution Donnerstag, 29. September 2011
  • 7. Patient History • 23 years • Working from home • Can work any hours Donnerstag, 29. September 2011
  • 8. So why get up early? • To get more stuff done ... Donnerstag, 29. September 2011
  • 10. Text Behavioral Conditioning Donnerstag, 29. September 2011
  • 11. Text Flying alarm clock Donnerstag, 29. September 2011
  • 12. Text Circadian rhythm app (Sleep Cycle) Donnerstag, 29. September 2011
  • 13. Text Many alarms Donnerstag, 29. September 2011
  • 14. Nothing was working Donnerstag, 29. September 2011
  • 22. The Script https://gist.github.com/1a40a207cf6132f77efa Donnerstag, 29. September 2011
  • 23. sudo ./alarm.js 7 30 Donnerstag, 29. September 2011
  • 25. Result • Reliably waking up at any time • Get to choose different music every night Donnerstag, 29. September 2011
  • 27. (Software) Engineering “Rigorous application of science” Donnerstag, 29. September 2011
  • 28. Hacking “Playful cleverness” Donnerstag, 29. September 2011
  • 29. Hacking vs. Engineering this project Donnerstag, 29. September 2011
  • 30. Tests? Engineering: Yes Hacking: Maybe Donnerstag, 29. September 2011
  • 31. Airtunes? Engineering: Implement protocol Hacking: Piggyback on iTunes or VLC Donnerstag, 29. September 2011
  • 32. Code var file = '/my/music/file.mp3'; var vlcPath = '/Applications/VLC.app/Contents/MacOS/VLC'; var vlc = spawn(vlcPath, [ '-R', '--sout=#transcode {acodec = alac channels = 2, samplerate = 44100}: raop{host=10.0.1.13,volume=255}', file ]); vlc.stdout.setEncoding('utf8'); vlc.stderr.setEncoding('utf8'); vlc.stdout.on('data', process.stdout.write); vlc.stderr.on('data', process.stderr.write); vlc.on('exit', function(code, signal) { console.log('vlc exit: %i %s', code, signal); }); Donnerstag, 29. September 2011
  • 33. Wakeup from Sleep? Engineering: pmset schedule wakeorpoweron <datetime> Hacking: pmset schedule wakeorpoweron MTWRFSU <time> Donnerstag, 29. September 2011
  • 34. Code var powerCmd = sprintf( 'pmset repeat wakeorpoweron MTWRFSU %02d:%02d:00', powerHour, powerMinute ); exec(powerCmd, function(err) { if (err) throw err; process.setuid('felix'); }); Donnerstag, 29. September 2011
  • 35. Turn off speakers? Engineering: Install speakers in unreachable place. Hacking: ? Donnerstag, 29. September 2011
  • 36. Text Duct Tape Donnerstag, 29. September 2011
  • 37. Duct Tape of Concurrent I/O Donnerstag, 29. September 2011
  • 38. Engineering Solution for Concurrency Donnerstag, 29. September 2011
  • 39. Why am I talking about this? Donnerstag, 29. September 2011
  • 40. JS has a very hacker-driven culture Donnerstag, 29. September 2011
  • 41. Text Duct tape of the web Donnerstag, 29. September 2011
  • 42. Text Duct tape of the DOM Donnerstag, 29. September 2011
  • 43. • Hacking is lots of fun, go do it! • Hacking can be a good solution! • But be aware that many problems call for an engineering approach. Donnerstag, 29. September 2011
  • 44. Where we need more engineering: • Libraries • Domain logic • Performance Donnerstag, 29. September 2011
  • 45. TL;DL • Hack when in doubt • Engineer when clear Donnerstag, 29. September 2011
  • 47. Questions? @felixge Donnerstag, 29. September 2011