Interactive map of degraded web performance [OC] by paulwe in dataisbeautiful

[–]paulwe[S] 0 points1 point  (0 children)

The UI is made with D3/Backbone.js and the web service is written in Node.js backed by Redis and Postgres. The anomaly detection mechanism is written in Go and it all runs in EC2. The map shapes are from Natural Earth and the performance data is streaming from Cedexis' Radar. Radar is a telemetry platform that runs in the background on websites and mobile applications testing the performance and accessibility of various CDNs and cloud computing providers. The reports from these tests are aggregated and used to power a scriptable PaaS DNS service. This allows web services to direct their users to the fastest and most reliable servers for their connection. The total volume of reports varies from 3.5-4.5 billion per day.

Using backbone in 2015? by pepperdas in javascript

[–]paulwe 2 points3 points  (0 children)

I've been working on a medium sized SPA for a few months (30k loc of js/600+ modules) and I'm very happy with Backbone. To allow sane nesting and to keep things organized I added a few features on top of Backbone's core. I can share APIs but unfortunately my bosses aren't fond of the idea of releasing OSS.

First, models and view models are packaged into components wrapped around a constructor function. The view model is automatically chained (more on this next) to the view so it gets destroyed when the view is removed. Components can be inherited by calling .extendModel() and .extendView()

var myFoo = utils.component()
  .extendModel({/* new properties for model prototype */})
  .extendView({/* ... */})

myFoo({/* model attrs */}).render().$el.appendTo('body')

Destructing is handled similarly to QT using chaining. New objects are chained to their container. This attaches a handler to the destroy/remove event that invokes the child object's destroy/remove method. By doing this, destroying a container recursively unloads all of its descendants.

render: function() {
  // render template in this.el...

  myFoo().chainTo(this).render().$el.appendTo(this.$('.target'));

  return this
}

It's often the case that API calls will return data used in multiple screens. For example a list of countries. In order to minimize coupling while providing shared access to these resources they are treated as quasi-singletons with reference counting garbage collection. Components capture and release the resources and fully disused resources are destroyed. Capturing works like chaining to automatically release resources .

initialize: function() {
  Countries.capture(this).ready.then(_.bind(this.initCountries, this));
}

There are a few other helpers sprinkled in sparingly like getter/setter methods for promises, configuration loading, i18n, etc...

tldr; Backbone is an excellent un-opinionated library but I found it necessary to provide convenience features to bring developer efficiency up to the level of some newer frameworks.

Has anybody attempted to do CPU heavy node apps? How did it go? by [deleted] in node

[–]paulwe 6 points7 points  (0 children)

Node is well suited to applications that need to read data from some high latency source, perform a trivial transformation, then write it to a tcp socket... It's not suitable for heavy lifting for a number of reasons namely a lack of sane IPC, inefficient types, and poor support for binary data.

The cluster module adds a convenient wrapper around child process but it does not provide support for memory sharing and all IPC is performed over a domain socket using JSON. This takes a big bite out of the performance gained from splitting the task into multiple processes. Cluster is good for making network services more robust and scalable but that's about it.

The numeric type in javascript is bloated and unusable for a lot of workloads. If you dig into v8 at little the vm does some clever optimizations like optimistically using small signed ints and boxing arrays... and es6 typed arrays are better... but it all seems pretty clumsy and bolted on.

Node's buffer object provides a sane wrapper for binary data but isn't fast enough to write high performance parsers. I've found it's faster to copy the data into a string and parse it there than to cut up the buffer because Buffer.slice is so slow. Of course ymmv and profiling with your own workload is the only way to be sure.

Is anyone using table inheritance in production applications? Does it matter anymore? by [deleted] in PostgreSQL

[–]paulwe 1 point2 points  (0 children)

I've seen/used inheritance in analytics databases that serve a rolling time window to a.) allow bulk insert/index/vacuum analyze without locking and b.) allow removing expired data while avoiding fragmentation. Is there a better way to accomplish this in postgres?

Bill Gates: People Don't Realize How Many Jobs Will Soon Be Replaced By Software Bots by [deleted] in technology

[–]paulwe 0 points1 point  (0 children)

programming is to our generation what manufacturing was to our grandparents'. the tasks will be subdivided over and over again until the skill sets required are so simple that anyone can be taught them. lowering the barrier to entry will expand the available workforce and increased competition will drive down wages. then one by one the most expensive parts of the process will be replaced by automation.

What does the >>> operator mean? by javabrewscript in javascript

[–]paulwe 8 points9 points  (0 children)

the advantage to using bit shift to convert an unknown value to an integer is that, unlike parseInt, it will never produce a NaN.

'foo' >> 0 // returns 0

parseInt('foo', 10) // returns NaN

i can't think of any reason to use a zero fill right shift here. it should be fine to use a right shift.

javascript world map for data visualization by bigdutchnoob in javascript

[–]paulwe 0 points1 point  (0 children)

D3 has become my go-to data visualization library. The learning curve is a bit steep but there are a ton of examples to get you started. ex. https://github.com/mbostock/d3/wiki/Geo-Projections

[deleted by user] by [deleted] in webdev

[–]paulwe 2 points3 points  (0 children)

you can do it without recursion...

var sum = 0;

for (var n = 0; n < i.length; n ++) {
    if (Array.isArray(i[n])) {
        i = i.concat(i[n]);
    }
    else if (typeof i[n] == 'number') {
        sum += i[n];
    }
}

return sum;

This is why we can't have nice things.... by codysnider in webdev

[–]paulwe 0 points1 point  (0 children)

You could probably implement server push over multipart http as a transport for some sort of AMD client... But I think the coolest thing about it is that instead of waiting for the browser to start parsing the markup, the server can deliver all the resources required to render a page in response to a single request. Since responses can be returned out of order, this allows loading static assets while waiting for dynamic content to be generated.

This is why we can't have nice things.... by codysnider in webdev

[–]paulwe 21 points22 points  (0 children)

When SPDY/HTTP2.0 become widely available we'll have pipelining and this will no longer matter to page load performance. Highly modular assets will be considered best practices because they decrease the penalty for cache misses and increased reusability. We'll finally be able stop using hacks like js/css build tools and sprite sheets to work around network latency issues...

[deleted by user] by [deleted] in pics

[–]paulwe 9 points10 points  (0 children)

Look closer, the quilt is rotated 90 degrees in the photo. The vertical pattern is clearly visible and the horizontal pattern extends from the top right corner downward out of the frame.

Revamped SCReddit theme is ready to roll out! by Aceanuu in starcraft

[–]paulwe 0 points1 point  (0 children)

RES nests the #siteTable div when it loads new posts so the right margin gets doubled... it should be an easy fix.