Posts

c# - Intermittent ArgumentOutOfRangeException when using AlternativeFrame -

i'm using winrtxamltoolkit's alternativeframe in xamrin/mvvmcross windows 8.1 application support animations while doing page navigations. animations run fine first couple of transitions, intermittently application unhandledexception mid-animation -- the operation attempted access data outside valid range (exception hresult: 0x8000000b)" system.argumentoutofrangeexception: collection cannot work indices larger int32.maxvalue - 1 (0x7fffffff - 1). parameter name: index @ system.runtime.interopservices.windowsruntime.listtobindablevectoradapter.ensureindexint32(uint32 index, int32 listcapacity) @ system.runtime.interopservices.windowsruntime.listtobindablevectoradapter.getat(uint32 index) that's stack trace. same animation works several times throw error on future attempt. have ideas causing or ideas on how more information? the offending views unnecessarily ui heavy -- gridviews inside listviews when simple itemscon...

python - How do I get the client port number in a Django project? -

i using django build web server, other people connect me clients. need know clients' port number distinguish them. if browser opens 2 'tabs' of same link, i.e. 2 pages same link, have distinguish them. although know can use request.meta['remote_addr'] client's ip in django view function, realy not enough me. then studied tcp/ip basics , know in tcp/ip layer, every ip packet has ip header contains client's port number. how can access in django? additional info: i'm using python 2.6 , django 1.4 i know every tab of browser allocated random unique port access django web page port. -- see link ' the web server opens port 80, browser has different, randomly-assigned port. ' need distinguish them. intuitive thoughts use port number in ip packet. if have other suggestion, welcome. i have found the similar question here , not using apache now. , may hard me config maybe causing other more complex questions. might make simple question com...

java - Is it possible to mock classes in webapp running within embedded Tomcat? -

i able mock class used webapp in junit test running embedded tomcat. public interface foo { void bar(); } @runwith(jmockit.class) public class integrationtest { @test public void mockingfoo(@capturing final foo foo) throws servletexception, lifecycleexception { new expectations() {{ foo.bar(); result = new runtimeexception(); }}; final tomcat tomcat = new tomcat(); // myapp invoke foo instance tomcat.addwebapp("/myapp", "/path/to/myapp.war"); tomcat.start(); /* invoke webapp (via selenium, example) call foo::bar in webapp should throw runtime exception */ tomcat.stop(); } } what can done foo instances within webapp mocked via jmockit? update - 20150821 i don't yet know answer question. however, managed mock classes in webapp running within jetty .

python - Why doesn't the + operator work between multi single line strings? -

this question has answer here: is possible break long line multiple lines in python 6 answers i trying concatenate multi line string single line in python , it's giving me invalid syntax error. authheader = '<header></header>' reqbody = '<s:envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">' + authheader + '''<s:body xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <getsnapshoturi xmlns="http://www.onvif.org/ver10/media/wsdl"><profiletoken>quality_h264</profiletoken></getsnapshoturi> </s:body> </s:envelope> ''' no need use + operator concatenate strings ...

ios - Archive build with split pods across app and watchkit extension -

i have been unable cocoapods build deployable ios app requires different pods app , watchkit extension. have tried format suggested in thread: include pods in main target , not in watchkit extension but has numerous failures, including not finding headers. here's closest can get: source 'https://github.com/cocoapods/specs.git' link_with 'railtime-watchkit-extension' pod 'reachability' pod 'iginterfacedatatable' target :'railtime', :exclusive=>true pod 'asihttprequest', '~> 1.8.2' pod 'bpxluuidhandler', '~> 0.0.1' pod 'mbprogresshud', '~> 0.9' pod 'appirater', '~> 2.0.4' end this works fine simulator, fails when trying install on device. first error is: ld: library not found -lpods-railtime-watchkit-extension i'm using latest cocoapods right .37. no errors generated when performing pod install. any appreciated! ken ...

actionscript 3 - Volume control after loop as3 -

i have problem code. code works great 1 exception, if have pressed mute-button , animation loops, it's volume = 1. how can loop without going volume = 1? var mysound:sound = new sound(); var songurl:urlrequest = new urlrequest("lyd/jetpass.mp3"); var channel1:soundchannel = new soundchannel(); var volumeadjust:soundtransform = new soundtransform(); mute1.addeventlistener(mouseevent.click, mutelyd); volumeadjust.volume = 1; mysound.load(songurl); channel1.soundtransform = volumeadjust; channel1 = mysound.play(); function mutelyd(e:mouseevent):void { if(volumeadjust.volume == 1){ volumeadjust.volume = 0; } else { volumeadjust.volume = 1; } channel1.soundtransform = volumeadjust; } just found out code solves problem: var mysound:sound = new sound(); var songurl:urlrequest = new urlrequest("lyd/jetpass.mp3"); var channel1:soundchannel = new soundchannel(); mute1.addeventlistener(mouseevent.click, mutelyd); unmute1.addeventlistener(mousee...

Vagrant + Docker + Postgresql - Cannot connect from host -

i'm trying simulate our production setup locally using vagrant. in production, use docker container our postgresql database, running on centos6.5/redhat (not choice). so, locally, i've installed vagrant, created machine, got postgresql docker container , running on machine, ensured it's running connecting vm. cannot figure out how connect postgresql host (or vm). here vagrant file: vagrantfile_api_version = "2" vagrant.configure(vagrantfile_api_version) |config| config.vm.box = "chef/centos-6.5" config.vm.provision "shell" |s| s.inline = "ps aux | grep 'sshd:' | awk '{print $2}' | xargs kill" end config.vm.define "db" |db| db.vm.synced_folder "../db", "/vagrant/db" db.vm.synced_folder "../deploy", "/vagrant/deploy" db.vm.hostname = "dbserver" db.vm.network :private_network, ip: "192.168.50.4" db.vm.netw...