Thanks to visit codestin.com
Credit goes to jugad2.blogspot.com

Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Thursday, March 20, 2014

JSONLint.com, an online JSON validator

By Vasudev Ram



JSON page on Wikipedia.

JSON, as most developers nowadays know, has become useful as a data format both for web client-server communication and for data interchange between different languages, since most popular programming languages have support for it (see the lower part of the JSON home page linked above in this sentence).

While searching for information about some specific aspects of JSON for some Python consulting work, I came across this site:

JSONLint.com

JSONLint.com is an online JSON validator. It is from the Arc90 Lab. (Arc90 is the creator of Readability, a tool that removes the clutter from web pages and makes a clean view for reading now or later on your computer, smartphone, or tablet.)

You paste some JSON data into a text box on the site and then click the Validate button, and it tells you whether the JSON is valid or not.

JSONLint.com is a useful resource for any language with JSON support, including Python.

P.S. Arc90 is being acquired by SFX Entertainment, Inc. (NASDAQ:SFXE).

- Vasudev Ram - Python consulting and training

Contact Page

Monday, January 27, 2014

JackDB, a web-based database client

JackDB - http://www.jackdb.com/ - is a browser-based database client. It requires no installation.

Friday, January 3, 2014

websocketd and Python for system monitoring - the JavaScript WebSocket client

By Vasudev Ram

In my previous post:

Use WebSockets and Python for web-based system monitoring ,

I said I'd show the HTML + JavaScript client code for the monitoring app in my next post. Here it is, in the file psutil_disk_usage.html:

<!DOCTYPE html>
<html>
    <head>
        <title>
        Disk space monitoring with websocketd (Go) and psutil (Python).
        </title>
    </head>
    <body>
        <h3>
        Disk space monitoring with websocketd (Go) and psutil (Python).
        </h3>
        <p>
            <div id="log"></div>
        </p>
        <script>
            // helper function: log message to screen
            function log(msg) {
                document.getElementById('log').innerText += msg + '\n';
            }

            // setup websocket with callbacks
            var ws = new WebSocket('ws://localhost:8080/');
            ws.onopen = function() {
                log('CONNECT');
            };
            ws.onclose = function() {
                log('DISCONNECT');
            };
            ws.onmessage = function(event) {
                log('MESSAGE: ' + event.data);
            };
        </script>
    </body>
