Posts

ruby on rails - Consuming messages from RabbitMQ: [amqp] Detected TCP connection failure -

the following rails rake task works on rails development system. after deploying rails production environment fails. rake pform_queue:receive rails_env=production stop ctrl+c waiting application forms ... [amqp] detected tcp connection failure telnet shows rabbitmq listening on default port: telnet localhost 5672 trying 127.0.0.1... connected localhost. escape character '^]'. rtyr fghtryr amqp connection closed foreign host. below code of rake task. desc "wait application forms pform" task :receive => :environment require "amqp" eventmachine.run connection = amqp.connect(:host => 'localhost') channel = amqp::channel.new(connection) queue = channel.queue("pform.applicationforms", :durable => true) puts "stop ctrl+c" puts "waiting application forms ..." queue.subscribe |payload| puts "#{time.now} received message" end ...

java ee - JPA Current Version -

Image
what current version of java persistence api? know jpa defined on jsr 338 , (march 2014) version 2.1 : but according peter pilgrim, on chapter 4 of java ee 7 developer handbook , jsr 338 defines version 3.2 of java persistence api: the java persistence api (jpa), jsr 338, version 3.2 specification mandates how persistence can applied objects in java ee product. well, didn't read book, pages needed. book ok or outdated? actually, think should re-read chapter 1 , re-examine contents of java ee 7 html5 productivity table displayed in book (pages 7 9). java ee 7 defines following: ejb specification version 3.2 defines enterprise java beans, entity beans , ejb ql, jsr 345; jpa specification version 2.1 defines java persistence api, jsr 338 pp

c++ - OpenCV CvSVM.predict() decision function value -

i training images bag of words. however, every time change condition value in if statement or sign, e.g. if(response<0) if(response>0) or if(response<-1) if(response<-0.5) different results results.push_back(response) . not figure out why happens. change condition, that's it. please, me problem. in advance. int i, j; for(i=1;i<=img.cols-width;i=i+20){ for(j=1;j<=img.rows-height;j=j+20){ vector<keypoint>keypoints; mat roi = img(rect(i, j, w, h)); detector.detect(roi,keypoints); if (keypoints.data()){ mat bowdescriptor2; bowde.compute(img,keypoints,bowdescriptor2); evaldata.push_back(bowdescriptor2); std::cout<<"svm predicting..."<<std::endl; float response = svm.predict(bowdescriptor2,1); results.push_back(response); std::cout<<response<<std::endl; if(response<0) { static cvscalar red = {0, ...

php - Is it possible to store date as meta_key in wordpress? -

i'm trying store dates , holidays in post_meta in wordpress database. made custom post type store data. in table wp_post, store _event_date = date , _event_holiday = holiday. problem can't query date has holiday want query. thinking store dates in "meta_key" fields, values stored in meta_keys needs have underscore. hesitate it. my current codes follows. this how store current data in wp_postmeta. add_post_meta($post->id, "_event_name", $_post["_event_name"]); add_post_meta($post->id, "_event_date", $_post["_event_date"]); this want instead. add_post_meta($post->id, $_post[_event_date], $_post["_event_name"]); would method have problems wordpress or something? you may use without underscore this add_post_meta($post->id, $_post['event_date'], $_post['event_name']); but, if need store using preceding underscore may use , there won't problem. btw, have this: ...

perl - Compare lines in a file -

i have large dataset looks this: identifier,feature 1, feature 2, feature 3, ... 29239999, 2,5,3,... 29239999, 2,4,3,... 29239999, 2,6,7,... 17221882, 2,6,7,... 17221882, 1,1,7,... i write script groups these lines identifier (so first 3 , last 2 grouped) in order compare them. so, example, 3 29239999 , take 1 of 2 feature 3 3 , last feature 3 7. in particular, take 1 has largest feature 2 (it third line 29239999). my specific question: of 2 options: (1) hashes , (2) making each identifier object , comparing them, best? if working "large" data set , data grouped id in example, suggest process these go instead of building huge hash. use strict; use warnings; # skip header row <data>; @group; $lastid = ''; while (<data>) { ($id, $data) = split /,\s*/, $_, 2; if ($id ne $lastid) { processdata($lastid, @group); @group = (); } push @group, $data; $lastid = $id; } processdata($lastid, @group); sub p...

visual c++ - How to fix : "Microsoft (r) developer studio has stopped working" in VC6 -

Image
i'm designing mfc interface application, throws following error: microsoft (r) developer studio has stopped working ex: if drag tabcontrol toolbar windows design area; when right click change properties , events, throws error: how 1 fix it? i'm using windows 7 ultimate x64 . i'm tried in windows xp , showed me same error.

python 2.7 - Making subarray from function on multiple arrays -

in 1 folder have 13 txt files have 3 columns of data t, x, y. use path in glob set multiple arrays data values. question if want create separate array each of main arrays (t, x, y) for path in glob("f:\thermal motion\*.txt"): t, x, y = np.loadtxt(path, unpack=true) in range(len(x)): d = ((x[i] - x[0])**2 + (y[i] - y[0])**2)**0.5 so when print d, don't array list. want sort d arrays according original 13 files. data first file going through d 1 array, , on... d looks float me, not array or list. if understand need correctly, need list of " d -values" each file you're reading in. let's want list of values associated name of file produced them simplicity; can reorder them want later. use list comprehension store values, , dict map file names lists of d values. this: d_values = {} path in glob("f:\thermal motion\*.txt"): t, x, y = np.loadtxt(path, unpack=true) # add list of computed d values d_values dictionar...