Posts

Force terminate a WPF application -

this question has answer here: how exit wpf app programmatically? 14 answers i need terminate running wpf application (e.g. wpf.exe). app did override onclosing event doing following protected override void onclosing(canceleventargs e) { e.cancel = true; } i tried "taskkill /f /im wpf.exe" still doesn't terminate it. how can force terminate app? rather doing protected override void onclosing(canceleventargs e) { e.cancel = true; } try void window_closing(system.componentmodel.canceleventargs e) { iclosing context = datacontext iclosing; if (context != null) { e.cancel = !context.onclosing(); } }

python - TypeError: __init__() got an unexpected keyword argument error -

i have 6 tables in sqlite database , i'm trying add new row in 1 of tables using sqlalchemy. here tables: class dsource(base): __tablename__ = 'dsource' source_id = column(integer, primary_key=true) subjects= relationship("subject") class subject(base): __tablename__ = 'subject' subject_id = column(integer, primary_key=true) source_id=column(integer, foreignkey("dsource.source_id"),nullable=false) sequences= relationship("sequence") class sequence(base): __tablename__ = 'sequence' sequence_id = column(integer, primary_key=true) subject_id=column(integer, foreignkey("subject.subject_id"),nullable=false) here code i'm using add new sequence table: engine = create_engine('sqlite:////desktop/emotion_data/test.db',echo=true) session = sessionmaker(bind=engine) session = session() new_sequence=sequence(sequence_id=0,subject_id=1) session.add(new_sequence...

unicode - Why is it that "using anything but a utf-8 decoder...might be insecure" in a URL percent decoding algorithm? -

i implementing url parser , have question w3c url spec (at http://www.w3.org/tr/2014/wd-url-1-20141209/ ) in section "2. percent-encoded bytes" has following algorithm (emphasis added): to percent decode byte sequence input, run these steps: using utf-8 decoder when input contains bytes outside range 0x00 0x7f might insecure , not recommended. let output empty byte sequence. for each byte byte in input, run these steps: if byte not '%', append byte output. otherwise, if byte '%' , next 2 bytes after byte in input not in ranges 0x30 0x39, 0x41 0x46, , 0x61 0x66, append byte output. otherwise, run these substeps: let bytepoint 2 bytes after byte in input, decoded , , interpreted hexadecimal number. append byte value bytepoint output. skip next 2 bytes in input. return output. in original spec, word "decoded" (in bold above) link utf-8 decoding algorithm. assume "utf-8 d...

c++ - Maintaining common source code for 32/64 bit build and use the correct libs -

environment: visual studio 2008 professional we porting our 32 bit windows application 64 bit. our application uses number of microsoft dlls htmlhelp.dll. added import libraries project. now have 32 , 64 bit version of htmlhelp.lib (surprisingly both have same name). why ms gave them same name. how application select right .lib current build platform. looking general guideline handle type of situation. put them in different directories : how use correct unmanaged dll file according cpu architecture? (32 / 64 bits) the setdlldirectory function affects subsequent calls loadlibrary , loadlibraryex functions. disables safe dll search mode while specified directory in search path. after calling setdlldirectory, standard dll search path is: the directory application loaded. directory specified lppathname parameter. system directory. use getsystemdirectory function path of directory. name of directory system32. 16-bit system directory. there no function ...

HTML and CSS progress bar -

i want create progress bar in below image: progress bar - image no idea how create it. would please give me creating progress bar? you can use html5 progress element html <progress max="100" value="80"></progress> css progress { height: 16px; width: 400px; -moz-appearance: none; -webkit-appearance: none; appearance: none; border-radius: 24px; background: #fff; border: solid 2px #e5e5e5; } progress::-webkit-progress-bar { height: 16px; background: #37cc7d; border-radius: 20px; } progress::-webkit-progress-value { height: 16px; background: #37cc7d; border-radius: 20px; } progress::-moz-progress-bar { height: 16px; background: #37cc7d; border-radius: 20px; } major modern browsers run progress element - caniuse demo here

documentation - Collapsible Table of Contents sidebar in Sphinx rtd theme -

i using sphinx document python code, i've opted use built in sphinx_rtd_theme (read docs theme) shown in my documentation purely local, in no way connected internet, looks fine except in demo table of contents(sidebar) expands , collapses when hit [+] or [-] symbols. mine not, expand on first click, subsequent clicks open path index.html folder in windows explorer. double clicking same. question how can prevent behaviour , make table of contents work in demo nicely expandable/collapsible toc. setting in conf.py file? i did read docs sphinx website points themeing options, seem apply classic theme. understanding correctly?

String is not being filled with random chars (C)? -

i'm trying fill string characters string 'reset\0' randomized. reason gives me 1 character back: #define str_len 6 char *inputstring() { char *string[str_len + 1] = {0}; const char *digits = "reset\0"; int i; (i = 0; < str_len; i++) { string[i] = digits[ rand() % 5 + 0 ]; } printf("string: %s\n", string); } prints 1 character 't' or 'e' console. doing wrong? if mean making random permutation of characters, not using source string alphabet, consider fisher–yates shuffle . implementation this: char s[] = "reset"; (size_t = strlen(s) - 1; > 0; i--) { size_t j = rand() % (i + 1); char t = s[i]; s[i] = s[j]; s[j] = t; } printf("%s\n", s); the idea go right left, , on every step swap element @ index i element @ random index j between 0 , i , inclusive.