Force Refresh CSS, JavaScript & Any Static File in Browser Cache

Link

Web browsers automatically save webpage stylesheets, JavaScripts, and other static files such as images and favicon on a user’s computer. This is called caching. Caching saves user time and bandwidth by not downloading the same files over and over again. It’s a great feature, but it also pose a big problem when a website makes some changes to a file. For instance, the webmaster may change some styles or JavaScript. Since the filename generally remains the same, a browser has no way of knowing it has been updated and uses old cached version of the files instead. To avoid this, browser needs to be notified when a file has been modified. Here are some ways to do so:

Manual Method

The simplest way of informing browser about a file modification is to change its name. This can be done by adding “ver” parameter to the filename. You can then increment the version number each time you want to force download a file. You can do it like this:

Force cached stylesheet to refresh:

<link href="http://sumtips.com/style.css?ver=2" rel="stylesheet" type="text/css" media="screen" />

Force cached JavaScript to refresh:

<script src="http://sumtips.com/script.js?ver=2" type="text/javascript"></script>

Force cached static files to refresh:

<link rel="shortcut icon" href="http://sumtips.com/favicon.ico?ver=2" />

You can add anything after the ‘?’ to force refresh files.

Automatically Using PHP

Updating version info manually each time may become tedious. To automate the process, we can use PHP to add the parameter:

<link href="http://sumtips.com/style.css?ver=<?php echo(filemtime("style.css")); ?>" rel="stylesheet" type="text/css" />
<script src="http://sumtips.com/script.js?ver=<?php echo(filemtime("script.js")); ?>" type="text/javascript" ></script>
<link rel="shortcut icon" href="http://sumtips.com/favicon.ico?ver=<?php echo(filemtime("favicon.ico")); ?>" />

Now whenever the file is changed on the server, its modified time is added to filename. This lets the browser know that the file has changed and it downloads a new copy.

WordPress

On WordPress, you can add the time() function to the code that adds the stylesheet and JavaScript files to your theme:

wp_enqueue_style( 'theme_style', 'style.css', '', time() );
wp_enqueue_script( 'theme_script', 'script.js', '', time() );

via WPEngineer

Hope it helps!

Share this post on Google+ Share this post on Twitter Share this post on Facebook 


Connect with SumTips on Facebook, Twitter, or Subscribe with RSS

Related posts:

  1. Funny Google Image Search with JavaScript
  2. Shares Files Browser-to-Browser without Limits
  3. Increase WordPress File Upload Size Limit on Shared Hosts
  4. Identify Unknown File Types with Smart File Advisor
  5. Add Create Folder List, Copy File/Folder Name to Explore Context Menu

from SumTips http://sumtips.com/2012/05/force-refresh-css-javascript-static-files.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+Sumtips+%28SumTips%29

Pubblicità / Arriva lo spot durante la chiamata telefonica (e altre segnalazioni)

Link

Alcune indicazioni di temi e articoli sul mondo e i problemi della pubblicità raccolti qua e là sulla Rete

 

SellARing: arriva la pubblicità durate la chiamata telefonica!

La società sellaring ha infatti studiato e messo a punto un sistema di annunci che va a sostituire il suono della chiamata nei primi 10 secondi di connessione. In pratica dovrebbe mettere al posto del “tuuu, tuuu” un annuncio pubblicitario.

Android.hdblog

 

 

Microsoft reinventa la pubblicità, ecco i Kinect NUads

I Kinect NUads (Natura User Interface ads)  sono clip pubblicitari che consentono allo spettatore di interagire in tempo reale con il brand pubblicizzato, servendosi delle funzioni di gestural e vocal interface proprie di Kinect.

Panorama.it

 

Now Available apre le porte al ‘’consumatore creativo’’

Accedendo al sito www.cambialapubblicita.it  è infatti possibile per chiunque candidarsi per partecipare in prima persona al cosiddetto “brainstorming”, il momento in cui in una agenzia di comunicazione il team creativo seduto intorno ad un tavolo condivide spunti e riflessioni, con l’obiettivo di trasformarli in idee per la pubblicità.

Cambialapubblicita.it

 

Quando l’informazione deve dire basta alla pubblicità”

Giovanni Boccia Artieri: ‘’Affrontare in tempo reale le news richiede più semplicemente di ripensare le strategie di inserzione pubblicitaria seguendo il flusso emotivo degli accadimenti. A volte infatti la migliore promozione (per il brand e la testata) è farla tacere’’.

Mediamondo

 

Pubblicità in cambio di equity, può funzionare?

