Posts

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()