Posts

Scala: Read JSON from Solr

The Scala play library has a library for creating and reading JSON. To import it you can add a couple lines in SBT: libraryDependencies += "com.typesafe.play" %% "play-json" % "2.4.6" libraryDependencies += "org.scalaj" %% "scalaj-http" % "2.3.0" To hit Solr, you can build a URL and pull the result with the HTTP library I imported: […]

Proxying HTTP requests with PHP

The following code will proxy requests to an external API. This has several advantages: Control over an API key Set caching headers to prevent overuse of an API Prevent issues with cross-domain scripting errors Limit the scope of what APIs can be called through your proxy $query = urlencode($_GET[’query’]); $url = ”;   $url = […]

, ,

Building a JSON webservice in R

R is a programming language for mathematics and statistics. There are several R libraries available to support web development, including rjson and RJSONIO (note case – R library names are case sensitive). RJSONIO is based on rjson, but with modifications to improve performance working with large JSON payloads. The example below returns the data required […]

ExtJS ListView Example

Problem You want to display a grid which lists a series of objects. Solution Use a GridPanel (aka ListView): Ext.require([ ‘Ext.grid.*’, ‘Ext.data.*’, ‘Ext.util.*’, ‘Ext.state.*’ ]);   Ext.onReady(function() { var trackStore = new Ext.data.Store({ storeId: ‘soundCloudStore’,   proxy: { type: ‘ajax’, url: ‘blues.json’, reader: { type: ‘json’, idProperty: ‘id’ } }, fields:[’duration’, ‘genre’, ‘created_at’, ‘kind’, ‘title’, […]