Posts

Showing posts from February, 2015

python - Variable inputs within an IF creating a bank. -

i'm new python , doing work if statements. have far... print("hello") myname = input("what name?") print("hello " +myname) myage = int(input("how old you?")) if myage <=18: myresponse = input("you must still @ school?") if myresponse == "yes" or "yes" or "yes" or "y" or "yes" or "y": myschool = input("what school go to?") print (myschool, "that school hear") if myresponse == "no" or "n" or "n" or "no": print("lucky you, have lots of free time!") if myage >=19: myresponse = input("you must have job?") if myresponse == "yes" or "yes" or "yes" or "y" or "yes" or "y": mywork = input("what do?") print (mywork, "thats tough job") if myresponse == &

ruby - How to replace 'nil' with a value using sub -

i trying substitute nil value using sub isn't happening. wrong. a="" a.sub!(//,"replaced") puts #=> "replaced" b=nil b.to_s.sub!(//,"replaced") #tried => (b.to_s).sub!(//,"replaced") didnt work puts b #=> nil what missing? to understand happening, let's follow code statement statement: a="" # create new string object (the empty string), assign a.sub!(//,"replaced") # sub! changes string object puts #=> "replaced" # changed string printed b=nil # assign nil b b.to_s.sub!(//,"replaced") # 2 steps # nil.to_s creates new string object "" (the empty string) # .sub! modifies new string object in place # edited string not assigned anything, garbage collected later puts b #=> nil # b still assigned nil we

asp.net - Export Excel from grid not working on Ajax Model PopUp -

