Posts

Showing posts from April, 2015

associative array - what does the following syntax in php mean? -

i working on fixing bug in legacy php code. not php person. please bear me if stupid question. i see line in code: $credentials = array("username"=>$fields->username, "password"=>$fields->password); $this->profile->create($fields); i don't understand syntax array means? i know associate array: array("username"=>"mike","password"=>"123" ) translate { "username": "mike", "password" : "123" } but above 1 translate to? in code used example, $fields object. then, username variable or property of object. so, end array: { "username": $fields->username, "password": $fields->password } if confused arrow syntax objects, read documentation on using objects php.

java - How create several columns of CardViews -

i try create fragment several columns of cardviews : <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="3dp" android:orientation="horizontal" > <android.support.v7.widget.cardview android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" app:cardelevation="2dp" app:cardcornerradius="3dp"> <textview android:text = "column 1" android:layout_width = "wrap_content" android:layout_height = "wrap_content" /> </android.support.v7.widget.cardview> <android.support.v7.widget.cardview android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content&

android - Why is Cursor.requery() deprecated while SQLiteCursor.requery() is not? -

i understand why cursor.requery() deprecated - have question read. however today found sqlitecursor , seems subclass, , sqlitecursor.requery() looks still ok in official documentation. does know why? kind of docs bug, or sqlitecursor.requery() different counterpart?

angularjs - Cordova File Transfer to Node Server -

i'm using ng-cordova filetransfer plugin try upload photo user's camera roll node/express server. i'm getting local uri of photo , trying pass plugin such: $cordovafiletransfer.upload('http://135.23.98.169:8069/upload_avatar', fileuri) .then(function (result) { console.log('success'); }, function (error) { console.log('what'); }); the server endpoint reached, req.files undefined. what doing wrong? in express 4.x, have include multer middleware enable multipart data. after you've done that, file available in req.files

r - Subtract every element of vector A from every element of vector B -

does know way accomplish following in vectorized format? rather subtracting member-wise test1 test , subtract every element of test1 every element of test . so, rather than: test = c(1:10) test1 = seq(0.1, 1, 0.1) test - test1 [1] 0.9 1.8 2.7 3.6 4.5 5.4 6.3 7.2 8.1 9.0 i want: test2=vector("list") for(i in 1:length(test)){ test2[[i]] = test[i] - test1 } test2 [[1]] [1] 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 [[2]] [1] 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1.0 [[3]] [1] 2.9 2.8 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 [[4]] [1] 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0 [[5]] [1] 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2 4.1 4.0 [[6]] [1] 5.9 5.8 5.7 5.6 5.5 5.4 5.3 5.2 5.1 5.0 [[7]] [1] 6.9 6.8 6.7 6.6 6.5 6.4 6.3 6.2 6.1 6.0 [[8]] [1] 7.9 7.8 7.7 7.6 7.5 7.4 7.3 7.2 7.1 7.0 [[9]] [1] 8.9 8.8 8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 [[10]] [1] 9.9 9.8 9.7 9.6 9.5 9.4 9.3 9.2 9.1 9.0 even vectors of uneven length? outer(test, test1, `-`) # [,1] [,2] [,3]

javascript - Animate function not working on DIV -

