post-processing

Play 2.0 RESTful request post-processing

旧时模样 提交于 2019-12-05 02:57:29
问题 In regard to this question I am curious how one can do post-request REST processing a la (crude): def postProcessor[T](content: T) = { request match { case Accepts.Json() => asJson(content) case Accepts.Xml() => asXml(content) case _ => content } } overriding onRouteRequest in Global config does not appear to provide access to body of the response, so it would seem that Action composition is the way to go to intercept the response and do post-processing task(s). Question: is this a good idea,

Rails 4 and paperclip - Stop the :original style file upload to copy it from an S3 remote directory

自闭症网瘾萝莉.ら 提交于 2019-12-02 16:40:18
问题 I use Paperclip 4.0.2 and in my app to upload pictures. So my Document model has an attached_file called attachment The attachment has few styles, say :medium, :thumb, :facebook In my model, I stop the styles processing, and I extracted it inside a background job. class Document < ActiveRecord::Base # stop paperclip styles generation before_post_process false end But the :original style file is still uploaded! I would like to know if it's possible to stop this behavior and copy the file

Post-hook a function, post-process and pass through all returns

喜夏-厌秋 提交于 2019-12-02 08:53:46
问题 I have a post-hook function that receives some data for itself, reference to another function and arguments for that arbitrary function in ... . This function does some post-processing, after referenced function returns. For simplicity let's just note time: function passthrough(tag, func, ...) metric1[tag] = os.time() func(...) metric2[tag] = os.time() end Since I need to postprocess, I can't immediately return func(...) and I don't know in advance how many returns there will be. How can I

Rails 4 and paperclip - Stop the :original style file upload to copy it from an S3 remote directory

随声附和 提交于 2019-12-02 08:07:05
I use Paperclip 4.0.2 and in my app to upload pictures. So my Document model has an attached_file called attachment The attachment has few styles, say :medium, :thumb, :facebook In my model, I stop the styles processing, and I extracted it inside a background job. class Document < ActiveRecord::Base # stop paperclip styles generation before_post_process false end But the :original style file is still uploaded! I would like to know if it's possible to stop this behavior and copy the file inside the :original/filename.jpg from a remote directory My goal being to use a file that has been uploaded

Post-hook a function, post-process and pass through all returns

不羁的心 提交于 2019-12-02 04:19:34
I have a post-hook function that receives some data for itself, reference to another function and arguments for that arbitrary function in ... . This function does some post-processing, after referenced function returns. For simplicity let's just note time: function passthrough(tag, func, ...) metric1[tag] = os.time() func(...) metric2[tag] = os.time() end Since I need to postprocess, I can't immediately return func(...) and I don't know in advance how many returns there will be. How can I passthrough those returns after I'm done with post-processing? So far I can think only of packing call in

How can I get the last match in regular extracor expression in jmeter?

南楼画角 提交于 2019-12-01 20:12:06
I would like to extract the last occurence of regular expression in Jmeter. I used Regular Extractor expression to do this, but I can't got the last occurence. I tried this : Regular expression : "var1":([^"]+),"var2" Template : $1$ Match No : -1 Default value : expression_matchNr Then in my script I used ${expression} variable I've tested expression_matchNr but it give me the number of match. What should I put in " Match No: " ? Thanks in advance If you have the following output: expression=foo expression_1=foo expression_2=bar expression_3=**what you looking for** expression_matchNr=3 You

How do I stop EffectComposer from destroying my transparent background?

天涯浪子 提交于 2019-12-01 05:58:59
问题 I want a threejs canvas with a transparent background. I'm creating a renderer like this: # coffeescript r = new THREE.WebGLRenderer alpha: true When I call r.render() , it works as expected, with the objects appearing over a transparent background. However, when I attempt to add post-processing with EffectComposer like so: cmp = new THREE.EffectComposer r cmp.addPass new THREE.RenderPass scene, camera effect = new THREE.FilmPass 0.9, 2, 2048, true effect.renderToScreen = true cmp.addPass

How to read plist information (bundle id) from a shell script

一曲冷凌霜 提交于 2019-11-28 21:12:39
I'd like to write a script that can read info like Bundle Identifier or maybe version number from the Info.plist of the app. Xcode doesn't seem to give that information in it's environment variables. Is there any other way to get them in sh/bash? The defaults command can read/write to any plist file, just give it a path minus the .plist extension: $ defaults read /Applications/Preview.app/Contents/Info CFBundleIdentifier com.apple.Preview This pulls the CFBundleIdentifier value directly from the application bundle's Info.plist file. Defaults also works with binary plists without any extra

boolean variables posted through AJAX being treated as strings in server side

前提是你 提交于 2019-11-27 20:25:13
Following is a part of an AJAX functionality to add classes and packs to session cart:- The jquery part function addClassToCart(itemId) { addItemToCart(itemId,true); } function addPackToCart(itemId) { addItemToCart(itemId,false); } function addItemToCart(itemId,isClass) { $.post(url+"/ajax/add_cart", { operation: 'add_cart','isClass':isClass, 'itemId': itemId}, function(data) { if(data.success) { alert("item added to cart"); } }, "json"); } The AJAX request processing php part - //Checking operation and other posted parameters if($_POST['isClass']) { //Code to add class to session cart } else