Posts

C#: Optimizing error prevention with the input console -

i've started learning c# using rob miles' c# programming yellow book , related lab exercises website. did 1 of them , produced solution works...(there's not 1 provided). wanted not crash if user inputs nonsensical answers or string can't converted integer(i googled , found tryparse method. textbook briefly taught try/catch method, didn't seem useful user interface, i.e. let program continue after bad input). set that, in 1 of these cases, sends out alternate message. i've ended long code... do/while within do/while , do/while within while. if have tips streamlining this, i'd obliged. best, elliot using system; using system.io; static class cinema { static void main() { int[] selection = new int[] //array age requirements of each film { 15, 15, 12, 18, 0 }; string filmnumbertext; //console input film number int filmnumber; //input string parsed integer string agetext; //console input age int age; ...

jquery - How can i take the value of the specific option? -

i have code : function select(cities, country) { $('<div class="btn-group "><button type="button" id="forecast" data- toggle="modal" data-target="#mymodal" name="forecast" class="btn btn-primary pull-right" >show me forecast</div>').insertafter('.btn-group'); $('#cities').html(' <label for="cities">select city</label> <select name="cities" id="city" class="form-control">' + '<option disabled selected value> -- select option -- </option>' + cities.map(function (city) { return '<option value="' + city + '">' + city + '</option> '; }).join('') + '</select>' ); var city = $("#city option:selected").val(); console.log(city); } i want ta...

Android Fit image to full width using Picasso library -

i using picasso library load images , working fine after using library image not fit layout .if set image directly image view image fit layout.is there option pass method in picasso fit image layout picasso.with(getcontext()) .load(r.drawable.dddd). .into(lavdateimageview); even tried pass following method no use fit() , croptinside() etc xml file <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:orientation="vertical"> <scrollview android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="none" android:background="#ffffff" > <l...

java - Spring controller redirect to another module -

Image
i need help. i have app, in backend , frontent separated(backend - java + spring, frontent - angularjs), located in different modules in project , connected via rest protocol. on request mapping "/" should redirect user page index.html, html file located not in same package , module of application spring controller. i know, can user internalresourceviewresolver redirect user view, located in web-inf folder. not case.. can me problem please? how can redirect user view in module? structure of application: you can put index.html in src/main/webapp (not in web-inf) folder , let serving index.html file is. no configuration needed. additionally rest controllers should respond not on / but, example on /rest/something, can annotate directely controllers classes

javascript - Mutually Exclusive Data Attribute Selectors -

is possible select elements based on mutually exclusive data attributes, example: i'd .show() div s data attribute of country="united-kingdom" , type="partner" or "director" ? like: $('.post[data-country="united-kingdom"]&[data-type="partner,director"]').show(); or $('.post[data-country="united-kingdom"]&[data-type="partner"]or[data-type="director"]').show(); i'd .show() divs data attribute of country="united-kingdom" , type="partner" or "director"? then want selector group : $('.post[data-country="united-kingdom"][data-type="partner"], .post[data-country="united-kingdom"][data-type="director"]').show(); that says: match element which has class post , has data-country set united-kingdom , , has data-type set partner or has class post , has data-country set un...

How to reduce return content size from Slack rtm.start api -

the api doc can found here . i connect rtm.start api bot user : https://slack.com/api/rtm.start?token=bot_token , doc described: this method returns lots of data current state of team, along websocket message server url acutally content care websocket message server url . currently, i'll 19mb content api(as big team many channels , users). it take long code make request , cause timout. can increase timeout time, want wss url , make websocket call, idea how decrease content size api? i know parameters simple_latest & no_unreads & mpim_aware can used. i've tried them https://slack.com/api/rtm.start?token=bot_token&simple_latest=true&no_unreads=1&mpim_aware=true or did not work. i want know how make these 3 optional parameters work. no_unreads=1 correct way use these 3 parameters. and got way: per contact slack team, got additional parameter did not appear in document: cache_ts ==> timestamp 1479103245436 indica...

javascript - Drawing a line between moving objects -

i'm trying draw line between 2 moving vertices. vertex's drawing stored in variable called object , has position , three.vector3 . the line created thusly: var line = function(scene, source, target){ var geometry = new three.geometry(); geometry.dynamic = true; geometry.vertices.push(source.object.position); geometry.vertices.push(target.object.position); geometry.verticesneedupdate = true; var material = new three.linebasicmaterial({ color: 0x000000 }); var line = new three.line( geometry, material ); scene.add(line); return line; }; ..., source , target vertices , vertices updated via: vertex.object.position.add(vertex.velocity); now, assigned source.object.position , target.object.position line.geometry.vertices[0] , line.geometry.vertices[1] because wanted 1 update other. instead, vertex positions vary wildly line positions. vertices are, lines don't connect vertices. how can make lines move vertices? in animation loop ha...