• How to Add a Cache Layer to #serverless #graphql #appsync API

    In this post, I show an example of simple application based on the Serverless framework. The application uses Amazon Appsync, Lambda, DynamoDB, Amazon DynamoDB Accelerator (DAX), to demonstrate how to use Amazon DAX as caching layer in front of #aws Appsync Resolvers.Amazon DynamoDB Accelerator (DAX) is a fully managed, highly available, in-memory cache for DynamoDB that delivers up to a 10x performance improvement — from milliseconds to microseconds — even at millions of requests per second.A simple serverless CMSThe example application in this post is a simple CMS. I use Serverless framework templates to simplify the setup for Appsync. The sections in template that create the Appsync, Dynamodb, Cognito identity pool and user pool, DAX cluster, roles, security groups, and subnet groups, and (...)


  • How to Move Code into a #docker Container

    Docker provides two good options for moving your code into an image or container: bind mounts and the Dockerfile COPY instruction. In this post, I’ll explain why images should always use the COPY instruction in production, and why it may be more convenient to use bind mounts in development.Dockerfile COPY InstructionThe COPY instruction in a Dockerfile is used to copy files or directories from the host machine filesystem into an image. For example, the following Dockerfile sets up a NodeJS application for running in production mode.# DockerfileFROM node:carbonWORKDIR /appENV NODE_ENV=production# Install dependencies first to take advantage of Docker layer caching. COPY package.json yarn.lock ./RUN yarn install —frozen-lockfile —no-cache —production# Copy the application files (...)

    #devops #move-code-into-docker #programming #best-practices

  • How I started doing load #testing on #graphql without writing a single Query

    EasyGraphQLSome time ago I was working on a GraphQL project that includes activities and each activity can have some comments with the info of the user that created the comment. The first thing that you might think is that it is a problem of query n + 1 , and yes; it is!I decided to implement dataloaders but for some reason, there was an error on the implementation, so it wasn’t caching the query and the result was a lot of request to the database. After finding that issue I implemented it on the right way reducing the queries to the database from 46 to 6.That’s why I decided to create an open source tool that will help me create queries and make load tests just passing my GraphQL schema.How it works:easygraphql-load-tester can be used on two ways for the moment; the first one is using (...)

    #javascript #artillery #load-testing

  • Ruby on Rails to Lucky on Crystal: Blazing fast, fewer bugs, and even more fun.

    I love Ruby and I love Rails, but I’ve found myself searching for something more. Something fast so I don’t need to add caching. Something type-safe so customers see fewer bugs. Something fun to use so I actually enjoy building applications.Would Elixir scratch my itch? It was a good start. It made it fun to write beautiful code, but I still encountered bugs in production that could have been caught with a better type system.There’s Elm. It’s beautiful. Fun. But only available on the front-end.I played briefly with Go and Rust, but I felt like the type-system and syntax was too unfriendly for me to enjoy using them.Finally, I tried CrystalAt first, I was pretty put-off by Crystal. It looked almost identical to Ruby, so why would I try it?Well eventually I did try it, and I fell in love (...)

    #programming #luckies #lucky-on-crystal #ruby-on-rails #web-development

  • Integrate CloudwaysCDN with #laravel

    A Content Delivery Network (CDN) is an arrangement of intermediary servers hosted at server farms located all over the web. The goal of a #cdn is to deliver content as fast as possible regardless of the location of the server hosting the website. In technical terms, CDN delivers web caching, load balancing, and request routing to ensure fast page load speed.How CDN Adds Value to Your BusinessRegardless of the nature of your business, CDN adds value to your website. If you are into services delivery, a CDN ensures faster delivery of your services to the clients. Similarly, if you are a product or a platform, a CDN allows all visitors and users enjoy your product without experiencing lag.In all cases, a CDN is an important addition to the website and business processes. The high page load (...)

    #web-development #cache #php

  • #graphql: 3 Years in, and lessons learned

    Back in late 2016 I wrote an article called GraphQL: Tips after a year in production. Since then, GraphQL started offering native subscriptions, Relay got so good you could replace Redux with Relay Modern, and I learned a few neat tricks along the way. I’ve also made a bunch of mistakes. Looking back on my GraphQL journey, here’s what I’d change.1. Use a DataLoader from the get goDataLoader is a small cache that is beautiful in its simplicity. Instead of caching the entirety of the GraphQL response, it caches database queries to be used in resolve functions. I put off implementing it in my app for fear that it was a premature optimization. Boy was I wrong. Looking back, I should have done it a lot sooner. Aside from the generous performance boost, it simplified my resolve functions by (...)


  • Poll finds U.S.-Mexico border residents overwhelmingly value mobility, oppose wall

    Residents who live along the U.S.-Mexico border overwhelmingly prefer bridges over fences and are dead set against building a new wall, according to a Cronkite News-Univision-Dallas Morning News poll.

    #sondage #murs #opposition #résistance #USA #Mexique #frontières #barrières_frontalières

    • Vigilantes Not Welcome : A Border Town Pushes Back on Anti-Immigrant Extremists

      In late August last year, 39-year-old Michael Lewis Arthur Meyer exited La Gitana bar in Arivaca, Arizona, took out his phone, and started recording a video for his Facebook page: “So down here in Arivaca, if you like to traffic in children, if you like to make sure women and children have contraceptives before handing them off to the coyotes to be dragged through the desert, knowing they’re going to get raped along the way, if you’re involved in human trafficking or dope smuggling, these individuals have your back.”

      Meyer, who had a trim red beard, dark sunglasses, and a camouflage American flag hat, aimed his cellphone camera at a wooden awning on a small white bungalow across the street from La Gitana, panning between two signs with the words “Arivaca Humanitarian Aid Office” and “Oficina De Ayuda Humanitaria” in turquoise letters.

      The video went on for nine and a half minutes, as Meyer, the leader of a group called Veterans on Patrol, which had more than 70,000 followers on Facebook, talked about stopping border crossers and searching abandoned mineshafts for evidence of trafficked women and children. Every couple of minutes he would return to the aid office.

      “If you’re ever down here in Arivaca,” he told his audience, “if you want to know who helps child traffickers, if you want to know who helps dope smugglers, if you want to know who helps ISIS, if you want to know who helps La Raza, MS-13, any of ’em, any of the bad guys, these people help ’em.”

      The claims were false and outrageous. But Meyer had an audience, and people in town were well aware of how media-fueled anti-­immigrant vitriol and conspiracies could spill over into real-world violence. It had happened there before.

      Arivaca sits just 11 miles north of the Mexico border in a remote area of the Sonoran Desert. For about two decades, anti-immigrant vigilante groups have patrolled the region to try to remedy what they perceive as the federal government’s failure to secure the border. In 2009, the leader of one of these groups and two accomplices murdered two residents—a little girl and her father—during a home invasion and robbery planned to fund their activities. Meyer’s video brought that trauma back and was quickly followed by a series of incidents revolving around various vigilante groups, La Gitana, and the humanitarian aid office. When I visited in mid-September, the town was clearly on edge. “If we don’t do something about [the situation], we’re going to have bodies here again,” Arivaca’s unofficial mayor, Ken Buchanan, told me.

      Shortly before making his video, Meyer had been sitting in La Gitana with several volunteers from Veterans on Patrol. Megan Davern, a 30-year-old meat cutter with work-worn hands and long brown hair, was tending bar. She had heard that a rancher living along the border was having issues with a vigilante group trespassing and flying drones over his property.

      “I walked into the bar at four o’clock one day to start a shift, and I saw this big group of people in fatigues with empty gun holsters and a drone on the table, and I felt it was probably them,” Davern recalled.

      Davern had heard the group’s name before and quickly did some internet research, reading highlights as the men drank. The group was founded to provide support to homeless veterans. Then, in May 2018, Meyer—who is not a veteran and has a criminal history—claimed he had discovered a child sex trafficking camp at an abandoned cement factory in Tucson. The camp, he said, was part of a pedophilia ring, and on his Facebook page he shared posts linking it to the Clintons, George Soros, and Mexican drug cartels.

      Meyer, who showed up for rancher Cliven Bundy’s 2014 armed standoff with authorities in Nevada and was present during Bundy’s sons’ occupation of an Oregon wildlife refuge in 2016, declined an interview request. But the story he was spreading mimicked right-wing conspiracies like Pizzagate and QAnon, and though Tucson police investigated and debunked his claims, Meyer gained tens of thousands of social-media followers. With donations of supplies and gift cards pouring in from supporters, he vowed to gather evidence and save the women and children he claimed were being victimized.

      Davern watched as Meyer and the other Veterans on Patrol volunteers left La Gitana and started filming the first video. Toward the end of the video, she stepped out of the bar to confront them. “We’ve been hearing about you for a long time,” she said, as Meyer turned the camera on her. “I’d appreciate if you don’t come in anymore.”

      Banning Veterans on Patrol, Davern told me, was an easy decision: “We have a strict no-militia policy at the bar because of the history of militia violence in this town.”

      Arivaca is a quirky place. To start with, it’s unincorporated, which means there’s no official mayor, no town council, no police force. The 700 or so residents are an unlikely mix of miners, ranchers, aging hippies, artists, and other folks who stumbled across the odd little community, became enchanted, and decided to make it home. A single road runs through it, linking an interstate highway to the east and a state highway to the west. The next town is 30 minutes away; Tucson is 60 miles north.

      There’s no official mayor, no town council, no police force…The next town is 30 minutes away.

      Jagged hills covered in scraggly mesquite spread in every direction until they meet towering mountains at the distant southern horizon. The vast landscape swallows up the dividing line with Mexico, but the presence of the border looms large.

      By the early 2000s, a federal policy called Prevention Through Deterrence had pushed border crossers from urban areas to more hostile terrain like the desert around Arivaca. Migrant deaths skyrocketed, and Arivaca eventually became a staging ground for volunteers caching water and food in the desert. Some settled down, and residents opened the humanitarian aid office in 2012.

      The border crossers also caught the attention of vigilante groups, many of which had formed in the late ’90s in Texas and California, and which ranged from heavily armed paramilitary-type organizations to gangs of middle-aged men sitting on lawn chairs with binoculars. “They realized that ground zero was really on the Arizona border,” said Mark Pitcavage, who researches right-wing extremism at the Anti-Defamation League.

      One group known as the Minutemen started organizing Arizona border watches in 2005. “It was a big deal in the press,” said Heidi Beirich, a hate group expert at the Southern Poverty Law Center. Beirich credits the Minutemen with helping mainstream the demonization of undocumented migrants, calling the media-savvy group “probably the thing that started off what ultimately becomes Donald Trump’s anti-­immigrant politics.”

      But by 2007, the organization was splintering. One spinoff, Minutemen American Defense (MAD), was led by a woman named Shawna Forde, a name that no one in Arivaca would soon forget.
      “The whole town has those emotional scars.”

      Just before 1 a.m. on May 30, 2009, Forde and two accomplices murdered nine-year-old Brisenia Flores and her 29-year-old father, Raul, in their home. They also injured Brisenia’s mother, Gina Gonzales, before she drove them away by grabbing her husband’s gun and returning fire.

      Raul Flores was rumored to be involved in the drug trade, and Forde, a woman with a long criminal history, had devised a plan to rob his home and use the money to finance MAD.

      The murders shook Arivaca. “The whole town has those emotional scars,” Alan Wallen, whose daughter was friends with Brisenia, told me.

      The day that Meyer filmed that first Facebook video in Arivaca, Terry Sayles, 69, a retired schoolteacher with a long-standing research interest in far-right groups, was at his home in Green Valley, some 45 minutes away. Sayles had been following Veterans on Patrol since the cement plant conspiracy theory first surfaced. When he saw Meyer’s video outside La Gitana, he called the bar with a warning. “You guys know that you’re on Facebook?” he asked.

      “Oh, great,” Davern remembered thinking. Until then, she hadn’t realized Meyer’s video was online. “I didn’t know what the ramifications would be. Were people going to come into my work and harass me? Threaten me with violence? Were they going to find out where I live?”

      Around the time of Davern’s confrontation outside the bar, La Gitana put up a sign saying that members of border vigilante groups were not welcome inside. It didn’t mention Veterans on Patrol but instead singled out another group: Arizona Border Recon (AZBR).

      Tim Foley, the leader of AZBR, had moved to Arivaca in the summer of 2017. Before starting the group in 2011, Foley, who has piercing blue eyes and leathery skin from long hours in the sun, worked construction jobs in Phoenix until 2008, when the financial crisis hit. “Everything fell apart,” he told me over the phone.

      Foley said that after years of seeing immigration violations on work sites go unpunished, he went down to the border and decided to dedicate himself to stopping undocumented crossers. The Southern Poverty Law Center considers AZBR a nativist extremist group, but Foley now says his main mission is gathering intelligence on Mexican drug cartels.

      Just before I visited Arivaca, Foley was in Washington, DC, speaking at “The Negative Impact of Illegal Alien Crime in America,” a rally hosted by families of people killed by undocumented immigrants. Other speakers included former Maricopa County Sheriff Joe Arpaio, who is also a Trump pardon recipient; presidential adviser Kellyanne Conway; and Rep. Steve King, a Republican from Iowa with a history of racist and anti-immigrant rhetoric.

      A few days after Meyer filmed his video, a BearCat armored vehicle—the kind used by SWAT teams—came rolling into Arivaca. It had a mock .50-caliber machine gun affixed to a turret on its roof and belonged to the Utah Gun Exchange, a marketplace and media company based near Salt Lake City with a mission to build what one of its co-owners, 46-year-old Bryan Melchior, described as “web platforms that allow free speech and that promote and protect the Second Amendment.”

      Before coming to Arivaca, the group had followed survivors of the Parkland high school shooting around the country during the teens’ “March for Our Lives” tour. But after President Trump threatened to shut down the government over funding for his border wall, Melchior shifted his attention. “Ultimately, we came here to tell stories from the border, and that’s what brought us to Arivaca, because there are some outspoken public figures here. Tim Foley is one of them,” Melchior told me.

      Melchior, stocky with a scruffy salt-and-pepper beard and an ever-present sidearm, and his crew decided to get dinner at La Gitana. Davern was tending bar and asked the group what they were up to. When Melchior said they were a media company in town to tell border stories and that they were in touch with Foley, “the whole thing went to hell in a handbag,” he recalled.

      Davern said she left their initial conversation feeling optimistic that the Utah Gun Exchange’s platform could be a good avenue to reach a different audience with information about what life was actually like at the border. But when she found out it had a channel called BuildTheWallTV, she changed her mind.

      Melchior was down by the border when somebody sent him a picture of a new sign in La Gitana’s window listing the Utah Gun Exchange and Veterans on Patrol as groups that were not welcome. He later went into La Gitana with an open container of alcohol from a store across the street to ask about the sign. The interaction did not go well.

      The next day, Meyer came back to town ready to film again. Playing to an audience watching in real time on Facebook Live, he walked up to La Gitana, showed the signs hanging in the window, and knocked. “Do you stand by your convictions to tell tens of thousands of supporters [that they’re not welcome]?” he asked the bartender working that day.

      “Sure. Absolutely,” she replied.

      Meyer went on to say that Veterans on Patrol was going to build a wall around Arivaca to make it part of Mexico. He then walked across the street to again film the humanitarian office: “This town’s made it apparent they don’t want us. They’d rather have the illegals crossing over. They’d rather help traffic the children and the women.”

      To many Arivaca residents, it felt like things were building toward cataclysm. “People are terrified,” Davern told me. “These people come to town and they’re threatening. Extremely threatening.”
      To many Arivaca residents, it felt like things were building toward cataclysm.

      So they called a town meeting. It was held on September 9, and about 60 people came. Terry Sayles, the retired teacher from Green Valley, was there. He suggested that the town report Veterans on Patrol’s page to Facebook. The residents set up a phone tree in case they needed to quickly rally aid—local law enforcement is at least an hour away. Kelly and a couple of others formed a neighborhood watch of sorts. “We had a strategy that we had rehearsed so that if in fact there was some attempt by somebody to do harm, we could de-escalate it in a hurry and quietly defuse it,” he said.Arivacans weren’t so much concerned about Foley, Meyer, or Melchior, but about their followers, who might see their inflammatory videos and posts about Arivaca and take matters into their own hands. “Our greatest fear was some person incensed at the thought of this community engaged in sex traffic would come out here and have a shootout at our local tavern,” Dan Kelly, a Vietnam War veteran who lives in Arivaca, told me.

      One of the most important things, though, was channeling the spiraling fear into a productive reaction. “We worked hard to separate the emotional response to it and try to look at it logically and coldly,” Kelly said. “The visceral side, the emotional side, was the impetus to get organized and take a rational response.”

      Their containment approach worked. A couple of days after the meeting, Veterans on Patrol’s main Facebook account was taken down, stripping Meyer of his audience. The Utah Gun Exchange eventually packed up and left. Many people had refused to talk to the outlet. “Arivaca is the most unwelcoming town I’ve ever been to in my life,” Melchior complained to me.

      In January, Melchior was charged in Utah with felony drug and weapons possession. Meyer also faces legal trouble, some of it stemming from videos he took of himself trespassing on private property around Tucson. He currently has several cases pending in the Pima County court system.

      “There’s been significantly less obvious militia activity in Arivaca, which I contribute to a victory on our part,” Davern told me during a recent phone call. “There’s a lot less fear going around, which is great.” Town meetings continued for a while but have stopped for now. But to Davern, as long as Tim Foley is still in town, the issue isn’t resolved. “That person needs to leave,” she said, describing him as a magnet for conflict. High Country News detailed an incident in early March when locals eager to keep the peace dissuaded a group of reportedly self-described anarchists who had come to town to confront him.

      Foley knows what Davern and others in Arivaca think about him but insists there’s a silent majority in town that supports his presence. “They can keep calling me the bad guy. I already know I’m not, or else I still wouldn’t be walking the streets,” he told me. “I’m not moving. I’m staying in Arivaca. They can keep crying for the rest of their lives. I really don’t care.”

      Even at the height of their fear, a question hovered over the town’s residents: Were they overreacting?

      It’s a question more people across the country confront as they wake up to the reality of right-wing extremism and violence. When I was in Arivaca, the answer was clear to Clara Godfrey, whose nephew Albert Gaxiola was Shawna Forde’s accomplice in the Flores murders. He and Forde had met at La Gitana. “We can never say, ‘We didn’t know,’ again,” Godfrey told me. “If anything happens, we have to say, ‘We knew, and it was okay with us.’”

      Commentaire de Reece_Jones sur twitter :

      A truism of borders: the people who live there hate the way people in the interior politicize and militarize their homes.
      ... ce qui me fait penser au fameux effet Tur_Tur !

  • Let’s build together — NZZ’s storytelling toolbox Q is now open source

    Here are some key features:
    – Simple user interface and workflows, designed for people with no specific expertise in data visualisation, to facilitate broad usage in newsrooms.
    – The same workflow from creation to publication for all tools, making it easy for users to understand new tools.
    – Searchable archive of all items created with any of the tools, so that everything can be easily re-used, edited and used as blueprints.
    – The same item can be rendered in different ways and designs for different targets (server side rendered, client side rendered, raster image, svg, you name it)
    – The data for the graphics is stored in a database and rendered on runtime (with heavy caching), making sure you always have the latest version everywhere it’s embedded, with no additional effort.
    – Q server, Q editor and tool services are decoupled and communicate via HTTP. This allows you to use whatever technologies fit your needs best.
    Tools define the editor form using JSON schema with some extensions, making it very easy to set up new tools.

    The tools currently available are:
    – Election results: Votes for people
    – Election results: Votes for parties
    – Election results: Seats won by parties

    #logiciel_libre #graphiques #outils #presse

  • willnorris/imageproxy: A caching, resizing image proxy written in Go

    imageproxy is a caching image proxy server written in go. It features:
    – basic image adjustments like resizing, cropping, and rotation
    – access control using host whitelists or request signing (HMAC-SHA256)
    – support for jpeg, png, and gif image formats (including animated gifs)
    – on-disk caching, respecting the cache headers of the original images
    – easy deployment, since it’s pure go

    #image #proxy #go #imageproxy

  • Caching best practices & max-age gotchas

    “you can hack around poor caching in your service worker, but you’re way better off fixing the root of the problem. Getting your caching right makes things easier in service worker land, but also benefits browsers that don’t support service worker”


  • The Best Self-Hosted Alternatives to Popular Services

    Comment se libérer des Google, Amazon etc.


    C’est un système pour gérer ses collections de vidéos et sons, c’est du GPL mais c’est payant, bizarre.

    Stream from your own computer.
    Your media — your terms.
    Enjoy your music and movies everywhere.
    Share with family and friends.


    A simple, fast and secure PHP/AngularJS based single user feed and mail reader, password and bookmark manager.

    CacoCloud is divided into a RESTful PHP backend storing all data into a SQLite database and an SPA frontend based on AngularJs.

    A slim backend makes it fast, even a Raspberry Pi can handle it.
    It is secure, all sensitive data like login credentials or mail accounts stored encrypted.
    The clean and user-friendly UI lets you fall in love with application.
    By transferring as less data as possible and smart client side caching of non sensitive data it will work even if your mobile network is slow.
    Host your own CacoCloud whether you want.
    Read your feeds everywhere, it saves your time clean up old feeds automagically.
    Manages your common bookmarks.
    Read your mails quick and reply to them, without configuring your mail accounts on every device. All mail account data are stored encrypted.
    Manage your login credentials, all sensitive data get encrypted twice, once in the browser and a second time before saving them into the database.
    An open RESTful API makes it easy writing your own client.
    Export your bookmarks to XBEL or HTML and your feeds to OPML.
    CacoCloud is written with love.
    CacoCloud is open source and hosted GitHub.

    Save the web, freely - wallabag : a self hostable application for saving web pages
    S’il n’y avait pas #seenthis, Wallabag ferait l’afffaire mais en privé. Enfin, pas tout à fait.

    Host Your Own Bookmarking Webapp with Unmark

    We looked several browsers and apps that let you bookmark pages, but perhaps the most intriguing of them all is Unmark, a free app from the good folks at Plain that encourages you to categorize your bookmarks by what you want to do with them—read the enclosed article, buy the listed product, watch the accompanying YouTube video or listen to the featured track.

    CalDAV/CardDAV : Kalender und Adressbücher ohne Google synchronisieren


    Synchronize contacts, events, tasks (two-way synchronization)
    Modern GUI focused on simplicity, security and privacy
    Complete in-app management: create, refresh and delete collections on the server
    Lightweight application that integrates seamlessly with address book/calendar apps
    Support for self-signed certificates
    Ready for Android 4 (Calendar/Contact Provider API), 5, 6 (dynamic permissions, doze mode/app standby), 7 (user-installed CA certificates) and newer
    Compatible with any standards-compliant CalDAV/CardDAV service (including VCard4 support)
    Available in English, Chinese, Czech, Danish, Dutch, French, German, Hungarian, Polish, Portuguese, Russian, Serbian, Spanish, Ukrainian
    Free and open-source software (GPLv3)

    OpenTasks – Android-Apps auf Google Play


  • GoogleChrome/sw-toolbox: A collection of tools for service workers.

    Service Worker Toolbox provides some simple helpers for use in creating your own service workers. Specifically, it provides common caching patterns and an expressive approach to using those strategies for runtime requests. If you’re not sure what service workers are or what they are for, start with the explainer doc.

  • As planned, the #DNS root name server, operated by the US Army, changed its IP addresses today. The new addresses are and 2001:500:1::53.

    The change is visible in the root zone file. Thanks to a process known as “priming” (and not officially documented), the DNS resolvers, even without any change of their list of root name servers, often see and use the new address.

    But because of caching, not all sites have the new address yet. If I query RIPE Atlas probes, I see many of them still use the old address :

    % python -r 500
    Measurement #3050786 for uses 500 probes
    [] : 308 occurrences
    [] : 181 occurrences
    Test done at 2015-12-01T07:53:47Z
    % python -r 500 -t AAAA
    Measurement #3050870 for uses 500 probes
    [2001:500:1::803f:235] : 154 occurrences
    [2001:500:1::53] : 336 occurrences
    Test done at 2015-12-01T07:58:26Z
  • Elachi Touts Helicopter Scout for Mars Sample-Caching Rover

    JPL has been touting its #Mars Helicopter since January but has not before linked it to any particular mission. The #drone would be solar powered and capable of flying for two to three minutes a day, according to a video JPL uploaded to youtube earlier this year.

    A scouting drone could help the Mars 2020 rover avoid the sort of mission-ending misstep that got the smaller Spirit rover — the twin of the still-operational Opportunity rover — stuck in martian sand in 2009.

  • mod_xsendfile for Apache2/Apache2.2

    mod_xsendfile is a small Apache2 module that processes X-SENDFILE headers registered by the original output handler.

    If it encounters the presence of such header it will discard all output and send the file specified by that header instead using Apache internals including all optimizations like caching-headers and sendfile or mmap if configured.

    It is useful for processing script-output of e.g. php, perl or any cgi.

    #apache #téléchargement #identification


      Forcer le téléchargement d’un fichier est relativement simple en PHP. Il suffit de l’ouvrir, le lire, l’assigner à une variable, prévoir les headers correspondants et enfin envoyer le contenu du fameux fichier. Très pratique pour gérer l’accès de fichiers soumis à autorisation.

      Oui... Mais ! D’une part, ce processus est très lent : combien de temps pour que PHP ouvre et renvoie un fichier d’une centaine de Mo ? Beaucoup trop. D’autre part la limite de mémoire allouée à PHP sera très vite atteinte, ou le temps d’execution maximal le se sera avant...

      Une alternative est proposée par mod_xsendfile, un module Apache2 (mais des versions compatibles Nginx et lighttpd existent). Le module surveille la présence d’en-têtes X-SENDFILE dans les requêtes http et réagit en envoyant directement le fichier demandé au navigateur sans traitement préalable par PHP ou n’importe quel autre langage (perl, cgi...).

  • The offline cookbook -

    With ServiceWorker (intro) we gave up trying to solve offline, and gave developers the moving parts to go solve it themselves. It gives you control over caching and how requests are handled. That means you get to create your own patterns. Let’s take a look at a few possible patterns in isolation, but in practice you’ll likely use many of them in tandem depending on URL & context.

  • substack/watchify

    Update any source file and your browserify bundle will be recompiled on the spot.

    I hadn’t realised that watchify cached browserify’s work. I thought it was just a watcher, and since I use nodemon elsewhere, I just stuck to nodemon.

    I was wondering if there were a caching plugin for browserify... and it was just there. Just to give an example, on a relatively small project:

    – browserify building everything on any change: 4.98s
    – watchify caching: 0.20s

    Yeah, that’s a win.

  • Bash Function for Caching Results

    In this blog I’d like to blog about the newest edition to my Bash (the UNIX shell) aliases file: the cache() function. What it does is cache the result of a lengthy command in a file in a common place, and then simply output this file if it already exists.

    #shell #outil #cache (à mettre dans son .profile ; mais y a pas un truc plus standard, et qui tiendrait compte des arguments, saurait utiliser un serveur memcached etc ?)

    même question ici

    • j’ai fini par bricoler ça :

      export CACHE_DIR=/tmp/cache
         local cache_fn=`echo $*| md5sum -b | awk '{print $1}'`
         local dir="${CACHE_DIR:-.}"
         if ! test -d "$dir"; then
             mkdir -p "$dir"

         local fn="$dir/$cache_fn"
         if ! test -f "$fn" ; then
             "$@" > "$fn"
         cat "$fn"

      c’est très basique mais ça le fait… on prie pour ne pas remplir le cache, ça ira pour ce soir

  • HTTP: The Protocol Every Web Developer Must Know – Part 2

    In my previous article, we covered some of HTTP’s basics, such as the URL scheme, status codes and request/response headers. With that as our foundation, we will look at the finer aspects of HTTP, like connection handling, authentication and HTTP caching. These topics are fairly extensive, but we’ll cover the most important bits.HTTP …

    Source: Web development tutorials, from beginner to advanced

    #http #tools_&_tips

  • There was a time where getting information about the content stored in the #DNS was easy: just fire dig from any machine in the Internet and ask your question. It has never been a perfect solution (because of caching and because of different network connectivity) but it worked most of the time: the DNS was supposed to give the same data to anyone. Now, several recent changes make this solution too limited. We need DNS Looking Glasses.


  • A Beginner’s Guide to Using the Application Cache

    It’s becoming increasingly important for web-based applications to be accessible offline. Yes, all browsers have caching mechanisms, but they’re unreliable and don’t always work as you might expect. HTML5 addresses some of the annoyances of being offline with the ApplicationCache interface.

    #html5 #html5_apps #html5_offline #mobile #webdev