Prompt stringlengths 14 160 | Instruction stringlengths 18 2k | Response stringlengths 8 2k |
|---|---|---|
Multiple Laravel Projects on a single domain with NGINX | At work we have a single staging server with a staging domain, something likehttps://staging.example.com. We recently decided to switch from Apache to NGINX on a new server and we're having issues with our Laravel routing.All of our laravel apps sit in sub-directories on the staging server, like so.https://staging.exam... | Your first capture is probably too greedy, you should limit it by using:rewrite ^(/[^/]+/[^/]+)/(.*)$ $1/index.php?$2 last;Seethis useful resourceon regular expressions. |
AWS Elastic Beanstalk - Configuring my nginx settings to increase timeout for Java Spring maven app | So I am using AWS Elastic Beanstalk to host my Java Spring app, and there are certain requests which take more than 60 seconds to complete. I wanted to raise the timeout cap so these could complete, so I began to followthistutorial.I succeeded in changing the Load Balancer timeout in the ELB console, but I am having tr... | Possible duplicate ofWhere to add .ebextensions in a WAR?, though since you are not using war packaging you can use Procfile-basedconfigurationand archive your jar and .ebextensions into additional zip layer. Then your zip file structure should be looking like this:your_app.zip
|
|_.ebextensions
| |_ nginx-timeout.co... |
nginx - reverse proxy certificate authentication | I´m trying to use nginx as a reverse proxy to an internal webserver running Tomcat, which hosts a front-end to our ERP system.It is already working fine: I can perfectly connect to the nginx server (which is locked up on our network, different VLAN, firewall, etc etc etc) and then reverse proxy to my ERP server.However... | Assuming you have generated a private key and a certificate request for your user and signed it with your client CA. You need to get the private key and the signed certificate into the list of personal certificates in the browser.I have found that the best way is to create a password protected PKCS#12 (as some browsers... |
Gitlab omnibus external url not working | This is my /etc/gitlab.rb file :I've ransudo gitlab-ctl reconfigureandsudo gitlab-ctl restart. Yet, when I go tohttp://gitlab.hop-child.comI get a ERR_NAME_NOT_RESOLVED. However,http://hop-child.combrings me to GitLab...What am I doing wrong? Restarting my whole server isn't really an option. | The error you're receiving,ERR_NAME_NOT_RESOLVED, is a DNS error. Couple that with the fact that GitLab works on the base domain, and I'd say that you probably forgot to setup the DNS record for your subdomain. |
413 Request Entity Too Large HighCharts | I am having trouble with the exportation of a certain graph. I have made a JSFiddle (http://jsfiddle.net/oy73rgc4/3/) to show with what I am working. This example doesn't contain all the data points with are used, because then my browser (Chrome) crashes. In total i am using about 80K of data points. The HighCharts is ... | The exporting server is something that you deploy on your server side (i.e. you have to deploy a server to do exporting for you). However, if you only need to export PNG and SVG, then you can do with client-side only solution as per their docs.http://www.highcharts.com/docs/export-module/client-side-exportIf their serv... |
Cloudfront CDN Font blocked by CORS policy blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource | I'm using a nginx as my host and a Amazon Cloudfront as my cdn.my header from my cdn has the Access-Control-Allow-Origin set to *From my site:curl -I http://example.com/ThemeIcons.woff?387osh
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 08 Dec 2016 03:01:23 GMT
Content-Type: application/font-woff
Content-Length: 18068
Last... | Did you figure it out yet? A link to your cdn or the website that was to use the cdn would be helpful.It could be that Chrome does a preflight OPTIONS request to your distribution, and that your origin doesn't have the header set for that. You can check this withcurl -I -X OPTIONS http://cdn.example.com/ThemeIcons.woff... |
How to solve Google Page Speed: "expiration not specified" | Analyzing an online shop (Shopware) withGooglePageSpeedresults in many "expiration not specified"-Lines on every image.I am wondering about because the webserver (nginx) addsLast-Modified-Timestamps andETAGheaders to the response of all images, resulting in an expected 304-Response on the second request.Is ETAG/LastMod... | Finally we've found out, that there was another expire-statement in the vhost-config. Reduce both to one single statement solved our issue |
python process takes time to start in django project running on nginx and uwsgi | I am starting a process using python's multiprocessing module. The process is invoked by a post request sent in a django project. When I use development server (python manage.py runserver), the post request takes no time to start the process and finishes immediately.I deployed the project on production using nginx and ... | I figured out a workaround (Don't know if it will qualify as an answer).
I wrote the background process as a job in database and used a cronjob to check if I have any job pending and if there are any the cron will start a background process for that job and will exit.The cron will run every minute so that there is not ... |
Nginx, django, gunicorn, ubuntu 14.04 (13: Permission denied) while connecting to upstream | I am working at mydjangoproject withnginxandgunicorn, as it said here:https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04My site works locally, but when I startnginxandgunicornserver I had502 Bad Gateway error.OS isUBUNTU 14.04I'm trying to make my proj... | proxy_pass http://unix:/root/myproject/myproject.sock;The socket is in the superuser's home folder. That's pretty much inaccessible to all other users including your nginx users. Please more the socket to a different location. /var/log/gunicorn/ is a good place.Also do i see you running gunicorn as root?. Not recommend... |
Is it more performant to use Proxygen or NGINX + FastCGI local socket with HHVM? | HHVM has a built in Server, Proxygen. You can run HHVM with the Proxygen server or run it in FastCGI mode, using another server such as nginx or apache to handle web requests.I cannot find any benchmarks or authoritative source that provides any indication of which of the two option performs best. Obviously I could p... | I have not done any measurement. But in theory, proxygen server would be more performant because it runs in the same process as the php worker threads, thus avoiding some overhead inter-process communication. Proxygen server is used at Facebook and some efforts are made to make it more reliable, e.g., protection mech... |
Nginx: Selectively enable compression based on referrer hostname | In order to mitigate against the BREACH attack, I would like to selectively enable gzip only when$http_referer's hostname matches one of my server names.How would I do this? I tried usingvalid_referers server_names;, but it seems like nginx doesn't allowgzip oninside if statements. When I include this in my conf:valid_... | Thenginx documentationspecifies that thegzipoption is allowed in the following contextsContext: http, server, location, if in locationThis means you need to wrap thegzipswitch inside alocationblock.gzip off;
server {
listen 80;
server_name localhost;
valid_referers server_names;
location / {
root /var/... |
Can Nginx make hash sum from some strings (unique Request Id)? | I found thissbange's answerabout unique request ID in nginx upstreams.
Here is a quote:location / {
proxy_pass http://upstream;
proxy_set_header X-Request-Id $pid-$msec-$remote_addr-$request_length;
}It's looks nice, but it generates long and not very useful string. It would be better with a short hash (m... | The new$request_idvariable now is available since Nginx v1.11.0. |
Remove leading slash NGINX | I have a double slash in my URL (which is not ideal).So my app is hit at//signup.Error message:Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET //signin""Anyway to change it to just/signup?I have tried the below in the first location block (which is the one c... | I have had success with the URI changing on the backend while processing with the following.location /apps/phpauthentication/1 {
rewrite ^(.*)//(.*)$ /$1/$2 permanent; ##First matches double slash and rewrites
try_files $uri /app_dev.php$is_args$args; ##URI is now /apps/1/signup
if (!-e $request_... |
Gunicorn - Can't Access Django Project (Browser Times Out) | Using AWS and Gunicorn, my Django site is accessible and fully functional if I spin up the Django's built-in server, but I can't access it through Gunicorn.If I try:gunicorn MyApp.wsgiIt seems to start up:[2015-11-18 17:53:30 +0000] [18752] [INFO] Starting gunicorn 19.3.0
[2015-11-18 17:53:30 +0000] [18752] [INFO] List... | AsDaniel Rosemanindicated, Amazon doesn't seem to allow me to do what I was trying to do here without additional configuration.I took the advice and configured Nginx and now I am able to usegunicorn MyApp.wsgi:application --bind=172.31.21.65:8000to spin it up. |
Nginx catch "broken header" when listening to proxy_protocol | I need to use http health checks on a Elastic Beanstalk application, with proxy protocol turned on. That is currently not possible, and the health check fails with a an error -->*58 broken header while reading PROXY protocolI figured I have two optionsPerform the health check on another port, and setup nginx to listen ... | The proxy protocol specificationsays:The receiver MUST be configured to only receive the protocol described in this
specification and MUST not try to guess whether the protocol header is present
or not. This means that the protocol explicitly prevents port sharing between
public and private access. Otherwise it w... |
PhpStorm and Remote XDebug not working | I've followed multiple tutorials to set up XDebug with PhpStorm but it seems likeI'm not lucky with it at all. No matter what I try, it's always stuck withWaiting for incoming connection with ide key 'PHPSTORM'But when I reload the page with CTRL + R I can see for asplit secondconnected.However, then it switches back t... | Give the following setting a try, sounds funny but just copy past the entire block instead of typing them in (believe you me that helped a couple of colleague of mine)xdebug.remote_host=10.0.2.2
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.show_exception_trace=0
xdebug.show_local_vars... |
Serving static resources with Flask - running afoul of Same-origin policy | I’m having trouble serving static files (image assets, etc.) for a small game I’m working on inPhaser. I’m usingflask-socketioon the server (and socket.io on the client-side) for networking which is why I’m trying to get this working under Flask. As far as I can tell, I must use Flask to serve the static resources be... | Normally, one would set up Nginx (or some other general web server) on the "main" port, and then configure it to forward certain requests to your application server (in this case, Flask) on a secondary port which is invisible/unknown to the client browser. Flask would provide the result to Nginx which would then forwar... |
SyntaxError: expected expression, got '<' on Heroku | When I click on the index.html file on my local computer, the page is correctly loaded in my browser. However, when I open the site on herokuapp, I get "SyntaxError: expected expression, got '<'" errors for all of the .js files I link to in the html.I would appreciate any help on how to fix this.Thanks! | The links are propably not working when installed on Heroku. Use the net panel of firebug or your browser developer tools to see which absolute URL the browser is trying to load. Most likely it is invalid and a HTML 404 error page is returned (starting with a '<') |
Confirm if application is using nginx to serve static files | I am using thistutorial - part 1, but i am not sure how to test if the app is running with nginx serving static files or not.I have exactly the same code./etc/nginx/sites-available/flask_project
server {
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_h... | First, requests to port8000completely bypass nginx, so nothing strange here. You should go tolocalhostwithout port number.Second, you have to symlink this config to/etc/nginx/sites-enabledand reload nginx.Third, your static location is wrong. You havelocationwithout trailing slash andaliaswith one. They should always b... |
nginx + fcgiwrapper sporadic Prblem: Delivers application/octet-stream instead of text/plain | I am new to this forum. This is my first question.I have a nginx-server + fcgiwrapper set up to run Programs on user request (no PHP).For testing I have a simple bash script, which displays the environment variables and sets two cookies, a second bash-script prints "Hello World" as text/plain and another bash-script pr... | Through trial and error (with curl + firefox-dev-tools) I have found, that the character0x11in combination with:Content-type: text/plainmakes nginx deliverContent-type: application/octet-stream.I don't know why this happens, but i found that the C-program produces the error, because it prints0x11or^Qordc1.
This phenome... |
502 bad gateway nginx + puma + rails 3.2 on Elastic Beanstalk | The deployment was successful and everything is green. But when we try to access the application URL, it gives502 Bad Gatewayerror.Checking for puma process withps -aux | grep pumadoesn't return any process attached to puma server butpgrepreturns following.$pgrep -fl puma
18009 su -s /bin/bash -c bundle exec puma -C /o... | I could not fix this problem. Also we supposed to use EC2 free instance only instead of BeanStalk.We have now moved to Free EC2 instance with RDS and deployed the rails application using Capistrano with Nginx + Unicorn. Though it was not easy[1][2]but finally we got it working. |
No such cookbook -- OpsWorks can't find custom cookbook | I'm trying to figure out the best way to add an nginx server as a proxy for my node.js AWS OpsWorks machines. I have not been able to get it working, as Chef/OpsWorks cannot seem to find the cookbook. Here is my setup: I am using the node.js layer, and have created a git repo for the chef recipes for nginx. I have enab... | Even if you've enabled custom recipes have you configured OPsWorks to go to your GIT repo?http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-installingcustom-enable.htmlIf your GIT repo is on Github for instance you'll have to also authorize Amazon to access your repo using the proper SSH Key.Also ens... |
Cloudflare bug random 302 redirections | I've an issue with Cloudflare, sometimes (randomly) I have 302 redirections on random an non-existing subfolders, I give you some examples :GET /en/home > 302 > /en/home/sWetZ > 302 > /en/home > 302 > /en/home/qUTIs > 302 > /en/home > 200
GET /en/home > 302 > /en/home/zaIue > 302 > /en/home/zaIue/widUT > 302 > /en/home... | Please open a support ticket & we can take a look. We wouldn't add a redirect unless you set a PageRule instructing us to do so, so this sounds like you may have something configured incorrectly. Forwarding & cache status are too different things & really shouldn't have any play together here. |
Routing to different servers with nginx | Is there a way to use nginx as a router while keeping the requested domain in the URL? For example, if I hit mysite.com, the nginx routing server looks at the URL and directs traffic to a particular server, all while maintaining the original requested domain in the URL.E.g.mysite.com/site1/params
Router -> site1.mysite... | Use location with trailing slash, remove rewrite and useproxy_passwith/uri. Nginx will take of replacing/site1/with/. Also, you may need to setHostheader tosite1.mysite.comnot the$host.location /site1/ {
proxy_pass http://site1/;
proxy_set_header Host site1.mysite.com;
...
} |
Cgit and Nginx URL rewrite | Wired URL rewriting issueswhile I gotohttp://git.example.org/fooit works fine, repos shows up. However the links on that page appended /foo again
i.e.http://git.example.org/foo/foo/commitWhen I goto URL likehttp://git.example.org/foo/commit?id=123123It works, but each links on that page looks likehttp://git.example.org... | This isn't anything to do with Nginx, there's a bug in the code generating your URLs.On the pagehttp://git.example.org/fooyou have a link written as:Click to commitIt should either be absolute to the server as:Click to commitOr relative to the current directory as:Click to commitPresumably somewhere in the code where y... |
Subdomains, nginx and godaddy | Here are the preconditions:I've registered domainexample.comin godaddy.I run a Tomcat on8080port with a couple of applications. 8080 port is hidden to the world.I want to mapsubdomain.example.comtoserver:8080/subdomain. I want it be possible to do similar mappings (subdomain2.example.comtoserver:8080/anotherContext, fo... | Ok. I got this work. Not sure the solution is correct but:First I need to setup a subdomain in Tomcat.Here is the answer I was inspired with.
Then, configure nginx with:server {
listen 80;
server_name example.com;
location / {
root /path/to/domain/root;
index index.html;
}
}
... |
Creating remote bookmarks while pushing to hgweb server | There's a lot of questions about bookmarks but none of them answers my question:What should I do to allow for creating bookmarks while pushing to my hgweb server?Here's what I'm getting while trying to push bookmark:$ hg push -B feature1
pushing to http://local_server/hg/Project
searching for changes
no changes found
e... | Problem solved:In system there were two Mercurial versions installed:/usr/bin/hg == v1.4
/usr/local/bin/hg == v2.2Althoughwhich hgshows/usr/local/bin/hgnginx was using/usr/bin/hg. |
nginx ignore location part | I have spent an hour looking for an answer to this, but unless you know the vocabulary it is very difficult to search. What I want is dead simple. I have a server like so:server {
listen 80;
server_name test.dev;
root /srv/www;
location / {
index foo.html;
}
location /foo {
index foo.html;
}
... | I'd probably use rewrite.server {
listen 80;
server_name test.dev;
root /srv/www;
location / {
index foo.html;
rewrite ^/foo(.*)$ /$1 last;
rewrite ^/bar(.*)$ /$1 last;
break;
}
}Something like that yah, I think you can figure it out from here :) |
IE makes extra GET-request on hash change | When I make an XMLHttpRequest, I also changewindow.location.hash.For example,mysite.com/gallery/q#1becomesmysite.com/gallery/q#2.When this happens, IE8, as Fiddler and nginx logs show, makes this strange extra request tomysite.com/gallery/(which is 404).The page isn't reloading, it's like an XMLHttpRequest.GET http://m... | Is the visitor being redirected to the affected page from another? If so, it's likely to be a known IE bug.Take a look at this similar question:javascript location.hash refreshing in IE |
Perl web serving with nginx and FastCGI - not able to read parameters | There are any number of tutorials out there on how to use FastCGI to CGI wrappers to serve Perl code using nginx. But I'm comfortable working with Perl modules myself, so I don't need the wrapper. I'm trying to figure out the right way to set this up. Here's the code I have so far:#!perl
use CGI;
use FCGI;
my $s = FC... | CGI::Fastwill handle most of the work for you, including setting up the daemon.use CGI::Fast;
local $ENV{FCGI_SOCKET_PATH} = ":9000";
local $ENV{FCGI_LISTEN_QUEUE} = 20;
while ($q = CGI::Fast->new) {
print $q->header;
print "The foo input is ", $cgi->param('foo'), "";
}An alternative isNginx::Simplewhich give... |
How does nginx handle long running requests like file downloads? | From my limited understanding of nginx I know that nginx seperates itself from Apache by using a single thread that handles all requests instead of Apache which throws threads at the problem. In theory with a bunch of small requests its faster. But what about long running requests.Lets say a user is downloading a large... | Worker processes in nginx can handle multiple incoming and outgoing requests simultaneously. The answer to the question you linked (3436808) is also applicable to this question. |
502 error after adding application to a Django project running on nginx and gunicorn | I am trying to add an application to an existing Django project, but once I have done it I get a 502 error.The server is running Ubuntu. I don't think it has to do with the applications code because I got it running on the django development server. It goes away when I take out the app's name from settings.py and resta... | Nginx isn't able to connect to your backend (gunicorn) or gunicorn is refusing the connection. You provided no details about the configuration so that's all the help you'll get. You are correct that the application code has nothing to do with it. It's a configuration error on your part. |
Nginx configuration with Magento 1.8 | anybody knows how to configure server {} in configuration file of nginx server?
I have something like this below:server {
server_name local.com;
root some_path;
index index.php;
#location / {
#try_files $uri $uri/ index.php;
#proxy_pass http://127.0.0.1:9000;
#}
# set a nice expire for assets... | Ok, it wasn't memory or database issue, it was... IonCube issue... i was debuging core classes and found that script stops on Enteprise Modules and... if You don't have IonCube installed it just simply display blank page.But, now Magento returns 404: Page not found...Thx, guys for help and if You have some advice on se... |
PHP and Django: Nginx, FastCGI and Green Unicorn? | I'm curious... I'm looking to have a really efficient setup for my slice for a client. I'm not an expert with servers and so am looking for good solid resources to help me set this up... It's been recommended to me that using FastCGI for PHP, Green Unicorn (gunicorn) for Django and Nginx for media is a good combination... | I think one solution could be using a combination of PHP as apache module or through FastCGI and use mod_proxy apache module to do some reverse proxy to access your administration app running with gunicornYou can have a setup like :Front HTTP Server apache on port 80 : www.host.com:80Backend HTTP Server gunicorn on ano... |
Django & Nginx deeplinking domains (re-write rules or django urls?) | I'm running Django behind Nginx (as FASTCGI) and I need to "deeplink" to a page in one domain from the root of another without redirecting or forwarding e.g.Given that I have a domain general-stuff.com and a matching URLhttp://general-stuff.com/books/and that I have a second domain books-stuff.com I need a way to get t... | You could use theproxy_passconfiguration in Ngxinx.server {
gzip on;
listen 80;
server_name books-stuff.com ;
location / {
proxy_pass http://general-stuff.com/books/;
break;
}
}Should do exactly what you want |
How to get the ip address in Node.js Express? | I am using this code to get the ip address in Node.js:const ip = await (req.headers['x-forwarded-for'] || '').split(',').pop().trim() || req.socket.remoteAddress;For all the devices on my home wifi network and when I access my website using data on my phone, I get this ip address: ::ffff:127.0.0.1I'm trying to get the ... | I found another solution for my use case. Based on some people's comments, it looks like it may not be possible to find the private ip address of a device that connects to your website, only the public ip address.@Cerceis os.networkInterfaces() answer may work. I did a quick test, but was unable to know for sure if it ... |
Getting Google Cloud CDN to serve stale file on 404 | My frontend runs on nginx, and I'm serving a bunch of.chunk.jsfiles that are built from react.Every time I update my frontend, I rebuild the docker image and update the kubernetes deployment. However,some users might still be trying to fetch the old js files.I wouldlikeGoogle Cloud CDN to serve the stale, cached versio... | I have this issue as well, if you find a way to set it up on Google CDN please let me know.Here is my Workaround:ChooseUse origin settings based on Cache-Control headersSince most browsers cache static JS assets, I reduce myCache-Controlheader for.htmlto be reasonably low or normal, like 5-60 minutes, whereas the javas... |
ALERT: [pool www] user has not been defined when using thecodingmachine/php:7.1-v3-fpm-node10 | i was trying lately to use thecodingmachine/php:7.1-v3-fpm-node10 image as my fpm container for local development and was surprised by this error message:php-fpm_1 | [24-Sep-2020 20:05:32] ALERT: [pool www] user has not been defined
php-fpm_1 | [24-Sep-2020 20:05:32] ALERT: [pool www] user has not been defined
php-... | I believe i have figured out what the error was. I had containers built without enabled WSL 2 within my Docker for Windows so when I have switched to WSL2 the containers weren't rebuilt. After pruning containers and rebuilding them it works OK. |
nginx ingress - unexpected error generating SSL certificate with full intermediate chain CA certs: Invalid certificate | I am running nginx ingress on my kubernetes 1.9 cluster. Using internal singed certificate for the application URL, I have include root & intermediate certificate part of the TLS secretes.From my nginx log file, I see this message frequently.backend_ssl.go:139] unexpected error generating SSL certificate with full inte... | Some certificates don't support it. You need to set --enable-ssl-chain-completion = false . Then it stops |
How to check if CUDA GPUs are available in R? |
I am writing a script that uses xgboost package to train machine learning models in R. The model training can be accelerated if CUDA GPUs are available and the GPU version of the package is installed.
Is there a function that can check if GPUs are available (preferably without installing additional package other than ... |
0
You can see the GPUs available for your project and zone via gce_list_gpus()
Try This:
gce_list_gpus(project="your-project")
Share
Improve this answer
Follow
answered Apr 19, 2021 at 20:57
... |
Cannot use NVIDIA Quadro P620 GPU with Tensorflow |
I have installed all things needed to run my GPU with Tensorflow, such as NVIDIA driver, Microsoft VisualStudio 2017 C++ distribution, CUDNN in the correct folder. But still I am unable to use the GPU. I receive the following message.
The following are my software and hardware specifications.
My GPU version is NVID... |
0
According to Tensorflow tested build configuration, you need to install CUDA 10.1 for Tensorflow 2.3 version.
If there is any incompatibility between versions of Tensorflow, CUDA and cuDNN, it won't detect GPU.
In your case i would recommend you to upgrade tensorflow vers... |
Is there a way to halt a GPU thread until all threads being executed reach that point? |
I am currently working on a compute shader that does CA-based fluid simulation. My current algorithm writes to the direct neighbours of the cell currently being computed. My current idea is to have one thread compute a 3x3 area of my CA grid, and subsequently, each 3x3 area adjacent to the other. This in theory would ... |
0
I have looked more into it and it appears that there is no way to halt GPU threads. I have also been told that threads end all at the same time if they have a constant number of instructions.
Share
Improve this answer
Follow
... |
Can I split a physical GPU into two virtual devices in tensorflow 2.x? |
I would like to test using multiple GPUs for training a network. However, I only have installed one physical GPU (RTX 2070) on my machine. Would I be able to split this device into two virtual devices?
My current attempt is based on the tf.config.experimental.set_virtual_device_configuration function, however, it does... |
0
The total number of GPU devices visible should be verified with list_logical_devices:
logical_gpus = tf.config.experimental.list_logical_devices('GPU')
print(logical_gpus)
#[LogicalDevice(name='/device:GPU:0', device_type='GPU'),
# LogicalDevice(name='/device:GPU:1', devi... |
How does a Pytorch neural network load dataset into GPU |
When loading a dataset into the GPU for training, would a Pytorch NN load the entire dataset or just the batch?
I have a 33GB dataset that fits comfortably on my normal RAM (64GB) but i only have a 16GB of GPU RAM (T4). As long as Pytorch only loads one batch at a time into the GPU, that should work fine without any m... |
You can load one batch of data at a time into GPU. You should use data loader to fetch a batch of data and also initialize a torch device instance to use GPU.
You can check the following tutorial. It uses data loader to get data as batches and load them to GPU by using torch device.
https://pytorch.org/tutorials/begin... |
GPU Compute unavailable in wsl2 in new build? |
I’m in the windows insider program to utilize the gpu-compute features that were implemented last summer. Things have worked great. However, after updating to the most recent build, nvidia-smi no longer works. I get an error saying “your operating system doesn’t allow it”
https://blogs.windows.com/windows-insider/2021... |
Known issue. Should be resolved in next build. The issue can be tracked here:
https://github.com/microsoft/WSL/issues/6773
Update: It has been resolved as of build 21359
|
Colab giving OOM for allocating 4.29 GB tensor on GPU in tensorflow |
I am running a model which allocates [32768,32768] float weight (around 4.29 GB) in its first layer. But it gives an oom error while adding the layer in the sequential model.
This is the output of nvidia-smi before adding layer -
This is the error -
And this is the output of nvidia-smi after the error -
When the Co... |
0
IMHO you don't need to specify GPU explicitly in TF/keras - current versions on Colab will use it when it is available. GPU loading usually takes place at fit and predict times, not at model building - and then you can fine tune memory consumption using batch size.
Please... |
Nvidia-smi shows internal error after 11.2 Cuda installation on P2000 GPU |
I installed Cuda 11.2 on a Nvidia Quadro P2000 GPU. The driver version is R460 U5 (461.92). Unfortunately, after executing nvidia-smi, it shows me the following screen:
...
+-----------------------------------------------------------------------------+
| Processes: ... |
0
In my case, reinstalling the GPU driver and reinstalling CUDA solved the issue.
Share
Improve this answer
Follow
answered Nov 15, 2021 at 17:34
TidesTides
1111111 bronze badges
... |
Ignore files that have already been committed to a Git repository [duplicate] |
This question already has answers here:
How do I make Git forget about a file that was tracked, but is now in .gitignore?
(35 answers)
Closed 6 years ago.
I have an already initial... |
To untrack a single file that has already been added/initialized to your repository, i.e., stop tracking the file but not delete it from your system use: git rm --cached filename
To untrack every file that is now in your .gitignore:
First commit any outstanding code changes, and then, run this command:
git rm -r --cac... |
Disabling Chrome cache for website development |
I am modifying a site's appearance (CSS modifications) but can't see the result on Chrome because of annoying persistent cache. I tried Shift+refresh but it doesn't work.
How can I disable the cache temporarily or refresh the page in some way that I could see the changes?
|
The Chrome DevTools can disable the cache.
Right-click and choose Inspect Element to open the DevTools. Or use one of the following keyboard shortcuts:
F12
Control+Shift+i
Command+Shift+i
Click Network in the toolbar to open the network pane.
Check the Disable cache checkbox at the top.
Keep in mind, as a tweet... |
Read whole ASCII file into C++ std::string [duplicate] |
This question already has answers here:
How do I read an entire file into a std::string in C++?
(24 answers)
Closed 7 years ago.
I need to read a whole file into memory and place i... |
Update: Turns out that this method, while following STL idioms well, is actually surprisingly inefficient! Don't do this with large files. (See: http://insanecoding.blogspot.com/2011/11/how-to-read-in-file-in-c.html)
You can make a streambuf iterator out of the file and initialize the string with it:
#include <string>... |
How can I force clients to refresh JavaScript files? |
We are currently working in a private beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slowing down this process. That being said, one issue we are running into is that after we push out an update with new JavaScript files, the client ... |
As far as I know a common solution is to add a ?<version> to the script's src link.
For instance:
<script type="text/javascript" src="myfile.js?1500"></script>
I assume at this point that there isn't a better way than find-replace to increment these "version numbers" in all of the script tags?
You might have a ver... |
How to clear gradle cache? |
I'm trying to use Android Studio, and the first time I boot it up, it takes like 45 MINUTES to compile... If I don't quit the application, it is okay - each subsequent compilation/running the app will take around 45 seconds.
I've tried to check some of my caches: there's a .gradle/caches folder in my home directory, a... |
As @Bradford20000 pointed out in the comments, there might be a gradle.properties file as well as global gradle scripts located under $HOME/.gradle. In such case special attention must be paid when deleting the content of this directory.
The .gradle/caches directory holds the Gradle build cache. So if you have any err... |
Is there a <meta> tag to turn off caching in all browsers? [duplicate] |
This question already has answers here:
How do we control web page caching, across all browsers?
(30 answers)
Closed 7 years ago.
I read that when you don't have access to the web ... |
For modern web browsers (After IE9)
See the Duplicate listed at the top of the page for correct information!
See answer here: How to control web page caching, across all browsers?
For IE9 and before
Do not blindly copy paste this!
The list is just examples of different techniques, it's not for direct
insertion. If ... |
What requests do browsers' "F5" and "Ctrl + F5" refreshes generate? |
Is there a standard for what actions F5 and Ctrl+F5 trigger in web browsers?
I once did experiment in IE6 and Firefox 2.x. The F5 refresh would trigger a HTTP request sent to the server with an If-Modified-Since header, while Ctrl+F5 would not have such a header. In my understanding, F5 will try to utilize cached co... |
Generally speaking:
F5 may give you the same page even if the content is changed, because it may load the page from cache. But Ctrl+F5 forces a cache refresh, and will guarantee that if the content is changed, you will get the new content.
|
ETag vs Header Expires |
I've looked around but haven't been able to figure out if I should use both an ETag and an Expires Header or one or the other.
What I'm trying to do is make sure that my flash files (and other images and what not only get updated when there is a change to those files.
I don't want to do anything special like changing ... |
They are slightly different - the ETag does not have any information that the client can use to determine whether or not to make a request for that file again in the future. If ETag is all it has, it will always have to make a request. However, when the server reads the ETag from the client request, the server can t... |
Force browser to clear cache |
Is there a way I can put some code on my page so when someone visits a site, it clears the browser cache, so they can view the changes?
Languages used: ASP.NET, VB.NET, and of course HTML, CSS, and jQuery.
|
If this is about .css and .js changes, then one way is "cache busting" by appending something like "_versionNo" to the file name for each release. For example:
script_1.0.css // This is the URL for release 1.0
script_1.1.css // This is the URL for release 1.1
script_1.2.css // etc.
or after the file name:
script.css?... |
Java time-based map/cache with expiring keys [closed] |
Closed. This question is seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. It does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions see... |
Yes. Google Collections, or Guava as it is named now has something called MapMaker which can do exactly that.
ConcurrentMap<Key, Graph> graphs = new MapMaker()
.concurrencyLevel(4)
.softKeys()
.weakValues()
.maximumSize(10000)
.expiration(10, TimeUnit.MINUTES)
.makeComputingMap(
new Function<K... |
How to clear the cache of nginx? |
I use nginx to as the front server, I have modified the CSS files, but nginx is still serving the old ones.
I have tried to restart nginx, to no success and I have Googled, but not found a valid way to clear it.
Some articles say we can just delete the cache directory: var/cache/nginx, but there is no such directory o... |
I had the exact same problem - I was running my nginx in Virtualbox. I did not have caching turned on. But looks like sendfile was set to on in nginx.conf and that was causing the problem. @kolbyjack mentioned it above in the comments.
When I turned off sendfile - it worked fine.
This is because:
Sendfile is used to ... |
How do you clear Apache Maven's cache? |
Recently, Apache Maven seems to be having caching issues. Performing clean installs on our projects using Windows Vista or Windows 7 sometimes produce artifacts with the same data as a previous build even though the newer artifact's files should have been updated.
Is there any way to clear this cache to force maven to... |
281
Delete the artifacts (or the full local repo) from c:\Users\<username>\.m2\repository by hand.
Share
Improve this answer
Follow
edited Jul 10, 2018 at 13:48
Peter G
2,78333 gold badges2626 silver ... |
How to Empty Caches and Clean All Targets Xcode 4 and later |
Jonathan suggest here: Xcode Includes .xib files that have been deleted! that cleaning all targets and empty the caches will fix the problem with Xcode including deleted .xib files but I cannot find a way to empty the cache in Xcode 4.
How to do that in Xcode 4?
|
Command-Option-Shift-K to clean out the build folder. Even better, quit Xcode and clean out ~/Library/Developer/Xcode/DerivedData manually. Remove all its contents because there's a bug where Xcode will run an old version of your project that's in there somewhere. (Xcode 4.2 will show you the Derived Data folder: choo... |
Is there a decorator to simply cache function return values? |
Consider the following:
@property
def name(self):
if not hasattr(self, '_name'):
# expensive calculation
self._name = 1 + 1
return self._name
I'm new, but I think the caching could be factored out into a decorator. Only I didn't find one like it ;)
PS the real calculation doesn't depend on ... |
Python 3.8 functools.cached_property decorator
https://docs.python.org/dev/library/functools.html#functools.cached_property
cached_property from Werkzeug was mentioned at: https://stackoverflow.com/a/5295190/895245 but a supposedly derived version will be merged into 3.8, which is awesome.
This decorator can be seen a... |
How to cache data in a MVC application |
I have read lots of information about page caching and partial page caching in a MVC application. However, I would like to know how you would cache data.
In my scenario I will be using LINQ to Entities (entity framework). On the first call to GetNames (or whatever the method is) I want to grab the data from the databa... |
Reference the System.Web dll in your model and use System.Web.Caching.Cache
public string[] GetNames()
{
string[] names = Cache["names"] as string[];
if(names == null) //not in cache
{
names = DB.GetNames();
Cache["names"] = names;
}
return names;
}
A bit simp... |
Angular IE Caching issue for $http |
All the ajax calls that are sent from the IE are cached by Angular and I get a 304 response for all the subsequent calls. Although the request is the same, the response is not going be the same in my case. I want to disable this cache. I tried adding the cache attribute to $http.get but still it didn't help. How can t... |
Instead of disabling caching for each single GET-request, I disable it globally in the $httpProvider:
myModule.config(['$httpProvider', function($httpProvider) {
//initialize get if not there
if (!$httpProvider.defaults.headers.get) {
$httpProvider.defaults.headers.get = {};
}
// Answ... |
Stop jQuery .load response from being cached |
I have the following code making a GET request on a URL:
$('#searchButton').click(function() {
$('#inquiry').load('/portal/?f=searchBilling&pid=' + $('#query').val());
});
But the returned result is not always reflected. For example, I made a change in the response that spit out a stack trace but the ... |
You have to use a more complex function like $.ajax() if you want to control caching on a per-request basis. Or, if you just want to turn it off for everything, put this at the top of your script:
$.ajaxSetup ({
// Disable caching of AJAX responses
cache: false
});
|
How do cache lines work? |
I understand that the processor brings data into the cache via cache lines, which - for instance, on my Atom processor - brings in about 64 bytes at a time, whatever the size of the actual data being read.
My question is:
Imagine that you need to read one byte from memory, which 64 bytes will be brought into the cache... |
If the cache line containing the byte or word you're loading is not already present in the cache, your CPU will request the 64 bytes that begin at the cache line boundary (the largest address below the one you need that is multiple of 64).
Modern PC memory modules transfer 64 bits (8 bytes) at a time, in a burst of ei... |
How can I clear the SQL Server query cache? |
I've got a simple query running against SQL Server 2005
SELECT *
FROM Table
WHERE Col = 'someval'
The first time I execute the query can take > 15 secs. Subsequent executes are back in < 1 sec.
How can I get SQL Server 2005 not to use any cached results? I've tried running
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
... |
Here is some good explaination. check out it.
http://www.mssqltips.com/tip.asp?tip=1360
CHECKPOINT;
GO
DBCC DROPCLEANBUFFERS;
GO
From the linked article:
If all of the performance testing is conducted in SQL Server the best approach may be to issue a CHECKPOINT and then issue the DBCC DROPCLEANBUFFERS command. A... |
Redis cache vs. using memory directly |
I have not used Redis yet, but I have heard about it and plan to try using it for caching data.
I have heard that Redis uses memory as a cache store database. What's the point of Redis, since I can use an object or dictionary to store data? Like this:
var cache = {
key: {
},
key: {
}
...
... |
Redis is a remote data structure server. It is certainly slower than just storing the data in local memory (since it involves socket roundtrips to fetch/store the data). However, it also brings some interesting properties:
Redis can be accessed by all the processes of your applications, possibly running on several no... |
AngularJS disable partial caching on dev machine |
I have problem with caching partials in AngularJS.
In my HTML page I have:
<body>
<div ng-view></div>
<body>
where my partials are loaded.
When I change HTML code in my partial, browser still load old data.
Is there any workaround?
|
For Development you can also deactivate the browser cache - In Chrome Dev Tools on the bottom right click on the gear and tick the option
Disable cache (while DevTools is open)
Update: In Firefox there is the same option in Debugger -> Settings -> Advanced Section (checked for Version 33)
Update 2: Although this op... |
Cache an HTTP 'Get' service response in AngularJS? |
I want to be able to create a custom AngularJS service that makes an HTTP 'Get' request when its data object is empty and populates the data object on success.
The next time a call is made to this service, I would like to bypass the overhead of making the HTTP request again and instead return the cached data object.
I... |
Angular's $http has a cache built in. According to the docs:
cache – {boolean|Object} – A boolean value or object created with $cacheFactory to enable or disable caching of the HTTP response. See
$http Caching for more
information.
Boolean value
So you can set cache to true in its options:
$http.get(url, { cache... |
Disable browser cache for entire ASP.NET website |
I am looking for a method to disable the browser cache for an entire ASP.NET MVC Website
I found the following method:
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.Cache.SetNoStore();
And also a meta tag method (it won't work for me, since some MVC actions send partial HTML/JSON throu... |
HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Curr... |
Laravel 5 Clear Views Cache |
I notice that Laravel cache views are stored in ~/storage/framework/views. Over time, they get to eat up my space. How do I delete them? Is there any command that could? I tried php artisan cache:clear, but it is not clearing the views cache. With that, I have to manually delete the files in the said folder.
Also, how... |
There is now a php artisan view:clear command for this task since Laravel 5.1
|
Programmatically get the cache line size? |
All platforms welcome, please specify the platform for your answer.
A similar question: How to programmatically get the CPU cache page size in C++?
|
You can use std::hardware_destructive_interference_size since C++17.
Its defined as:
Minimum offset between two objects to avoid false sharing. Guaranteed
to be at least alignof(std::max_align_t)
|
What is the difference between buffer and cache memory in Linux? |
To me it's not clear what's the difference between the two Linux memory concepts : buffer and cache. I've read through this post and it seems to me that the difference between them is the expiration policy:
buffer's policy is first-in, first-out
cache's policy is Least Recently Used.
Am I right?
In particular, I'm ... |
"Buffers" represent how much portion of RAM is dedicated to cache disk blocks. "Cached" is similar like "Buffers", only this time it caches pages from file reading.
quote from:
https://web.archive.org/web/20110207101856/http://www.linuxforums.org/articles/using-top-more-efficiently_89.html
|
Notepad++ cached files location |
On the most recent versions of Notepad++, when the application is closed, unsaved files are maintained when the application is restarted.
I presume that those files are cached on a temporary files. What is the location of that file(s).
Thank you
|
I noticed it myself, and found the files inside the backup folder. You can check where it is using Menu:Settings -> Preferences -> Backup. Note : My NPP installation is portable, and on Windows, so YMMV.
|
Spring Cache @Cacheable - not working while calling from another method of the same bean |
Spring cache is not working when calling cached method from another method of the same bean.
Here is an example to explain my problem in clear way.
Configuration:
<cache:annotation-driven cache-manager="myCacheManager" />
<bean id="myCacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
<pr... |
I believe this is how it works. From what I remember reading, there is a proxy class generated that intercepts all requests and responds with the cached value, but 'internal' calls within the same class will not get the cached value.
From https://code.google.com/p/ehcache-spring-annotations/wiki/UsingCacheable
Only ... |
How to force Chrome browser to reload .css file while debugging in Visual Studio? |
I'm currently editing a .css file inside of Visual Studio 2012 (in debug mode). I'm using Chrome as my browser. When I make changes to my application's .css file inside of Visual Studio and save, refreshing the page will not load with the updated change in my .css file. I think the .css file is still cached.
I have tr... |
There are much more complicated solutions, but a very easy, simple one is just to add a random query string to your CSS include.
Such as src="/css/styles.css?v={random number/string}"
If you're using php or another server-side language, you can do this automatically with time(). So it would be styles.css?v=<?=time();... |
Clear MySQL query cache without restarting server |
Is there any way to clear mysql query cache without restarting mySQL server?
|
I believe you can use...
RESET QUERY CACHE;
...if the user you're running as has reload rights. Alternatively, you can defragment the query cache via...
FLUSH QUERY CACHE;
See the Query Cache Status and Maintenance section of the MySQL manual for more information.
|
Write-back vs Write-Through caching? |
My understanding is that the main difference between the two methods is that in "write-through" method data is written to the main memory through the cache immediately, while in "write-back" data is written in a "later time".
We still need to wait for the memory in "later time" so What is the benefit of "write-through... |
The benefit of write-through to main memory is that it simplifies the design of the computer system. With write-through, the main memory always has an up-to-date copy of the line. So when a read is done, main memory can always reply with the requested data.
If write-back is used, sometimes the up-to-date data is in ... |
How would you implement an LRU cache in Java? |
Please don't say EHCache or OSCache, etc. Assume for purposes of this question that I want to implement my own using just the SDK (learning by doing). Given that the cache will be used in a multithreaded environment, which datastructures would you use? I've already implemented one using LinkedHashMap and Collections#s... |
If I were doing this again from scratch today, I'd use Guava's CacheBuilder.
|
How to clear APC cache entries? |
I need to clear all APC cache entries when I deploy a new version of the site.
APC.php has a button for clearing all opcode caches, but I don't see buttons for clearing all User Entries, or all System Entries, or all Per-Directory Entries.
Is it possible to clear all cache entries via the command-line, or some other w... |
You can use the PHP function apc_clear_cache.
Calling apc_clear_cache() will clear the system cache and calling apc_clear_cache('user') will clear the user cache.
|
What is the difference between Caching and Memoization? |
I would like to know what the actual difference between caching and memoization is.
As I see it, both involve avoiding repeated function calls to get data by storing it.
What's the core difference between the two?
|
Memoization is a specific form of caching that involves caching the return value of a function based on its parameters.
Caching is a more general term; for example, HTTP caching is caching but not memoization.
Wikipedia says:
Although related to caching, memoization refers to a specific case of this optimization, di... |
How to programmatically empty browser cache? |
I am looking for a way to programmatically empty the browser cache. I am doing this because the application caches confidential data and I'd like to remove those when you press "log out". This would happen either via server or JavaScript. Of course, using the software on foreign/public computer is still discouraged as... |
It's possible, you can simply use jQuery to substitute the 'meta tag' that references the cache status with an event handler / button, and then refresh, easy,
$('.button').click(function() {
$.ajax({
url: "",
context: document.body,
success: function(s,x){
$('html[manifest=sav... |
How to prevent caching of my Javascript file? [duplicate] |
This question already has answers here:
How to force browsers to reload cached CSS and JS files?
(58 answers)
Closed 10 years ago.
I have a simple html:
<html>
<body>
<head>
<meta ... |
Add a random query string to the src
You could either do this manually by incrementing the querystring each time you make a change:
<script src="test.js?version=1"></script>
Or if you are using a server side language, you could automatically generate this:
ASP.NET:
<script src="test.js?rndstr=<%= getRandomStr() %>"><... |
How do I request a file but not save it with Wget? [closed] |
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
... |
Use q flag for quiet mode, and tell wget to output to stdout with O- (uppercase o) and redirect to /dev/null to discard the output:
wget -qO- $url &> /dev/null
> redirects application output (to a file). if > is preceded by ampersand, shell redirects all outputs (error and normal) to the file right of >. If you don't ... |
What is the "Temporary ASP.NET Files" folder for? |
I've discovered this folder in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files and have a few questions.
What does ASP.NET use this folder for, and what sort of files are stored here?
How does a file get stored here, and when is it updated?
Does the folder need any sort of maintenance?
|
These are what's known as Shadow Copy Folders.
Simplistically....and I really mean it:
When ASP.NET runs your app for the
first time, it copies any assemblies
found in the /bin folder, copies any
source code files (found for example
in the App_Code folder) and parses
your aspx, ascx files to c# source
fi... |
Redis: possible to expire an element in an array or sorted set? |
Is it currently only possible to expire an entire key/value pair? What if I want to add values to a List type structure and have them get auto removed 1 hour after insertion. Is that currently possible, or would it require running a cron job to do the purging manually?
|
Is it currently only possible to expire an entire key/value pair?
As far as I know, and also according to key commands and document about expiration, currently you can set expiration only to specific key and not to it's underlying data structure. However there is a discussion on google groups about this functionalit... |
Cache busting via params |
We want to cache bust on production deploys, but not waste a bunch of time off the bat figuring out a system for doing so. My thought was to apply a param to the end of css and js files with the current version number:
<link rel="stylesheet" href="base_url.com/file.css?v=1.123"/>
Two questions: Will this effectivel... |
The param ?v=1.123 indicates a query string, and the browser will therefore think it is a new path from, say, ?v=1.0. Thus causing it to load from file, not from cache. As you want.
And, the browser will assume that the source will stay the same next time you call ?v=1.123 and should cache it with that string. So it ... |
How to prevent browser page caching in Rails |
Ubuntu → Apache → Phusion Passenger → Rails 2.3.
The main part of my site reacts to your clicks. So, if you click on a link, it will send you on to the destination, and instantly regenerate your page.
But, if you hit the back button, you don't see the new page. Unfortunately, it's not showing up without a manual refre... |
I finally figured this out - http://blog.serendeputy.com/posts/how-to-prevent-browsers-from-caching-a-page-in-rails/ in application_controller.rb.
After Ruby on Rails 5:
class ApplicationController < ActionController::Base
before_action :set_cache_headers
private
def set_cache_headers
response.headers["Ca... |
Why both no-cache and no-store should be used in HTTP response? |
I'm told to prevent user-info leaking, only "no-cache" in response is not enough. "no-store" is also necessary.
Cache-Control: no-cache, no-store
After reading this spec http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, I'm still not quite sure why.
My current understanding is that it is just for intermediate c... |
I must clarify that no-cache does not mean do not cache. In fact, it means "revalidate with server" before using any cached response you may have, on every request.
must-revalidate, on the other hand, only needs to revalidate when the resource is considered stale.
If the server says that the resource is still valid th... |
Private vs Public in Cache-Control |
Can you please describe an example indicating difference between Public and Private Cache-Control in asp.net applications hosted in IIS.
I read in MSDN that the difference is the following:
Public:
Sets Cache-Control: public to specify that the response is cacheable by clients and shared (proxy) caches.
Private: Defa... |
The only difference is that with Private you are not allowing proxies to cache the data that travels through them. In the end, it all boils down to the data contained in the pages/files you are sending.
For example, your ISP could have an invisible proxy between you and the Internet, that is caching web pages to reduc... |
Stop Chrome Caching My JS Files |
I will make a change to my JS files but it won't really change in the browser, I have to rename the files every time so that it reloads it. Is there some sort of .htaccess command I can add or something to make it stop caching?
It is even caching my html pages hard core. I need to reopen my entire browser just to see... |
You can click the settings icon on top right corner ... | More Tools | Developer Tools | Network | Disable cache (while DevTools is open)
For windows, this is F12 or CTRL + SHIFT + I while on mac CMD + SHIFT + I opens up DevTools.
New path for Chrome Update Sept 2018:
Click settings icon on the top right corner ... |... |
Chrome memory cache vs disk cache |
I am interested in chrome memory cache vs disk cache? I use webpack, common chunks plugin and generate all my files with chunkhash.
How does memory differ from disk cache. When I reload my page some files are loaded from memory cache and some from disk cache (bundle.js and image.jpg from memory cache and css from dis... |
Like their names say:
"Memory Cache" stores and loads resources to and from Memory (RAM). So this is much faster, but it is non-persistent. Content is available until you close the browser.
"Disk Cache" is persistent. Cached resources are stored and loaded to and from disk.
Simple Test:
Open Chrome Developer Tools/Ne... |
How to configure static content cache per folder and extension in IIS7? |
I would like to set up rules in IIS7 for static content caching in my ASP.NET website.
I have seen these articles, which details how to do it using the <clientCache /> element in web.config:
Client Cache <clientCache> (IIS.NET)
Add Expires or Cache Control Header to static content in IIS (Stack Overflow)
However, th... |
You can set specific cache-headers for a whole folder in either your root web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- Note the use of the 'location' tag to specify which
folder this applies to-->
<location path="images">
<system.webServer>
<staticContent>
<clie... |
Is there a Python caching library? |
I'm looking for a Python caching library but can't find anything so far. I need a simple dict-like interface where I can set keys and their expiration and get them back cached. Sort of something like:
cache.get(myfunction, duration=300)
which will give me the item from the cache if it exists or call the function and ... |
Take a look at Beaker:
Home Page
Caching Documentation
Good quick-start article about using Beaker with Django (but useful in any other apps too)
|
How to prevent Browser cache on Angular 2 site? |
We're currently working on a new project with regular updates that's being used daily by one of our clients. This project is being developed using angular 2 and we're facing cache issues, that is our clients are not seeing the latest changes on their machines.
Mainly the html/css files for the js files seem to get upd... |
angular-cli resolves this by providing an --output-hashing flag for the build command (versions 6/7, for later versions see here). Example usage:
ng build --output-hashing=all
Bundling & Tree-Shaking provides some details and context. Running ng help build, documents the flag:
--output-hashing=none|all|media|bundles... |
How to turn off caching on Firefox? |
During development I have to "clear cache" in Firefox all the time in order to make it use the latest version of JavaScript files.
Is there some kind of setting (about:config) to turn off caching completely for JavaScript files? Or, if not, for all files?
|
Enter "about:config" into the Firefox address bar and set:
browser.cache.disk.enable = false
browser.cache.memory.enable = false
If developing locally, or using HTML5's new manifest attribute you may have to also set the following in about:config -
browser.cache.offline.enable = false
|
Python in-memory cache with time to live |
I have multiple threads running the same process that need to be able to to notify each other that something should not be worked on for the next n seconds its not the end of the world if they do however.
My aim is to be able to pass a string and a TTL to the cache and be able to fetch all the strings that are in the ... |
You can use the expiringdict module:
The core of the library is ExpiringDict class which is an ordered dictionary with auto-expiring values for caching purposes.
In the description they do not talk about multithreading, so in order not to mess up, use a Lock.
|
Android image caching |
How can I cache images after they are downloaded from web?
|
178
And now the punchline: use the system cache.
URL url = new URL(strUrl);
URLConnection connection = url.openConnection();
connection.setUseCaches(true);
Object response = connection.getContent();
if (response instanceof Bitmap) {
Bitmap bitmap = (Bitmap)response;
}
... |
Disable cache for some images |
I generate some images using a PHP lib.
Sometimes the browser does not load the new generated file.
How can I disable cache just for images created dynamically by me?
Note: I have to use same name for the created images over time.
|
A common and simple solution to this problem that feels like a hack but is fairly portable is to add a randomly generated query string to each request for the dynamic image.
So, for example -
<img src="image.png" />
Would become
<img src="image.png?dummy=8484744" />
Or
<img src="image.png?dummy=371662" />
From the ... |
What is causing "Unable to allocate memory for pool" in PHP? |
I've occasionally run up against a server's memory allocation limit, particularly with a bloated application like Wordpress, but never encountered "Unable to allocate memory for pool" and having trouble tracking down any information.
Does anyone know what this means? I've tried increasing the memory_limit without suc... |
Probably is APC related.
For the people having this problem, please specify you .ini settings. Specifically your apc.mmap_file_mask setting.
For file-backed mmap, it should be set to something like:
apc.mmap_file_mask=/tmp/apc.XXXXXX
To mmap directly from /dev/zero, use:
apc.mmap_file_mask=/dev/zero
For POSIX-compl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.