hi trying export grid data excel not working in ie8.i using ajax modal popup dialog box containing 2 buttons 'ok' , 'close'.on ok click want download excel file.it works fine in mozilla in ie not working.i using below code. please suggest me how that?also when open file first show warning before opening file how handle that? response.clear(); response.buffer = true; string filename = "checkout"; response.charset = ""; response.contenttype = "application/vnd.ms-excel"; response.addheader("content-disposition", "attachment; filename=" + filename + ".adt"); response.write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">"); response.write("<head>"); response.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">"); response.write("<!--[if gte mso 9]&g

c++ - magick++:cut out a image to a new image -

i want cut out image , save in new image. new image written file right, printed pixels wrong. why? magick::image cutout(magick::image & image, point const & pos, size_t width, size_t height) { size_t const buffersize = width*height*3*sizeof(char); std::unique_ptr<char[]> buffer(new char[buffersize]); image.write(pos.x, pos.y, width, height, "rgb", magick::charpixel, buffer.get()); magick::image res(width, height, "rgb", magick::charpixel, buffer.get()); return res; } magick::image cutoutdigit(magick::image & image, fixestype const & fixes, point const & pos) { point lt = transform(fixes, pos); point rb = transform(fixes, point(pos.x+digitwidth, pos.y+digitheight)); auto newimage = cutout(image, lt, rb.x-lt.x, rb.y-lt.y); magick::geometry g(digitwidth,digitheight); g.aspect(true); newimage.resize(g); return newimage; } void print(magick::p

python - extract price from html tag -

this question has answer here: regex match open tags except xhtml self-contained tags 35 answers <dt class="col2"> <p>rs. 2691.00 </p> </dt> from above html code,i need extract price using regular expressions.i used beautifulsoup parsing. can propose regular expression above? if you're trying "2691.00" use: (?<=rs\.)\s*(\d+\.\d{2}) most regex engines can't * in lookbehind, make dynamic enough not fail if there's more 1 space left in main group. can either use main match , trim off excess spaces or use capture group 1. (?<= ) positive lookbehind. tells regex engine whatever inside of has matched before main matching group, don't include in match. rs\. matches "rs.". in regex . character matches have escape match period. \s matches spaces. * matches between 0 , inf

c# - Switching between viewmodels -

my wpf application has 3 models , each has own viewmodel & view. how switch between these views on main window based on menu selection? switching vms not route go due data binding. each page should have own vm. doesn't mean can't share vms though. have main page vm have each other vm, when switch, take change account data bindings.

c# - How to determine the sender of a delegated email in Exchange 2010 -

i trying find way name of sender of item in delegated mailbox in exchange 2010 via exchange web services. scenario many delegates have access shared inbox , send emails inbox owner (i.e. 'messagingtest@onetwothree.com') able identify sent particular email. i can hold of sent folder items fine can't find way of identifying sender. exchangeservice service = new exchangeservice(exchangeversion.exchange2010_sp2); service.credentials = new system.net.networkcredential("administratorusername", "administratorpassword", "onetwothree"); service.url = new uri("https://excas.onetwothree.local/ews/exchange.asmx"); service.autodiscoverurl("exadmin@onetwothree.com", redirectionurlvalidationcallback); mailbox principal = new mailbox("messagingtest@onetwothree.com"); folder ftest = folder.bind(service, new folderid(wellknownfoldername.sentitems, principal)); finditemsresults<item> findaltresults = service.finditems(

ios - Cropping ImageView in the Shape of Another ImageView -

how can crop imageview bubble shape have image in project. following simple code resizing or crop image, need pass height or width image want: for croped image: uiimage *croppedimg = nil; cgrect croprect = cgrectmake(as need); croppedimg = [self croppingimagebyimagename:self.imageview.image torect:croprect]; use following method return uiimage ( as want size of image ) - (uiimage *)croppingimagebyimagename:(uiimage *)imagetocrop torect:(cgrect)rect { //cgrect croprect = cgrectmake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height+15); cgimageref imageref = cgimagecreatewithimageinrect([imagetocrop cgimage], rect); uiimage *cropped = [uiimage imagewithcgimage:imageref]; cgimagerelease(imageref); return cropped; } here croped image return above method; or resizing and use following method specific hight , width image resizing uiimage : + (uiimage*)resizeimage:(uiimage*)image withwidth:(i

basic authentication with http post params android -

i doing basic authentication passing username , password , using basicnamevaluepair sending post params response service. my method: public stringbuilder callservicehttppost(string username, string password, string type) { // create new httpclient , post header httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(webservice + type); httpresponse response = null; stringbuilder total = new stringbuilder(); try { url url = new url(webservice + type); /*string base64encodedcredentials = base64.encodetostring((username + ":" + password).getbytes(), base64.url_safe | base64.no_wrap);*/ string base64encodedcredentials = "basic " + base64.encodetostring( (username + ":" + password).getbytes(), base64.no_wrap); httppost.setheader("auth

Unable bind for the same port in PHP server socket programming -

i trying bind socket same port, getting error. socket_bind(): unable bind address [0]: 1 usage of each socket address (protocol/network address/port) permitted. in c:\xampp\htdocs\my\server.php on line 79 not bind socket here 79-th line: $result = socket_bind($socket, $host, $port) or die("could not bind socket\n"); how fix this? i trying bind socket same port use different port or kill application bound port trying bind to. speaking 1 application can bound port @ time. netstat -o used find ports in use via cmd in windows.

javascript - How to delete the last column in an HTML TABLE using by jquery? -

i have html table: <table id="persons" border="1"> <thead id="theadid"> <tr> <th>name</th> <th>sex</th> <th>message</th> </tr> </thead> <tbody id="tbodyid"> <tr> <td>viktor</td> <td>male</td> <td>etc</td> </tr> <tr> <td>melissa</td> <td>female</td> <td>etc</td> </tr> <tr> <td>joe</td> <td>male</td> <td>etc</td> </tr> </tbody> </table> <input type="button" onclick="deletelastcolumn();" value="do it"/> i need javascript/jquery code, delete last column (message)

concurrency - mulithreading in java example -

here sample program in java tutorials point : // create new thread. class newthread implements runnable { thread t; newthread() { // create new, second thread t = new thread(this, "demo thread"); system.out.println("child thread: " + t); t.start(); // start thread } // entry point second thread. public void run() { try { for(int = 5; > 0; i--) { system.out.println("child thread: " + i); // let thread sleep while. thread.sleep(50); } } catch (interruptedexception e) { system.out.println("child interrupted."); } system.out.println("exiting child thread."); } } public class threaddemo { public static void main(string args[]) { new newthread(); // create new thread try { for(int = 5; > 0; i--) { system.out.println("main thread: " + i); thread.sleep

.net - Binding to a quantity and a measurement unit -

i'm new wpf development , i'm looking advice regarding recurrent databinding pattern within application. in database i'm working with, there's quite heavy usage of measurement units , associated values. for sake of demonstration, here's stripped-down table structures might give clues on have work with: sampletable (...) quantity measurementunitid (...) sampletable2 (...) speed distancemeasurementunitid timemeasurementunitid (...) sampletable3 (...) distance measurementunitid (...) sampletablen (etc...) (...) weight weightmeasurementunitid volume volumemeasurementunitid (...) measurementunits id measurementunittypeid shortname conversionfactor (...) measurementunittypes id shortname (...) i hope names speaks themselves. :) the way system works, stored values must in default system unit. user writing 10 meters in ui won't make value stored 10, converted system value before. example, distance valu

asp.net mvc 4 - MVC4 Why have separate script bundles -

this interest sake. why vanilla mvc template in vs split script bundles into scriptbundle("~/bundles/jquery") and ("~/bundles/jqueryval") i realize pages won't need jqueryval bundle, minified small may include in main bundle , cache right start, or missing more important reason?

fortran - MPI_ALLGATHER error parallelizing code -

i'm trying parallelize following code. subroutine log_likelihood(y, theta, lli, ll) doubleprecision, allocatable, intent(in) :: y(:) doubleprecision, intent(in) :: theta(2) doubleprecision, allocatable, intent(out) :: lli(:) doubleprecision, intent(out) :: ll integer :: allocate (lli(size(y))) lli = 0.0d0 ll = 0.0d0 = 1, size(y) lli(i) = -log(sqrt(theta(2))) - 0.5*log(2.0d0*pi) & - (1.0d0/(2.0d0*theta(2)))*((y(i)-theta(1))**2) end ll = sum(lli) end subroutine log_likelihood to this, i'm trying use mpi_allgather. code wrote subroutine log_likelihood(y, theta, lli, ll) doubleprecision, allocatable, intent(in) :: y(:) doubleprecision, intent(in) :: theta(2) doubleprecision, allocatable, intent(out) :: lli(:) doubleprecision, intent(out) :: ll integer :: i, size_y, diff

Different styles within the same Word Table cell using VBA -

i have xls word document automation project 2 strings string1 , string2 needs assigned word table cell. challenge have string1 in red italics font style , string2 in black normal font style. how achieve ? my present code makes text red itallic, default table font style. with wdoc.tables(pos) .rows(1).cells(1).range.text = string1 wapp.selection.font.italic = false wapp.selection.font.color = wdcolorautomatic .rows(1).cells(1).range.text = .rows(1).cells(1).range.text & string2 end the first idea think of use references range based on position of text within whole document. below code find values of 2 properties: .start , .end of cell text, check length of both string1 , string2 texts. used document.range(start,end) parameters. so, code follows (add after code: with wdoc.tables(pos).rows(1).cells(1).range wdoc.range(.start, .start + len(string1)).font .italic = true .color = vbred end wdoc.

c# - runtime winform designer for users -

we trying build budget program. going big project. want let users build own winforms , controls it. databindings next step. is there way build "runtime form designer" in c# ? reading page . says possible doesnt give enough information start , finish designer. thanks, this short answer because can't give full answer; require time... basically need create form , toolbox , vs, , have users drag-and-drop controls. drag-and-drop needs enabled , it's event handled. need in drop event handler mouse position on form , programmaticaly create default control there. now, lot of questions come mind. have addressed come, because can't answer them in less day.

linux - Why does the Solaris assembler generate different machine code than the GNU assembler here? -

i wrote little assembly file amd64. code not important question. .globl fib fib: mov %edi,%ecx xor %eax,%eax jrcxz 1f lea 1(%rax),%ebx 0: add %rbx,%rax xchg %rax,%rbx loop 0b 1: ret then proceeded assemble , disassemble on both solaris , linux. solaris $ -o y.o -xarch=amd64 -v y.s as: sun compiler common 12.1 sunos_i386 patch 141858-04 2009/12/08 $ dis y.o disassembly y.o section .text 0x0: 8b cf movl %edi,%ecx 0x2: 33 c0 xorl %eax,%eax 0x4: e3 0a jcxz +0xa <0x10> 0x6: 8d 58 01 leal 0x1(%rax),%ebx 0x9: 48 03 c3 addq %rbx,%rax 0xc: 48 93 xchgq %rbx,%rax 0xe: e2 f9 loop

vb.net - Virtual Keyboard commands -

i wondering difference between virtual these keyboard commands is: keyeventf_extendedkey , keyeventf_keyup is. everywhere have looked gives me description based off integers , not want know each of them does. you've tagged question vb.net, these have nothing @ vb.net. they're constants defined in windows header files, use win32 api functions. as far difference, can't tell looking @ values. individual values not particularly important, that's why named identifiers used. what's important used , documentation functions tells mean. the first one, keyeventf_extendedkey , used keybdinput structure (which used along e.g. sendinput function) pass information synthesized keyboard input. if flag used, means scan code should interpreted extended key. technically, means scan code preceded prefix byte value 224 (&he0 in hexadecimal notation). the second one, keyeventf_keyup , 1 of flags available use structure. means key being released (going up)

An anonymous function in a php library is incompatible with php 5.2 -

how can convert following anonymous function, found in php library using, compatible php 5.2 (which not support anonymous functions): curl_setopt($curl, curlopt_writefunction, function($handle, $data) use (&$headers, &$body, &$header_length, $max_data_length) { $body .= $data; if ($headers == '') { $headers_end = strpos($body, "\r\n\r\n"); if ($headers_end !== false) { $header_length = $headers_end; $headers = substr($body, 0, $header_length); $body = substr($body, $header_length + 4); # have headers, if content type not html, # not need download else. prevents downloading # images, videos, pdfs, etc. won't contain redirects # until php 5.4, can't import $this lexical variable closure, # need duplicate code contenttypefromheader() # , hashtmlcontenttype(

javascript - Google Script maker to format a spreadsheet -

this first time posting bear me if leave crucial details out. anyway, summarize problem: have been trying script work on google script maker format spreadsheet hooked form, go straight email. so user form --> spreadsheet --> my email the questions pretty standard: what's problem? where located however 1 question i'd use "what priority of problem?" high or low. have under multiple choice format simple choice. psuedocode want: if (priority = low) put #priority low onto email simple enough, can't seem work, here's code: function sendformbyemail(e) { // remember replace xyz own email address var email = "email"; var subject = "help desk form submitted"; var s = spreadsheetapp.getactivesheet(); var headers = s.getrange(1,1,1,s.getlastcolumn()).getvalues()[0]; var message = ""; var priority = ""; if(message.indexof("what priority of problem?

entity framework - EF5 - Navigation properties not loading in a reversed engineered code first model -

i'm banging head on keyboard one, i'm trying rather simple. i reversed engineered existing database ef power tools, did because database in question quite old , missing lot of foreign keys, or primary key matter. goal able add navigation properties generated model, have cleaner code when querying model. now have 2 classes user , costcentre , mapped respective tables users , costcentres proper primary keys, pk of users username named userid in costcentres , theoretical relation between 2 1 m (one user can have multiple costcentre). added navigation property user public virtual icollection<costcentre> costcentres { get; set; } i'm initializing list in default constructor simple public user() { costcentres = new list<costcentre>(); } to costcentre added user property public virtual user user { get; set; } in generated costcentremap class, mapped navigation property this.hasrequired(cc => cc.user)

jquery - How to access var from child function in javascript? -

i want id of elements , want use child function function example(id) { var me = this; this.pro = id this.code = function () { settimeout(function () { alert(id) }, 20) } this.validate = function () { $('.' + id).keyup(function (e) { var id = this.id; if (e.keycode == 13) me.code() }) } } body <input type="text" class="test" id="1" /> <input type="text" class="test1" id="2" /> <script type="text/javascript"> var test = new example('test') var test1 = new example('test1') test.validate() test1.validate() </script> either use pro property function example(id) { var me = this; this.pro = null; this.code = function () { settimeout(function () { alert(me.pro); }, 20); }; this.validate = function () {

java - Why this code work only once [Android-canvas] -

i want draw circle in canvas. use function id: public static void add() { float = 20 + (new random()).nextint(width-40); float b = 20 + (new random()).nextint(height-40); paint.setcolor(color.rgb(13, 13, 13)); c.drawcircle(a, b, r, paint); paint.setcolor(color.rgb(119, 119, 119)); c.drawcircle(a, b, r-3, paint); } it works once, when called "ondraw". p.s. paint, width, height, c - public varibles. upd.: protected void ondraw(canvas canv) { super.ondraw(canv); c = canv; paint = new paint(); paint.setstyle(paint.style.fill); paint.setantialias(true); paint.setcolor(color.white); c.drawpaint(paint); add(); } ondraw() called whenever view needs re-draw itself. can due many reasons, layout changing, scrolling etc. you can call invalidate() on view cause re-draw. if going draw @ high r

Is there any way to specify a CSS selector for a lonely child? -

i want have different style list item when list has 1 element, there way css? the selector want :only-child so can use in css: li:only-child { } or p:only-child {} apply-it on element

cordova - PhoneGap 2.9.0 -- Can't get app to access camera -

i've exhausted every resource can find on this, , nothing has helped. far can tell, there's wrong line: <script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script> i copied example documentation on camera use ( http://docs.phonegap.com/en/2.9.0/cordova_camera_camera.md.html ) , phonegap version 2.9.0. issue seem having don't have cordova-2.9.0.js file. why that? it? trying run code throws "uncaught typeerror: cannot call method 'getpicture' of undefined @ file:///android_asset/www/test.html:12" i've included lot of permissions in config.xml file out of desperation work: <plugin name="camera" value="org.apache.cordova.cameralauncher" /> <feature name="http://api.phonegap.com/1.0/device" /> <feature name="http://api.phonegap.com/1.0/camera"/> <feature name="http://api.phonegap.com/1.0/file"/> <fe

objective c - Implementation of componentRGBA method called by KVC when setting a UIColor property -

i have class uicolor property named color , want set property string: [label setvalue:@"1.0 0.5 0.0 1.0" forkey:@"color"]; i know need convert string uicolor. noticed kvc calls method named "componentrgba" want perform conversion. added category method on nsstring: -(uicolor*) componentrgba { cicolor* cicolor = [cicolor colorwithstring:self]; uicolor* uicolor = [uicolor colorwithcicolor:cicolor]; return uicolor; } the method called. however, self not seem valid nsstring object because call colorwithstring: crashes exc_bad_access , every attempt of sending self nsobject message (class, description, etc). my suspicion method signature of componentrgba not correct , therefore self isn't string object. though not find reference googling method. how implement componentrgba can perform color conversion automatically when uicolor property set nsstring* value via kvc? update: interestingly, when in componentrgba method: cfs

PHP MySQL inner join issues -

basically have 2 tables: nodes , nature. nodes have auto-incrementing id, , nature has 'node' column focusing on here. node column contains delimited string of ids nodes table (the nodes nature entry in.) an example of node column in nature table might this: .1.10.597.598.599.600. there periods in front , behind each id can search images in node (where node '%.".$_get['id'].".%') example. that being said trying select entries node table have entries in nature table. here's i've got far returns empty set. select * nodes inner join nature b on a.id '%.b.node.%' any appreciated. use concat function on a.id concat('%.',b.node,'.%')

ruby on rails - RoR Application built using spree works fine in local not in heroku -

i have ror application thats year old uses older versions of multiple spree dependencies have ensured works , expected without dependency issues in local ubuntu mysql database. when push heroku not getting errors while pushing. when load application on browser getting application error. when run heroku logs get. not sure causing app crash on heroku. can give me insight possibly happening. 2013-07-31t15:33:04.533860+00:00 app[web.1]: 2013-07-31t15:33:24.224146+00:00 app[web.1]: => booting webrick 2013-07-31t15:33:24.224146+00:00 app[web.1]: => rails 3.1.4 application starting in production on http://0.0.0.0:30818 2013-07-31t15:33:24.224146+00:00 app[web.1]: => call -d detach 2013-07-31t15:33:24.224146+00:00 app[web.1]: => ctrl-c shutdown server 2013-07-31t15:33:24.224146+00:00 app[web.1]: exiting 2013-07-31t15:33:24.225435+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/bundler/gems/spree_email_to_friend-f38187568f33/app/mailers/spree/to_friend_mailer.rb:1:in `&l

python - How to subclass scipy.stats.norm? -

i'd subclass scipy.stats.norm can have instances of frozen distributions (i.e. specific means/variances) additional functionality. however, can't past first step of constructing instance. edit : here transcript of interactive session demonstrates problem (there's nothing sleeves) in [1]: import scipy.stats in [2]: class a(scipy.stats.norm): ...: def __init__(self): ...: super( a, self).__init__() ...: ...: --------------------------------------------------------------------------- typeerror traceback (most recent call last) /home/dave/src/python2.7/density_estimation/<ipython console> in <module>() /usr/lib64/python2.7/site-packages/scipy/stats/distributions.pyc in __init__(self, momtype, a, b, xa, xb, xtol, badvalue, name, longname, shapes, extradoc) 958 959 if longname none: --> 960 if name[0] in ['aeiouaeiou']: 961

Alternative implementation syntaxes for class members on c++ -

when declaring , implementing class or struct in c++ do: h file namespace space{ class something{ void method(); } } cpp file void space::something::method(){ //do stuff } or namespace space{ void something::method(){ //do stuff } } note how possible wrap implementations inside namespace block don't need write space:: before each member. is there way wrap class members in similar way? please note want keep source , header file separated . that's practice. you can not if keep .cpp file. otherwise, can, dropping .cpp file. in .h file, have: namespace space{ class something{ void method() { //method logic } }; } except, know, there limitations include header. i'm not sure you, op, seem know you're doing, i'll include future users of question: what should go .h file?

jquery - call function after slidetoggle complete -

$(document).ready(function () { $("#newrecord tr:odd").addclass("odd"); $("#newrecord tr:not(.odd)").find("li").hide(); $("#newrecord tr:not(.odd)").hide(); $("#newrecord tr:first-child").show(); $("#newrecord tr.odd").click(function () { $("#newrecord tr:not(.odd)").show(); $(this).next("tr").find("li").slidetoggle("slow","swing"); }); }); the following first hides rows , when click on odd row displays row , slides down li content of each row. need when click again li tag slides want it, should hide row. should call hide function on row after slide up. $(document).ready(function () { $("#newrecord tr:odd").addclass("odd"); $("#newrecord tr:not(.odd)").find("li").hide(); $("#newrecord tr:not(.odd)").hide(); $("#newrecord tr:first-child").

ruby - Call module method from other class -

so have 1 ruby file reside inside model > service module services module somejobs def mainjob ... end end end and how call method ruby class sit inside lib/testfunction.rb i tried following , did not work. appreciate. trying debug code. class testfunction include somejobs testfunction::mainjob end try out module services module somejobs def self.mainjob end end end make mainjob module method, module instance method never included in including class, private module class testfunction include services::somejobs end now call from outside testfunction class like testfunction.new.mainjob and inside testfunction class with self.class.new.mainjob if want access mainjob class method then, use extend instead of include. as using ide debugger try requiring file relative rails application, in testfunction class

javascript - Using the Tor api to make an anonymous proxy server -

i making app makes lots of api calls site. trouble i've run site has limit on number of api calls can made per minute. around hoping use tor in conjunction node-http-proxy create proxy table uses anonymous ip addresses taken tor api . so question is, how possible this, , tools recommend getting done. app written in javascript, solutions involving things node-tor preferable. i've found reasonable solution using tor , curl command line tools via node.js. download tor command-line tool , set in $path. now, can send requests through local tor proxy establish "circuit" through tor network. let's see our ip address using http://ifconfig.me . can copy paste of these things node repl: var cp = require('child_process'), exec = cp.exec, spawn = cp.spawn, tor = spawn('tor'), puts = function(err,stdo,stde){ console.log(stdo) }, child; after this, may want build in delay while tor proxy spawned & sets up.

python - Why do threads continue to run after application has exited? -

the following python application spans few threads, spawns new process of , exits: from pprint import pprint import os import random import signal import sys import threading import time class name(object): def __init__(self, name): self.name = name class callthreads(threading.thread): def __init__(self, target, *args): self.target = target self.args = args threading.thread.__init__(self) def run (self): self.target(*self.args) def main(args): print("hello, world!") letter = random.choice(['a', 'b', 'c', 'd', 'e', 'f']) count = 0 while count<3: count += 1 name = name(letter+str(count)) t = callthreads(provider_query, name) t.daemon = true t.start() time.sleep(3) print("------------") print("time die!") os.system('python restart.py') sys.exit(0)

xpath - EclipseLink MOXy: Logical operators in XmlPath annotation -

do logical operators work in xmlpath annotations of eclipselink moxy? tried , not make work (no exception thrown , nothing bound "elements"). for example, have in bindings file this: <java-type name="content"> <java-attributes> <xml-element java-attribute="elements" xml-path="/a/b/ | /c/d" type="elementtype" container-type="java.util.list" /> </java-attributes> </java-type> is there way achieve same result modification of bindings without using logical or in xml-path? i can think of workaround 1 use getters , settings in domain model, bind both /a/b , /c/d elements , have setters append elements list rather replacing list upon each call setelements(). i'd rather handle in bindings file, though. does there exist place in documentation specifies parts of xpath supported in moxy? here example of how support use case. mappi

asp.net - Security for an AngularJs + ServiceStack App -

i have application have 4 modules in front end, i'm trying use as possible angularjs in front end i'm using empty website asp.net project host files , rest servicestack, project have kind of following structure: ~/ (web.config, global.asax , out of box structure asp.net website) - app <- angularjs - users <- js controllers , views (static html files) - companies - backend - public index.html indexctrl.js app.js - content - js i use angularjs service calls , backend i'm using rest servicestack. the question how can restrict access authenticated users static html files? let's ones inside inside companies, backend , users example hi after doing research solution worked me: install razor markdown nuget change file structure match default behavior rm [razor markdown] /views modify web config following approach described in this service stack example change static htmls files .cshtml files, default creates same

java - Toast call inside of a button tap giving an error that i can't figure out -

i trying make toast display information stored in text variable when submitbtn clicked. error getting not in running of code eclipse telling me : the method maketext(context, charsequence, int) in type toast not applicable arguments (class, string, int) the file toast in userinput.java file. here current code block: button submitbtn = (button) findviewbyid(r.id.buttonsubmit); submitbtn.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { int position = spinner.getselecteditemposition(); string text = null; text = dayarray[position].tostring(); //log.i("spinner test: ", text); toast toast = toast.maketext(userinput.class, text, toast.length_long).show(); } }); i have tried set context userinput.this , getapplicationcontext() , gives me error: type mismatch: cannot convert void toast i let know android novice , of java novice have searched h

python - Properly creating OAuth2Service with Rauth and Django -

i using rauth authentication against stripe connect. in doing needing instantiate oauth2service use in multiple views. right views file looks lot (and works), feels wrong: from rauth.service import oauth2service service = oauth2service( name = 'stripe', client_id = 'my_client_id', client_secret = 'my_secret', authorize_url = 'auth_url', access_token_url = 'stripe_access_token_url', base_url = 'stripe_api_url', ) def stripe_auth(request): params = {'response_type': 'code'} url = service.get_authorize_url(**params) return httpresponseredirect(url) def stripe_callback(request): code = request.get['code'] data = { 'grant_type': 'authorization_code', 'code': code } resp = service.get_raw_access_token(method='post', data=data) ... rest of view code ... my problem feel placing "service" variable o

asp.net - IIF statement to determine visibility of ImageButton in GridView not evaluating properly -

i have gridview displays user info along 2 template fields imagebuttons. 1 open detailsview edit user information. other edit user's password. in code behind, have 3 iif statements check criteria. based on combinations of criteria, want imagebuttons either show/not show appropriately. here code behind: protected sub gvusers_rowdatabound(byval sender object, byval e system.web.ui.webcontrols.gridviewroweventargs) handles gvusers.rowdatabound dim isprovisioned boolean dim acceptedtos boolean dim issuspended boolean 'hide password change option users have not yet been provisioned or have not accepted tos agreement or have been suspended' if e.row.rowtype = datacontrolrowtype.datarow , _ directcast(sender, gridview).editindex <> e.row.dataitemindex isprovisioned = iif(string.isnullorempty(e.row.dataitem(guser.columns.dateadded).tostring), false, true) acceptedtos = iif(string.isnullorempty(e.row.dataitem(guser.co

ios - provisioning profile -request timed out Xcode -

Image
i added new app xcode , trying update provisioning profiles under window-organizer-library,after giving apple developer credits, showing error -the request timed out.it worked fine before 2 apps , have 1 account in teams, checked code signing in new app , fine.does apple developer site still down?? please me on finding issue.any appreciated. yes, status site says automatic xcode configuration not working yet. https://developer.apple.com/support/system-status/ you can still use manual way of generating , downloading certificates dev portal.

c# - How do I bind a string array(list of files in my case) to a variable in the item template of a repeater? -

how bind string array(list of files in case) variable in item template? here have far not sure code behind itemdatabound. i trying put each url in <% photo_url %> variable. any appreciated. thanks in advanced. page code <asp:repeater id="unorderedlist" runat="server" onitemdatabound="unorderedlist_itemdatabound"> <headertemplate> <ul class="thumbs noscript"> </headertemplate> <itemtemplate> <li> <a class="thumb" href='<%# photo_url %>'> <img src='<%# photo_url %>'> </a> <div class="caption"> <div class="download"> <a href='<%# photo_url %>'>download original</a> </div> </div> </li> </itemtemplate> <

Learning Ruby on Rails in terms of Flask -

i'm experienced flask , have built couple things in it. i'm learning rails, , since know flask best, keep on trying tie learn it. mind explaining ror in terms of flask? flask isn't mvc, have used sqlalchemy, i've been thinking of model that. learning rails in terms of flask trying fit large truck inside small sports car. rails large framework full of powerful features , flask micro framework limited features designed build simple sites fast. best off learning rails on own , comparing few features flask has rails. if finding rails learn @ once, perhaps try sinatra first. it's ruby micro-framework flask cloned. 2 have lot in common. after mastering sinatra, rails relatively easy step.

javascript - delegated click event not firing when element gets disabled -

when bind click handler element disables element, try delegate event it, second event doesn't fire. is there simple solution this? demo $('button').click(function() { log('first click fired'); $(this).prop('disabled', true); }); $('span').on('click', 'button', function() { log('second click fired'); }); html: <span><button>click</button></span> edit: to clarify, setting click event on object fire as seen in edit , want able delegation disabled elements not fire mouse events, ... wait ... disabled. since don't fire mouse events, no event bubbles span, , event handler never triggers. the solution not disable element, , it's pretty solution far know, if explain why need behaviour maybe can workaround? edit: it seem work if create own delegation: $('span').on('click', function(e) { if (e.target.tagname.tolowercase() === 'button

Java Web Service Client Timeout values not changing -

is there reason when set time out service call client doesnt override defualt values? i have tried these no luck. dictionarytransferservice service = new dictionarytransferservice(); dictionarytransfer port = service.getdictionarytransferport(); ((bindingprovider) port).getrequestcontext().put(stubext.property_client_timeout, 10 * 60 * 1000); ((bindingprovider) port).getrequestcontext().put("com.sun.xml.internal.ws.connect.timeout", 5 * 60 * 1000); ((bindingprovider) port).getrequestcontext().put("com.sun.xml.internal.ws.request.timeout", 10 * 60 * 1000); ((bindingprovider) port).getrequestcontext().put(bindingprovider.endpoint_address_property, endpointurl.tostring()); the constants these jax-ws ri settings changed @ 1 point, may need use these instead: "com.sun.xml.ws.connect.timeout" "com.sun.xml.ws.request.timeout" or better yet, use constants jaxwsproperties class itself. you might try these since you're runnin

graph algorithm - Can weighted PageRank values converge to same values regardless of weights? -

i did project computed pagerank (and hits , various centrality scores) network 500k nodes , 1.2 million edges. calculated pagerank scores using networkx python package, tested them linear regression against reasonably reliable external data source. unweighted scores correlated closely external data, confused find weighted pagerank scores came out same values (with high precision floats) regardless of how weighted edges in graph, , didn't correlate @ external data. i'm trying figure out whether had error in code in adding edges didn't notice or whether pagerank might converge same values regardless of edge weights after sufficient number of iterations, gather regardless of starting pagerank values. is possible edges indeed weighted differently each run pagerank produced same values? or screwed network edges? thank you. edit: other pagerank questions seem explain out-going weights have normalized, didn't do. weights we're integers, 4, 10, 15, etc. problem?

WPF combobox in a dialog window - can not select items falling beyond height of window -

i have dialog window in wpf combobox . when combobox items more, show beyond height of parent dialog window (in open state). i not able select these items mouse (which falling outside parent dialog window). one possible solution increase height of parent dialog window, doesn't good. can help? try setting maxdropdownheight of combobox <combobox maxdropdownheight="100" />