Posts

How to dequeue messages from RabbitMQ in a scheduled time -

i using rabbitmq messaging service send messages. want dequeue messages sent on scheduled basis , stop dequeuing messages after 2 minutes, can dequeue them on next scheduled time. thanks, r. venkatesan looks time-to-live extensions want. setting per-queue ttl 2 minutes dead-letter messages published more 2 minutes ago.

perl - pdf file encryption function error -

for testing encryption function (by default 128 bit encryption) , created pdf file 'apps.pdf' password protected 'abcd' password. source code 1: use pdf::tk; $doc = pdf::tk->new( pdftk => '/apps/free/pdftk/1.44/bin/pdftk' ); $doc->call_pdftk( 'apps.pdf', '1.128.pdf', 'owner_pw', 'abcd' ); getting error: error: unexpected command-line data: owner_pw expecting input pdf filename, operation (e.g. "cat") or "input_pw". exiting. errors encountered. no output created. done. input errors, no output created. pdftk apps.pdf owner_pw abcd 1.128.pdf failed: 256 @ /usr/lib/perl5/site_perl/5.10.0/pdf/tk.pm line 73. note: created new pdf 'apps.pdf' document open password 'abcd' , permission password 'abcd123'. please let me know how resolve it. replace line "$doc->call_pdftk( 'apps.pdf', '1.128.pdf', 'owner_pw', 'abc...

c# - Parse float, decimal or double -

