w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
How efficient is Meteor's DDP at syncing very large collections?
Basically it is more a matter of what and how you are publishing to the client than the number of clients. A request is usually handled in log2(N) if indexed, therefore it is quite easy for the server to recompute the result set even if (in the worst case) the whole collection would change. So, from the server side you can quite quickly get the new result sets to publish to the clients (if they changed from the one they had already). The real problem (and common error) comes when you do publish everything to the client (like with the former autopublish), so make a publication wisely so that you do only give what the client is supposed to see. You can either prune the documents hiding useless fields or reduce the result set to send to the client by creating a publication with specific to y

Categories : Meteor

Meteor: Could a race condition happen with Meteor.collections on server side?
In Meteor's concurrency model, you can imagine a whole method as an uninterruptible block of stuff that happens. In order for Meteor to switch from running one method midway to say, starting another method, you need to "yield"—the method needs to signal, "I can be interrupted." Methods yield whenever they do something asynchronous, which in practice means any time you do a database update or call a method with a callback in Meteor 0.6.5 and later. Since you give your update call a callback, Meteor will always try to do something in between the call to update and the update's callback. However, in Meteor 0.6.4.2 and earlier, database updates were uninterruptible regardless of the use of callbacks. However, multiple calls to saveOnServer will happen in order and do not cause a race condi

Categories : Javascript

Necessary to validate _id in Meteor collections?
Strictly speaking you do not need to do any validation tests of the _id. The database will refuse the insert if the _id you give is not unique but I think that is the only rule. Checking that the _id is unique could also be picked up afterwards if the insert errors. Other checks are optional and are just to allow users to access, insert, or remove the documents you want them to.

Categories : Validation

Tomcat not serving static files
The URL-patterns used in web.xml/servlet-mapping is often a little simplistic. I think in your case, the /* pattern for Resteasy will work as a catch-all, so that no other mapping will really matter. For debugging, I suggest you remove the Resteasy-servlet altogether, and see if you can server static files from a custom URL with your mapping. If that works, re-enable Resteasy, but on a different URL-pattern (eg. /rest/*). If that works, well, then everything really works fine, it's just that the URL-mapping for /* blocks anything else from working. The easiest solution would probably be to server static files as per default (no mapping), and serve rest-stuff from another URL. Alternatively use two web apps. One with context root "/static", one with context root "/".

Categories : Java

serving static files from heroku
try to change this line : url(r'^static/images/(?P<path>.*)$','django.views.static.serve','document_root: settings.STATIC_ROOT'), for this: url(r'^static/images/(?P<path>.*)$','django.views.static.serve',{'document_root': 'settings.STATIC_ROOT'}),

Categories : Django

Go web page static file serving
The images should be served from a different URL path to the templates. You need to define where the static files will be served from using something like: http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("/home/jeff/web/")))) and then make sure the <IMG> source URLs are something like: <img src="/static/foo.jpg" alt="moooooo"> Hope that helps.

Categories : Go

Turn off notifications for Meteor collections
Put a flag in each document, 'updating'. Add the new ones with this set to true; render their template with a css class that hides them based on this field. When ready, update the collection to updating: false. They will be visible pretty quickly. This being said, there are events you can plug into to make transitions more pleasant/animated. Didn't think you were asking that, but it may be a better answer. To the comment: Inserting a template for an additional document triggers DOM changes, which are fairly expensive, and then the device has to figure out how to display. Updating a property requires just the second part, that the device has to figure out how to display.

Categories : Meteor

Serving static content with grizzly's StaticHttpHandler from within a .jar
You have to use CLStaticHttpHandler instead of StaticHttpHandler. Please take a look at this question html server grizzly+jersey (.html from .jar archive)

Categories : Java

Trouble serving static files in Sinatra
For one, I don't believe you need the 'public' in your layout file. href="/css/main.css" Secondly, I recommend using scss/sass for styling. You just keep the .scss file within your primary /views directory. app.rb - views - index.haml/html - style.scss In your .rb app file: get '/style.css' do scss :style end Then, in your view: href="/style.css" Hope that helps!

Categories : CSS

Serving static content from dynamic URLs
Rewrite the static files request to the right directoty, for example : location ^(.*)/skin/(.*).(jpeg|jpg|gif|png|ico|svg|css|js)$ { rewrite "^.*/skin/(.*)$" /skin/$1 break; }

Categories : Nginx

Modifying the path for serving static resources
Have you seen the class org.springframework.web.servlet.DispatcherServlet? In the web.xml: <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> And in the dispatcher-servlet.xml: <mvc:resources mapping="/v1/client/*.html" location="/client/pages/" /> <mvc:resources mapping="/v1/client/*.js" location="/client/js/" /> <mvc:resources mapping="/v1/client/*.css" location="/client/css/" /> If you want to use a base tag, see relative paths.

