
Recherche avancée
Autres articles (70)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Menus personnalisés
14 novembre 2010, parMediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
Menus créés à l’initialisation du site
Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...) -
Déploiements possibles
31 janvier 2010, parDeux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
Version mono serveur
La version mono serveur consiste à n’utiliser qu’une (...)
Sur d’autres sites (12368)
-
React Native Expo File System : open failed : ENOENT (No such file or directory)
9 février 2023, par coloradayI'm getting this error in a bare React Native project :


Possible Unhandled Promise Rejection (id: 123):
Error: /data/user/0/com.filsufius.VisionishAItest/files/image-new-♥d.jpg: open failed: ENOENT (No such file or directory)



The same code was saving to File System with no problem yesterday, but today as you can see I am getting an ENOENT error, plus I am getting these funny heart shapes ♥d in the path. Any pointers as to what might be causing this, please ? I use npx expo run:android to builld app locally and expo start —dev-client to run on a physical Android device connected through USB.


import { Image, View, Text, StyleSheet } from "react-native";
import * as FileSystem from "expo-file-system";
import RNFFmpeg from "react-native-ffmpeg";
import * as tf from "@tensorflow/tfjs";
import * as cocossd from "@tensorflow-models/coco-ssd";
import { decodeJpeg, bundleResourceIO } from "@tensorflow/tfjs-react-native";

const Record = () => {
 const [frames, setFrames] = useState([]);
 const [currentFrame, setCurrentFrame] = useState(0);
 const [model, setModel] = useState(null);
 const [detections, setDetections] = useState([]);

 useEffect(() => {
 const fileName = "image-new-%03d.jpg";
 const outputPath = FileSystem.documentDirectory + fileName;
 RNFFmpeg.execute(
 "-y -i https://res.cloudinary.com/dannykeane/video/upload/sp_full_hd/q_80:qmax_90,ac_none/v1/dk-memoji-dark.m3u8 -vf fps=25 -f mjpeg " +
 outputPath
 )
 .then((result) => {
 console.log("Extraction succeeded:", result);
 FileSystem.readDirectoryAsync(FileSystem.documentDirectory).then(
 (files) => {
 setFrames(
 files
 .filter((file) => file.endsWith(".jpg"))
 .sort((a, b) => {
 const aNum = parseInt(a.split("-")[2].split(".")[0]);
 const bNum = parseInt(b.split("-")[2].split(".")[0]);
 return aNum - bNum;
 })
 );
 }
 );
 })
 .catch((error) => {
 console.error("Extraction failed:", error);
 });
 }, []);

 useEffect(() => {
 tf.ready().then(() => cocossd.load().then((model) => setModel(model)));
 }, []);
 useEffect(() => {
 if (frames.length && model) {
 const intervalId = setInterval(async () => {
 setCurrentFrame((currentFrame) =>
 currentFrame === frames.length - 1 ? 0 : currentFrame + 1
 );
 const path = FileSystem.documentDirectory + frames[currentFrame];
 const imageAssetPath = await FileSystem.readAsStringAsync(path, {
 encoding: FileSystem.EncodingType.Base64,
 });
 const imgBuffer = tf.util.encodeString(imageAssetPath, "base64").buffer;
 const imageData = new Uint8Array(imgBuffer);
 const imageTensor = decodeJpeg(imageData, 3);
 console.log("after decodeJpeg.");
 const detections = await model.detect(imageTensor);
 console.log(detections);
 setDetections(detections);
 }, 100);
 return () => clearInterval(intervalId);
 }
 }, [frames, model]);

 
 return (
 <view style="{styles.container}">
 
 <view style="{styles.predictions}">
 {detections.map((p, i) => (
 <text key="{i}" style="{styles.text}">
 {p.class}: {(p.score * 100).toFixed(2)}%
 </text>
 ))}
 </view>
 </view>
 );
};

const styles = StyleSheet.create({
 container: {
 flex: 1,
 alignItems: "center",
 justifyContent: "center",
 },
 image: {
 width: 300,
 height: 300,
 resizeMode: "contain",
 },
 predictions: {
 width: 300,
 height: 100,
 marginTop: 20,
 },
 text: {
 fontSize: 14,
 textAlign: "center",
 },
});

