SlideShare uma empresa Scribd logo
1 de 21
Baixar para ler offline
CouchDB
                   Couch
       @motokazu




2010   12   12
• @motokazu ( Motokazu Nishimura )


       • CouchDB


             •


             • “relax”


             • javascript    JSON


       •


             •     Arduino


             •



2010   12   12
•


             •


                 •     DB


       •                    mapreduce   CouchApp


       •             HTTP


       • relax



2010   12   12
•


       •


       •


             •


             •   (Google PowerMater) SSL+XML


             •



2010   12   12
•              ※


             •


             •


       •


             •      Google PowerMater
                 http://www.google.com/powermeter/about/partners.html

             •              Google PowerMater


       •


             •        Arduino + ethernet shield +


             •               CouchDB !! (+ Couchapp)




2010   12   12
2010   12   12
•         Relax


       • CouchDB


       •




2010   12   12
Sheevaplug
       AC
       ARM core 1.2GHz
       Mem: 512MB

       ...



                         SD
                              ※
2010   12    12
: Arduino +

       • Arduino


             •


             •


             •       AD


                 • 0v 5v   0 1023           analogRead


             • C
                                    Arduino
             • Pin


2010   12   12
CouchDB

       •             Vout(            )    analog 2pin


       • analogRead
                                                                         int solarValue = analogRead(solarPin);


       • sprintf    json
                             sprintf(json,"{%cstime%c: %ld, %csolarpower%c: %0d.%d, %ctemperature%c: %d}",
                                            q,q,now(), q,q,(int)solarpower,solarpower1, q,q,temperature);

       • strlen    content-length
                                                                sprintf(clength,"Content-Length: %d",strlen(json));

       • CoucnDB http                     json   POST




2010   12   12
Client client(server, 5984); // connect couchdb
                 Serial.println("connecting couchdb...");

                 if(client.connect()){
                   Serial.println("connected");
                   client.println("POST /sensmon HTTP/1.1");
                   client.println("Host: sheevabian");
                   client.println("Authorization: Basic xxx=");
                   client.println("Content-Type: application/json");
                   sprintf(clength,"Content-Length: %d",strlen(json));
                   client.println(clength);
                   client.println("Connection: Close");
                   client.println();
                   client.print(json);
                   Serial.println("POST OK");
                 } else {
                   Serial.println("connection failed");
                   return false;
                 }
                 client.stop();
2010   12   12
CouchDB

       •                          {key:        , value:                       }

                 {"_id":"676a376bc707cd7da0cb2c78050044c4","_rev":"1-a92b94af015ef8b1bed2df56f7e037c8","stime":
                                         1291595210,"solarpower":0.63,"temperature":22}}



       • DB
            curl -X PUT http://localhost:5984/sensmon
            (                       couchapp push                      )


       •                            view




2010   12   12
•


       •                . Couchapp
            https://github.com/couchapp/couchapp


       • couchapp generate sensmon


       • ...


       • couchapp push !!




2010   12   12
sensmon

       •


       •


                             sensmon
                 sensmon
                             -calendar




                 https://github.com/motokazu/sensmon
2010   12   12
sensmon

       •                                   Flot
                    http://code.google.com/p/flot/


       •                                                             (_view/all )Flot
             <script src="/_utils/script/jquery.js?1.3.1"></script>
             ...
             $.ajax({
             	        	     type: 'GET',
             	        	     dataType: 'json',
             	        	     url: "/sensmon/_design/sensmon/_view/all",
             	        	     success: function(data){
                        	   $.each(data.rows, function(id, val){
             	        	     	         	       // temperature
             	        	     	         	       var tmp = [val.value.stime, val.value.temperature];
             	        	     	         	       tempd.push(tmp);
                                     }
                                     ...
                                     datasets.push({"label":"Temperature",data:tempd, yaxis: 1 });
                                     ...
                                     var plot = $.plot($("#placeholder"), datasets , options);
                                }




2010   12   12
sensmon-calendar

       • mapreduce + group=true
                         	       $.ajax({
                         	       	     type: 'GET',
                         	       	     dataType: 'json',
                         	       	     url: "/sensmon/_design/sensmon-calendar/_view/summary_temp_day?group=true",


   map
        var key = [d.getFullYear(),(d.getMonth()+1),d.getDate()];	                        	
        emit(key, doc.solarpower);


   reduce        values.forEach(function(val){
                 	        	       	        max = Math.max(max,val.max);                       {"count":count,"max":max,"min":min,"ave":ave}
                 	        	       	        min = Math.min(min,val.min);                         {"count":count,"max":max,"min":min,"ave":ave}
                                                                                                  {"count":count,"max":max,"min":min,"ave":ave}
                 	        	       	        ave += val.ave;                                          {"count":count,"max":max,"min":min,"ave":ave}
                 	        	       	        count += val.count;                                        {"count":count,"max":max,"min":min,"ave":ave}
                                                                                                        {"count":count,"max":max,"min":min,"ave":ave}
                 	        	       });                                                                     {"count":count,"max":max,"min":min,"ave":ave}
                 	        	       ave = ave/values.length;
                                                                                                            {"count":count,"max":max,"min":min,"ave":ave}
                 	        	


       rereduce
                 	        	       return {"count":count,"max":max,"min":min,"ave":ave};


                      {"count":count,"max":max,"min":min,"ave":ave}
                      {"count":count,"max":max,"min":min,"ave":ave}
                      {"count":count,"max":max,"min":min,"ave":ave}

2010   12   12
sensmon demo

       • demo : to localhost




2010   12   12
replication

       • 0.11      1.X


             • Bad Content-Type


       • 1.X     Futon    _replication          0.11   source




2010   12   12
2010   12   12
•


             •


       • relax


             •       db   web
                 (              delay)




2010   12   12
thank you




2010   12   12

Mais conteúdo relacionado

Mais procurados

Aplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackAplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackNelson Glauber Leal
 
Thoughts on MongoDB Analytics
Thoughts on MongoDB AnalyticsThoughts on MongoDB Analytics
Thoughts on MongoDB Analyticsrogerbodamer
 
The State of NoSQL
The State of NoSQLThe State of NoSQL
The State of NoSQLBen Scofield
 
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutines
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando CoroutinesTDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutines
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutinestdc-globalcode
 
Html5 game programming overview
Html5 game programming overviewHtml5 game programming overview
Html5 game programming overview민태 김
 
D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4Jan Berdajs
 
In a galaxy far, far away - A procedural generation tale
In a galaxy far, far away - A procedural generation taleIn a galaxy far, far away - A procedural generation tale
In a galaxy far, far away - A procedural generation taleShay Davidson
 
MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !Sébastien Prunier
 
Esoteric, Obfuscated, Artistic Programming in Ruby
Esoteric, Obfuscated, Artistic Programming in RubyEsoteric, Obfuscated, Artistic Programming in Ruby
Esoteric, Obfuscated, Artistic Programming in Rubymametter
 
Doctype htm1
Doctype htm1Doctype htm1
Doctype htm1Eddy_TKJ
 
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...MongoDB
 
Building and Scaling the Internet of Things with MongoDB at Vivint
Building and Scaling the Internet of Things with MongoDB at Vivint Building and Scaling the Internet of Things with MongoDB at Vivint
Building and Scaling the Internet of Things with MongoDB at Vivint MongoDB
 
Delex 2020: Deep diving into the dynamic provisioning of GlusterFS volumes in...
Delex 2020: Deep diving into the dynamic provisioning of GlusterFS volumes in...Delex 2020: Deep diving into the dynamic provisioning of GlusterFS volumes in...
Delex 2020: Deep diving into the dynamic provisioning of GlusterFS volumes in...Artem Romanchik
 
テスト用のプレゼンテーション
テスト用のプレゼンテーションテスト用のプレゼンテーション
テスト用のプレゼンテーションgooseboi
 
Mongodb Aggregation Pipeline
Mongodb Aggregation PipelineMongodb Aggregation Pipeline
Mongodb Aggregation Pipelinezahid-mian
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation FrameworkTyler Brock
 
WordPressでIoTをはじめよう
WordPressでIoTをはじめようWordPressでIoTをはじめよう
WordPressでIoTをはじめようYuriko IKEDA
 

Mais procurados (20)

Aplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackAplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & Jetpack
 
A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?
 
Elastic search 검색
Elastic search 검색Elastic search 검색
Elastic search 검색
 
Thoughts on MongoDB Analytics
Thoughts on MongoDB AnalyticsThoughts on MongoDB Analytics
Thoughts on MongoDB Analytics
 
The State of NoSQL
The State of NoSQLThe State of NoSQL
The State of NoSQL
 
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutines
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando CoroutinesTDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutines
TDC2018SP | Trilha Kotlin - Programacao assincrona utilizando Coroutines
 
Html5 game programming overview
Html5 game programming overviewHtml5 game programming overview
Html5 game programming overview
 
D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4D-Talk: What's awesome about Ruby 2.x and Rails 4
D-Talk: What's awesome about Ruby 2.x and Rails 4
 
In a galaxy far, far away - A procedural generation tale
In a galaxy far, far away - A procedural generation taleIn a galaxy far, far away - A procedural generation tale
In a galaxy far, far away - A procedural generation tale
 
MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !
 
Esoteric, Obfuscated, Artistic Programming in Ruby
Esoteric, Obfuscated, Artistic Programming in RubyEsoteric, Obfuscated, Artistic Programming in Ruby
Esoteric, Obfuscated, Artistic Programming in Ruby
 
Doctype htm1
Doctype htm1Doctype htm1
Doctype htm1
 
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
 
Building and Scaling the Internet of Things with MongoDB at Vivint
Building and Scaling the Internet of Things with MongoDB at Vivint Building and Scaling the Internet of Things with MongoDB at Vivint
Building and Scaling the Internet of Things with MongoDB at Vivint
 
Delex 2020: Deep diving into the dynamic provisioning of GlusterFS volumes in...
Delex 2020: Deep diving into the dynamic provisioning of GlusterFS volumes in...Delex 2020: Deep diving into the dynamic provisioning of GlusterFS volumes in...
Delex 2020: Deep diving into the dynamic provisioning of GlusterFS volumes in...
 
テスト用のプレゼンテーション
テスト用のプレゼンテーションテスト用のプレゼンテーション
テスト用のプレゼンテーション
 
Mongodb Aggregation Pipeline
Mongodb Aggregation PipelineMongodb Aggregation Pipeline
Mongodb Aggregation Pipeline
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation Framework
 
Corona sdk
Corona sdkCorona sdk
Corona sdk
 
WordPressでIoTをはじめよう
WordPressでIoTをはじめようWordPressでIoTをはじめよう
WordPressでIoTをはじめよう
 

Destaque

Private lens @ yahoo open hack day 2014
Private lens @ yahoo open hack day 2014Private lens @ yahoo open hack day 2014
Private lens @ yahoo open hack day 2014Motokazu Nishimura
 
Suika warenja - スイカ割れんじゃー -
Suika warenja - スイカ割れんじゃー -Suika warenja - スイカ割れんじゃー -
Suika warenja - スイカ割れんじゃー -Motokazu Nishimura
 
UXのための心理学(仮)
UXのための心理学(仮)UXのための心理学(仮)
UXのための心理学(仮)Naruhito Kubota
 
ユーザーエクスペリエンスとユーザー心理(仮)
ユーザーエクスペリエンスとユーザー心理(仮)ユーザーエクスペリエンスとユーザー心理(仮)
ユーザーエクスペリエンスとユーザー心理(仮)Naruhito Kubota
 
デザインの価値のお話
デザインの価値のお話デザインの価値のお話
デザインの価値のお話Naruhito Kubota
 
Freer Monads, More Extensible Effects
Freer Monads, More Extensible EffectsFreer Monads, More Extensible Effects
Freer Monads, More Extensible EffectsHiromi Ishii
 

Destaque (8)

Private lens @ yahoo open hack day 2014
Private lens @ yahoo open hack day 2014Private lens @ yahoo open hack day 2014
Private lens @ yahoo open hack day 2014
 
Suika warenja - スイカ割れんじゃー -
Suika warenja - スイカ割れんじゃー -Suika warenja - スイカ割れんじゃー -
Suika warenja - スイカ割れんじゃー -
 
Plugman code-reading
Plugman code-readingPlugman code-reading
Plugman code-reading
 
Lean geo-location-data-format
Lean geo-location-data-formatLean geo-location-data-format
Lean geo-location-data-format
 
UXのための心理学(仮)
UXのための心理学(仮)UXのための心理学(仮)
UXのための心理学(仮)
 
ユーザーエクスペリエンスとユーザー心理(仮)
ユーザーエクスペリエンスとユーザー心理(仮)ユーザーエクスペリエンスとユーザー心理(仮)
ユーザーエクスペリエンスとユーザー心理(仮)
 
デザインの価値のお話
デザインの価値のお話デザインの価値のお話
デザインの価値のお話
 
Freer Monads, More Extensible Effects
Freer Monads, More Extensible EffectsFreer Monads, More Extensible Effects
Freer Monads, More Extensible Effects
 

Semelhante a Sensmon couchdb

Programming the cloud with Skywriting
Programming the cloud with SkywritingProgramming the cloud with Skywriting
Programming the cloud with SkywritingDerek Murray
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonAlex Payne
 
kissy-past-now-future
kissy-past-now-futurekissy-past-now-future
kissy-past-now-futureyiming he
 
KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天tblanlan
 
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiMonitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiInfluxData
 
Building and Deploying Application to Apache Mesos
Building and Deploying Application to Apache MesosBuilding and Deploying Application to Apache Mesos
Building and Deploying Application to Apache MesosJoe Stein
 
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourPeter Friese
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for CassandraEdward Capriolo
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"DataStax Academy
 
3 Dundee-Spark Overview for C* developers
3 Dundee-Spark Overview for C* developers3 Dundee-Spark Overview for C* developers
3 Dundee-Spark Overview for C* developersChristopher Batey
 
Weather of the Century: Design and Performance
Weather of the Century: Design and PerformanceWeather of the Century: Design and Performance
Weather of the Century: Design and PerformanceMongoDB
 
Declarative & workflow based infrastructure with Terraform
Declarative & workflow based infrastructure with TerraformDeclarative & workflow based infrastructure with Terraform
Declarative & workflow based infrastructure with TerraformRadek Simko
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseSages
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.Mike Brevoort
 
Hazelcast
HazelcastHazelcast
Hazelcastoztalip
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 
Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...
Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...
Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...confluent
 
Apache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestApache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestMyles Braithwaite
 

Semelhante a Sensmon couchdb (20)

Programming the cloud with Skywriting
Programming the cloud with SkywritingProgramming the cloud with Skywriting
Programming the cloud with Skywriting
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the Horizon
 
kissy-past-now-future
kissy-past-now-futurekissy-past-now-future
kissy-past-now-future
 
KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天
 
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiMonitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
 
Building and Deploying Application to Apache Mesos
Building and Deploying Application to Apache MesosBuilding and Deploying Application to Apache Mesos
Building and Deploying Application to Apache Mesos
 
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 Hour
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
 
From Node to Go
From Node to GoFrom Node to Go
From Node to Go
 
3 Dundee-Spark Overview for C* developers
3 Dundee-Spark Overview for C* developers3 Dundee-Spark Overview for C* developers
3 Dundee-Spark Overview for C* developers
 
Weather of the Century: Design and Performance
Weather of the Century: Design and PerformanceWeather of the Century: Design and Performance
Weather of the Century: Design and Performance
 
Declarative & workflow based infrastructure with Terraform
Declarative & workflow based infrastructure with TerraformDeclarative & workflow based infrastructure with Terraform
Declarative & workflow based infrastructure with Terraform
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
 
Hazelcast
HazelcastHazelcast
Hazelcast
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...
Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...
Closing the Loop in Extended Reality with Kafka Streams and Machine Learning ...
 
Apache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestApache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux Fest
 
Apache Cassandra and Go
Apache Cassandra and GoApache Cassandra and Go
Apache Cassandra and Go
 

Sensmon couchdb

  • 1. CouchDB Couch @motokazu 2010 12 12
  • 2. • @motokazu ( Motokazu Nishimura ) • CouchDB • • “relax” • javascript JSON • • Arduino • 2010 12 12
  • 3. • • DB • mapreduce CouchApp • HTTP • relax 2010 12 12
  • 4. • • • • (Google PowerMater) SSL+XML • 2010 12 12
  • 5. ※ • • • • Google PowerMater http://www.google.com/powermeter/about/partners.html • Google PowerMater • • Arduino + ethernet shield + • CouchDB !! (+ Couchapp) 2010 12 12
  • 6. 2010 12 12
  • 7. Relax • CouchDB • 2010 12 12
  • 8. Sheevaplug AC ARM core 1.2GHz Mem: 512MB ... SD ※ 2010 12 12
  • 9. : Arduino + • Arduino • • • AD • 0v 5v 0 1023 analogRead • C Arduino • Pin 2010 12 12
  • 10. CouchDB • Vout( ) analog 2pin • analogRead int solarValue = analogRead(solarPin); • sprintf json sprintf(json,"{%cstime%c: %ld, %csolarpower%c: %0d.%d, %ctemperature%c: %d}", q,q,now(), q,q,(int)solarpower,solarpower1, q,q,temperature); • strlen content-length sprintf(clength,"Content-Length: %d",strlen(json)); • CoucnDB http json POST 2010 12 12
  • 11. Client client(server, 5984); // connect couchdb Serial.println("connecting couchdb..."); if(client.connect()){ Serial.println("connected"); client.println("POST /sensmon HTTP/1.1"); client.println("Host: sheevabian"); client.println("Authorization: Basic xxx="); client.println("Content-Type: application/json"); sprintf(clength,"Content-Length: %d",strlen(json)); client.println(clength); client.println("Connection: Close"); client.println(); client.print(json); Serial.println("POST OK"); } else { Serial.println("connection failed"); return false; } client.stop(); 2010 12 12
  • 12. CouchDB • {key: , value: } {"_id":"676a376bc707cd7da0cb2c78050044c4","_rev":"1-a92b94af015ef8b1bed2df56f7e037c8","stime": 1291595210,"solarpower":0.63,"temperature":22}} • DB curl -X PUT http://localhost:5984/sensmon ( couchapp push ) • view 2010 12 12
  • 13. • . Couchapp https://github.com/couchapp/couchapp • couchapp generate sensmon • ... • couchapp push !! 2010 12 12
  • 14. sensmon • • sensmon sensmon -calendar https://github.com/motokazu/sensmon 2010 12 12
  • 15. sensmon • Flot http://code.google.com/p/flot/ • (_view/all )Flot <script src="/_utils/script/jquery.js?1.3.1"></script> ... $.ajax({ type: 'GET', dataType: 'json', url: "/sensmon/_design/sensmon/_view/all", success: function(data){ $.each(data.rows, function(id, val){ // temperature var tmp = [val.value.stime, val.value.temperature]; tempd.push(tmp); } ... datasets.push({"label":"Temperature",data:tempd, yaxis: 1 }); ... var plot = $.plot($("#placeholder"), datasets , options); } 2010 12 12
  • 16. sensmon-calendar • mapreduce + group=true $.ajax({ type: 'GET', dataType: 'json', url: "/sensmon/_design/sensmon-calendar/_view/summary_temp_day?group=true", map var key = [d.getFullYear(),(d.getMonth()+1),d.getDate()]; emit(key, doc.solarpower); reduce values.forEach(function(val){ max = Math.max(max,val.max); {"count":count,"max":max,"min":min,"ave":ave} min = Math.min(min,val.min); {"count":count,"max":max,"min":min,"ave":ave} {"count":count,"max":max,"min":min,"ave":ave} ave += val.ave; {"count":count,"max":max,"min":min,"ave":ave} count += val.count; {"count":count,"max":max,"min":min,"ave":ave} {"count":count,"max":max,"min":min,"ave":ave} }); {"count":count,"max":max,"min":min,"ave":ave} ave = ave/values.length; {"count":count,"max":max,"min":min,"ave":ave} rereduce return {"count":count,"max":max,"min":min,"ave":ave}; {"count":count,"max":max,"min":min,"ave":ave} {"count":count,"max":max,"min":min,"ave":ave} {"count":count,"max":max,"min":min,"ave":ave} 2010 12 12
  • 17. sensmon demo • demo : to localhost 2010 12 12
  • 18. replication • 0.11 1.X • Bad Content-Type • 1.X Futon _replication 0.11 source 2010 12 12
  • 19. 2010 12 12
  • 20. • • relax • db web ( delay) 2010 12 12
  • 21. thank you 2010 12 12