</html>
As you can see, the code is pretty straightforward. You open the above HTML file in a WebSocket-enabled browser after running the websocketd command I showed in my previous post. (If you start the HTML page before the websocketd command, the client socket times out and disconnects, because it has nothing to read.

Here is the output of running the websocketd command at the command line:


And here is the WebSocket client running in the browser, showing the first two lines of disk space info pushed to it by the server:


Though it was coincidental, I realized that the websocket-based system monitoring technique shown (in this post and my previous post) may be useful for collecting system or sensor data from devices in the Internet of Things (IoT), as I mentioned in this other recent post:

PTC Acquires ThingWorx, Internet of Things Platform Provider

, in which I said:

[ One point of interest is the use of the IoT for system monitoring. Since many more devices will have some intelligence (i.e. a processor built-in) and network access, monitoring systems comprising of many such "things" could be potentially easier and more scalable. ]

For example, many IoT devices could send their data (on weather, traffic, etc.) to a server, which could use WebSockets as in this example to push the analysed / consolidated / summarized data to a WebSocket client running in a browser, for human consumption.

- Vasudev Ram - Dancing Bison Enterprises

Contact Page



Friday, October 18, 2013

xtopdf - an online presentation


By Vasudev Ram

(Updated the post with more links and a few edits; apologies to readers seeing it twice as a result, via feed readers.)

While doing some minor work on my PDF creation toolkit, xtopdf (which is written in Python), I realized that there was no central place where all or most of its features and uses were described, although I have written various articles about xtopdf on this blog and elsewhere on the Internet. I also realized that over a period of time, I have been adding various features or improvements to xtopdf, which some users may not be aware of.

And coincidentally, while browsing the site of a Python Quant, Dr. Yves J. Hilpisch, I saw a presentation there, done using Reveal.js, by Hakim El Hattab. Reveal.js looks very good, BTW. It is a JavaScript tool for creating online presentations. It can be used by creating your slides manually in HTML/JavaScript/CSS, or via an online tool:

There is a companion site, slid.es, where you can create a presentation using Reveal.js. The slid.es site has both free and paid accounts.

So I created a presentation about xtopdf on the slid.es site.

You can view it either here: slid.es/vasudevram/xtopdf, or embedded below:



I hope the xtopdf presentation helps readers and users to get to know xtopdf better, and use it to the fullest. Note: the presentation has hyperlinks; make sure to (right-)click on them to see all the information about xtopdf.

- Vasudev Ram - Dancing Bison Enterprises

Make a Python training or consulting inquiry

Friday, March 1, 2013

repl.it, online REPL for many languages, and empythoned

By Vasudev Ram

repl.it is an online REPL (Read-Eval-Print-Loop) for multiple programming languages, including for Python. Some of the other supported languages are QBASIC, FORTH, Lua and Scheme and Ruby (it says "beta" for Ruby, but the other languages also may not have full support, e.g. see the excerpts below).

Here is a small test run of using repl.it with Python, that I just did:
Python 2.7.2 (default, Jul 20 2011, 02:32:18)
[GCC 4.2.1 (LLVM, Emscripten 1.5, Empythoned)] on linux2
   def foo(bar): 
..   print "in foo, bar =", bar 
..   
   foo(1)
in foo, bar = 1
   foo("ab")
in foo, bar = ab
   
   for i in range(4): 
..   foo(i) 
..   
in foo, bar = 0
in foo, bar = 1
in foo, bar = 2
in foo, bar = 3

   class Foo(): 
..   def bar(self): 
..     print "in Foo.bar()" 
..     
   
   foo = Foo()
   foo.bar()
in Foo.bar()
    

About repl.it.

For running Python, repl.it uses empythoned, which in turn uses emscripten.

Excerpts from the related tools' sites:

[ Empythoned is a build script that uses Emscripten to compile CPython for use in a browser. It attempts to compile the main interpreter as a single small executable and the whole standard library as dynamically loaded libraries.

The project is in its infancy. Right now the core interpreter works very well, but many of the libraries either don't work at all or contain various bugs. ]

[ Emscripten is an LLVM-to-JavaScript compiler. It takes LLVM bitcode - which can be generated from C/C++, using llvm-gcc or clang, or any other language that can be converted into LLVM - and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run).

Links to demos, tutorial, FAQ, etc: https://github.com/kripken/emscripten/wiki

Main project page: http://emscripten.org ]

- Vasudev Ram - Dancing Bison Enterprises



Saturday, February 23, 2013

Dashboard gauges for JavaScript from TechOctave

Beautiful dashboard gauges for the sophisticated developer.

Just saw this.

TechOctave,  a US company, makes dashboard gauges for JavaScript using Raphael, the JavaScript graphics library. The gauges look very good. It is a paid product.

I had blogged about Raphael.js some time ago on my older blog, jugad.livejournal.com

- Vasudev Ram
dancingbison.com
jugad2.blogspot.com
twitter.com/vasudevram

Sunday, December 16, 2012

D3.js looks interesting

D3.js - Data-Driven Documents

I have been seeing the D3.js JavaScript library mentioned on tech sites for some days. Took a look at it today. Seems interesting and useful.

It uses a functional style, at least in parts, which can result in shorter and clearer code, something like the difference between SQL and earlier C-ISAM based approaches to data handling.

D3.js is  an abstraction over the DOM but still gives you access to the underlying HTML, CSS and SVG elements.

The D3 Gallery:

https://github.com/mbostock/d3/wiki/Gallery

- Vasudev Ram
www.dancingbison.com

Friday, October 12, 2012

Tuesday, October 2, 2012

TypeScript, a typed JavaScript from Microsoft - open source

http://www.typescriptlang.org

It has a compiler to convert TypeScript code into JavaScript.

It is open source software.

The TypeScript news currently has many comments on Hacker News:

http://news.ycombinator.com/item?id=4597716

Surprisingly, they even have info on how to use it with "other editors" like Vim, apart from Visual Studio.

A comment on HN say that Microsoft is now getting more open-source-friendly, due to newer people ("young turks" :) getting into management roles there. Good news if so.

Inspired by nature.
- dancingbison.com | @vasudevram | jugad2.blogspot.com

Monday, August 6, 2012

Raphael JS has improved a lot (v2.1.0)

By Vasudev Ram


I had first blogged (*) about Raphael, a vector graphics library for JavaScript, some years ago, on my older blog, jugad's Journal.

I came across it again today via seeing Morris.js, a time-series graph library (by Olly Smith) which uses Raphael, and found that it has improved a lot. It's now at version 2.1.0. Check out some of the demos on the Raphael site, particularly the animations.

I particularly like the gear animation, and the interactive chart, but the others are good too.

(*) The Raphael example in my earlier post (linked above), doesn't show output now (though it did earlier), probably due to some LiveJournal change. (After they were acquired there were some issues, which is one of the reasons I moved my blog from there to here.)

- Vasudev Ram - Dancing Bison Enterprises

Wednesday, July 25, 2012

html5slider

A JavaScript implementation of HTML5 <input type=range> for Firefox 4 and up:

http://frankyan.com/labs/html5slider/

Inspired by nature.
- dancingbison.com | @vasudevram | jugad2.blogspot.com

Thursday, April 12, 2012

Meteor real-time Javascript framework getting noticed

http://docs.meteor.com/#concepts

There was a thread about it on Hacker News recently. Concepts seem good (see above link), time will tell.

- Vasudev Ram
www.dancingbison.com

Saturday, March 3, 2012

Paper, Processing, Raphael - 3 web drawing libraries


Good overview of the use of, and differences between them:

http://coding.smashingmagazine.com/2012/02/22/web-drawing-throwdown-paper-processing-raphael

Via Peter Cooper's JavaScript Weekly.

- Vasudev Ram
www.dancingbison.com

Tuesday, October 11, 2011

Dart from Google, a structured web programming language

By Vasudev Ram - dancingbison.com | @vasudevram | jugad2.blogspot.com

Google has just released the first public version of Dart, a new language, meant for what they call "structured web programming".

They had announced that they were working on Dart some weeks / months earlier.

The Dart language site is here: http://www.dartlang.org

It has an introduction to Dart, and links to a tutorial and a technical overview, among other things.

There is already a Dart thread on Hacker News, with tons of comments, some pro, some con:

http://news.ycombinator.com/item?id=3092558

Google says that the language can be used in most modern browsers - Chrome, Safari 5+, Firefox 4+, as well as on servers.

The site http://www.dartlang.org/ currently has an app called Dartboard.

Dartboard allows you to run a few sample snippets of Dart code.

It also lets you modify them and then run the modified versions.

I tried out the 4 or so sample Dart snippets in a recent Chrome version.

All samples worked. But running the code seemed to trigger web requests, even though the code itself was not doing anything web-related, as far as I know.

Not sure why, as of now. Possibly it is because the Chrome version I used does not yet support Dart, so clicking Run may be sending a request to the server to compile the Dart code into JavaScript and send it back to the browser to be run - Google does say that that is the way in which Dart will be able to run on browsers that _do not_ have explicit support for it.

Posted via email

- Vasudev Ram @ Dancing Bison

Monday, October 3, 2011

Blaast - next Skype or hype?


By Vasudev Ram - dancingbison.com | @vasudevram | jugad2.blogspot.com

I got to know about Helsinki, Finland-based Blaast via Twitter.

This may be the best place to start checking them out - their about page:

http://blaast.com/about

Excerpts from their about page:

[
Most people aren’t connected to the Internet today but when they do finally get online, they’ll use a mobile phone.
...
Right now though, smart phones are just too expensive for emerging markets. That’s where Blaast comes in: we’re bringing mobile apps and a smartphone user experience to the next billion people.
...
Through a series of unique distribution partnerships, Blaast is working together with mobile network operators. In effect, this creates a unique subscription based app store offering, one which offers developers recurring revenues in addition to huge subscriber bases.
...
Blaast is funded by the founding engineers of Skype, Veturi Venture Accelerator and top European and Asian angels.
]

(Their technical model seems to be partly about splitting the mobile app functionality between the mobile device and the cloud (on the back end). And the apps are written completely in JavaScript, on both front end (device) and back end.)

Also check these links about Blaast:

Blaast Raises Funding, On Track For A Blowout Year:

http://www.arcticstartup.com/2011/03/02/blaast-raises-funding-on-track-for-a-blowout-year

Mobile Cloud Startup Blaast Raises Seed Money:

http://gigaom.com/2011/03/01/mobile-cloud-startup-blaast-raises-seed-money/

From that GigaOm post:

"The Wall Street Journal recently quoted ABI Research analyst Mark Beccue suggesting that the number of mobile phone users who access apps through the cloud will rocket from 42.8 million in 2008 to nearly 1 billion by 2014."

The Blaast Twitter account:

http://twitter.com/#!/blaast

Blaast is hiring:

http://blaast.com/jobs

Blaast developer site:

https://developer.blaast.com

- - Vasudev Ram @ Dancing Bison



Tuesday, May 17, 2011

jslinux - boot and run Linux inside your browser

By Vasudev Ram - www.dancingbison.com

jslinux by Fabrice Bellard - http://bellard.org/jslinux/ - lets you "run Linux in your browser". It requires a fairly recent browser. I used Google Chrome 11.0.x. Just saw this on Hacker News (HN) and tried it out. It does work some. Showed typical messages of a Linux OS booting up, in the browser window. Then came to the Linux prompt. I tried a few standard Linux commands:

uname -a # Worked.

ls -l #Worked, showed only one file, hello.c

cat hello.c # Worked, showed a hello world program that can be compiled with tcc.

tcc -o hello hello.c #Worked, created the hello binary

./hello # Worked, showed output "Hello World".

which cat # Worked, showed "/bin/cat".

The /bin directory has about 97 commands. Some of them are dummies, e.g., hostname outputs "null". The less command and the grep command worked. So did wc.

ls -l | wc -l
97

The HN comments say that Fabrice used JavaScript to create an x86 emulator in the browser.

Of course it can't be a complete Linux but still, amazing work.

Check out the HN thread here:

http://news.ycombinator.com/item?id=2555349

This is his web site: http://bellard.org/

About Fabrice Bellard: http://en.wikipedia.org/wiki/Fabrice_Bellard

Posted via email
- Vasudev Ram

Wednesday, May 4, 2011

John Resig, jQuery creator, joining Khan Academy

By Vasudev Ram - http://www.dancingbison.com

John Resig, the creator of jQuery, the widely used JavaScript library, is joining Salman Khan's (*) Khan Academy, which develops free online courses and videos for various topics.

(*) Not the Indian movie star of the same name :-) This Salman Khan lives and works in the US, though he does have a partly Indian background.

Resig earlier worked for around 4 years for Mozilla. He's going to work full time on leading the open source and JavaScript efforts of the Khan Academy, according to his blog post (linked below).

John Resig: http://ejohn.org/about/

jQuery: http://jquery.com/

Khan Academy: http://www.khanacademy.org/

Mozilla: http://www.mozilla.org/

Here is John Resig's blog post about this news:

http://ejohn.org/blog/next-steps-in-2011/

(*) jQuery users include Google, Dell, Bank of America, Major League Baseball, Digg, NBC, CBS News, Netflix, Technorati, Mozilla, Wordpress, Drupal, according to the jQuery site.

I had blogged recently about Salman Khan and his Khan Academy, here:

Bill Gates' favorite teacher, Sal Khan:

http://jugad2.blogspot.com/2011/04/bill-gates-favorite-teacher-sal-khan.html


Posted via email
- Vasudev Ram - Dancing Bison Enterprises