Categories : Java

serving static files in heroku with django
I've also been running into issues with collectstatic not running automatically when I deploy my Django app to Heroku, but a temporary fix at least would be to add python manage.py collectstatic --noinput to your Procfile, e.g. web: python my_django_app/manage.py collectstatic --noinput ; gunicorn --bind 0.0.0.0:$PORT my_django_app.wsgi:application

Categories : Python

In Meteor Collections, use an array-field or another collection?
I inspected what was sent as commented by user728291, and it seems like the entire array-field is sent, and not just the pushed value. I don't know if this always is the case (I just tested with an array containing few and small values; if it contains many or big values Meteor maybe try to do some optimization I couldn't see in my tiny test), but I'll go with the solution using another collection instead of the array-field.

Categories : Arrays

Struts2 not serving static resources after configuration.reload()
The s:head tag should be placed under the head tag. The constant used by FilterDispatcher by default serves static content from inside its jar. struts.serve.static=true If you want to access it from context_path/struts then turn it off by setting to false. struts.serve.static=false

Categories : Java

Ruby Rack Heroku: Serving Static Files
For your config.ru file, try: use Rack::Static, :urls => ["/images", "/js", "/css"], :root => "public" run Rack::File.new("public") You could also replace the last line with run Rack::Directory.new("public") which would serve up all your files, but would give a file browser like interface if someone went to the url of a directory (like the root directory)

Categories : Ruby

Serving static files with Nginx + Gunicorn + Django
You need to create an nginx location block that matches the location of your django STATIC_URL. As you have it configured, nginx is also forwarding requests for static assets to your django application. I'm guessing you are seeing the 404 errors in your django application log? You want nginx to handle these requests, not django. location /static { alias /home/tunde/django-projects/mumu/STATIC/; } Be sure to run the django admin command collectstatic to make sure all the static assets get copied to the STATIC_ROOT directory.

Categories : Django

Serving up a static image in IE results in Quirks Mode
Use a header template which includes the doctype: <?php echo <<<HEADER <!doctype html> <html> <body> HEADER; ?> and a footer template which ends the file: <?php echo <<<FOOTER </body> </html> FOOTER; ?> In the main file, include both as well as the existing content: <?php include('header.php') include('content.php') include('footer.php') ?> Use output buffering to cache the output string internally and send it to the user in one shot. In long-running scripts, you will also want to flush the output buffer periodically so that some feedback is sent to the HTTP client. This can be done with ob_end_flush(). This function also turns off output buffering, so you might want to call ob_start() again immediately

Categories : PHP

Nginx isn't serving static rails asset files
Figured it out. I wasn't looking at the nginx error log before for some reason. Once I looked there I could see that those assets were getting "permission denied" error for them. I tracked down this problem and had to make sure every directory from the root to the location of the asset files had: chmod +x on it.

Categories : Ruby On Rails

Different hosting site for serving static content using Django?
Yes, absolutely. You can find more information in the Django docs for "Managing static files" and "Deploying static files". It just takes a little configuration of your settings.py file.

Categories : Django

Serving static files with CherryPy ignores mount point?
This is how I solved it: [/] tools.staticdir.root: os.path.abspath("public/") tools.encode.on: False tools.gzip.on: True tools.gzip.mime_types: ['text/html', 'text/plain', 'application/json', 'text/javascript', 'application/javascript'] [/static] tools.etags.on: True tools.staticdir.on: True tools.staticdir.dir: "public" [/js] tools.staticdir.on: True tools.staticdir.dir: 'js' [/css] tools.staticdir.on: True tools.staticdir.dir: 'css' [/images] tools.staticdir.on: True tools.staticdir.dir: 'images'

Categories : Python

Serving Static content from local hard disk in jboss as 7
As of my knowledge, we dont have an option to access static files on the hard disk through JBOSS AS 7.1. The solution I have tried was , I have created a dummy web application and I have been storing the files into the dummy web application. Once the files are stored over there, they are accessed with URL pointing to newly created dummy web application. Though this is not the correct way for this kind of access, I find no other way for this. Pl. let me know if any other ideal way exists... Thanks....

Categories : Java

Node.js Express serving index.html instead of static file
Can you elaborate on what you mean by your 'static file' ? on this line: app.use(express.static(path.join(__dirname, 'public'))); you have express routed to serve all files in the 'public' dir as static files. By default, express.static will serve 'index.html' if that directory is called. since you're serving the 'public' dir to '/', it's delivering index.html. EDIT: I'm not sure if this is the problem, but this part of the code is redundant: http.createServer(app).listen() you can just say: app.listen([port], [callback]); since calling express() created a server. hope that helps.