export default Record;```



-
Different ways of embedding the Piwik tracking code for faster website performance
18 avril 2017, par InnoCraft — Community, DevelopmentMany studies have shown that performance matters a lot. For each 100ms a websites takes longer to load, a business may lose about 0.1% to 1% in revenue. It also matters because Google judges page speed as a ranking factor for search results page. At InnoCraft, we help our clients optimizing their Piwik integration and recommend different ways of embedding the tracking code tailored to their needs. The best way to embed the tracking code depends on your website, what you want to achieve, and how important tracking is to you.
This technical blog post mainly focuses on improving the time to load your website. This is an important metric as for example Google usually measures the time it took to load a page. Many businesses therefore want to get to the page load event as quickly as possible.
The regular way of embedding the tracking code
By default, Piwik is embedded in the header or footer of your website. This is a sensible default. While it is loaded asynchronously and deferred, it still does delay the
onload
event. Depending on the performance of your Piwik, how fast your website loads, how your website’s resources are embedded, and other factors you may want to consider alternatives. Three of them I will introduce below.Embedding the tracker after the load event
To ensure that your website will always load even if the Piwik server is un-available, you may want to load the tracking code only after the website is loaded like this :
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
function embedTrackingCode() {
var u="https://your.piwik.domain/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "1"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
}
if (window.addEventListener) {
window.addEventListener("load", embedTrackingCode, false);
} else if (window.attachEvent) {
window.attachEvent("onload",embedTrackingCode);
} else {
embedTrackingCode();
}The downside is you won’t track all of your visitors because some will have already left your website by the time your website is fully loaded. Especially when you have a JavaScript-heavy website or when your website takes longer to load in general. To detect the load event correctly cross browser, you may want to use a library like jQuery.
Delaying the tracking
Another technique is to load the tracking with a little delay at the end of your website like this :
setTimeout(function () {
embedTrackingCode();
}, 5);This time the tracking script will still track most of your visitors but does not slow down loading the rest of your website as much as it would do by default (at least perceived). In some cases, you will notice a performance improvement when looking at the “time to load” but it depends on your website.
Not loading the JavaScript Tracker at all
With Piwik you also have the option to not embed the tracking code into your websites at all and instead generate reports from the webserver logs using Piwik Log Analytics. This works very well but some data might not be available like the device resolution which can be only captured using JavaScript. On the bright side this solution also captures users with ad blockers or tracking blockers.
Questions ?
We invite you to test different ways to see what makes sense for you and how it affects your website performance as well as the perceived performance. If you have any questions, feel free to get in touch with us.
Read on
The last post in this series is Performance optimizations you can apply today to load the Piwik JavaScript tracker faster.
-
Ruby on Rails : FFMPEG fails after upgrade Mountain Lion to Mavericks
25 octobre 2013, par CristianOrellanaBakyesterday I upgrade my OS fom Mountain Lion to Mavericks and all goes well until recently.
We are developing a Ruby on Rails v3.2.13 application for manage videos (only MP4), which worked fine until yesterday with Mountain Lion. Today (with Mavericks) I try to upload a video but get the following error in the console :
Running transcoding...
ffmpeg -y -i /Users/ME/Documents/workspace/rails/rails3-devise/public/uploads/tmp/1382653048-574-3293/thumb_con02_apv_revisado_1280x720.mp4 -ss 0 -s 180x110 -vframes 1 -f image2 -aspect 1.6363636363636365 /Users/Me/Documents/workspace/rails/rails3-devise/public/uploads/tmp/1382653048-574-3293/thumb_con02_apv_revisado_1280x720.png
Transcoding of /Users/Me/Documents/workspace/rails/rails3-devise/public/uploads/tmp/1382653048-574-3293/thumb_con02_apv_revisado_1280x720.mp4 to /Users/Me/Documents/workspace/railspublic/uploads/tmp/1382653048-574-3293/thumb_con02_apv_revisado_1280x720.png succeeded
Running transcoding...
ffmpeg -y -i /Users/Me/Documents/workspace/rails/public/uploads/tmp/1382653048-574-3293/thumb_con02_apv_revisado_1280x720.mp4 -ss 0 -s 180x110 -vframes 1 -f image2 -aspect 1.6363636363636365 /Users/Me/Documents/workspace/rails/rails3-devise/public/uploads/tmp/1382653048-574-3293/thumb_con02_apv_revisado_1280x720.png
Failed encoding...
ffmpeg -y -i /Users/Me/Documents/workspace/rails/tmp/1382653048-574-3293/thumb_con02_apv_revisado_1280x720.mp4 -ss 0 -s 180x110 -vframes 1 -f image2 -aspect 1.6363636363636365 /Users/Me/Documents/workspace/rails/uploads/tmp/1382653048-574-3293/thumb_con02_apv_revisado_1280x720.png
ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
built on Sep 28 2013 20:09:07 with Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1/include/openjpeg-1.5 '
libavutil 52. 18.100 / 52. 18.100
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.104 / 54. 63.104
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[mp3 @ 0x7fd493820c00] Format mp3 detected only with low score of 1, misdetection possible!
[mp3 @ 0x7fd49380a000] Header missing
Last message repeated 1 times
[mp3 @ 0x7fd493820c00] decoding for stream 0 failed
[mp3 @ 0x7fd493820c00] Could not find codec parameters for stream 0 (Audio: mp2, 0 channels, s16p): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mp3 @ 0x7fd493820c00] Estimating duration from bitrate, this may be inaccurate
/Users/Me/Documents/workspace/rails/tmp/1382653048-574-3293/thumb_con02_apv_revisado_1280x720.mp4: could not find codec parameters
Errors: no output file created.I reinstall the dependencies of ffmpeg, but the problem persists.
Any ideas or suggestions to solve the problem ?
Thank you very much !EDIT NOTE : I notice this when run
brew upgrade
:==> Upgrading ffmpeg
==> Installing ffmpeg dependency: libass
Error: libass dependency fontconfig was built with the following
C++ standard library: libstdc++ (from clang)
This is incompatible with the standard library being used
to build libass: libc++ (from clang)
Please reinstall fontconfig using a compatible compiler.
hint: Check https://github.com/mxcl/homebrew/wiki/C++-Standard-Libraries