物理仪表板/状态板的库和伪代码 [英] Libraries and pseudocode for physical Dashboard/Status board

查看:137
本文介绍了物理仪表板/状态板的库和伪代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我昨天为办公室买了一个46英寸的屏幕,并且即将被指控设置精心制作的世界杯拖延计划的风险,我最好向同事们展示它的意义;)



看看我简单的草图,并在这些很棒 项目从中受到启发,我希望得到以下内容:


  1. 骨架的伪代码: 由于某些方法应该每24小时调用一次(标题中的今天日期),其他方法每隔60秒调用一次(Twitter结果),使用JavaScript(jQuery)和PHP会有什么好办法? / p>

    编辑:Alsciende:我同意#1和#8太模糊了。因此我删除#8并尝试澄清#1:使用Pseudocode for骨架,我基本上的意思是这可以完全使用JavaScript定时器完成,你会如何设置各种定时器?


  2. Google Analytics库:哪些库支持Google AnalyticsAPI,可以生成整齐的图表。最好是HTML5,基于JavaScript,如 Protovis


  3. Twitter图书馆:您建议使用哪些图书馆从个人资料中获取Twitter搜索结果和最新推文。


  4. 排版/ CSS / HTML5库:在此过程中尝试学习一些HTML5等,请就任何其他可能相关的排版/ css库提出建议。


  5. 刮痧/解析?我会给你一个具体的例子:尝试从今天的菜单//www.smi.se/om-smi/restaurang-konigs/veckans-matsedel/\"rel =nofollow noreferrer>这家餐厅的网站,你会怎么做? (这是瑞典语 - 但你明白了 - 对不起;)


  6. 实时统计数据?我正在使用WordPress的WassUp插件可以在我们的网站上跟踪实时访问者。其他日志记录软件(AWStats等)也可能安装在网络服务器上。关于如何从这些信息中提取信息并在仪表板上实时显示的任何想法?


  7. 浏览器选择?哪个浏览器和OS你会选择吗?稳定,全屏,HTML5。


alt text http://www.freeimagehosting.net/uploads/cb7af2ef28.png

解决方案

我已经建立了一个类似于你在办公室谈论的仪表板。我花了大约一天时间研究它,可能性(非常)无穷无尽。基本上,我通过PHP处理的所有计算内容和间隔AJAX调用相应的PHP脚本,该脚本返回JSON数据。



#2:
对于图表,我使用/推荐flot( http://code.google的.com / p /海军报/ )。文档并不是那么好,但是一旦你弄清楚事情是如何工作的 - 这是一个很棒的库,它使用HTML5 Canvas标签生成图形。



我'以前没有将外部库与Google Analytics集成,但我认为您可以从分析中提取数据并将其格式化为flot以构建适当的图表。这可能是困难的,但我比大多数其他图形库更熟悉flot(并且它不像其他很多人那样吸吮)所以对我来说,这将是最简单的方法。完成它。



#3:
对于Twitter,使用JSON-P从搜索API中提取数据非常容易。基本上它的作用是动态地向你的DOM添加< script> 标签,这是Twitter解释的GET参数,然后调用预定义的javascript方法(你通过URI)带有json编码的结果哈希值。



#5:
刮痧和解析各个网站将会是一个艰苦的过程。每个网站都会拥有自己的模式(或非模式)来发布他们的日常菜单或特价。我将构建一个菜单脚本,它知道如何调用一些函数,并编写一个函数/类来抓取每个餐馆的网站,你有兴趣用PHP显示菜单(或者你喜欢的任何其他语言)用)。它可以用json回复,这是(imo)在Javascript中操作/处理数据的最简单方法。



#6:
实时统计数据与#5几乎相同。我将构建一些知道如何从我感兴趣的数据源中获取统计信息的类,并通过ajax调用将数据以json格式呈现给javascript。



#1:编写javascript代码以在计时器上加载数据非常简单,请查看 setInterval clearInterval setTimeout clearTimeout 方法。它们都会在调用该函数之前使用函数名(或闭包)和等待超时(以ms为单位)。你可以很容易地每60秒调用一次主计时器功能,它基本上是一个调度程序或cron样式函数,它只需要查找需要立即运行并从调度程序执行这些功能的东西。