Categories : Node Js

Defining Meteor collections when using coffeescript; ReferenceError saying that collection not defined
In addition to the global scope it could also be the file loading order. To ensure your collections are loaded first move your collections directory into a /lib directory

Categories : Javascript

Serving either a static or dynamic file based on a query variable using nginx
I think that you need something like this: location /thumbs/ { if ($arg_nocache) { rewrite ^(.*)$ /thumbs/index.php?r=$uri&$query_string break; } try_files $uri /thumbs/index.php?r=$uri&$query_string; }

Categories : PHP

Update document in Meteor mini-mongo without updating server collections
There are some people working on local storage in the browser https://github.com/awwx/meteor-browser-store You might be able to adapt some of their ideas to provide "fake" documents.

Categories : Meteor

Collections inside Meteor.call doesn't update server data
Your method has to be defined on the server if you want to update the real server database. If you define it on the client as well it will be run first ("latency compensation)". Questions = new Meteor.Collection("questions"); Meteor.methods({ post: function(title){ Questions.insert({title: title}); } }); if (Meteor.isServer){ Meteor.publish("questions", function(){ return Questions.find(); }); } if (Meteor.isClient){ var questionHandle = Meteor.subscribe("questions"); $('.save').on('click', function(){ var title = $('input[name="title"]').val(); Meteor.call('post', title); }); } You can see the doc, and EventedMind screencast.

Categories : Meteor

Deploy Nodejs on Heroku fails serving static files located in subfolders
Apparently, as explain in this question: Heroku(Cedar) + Node + Express + Jade Client-side javascript files in subdirectory work locally with foreman+curl but not when pushed to Heroku, you can't use __dirname with Heroku. The alternative seems to be: // At the top of your web.js process.env.PWD = process.cwd() // Then app.use(express.static(process.env.PWD + '/htdocs'));

Categories : Node Js

Merging into large collections with Mongo
MapReduce is not meant for incremental updates. It's a one shot tool to churn lots of data and return a result. I would actually advice you to see whether using the aggregation framework is just fast enough to do this in real time. It is a lot faster than M/R. For example, your above example would be represented with the following call to aggregate: db.collName.aggregate( { $group: { '_id': '$_id', watts: { $sum: '$watts' } } } ); A/F is faster than M/R as it's implemented in C and can run concurrent jobs. A down side at the moment is that it doesn't output its results to a new collection, but that's currently being worked on: https://jira.mongodb.org/browse/SERVER-3253

Categories : Mongodb

serving static files with nginx on diffent machine and gunicorn on a diffrent one for a django production
Please can any one advice me the right way to do this in a production environment. Use a network attached storage (NAS) device that is mounted on both machines. This is how you would do it the right way in production. You could do all sorts of other workarounds - like rsync, nfs, etc. however the most reliable way to have this working is with a proper NAS.

Categories : Django

Out of memory when sending large data collections
Try changing to streaming, this is a known issue when sending large payloads with WCF. The reason for the problem is it tries to load everything into memory before sending the content and after receiving, which is exhausting memory. See Large Data Content section under Large Data and Streaming for info, and Streaming Data section to see how to go about to enable streaming

Categories : C#

How to structure a large meteor.js application?
I think you are trying to make a package. Here is an example of Npm.require() being used in a package. Also packages already exist for many common js libraries so check atmosphere and maybe you will not need to write your own package. You can also just place .js files in a directory structure like this without needing to use Npm.require and packages which may be easiest if you already have code working in one .js file on the server.

Categories : Javascript

Serving static files( including HTML files). Nginx vs Node.js. Which one is more scalable?
Both Node.js and Nginx are asynchronous (non-blocking) servers. Nginx is definitely more well suited for serving your static files. However, depending on your use case, the difference may not be worth the added administration overhead. You would really have to be running a significant amount of traffic before you would notice the difference.

Categories : HTML

Server is serving old versions of static files, but trimmed or padded to match length of new versions
In the end it turned out that this was probably being caused by VM issues. The code in question was located on a Windows drive, but was being served from within a Linux VM that was accessing the code via a shared directory. Remounting the share seemed to fix the problem (although not necessarily reliably).

Categories : Caching

Is there a way to tell meteor a collection is static (will never change)?
When you "want to tell the server that a collection is static", I am aware of two potential optimizations: Don't observe the database using a live query because the data will never change Don't store the results of this query in the merge box because it doesn't need to be tracked and compared with other data (saving memory and CPU) (1) is something you can do rather easily by constructing your own publish cursor. However, if any client is observing the same query, I believe Meteor will (at least in the future) optimize for that so it's still just one live query for any number of clients. As for (2), I am not aware of any straightforward way to do this because it could potentially mess up the data merging over multiple publications and subscriptions. To avoid using a live query, you ca

Categories : Meteor

How to add expiration headers to Meteor static assets
For use on production it is recommended that you always have a nginx proxy between client and meteor server. So the best way to add caching headers to files from the static directory would be to add them in the nginx config. Just take a meteor nginx config like the one David Weldon made: gist Then add the following location: location /static { proxy_pass http://localhost:3000/static; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; expires 365d; gzip on; gzip_min_length 1100; gzip_buffers 4 32k; gzip_types text/plain application/x-javascript text/xml text/css; gzip_vary on; } As a bonus I also added gzip, if you do not need that remove all the gzip stuff

Categories : Javascript

How can I serve static images with spaces in the filename using Meteor?
I honestly think you have found a bug, and your only solution until the bug is fixed is to rename your files and remove spaces. There are two issues here: the behavior of Meteor on missing pages -- taking you to the home page instead of a 404 page. This is a design decision, not a bug, but one that not everyone agrees with. There's a discussion on handling missing pages with meteor-router here, though it doesn't solve your problem. Meteor handling of files without spaces. I tried this myself and the same thing happens for me -- Meteor as of version 0.6.5 just doesn't seem to handle spaces in file names correctly, at least when serving up files from /public.

Categories : Javascript

How to render a static page with predefined data in Meteor
Relay the data with Session: http://docs.meteor.com/#session Template.myStaticPage.content = function(){ return Session.get("weather"); } //Will run when the template is created Template.myStaticPage.created = function() { Meteor.http('GET', 'http://someurl.com/api/weather', function(err, res){ if(res){Session.set("weather", res);}; }); } You need to be careful with callbacks in javascript, when you use a callback the return statement isn't passed to the original function because the callback makes it async

Categories : Javascript

Oracle PL/SQL - How do i copy a large amount of data from one table to another using oracle collections
/* package header */ CREATE OR REPLACE PACKAGE perfrormance_test AS PROCEDURE nested_table; PROCEDURE associative_array; END perfrormance_test; /* package body */ CREATE OR REPLACE PACKAGE BODY perfrormance_test AS PROCEDURE nested_table AS /* select all records from source table */ CURSOR big_table_cur IS SELECT col1 , col2 , col3 FROM big_table; /* create nested table type and variable that will hold BIG_TABLE's records */ TYPE big_table_ntt IS TABLE OF big_table_cur%ROWTYPE; l_big_table big_table_ntt; BEGIN /* open pointer to SELECT statement */ OPEN big_table_cur; /* collect data in the collection */ FETCH big_table_cur BULK

Categories : SQL

PIL saves large images as static
It's quite possible that your actual problem is not with PIL, but with whatever you're using to display the image. It's also possible that your problem is with PIL, and it's been fixed by Pillow 2.0, or it only happens on 32-bit, or whatever, but I couldn't reproduce it. Anyway, here's my code to generate a 2Mx60 PNG file, which is over 300MB uncompressed (but under 1MB compressed), out of a bunch of copies of a 512x60 PNG: >>> src = PIL.Image.open('strip-512x60.png') >>> dst = PIL.Image.new('RGBA', (4096*512, 60)) >>> for i in range(4096): ... dst.paste(src, (4096*i, 0)) >>> dst.save('strip-3Mx60.png') I examined the file; it's got a valid PNG block structure and all the right info in the IHDR. I can reopen it in PIL, and the pixels are clearly

Categories : Python

Large static arrays in header only implementation
I will try to give you an alternative for Q1 you've asked. I don't like to see hard-coded values which are meaningless to the program logics. Here's a nice trick That I use sometimes: Create a new file and paste the values in it. data.dat { 0x00030 , 0x00039 }, { 0x00660 , 0x00669 }, { 0x006f0 , 0x006f9 }, { 0x007c0 , 0x007c9 }, { 0x00966 , 0x0096f }, { 0x009e6 , 0x009ef }, { 0x00a66 , 0x00a6f }, { 0x00ae6 , 0x00aef }, { 0x00b66 , 0x00b6f }, { 0x00be6 , 0x00bef }, { 0x00c66 , 0x00c6f }, { 0x00ce6 , 0x00cef }, { 0x00d66 , 0x00d6f }, { 0x00e50 , 0x00e59 }, { 0x00ed0 , 0x00ed9 }, { 0x00f20 , 0x00f29 }, { 0x01040 , 0x01049 }, { 0x017e0 , 0x017e9 }, { 0x01810 , 0x01819 }, { 0x01946 , 0x0194f }, { 0x019d0 , 0x019d9 }, { 0x01b50 , 0x01b59 }, { 0x0ff10 , 0x0ff19 }

Categories : C++



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.