Posts

concurrency - Concurrent blocking queue in C++11 -

for message passing in between threads, i'm looking concurrent queue following properties: bounded size pop method blocks/waits until element available. abort method cancel wait optional: priority multiple producers, 1 consumer. the concurrent_bounded_queue of tbb provide that, i'm looking alternatives avoid additional dependency of tbb. the application uses c++11 , boost. couldn't find suitable in boost. options? naive implementation using boost library(circular_buffer) , c++11 standard library. #include <mutex> #include <condition_variable> #include <boost/circular_buffer.hpp> struct operation_aborted {}; template <class t, std::size_t n> class bound_queue { public: typedef t value_type; bound_queue() : q_(n), aborted_(false) {} void push(value_type data) { std::unique_lock<std::mutex> lk(mtx_); cv_pop_.wait(lk, [=]{ return !q_.full() || aborted_; }); if (aborted_) throw operation_aborted(); ...

java - How to make Apache Tomcat accept DELETE method -

i'm working on project of restful web services, i'm using apache tomcat , jax-rs. i want accept delete requests client whenever send delete request advanced rest client chrome plugin gives response code 403 forbidden. so how can make apche tomcat accept delete request? tomcat blocking delete methods me because of cors filters. i needed new filters registered in web.xml file. here's example of permissive one: <filter> <filter-name>corsfilter</filter-name> <filter-class>org.apache.catalina.filters.corsfilter</filter-class> <init-param> <param-name>cors.allowed.headers</param-name> <param-value>accept,accept-encoding,accept-language,access-control-request-method,access-control-request-headers,authorization,connection,content-type,host,origin,referer,token-id,user-agent, x-requested-with</param-value> </init-param> <init-param> <param-name...

runtime - what is the GOMAXPROCS default value -

is guaranteed gomaxprocs set 1 when environment variable of same name not set? this code shows value: package main import ( "runtime" "fmt" ) func getgomaxprocs() int { return runtime.gomaxprocs(0) } func main() { fmt.printf("gomaxprocs %d\n", getgomaxprocs()) } and running this: $ gomaxprocs= go run max.go gomaxprocs 1 shows 1 in case, looking confirmation here. no, there's no guarantee default is; though known implementations use value '1'. if code, in absence of environment variable, requires specific default value should set in code. additionally : gomaxprocs sets maximum number of cpus can executing simultaneously , returns previous setting. if n < 1, not change current setting. number of logical cpus on local machine can queried numcpu. this call go away when scheduler improves. (emphasis mine)

Mule ESB annotation doesn't work -

i try use @schedule annotation in mule esb, not work. don't know what's wrong it. java code : public class mycache { @schedule(interval=1000) public void writestr(){ log.debug("111112222222223333333334444444444"); system.out.println("111112222222223333333334444444444"); } } for reason goes beyond imagination, have use @schedule annotated java components in obsolete model/service container work. your above class (that put in com.acme package) works following on mule 3.4.0: <model> <service name="mycachescheduler"> <component> <singleton-object class="com.acme.mycache" /> </component> </service> </model>

javascript - How can I define two model in html with AngularJs -

i new angularjs if want define 2 model in html how define it? i haved tried times please help <body ng-app="experiment"> <div ng-controller="functioncrtl" id="staff"> <div ng-modle="data1.data"> <ng-view></ng-view> </div> <div ng-app="experiment_left"> <div ng-controller="accordtioncrtl"> <div ng-model="accordtion.accordtion"> <ng-view></ng-view> </div> </div> experiment.config (function($routeprovider) { $routeprovider.when("/",{ templateurl : "function1.html", controller: 'functioncrtl'}); i want dynamic load 2 page , how can do? but answer question read http://docs.angularjs.org/api/ng.directive:input . controller: angular.module('myapp').controller('createuserctrl', function ($scope) { $scope.firstname = 'john...

javascript - video is not playing in IE8 by mediaelement.js -

i not able play video in ie8 using mediaelementjs. i using html5 video tag , want video played in ie8 , below browsers. i know ie8 doesn't support html5 video tag.hence implementing mediaelement.js make video play in ie8. can tell me how make video play in ie8 using mediaelement.js(html5 video tag)? i guess something's wrong <script> tag. ie takes html errors more seriously, if forgot close / forgot type="text/javascript" , chose example xhtml 1.0 strict doctype, mediaelement.js can not used. or can have error elsewhere of course, can't identify unless showing code.

serialization - Can serialVersionUID of java standard objects change ? -

on project, have several objects serialized. necessary use these objects on machine different jvm (possibly different versions). our objects serialversionuid fixed , won't change, concerned serialversionuid of jvm standard objects, instance arraylist/hashset used in our serialized objects. so question is, can these serialversionuid change between different versions of jvm or between different jvm ? or have use serialization mechanism support different jvms ? the serialversionuid should changed if there change class not compatible serialized versions of it. to see changes potentially break compatibility check specification i highly doubt new version of java introduce changes core classes break compatibility.