希望这能为您提供一些关于去哪里以及如何去那里的建议。


OK, so I bought a 46" screen for the office yesterday, and with the imminent risk of being accused for setting up an "elaborate World Cup procrastination scheme", I'd better show my colleagues what it's meant for ;)

Looking at my simple sketch, and at these great projects from which I was inspired, I would like to get some input on the following:

  1. Pseudocode for the skeleton: As some methods should be called every 24 hours ("Today's date in the heading"), others at 60 second intervals ("Twitter results"), what would be a good approach using JavaScript (jQuery) and PHP?

    EDIT: Alsciende: I can agree that #1 and #8 are too vague. Therefore I remove #8 and try to clarify #1: With "Pseudocode for the skeleton", I basically mean could this be done entirely using JavaScript timers and how would you set up the various timers?

  2. Library for Google Analytics: Which libraries support the Google Analytics API and can produce neat charts. Preferably HTML5, JavaScript-based like Protovis.

  3. Library for Twitter: Which libraries would you recommend for fetching twitter search results and latest tweets from profiles.

  4. Libraries for Typography/CSS/HTML5: Trying to learn some HTML5 etc. in the process, please advice on any other typography/css libraries that could be of relevance.

  5. Scraping/Parsing? I'll give you a concrete example: Trying to fetch today's menu from this restaurant's website, how would you go about? (it's in Swedish - but you get the point - sorry ;) )

  6. Real-time stats? I'm using the WassUp-plugin for WordPress to track real-time visitors on our website. Other logging software (AWStats etc.) is probably also installed on the webserver. Any ideas on how to extract information from these and present in real-time on the dashboard?

  7. Browser choice? Which Browser and OS would you pick? Stable, Full-screen, HTML5.

alt text http://www.freeimagehosting.net/uploads/cb7af2ef28.png

解决方案

I've built a dashboard similar to what you're talking about for our office. I spent about a day working on it, the possibilities are really (pretty much) endless. Basically, all the computational stuff I handle via PHP and do interval AJAX calls to the appropriate PHP script, which returns JSON data to present.

#2: For graphs, I use/recommend flot (http://code.google.com/p/flot/). The documentation isn't really that great, but once you figure out how things generally work - it's a great library, and it generates graphs using HTML5 Canvas tag.

I've not integrated external libraries with Google Analytics before, but I assume you could pull data from analytics and format it for flot to build appropriate graphs for. This might be the hard-way around, but I'm more familiar with flot than most other graphing libraries (and it doesn't suck, as much as a lot of others do) so for me, this would be the easiest way to get it done.

#3: For twitter, it's pretty easy to pull data from their search API using JSON-P. Basically what this does, is dynamically adds a <script> tag to your DOM, which GET parameters that twitter interprets, then calls a predefined javascript method (which you pass via the URI) with a json-encoded hash of the results.

#5: Scraping and parsing individual sites is going to be a painstaking process. Every site is going to have it's own "pattern" (or non-pattern) for publishing their daily menu or specials. I'd build a "menu" script which knew how to call a few functions, and write a function / class for scraping each restaurant's site which you're interested in showing the menu for in PHP (or whatever other language you're comfortable with). It can reply with json, which is (imo) the easiest way to manipulate/process data in Javascript.

#6: Real time stats are pretty much the same as #5. I'd build a couple classes that knew how to fetch the statistics from whatever data sources I was interested in pulling from, and present the data in json to javascript, via an ajax call.

#1: Writing javascript code to load data on a timer is really simple, look into the setInterval, clearInterval, setTimeout, and clearTimeout methods. They all take a function name (or closure) and a timeout to wait before calling that function (in ms). You could easily call a master timer function every 60 seconds which would basically be a "scheduler" or a "cron" style function, which would just look for the stuff that needed to run "right now" and execute those functions from the scheduler.

Hopefully this gives you some ideas on where to go, and how to go about getting there.

这篇关于物理仪表板/状态板的库和伪代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