Posts

Showing posts from June, 2010

Generate Different Text Languages from one DSL with MPS -

i'm looking way generate code in several different languages, start objc, java android, unity , javascript (cordova), repeated code. i'm writing code manually on , on in each language. i'm looking @ mps , thinking on developing 1 dsl , generate different code each language. my question mps allow create different textgen different languages? yes, mps allows target different languages. surely need distinguish between 2 logical "phases" of generation process in mps - generator, performs model transformations, , textgen, transforms models text. generator typically transforms dsl general-purpose language (still represented ast), while textgen defined general-purpose language transforms code text. several such general-purpose "base" languages exist - java, c, xml , few prototypes. transforming dsl directly text through textgen defined dsl possible, feasible simple dsl only.

Unable to Connect to connect to Oracle 12c with SID But Service Name Works -

i'm trying connect oracle database. database hosted in local virtual machine. i can connect fine with service name: ...@localhost:1521/orcl however sid: ...@localhost:1521:cdb1 not work. currently when try , connect get: ora-01017: invalid username/password; logon denied note: i'm using exact same username , password both login - attempts. i can connect sid system user. your service name orcl - connection works. then try different database, 'cdb1', , same user/password don't work. those different databases, probably. you're in multitenant environment. should use service name when connecting 12c instance. sid in multitenant take container database. pluggables running in container reachable service name.

html - Changing media screen makes div overlay -

