I have a project wherein I need to access remotely hosted RRD files and create a highly interactive dashboard to visualize the data (most likely using Rails/Flot etc..)
I've looked into projects such as RRDTool and Jarmon (which seems to be collectd specific) and was wondering if there was a proven way to get the data from the rrd files into a format I can use on the javascript side of things. I intend to have this running on a fairly simple heroku instance, if that's any indicator of my server restrictions.
Thanks so much,
Nader
Have a look at rrdtool xport called on the command line it can produce json for you or when called via a scripting api you get the raw data which you cann then easily convert to json using your scripting language.
HTH
tobi
You need JavascriptRRD:
http://javascriptrrd.sourceforge.net/index.html
As the name implies (Javascript RRD), javascriptRRD is a javascript library for reading and interpreting RRD (Round Robind Database) files from both remote Web servers and local file directories. It uses AJAX-like techniques, but without any code being run on a remote Web server; i.e. it provides a purely client-side access to RRD files.
The javascriptRRD package provides the basic RRD reading libraries, as well as helper libraries to make displaying of RRD files easy with the Flot library.
Related
I am trying to write an application that will use Ember to post to a Rails app with a Postgres database backend. The application has a front end that deals with users calendars and keeping track of recurrence of events so I thought it would be great to use the iCal format for keeping track of everything and doing exports. Is there a JavaScript library that would work for generating, parsing and exporting iCal formatted events?
Thanks!
There is a NodeJS module called node-icalendar, which you can use in conjunction with browserify (a tool that lets you use NodeJS modules in the browser) generate and parse iCalendar files in your front-end app.
I've used node-icalendar in my own NodeJS apps, without too much luck (that's not to say it won't work for you!). What I personally ended up doing was reading the iCalendar spec and formulating my own super bare-bones .ical file generator that exactly met my needs.
Wouldn't you want to parse the icalendar file on the server with Rails? You could use something like ri_cal.
I want to create .xls .xlsx file from NodeJS but i can't find any stable module for do that.
Is there any stable nodejs module for generating simple excel pages ?
The Excel format is published by Microsoft as an open specification. You can get the spec here in a nicely formatted, intimidating 1200 page PDF.
I've used Microsoft spec documents before to figure out how to implement partial (incomplete) systems that just serve my specific use cases. In other words, if you can figure out the exact bits you need (i.e. just convert a 2d array into some excel rows), then you can often ignore rest of the spec as it doesn't apply to you.
I've also found that looking at solutions written in other languages has helped me - for example, here's a project that uses c#.
Depending on whats available on your backend system, you could spawn a child process that handles the conversion.
Or, you could offload the whole thing to a web service. Google Documents List API allows you to store and manipulate files Google Docs, and then with Google Spreadsheets API you can read and modify the data in Google Spreadsheets.
I realize none of this really addresses your question of the availability of a library, but might give you a new way of solving the problem.
Did you tried the sheetjs? It is the best lib ever!
I also wrote a simple formula parser if you need to evaluate some formula on nodejs server side.
OpenXML SDK for javascript
Use this.
Is it possible with Javascript or jQuery to convert mp3, wav, etc. to m4r format?
Let's assume you had a library that can change the format of files.
Let's also assume you only need the application to work on current browsers that implement FileAPI or FileReference so you can have access to uploaded files (you can't have access to them without FileAPI or FileReference unless you use Flash or Java Applets or equivalent technologies).
You wouldn't be able to write the output file back to the user because JavaScript is not allowed to access the local filesystem.
Your only solution would become sending the converted file to the server and the server sending it back to you with a force download directive so that the user will be prompted to download the results.
Now back to if there were a library that can the conversion (or even native JavaScript)... I haven't heard of any. It's not impossible to build one but it is impractical and wouldn't run very fast.
Edit:
Let's not forget Node.js!
It's a backend server that uses Google Chrome's V8 JavaScript interpretor/compiler. And it runs JavaScript as a backend scripting engine.
You have access to filesystem, databases and everything if you use that (or any other backend system for that matter) and still be using JavaScript. You can use libraries too. Either written in JavaScript or libraries written in other languages that have been linked to interface with Node.js.
Edit 2:
There is a PC emulator written entirely in JavaScript. It runs binary executables if you want it to. It's called JSLinux.
If you're feeling particularly rambunctious you can grab the ffmpeg binary executable (compiled with static linking). And embed it into your application code as an uuencoded string then use JSLinux to execute the commands and grab the results.
Indeed, it is possible doing this on the client using the latest js technologies. A web-worker thread can do the work in the background. At least in Firefox and Chrome it is also possible to read ("upload in memory") and write ("download from memory") files using the new W3C File API, see here.
I managed to read files via drag&drop from and within the client using google's GWT which in the end is plain javascript, so it must also be possible to do it "natively".
Besides that, the conversation algorithm of course has to be implemented in a javascript web worker to avoid blocking the gui. This should be the hardest part, but not impossible, though.
You would need a backend to do this. You may want to look into the PHPExtension of FFmpeg
I am trying to write a small web tool which takes an Excel file, parses the contents and then compares the data with another dataset. Can this be easily done in JavaScript? Is there a JavaScript library which does this?
How would you load a file into JavaScript in the first place?
In addition, Excel is a proprietary format and complex enough that server side libraries with years in development (such as Apache POI) haven't yet managed to correctly 100% reverse engineer these Microsoft formats.
So I think that the answer is that you can't.
Update: That is in pure JavaScript.
Update 2: It is now possible to load files in JavaScript: https://developer.mozilla.org/en-US/docs/DOM/FileReader
In the past four years, there have been many advancements. HTML5 File API has been embraced by the major browser vendors and performance enhancements actually make it somewhat possible to parse excel files (both xls and xlsx) in the browser.
My entries in this space:
http://oss.sheetjs.com/js-xls/ (xls)
http://oss.sheetjs.com/js-xlsx/ (xlsx)
Both are pure-JS parsers
To do everything in js, you'll have to use ActiveX and probably the office web components as well. Just a suggestion, but you probably don't want to go this route; it'll be inefficient and IE/Win only. You'll be better off with a server based solution.
You will need to use ActiveX (see W3C Schools on the use of AJAX) and register the file in the hosting computers Dataconnectors (only the computer hosting the file). Unlike mentioned before, this method is not Microsoft platform dependant (for the client anyways) and you do not need to have Office components installed.
This can be done for most datafiles registered in Windows, including MDB's, and allows you as much control as you want, as you can assign different Windows Accounts for different purposes.
Like I said before, this all is serverside and has no impact on the client, apart from maybe retrieving credentials, actions and all that.
This method uses JavaScript, SQL (no, not even MSSQL, just SQL standard) and requires only that the hosting computer is running ANY Microsoft NT platform.
What Windows dataconnectors do is provide a generalised interface for various data components much like DirectX does for videocards and other peripherals. You can also use it to link an MDB (Microsoft Access) to a MySQL server and feed data live that way, which I believe is even simpler than using XLS spreadsheets...especially since you can import XLS into MDB.
Do you really need an Excel file? Why not use Excel to export the data in CSV or XML and load that?
The Excel file format is very specific to Excel's implementation. If you just need the data, use a file format that just contains the data.
I need to edit an xml file using javascript. Now I'm involved in a project of online testing.
The question.xml file is already in the project folder.
In that i want to add or edit the questions(only using javascript). I'm able to bring the particular content through ajax, but I am not able to edit the file.
Javascript can't write to a file. The best you'll be able to do is get Javascript to read and edit the XML then post that data to a server-side script to write to file.
Until now, Google Chrome is the only web browser that has a functioning implementation of the FileSystem API, therefore, it may allow you to save files locally using only Javascript.
Obviously, for security reasons, when writing files to the local file system, the user must explicitly allow it.
A working tutorial: http://www.html5rocks.com/en/tutorials/file/filesystem/
Nickf is correct. The reason Javascript can't write to a file is because it is a Client-Side language. Javascript will never have permission to write a file because it has to operate inside the browser sandbox.
You will need to use a server-side script (.NET, PHP, ColdFusion, etc) to write the file.
If you are willing to use Google Gears, you get a sandbox on the client machine on which you can write files.
Javascript has no built-in file I/O (a.k.a. you can't do it with JS alone)
Instead use some kind of server side language such as PHP or ASP.NET in conjunction with Javascript's AJAX functionality.
Look over Adobe's Flex development system. There are ways you can use it to build an app that runs in the browser (or not) and can access the filesystem (Windows/Mac/Linux). It's programmed in ActionScript, a dialect of javascript; and can interoperate with javascript in the browser.