i'm trying let div move off screen on screen... div should come down. i've tried stuff, unfortunately nothing happens :(. right div has position: absolute; ? please help. html + jquery <div id="nav"> <a href="#"><span>1</a> <a href="#"><span>2</a> <a href="#"><span>3</a> <a href="#"><span>4</a> <a href="#"><span>5</a> </div> <div id="hidden"> <h1>text</h1> <p>text</p> </div> <script> var main = function() { $('#nav a:nth-child(1)').click(function() { $('#hidden').animate({ top: +=500px }, 1000); }); }; $(document).ready(main); </script> css body { background-image: url("http://static.tumblr.com/97f4b171db68d6ef1836c

python - Embedding a bokeh app in flask -

i trying desperately embed working bokeh applet flask, , can't find proper way this. looked through examples, can't find 1 includes ability update data (best example: sliders_applet). if i'm not mistaken, need bokeh-server able change data (with sliders etc.). starting applet way works, e.g.: bokeh-server --script sliders_app.py but can't find proper, or @ least working way embed sliders_app flask. , since should possible use multiple applets, doesn't seem clean me specify 1 single applet @ startup of bokeh server too.. i gladly appreciate - bokeh looks great tool me. the other answer not describe how embed bokeh server app (it uses components embed standalone bokeh document). first, can see lots of live examples hosted at: https://demo.bokehplots.com/ for embedding apps there 2 usual options: iframes (works fine), or autoload_server the latter used this: script = autoload_server(model=none, app_path="

python - Using process instead of thread with zeromq -

i'm reading code http://zguide.zeromq.org/py:mtserver when i've tried replace threading.thread multiprocessing.process got error assertion failed: ok (mailbox.cpp:84) code is import time import threading import zmq def worker_routine(worker_url, context=none): """worker routine""" context = context or zmq.context.instance() # socket talk dispatcher socket = context.socket(zmq.rep) socket.connect(worker_url) while true: string = socket.recv() print("received request: [ %s ]" % (string)) # 'work' time.sleep(1) #send reply client socket.send(b"world") def main(): """server routine""" url_worker = "inproc://workers" url_client = "tcp://*:5555" # prepare our context , sockets context = zmq.context.instance() # socket talk clients clients = co

regex - Google Analytics filters, only two countries -

Image
i want create filter include 2 countries. example united kingdom , russia. i have 2 filters, first excluding countries. filter set regex pattern '.' , next filter including countries, pattern: united kingdom|russia . but don't have results displayed. whats wrong regex? your regex fine. need include variable against regex filter going executed. in case, type country ( pays in french) preview (sorry french): ps: have tested on g account. edit: as per comment below, . match 1 character (there no countries 1 character name). if want match countries regex pattern .+ yet leaves question: if want match countries why use filter in first place?

android - Is it ok to use DialogFragment in fullscreen to simulate a new activity? -

i trying know if ok manage "navigation" of app dialogfragments time, putting them in fullscreen if activities. thank much you can this. can opposite (using activities dialogs, weird). the real reason reuse fragment both dialog , full screen view, perhaps different screen sizes, etc. you might have ui design in want piece of ui appear dialog in situations, full screen or embedded fragment in others (perhaps depending on whether device large screen or small screen). dialogfragment class offers flexibility because can still behave embeddable fragment. http://developer.android.com/guide/topics/ui/dialogs.html#fullscreendialog doing in general no real reason odd practice

google chrome devtools - locating the corresponding jQuery code upon clicking on HTML -

when jquery code separated html completely, code becomes lot leaner , easier maintain. but, makes debugging , exploring underlying code more difficult crack down. my question if there easy way ( using chrome devtools ) locate corresponding jquery code given html. let's break down example. we've got html this; <i class="icon-chevron-right navigation-arrow"></i> this html displays right arrow. though html not suggest arrow clickable, user point , click on arrow , things happen. let's click brings next testimonial div. , each click on arrow keeps bringing next testimonial , that's there it. now... when want debug this, naturally, turn on dev tools panel , spot arrow what... there no function name or that'll script. we know there click event tied icon code? perhaps, there easy way figure out. hence question.. . i add console.debug('arrow click handler called', this, arguments); on handler , have appearance on w

jquery ias - infinite ajax scroll plugin and firefox -

i'm using infiniteajaxscroll plugin load new content div , works fine safari , chrome. in firefox can see jquery-ias code hiding pagination div when reach end of page nothing happens , can't see error in firebug. i noticed in overflow example of ias website same behaviour. loads more items safari , chrome not firefox. example of code. html: <div style="margin:0; padding:0; width:100%; height:100%;" id="results"> <div id="articles"> <div id="article-79" class="article">....</div> <div id="article-80" class="article">....</div> <div id="article-81" class="article">....</div> <div id="article-82" class="article">....</div> ... </div> <div id="pagina" style="display: none;"><a class="next" href="/lista.php?p=2&amp;cod=0&amp;idl=1&amp;idt

javascript - Backbone: How to prevent overriding jQuery Ajax methods by Backbone Ajax functions? -

very interesting situation! the code below represents order entry. before saving user should calc order total clicking on #calctotal button , clicks on #saveorder button. the problem if user launches saveorder function 1 time ajax method in calctotal function call model.save in saveorder function! i think this.model.save function override backbone model functions ajax request execute actions in model.save . how should prevent behaviour? events: { 'click #calctotal': 'calctotal', 'click #saveorder': 'saveorder' }, calctotal: function() { this.model.set( $('form').serializejson() ); var = this; $.ajax({ url: 'api/order/calctotal', type: 'get', data: this.model.tojson(), datatype: 'json', success: function( result ) { that.model.set({ 'total': result.total }); that.rendertotal();

lua - How to specify startup file for Torch REPL -

i'd define command line convenience functions run every time start torch repl. example, function cl() os.execute('clear') end and things of nature. how can have functions added namespace every time start repl? i web searched "luajit|torch|trepl startup|rc file" couldn't find leads on this. you can alias th repl take default -l parameter: alias thnew='th -lmyadditions ' where myadditions.lua file executed placed in lua path.

Can Spring Controller change the url of browser? -

i using spring controllers return name of views, this: @requestmapping(value = {"/login","/login.do"}) public modelandview showloginform(httpservletrequest request, httpservletresponse response) throws ioexception { string username = getusername(); if(!username.equals("anonymoususer")){ return new modelandview("redirect:/home"); } return new modelandview("login"); } my application running in domain (example) www.localhost:8080/app/home , after second login, need invalidade first login , redirect www.localhost:8080/app/login . possible in server code? if in home page , return new modelandview("login"), browser url isn't modified. why? i have same problem , use this: return new modelandview(new redirectview("login")); if it's not work case, can try absolute path.

c# - UseTaskFriendlySynchronizationContext with WebForms and WebAPI in the same project -

i have legacy app uses webforms need extend. incorporated webapi newer functionality . works great until start using async await. in webapi usetaskfriendlysynchronizationcontext = false cause httpcontext null. setting true fixes issue. in webforms usetaskfriendlysynchronizationcontext = true causes pages never return. it's iis never returns response. setting false fixes this. is there someway have true webapi , false webforms? no, it's not possible have set @ level. asp.net runtime in process (technically app-domain) must use 1 implementation. my recommendation investigate webforms code , determine why deadlocking new syncctx. vast majority of code should work fine, there must unusual there.

ios - Push notification is not receiving very first time -

i sending push notification node server iphone , android. sent apns/gcm , receiving notifications mobile devices. but, in iphone 6, push notification not receiving first time after it's receiving notification. it's happening in following stage: installing application , opening first time. if application no longer in use. thanks in advance.. sometimes push notifications may not come. the code written occasions? (app close/ active / inactive / background) the code tested same occasions?

dictionary - android show multi point on esri map -

i new developer in arcgis environment , i'm android developer. training followed arcgis tutorials. want add multi point on map, when try, last point appears on map. need solve it. here current code: mapview mmapview; graphicslayer graphicslayer = new graphicslayer(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_hello_map); mmapview = (mapview) findviewbyid(r.id.map); mmapview.addlayer(graphicslayer); simplemarkersymbol sms = new simplemarkersymbol(color.red,10, simplemarkersymbol.style.circle); multipoint multipoint = new multipoint(); multipoint.add(-5.2769,6.8169); multipoint.add(-3.0195,8.7057); multipoint.add(-0.0195,9.7057); int len = multipoint.getpointcount(); graphic[] graphics = new graphic[len]; for(int = 0; i<len; i++){ point pt = multipoint.getpoint(i

java - Overriding equals and hashCode on a POJO with a List object -

i have 2 pojos this public class element{ private string name; private int number; //getters , setters } public class container{ private string subject; private string email; private list<element> elements; //getters , setters } and need verify if 2 container objects same. looked bit , found apache commons has hashcodebuilder , equalsbuilder overriding methods. idea builder methods use elements in object in order determine hashcode , equality of 2 objects. problem that, if see example code, looks this: public boolean equals(object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getclass() != getclass()) { return false; } myclass rhs = (myclass) obj; return new equalsbuilder() .appendsuper(super.equals(obj)) .append(field1, rhs.field1) .append(field2, rhs.field2) .append(field3, rhs.field3) .isequals

rest - How to handle python objects built from a web API that have references to each other? -

i'm building client library web api exposes objects this: # objs/foo/obj_id_1 {id: "foo_id_1" name: "your momma" bar: "bar_id_2"} # objs/bar/obj_id_1 {id: "bar_id_2" name: "puh-lease" foo: "foo_id_1"} so, objects of type foo have reference objects of type bar , vice versa. in python client library, build python objects out of api data. foo instance have bar attribute containing bar instance instead of id of bar , bar instance has reference foo instance in foo attribute. my python classes have save , refresh methods post or web api, , sub-objects. example, if call a_foo.refresh() , automatically call a_foo.bar.refresh() . the above simplified example, , there might many different classes referring same instance of bar or foo or of many other types of objects get. i think question 2 questions: what design or strategy ensure when build object api data of references other objects point

spring - Using hibernate.c3p0 when creating a EntityManagerFactoryBean in Java -

i moved .net world java world. i have build core project used multiple clients (web client, api, ...) doing got tired of having configure data access beans , connection strings in multiple projects. goal include "core-project.jar" , able use without having configure data access beans , connection strings. i found this: (seems have trouble webserver atm.) http://www.baeldung.com/2011/12/13/the-persistence-layer-with-spring-3-1-and-jpa/ which resulted in code works , completes goal. baserepository package com.company.core.data.repositories; import javax.persistence.entitymanagerfactory; import javax.persistence.persistenceunit; public abstract class baserepository { protected entitymanagerfactory emf; @persistenceunit public void setentitymanagerfactory(entitymanagerfactory emf) { this.emf = emf; } } userrepository package com.company.core.data.repositories; import com.company.core.data.interfaces.iuserrepository; import com.compa

python - Pygame: Colliding Rectangle on multiple other rectangles -

i attempting create game in block moves , forth until player presses space. upon which, block jumps next line , stops. currently having problems collision code. the error being thrown shell is: if dorectsoverlap(j['rect'], floors['line']): typeerror: list indices must integers, not str i stuck understanding code has gone wrong. knowledge of how python works limited. there code have commented out floor moving dowards when player jumps. has been commented out until can collisions working, still included code below: import pygame, sys, time pygame.locals import * def dorectsoverlap(rect1, rect2): a, b in [(rect1, rect2), (rect2, rect1)]: # check if a's corners inside b if ((ispointinsiderect(a.left, a.top, b)) or (ispointinsiderect(a.left, a.bottom, b)) or (ispointinsiderect(a.right, a.top, b)) or (ispointinsiderect(a.right, a.bottom, b))): return true return false def isp

No Class Def Found Error org.apache.ContentType (Android Studio) -

good day.i done heaps of researches , used every answer found nothing helped!im trying upload simple image php server in bytes code @override protected string doinbackground(void... params) { bytearrayoutputstream bos = new bytearrayoutputstream(); bitmapdrawable drawable = (bitmapdrawable) imageview.getdrawable(); bitmap bitmap = drawable.getbitmap(); bitmap.compress(bitmap.compressformat.jpeg, 50, bos); byte[] data = bos.tobytearray(); string filename = string.format("file_%d.png", new date().gettime()); bytearraybody bab = new bytearraybody(data, filename); httpclient client = new defaulthttpclient(); httppost post = new httppost("http://192.168.1.100/paqqy/user/registration/platform/android"); multipartentity reqentity = new multipartentity( httpmultipartmode.browser_compatible); reqentity.addpart("file", bab); whats funny damned android studio keeps giving me noclassdeffound error @

javascript - suppress main function call with function defined in prototype -

have @ code below: function person() { this.fname = 'baby'; this.lname = 'boy'; this.walk = function () { return 'i can walk'; } } person.prototype.walk=function(){ return 'all can walk';} var obj=new person(); obj.walk(); now want let both these funtions in code want when make call walk using obj.walk()...it should calling walk function prototype,as result return me 'all can walk' you can delete obj.walk remove property specific object, , force use inherited method. function person() { this.fname = 'baby'; this.lname = 'boy'; this.walk = function () { return 'i can walk'; } } person.prototype.walk=function(){ return 'all can walk';} var obj=new person(); delete obj.walk; console.log(obj.walk());

android - Start an activity when screen on -

i have designed lockscreen adnroid. i'm trying use broadcast receiver start lockscreen activity when user pushes power button unlock. public class receiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { if(intent.getaction().equals(intent.action_screen_on)){ log.w("bam", "screen went on"); } else if(intent.getaction().equals(intent.action_screen_off)){ log.w("bam","screen went off"); } } } android manifest:` <uses-sdk android:minsdkversion="7" android:targetsdkversion="21" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mylockscreenactivity" android:label="@string/app_name" > <

Is there a way to define placeholders in a Maven assembly descriptor? -

i'm not expert on maven, i'm sorry if question bit silly. i using 3 descriptors in pom.xml. in each of these descriptors, file being filtered. use placeholder reference id of descriptor inside file. for example, if 1 of assembly descriptors: <assembly> <id>descriptornumbertwo</id> ... <file> <source>src/main/assembly/run.sh</source> <filemode>0755</filemode> <lineending>unix</lineending> <filtered>true</filtered> </file> ... </assembly> i want use ${placeholder.for.my.id} (or something) in run.sh, "descriptornumbertwo". possible? thanks in advance!!

sitecore7.2 - Sitecore User Manager extremely slow when using Active Directory Module -

does else have performance issues when using sitecore active directory module? configured it, using 26 different domains not issue, makes slower guess, when open user manager, takes 25 seconds go next page in usermanager. have 8000 users in total. on other hand, when go roles, have 12,000 roles coming ad, , there no performance issue whatsoever. tried disabling profiles ad, didn't make noticeable difference. when comment out 25 of 26 domains in config (leaving me 1000 ad users), there noticeable improvement in performance. if browse through set, can see cache created domain gets populated, don't see performance improvement cache being filled. cache used for? batch updates? difference between members, memberof , user caches created? thanks! erwin it has been while, going memory recall: the issue user manager has query ad each page request it, whereas role manager gets roles , pages through cache. limitation of underlying .net provider. best advice can give

aws java sdk - Is there a way to programmatically get the maximum authorized number of shards for an Amazon Kinesis stream? -

by default kinesis stream authorized have @ 10 shards, possible increase limit. possible retrieve limit stream programmatically? wasn't able find method in official aws java sdk. no, there doesn't seem api call that. in case, have contact aws support , approved limit increase, means value not change often. if need access limit number dynamically, might consider storing in database somewhere. or, might listen , react exception produced when try scale greater allowed limit. note if wondering scaling purposes: open shards count toward limit - can scale 5 10 shards, , during scale, original 5 closed become parent shards, mean have 15 shards on account 24 hours until parent shards expire. works fine.

Assembly Programming x86 Pentium Bug -

i'm having little problem in program written in assembly language x86 pentium. used debugger search abnormal thing in run of program. happening when try run in debugger goes when in terminal segmentation fault (core dumped) appears. know i'm accessing part of memory not defined see no problem on code. here's code: #.text #same .section .text .globl hell hell: push %ebp movl %esp, %ebp push %ebx #index push %edi push %esi subl $8, %esp movl 8(%ebp), %edx #str movl 12(%ebp), %eax #hist movl $-1, %esi xor %ecx, %ecx #j dec %ecx forclean: inc %ecx cmp $26, %ecx je for1 movl $0, (%eax, %ecx, 4) jmp forclean for1: inc %esi movb (%edx,%esi,1), %al cmpb $0, %al je fim cmpb $0x41, %al jl if2 cmpb $0x5a, %al jg if2 subb $0x41, %al movzbl %al, %ebx #mover para o index incl (%eax, %ebx, 4) jmp for1 if2: movb (%edx,%esi,1), %al cmpb $0x61, %al jl for1 cmpb $0x7a, %al jg for1 subb $0x61, %al movzbl %al, %ebx #mover para o index incl (%eax, %ebx, 4) jmp for1 end: movl %ebp,

html - CSS: dashed border under 2 divs -

Image
please see attached image , fiddle. idea have 2 tables side side (the blue boxes) , can select row in each table , press red link button below. lines connect boxes , link buttons need dashed border. height of blue boxes vary. here can find fiddle of have far. <div class="container cf"> <div class="link"> <div class="linkbutton"> <input type="button" value="link" /> </div> </div> <div class="tab table1">table left </div> <div class="tab table2">table right</div> </div> i having difficulties centering link button , wondering how robust html because of positioning link button , container using negative values. any suggestions on better structure welcome. need support ie7 cannot take advantage of :before, :after , other pseudo elements. here simplified version of it, changed order of tabl

Use of 'prototype' vs. 'this' in JavaScript? -

what's difference between var = function () { this.x = function () { //do }; }; and var = function () { }; a.prototype.x = function () { //do }; the examples have different outcomes. before looking @ differences, following should noted: a constructor's prototype provides way share methods , values among instances via instance's private [[prototype]] property. a function's this set how function called or use of bind (not discussed here). function called on object (e.g. myobj.method() ) this within method references object. this not set call or use of bind , defaults global object (window in browser) or in strict mode, remains undefined. javascript object oriented language, i.e. object, including functions. so here snippets in question: var = function () { this.x = function () { //do }; }; in case, variable a assigned value reference function. when function called using a() , function's this

jquery - how to get value from div and place it within img tag src in php -

value coming table on clicking row : <script> var link_base = "<?php echo bloginfo('template_url').'/savelabel/'; ?>" ; var img_name = $('#imgdiv').text(); $('#imgid').attr('src', link_base + img_name); </script> <div class="bx2"> <img id="imgid" alt="" class="imgsty" /> </div> selected filename showing in div : <div id="txtdiv"></div> and within html, there image tag, in want pass value of div (ie name of image file) src="" within img tag. the code trying achieve shown below : <script> var link_base = "<?php echo bloginfo('template_url').'/savelabel/'; ?>" ; var img_name = $('#imgdiv').text(); $('#imgid').attr('src', link_base + img_name); </script> <div class="bx2"> <img id="imgid"

javascript - I want clear the cookies of a page when loading from another page but not when the same page is reloaded -

i building new website , have created page has array store in cookies , clearing array using $.removecookie("checkboxvalues"); i running function when document gets ready. when coming page page using link want clear cookies , yes happening. problem if load same page (using f5 or ctrl + r) cookies gets cleared , don't want loose cookies. kind of appreciated. thanks. you can try 1 of below: the easiest way can think of achieve put time-stamp in query string of redirect , read in javascript. set cookie time stamp , detect whether exists tell whether page being reloaded (has been loaded query-string before). code : store cookie first time visits page. on refresh check if cookie exists , if does, alert. function checkreload() { if(document.cookie.indexof('yourcookie')==-1) { // cookie doesn't exist, create } else { // not first visit, alert alert('you refreshed!'); } } and in body tag: <body on

c# - How to populate a list in a Repeater - HeaderTempalte from the ItemTemplate -

i trying create accessible accordion repeater. need populate list in headertemplate eval in itemtemplate. have runat server it's not shown in codebehind. how can populate ul? structure: <asp:repeater runat="server" id="repeater1" onitemdatabound="repeater1_itemdatabound"> <headertemplate> <div class="accordion"> <ul class="tab-titles" role="tablist" runat="server" id="tabtitles"> <li aria-controls="panel1" class="title" id="tab1" role="tab" tabindex="0">tab 1</li> <li aria-controls="panel2" class="title" id="tab2" role="tab" tabindex="0">tab 2</li> </ul> </headertemplate> <footertemplate> </div> </footertemplate> <itemtemplate> <asp:label id="category" runat="server" text='<%# eval(&q

c# - Consume WCF library with Windows Credential -

i've wcf library , want switch anonymous windows authentication. settings in iis , web.config file seem fine, can connect powershell using new-webserviceproxy have problem c# client. in powershell needed switch piece of code new-webserviceproxy -uri $uri; to one new-webserviceproxy -uri $uri -usedefaultcredential; in c# referenced library how can tell client "use default credentials"? error an unhandled exception of type 'system.servicemodel.security.messagesecurityexception' occurred in mscorlib.dll additional information: http request unauthorized client authentication scheme 'anonymous'. authentication header received server 'negotiate,ntlm'.

Asynchronous processing of parallel shapes in BizTalk orchestration -

is there way can make various parallel shapes in biztalk orchestration processed in asynchronous way? more specifically, if 1 of parallel shape fails while getting executed, should not affect other parallel shapes execution. as found out parallel shapes in biztalk orchestration aren't independent each other. try , execute steps in first parallel action , start on 1 of other parallel actions when waiting on response on current parallel action. failures or termination can lead unexpected results per. how configure parallel actions shape caution if place terminate shape inside parallel actions shape, , branch terminate on run, instance completes immediately, regardless of whether other branches have finished running. depending on design, results might unpredictable in case. your options are have scope inside each branch of parallel shape, if there failure caught doesn't stop execution of other branches. note: if execution of steps inside par

How to choose design pattern -

i learning design pattern , have question. example, here first design . shape shape->red circle shape->blue circle shape->red square shape->blue square ... second design shape shape->circle shape->square shape->circle->red circle shape->circle->blue circle shape->square->red square shape->square->bluesquare ... thanks tony, come situation. in first design, shape class abstract, , have function "red square" , "blue square" only. means cannot define function in shape class need 1 one in "red square" , "blue square". same situation second design, can put new function in "square" class. now, question correct , there other design can use? your question not specific enough give solid answer. after discussing in comments clear actively trying learn design patterns may not clear best way ask question. providing answer have room type. resources dofactory - use refere

php - Configuring HHVM 3.7 with Apache 2.4 gives me a 404? -

i can't seem configure hhvm , apache, keeps giving me 404 file not found error. configuration file website saved www.example.com.conf , contains: <virtualhost *:80> servername website.com serveradmin mail@website.com documentroot /var/www/website.com/public_html/ proxypassmatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/website.com.com/public_html/$1 errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/access.log combined </virtualhost> note i've removed actual website name, it's subdomain it's this: subdomain.xyz.com . i've tried looking how fix this, whatever i've tried doesn't seem work; github issues people have posted on official repository don't seem work. haven't changed default apache configuration, thing have changed root directory of website directory in configuration file above. any ideas? thanks. i know it's been 2 months already, maybe

php - Email Images Suddenly Stopped Showing -

i have custom php script runs @ 11:30-12:00 every day sends out custom branded newsletter 660 people. this has been working 3 years , emails html based images loaded in remotely server user can choose in mail client whether or not load them automatically or not etc. main ones being header image , 10 little square png/jpg images represent small banner images. however within last 3 days emails have been receiving (as tests) have been coming through without images showing , alt tag displayed. this makes email pretty bad. i can go website , see article display , in debug file can see application sending off correct html src attributes article webserver , plugin converts emails articles working fine. i use thunderbird had update , before update set allow remotely loaded images site. however when open email don't "options" button or line above email says "to protect privacy, thunderbird has blocked remote content in message" stops images appearing in o

magento - Place an order does not work on checkout/onepage/ after moving from 1.7 to ver 1.9.1 -

place order not work on checkout/onepage/ after moving 1.7 version 1.9.1 [ new ] options 54 seconds ago i have upgraded 1.7 version 1.9.1. have made many changes nothing working. luckly manage fix login page , update cart few code change in id etc. anyone have idea. realy stuck. :smileyhappy: wht changes have made regarding placing order far i have added @ bottom of info.html review = new review('<?php echo $this->geturl('checkout/onepage/saveorder', array('form_key' => mage::getsingleton('core/session')->getformkey())) ?>', '<?php echo $this->geturl('checkout/onepage/success') ?>', $('checkout-agreements')); i added value in payment.phtml public_html/app/design/frontend/base/default/template/checkout/onepage <fieldset id="checkout-payment-method-load"> getchildhtml('methods') ?> but no luck. page not go anywhere @ all. idea!!!!!!!!!!!!!!!!!!!!!!!!!!

python - Use database to store session instead of Cookie with Flask -

i have python project flask. i'm using sql alchemy (according page of documentation : http://flask.pocoo.org/docs/0.10/patterns/sqlalche ) handle database actions. i'm using flask.session store user's information (authentication status, preferences, ...) default flask's session behaviour store sessions in user's cookie, , sign cookie secret_key users can't alter it, can read it. i don't users able "see" session's content. flask offer built-in way store session's content in orm (sqlalchemy), or have implement myself ? thanks ! this adapted http://flask.pocoo.org/snippets/75/ . if need store lot of session data makes sense move data cookie server. in case might want use redis storage backend actual session data. the following code implements session backend using redis. allows either pass in redis client or connect redis instance on localhost. keys prefixed specified prefix defaults session:. import pickle datet

c++ - Why this code is getting slower when I use std::algorithms instead of plain loops? -

i calculating mean , standard deviation of elements of vector. have 2 versions of , puzzled why version using standard algorithms slower 1 using plain loops. both version use struct return type: struct meanandsigma { double mean; double sigma; }; and version loops this: meanandsigma getmeanandsigma(const dvector& v){ meanandsigma ms; ms.mean = 0; (int i=0;i<v.size();++i){ms.mean += v[i];} ms.mean = ms.mean / v.size(); double sqsum = 0; (int i=0;i<v.size();++i){sqsum += (v[i]-ms.mean)*(v[i]-ms.mean);} ms.sigma = std::sqrt(sqsum / (v.size()-1)); return ms; } and 1 algorithms: meanandsigma getmeanandsigma2(const dvector& v){ meanandsigma ms; ms.mean = std::accumulate(v.begin(),v.end(),0.0) / v.size(); dvector diff(v.size()); std::transform(v.begin(),v.end(),diff.begin(), std::bind2nd(std::minus<double>(), ms.mean)); double sqsum = std::inner_product(diff.begin(),diff.end(),diff.

c# - How do you access the model in an EditorFor template? -

how access model in asp.net mvc editor template? example if parent view contains say: @html.editorfor(x => x.surname) then inside views/shared/editortemplates/string.cshtml have: @model string <div class="field"> @html.labelfor(x => x) @html.textboxfor(x => x) @model.length </div> this fails @ @model.length because model null, although labelfor , textboxfor render correct surname properties. when html.displayfor equivalent template file used, model contain given string value. creating editor template broad string have unintended consequences, since have many editorfor(x => x.stringvalue) s in code don't want editor template apply to. it's have editorfor causing nullref exception here.

javascript - Infinite scrolling not working -

i trying implement infinite scrolling function seems code not working. can me? $(document).ready(function(){ var origelement = $('.scroll').clone(); if($(window).width() > 500){ $('.scroll').jscroll(); } $(window).resize(function(){ if($(window).width() < 500){ alert($(window).width()); $('.scroll').remove(); $('#container').append(origelement); } else{ $('.scroll').jscroll(); } }); }); bellow html code: <div id="container"> <div class="scroll"> <h3>page 1</h3> <p>page 1 of jscroll example - jquery infinite scrolling plugin content of page 1 in jscroll example. scroll bottom of box load next set of content. example text jscroll demonstration. jscroll jquery plugin infinite scrolling, endless scrolling, lazy loading, auto-p