In Europa, dove per le giovani imprese la situazione è ancora più difficile rispetto a quella dei competitor d’oltreoceano, alcuni media group si sono inventati un nuovo modo per aiutarle: concedere loro spazi commerciali in cambio di quote azionarie

Workingcapital

 

Facebook: la maggioranza degli utenti non clicca sulla pubblicità

Un nuovo studio, condotto da CNBC e Associated Press, ha rilevato che il 57% degli utenti di Facebook non viene mai coinvolto e non clicca mai sui contenuti commerciali del sito, mentre solo il 26% sostiene di farlo, ma raramente.

Telegraph.co.uk

 

from LSDI http://www.lsdi.it/2012/pubblicita-arriva-lo-spot-durante-la-chiamata-telefonica-e-altre-segnalazioni/

How to create a facebook style activity notification plugin using jQuery and PHP – facebook beeper

Link

Facebook’s new beeper alert notification system looks so handy. AA423WMEB3GP I believe that this is the most effective way of notifying anything live like a friends update or a friends request or when someone comes online. But the technology behind is just so simple. It contains only a bit of javascript code using jQuery and [...]

from Swadesh Programming Blog http://itswadesh.wordpress.com/2012/05/20/how-to-create-a-facebook-style-activity-notification-plugin-using-jquery-and-php-facebook-beeper/

Oscuramento preventivo per un sito web sulla Gorgona

Link

Il tribunale del riesame di Livorno si è riservato di decidere sulla richiesta di dissequestro di www.ilgorgon.eu, un sito dedicato all’ isola di Gorgona.

Il sito era stato oscurato dal gip livornese, che aveva accolto una richiesta in tal senso della procura della repubblica, motivata dal rischio di reiterazione del reato – finora presunto – di diffamazione.

 

Una decisione preoccupante, che suona come una vera e propria censura preventiva e che rischia di rappresentare un pericoloso precedente da utilizzare nel tentativo di  mettere a tacere siti web scomodi o troppo ingombranti.

 

 

 

Autori della querela – spiega Antonio Brindisi, il responsabile del sito – ‘’alcune persone che gravitano occasionalmente sull’ isola di Gorgona, per vacanze o per lavoro, che si sono ritenute offese da poche righe di filastrocca con cui io e miei figli ci divertivamo a dare dei soprannomi a dei personaggi che gravitavano nel paese, senza mai fare nome e cognome. Poche righe di filastrocca ironica ed infantile, in un sito che potrebbe riempire un enciclopedia Treccani, hanno motivato il pm e il gip ad oscurare il mio sito, in via preventiva perché il reato era reiterabile…’’.

 

 

E’ anche per questo che Antonio Brindisi – giornalista, per anni corrispondente dall’ Africa dell’ agenzia Agr e ora promotore di un Comitato abitanti dell’ isola – oltre a ricorrere al tribunale della libertà, qualche giorno fa ha rivolto un appello all’ Ordine dei giornalisti chiedendo un suo impegno per la tutela della libertà di stampa e del diritto alla libertà di espressione.

 

 

Abbiamo chiesto a Brindisi di raccontarci la vicenda.

 

Ecco il suo racconto:

 

‘’Nel 2000, dopo 7 anni passati nell’Africa Occidentale, anche come corrispondente per l’agenzia agr, sono tornato all’isola di Gorgona, di cui sono discendente da parte di mia nonna, Amelia Citti, e ho constatato che il paese dei gorgonesi stava scomparendo invaso dalla colonia penale presente sull’isola, che non rispettava più i limiti tra paese e carcere (vedi www.ilgorgon.blogspot.com). Sarebbe divenuta un’ altra Pianosa, ora dopo lo svuotamento del paese, interdetta a tutti, abbandonata alle zecche, di proprietà del ministero di giustizia che ne fa quello che vuole dopo averla distrutta civilmente.

 

Ho capito che a Gorgona si riservava lo stesso destino. Così ho deciso con la mia famiglia (moglie e tre figli) di vivere stabilmente sull’isola prima che fosse troppo tardi (oggi ci sono 67 residenti che vengono solo per le vacanze, di cui una diecina di abitanti civili fissi, a parte i dipendenti della colonia penale, circa 150 persone) e di aprire un sito internet, www.ilgorgon.eu, per far conoscere tutte le problematiche dell’ isola. Sino ad oggi il sito era una piccola ‘’treccani’’ di Gorgona a cui mi dedicavo ogni giorno, a mie spese, senza ottenerne nessun profitto.

 

