Skip to main content

Posts

About Node.js

As an asynchronous event driven JavaScript runtime, Node is designed to build scalable network applications. In the following "hello world" example, many connections can be handled concurrently. Upon each connection the callback is fired, but if there is no work to be done, Node will sleep.

const http =require('http');const hostname ='127.0.0.1';const port =3000;const server = http.createServer((req, res)=>{ res.statusCode =200; res.setHeader('Content-Type','text/plain'); res.end('Hello World\n');}); server.listen(port, hostname,()=>{ console.log(`Server running at http://${hostname}:${port}/`);}); This is in contrast to today's more common concurrency model where OS threads are employed. Thread-based networking is relatively inefficient and very difficult to use. Furthermore, users of Node are free from worries of dead-locking the process, since there are no locks. Almost no function in Node directly performs I/O, so…
Recent posts

Node.js + MySQL Example: Handling 100's of GigaBytes of Data

Through this Node.js & MySQL example project, we will take a look at how you can efficiently handle billions of rows that take up hundreds of gigabytes of storage space.
                         Secondary goal with this article is to help you decide if Node.js + MySQL is a good fit for your needs, and to provide help with implementing such a solution.

The actual code we will use throughout this blogpost can be found on GitHub.

Why Node.js and MySQL? Use MySQL to store the distributed tracing data of the users of our Node.js Monitoring & Debugging Tool called Trace. We chose MySQL, because at the time of the decision, Postgres was not really good at updating rows, while for us, updating immutable data would have been unreasonably complex. Most think if anyone has millions/billions of rows, they should use a NoSQL solution such as Cassandra or Mongo. Unfortunately, these solutions are not ACID compliant which makes them difficult to use when data consistency is extremely important.

Differences Between CSS & CSS3

The original Cascading Style Sheets specification, as well as its much more recent CSS3 revision, are technologies used to enhance and format HTML Web pages. CSS was initially designed to handle the presentation layer of a Web page in a more efficient manner than formatting with HTML, which was never intended to handle the complex construction of the contemporary Web. Because CSS2 is a a universally adopted extension of CSS1, the term CSS without a number implies the inclusion of CSS2. The CSS3 spec is still under development as of July 2014, so Web developers need to consider feature support varies between browsers.


CSS3 Is Backwards Compatible With CSS CSS3 is an update to CSS2 that maintains compatibility with all of CSS's features -- CSS3 doesn't deprecate any of the CSS code. The CSS3 code is designed to make Web pages look better and load faster as well as reduce development time to build pages in a user's browser. CSS3 makes Web design less reliant on image files fo…

Push notifications in Web Apps via Service Workers

A push notification is a message that is “pushed” from backend server or application to user interface, e.g. (But not limited to) mobile applications and desktop applications. Service workers are a great way to run some script in the background and not putting the load on your main business logic running on front-end.  Your app does not have to be open in the browser, to get the notification. It mean that’s the real purpose of push notifications, notify the user about the content of your application.                          Application server tells Google Cloud Messaging (GCM) server that there is something new content and GCM server then awakens the service worker which generates the push notification.

Register Service Worker
if ('serviceWorker' in navigator && 'PushManager' in window) { navigator.serviceWorker.register('software-worker.js') .then(function(reg) { registration = reg; }) .catch(function(error) { return; }); } else { // …