Posts

c# - Problems when P/Invoking CertCreateSelfSignCertificate -

i following this article (in there link .cs file @ bottom of page) generate self-signed x509certificate2 . code in article works want extend it. trying pass optional argument, _in_opt_ pcrypt_algorithm_identifier psignaturealgorithm , certcreateselfsigncertificate . i have created structure it: struct cryptoapiblob { public int32 cbdata; public intptr pbdata; } struct cryptalgorithmidentifier { public string pszobjid; public cryptoapiblob parameters; } the code trying use create is: cryptalgorithmidentifier algorithm = new cryptalgorithmidentifier { pszobjid = "szoid_nist_aes256_cbc", parameters = new cryptoapiblob { cbdata = 0 } }; algorithmpointer = marshal.allochglobal(marshal.sizeof(algorithm)); marshal.structuretoptr(algorithm, algorithmpointer, false); i pass algorithmpointer method. i error when try pass certcreateselfsigncertificate : an unhandled exception of type 'system.runtime.interopservices.comexception' occurred...

c# - Regex blocks of permutations -

thanks kobi resolve problem of checking permutations without repetition given string "abbc". solution (?:(?<a>a)|(?<b>b)|(?<c>c)){4}(?<-a>)(?<-b>){2}(?<-c>) the expression has have 1 "a", 2 "b" , 1 "c" in 4 consecutive characters. now need more complicated, need check expression 2 blocks of permutations: in first 6 positions has find permutations of "abccc" adding each 1 character in 3rd position can of them (a, b or c). in second block has find permutations of "abccc" i don't know if have explained myself well, but: for first 6 positions has have 1 a, 1 b, 3 c , in 3rd position value (a,b or c) no matter order except 3rd position can any for next 5 positions has have 1 a, 1 b , 3 c no matter order. i'm trying explain best way possible. i'm sorry looked copy-paste not. the regex i'm looking "abxccc-abccc" x a, b or c , - separate 2 blocks...

database - Retrieve data from Db set by combobox and display to textbox -

this code s2="select notes atotalno =" + combobox1.selecteditem +"" dim cmd oledbcommand=new oledbcommand(s2,myconnection1) cmd.commandtext=s2 textbox1.text=convert.toint32(cmd.executescalar()).tostring() and getting following error:- erorr: data type mismatch in criteria expression apply tostring() on selecteditem , why convert result set integer, if want show in textbox? try this, s2 = "select notes atotalno = "& combobox1.selecteditem.tostring() &"" dim cmd oledbcommand = new oledbcommand(s2, myconnection1) cmd.commandtext = s2 textbox1.text = "" & cmd.executescalar() here resultset concatenated empty string make whole string. if column atotalno of type varchar decorate selecteditem value single quotes. like, s2 = "select notes atotalno = '"& combobox1.selecteditem.tostring() &"'" hope helps thanks.

html - InnerHtml of div is always empty -

i have next html : <div class="output"> <div id="divinternet" runat="server" class="issue"> <!--this message shows regardless of choice--> <p> if operate service connects internet , intend collect any... </p> </div> </div> on server side try innerhtml of div id divinternet : var q1text = divinternet.innerhtml; but q1text empty. i try add attribute runat="server" inner p throws exception innerhtml must literal. expected result - want <p> , content: <p> if operate service connects internet , intend collect any... </p> what have missed? upd: didn't mention on start, think important. more detailer content of div : <p> if operate service connects internet , intend collect <a href= "<%=project.core.common.publisherconfigurationmanager.navigation%>privacy/faq.aspx#16...

c++ - Filling a std string with memcpy does not set length -

i have following code fill std::string curl response. struct curl_string { std::string tmpstr; size_t len; }; void init_string(struct curl_string *s) { s->len = 0; } size_t writefunc(void *ptr, size_t size, size_t nmemb, struct curl_string *s) { size_t new_len = s->len + size*nmemb; s->tmpstr.reserve(new_len + 1); memcpy(&s->tmpstr[0] + s->len, ptr, size*nmemb); s->tmpstr[new_len] = '\0'; s->len = new_len; return size*nmemb; } the problem is, though reserve correct length, when try read string, size still 0. i wanted avoid using loop add 1 character @ time. there way still have correct string length in std::string ? your problem std::string::reserve reserves memory characters, doesn't alter length of string. size isn't recalculated when underlying buffer modified, because near-impossible detect in cases. the solution use resize instead of reserve : s->tmpstr.resize(new_len + 1...

Iterating json response from google api using python -

i took nearby location google api , json, when try split json receive error { u'status':u'ok', u'next_page_token':u'coqc9aaaahepdlfivauuqz6y6wwaskbmq5aaoyr0bbu97upcmy4ei1ea5t-6s6iobzdz5_rib7ywocdg-lf9ian5jrutqvgl7mwbba_un3efs7xzjmlvx-iksauieio-wu3r25zk9sl3yc5d_vdgvn3vqjka7bbidwhkloj4rfngjbsgvwvqonj5glrbwvvrw9nu6dni70c2wdqqy_65b_jfjjijytawrlfoyl7ggpxk5gng7qgsfdttjii9zdfkxcj3osuzklretjradtgfaqgxr0ka_h5btbuxz3ut6r-dyqdj2qd1tr_0oavfkgb9t0qfbuyse7bdeteawddv7msmmxeyhqusemcbruhu5pb8x4eopbpw9ncaflgqttickqygyy-boaj1_3x3saet', u'html_attributions':[ u'listings <a href="http://www.indiacom.com/">indiacom yellow pages</a>'], u'results':[ { u'name':u'institute financial management , research', u'reference':u'cpqbgwaaal5gg4t18lzupntezvkweah0jlbutyc_rmxoycl3kndgq05wvkovvhiiyhnnqeoxcx1tcwesii0vsvwugaskyy2unj_brtd5zblxzd7nlxp9l-foqletrgbpa6dlnzhm6nmcu3jtjibaoymq...

jquery - Carousel not working in ractive template -

home/index.ract <div class="row owl-carousel owl-theme row"> {{#featured}} <div class="column small-12 medium-6 large-3 pan item"> <a href="{{ link }}"> <div class="griditem boxshadow"> <div class="item-content"> <h1 class="title">{{ title }}</h1> <p class="byline">by {{ subtitle }}</p> </div> </div> </a> </div> {{/featured}} </div> layout/index.ract <!doctype html> <head> <link rel="stylesheet" href="/owl.carousel/owl-carousel/owl.theme.css"> </head> <body> <main> <cromly:content /> /***ractive component**/ </main> <script type="text/javascript" src="/jquery-1.9.1.min.js"></script> <script type="t...