Search Results

Search found 5929 results on 238 pages for 'node webkit'.

Page 12/238 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • jquery selecting sibling node of the current node

    - by priyank.mp
    How do I select sibling node of the current node? Here is the snippet: <div id="main"> <a class="test" href="test.html">Hello</a> <div>Some text</div> </div> //script $(".test").click(function() { $("this:parent > div").toggle(); }); or $(".test").click(function() { $("this ~ div").toggle(); }); None of these works. I know I can access current object using $(this) but in this case I don't know how.

    Read the article

  • Creating a view linking three different node types with two node references

    - by mikesir87
    I have the following content types: Camp - the top level type Registration Information - contains node reference to Camp called Camp Medical Release Form - contains node reference to registration information called Camper I would like to create a View that takes the nid for the Camp, and pulls out all the fields for the Registration Info and Medical Release Form. I'm having trouble figuring out how to set up the various arguments/relationships. I haven't done something that's referenced more than two types. I know it would be smart/best to just combine the Registration Info and Medical Release Form, since it's a 1:1 mapping, but we can't. So... any help would be appreciated!

    Read the article

  • a server side mustache.js example using node.js

    - by onecoder4u
    I'm looking for an example using mustache.js with node.js here is my example but it is not working. Mustache is undefined. I'm using Mustache.js from the master branch. var sys = require('sys'); var m = require("./mustache"); var view = { title: "Joe", calc: function() { return 2 + 4; } }; var template = "{{title}} spends {{calc}}"; var html = Mustache().to_html(template, view); sys.puts(html);

    Read the article

  • NodeJS and node-mongodb-native

    - by w1nk
    Just getting started with node, and trying to get the mongo driver to work. I've got my connection set up, and oddly I can insert things just fine, however calling find on a collection produces craziness. var db = new mongo.Db('things', new mongo.Server('192.168.2.6',mongo.Connection.DEFAULT_PORT, {}), {}); db.open(function(err, db) { db.collection('things', function(err, collection) { // collection.insert(row); collection.find({}, null, function(err, cursor) { cursor.each(function(err, doc) { sys.puts(sys.inspect(doc,true)); }); }); }); }); If I uncomment the insert and comment out the find, it works a treat. The inverse unfortunately doesn't hold, I receive this error: collection.find({}, null, function(err, cursor) { ^ TypeError: Cannot call method 'find' of null I'm sure I'm doing something silly, but for the life of me I can't find it...

    Read the article

  • help understanding the concept of javascript callbacks with node.js, especially in loops

    - by Mr JSON
    hi I am just starting with node.js. I have done a little ajax stuff but nothing too complicated so callbacks are still kind of over my head. I looked at async but all I need is to run a few functions sequentially. I basically have something that pulls some json from an api, creates a new one and then does something with that. obviously i can't just run it because it runs everything at once and has an empty json. mostly they have to go sequentially but if while pulling a json from the api it can pull other json while it's waiting that is fine. I just got confused when putting the callback in a loop. what do I do with the index? i think i have seen some places that use callback inside the loop as kind of a recusive function and don't use for loops at all. simple examples would help alot thanks!

    Read the article

  • LearnBoost's Socket.IO-Node why onClientMessage not work

    - by KingPin
    Hi, all, I tried to put the module "LearnBoost's Socket.IO-Node", all works, except event 'onClientMessage' Tell, in what there can be a problem, thanks! ...sorry for my english io.listen(server, { onClientConnect: function(client){ client.send(json({ buffer: buffer })); client.broadcast(json({ announcement: client.sessionId + ' connected' })); }, onClientDisconnect: function(client){ client.broadcast(json({ announcement: client.sessionId + ' disconnected' })); }, onClientMessage: function(message, client){ var msg = { mess: [client.sessionId, message] }; buffer.push(msg); if (buffer.length > 15) { buffer.shift(); } client.broadcast(json(msg)); }

    Read the article

  • Node.js Creating and Deleting a File Recursively

    - by Matt
    I thought it would be a cool experiment to have a for loop and create a file hello.txt and then delete it with unlink. I figured that if fs.unlink is the delete file procedure in Node, then fs.link must be the create file. However, my code will only delete, and it will not create, not even once. Even if I separate the fs.link code into a separate file, it still will not create my file hello.txt. Below is my code: var fs = require('fs'), for(var i=1;i<=10;i++){ fs.unlink('./hello.txt', function (err) { if (err){ throw err; } else { console.log('successfully deleted file'); } fs.link('./hello.txt', function (err) { if (err){ throw err; } else { console.log('successfully created file'); } }); }); } http://nodejs.org/api/fs.html#fs_fs_link_srcpath_dstpath_callback Thank you!

    Read the article

  • Load Globalize cultures with Node.js?

    - by Xeon06
    I'm using jQuery Globalize with Node.js. They have a package.json file so I can simply use it as a module and require it. However, it doesn't load all cultures by default. I was wondering what the proper way to load a culture would be? I could go and do something like require('./node_modules/globalize/lib/cultures/globalize.culture.es-US.js') and load the file directly, but that doesn't seem too elegant. Is there a "proper" way to do this?

    Read the article

  • What does addListener do in node.js?

    - by Jeffrey
    I am trying to understand the purpose of addListener in node.js. Can someone explain please? Thanks! A simple example would be: var tcp = require('tcp'); var server = tcp.createServer(function (socket) { socket.setEncoding("utf8"); socket.addListener("connect", function () { socket.write("hello\r\n"); }); socket.addListener("data", function (data) { socket.write(data); }); socket.addListener("end", function () { socket.write("goodbye\r\n"); socket.end(); }); }); server.listen(7000, "localhost");

    Read the article

  • Drupal: create a node with employee working hours

    - by JMarshall
    I have a bit complicated task. 1. I need to create a node with employee working hours (it's gonna be created for all users with role "employee"), which looks like this: Monday: From __ : __ To __ : __ Tuesday: From __ : __ To __ : __ Wednesday: From __ : __ To __ : __ etc. So, I'll have to create probably 14 CCK fields (monday_from, monday_to, tuesday_from...) or more to store the day of the week and workging hours (hours and minutes). 2. I need to add a view with exposed filters, where visitors can filter employees by day of the week and working hours. What kind of field should I use for working hours? How could views filtering described above be achieved? Any suggestions are greatly appreciated. Thank you!

    Read the article

  • APress Deal of the Day 16/August/2014 - Node.js Recipes

    - by TATWORTH
    Originally posted on: http://geekswithblogs.net/TATWORTH/archive/2014/08/15/apress-deal-of-the-day-16august2014---node.js-recipes.aspxToday’s $10 Deal of the Day from APress at http://www.apress.com/9781430260585 is Node.js Recipes. “Node.js Recipes is your one-stop reference for solving Node.js problems. Filled with useful recipes that follow a problem/solution format, you can look up recipes for many situations that you may come across in your day-to-day server-side development. ”

    Read the article

  • Using Node.js as an accelerator for WCF REST services

    - by Elton Stoneman
    Node.js is a server-side JavaScript platform "for easily building fast, scalable network applications". It's built on Google's V8 JavaScript engine and uses an (almost) entirely async event-driven processing model, running in a single thread. If you're new to Node and your reaction is "why would I want to run JavaScript on the server side?", this is the headline answer: in 150 lines of JavaScript you can build a Node.js app which works as an accelerator for WCF REST services*. It can double your messages-per-second throughput, halve your CPU workload and use one-fifth of the memory footprint, compared to the WCF services direct.   Well, it can if: 1) your WCF services are first-class HTTP citizens, honouring client cache ETag headers in request and response; 2) your services do a reasonable amount of work to build a response; 3) your data is read more often than it's written. In one of my projects I have a set of REST services in WCF which deal with data that only gets updated weekly, but which can be read hundreds of times an hour. The services issue ETags and will return a 304 if the client sends a request with the current ETag, which means in the most common scenario the client uses its local cached copy. But when the weekly update happens, then all the client caches are invalidated and they all need the same new data. Then the service will get hundreds of requests with old ETags, and they go through the full service stack to build the same response for each, taking up threads and processing time. Part of that processing means going off to a database on a separate cloud, which introduces more latency and downtime potential.   We can use ASP.NET output caching with WCF to solve the repeated processing problem, but the server will still be thread-bound on incoming requests, and to get the current ETags reliably needs a database call per request. The accelerator solves that by running as a proxy - all client calls come into the proxy, and the proxy routes calls to the underlying REST service. We could use Node as a straight passthrough proxy and expect some benefit, as the server would be less thread-bound, but we would still have one WCF and one database call per proxy call. But add some smart caching logic to the proxy, and share ETags between Node and WCF (so the proxy doesn't even need to call the servcie to get the current ETag), and the underlying service will only be invoked when data has changed, and then only once - all subsequent client requests will be served from the proxy cache.   I've built this as a sample up on GitHub: NodeWcfAccelerator on sixeyed.codegallery. Here's how the architecture looks:     The code is very simple. The Node proxy runs on port 8010 and all client requests target the proxy. If the client request has an ETag header then the proxy looks up the ETag in the tag cache to see if it is current - the sample uses memcached to share ETags between .NET and Node. If the ETag from the client matches the current server tag, the proxy sends a 304 response with an empty body to the client, telling it to use its own cached version of the data. If the ETag from the client is stale, the proxy looks for a local cached version of the response, checking for a file named after the current ETag. If that file exists, its contents are returned to the client as the body in a 200 response, which includes the current ETag in the header. If the proxy does not have a local cached file for the service response, it calls the service, and writes the WCF response to the local cache file, and to the body of a 200 response for the client. So the WCF service is only troubled if both client and proxy have stale (or no) caches.   The only (vaguely) clever bit in the sample is using the ETag cache, so the proxy can serve cached requests without any communication with the underlying service, which it does completely generically, so the proxy has no notion of what it is serving or what the services it proxies are doing. The relative path from the URL is used as the lookup key, so there's no shared key-generation logic between .NET and Node, and when WCF stores a tag it also stores the "read" URL against the ETag so it can be used for a reverse lookup, e.g:   Key Value /WcfSampleService/PersonService.svc/rest/fetch/3 "28cd4796-76b8-451b-adfd-75cb50a50fa6" "28cd4796-76b8-451b-adfd-75cb50a50fa6" /WcfSampleService/PersonService.svc/rest/fetch/3    In Node we read the cache using the incoming URL path as the key and we know that "28cd4796-76b8-451b-adfd-75cb50a50fa6" is the current ETag; we look for a local cached response in /caches/28cd4796-76b8-451b-adfd-75cb50a50fa6.body (and the corresponding .header file which contains the original service response headers, so the proxy response is exactly the same as the underlying service). When the data is updated, we need to invalidate the ETag cache – which is why we need the reverse lookup in the cache. In the WCF update service, we don't need to know the URL of the related read service - we fetch the entity from the database, do a reverse lookup on the tag cache using the old ETag to get the read URL, update the new ETag against the URL, store the new reverse lookup and delete the old one.   Running Apache Bench against the two endpoints gives the headline performance comparison. Making 1000 requests with concurrency of 100, and not sending any ETag headers in the requests, with the Node proxy I get 102 requests handled per second, average response time of 975 milliseconds with 90% of responses served within 850 milliseconds; going direct to WCF with the same parameters, I get 53 requests handled per second, mean response time of 1853 milliseconds, with 90% of response served within 3260 milliseconds. Informally monitoring server usage during the tests, Node maxed at 20% CPU and 20Mb memory; IIS maxed at 60% CPU and 100Mb memory.   Note that the sample WCF service does a database read and sleeps for 250 milliseconds to simulate a moderate processing load, so this is *not* a baseline Node-vs-WCF comparison, but for similar scenarios where the  service call is expensive but applicable to numerous clients for a long timespan, the performance boost from the accelerator is considerable.     * - actually, the accelerator will work nicely for any HTTP request, where the URL (path + querystring) uniquely identifies a resource. In the sample, there is an assumption that the ETag is a GUID wrapped in double-quotes (e.g. "28cd4796-76b8-451b-adfd-75cb50a50fa6") – which is the default for WCF services. I use that assumption to name the cache files uniquely, but it is a trivial change to adapt to other ETag formats.

    Read the article

  • How-to delete a tree node using the context menu

    - by frank.nimphius
    Hierarchical trees in Oracle ADF make use of View Accessors, which means that only the top level node needs to be exposed as a View Object instance on the ADF Business Components Data Model. This also means that only the top level node has a representation in the PageDef file as a tree binding and iterator binding reference. Detail nodes are accessed through tree rule definitions that use the accessor mentioned above (or nested collections in the case of POJO or EJB business services). The tree component is configured for single node selection, which however can be declaratively changed for users to press the ctrl key and selecting multiple nodes. In the following, I explain how to create a context menu on the tree for users to delete the selected tree nodes. For this, the context menu item will access a managed bean, which then determines the selected node(s), the internal ADF node bindings and the rows they represent. As mentioned, the ADF Business Components Data Model only needs to expose the top level node data sources, which in this example is an instance of the Locations View Object. For the tree to work, you need to have associations defined between entities, which usually is done for you by Oracle JDeveloper if the database tables have foreign keys defined Note: As a general hint of best practices and to simplify your life: Make sure your database schema is well defined and designed before starting your development project. Don't treat the database as something organic that grows and changes with the requirements as you proceed in your project. Business service refactoring in response to database changes is possible, but should be treated as an exception, not the rule. Good database design is a necessity – even for application developers – and nothing evil. To create the tree component, expand the Data Controls panel and drag the View Object collection to the view. From the context menu, select the tree component entry and continue with defining the tree rules that make up the hierarchical structure. As you see, when pressing the green plus icon  in the Edit Tree Binding  dialog, the data structure, Locations -  Departments – Employees in my sample, shows without you having created a View Object instance for each of the nodes in the ADF Business Components Data Model. After you configured the tree structure in the Edit Tree Binding dialog, you press OK and the tree is created. Select the tree in the page editor and open the Structure Window (ctrl+shift+S). In the Structure window, expand the tree node to access the conextMenu facet. Use the right mouse button to insert a Popup  into the facet. Repeat the same steps to insert a Menu and a Menu Item into the Popup you created. The Menu item text should be changed to something meaningful like "Delete". Note that the custom menu item later is added to the context menu together with the default context menu options like expand and expand all. To define the action that is executed when the menu item is clicked on, you select the Action Listener property in the Property Inspector and click the arrow icon followed by the Edit menu option. Create or select a managed bean and define a method name for the action handler. Next, select the tree component and browse to its binding property in the Property Inspector. Again, use the arrow icon | Edit option to create a component binding in the same managed bean that has the action listener defined. The tree handle is used in the action listener code, which is shown below: public void onTreeNodeDelete(ActionEvent actionEvent) {   //access the tree from the JSF component reference created   //using the af:tree "binding" property. The "binding" property   //creates a pair of set/get methods to access the RichTree instance   RichTree tree = this.getTreeHandler();   //get the list of selected row keys   RowKeySet rks = tree.getSelectedRowKeys();   //access the iterator to loop over selected nodes   Iterator rksIterator = rks.iterator();          //The CollectionModel represents the tree model and is   //accessed from the tree "value" property   CollectionModel model = (CollectionModel) tree.getValue();   //The CollectionModel is a wrapper for the ADF tree binding   //class, which is JUCtrlHierBinding   JUCtrlHierBinding treeBinding =                  (JUCtrlHierBinding) model.getWrappedData();          //loop over the selected nodes and delete the rows they   //represent   while(rksIterator.hasNext()){     List nodeKey = (List) rksIterator.next();     //find the ADF node binding using the node key     JUCtrlHierNodeBinding node =                       treeBinding.findNodeByKeyPath(nodeKey);     //delete the row.     Row rw = node.getRow();       rw.remove();   }          //only refresh the tree if tree nodes have been selected   if(rks.size() > 0){     AdfFacesContext adfFacesContext =                          AdfFacesContext.getCurrentInstance();     adfFacesContext.addPartialTarget(tree);   } } Note: To enable multi node selection for a tree, select the tree and change the row selection setting from "single" to "multiple". Note: a fully pictured version of this post will become available at the end of the month in a PDF summary on ADF Code Corner : http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html 

    Read the article

  • APress Deal of the Day 20/August/2014 - Node.js Recipes

    - by TATWORTH
    Originally posted on: http://geekswithblogs.net/TATWORTH/archive/2014/08/20/apress-deal-of-the-day-20august2014---node.js-recipes.aspxToday’s $10 Deal of the Day from APress at http://www.apress.com/9781430260585 is Node.js Recipes. “Node.js Recipes is your one-stop reference for solving Node.js problems. Filled with useful recipes that follow a problem/solution format, you can look up recipes for many situations that you may come across in your day-to-day server-side development. ”

    Read the article

  • Unable to show Desktop Notifications using Google Chrome

    - by Praveen Kumar
    I followed the instructions as given in Using The Notifications API. Also I faced many problems like the below, because I added the document.querySelector() inside the <head> part: Uncaught TypeError: Cannot call method 'addEventListener' of null Now I have the below source, where I am able to Check Notification Support, and Check Notification Permissions links. Guide me how to bring in notifications in a simpler way. Also, I tried this: $("#html").click(function() { if (window.webkitNotifications.checkPermission() == 0) { createNotificationInstance({ notificationType: 'html' }); } else { window.webkitNotifications.requestPermission(); } }); Now I am stuck with this source. I need to generate HTML & Simple Notifications. Am I missing something? Please guide me. Source: <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title>Desktop Notifications</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> function checkNotifications() { if (window.webkitNotifications) alert("Notifications are supported!"); else alert("Notifications are not supported for this Browser/OS version yet."); } function createNotificationInstance(options) { if (window.webkitNotifications.checkPermission() == 0) { // 0 is PERMISSION_ALLOWED if (options.notificationType == 'simple') { return window.webkitNotifications.createNotification('icon.png', 'Notification Title', 'Notification content...'); } else if (options.notificationType == 'html') { return window.webkitNotifications.createHTMLNotification('http://localhost/'); } } else { window.webkitNotifications.requestPermission(); } } </script> <style type="text/css"> * {font-family: Verdana, sans-serif;} body {font-size: 10pt; margin: 0; padding: 0;} p {margin: 5px;} a {color: #09f; text-decoration: none;} a:hover {color: #f00;} </style> </head> <body> <p><strong>Desktop Notifications</strong></p> <p>Lets see how the notifications work in this browser.</p> <p> <a href="#" onclick="checkNotifications(); return false;">Check Notification Support</a>. Next <a href="#" onclick="alert('Notifications are ' + ((window.webkitNotifications.checkPermission() == 0) ? '' : 'not ') + 'allowed!'); return false;">Check Notification Permissions</a> and if permissions are not there, <a href="#" onclick="window.webkitNotifications.requestPermission(); return false;">Request Permissions</a>. Create a <a href="#" id="text">Simple Notification</a> or <a href="#" id="html">HTML Notification</a>. </p> </body> <script type="text/javascript"> document.querySelector("#html").addEventListener('click', function() { if (window.webkitNotifications.checkPermission() == 0) { createNotificationInstance({ notificationType: 'html' }); } else { window.webkitNotifications.requestPermission(); } }, false); document.querySelector("#text").addEventListener('click', function() { if (window.webkitNotifications.checkPermission() == 0) { createNotificationInstance({ notificationType: 'simple' }); } else { window.webkitNotifications.requestPermission(); } }, false); </script> </html>

    Read the article

  • Contains Query into MongoDB Array using Mongoose

    - by Nilay Parikh
    I'm trying to query into following document and want to list all document which contains TaxonomyID "1" in "TaxonomyIDs" field. ... "Slug" : "videosecu-600tvl-outdoor-security-surveillance", "Category" : "Digital Cameras", "SubCategory" : "Surveillance Cameras", "Segment" : "", "Usabilities" : [ "Dome Cameras", "Night Vision" ], "TaxonomyIDs" : [ 1, 12, 20, 21, 13 ], "Brand" : "VideoSecu", ... Totally stuck!

    Read the article

  • create file in user's temp folder

    - by user2867494
    I am using the following code to try and create a file in the user's temp folder, but it will not. var fs = require('fs'); var os = require('os'); var ostemp = os.tmpdir(); var exec = require('child_process').exec; var file = fs.createWriteStream(ostemp + '\setup.exe'); ostemp will return a path similar to 'c:\users\user\appdata\local\temp' But the code above will save the file to local, and the filename will be tempsetup.exe Why is that?

    Read the article

  • Why does only one of these @-webkit-keyframes declarations fail?

    - by Alex Ford
    I have two -webkit-keyframes declarations (see below). blink2 works fine. blink does nothing. What's the deal? Is there a limit to the number of keyframes that can be declared? @-webkit-keyframes blink { 0% { opacity:1; } 40% { opacity:1; } 50% { opacity:.5; } 90% { opacity:1; } 99% { opacity:1; } } @-webkit-keyframes blink2 { 0% { opacity:1; } 50% { opacity:.25; } 100% { opacity:1; } }

    Read the article

  • Sorted exsl:node-set. Return node by it position.

    - by kalininew
    Good afternoon, gentlemen. Help me solve a very simple task. I have a set of nodes <menuList> <mode name="aasdf"/> <mode name="vfssdd"/> <mode name="aswer"/> <mode name="ddffe"/> <mode name="ffrthjhj"/> <mode name="dfdf"/> <mode name="vbdg"/> <mode name="wewer"/> <mode name="mkiiu"/> <mode name="yhtyh"/> and so on... </menuList> I have it sorted now this way <xsl:variable name="rtf"> <xsl:for-each select="//menuList/mode"> <xsl:sort data-type="text" order="ascending" select="@name"/> <xsl:value-of select="@name"/> </xsl:for-each> </xsl:variable> Now I need to get an arbitrary element in the sorted array to the number of its position. I write code <xsl:value-of select="exsl:node-set($rtf)[position() = 3]"/> and get a response error. How to do it right?

    Read the article

  • express+jade: provided local variable is undefined in view (node.js + express + jade)

    - by Jake
    Hello. I'm implementing a webapp using node.js and express, using the jade template engine. Templates render fine, and can access helpers and dynamic helpers, but not local variables other than the "body" local variable, which is provided by express and is available and defined in my layout.jade. This is some of the code: app.set ('view engine', 'jade'); app.get ("/test", function (req, res) { res.render ('test', { locals: { name: "jake" } }); }); and this is test.jade: p hello =name when I remove the second line (referencing name), the template renders correctly, showing the word "hello" in the web page. When I include the =name, it throws a ReferenceError: 500 ReferenceError: Jade:2 NaN. 'p hello' NaN. '=name' name is not defined NaN. 'p hello' NaN. '=name' I believe I'm following the jade and express examples exactly with respect to local variables. Am I doing something wrong, or could this be a bug in express or jade?

    Read the article

  • Azure SDK causes Node.js service bus call to run slow

    - by PazoozaTest Pazman
    I am using this piece of code to call the service bus queue from my node.js server running locally using web matrix, I have also upload to windows azure "web sites" and it still performs slowly. var sb1 = azure.createServiceBusService(config.serviceBusNamespace, config.serviceBusAccessKey); sbMessage = { "Entity": { "SerialNumbersToCreate": '0', "SerialNumberSize": config.usageRates[3], "BlobName": 'snvideos' + channel.ChannelTableName, "TableName": 'snvideos' + channel.ChannelTableName } }; sb1.getQueue('serialnumbers', function(error, queue){ if (error === null){ sb1.sendQueueMessage('serialnumbers', JSON.stringify(sbMessage), function(error) { if (!error) res.send(req.query.callback + '({data: ' + JSON.stringify({ success: true, video: newVideo }) + '});'); else res.send(req.query.callback + '({data: ' + JSON.stringify({ success: false }) + '});'); }); } else res.send(req.query.callback + '({data: ' + JSON.stringify({ success: false }) + '});'); }); It can be up to 5 seconds before the server responds back to the client with the return result. When I comment out the sb1.getQueue('serialnumbers', function(error, queue){ and just have it return without sending a queue message it performs in less than 1 second. Why is that? Is my approach to using the azure sdk service bus correct? Any help would be appreciated.

    Read the article

  • node.js UDP data lost at high package rates

    - by koleto
    I am observing a significant data-lost on a UDP connection with node.js 0.6.18 and 0.8.0 . It appears at high packet rates about 1200 packet per second with frames about 1500 byte limit. Each data packages has a incrementing number so it easy to track the number of lost packages. var server = dgram.createSocket("udp4"); server.on("message", function (message, rinfo) { //~processData(message); //~ writeData(message, null, 5000); }).bind(10001); On the receiving callback I tested two cases I first saved 5000 packages in a file. The result ware no dropped packages. After I have included a data processing routine and got about 50% drop rate. What I expected was that the process data routine should be completely asynchronous and should not introduce dead time to the system, since it is a simple parser to process binary data in the package and to emits events to a further processing routine. It seems that the parsing routine introduce dead time in which the event handler is unable to handle each packets. At the low package rates (< 1200 packages/sec) there are no data lost observed! Is this a bug or I am doing something wrong?

    Read the article

  • What is the most common way to use a middleware in node with express and connect

    - by Bernhard
    Thinking about the correct way, how to make use of middlewares in a node.js web project using express and connect which is growing up at the moment. Of course there are middlewares right now wich has to pass or extend requests globally but in a lot of cases there are special jobs like prepare incoming data and in this case the middleware would only work for a set of http-methods and routes. I've a component based architecture and each component brings it's own middleware layer which can implement those for requests this component can handle. On app startup any required component is loaded and prepared. Is it a good idea to bind the middleware code execution to URLs to keep cpu load lower or is it better to use middlewares only for global purposes? Here's some dummy how an url related middleware look like. app.use(function(req, res, next) { // Check if requested route is a part of the current component // or if the middleware should be passed on any request if (APP.controller.groups.Component.isExpectedRoute(req) || APP.controller.groups.Component.getConfig().MIDDLEWARE_PASS_ALL === true) { // Execute the midleware code here console.log('This is a route which should be afected by middleware'); ... next(); }else{ next(); } });

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >