Posts

javascript - How to deserialize multiple JSON objects in C#? -

i'm passing multiple json objects frontend c# backend - how can deserialize them c# classes can used later on in application? before go farther, tied using js formdata object, contenttype: false , , processdata: false , because need pass files via ajax call; unrelated question. here's code far: frontend - function called when submit button pressed submitdata: function () { var formcollection = this.appmodel.get('formcollection').models; var formdata = new formdata(); var formjson = []; $.each(formcollection, function (index, form) { var tempjson = {}; if (form) { tempjson['id'] = form.get('id'); tempjson['number'] = form.get('number'); tempjson['name'] = form.get('name'); tempjson['attachments'] = form.get('attachments'); formjson.push(tempjson); } }); console.log(json.stringify(formjson));...

spring cloud - How to safely have a @RestController class implementing an interface annotated with @FeignClient -

given following code sample -- client library code @feignclient("string-service") public interface stringclient { @requestmapping(method = requestmethod.get, value = "/microservicestring") public string home(); } @service public class stringhystrixclient { private final springclient springclient; //.... } -- service library code @restcontroller public class stringcontroller implements stringclient { public string home(){ return "world"; } } @springbootapplication @enablehystrix @enableeurekaclient @enablefeignclients public class stringapplication { ....} if service library references client library, when application gets started, through component scanning state in filling dependencies stringhystrixclient, spring container not know because there 2 beans implementing stringclient. one solution avoid not implement stringclient in stringcontroller, code duplication interface , rest controller error prone...

android - Identifying error on the native app using appium when some field is blank -

i using appium automate native android app ui , functionality. requirement capture error message comes when username kept blank during login. error message shown red exclamation mark on username field , cannot identified uiautomator. there way capture text of error message via appium you can try find element using xpath , providing text value expect error message object possess. $driver.find_element :xpath, '//text[@text="err msg"]' if element found can retreive out other properties.

button - Method must have a return type (C#) -

been getting "method must have return type, , don't understand why. it "public helpview()" part returns error. (top of code, made block quote) web browser application, code , forward buttons. public class helpview { } list<uri> historystack; int historystack_index; bool fromhistory; //constructor public helpview() { initializecomponent(); historystack = new list<uri>(); historystack_index = 0; fromhistory = false; webbrowser1.navigated += new eventhandler<system.windows.navigation.navigationeventargs>(webbrowser1_navigated); updatenavbuttons(); } helpview not exact name of class. if meant constructor, make sure method name matches class name. if meant method, change public void helpview()

jsf - How to reference CSS / JS / image resource in Facelets template? -

i've done tutorial facelets templating . now i've tried create page isn't in same directory template. i've got problems page style, because of styles referenced relative path so: <link rel="stylesheet" href="style_resource_path.css" /> i can use absolute referencing starting / : <link rel="stylesheet" href="/project_root_path/style_resource_path.css" /> but bring me troubles when i'll moving application different context. so i'm wondering best way reference css (and js , image) resources in facelets? introduction the proper jsf 2.x way using <h:outputstylesheet> , <h:outputscript> , <h:graphicimage> name referring path relative webapp's /resources folder. way don't need worry context path in jsf 1.x. see how include css relative context path in jsf 1.x? folder structure drop css/js/image files in /resources folder of public webcontent below (just cre...

Multiplexing online audio and video streams in android -

there 2 media files hosted on external servers - audio , video. need mux them , play online stream through android mediaplayer class. the main problem, don't know, if there possible solution continuous download-mux-play process. i've seen examples of mediamuxer class usage, local files. currently, start 2 media players : //setting video mediaplayer video = new mediaplayer(); video.setdatasource("videurl"); video.prepare(); //setting audio mediaplayer audio = new mediaplayer(); video.setdatasource("audiourl"); video.prepare(); //starting both players simultaneously video.start(); audio.start(); but, of course, gives terrible synchronization between audio , video. so, question - possible mux online streams, , if yes - start research?

angularjs - Load JSON in angular service -

i'm trying use jed translating angular app. this, use angular service providing jed object. now, jed needs translations, stored in json file, when created: jed = new jed( jsondata ); alert( jed.gettext( 'i translated!' ) ); so, ajax request, app.factory( 'jed', function ( $http ) { var ret = { jed: null }; $http.get( 'i18n/de_ch/messages.json' ) .success( function ( data ) { ret.jed = new jed( data ); } ); return { jed() { // null until receive messages.json return ret.jed; } }; } ); problem jed not initialised until http request returns. possible solution return deferred object, usage ugly have check deferred object , use function callbacks, , inlined {{jed.gettext( 'quit' )}} not work anymore. is there clean way of doing this? yes, there way. make it return { jed() return ret; } }; and watch changes in...