Questa scelta di abitarvi e di fare il sito non è stata mai digerita dalla direzione carceraria e dagli ex-gorgonesi che ci passano le vacanze quasi gratis, nelle casette fatiscenti del demanio a pochi euro di affitto, scroccando a più non posso ed utilizzando i beni del ministero a fini personali senza che nessuno si accorgesse di niente (qui si spendono una diecina di milioni l’ anno per settanta detenuti per un carcere considerato modello, ma che è solo un grande spreco di soldi, che fra l’altro ci ha fatto quasi sparire definitivamente). Ce ne hanno fatte di tutti i colori, fino ad oggi con l’oscuramento del sito. Pensa che i due giudici che lo hanno deciso preventivamente non lo hanno nemmeno letto perché quello che mi imputano l’avevo cancellato io stesso già prima.

 

L’oscuramento è nato dopo la denuncia di 6-7 persone che si sono sentite offese per poche righe ironiche sui personaggi del paese, senza che vi fossero nome e cognome o riferimenti personali. Le stesse persone (dipendenti del carcere ed ex gorgonesi che non vivono a Gorgona ma ci conservano un’ abitazione) che ci hanno da anni isolato, minacciato, che hanno fatto perdere il lavoro a mia moglie che lavorava alla mensa della polizia penitenziaria, che ci hanno denunciato per le cose più diverse, senza riuscire a toglierci dall’ isola. Una cosa che, tra l’ altro, è per noi un enorme sacrificio perché lì, oltre ai nostri affetti, non c’è niente’’.

 

Antonio Brindisi

ilgorgon@libero.it

from LSDI http://www.lsdi.it/2012/oscuramento-preventivo-per-un-sito-web-sulla-gorgona/

Sound Design: Mechanical Roof Tweaks Concert Acoustic in Real Time

Link

Imagine a concert hall that adapts to each performer, during the performance.

Since humans started building large buildings, we’ve been obsessed with the acoustics of our theaters and concert halls. And despite all that time to get it right, we’re constantly deploying new materials and computer-calculated designs to create perfection in the sound of live performance.

Resonant Chamber feels like architectural acoustics has, at last, met its natural conclusion. In a huge collaboration spearheaded by design firm RVTR, engineers, composers, and designers have constructed what are essentially transforming roofs that can adapt to the sound of performers and reshape themselves to complement and amplify the audio.

“The goal is not ‘perfect’ acoustics, but rather variable acoustics for different applications,” explains RVTR’s Geoffrey Thun. “To enable a single venue to provide ideal conditions for a range of music performance and audience configurations would be fantastic.”

The system is described best as “rigid origami,” a collection of triangle panels that hang from a track, driven by motors to shift positions on command. The panels themselves come in three varieties: One is bamboo plywood, which reflects sound. Another is porous polypropylene, which absorbs it. And the third is actually a hollow panel that’s been filled with a speaker. With these three counterbalancing tools at its disposal, the Resonant Chamber can play chess with sound waves, creating a strategic structure to match any style of performance.

But the real promise of the system is its potential to go live. “We are currently developing a customized software interface that can track, control, and predict the physical systems performance in real time,” Thun explains to Co.Design. In this next model, microphones follow various frequencies to make immediate tweaks to the physical and aural landscape. Imagine a rock concert that could add a real chamber reverb to select songs, or an orchestra that could accentuate a melody without changing the volume at which it played.

As of now, RVTR is also looking to scale their prototype, with the goal of creating a 1,000-square-foot installation. “Our early system simulations suggest that the system is scalable,” writes Thun. “We also anticipate that specific geometric patterns utilized to date will likely be modified as will the actuation logics moving forward–that’s why we iteratively prototype.” So the Resonance Chamber of today may look much different than that of tomorrow.

Ultimately, with such a duplicable and adaptive system, RVTR could take over, not just the concert space, but any live environment in need of dynamic adjustment (busy restaurants come to mind). But until then, we’ll all have to do what we always do: ignore that obnoxiously loud bachelorette party at the next table over, and pretend the band we’re about to see won’t inevitably sound worse than they did on their studio album.

Write by Mark Wilson on http://www.fastcodesign.com/1669640/a-mechanical-roof-tweaks-concert-aco…

About the author

My name is Gustavo Guiotto, I’m from Porto Alegre, Brazil. I am an audio/sound aficionado and producer in my own studio, soultronick.com. If you have any suggestions or requests just let me know. You can contact me via email at soultronick@gmail or follow me on Twitter at @soultronick

Sponsored Links:

Abduzeedo Inspiration Guide for Designers at Amazon

from Latest articles http://feedproxy.google.com/~r/abduzeedo/~3/EFJY-98wKR0/sound-design-mechanical-roof-tweaks-concert-acoustic-real-time