i'm in process of rewriting our flat file parser, ungeneric, attribute oriented thingy more modern fluent synstax thingy. have problem coming way deal floating point numbers given dto public class foo { public decimal decimalvalue { get; set; } } and flatfile 1234561234 you configure mapping this mapper.createmap<foo>() .map(f => f.decimalvalue) .decimal(10, 4); //length 10, precision 4 deserialize var result = mapper<foo>.read(flatfile); it result in foo object property value 123456.1234 i have working code this, hardcoded decimal values only. i'm trying find generic way this. 1 problem there no generic constaint floating numbers. the generic map method above example public propertymapresult<ttype, tproperty> map<tproperty>(expression<func<ttype, tproperty>> expression) { var result = new propertymapresult<ttype, tproperty>(this, expression); propertymappers.add(result); ...

python - kivy syntax error - conditions inside widget_add -

i have got syntax error in kivy application. because can't have conditions inside widget_add? how can make work this? def status(what): object = self.add_widget( label( text='you selected '+object+', please wait...', size_hint=(.3, .1) if object == "car": pos_hint={'center_x': .3, 'center_y': .6} elif object == "tree": color = (1,0,0,1), pos_hint={'center_x': .7, 'center_y': .6} ) ) error: running "python.exe c:\users\somebody\desktop\kivy\test.py" \n file "c:\users\slugma\somebody\kivy\test.py", line 51 if object == "vnc": ^ syntaxerror: invalid syntax you correct, cannot have conditionals inside function's arguments. move if...elif conditional outside (just af...

recursion - C++ deep copy a linked list resursively -

i c++ beginner trying write function create deep copy of linked list in c++. function calls until @ last node in source list, copies node. when run segmentation fault or exc_bad_access error. here have far: struct node { int data; node* next; }; void copy_list(const node*& source_ptr, node*& dest_ptr) { if (dest_ptr != nullptr){ clear_list(dest_ptr); } if (source_ptr == nullptr) return; //we cleared dest_ptr if (source_ptr->next == nullptr) // last node { dest_ptr = new node(); //initialize in memory dest_ptr->data = source_ptr->data; //copy last datum dest_ptr->next = nullptr; //since end return; } const node* cursor = source_ptr->next; // happens if source not yet @ end copy_list(cursor, dest_ptr->next); } i know there other questions similar this, haven't helped me. have tried using other methods recursion example while loop looks like: dest_ptr = new node(); dest_ptr->data = source_ptr->data; node* d...

java - ExecutorService terminated, but the JVM did not -

Image
i submit tasks executors.newfixedthreadpool(3) , run , complete successfully. call executorservice.shutdown(); executorservice.awaittermination(2000, timeunit.milliseconds); check via executorservice.isshutdown() executorservice.isterminated() and twice true back. main thread exits, jvm stays alive. there's no awt thread or alike, can see 3 pool threads, destroyjavavm , , com.google.inject.internal.util.$finalizer . the finalizer prime suspect, if wasn't deamon thread. suspended 2 threads image actually, i'd expect pool threads long gone, because of isterminated == true . idea waiting for? it seems debug image service not alone it's named pool-2 . might have executorservice still running pool-1 prevents jvm exit.

JavaFX check if it is full screen -

hey want check if application full screen or not use javafx how can it? i have tried getfullscreenexitproperty not work. you can check using isfullscreen available in stage primarystage.isfullscreen()

Read phone number from Android Device in Eclipse -

i wanted read phone number of sim card inserted android phone in eclipse project. have tried telephone manager class since reads device phone number, in of devices unknown , string retrieved using getline1number() of telephonemanager class unknown or null. is there other way or workaround can done in order read phone number sim api or changing phone number in device information in phone menu in android phone.

angularjs - In Angular.js, where are $stateParams set? -

i learning angular.js through mean.io, has articles package example. in articles controller see line articleid: $stateparams.articleid : $scope.findone = function() { articles.get({ articleid: $stateparams.articleid }, function(article) { $scope.article = article; }); }; see full code here . i wondering , how articleid set in $stateparams . , how $stateparams set? update: in useful link provided samitha says: "in state controllers, $stateparams object contain params registered state." so did articleid registered "with state"? finding code helpful. as samitha menthoned, code uses ui-router , right? from document, articleid set url. https://github.com/angular-ui/ui-router/wiki/url-routing#url-parameters https://github.com/linnovate/mean/blob/master/packages/articles/public/routes/articles.js#l50 for example, when access http://<your domain>/articles/1 then $stateparams.articleid => 1...

java - Android duplicate class error when including Apache POI -

i've got problem apache poi excel api (xlsx). i'm using android studio , i've added poi libs "libs" folders. error popping reason (see below). how solve it?, please explain how identified issue? xmlbeans-2.6.0, poi-ooxml-schemas-3.10.1-20140818, poi-ooxml-3.10.1-20140818, poi-3.10.1-20140818, log4j-1.2.13, junit-4.11, dom4j-1.6.1, commons-logging-1.1, commons-codec-1.5 thanks! my build.gradle looks following (excluding generic other stuff)... dependencies { compile filetree(include: ['*.jar'], dir: 'libs') } android { packagingoptions { exclude 'meta-inf/license' exclude 'meta-inf/notice' exclude 'meta-inf/license.txt' exclude 'meta-inf/notice.txt' } } my app.iml has no duplicate entries either... error error:class org.apache.xmlbeans.xml.stream.location has been added output. please remove duplicate copies. compiler did not ...

osx - Vala + Gtk doesn't work in mac os x -

i installed vala via homebrew , compiled normal hello world app in osx 10.9.3. error-message report: ld: warning: ignoring file /library/frameworks/gtk3.framework/lib/libgtk-3.dylib, file built i386 not architecture being linked (x86_64): /library/frameworks/gtk3.framework/lib/libgtk-3.dylib ld: warning: ignoring file /library/frameworks/gtk3.framework/lib/libgio-2.0.dylib, file built i386 not architecture being linked (x86_64): /library/frameworks/gtk3.framework/lib/libgio-2.0.dylib ld: warning: ignoring file /library/frameworks/gtk3.framework/lib/libatk-1.0.dylib, file built i386 not architecture being linked (x86_64): /library/frameworks/gtk3.framework/lib/libatk-1.0.dylib ld: warning: ignoring file /library/frameworks/gtk3.framework/lib/libgdk-3.dylib, file built i386 not architecture being linked (x86_64): /library/frameworks/gtk3.framework/lib/libgdk-3.dylib ld: warning: ignoring file /library/frameworks/gtk3.framework/lib/libgdk_pixbuf-2.0.dylib, file built i386 no...

python - Return data to ajax function data shown in below format -

using jsondump in python need send response ajaxpage object format in python shell show in below image how use java server object notation function send response //view output data [<userpost: userpost object>, <userpost: userpost object>] //this django view def load_scroll_posts(request): if request.method == 'post': post_id = request.post['post_id'] loaded_posts = userpost.objects.filter(id__gte = post_id) return httpresponse(json.dumps({'up':loaded_posts})) //this ajax function function load_remain_user_posts() { var post_id = $(".message_box:last").attr("id"); var csrftoken = getcookie('csrftoken'); $.post('/theweber.in/load_m',{ post_id ':post_id,' csrfmiddlewaretoken ':csrftoken}, function(data){ //console.log(data) var obj = json.parse(data); console.log(obj) }); } in console nothing displaying ...

java - Parse Swift syntax to Android -

i had trouble trying retrieve user based on search distance, , have received great support community. code boiled down following: let userlocation = pfgeopoint(latitude: userlatitude, longitude: userlongitude) query.wherekey("location", neargeopoint:userlocation, withinkilometers: 100) the issue code tailored swift/xcode, , when tried "converting to" android came down to query.wherewithinkilometers("location", parsegeopoint point, 100); i not sure if proper way of writing in java (android), , not sure parsegeopoint point. i have looked https://parse.com/docs/android/api/com/parse/parsegeopoint.html , bit stuck. if need clarification, let me know. thanks update: below how store location point of current user parse @override public void onlocationchanged(location loc) { // todo auto-generated method stub double lati = loc.getlatitude(); double longi = loc.getlongitude(); parseuser c...

ipad - How to resize view using UIModalPresentationFormSheet on iOS 8 -

looks old workaround resizing view (from sheet style) doesn't work on ios 8. any other solutions ? for example, below code works on ios 7, not ios 8. uiviewcontroller *viewcontroller = [[uiviewcontroller alloc] init]; uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:viewcontroller]; navigationcontroller.modalpresentationstyle = uimodalpresentationformsheet; navigationcontroller.modaltransitionstyle = uimodaltransitionstylecrossdissolve; [self presentviewcontroller:navigationcontroller animated:yes completion:nil]; navigationcontroller.view.superview.frame = cgrectmake(0, 0, 800, 544); navigationcontroller.view.superview.center = self.view.center; finally found solution on ios 8, need implement -(cgsize)preferredcontentsize on each view controller.

Is there any difference in HBase performance when a value is used as column name? -

in hbase, there difference in performance or other aspects when store value in column or use value column name? ex: <table>:<column-family>:<column-name>=<value> vs <table>:<column-family>:<column-name>:<value>=1 what's recommended use in scenarios? it depends on data , need extract it! if you're having database list of equipments , associated sensors : id - label - sensors 1 - k200 - 1,2 2 - k300 - 1,2,3 id - label - sensor_1 - sensor_2 - sensor_3 1 - k200 - 1 - 1 - 0 2 - k300 - 1 - 1 - 1 in opinion first design better, don't have store 0 unlike second design, depends on information need extract. if want check equipment integrating sensor type 1 second design better because you're going read column on each row whereas first design you'll have process data ... if you're asking type of sensor available each equipment first design better ... try list need know data ...

python - My Django form renders always with type='hidden' -

i did https://docs.djangoproject.com/en/1.7/topics/forms/ , after html page rendered, form hidden. , source code html following: <form action = "/blogcore/register/" method = "post"> <input type='hidden' name='csrfmiddlewaretoken' value='0afx5lrzm4qdp5cfhozbqsohgeipkwn4' /> <input type = "submit" value = "next" /> how can make form display? the form not hidden. csrf token hidden, correct.

c# - concurrency Control for inserting records based on previous transaction -

i having situation in have make entries tablea tableb such need counter-balance entries. example: tablea id name 1 2 b 3 c if no entries in tableb of table user,i add entries in tablea user1 as id tablea_id userid 1 1 1 2 2 1 3 3 1 for anther user user2, need check entries of lastuser , find out entry made first. entry made first made @ last next user. as id tablea_id userid 1 1 1 2 2 1 3 3 1 4 2 2 5 3 2 6 1 2 similiar next user enteries 7 3 3 8 1 3 9 2 3 problem here users may request @ same time , need implement locking mechanism handle it. user's request, need find entries last user. table must locked until user makes entries in tableb. in short want control concurrency. please suggest how implement it. better if not effect entries tablec tableb.

c# - get html response from local aspx page -

i have local .aspx page generate html message. when try request page using code html = new webclient().downloadstring("http://localhost/mysite/htmlemail.aspx") it returns html without passed data through session. if tried request page directly browser, displays html page passed data. so why doesn't fill html message data when programmatic request page ? it returns html without passed data through session not if that's request being made, doesn't. session used track data across multiple requests made particular client. (effectively creating server-side "session" client.) if you're requesting 1 page 1 time there's no session state tracked in first place. if you're making other requests (not shown in question) , server-side application isn't tracking session state problem may in server-side application, not in client. if you're making other requests as client that's different session. different cl...

Optimizing/Streamlining Excel VBA for Deleting empty columns -

i've been using code below jonhaus.hubpages.com remove empty columns have. 'delete empty columns dim c integer c = activesheet.cells.specialcells(xllastcell).column until c = 0 if worksheetfunction.counta(columns(c)) = 0 columns(c).delete end if c = c - 1 loop however, i've been writing vba, it's gotten kinda bloated , slow... i'm trying optimize , streamline code eliminating loops, copy/pastes, etc. do y'all have suggestions code same thing (deleting entire emtpy columns) without requiring looping "do until/if/end if/loop" statements? references: http://jonhaus.hubpages.com/hub/excel-vba-delete-blank-blank-columns http://www.ozgrid.com/vba/speedingupvbacode.htm expanding on comment above, create range inside loop, delete once. dim c integer dim rngdelete range c = activesheet.cells.specialcells(xllastcell).column until c = 0 if worksheetfunction.counta(columns(c)) = 0 ...

r - Creating Repeated Start and End Dates -

i have data set many variables. of interest are: id, episode, start, end, assessment date. example data set shown id episode start end assessmentdate 1 1 1/1/2012 12/21/2012 1/1/2012 1 1 1/1/2010 12/21/2012 12/12/2012 1 1 1/1/2010 12/21/2012 12/21/2012 1 2 1/1/2013 . 1/2/2013 1 2 1/1/2013 . 2/2/2013 1 2 1/1/2013 . 3/2/2013 2 1 1/1/2012 . 4/1/2012 2 1 1/1/2010 . 5/12/2012 2 1 1/1/2010 . 6/21/2012 2 2 1/1/2013 . 7/2/2013 2 2 1/1/2013 . 8/2/2013 2 2 1/1/2013 . 9/2/2013 i have start dates everyone, not end dates. want identify end date each episode , each patient, 10,000 patients. want end date last date of assessment per episode number, , want present each row between first , last assessment dates. ...