Image
i using bootstrap , divs 4-columns each (col-md-4) . based on bootstrap 12-columns means in pc media screen 3 divs @ each row. below 991px it's standard each 4-columns covers whole screen. please see screenshot: however, want 4-columns cover 50% of screen when screen size between 600px , 990px. meaning there 2 divs @ each row. have succeeded in, there issues. when loading page @ mobile portrait (approx < 530px) loads correctly. div not overlay each other. when loading page @ mobile landscape, or ipad portrait (approx > 740px) loads correctly. div not overlay each other. when flipping screen either mobile portrait mobile landscape or opposite it's starting act strange. divs overlaying each other. the effect want has been adding using following css : @media screen , (min-width: 991px) , (max-width: 1200px) { #isotope-list img { height: 100%; } } @media screen , (min-width: 600px) , (max-width: 990px) { #isotope-list .col-md-4 { width: 50%; } #isot...

arrays - Decrease run time of this java program -

i have made program input array, , find product of 3 largest numbers of array such that: the array constitutes of sub-arrays consisting of index increased 1 @ time. that is, array of 10 elements, find product considering first 3 elements, first 4 elements, first 5 elements , on. here's code: import java.io.*; import java.util.arrays; public class monkmulti { public static void main(string args[] ) throws ioexception { bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); int n = integer.parseint(br.readline()); // no. of elements string xs = br.readline(); //accepting elements in string xs=xs+" "; if(n<1||n>100000) //constraint system.exit(0); int i,temp,count=0; for(i=0;i<xs.length();i++) { if(xs.charat(i)==' ') { count++; } } if(count!=n) //checks if no. of elements eq...

html - How can I move my navigation bar to a different place? -

i'm trying make nav bar horizontal , centered. right now, it's smushed right of website. how control bar located? also, why can't have css under #nav (why need #nav ul li, etc?) #nav{ width: 90%; text-align: center; font-size: 35px; text-align: center; } #nav ul li{ display: inline; height: 60px; text-align: center; } #nav ul li a{ padding: 40px; background: #25ccc7; color: white; text-align: center; } <div id="nav"> <ul> <li><a href="/">home</a></li> <li><a href="/about">about</a></li> <li><a href="/contact">contact</a></li> </ul> </div> you need different css selectors because not styles meant applied surrounding container #nav , elements inside it. pure css, not possible nest rules . if nesting aski...

Where do I find the definition of Rf_protect() in R's sources? -

i reading r sources , trying learn heap structure. i'm looking definition of protect(), i've founded: $ grep -rn "#define protect(" * src/include/rinternals.h:642:#define protect(s) rf_protect(s) and then $ grep -rn "rf_protect(" * src/include/rinternals.h:803:sexp rf_protect(sexp); src/include/rinternals.h:1267:sexp rf_protect(sexp); but didn't find rf_protect()'s definition. thanks. the rf_ prefix common idiom giving plain c code resemblance of namespace. want protect(...) instead: /usr/share/r/include/rinternals.h:#define protect rf_protect and given how 'core' this, may start in src/main quick grep -c leads src/main/memory.c . et voila on lines 3075 3081 sexp protect(sexp s) { if (r_ppstacktop >= r_ppstacksize) r_signal_protect_error(); r_ppstack[r_ppstacktop++] = chk(s); return s; } now said, want pay attention of file , not function.

python - SWIG Syntax Error -

i'm trying compile swig bindings wireless communications library ( http://www.yonch.com/wireless ) uses it++ library. using swig version 2.0.11 on ubuntu 14.04. this error getting when trying build: /usr/include/itpp/base/binary.h:162: error: syntax error in input(1) here line 162 binary.h: itpp_export std::ostream &operator<<(std::ostream &output, const bin &inbin); if rest of file needed can found here: http://montecristo.co.it.pt/itpp/binary_8h_source.html this swig command line call being used: /usr/bin/swig -c++ -python -i/home/user/anaconda/include/python2.7 -i../../../include -i/usr/include -i../../../bindings/itpp -i../../../bindings/itpp/.. -dhave_config_h -o base_sparse.cpp ../../../bindings/itpp/base_sparse.i i have no experience swig , can't seem see code causing syntax error. insights appreciated! exports not understood swig i add a #define itpp_export in .i file after inclusion of c/c++ headers , before include...

php - Increasing row limit import size -

trying import file web application , fails when importing >100k rows. less successful. file size 14mb php.ini set 100mb file upload ideas helpful. php 5.4.20 (cli) mysql ver 15.1 distrib 5.5.33-mariadb in php.ini check max_execution_time , increase it

javascript - Coffescript switch when -

my coffeescript following: level = switch when 0 <= value <= 1 0 when 1 < value <= 2 1 when 2 < value <= 3 2 when 3 < value <= 4 3 when 4 < value <= 5 4 else 6 why : uncaught error: execjs::programerror: [stdin]:15:4: error: unexpected when when 1 < value <= 2 1 this works fine: when value <= cool 0 when value >= warm 4 else bucketsize = (warm - cool) / 3 # total # of colours in middle math.ceil (value - cool) / bucketsize this works: level = switch when value <= 1 0 when value <= 4 4 else 5 untill add when value <=2 1 it indentation. level = switch when 0 <= value < 1 0 when 1 <= value < 2 1 when 2 <= value < 3 2 when 3 <= value < 4 3 when 4 <= value <= 5 4 else 5 i kept code here : http://www.coffeelint.org/ and checked indentation.

mysql - Update my PHP API -

firstly i've been told use outdated mysql, , should use mysqli, i'm not entirely sure how migrate over. also, further explain api shows player stats when search name. reason in background it's querying url/0 , it's making page loading extremely slow. anyhow here's api.php. give me example of mysqli? <?php // epicmc cms api $date1 = new datetime('now'); $date2 = new datetime('12/12/2014'); $difference = $date1->diff($date2)->days; $link = mysql_connect("localhost", "username", "password"); mysql_select_db("database", $link); if ($_get['task'] == 'total') { $get_db = 'database'; $result = mysql_query("select * $get_db", $link); echo '{"task":"total","amount":"'; echo mysql_num_rows($result); echo '"}'; } elseif ($_get['task'] == 'info') { $get_player = $_get[...

php - Getting Img Tag from RSS Description -

i have couple of rss feeds hide images within pesky description tag. i'm trying image src description, seem failing every solution on here. <description><![cdata[duration: 604 sec<br>url: http://www.test.com/videos/998879/surf.mpeg<br><img src="http://test.test.com/320x240/461/1055458.jpg"><br><iframe src="http://test.com/embed/998879" frameborder=0 width=650 height=518 scrolling=no></iframe>]]></description> as can see it's bit stuck in there! function echo_url($string) { preg_match_all('#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $string, $match); return $match[0][0]; } currently using function try , retrieve image no luck! any brilliant! $description = '<description><![cdata[duration: 604 sec<br>url: http://www.test.com/videos/998879/surf.mpeg<br><img src="http://test.test.com/320x240/461/1055458.jpg"><br...

javascript - Bring active Bootstrap navbar link to top -

Image
i have bootstrap navbar on site collapsed menu toggles on/off. when user clicks 1 of links in menu (which dropdown, way), active link should jump top of menu. way can see more expanded list of dropdown items. here's regular bootstrap navbar. want when click on "dropdown", bring active link top under "project name". if understand want correctly, user interface point of view recommend against doing this. highly unexpected behaviour user confused why thing tapped has moved. cause mistakes people opening menu, (since finger still close screen) accidentally clicking 1 of menu items , being moved new page. if worried users not being able see items maybe should consider different menu interface mobile devices such off-canvas menu (click little 'toggle nav' button rather hamburner menu see off canvas menu). give more space play menu items.

angularjs - How to stop $http being called multiple times in an Angular controller -

inside controller have tried stop $http being called multiple times, efforts seem in vein. i want report's items loaded once. have tried checking items being undefined , having timesrun variable @ top of controller , increasing 1 @ bottom of it. if ($scope.items === undefined && $scope.timesrun == 0) { var req = { method: 'get', *snipped* }; $http(req).success(function (data, status, headers, config) { $scope.items = data; }).error(function (data, status, headers, config) { sweetalert.swal("error " + status, data, "error"); }); } i have had in service service gets called multiple times. i'm missing trick. can understand digest cycle , have expressions in page need checked can see why controller running multiple times, cannot understand how can exclude web calls after they've run once. being called $http service twice or more may due many reasons. few listing be...

Powershell http get request from jenkins -

please tell me - how run jenkins (shell or windows powershell) powershell commando. command line following command works. powershell -command "[net.webrequest]::create(\"http://rackham:8080/job/ms-enu-deploy/buildwithparameters?artifact_version=1.3\").getresponse()" this command run jenkins. build success, request in post build section not fulfilled. powershell -command "[net.webrequest]::create('http://rackham:8080/job/ms-enu-deploy/buildwithparameters?artifact_version=1.3\').getresponse()" can me? well, looks internal, can't hit site referring. however, use powershell , use invoke-webrequest. use grab data websites , other various things. try , let me know if there more need. $request = invoke-webrequest "http://stackoverflow.com/questions/31568695/powershell-http-get-request-from-jenkins" $request.content

c++ - Vectorize function calls on each element of a vector -

when call function each element in vector using for_each calls vectorized or not? in general, no. std::for_each wrapper around loop. however, optimizations on, it's quite call std::for_each inlined, , simple functions, function call each element inlined too. once inlined, it's if loop had been written hand; in such case, question becomes "will compiler vectorize loop doing simple arithmetic"; , that's entirely compiler. in order happen, compiler needs know target architecture supports simd instructions, , may or may not vectorize depending on optimization level, whether number of iterations constant or not, whether number of iterations known multiple of 4, etc.

metaprogramming - How to check if a function is pure in Python? -

a pure function function similar mathematical function, there no interaction "real world" nor side-effects. more practical point of view, means pure function can not : print or otherwise show message be random depend on system time change global variables and others all limitations make easier reason pure functions non-pure ones. majority of functions should pure program can have less bugs. in languages huge type-system haskell reader can know right start if function or not pure, making successive reading easier. in python information may emulated @pure decorator put on top of function. decorator validation work. problem lies in implementation of such decorator. right source code of function buzzwords such global or random or print , complains if finds 1 of them. import inspect def pure(function): source = inspect.getsource(function) non_pure_indicator in ('random', 'time', 'input', 'print', 'global'...

java - How do you configure Embedded MongDB for integration testing in a Spring Boot application? -

i have simple spring boot application exposes small rest api , retrieves data instance of mongodb. queries mongodb instance go through spring data based repository. key bits of code below. // main application class @enableautoconfiguration(exclude={mongoautoconfiguration.class, mongodataautoconfiguration.class}) @componentscan @import(mongoconfig.class) public class productapplication { public static void main(string[] args) { springapplication.run(productapplication.class, args); } } // product repository spring data public interface productrepository extends mongorepository<product, string> { page<product> findall(pageable pageable); optional<product> findbylinenumber(string linenumber); } // configuration "live" connections @configuration public class mongoconfig { @value("${product.mongo.host}") private string mongohost; @value("${product.mongo.port}") private string mongoport; ...

statistics - Ordered Probit R -

i'm trying create ordered probit model in r. independent variable categorical, dependent variable ordinal. i'm using polr command , go through. when run command, log odds different variables. have converted them odds ratios using exp command. far understand it, these odds ratios tell me probability of dependent variable going 1 category every time independent variable "goes up" 1 category. correct? i'm confused because in case of independent variable, it's not increase since categories. my second question concerns interpretation of polr. odds ratios. how recommend additional information on suitability of ordered probit? thanks!

c# - Plugin retrieve multiple CRM dynamics Online 2015 -

i have plugin 1 steps (retrievemultiple) run entity list. (results ok , data filtred) when create graphic (standard graphic on dynamics crm ) based on de same entity, noticed data on graphic not filtred did know if normal ? there solution have data filtred same plugin ? thx help i know talking because had similar task , have charts in crm don't use retrievemultiple method getting of data. solution see configure views , security records used display information in charts.

string - Lua Parse After Match -

using lua 5.3 i'm trying parse string looks like. a=data0 b=data c=data a=data1 b=data c=data a=data2 ... i want parse 'b=data & c=data' after occurrence of 'a=data1'. know can start doing string.find(examplestring, 'a=data1') give me start/end position , know start parsing b after don't know how long 'data' after that, don't know start parsing 'c'? there anyway can parse next line type of thing? how else should tackle this? know start parsing b after don't know how long 'data' after that, don't know start parsing 'c'? is there anyway can parse next line type of thing? yes, can match eol character: for letter, data in s:gmatch('(%w)=(.-)\n') print(letter,data) end .- = 0 or more characters, few possible \n = eol character parentheses capture parts of pattern want gmatch return. you ([^\n]*) means 0 or more character not newline.

javascript - Request headers not sent from Service Worker -

i'm trying fetch web service service worker. service jsp secured basic apache authentication, must provide credentials authenticate in request headers. following request works fine main window: self.addeventlistener('push', function(event) { console.log('received push message', event); event.waituntil( fetch(online_site_endpoint, { method: 'get', mode: 'cors', headers: { 'accept': 'application/json', 'authorization': 'basic btoa(auth info)' } }).then(function(response) { //process response }).catch(function(err) { }) ); }); that code event.waituntil() scope, function called 'push' event listener. however, same exact call fails 401 (unauthorized). network panel developer tools shows headers not being sent: options /latest-new.jsp http/1.1 host: {an accessible host} connection: keep-alive access-control-request-method: origin: http://localh...

java - Error while importing data from MongoDb to Hdfs -

i'm trying import documents of collection in mongodb hdfs through mapreduce job. using old api. driver code package my.pac; import org.apache.hadoop.conf.configured; import org.apache.hadoop.fs.path; import org.apache.hadoop.io.text; import org.apache.hadoop.mapred.fileoutputformat; import org.apache.hadoop.mapred.jobclient; import org.apache.hadoop.mapred.jobconf; import org.apache.hadoop.mapred.textoutputformat; import org.apache.hadoop.util.tool; import org.apache.hadoop.util.toolrunner; import com.mongodb.hadoop.mapred.mongoinputformat; import com.mongodb.hadoop.util.mongoconfigutil; public class importdriver extends configured implements tool { public static void main(string[] args) throws exception { int exitcode = toolrunner.run(new importdriver(), args); system.exit(exitcode); } @override public int run(string[] args) throws exception { jobconf conf = new jobconf(); mongoconfigutil.setinputuri(conf,"mongodb://127.0.0.1:...

message queue - Can I build a software around Gearman in 2015? -

i'm looking queue/job tool , gearman perflectly fit need. however development seems stalled: last release 1.5 year ago: https://launchpad.net/gearmand/+download last commit maintainers well: https://code.launchpad.net/gearmand maintainers seems have start again seems nothing happened since apr 23rd either. so idea start using gearman (ie. it's stable enough , stalled developments not issue) or alternative ? hopefully yes. received notification yesterday saying the proposal submitted 2 years ago accepted , merged soon .

google analytics - Recovering from maximum unsampled reports -

when trying create new unsampled report through ga api, of our requests (to insert) receive http 400 in response: "error creating entity. have reached maximum allowed entities of type." it appears there isn't way delete unsampled reports, , i've not had luck finding documented maximum number of reports. there way either work around limit or delete older unsampled reports?

Get the same hash value for a Pandas DataFrame each time -

my goal unique hash value dataframe. obtain out of .csv file. whole point same hash each time call hash() on it. my idea create function def _get_array_hash(arr): arr_hashable = arr.values arr_hashable.flags.writeable = false hash_ = hash(arr_hashable.data) return hash_ that calling underlying numpy array, set immutable state , hash of buffer. inline upd. as of 08.11.2016, version of function doesn't work anymore. instead, should use hash(df.values.tobytes()) see comments most efficient property hash numpy array . end of inline upd. it works regular pandas array: in [12]: data = pd.dataframe({'a': [0], 'b': [1]}) in [13]: _get_array_hash(data) out[13]: -5522125492475424165 in [14]: _get_array_hash(data) out[14]: -5522125492475424165 but try apply dataframe obtained .csv file: in [15]: fpath = 'foo/bar.csv' in [16]: data_from_file = pd.read_csv(fpath) in [17]: _get_array_hash(data_from_file) out[17]: 69970179...

Python, Selenium, CSV, and UTF-8 (French) characters -

i have csv file contains french words, such "immédiatement". i'm using python plus selenium webdriver write words text field. basically, using required selenium packages plus csv: start selenium , go correct area. open csv file. for each row: get cell contains french word. write word in textarea. the problem: "unicodedecodeerror: 'utf8' codec can't decode byte 0x82 in position 3: invalid start byte" i've tried: declaring "coding: utf-8" @ top of file, , leaving out once set variable contents of cell, appending .decode("utf-8") once set variable contents of cell, appending .encode("utf-8") no love. (i can't set "ignore" or "replace", because need type word out. doesn't appear selenium itself, because when put list directly in script, typing goes fine. (i put in dict in script, jesus, why .)) what missing? [edit] sample csv content: 3351,payé/effectué,link...

c# - Is it possible to update Secondary Tile's DisplayName? -

i've secondary tile created this: secondarytile tiledata = new secondarytile() { tileid = "myid", displayname = "myoldname", arguments = "none" }; tiledata.visualelements.square150x150logo = new uri(mediumimage); tiledata.visualelements.shownameonsquare150x150logo = true; return await tiledata.requestcreateasync(); the tile has been created , can see displayname . when want update image, can done via tileupdater : tileupdater tileupdater = tileupdatemanager.createtileupdaterforsecondarytile("myid"); var tilexml = tileupdatemanager.gettemplatecontent(tiletemplatetype.tilesquare150x150image); // ... , on but displayname - when looking @ tile template catalog , there none, used change tile's displayname - possible somehow? in windows 10 (maybe windows phone 8.1) can use asyncupdate : _secondarytile.displayname = newdisplayname; await _secondarytile.updateasync();

Change Column Headers in Array with Unset: PHP -

i'm trying change text gets written first row, column header, of csv. i'm trying use unset , it's not working. referencing wrong array? appreciated. code below: for ($x=0; $x<$count; $x++) { $currentrecord = $response['data'][$x]; $jsondatainarray[] = array ( "b98336b40c8420dc2f1401d6451b1b47198eee6d" => $response['data'][$x]['b98336b40c8420dc2f1401d6451b1b47198eee6d'], "17a14a9da9815451ff5ffc669d407e8b0376b06b" => $response['data'][$x]['17a14a9da9815451ff5ffc669d407e8b0376b06b'], "3eedd4fd08f44a72d911dc4934a6916f3b31911b" => $response['data'][$x]['3eedd4fd08f44a72d911dc4934a6916f3b31911b'], "52ede287f6c55eb6b12821ca24f74098779abdce" => $response['data'][$x]['52ede287f6c55eb6b12821ca24f74098779abdce'], "13916ba291ab595f27aefbff8b6c43a3fb467b72" => $response['data'][$x][...

javascript - Sensor Data on Vis.js -

i working wireless sensor networks , have been obtaining sensor's addresses , sensing parameter temperature in json format. format follows: {"eui":"c10c00000000007b","count":0"tmp102":" 0.0000 c"} as far connection of network, parent node , next destination got through json format (on ubuntu gnome terminal) using coap (constrained application protocol) sensor networks has synonymous implementation http light weight. {"dest":"aaaa::c30c:0:0:7b","next":"fe80::c30c:0:0:7b"} for further details please refer repository i want create visualization of topology of sensors if possible attributes when 1 clicks on sensor, last sensed value observed. i storing first in file .json extension. want try visualization in vis.js relatively new it. have seen example of gephijson somehow not understand implementation. any sincere guidance appreciated. if want load data vis.js, have conv...

unit testing - Jasmine AJAX mock turns string into array -

i'm trying write test suite around ajaxrequest class, when i'm trying inspect request body test failure failed tests: ajaxrequest #post ✖ attaches body response phantomjs 1.9.8 (mac os x 0.0.0) expected object({ example: [ 'text' ] }) equal object({ example: 'text' }). here's relevant bit of unit test: req = new ajaxrequest().post('http://example.com') .body({ example: 'text' }).run(); and here's run() method ajax request made var options = { url: this._url, method: this._method, type: 'json', data: this._body }; return when(reqwest(options)); i'm using reqwest issue ajax requests. could point out why it's expecting ['text'] when request sent 'text' in json body? thank you! changing implementation of ajaxrequest solved problem. here new implementation of run using xmlhttpreque...

delphi - Cannot get string from StringStream -

i sending http request google's map api, , fill stringstream response. however, when try read stream, presented empty string ''. { attempts json google's directions api } function getjsonstring_ordie(url : string) : string; var lhttp: tidhttp; ssl: tidssliohandlersocketopenssl; buffer: tstringstream; begin {sets ssl} ssl := tidssliohandlersocketopenssl.create(nil); {creates http request} lhttp := tidhttp.create(nil); {sets http request use ssl} lhttp.iohandler := ssl; {set buffer} buffer := tstringstream.create(result); {attempts json google's directions api} lhttp.get(url, buffer); result:= buffer.readstring(buffer.size); //an empty string put result {frees http object} lhttp.free; {frees ssl object} ssl.free; end; why getting empty string back, when can see stringstream buffer has plenty of data (size of 32495 after called). i've tested call, , returned valid json. maybe first set buffer.po...

arrays - Randomly select item from JSON in PHP -

i have json string : [{"format":"i25","content":"172284201241"}, {"format":"i25","content":"40124139"}, {"format":"i25","content":"20197086185689"}, {"format":"i25","content":"10215887"}, {"format":"i25","content":"702666712272"}, {"format":"qrcode","content":"3"}] and want select 1 of these items randomly,for example : {"format":"i25","content":"40124139"} how can php? that string looks lot json, decode array. $array = json_decode($string, true); then, pick random index: $one_item = $array[rand(0, count($array) - 1)]; and convert json: $one_item_string = json_encode($one_item); echo $one_item_string;

python - Writing a line between lines -

i writing script have insert line between 2 lines. example: <tag1> <subtag1> line 1 - text line 2 - text </subtag> - #closing of subtag **--> here have (between closure of subtag , tag1) insert new tag (3 lines, opening tag, body , closing tag)** </tag1> i trying below-mentioned code, not able write in file. open ('abc.xml' , "r+") f: line in f: if '</subtag>' in line: f.write('\n text1\n') f.write('text2') f.write('text3') can please let me know in above code doing wrong, or other idea write code inserting line between 2 lines in file in python? as per jonrsharpe 's comment, easy understand approach read whole file, insert lines need them: # let's read our input file variable open('input.html', 'r') f: in_file = f.readlines() # in_file list of lines # start bui...

ios - How to create flash LED in SOS on swift 2? -

i tried write small program base on torch/flash in iphones. want add sos signal have no idea how should this. in code when start program switch on , off led every 0.2 sec. don't know how in sos signal. , when user click sos on , click sos off led should off immediately. need running thread ? or on nstimer ? class sos { var timer1 = nstimer() var timer2 = nstimer() var volume: float = 0.1 let flashlight = flashlight() func start() { self.timer1 = nstimer.scheduledtimerwithtimeinterval(0.2, target: self, selector: selector("switchon"), userinfo: nil, repeats: true) self.timer2 = nstimer.scheduledtimerwithtimeinterval(0.4, target: self, selector: selector("switchoff"), userinfo: nil, repeats: true) } func stop() { timer1.invalidate() timer2.invalidate() flashlight.switchoff() } @objc ...

Android Pay Style Button not coming its Display Google wallet Style button -

Image
i integrated android pay using developer reference: https://developers.google.com/android-pay in ui of buy button got old google wallet style button :-- i want android pay style button :-- i used supportwalletfragment this. below wallet fragment style: walletfragmentstyle walletfragmentstyle = new walletfragmentstyle() .setbuybuttontext(buybuttontext.buy_with_google) .setbuybuttonwidth(dimension.match_parent); the situation same button still old google wallet style. hack if need can try this: create wallet fragment in normal way hide it. create custom button android pay' one. when user clicks custom button can click manually hidden android pay button this. (when fragment has been created of course). if (walletfragment != null && walletfragment.getview() != null && ((framelayout) walletfragment.getview()).getchildcount() > 0) { ((framelayout) wallet...

c# - How to draw with mouse? -

i want make simple mspaint. firstly, draw lines in mouse event. private void pnl_draw_mousemove(object sender, mouseeventargs e) { if(startpaint) { g = pnl_draw.creategraphics(); g.drawline(p, new point(initx ?? e.x, inity ?? e.y), new point(e.x, e.y)); initx = e.x; inity = e.y; } } and then, realized resolved if form minimized. however, how use onpaint event it? should store points in list when user click , move, , paint , clear them in onpaint event? you need keep copy of last image bitmap object. user should update object in memory. can handle onpaint event of canvas display bitmap object background image.

logic - How to sort specific string, in the following situation (PYTHON) -

i trying build acronym shortner (as beginners project) link: http://pastebin.com/395ig9ec explaination: ++acronym block++ if user string variable set "international business machines" return ibm but in the... ++sorting block++ if user string variable set "light amplification simulated emission of radiation" i tried split whole sentence by: z=string.split(" ") l=len(z) then use following loop: '''|soring block|''' < for x in range(0,l,1): esc=z[x] if (z[x]=="by" or z[x]=="the" or z[x]=="of"): esc=z[x+1] emp=emp+" "+esc print emp but problem when there 2 consecutive exclusion words python messes up. how solve it? this takes first letter of each word in sentence, ignores words excluded, , puts letters using join. #python3 def make_acronym(sentence): excluded_words = ['by', 'the', 'of'] acrony...

css - -webkit-border-radius not work in Chrome Version 44.0.2403.89 m -

today, faced issue -webkit-border-radius in chrome browser version 44.0.2403.89 m. i called border-radius first , after -webkit-border-radius called. in firefox had no issue suprised chrome has issue not working code: div { width: 100px; height: 40px; background-color: green; border-radius: 0px 30px; -moz-border-radius: 0px 30px; -webkit-border-radius: 0px 30px; } <div></div> so change code call border-radius after -webkit-border-radius, works. can explain issue occur. working code: div { width: 100px; height: 40px; background-color: green; -moz-border-radius: 0px 30px; -webkit-border-radius: 0px 30px; border-radius: 0px 30px; } <div></div> edit: now use border-radius: 0px 30px 0px 30px; -moz-border-radius: 0px 30px 0px 30px; -webkit-border-radius: 0px 30px 0px 30px; its works. how? div { width: 100px; height: 40px; background-color: green; border-radiu...

c++ - A circular dependency involving comparison functors -

suppose need store information labeled e-mail messages. each message can assigned many labels. also, able retrieve messages assigned given label. here design: class message; class label { public: ... private: std::string name_; std::set<std::shared_ptr<message>, std::function<bool(...)>> messages_; // message incomplete! }; class message { public: ... private: std::string title_; std::set<label *, std::function<bool(...)>> labels_; // fine }; each label stores set of messages label assigned. since set needs searchable message title, pass std::function comparison second template parameter of std::set . the problem: function object needs able access message 's members. however, message incomplete type @ point. the situation cannot fixed putting definition of message before definition of label , because have similar problem std::function passed set of labels (the line commented being fine...

java - Why do we set hadoop_classpath for folder conatining the jar is required to run? -

i trying run wordcount program. created wordcount.jar. below content of jar. meta-inf/<br> meta-inf/manifest.mf<br> org/myorg/wordcount.class<br> org/myorg/wordcount$intsumreducer.class<br> org/myorg/wordcount$tokenizermapper.class<br> i ran program using below command: hadoop jar ./wordcount.jar org.myorg. wordcount mreduce/input mreduce/output however getting below error: java.lang.runtimeexception: java.lang.classnotfoundexception: class org.myorg.wordcount$tokenizermapper not found @ org.apache.hadoop.conf.configuration.getclass(configuration.java:1895) @ org.apache.hadoop.mapreduce.task.jobcontextimpl.getmapperclass(jobcontextimpl.java:191) @ org.apache.hadoop.mapred.maptask.runnewmapper(maptask.java:631) @ org.apache.hadoop.mapred.maptask.run(maptask.java:330) @ org.apache.hadoop.ma...

Pass json data by selecting id using fresh scope in angularjs -

i have table in template retrieving json data ` id type date 755 video 21/09/12 `. here controller of retrieving data table .controller('list', function($scope, $http) { $http.get(baseurl + '/page/1', _auth) .success(function(data) { $scope.value = data.data; }, function(err) { console.error(err); }); $scope.detail = function(index) { $http.get(baseurl + '/page') } }) for routing using ui-router , doing $stateprovider .state('/get' , { url: '/data', templateurl: 'app/list/data/data.html' }) this page has button redirects different template on clicking row table. want clicking row redirects different template , show data related id clicked. how can achieve this? ? thankx you'll need route display particular element : $stateprovider .state('/get' , { url: '/data', templateurl: 'app/list/data/data.html...