http://www.revillweb.com/tutorials/angularjs-in-30-minutes-angularjs-tutorial/
Thursday, May 8, 2014
Monday, May 5, 2014
Useful R graphics link
http://stackoverflow.com/questions/14698616/when-should-i-use-geom-map
# solution 1
colnames(pointData) < - c('long','lat') # makes consistent with county_map
pointData$group < - 1 # ggplot needs a group to work with
county_map$value < - sapply(1:nrow(county_map),
function(x) round(runif(1, 1, 8), 0)) # for colours
ggplot(county_map, aes(x = long, y = lat, group = group)) +
geom_polygon(aes(fill = value)) +
coord_map() +
geom_point(data = pointData, aes(x = long, y = lat), shape = 21, fill = "red")
# solution 2
map1 < - ggplot(countyData) +
geom_map( map = county_map, aes(map_id = id,fill = value),
colour = "black") + coord_map() +
expand_limits(x = county_map$long, y = county_map$lat)
map1 + geom_point(mapping = aes(xx, yy), data = pointData)
Tuesday, April 29, 2014
Reite = R + Delite
Delite - http://stanford-ppl.github.io/Delite/
Relite - https://github.com/TiarkRompf/Relite (based on the FastR)
FastR - https://github.com/allr/fastr
With Delite, parallelized using 8 threads, we get about a 10x speedup over GNU R (and about 4x over FastR).
http://sandeeptata.blogspot.com/2012/08/scala-dsls-and-big-data.html
Relite - https://github.com/TiarkRompf/Relite (based on the FastR)
FastR - https://github.com/allr/fastr
Delite is a compiler framework and runtime for parallel embedded DSLs.
Delite provides:
- Built-in parallel execution patterns
- Optimizers for parallel code
- Code generators for Scala, C++ and CUDA
- A heterogeneous runtime for executing DSLs
With Delite, parallelized using 8 threads, we get about a 10x speedup over GNU R (and about 4x over FastR).
http://sandeeptata.blogspot.com/2012/08/scala-dsls-and-big-data.html
Monday, April 28, 2014
How to pass actor messages through websocket ?
http://stackoverflow.com/questions/21851444/scala-play-akka-websocket-how-to-pass-actor-messages-through-websocket
I have an actor which is launched with application, running in the background watching for certain changes and if there are any reporting them. At the moment it just a
println to the console. What I need to do is whenever there is a new message - send it to the front end using Websocket.
This is my Play Global object where the monitoring/listening actor is launched:
object Global extends GlobalSettings {
override def onStart(app: Application) {
class Listener extends Actor {
//This needs to be changed to pass messages to Websocket, how?
def receive = {
case Create(path) => println("CREATE " + path)
case Delete(path) => println("DELETE " + path)
case Modify(path) => println("MODIFY " + path)
}
}
val listener = Akka.system.actorOf(Props[Listener], "listener")
val swatch = Akka.system.actorOf(Props[SwatchActor], "swatch")
swatch ! Watch("/folder/path", Seq(Create, Modify, Delete), true, Some(listener))
}
}
This is my Play controller:
object Application extends Controller {
def test = WebSocket.using[String] { request =>
//This hopefully gets the listener actor reference?
val listener = Akka.system.actorSelection("/user/listener")
val (out, channel) = Concurrent.broadcast[String]
val in = Iteratee.foreach[String] { msg =>
//Actor messages must be pushed here, how?
channel push("RESPONSE: " + msg)
}
(in, out)
}
}
I understand that in order for websocket connection to be established there has to be an initial "in".
So my problems are:
- How do I modify the
Listeneractor to push messages to Websocket? - What do I need to do to prepare the actor to push messages once the websocket connection is established?
- How do I push messages from the listener actor to the websocket?
Saturday, April 26, 2014
Skinny Framework
http://skinny-framework.org/
https://github.com/skinny-framework
Skinny is a full-stack web app framework built on Scalatra.
To put it simply, Skinny framework’s concept is Scala on Rails. Skinny is highly inspired by Ruby on Rails and it is optimized for sustainable productivity for Servlet-based web app development.
What’s more, Skinny’s components are basically independent from Skinny app environment. If you prefer using only Skinny ORM, Validator module or else, it’s also possible. We hope Skinny components help developers that use other frameworks too.
What does the name
A sound-alike word “好きに (su-ki-ni)” in Japanese means “as you like it”. This is only half kidding but it also represents Skinny’s concept. Skinny framework should provide flexible APIs to empower developers as much as possible and shouldn’t get in the way.
https://github.com/skinny-framework
Skinny Framework
Skinny is a full-stack web app framework built on Scalatra.
To put it simply, Skinny framework’s concept is Scala on Rails. Skinny is highly inspired by Ruby on Rails and it is optimized for sustainable productivity for Servlet-based web app development.
What’s more, Skinny’s components are basically independent from Skinny app environment. If you prefer using only Skinny ORM, Validator module or else, it’s also possible. We hope Skinny components help developers that use other frameworks too.
Why Skinny?
What does the name
Skinny actually mean? We have three reasons as follows.Application should be skinny
All the parts of a web application - controllers, models, views, routings and other settings - should be skinny. If you use Skinny framework, you can do without a lot of non-essential boilerplate code. For instance, when you create a simple registration form, all you need to do is define the parameters and validation rules and create view templates in an efficient way (ssp, scaml, jade, FreeMarker or something else) in most cases.Framework should be skinny
Even if you need to investigate Skinny’s internals, don’t worry. Skinny keeps itself skinny, too. We believe that if the framework is well-designed, the resulting implementation will be skinny.“su-ki-ni” in Japanese means “as you like it”
A sound-alike word “好きに (su-ki-ni)” in Japanese means “as you like it”. This is only half kidding but it also represents Skinny’s concept. Skinny framework should provide flexible APIs to empower developers as much as possible and shouldn’t get in the way.
Tuesday, April 22, 2014
OpenLayers vs OpenStreetMap
http://terokarvinen.com/2012/getting-started-with-openlayers-and-openstreetmap
Add a free, interactive map on your homepage. Just plain HTML5 and JavaScript, no special server needed. Live demo with source.
No API keys needed. And if you really like it, you can later download planet vector data for free!
Prequisites: HTML5, JavaScript
Getting Started with OpenLayers and OpenStreetmap
Posted on w15 Wed 2012-04-11 by Tero Karvinen
No API keys needed. And if you really like it, you can later download planet vector data for free!
Prequisites: HTML5, JavaScript
Source Code Explained
< !doctype html >
The new HTML5 Doctype. Some older examples won’t work with HTML5. Especially, you must make sure that #map div is larger than 0×0.< meta charset="utf-8" / >
Always define the charset in document. UTF-8 is the new black.< div id="map" style="top: 0; left: 0; bottom: 0; right: 0; position: fixed;" >
Fill parent with just CSS. This is the preferred method.< script src="http://openlayers.org/api/OpenLayers.js" >< /script >
For good performance, JavaScript should be last, just before /body. OpenLayers.js should be called before your own code using it. To speed things up, you could also copy OpenLayers.js to your server.map = new OpenLayers.Map("map");
OpenLayers.Map(divName) is the main container for everything. It includes layers, all the vectors and point of interest (POI) markers.map.addLayer(new OpenLayers.Layer.OSM());
OpenLayers.Layer.OSM() is the standard OpenStreetMap Mapnik layer. This is what you normally want.var lonLat = new OpenLayers.LonLat(24.9342, 60.2017)
.transform(
new OpenLayers.Projection("EPSG:4326"), // from WGS 1984
map.getProjectionObject() // to Spherical Mercator
);
You can get coordinates from OpenStreetMap.org regular web interface. Just navigate to your point of interest, using search if needed. Then click “Permalink” on bottom right. The URL shows latitude and longitude. Be careful not to mix lat and lon: they have different order in the URL and in OpenLayers.LonLat() constructor.map.setCenter (lonLat, 14);
Getting started with the Play framewotk
http://brikis98.blogspot.com/2014/03/the-ultimate-guide-to-getting-started.html
Are you trying to get started with the Play Framework? Struggling to wrap your head around Futures, SBT, Scala, Functional Programming, or Iteratees? Then you've come to the right place.
This post is a collection of the best resources I've found for getting started with Play. I've broken it down by category to make it easier to browse and jump to the topic you're most interested in.
The list below is not meant to be comprehensive documentation, but rather, a collection of resources that cover the main areas where new Play users tend to get stuck. If you've got any great resources that are missing from the list below, leave a comment!
Introduction to Play
Are you trying to get started with the Play Framework? Struggling to wrap your head around Futures, SBT, Scala, Functional Programming, or Iteratees? Then you've come to the right place.
This post is a collection of the best resources I've found for getting started with Play. I've broken it down by category to make it easier to browse and jump to the topic you're most interested in.
The list below is not meant to be comprehensive documentation, but rather, a collection of resources that cover the main areas where new Play users tend to get stuck. If you've got any great resources that are missing from the list below, leave a comment!
Introduction to Play
- Play Framework Documentation: the official docs are a must read to get a solid starting point.
- The Play Framework at LinkedIn: Performance and Productivity at Scale: video intro to Play and why LinkedIn uses it. See the accompanying slides and blog post.
- Typesafe Activator: very easy way to get started with Play. A simple script you run to generate Play app skeletons from the many available templates - including Hello Play (Scala), Hello Play (Java), Realtime and Reactive Play apps, Play with Slick, Play with AngularJS - and an in-browser UI that interactively walks you through changing, running, and testing those apps
Subscribe to:
Posts (Atom)
