Posts

Showing posts from March, 2013

wpf - C#: Cast to Base -

i have datagrid column contains link. file gets opened on click <datagridhyperlinkcolumn binding="{binding path=number}" > <datagridhyperlinkcolumn.elementstyle> <style> <eventsetter event="hyperlink.click" handler="linkclicked"/> </style> </datagridhyperlinkcolumn.elementstyle> </datagridhyperlinkcolumn> i use method public void linkclicked(object sender, routedeventargs e) { var vm = (basepartviewmodel<part>) datacontext; vm.openfile(); } i use code in base viewmodel class. but problem cast not work (basepartviewmodel<part>) datacontext because every implementation different. instance (basepartviewmodel<plug>) datacontext and plug derives part . how make work without implementing method in every derived viewmodel? you factor out openfile method covariant interface , cast interface. interface myinterface<out t> {

c# - Azure Web Jobs failure - ReadLine() left in -

so created azure web job performs task every 15 mins. runs c# console application. problem on last upload of program left console.readline(); argument in, causing program never finish (used local debugging of course) , web job fail , never run again. can fixed real quick if had source code, source code @ office, forgot upload cloud storage. won't have access till bit later on week. so i'm looking quick fix. can download .exe program last uploaded easily. i'm thinking run program first calls main program , closes after time. tried simple .bat script able open program, couldn't close/kill process due access denied errors (worked locally). other quick suggestions that'll work in web job environment? obviously if see here in few days, i've made corrections source code @ root of issue, others may interested well. :) update: thank everyone! each of these solutions helped me web job running intended. decompiling using reflector useful can add project cloud

protocol buffers - Apache Apex CLI launch error - protobuf -

i'm trying launch apa file apache apex cli (version 3.4) on hadoop cluster running 2.7.4-snapshot , protobuf v2.6.1 , following error: java.lang.nosuchmethoderror: com.google.protobuf.lazystringlist.getunmodifiableview()lcom/google/protobuf/lazystringlist; @ org.apache.hadoop.yarn.proto.yarnserviceprotos$getapplicationsrequestproto$builder.buildpartial(yarnserviceprotos.java:17322) @ org.apache.hadoop.yarn.proto.yarnserviceprotos$getapplicationsrequestproto$builder.build(yarnserviceprotos.java:17310) @ org.apache.hadoop.yarn.api.protocolrecords.impl.pb.getapplicationsrequestpbimpl.mergelocaltoproto(getapplicationsrequestpbimpl.java:79) @ org.apache.hadoop.yarn.api.protocolrecords.impl.pb.getapplicationsrequestpbimpl.getproto(getapplicationsrequestpbimpl.java:69) @ org.apache.hadoop.yarn.api.impl.pb.client.applicationclientprotocolpbclientimpl.getapplications(applicationclientprotocolpbclientimpl.java:249) any ideas wro

R Date conversion from factor -

i have factor of date given in number origin 1899-12-30, e.g. dat1 <- factor(42648) if want change date format, i'd do as.date(dat1, origin="1899-12-30") but conversion requires format. doing as.date(as.numeric(as.character(dat1)), origin="1899-12-30") works seems little on top. there shorter way?

java - Does creating multiple "throwaway" objects affect performance -

example: is this public double rounddecimal(double val) { return double.parsedouble(new decimalformat("#,##0.0").format(val)); } double d1 = rounddecimal(val); double d1 = rounddecimal(val); double d1 = rounddecimal(val); // lot more of these... considered bad practice instead of this? public double rounddecimal(double val, decimalformat dformat) { return double.parsedouble(dformat.format(val)); } decimalformat dformat = new decimalformat("#,##0.0"); double d1 = rounddecimal(val, dformat); double d1 = rounddecimal(val, dformat); double d1 = rounddecimal(val, dformat); // lot more of these... the difference of course being instead of creating decimalformat object on , over, create once , resuse it. thoughts garbage collector ensure wouldn't matter, don't understand enough know sure. you looking @ wrong end. “optimized” variant public double rounddecimal(double val, decimalformat dformat) { return double.parsedouble(dfor

osx - Cannot edit Sharepoint files on my mac. -

i'm using sharepoint on mac. (tried both safari , chrome) editing files online not possible. error: "sorry, document can't opened editing." tried .doc files , .docx files, both did not work. some files, made colleagues can opened, browser messes layout. what do? thanks! jill how file opens determined settings in library. if library not allow file open in browser view , don't have appropriate software in machine won't open. the browser view making mess of document layouts pretty standard ms file types in browser viewers. if have ever wondered why developers tend prefer text files in preference msword , that's 1 of many reasons. there many more factors may causing experiencing impossible work through them in context. able discuss happening site owner or site collection owner , start exploring site settings, list settings, software on machine, formatting of documents not displaying in browser , see if can start eliminating obvious probl

Is there a way to restrict input to integer/double in this format in c++ -

i trying make simple calculator in c++. in first version, had menu based system , asked input 1 after other easy validate integer. however, realised can user enter question in format enter on real calculator. double first; char choice; double second; cin >> first >> choice >> second; however stuck on how can check because of solution have looked @ follow format, not know how can implement because cin takes in 3 pieces of data. int x; cin >> x; if (!cin) { // not number } you cannot restrict user types @ terminal. best thing can detect input not appropriate, , ask input again. while ( !(cin >> first) ) { cout << "please enter floating point number: " cin.clear(); cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); } do same thing other numbers.

java - Radio button selection with primefaces -

this question has answer here: commandbutton/commandlink/ajax action/listener method not invoked or input value not set/updated 9 answers i have following radio button-selectable datatable: <h:form> <p:datatable value="#{gerardocumentobacking.reclamantes}" selection="#{gerardocumentobacking.reclamante}" var="re" rowkey="#{re.id}"> <p:column headertext="id"> <h:outputtext value="#{re.id}"/> </p:column> <p:column headertext="relamantes"> <h:outputtext value="#{re.nome}"/> </p:column> <p:column selectionmode="single"/> </p:datatable> <p:commandbutton value="gerar" action

CSS menu hover colors and background colors -

i have css menu: .menu-product-categories-container { display:block; width:100%; height:60px; background:#f36f25; } #menu-product-categories { list-style: none; padding: 0; margin: 0; text-align:center; height:100%; z-index: 0; } #menu-product-categories > li { display: inline-block; z-index:9999; position:relative; padding:21px 8px; text-decoration:none; } #menu-product-categories li > { display: block; } #menu-product-categories > li:hover { background:#ffffff; color:#f36f25; } #menu-product-categories > li > a:hover { color:inherit; } #menu-product-categories ul.sub-menu { list-style: none; padding: 0; margin: 0; display:none; width:200px; position:absolute; z-index:1; left:0; top:60px; background: #ffffff; } #menu-product-categories li:hover ul.sub-menu { display: block; max-height: 200px; background: #ffffff; } #menu-product-categorie

javascript - How to call Python function from Node.JS -

i'm working on making homebridge plugin project. homebridge node.js server have running on raspberry pi emulates apple homekit bridge. using this link, able execute python code following node.js code: var service, characteristic; var spawn = require('child_process').spawn; var py = spawn('python', ['/home/pi/desktop/rfbulb/nrf24l01plus.py']); var data = [10,10,10]; var datastring = ''; var rfstatus = true; module.exports = function(homebridge) { service = homebridge.hap.service; characteristic = homebridge.hap.characteristic; homebridge.registeraccessory("homebridge-rfbulb", "rfbulb", rfbulbaccessory); } function rfbulbaccessory(log, config) { this.log = log; this.config = config; this.name = config["name"]; this.address = config["address"]; this.service = new service.lightbulb(this.name); this.service .getcharacteristic(characteristic.on) .on

How to create a m4v video using ffmpeg? -

i'm trying create m4v video following command using ffmpeg: ffmpeg -loop 1 -i orange640x360.png -i be+present.mp3 -tune stillimage -shortest -c:v libx264 -c:a copy ./be+presentorange640x360.m4v this error i'm getting: [ipod @ 0x7fbbc9801600] not find tag codec mp3 in stream #1, codec not supported in container could not write header output file #0 (incorrect codec parameters ?): invalid argument if same command create mp4 video, works correctly, such: ffmpeg -loop 1 -i orange640x360.png -i be+present.mp3 -tune stillimage -shortest -c:v libx264 -c:a copy ./be+presentorange640x360.mp4 .m4v required format jplayer i'm using. since not sure looked , yeah - ffmpeg considers m4v files raw video stream container without audio. rawenc.c on github: #if config_m4v_muxer avoutputformat ff_m4v_muxer = { .name = "m4v", .long_name = null_if_config_small("raw mpeg-4 video"), .extensions

arrays - Turning a plain text string into a table using Javascript -

i'm scratching head around javascript exercise: receive plain text using ajax: “201 george / / ” “301 mary / 302 lucy / ” “401 craig da / 402 ann / 403 al mia” i need create 3 objects this: { "floor2": [{ "apart": "201", "name": "george" }], "floor3": [{ "apart": "301", "name": "mary" }, { "apart": "302", "name": "lucy" }], "floor4": [{ "apart": "401", "name": "craig d" }, { "apart": "402", "name": "ann" }, { "apart": "403", "name": "al mia" }] } the table below visual aid. apartment 1 | name | apartment 2 | name | apartment 3 | name ------

ios - Glitch on UITextField resignFirstResponder -

Image
we have 1 uitextfield on our application "jumping" after calling resignfirstresponder on it. here's gif glitch: and here's code triggers it: -(bool)textfieldshouldreturn:(uitextfield *)textfield { //[self searchcontent]; [_searchfield resignfirstresponder]; return no; } it's weird because commented out keyboardwillhide , keyboardwillchangeframe code, , still happens on ios 10. ios 9 , 8 working fine. edit: created new uitextfield , put in screen. when calling resignfirstresponder on it, same glitched behavior. running on ios 10 gm

python - Retain hyperlinks in Pandas - Excel to dataframe -

Image
i have large excel file several sheets of data need convert html. excited try pandas streamline conversion , keep saving excel sheets html , spending day removing horrific ms tags. i able read excel file + sheets , load them dataframe. problem is stripping hyperlinks out of cells. i've looked on cannot find answer on retaining hyperlinks. first time i've used pandas, inexperience. below code , screenshot of output. thank help. in [2]: import pandas pd in [3]: xls_file = pd.excelfile('desktop/cfec-temp/blackbook/blackbook.xlsx') in [4]: xls_file out[4]: <pandas.io.excel.excelfile @ 0x1132ce4e0> in [5]: xls_file.sheet_names out[5]: ['sheet1', 'sheet2', 'sheet3', 'sheet4', 'sheet5', 'sheet6', 'sheet7'] in [6]: df = xls_file.parse('sheet1') in [7]: df what use openpyxl hyperlinks, iterate through rows in loop, creating list of hyperlinks, , add new column in pandas dataframe:

Bootstrap Modal to present search results -

i present google custom search engine results bootstrap modal on website. not sure put form action (action=""). using separate page on site. <!-- search --> <div class="hidden-sm hidden-md hidden-lg col-xs-12 search-mob"> <form action="" method="post"> <input class="search-input col-xs-8" name="q" placeholder="buscar mexpro..." size="35" type="text"> <button title="search" class="gsc-search-button btn btn-primary col-xs-3" size="35" type="submit" value="inicie" data-toggle="modal" data-target="#mobile-search" >inicie</button> </form> </div> <!-- end search --> modal: <div class="modal fade" id="mobile-search" tabindex="-1" role="dialog" aria-labelledby="mobile-search" ari

c# - No GPIO controller on Raspberry Pi 3 with Windows 10 IoT -

i got myself raspberry pi 3 model b, , wanted feet wet windows 10 iot following of tutorials microsoft (in case, blinky ). i have run issue returns "there no gpio controller on device." , , have no idea why, have more triple checked wiring make sure not issue. does know why gpiocontroller.getdefault() returns null? googling issue has sadly not given me solution, or others same issue, imagine kind of error on part have no idea what. my problem seems have been related windows 10 iot itself, after letting update via device portal, gpio works outlined in tutorial.

.net - FileHelpers not influence on data -

when define comma file separator new file noticed when placed comma within data comma placed in output file, mean filehelpers not influence on data automaticly or? instance quotes or whatever thought filehelpers contains inner engines "correct" such things automaticly. you must add [fieldquoted] make library auto use quotes when fields contains delimiter http://www.filehelpers.net/docs/html/t_filehelpers_fieldquotedattribute.htm also check quotemode parameter http://www.filehelpers.net/docs/html/t_filehelpers_quotemode.htm [delimitedrecord(",")] public class records { // contains " on output , require read [fieldquoted(quotemode.alwaysquoted)] public string name; // add " if data cantains , , read no quotes [fieldquoted(quotemode.optionalforboth)] public string track; [fieldquoted] public string worldprice; }

javascript - Google Chrome tainted canvas from local images -

i trying make vanilla javascript game html 5 canvas element, , in order make color-based hit boxes, need grab image data spots on canvas. whenever use getimagedata(), error: uncaught securityerror: failed execute 'getimagedata' on 'canvasrenderingcontext2d': canvas has been tainted cross-origin data. all of images being displayed on canvas being pulled local file. there way working on chrome? i draw images placing html image tags on page , using context.drawimage(*img id, x, y*); it cors . can start chrome --allow-file-access-from-files development purposes , later load files same server site being hosted on, there no problem. note flag changes security settings of chrome.

c++ - How to eliminate certain (non system) headers from dependency files(.d)? -

we link in library(tao) composed of many header files. every time run pre-processor command on cpp file( g++ -mm $< $@ ), these library files automatically included in every .d file generated. these not system files , never change far we're concerned, eliminate them .d files. short of filtering out these header files using sed, there built in way accomplish this? you may instruct gcc consider path system headers -isystem ; , g++ -mm ignore system-headers.

No such property for Jenkins while running groovy script from command line -

using script console i'm able execute below script without issues. whenever run script command line got below error. added " execute groovy script " job throwing same error. " execute system groovy script " works fine. there wrong i'm doing? can me plz import jenkins.model.jenkins.*; jenkins = jenkins.model.jenkins.instance def item = jenkins.getitem("3rd-libraries") def build = item.getlastbuild() println build.isinprogress() caught: groovy.lang.missingpropertyexception: no such property: jenkins class: job groovy.lang.missingpropertyexception: no such property: jenkins class: job @ job.run(job.groovy:2) jenkins:2.18 groovy: groovy version: 2.4.6 jvm: 1.7.0_40 vendor: oracle corporation os: linux i think you're missing def declaration jenkins. the second line should read; def jenkins = jenkins.model.jenkins.instance

visual studio 2015 - Emulators for Windows 10 Mobile not available to install -

Image
i'm using visual studio 2015 professional update 3 , i'm trying modify vs , add emulators windows 10 mobile . unfortunately, doesn't list emulators windows 10 mobile option. note: using remote desktop connect computer. hype-v enabled. found problem. verified following setup: intel vt enabled on bios verified hyper-v feature not enabled on windows 10 manually installed intelhaxm-android.exe more info: https://software.intel.com/en-us/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-windows once installed/enabled and/or verified, able modify vs2015 , see features.

python - Non decreasing sequences -

i trying write simple python script find non-decreasing sequences made of positive integers summing 7. code not seem work it's supposed no matter try. here's have components = [1,2,3,4,5,6,7] ans = [] def sumseq(seq): suma = 0 in seq: suma += return suma def findseq(seq): x in components: if (x < seq[-1]): continue newseq = seq newseq.append(x) suma = sumseq(newseq) if (suma > 7): continue if (suma == 7): ans.append(newseq) findseq(newseq) findseq([0]) print ans when following assignment: newseq = seq you bind different name (newseq) same object (seq), not create new object similar values. change contents of newseq, change contents of seq, too, since both aliases of same object stored in memory. python documentation says: assignment statements in python not copy objects, create bindings between target , object. collections m

php - Shorten the code without a prepared statement -

i want check if number present in column col , run mysqli_num_rows . far working following code: //$conn = connection mysql. $row1sql = "select * chktable col='1'"; $row2sql = "select * chktable col='2'"; $row3sql = "select * chktable col='3'"; $row4sql = "select * chktable col='4'"; $query1sql = $conn->query($row1sql); $query2sql = $conn->query($row2sql); $query3sql = $conn->query($row3sql); $query4sql = $conn->query($row4sql); $num1 = mysqli_num_rows($query1sql); $num2 = mysqli_num_rows($query2sql); $num3 = mysqli_num_rows($query3sql); $num4 = mysqli_num_rows($query4sql); i edit other code based on $num . how can shorten code? can use for statement? how use if applicable? or other way shorten code? thanks. this col value , number of rows of it, col values 1,2,3,4 $query = $conn->query("select col, count(*) num chktable group col col in (1,2,3,4);&quo

d3.js - how to change the color of text labels in a dc.js chart using css -

given fiddle how change color of text labels in graph. white (e.g. aziz). i have tried here not work text { fill: black; } i got here .dc-chart g.row text { fill: black; } why need such complicated selector? best way achieve this?

hibernate - JPA Query: java.lang.ClassCastException: [Enum] cannot be cast to java.lang.Enum -

i need help... i building application , using jpa queries there wrong enum types. i have this. public enum schedulingstatus { skipped, pending_confirmation, confirmed, sent, processing, cancelled, finished, finished_with_errors, not_confirmed_in_server } then class farmirrigationscheduling.java many other fields , important one: @column @enumerated(enumtype.ordinal) private schedulingstatus status; and trying query: typedquery<farmirrigationscheduling> query = getentitymanager().createquery( "from farmirrigationscheduling farm = :farm , status not in :statuscollection order calculated desc", farmirrigationscheduling.class); query.setparameter("farm", farm); schedulingstatus[] status = new schedulingstatus[] { schedulingstatus.finished, schedulingstatus.finished_with_errors, schedulingstatus.cancelled }; query.setparameter("statuscollection", status); return getsingleresult(quer

swift - Prepareforsegue data passing with multiple tableviewControllers in-between? -

okay found code youtube video data passed 1 viewcontroller , works fine but, need pass across multiple view controllers , not 1 other. youtube video along project in desc: https://www.youtube.com/watch?v=kpwrc1prdsg here code: class viewcontroller: uiviewcontroller { @iboutlet weak var textfield: uitextfield! override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { let nextvc: secondviewcontroller = segue.destinationviewcontroller as! secondviewcontroller nextvc.recevedtext = textfield.text! } then secondviewcontroller code: class secondviewcontroller: uiviewcontroller { var recevedtext: string = "" @iboutlet weak var textlable: uilabel! override func viewdidload() { super.viewdidload() textlable.text = recevedtext } i have heard of delegates before have difficulty them. if need pass on value across multiple view controller, 1 possible way use global variables can updated , used in of view controller. cauti

java - Result of variables using Semaphore -

semaphore s = new semaphore (0); int x = 7; int y = 1; 1.1 s.acquire(); 2.1 s.release(); 2.2. s.release(); 1.2 s.aquire(); 2.3 s.acquire(); 1.3 int tmp = x; 2.4 int tmp = y; 1.4 s.release(); 2.5 s.release(); 1.5. tmp = tmp * 2; 2.6 tmp = tmp * 3; 1.6. s.acquire(); 2.7 s.acquire(); 1.7 y = tmp + 1; 2.8 x = tmp + 1; 1.8. s.release(); 2.9 s.release(); semaphore program i have trouble getting result of these variables x , y, if these 2 threads run parallel. the semaphore has 0 permits? possible output here should x=7, y=1, shouldn't it? i don't understand nested acquires() , releases(). result of x , y ifsemaphore have 2 permits? since there no delays in code, can run in many ways, depending on cpu faster, or how os schedules threads (e.g. in single-cpu system): 2.1 s.release(); 1 permit 2.2

How can we access input values in the then block of context promise in JavaScript? -

how can access input values in block of context promise in javascript? see code snippet below. processinserver() may invoked several times. function processinserver(somedata){ return getpromise(somedata).then(function(data) { return {"input": somedata, "output": data}; }); } var a1 = processinserver(somedata1); var a2 = processinserver(somedata2); you adjust getpromise constructor returns object. set somedata , promise properties of returned object. somedata should accessible @ object reference, promise object. use .then() chained promise set @ object review both promise value , input value. function getpromise(somedata) { this.somedata = somedata; this.promise = promise.resolve(somedata * math.random() * math.pi); } var gp = new getpromise(123); var result = gp.promise.then(function(data) { return { "input": gp.somedata, "output": data }; }); result.then(function(result) {

iis - Making async WebApi wrapper over existing code -

we exposing our current logic/business layer using webapi. per understanding, if want keep our self safe thread starvation requests, should make async webapi controller, large number of concurrent request can make up. i understand underlying service/business layer synchronous, there no performance gain. aiming large number of concurrent requests pass through. below code using: public async task<ihttpactionresult> get() { var result = await task.run(() => service.getallcompanies()); //existing business layer return ok(result); } wrapping underlying layer in task, proceed , achieve goal. my understanding if await -ed methods' implementations aren't async, not accomplishing think are. if have cpu-bound service methods, you're releasing thread request-handling pool , spinning new 1 (from same pool, mind you) when task.run(); incur overhead switch, asp.net thread pool still doing work, haven't achieved want. if service methods can c

amazon web services - AWS RDS freeable memory for SQL Server -

i'm running small database in aws rds (t2.medium 4g memory) , found freeable memory sql server 250mb no matter number of connections 20 or 200. my database previous running in t2.medium ec2 without problem. i'm wondering if memory usage more in rds? thanks. freeable memory represents ram of physical server on sql running. if freeable memory low, means getting used somewhere. if session performing memory intensive ddl's , dml statements affect memory , swap usage. 250mb seems low me given can allow 200 connections rds. should not hold rds close limits. in case of increase in dml, ddl , tcl queries, our ram can comsume 100% , may cause latency issues. i suggest enable slow_query_log , general_log parameters identify queries consuming memory. decrease in freeablememory seems caused workload instance had during time.

jquery - How to complete my JavaScript game? -

can me finish game, please? turns out i'm doing game in javascript, html , ajax; "minefield". problem have when throw more 1 request, rebuilds variables , that, rebuilds random field , returns not make sense. i want create game, , algorithm this: when user joins web, user puts values in "x" , "y". code put position according user coords. then, program generate random field, if user position red, user lose, in case, if position green user win , if green, user can continue playing , if red user cannot continue playing. in right position of web page, there box shows times user survive. the problem is: if user wins first time, can continue gaming , when user puts again coords, game generates random field, , of variables of play lose (i mean: variable register times user survive, variables generate field , of variables). want conserve variables. , if user lose, option user has if wants play again way of refresh page. if want execute on server, c

151 as an 8-bit signed binary number -

converting base 10 base 2 n = 8 a= 49 b= 151 by doing 49 00110001 , -49 11001111. i having problems finding 151 , -151 because after conversion 8-bit number. 151 10010111, in signed binary doesn't farthest left digit indicate whether negative or positive. 1 negative , trying positive 151, within 8-bits. how go this? if have 8 bits, unsigned range 0 255, makes signed range -128 127. cannot express -151 or 151 signed number 8 bits.

c - fprintf outputs 0x08 when printing backspace -

Image
when trying print backspace ("\b \b") file (in c ), show unicode character (0x08). does have format of file printing or emulation of terminal? also, on unrelated question trying find out how read arrow key inputs getch() . if trying delete characters existing file, should use fseek. printing '\b' won't help.

asp.net mvc - I want to insert unique value in my MVC using Entity Framework.I have looked all the answer available in stackoverflow, But still i cant get. -

please 1 provide me complete tutorial insert unique value in database.if duplicate data tried insert should show error message. please provide me complete tutorials because beginner using linq your_context_db context = new your_context_db(); public bool function(your_entity entity) { if(context.entity.where(x => x.id == entity.id).count() > 0) { return true; //the value has been existed. } else return false; //the value has not been existed. }

android - how to avoid the null value for bitmap images -

i have made program upload image , has 2 buttons 1 pick image fom gallary , upload database if click upload button without choosing image face null value ,how can avoid it.? 1 me. here upload code: public void insertimage() { class updateemployee extends asynctask<void, void, string> { string image = getstringimage(bitmap); progressdialog loading; @override protected void onpreexecute() { super.onpreexecute(); loading = progressdialog.show(settings.this, "updating...", "wait...", false, false); } @override protected void onpostexecute(string s) { super.onpostexecute(s); loading.dismiss(); toast.maketext(settings.this, s, toast.length_long).show(); } @override protected string doinbackground(void... params) { hashmap<string, string> hashmap = new hashmap<>(); hashmap

asynchronous - Android Realm Update Asynchronously Using RxJava -

i have query update data in realm table; for (mygameentrysquad squad : response.body().getsquad()) { subscription = realm.where(realmplayer.class).equalto("id", squad.getplayer().getid()) .findfirstasync() .asobservable() .subscribe(new action1<realmobject>() { @override public void call(realmobject realmobject) { } }); } i perform query asynchronously display results on ui. basically, whatever been returned response.body().getsquad() has id matching record in db; , using in equalto method. based on data received, update 2 columns on each of record matching ids. however, facing few challenges on this: the action1 in subscribe returning realmobject instead of playerobject how proceed here any guidance on appreciated. thanks update if (response.issuccessful()) { //a

html - How can I make text wrap to scrollWidth rather than clientWidth? -

note: despite title, question contains no javascript, i'm using terms illustrate problem. i have div of fixed width, , content within wide, have set overflow: auto , , work properly. however, if div contains both text , image, 1 large fit without overflowing, text still wraps width of visible portion of div ( clientwidth ), rather full extent ( scrollwidth ). seems ugly me, i'm not sure how fix it. simply turning off text wrapping not solution either, because text stretch div far more necessary if wider image. example interesting question. this workaround find far uses cross browser css. http://codepen.io/anon/pen/qkygbr .outer { margin: auto; width: 400px; overflow: auto; } .outer > div { display:table; } .outer > div > * { box-sizing:border-box; border: 5px outset red; display:block; margin:0; } flexbox solution: http://codepen.io/anon/pen/jrwvjy .outer { margin: auto; width: 400px; overflow: auto; display: f

javascript - How to use ajax post data from a row -

<table> <tr data-id="1"> <input type="text" name="name_1" value="abc"> <input type="text" name="value_1" value="1"> <a href="load_edit_row(this)">edit</a> </tr> <tr data-id="2"> <input type="text" name="name_2" value="def"> <input type="text" name="value_2" value="2"> <a href="load_edit_row(this)">edit</a> </tr> <tr data-id="3"> <input type="text" name="name_3" value="ghi"> <input type="text" name="value_3" value="3"> <a href="load_edit_row(this)">edit</a> </tr> </table> function load_edit_row(input) { var id = $(input).parent().attr('data-id'); var datastring = []; $(

spring - How would I parse this JSON, looks like an array but no "[]"s -

i'm using springboot resttemplate parse json. resources i'm looking @ deal arrays, understand arrays need brackets ([]). i have json here ( https://rsbuddy.com/exchange/summary.json ) (short example in case link goes down) {"2": {"overall_average": 216, "sp": 5, "members": true, "buy_average": 215, "sell_average": 215, "name": "cannonball", "id": 2}, "6": {"overall_average": 173518, "sp": 187500, "members": true, "buy_average": 190176, "sell_average": 189343, "name": "cannon base", "id": 6}, ... , "12287": {"overall_average": 0, "sp": 5200, "members": false, "buy_average": 3234, "sell_average": 3234, "name": "mithril platebody (t)", "id": 12287}} that feels should array because it&#

How to correct this for loop over tuple function in Python? -

here program each line split pairs using tuples, such every alphabet had corresponding numeric a:6, b:6, c:35 ..etc if value less 10, alphabets converted n. following code. find code not loop on tuple function in last part of code. takes in single sequence , not loop on other tutorial = open('c:/test/z.txt','r') ## input file looks >qrst abcde-- 6 6 35 25 10 >qqqq abbde-- 7 7 28 29 2 org = [] seqlist = [] seqstring = "" line in tutorial: if line.startswith(">"): if seqstring!= "": seqlist.append(seqstring) seqstring = "" org.append(line.rstrip("\n")) else: seqstring += line.rstrip("\n") seqlist.append(seqstring) l = seqlist #print l j = [] ll = len(seqlist) in range(0,ll): sq = l[i] sequence = sq.split(" ")[0] ## stores alphabets qualities = sq.split(" ")[1:] ## stores numeric qualities = filter(non

c# - developing UWP Remote dekstop viewer -

i wants develop uwp remote desktop viewer application. had gone through many tutorials of winform application , can't port them uwp. desktop can viewed windows 10 mobile. have 0 knowledge regarding can me should start , if having uwp remote desktop code can understand working easily. i afraid cannot develop such application in universal windows platform. microsoft has own remote desktop app, using apis not publicly available connection remote computer. to develop such app need capture / record screen on desktop capture input , relay input remote device source. you create desktop side of app using windows forms / wpf , connect remotely phone, act display , capture , send user input desktop counterpart. there small chance implement desktop app in uwp of brokered windows runtime components , tedious work. once again however, developing major task, more suitable team of developers.

javascript - php form not working no matter input, php script alert not working -

so have been searching questions "randomly redirects index.php" , "form not submitting correctly" none of questions seem address problem thinking maybe problem specific one. (may contain more 1 error). basically have login page supposed redirect register.php if username , password not match of in database, , redirect index.php if both username(email) , password matches. login.php <?php include "header.php"; ?> <!--follow header.php--> <div class="ui centered grid" id="loginbox"> <div class="ui inverted segment"> <form class="ui inverted form" action="login.php" method="post" enctype="multipart/form-data"> <div class="two fields"> <div class="required field"> <label>username</label> <input placeholder="username" type="text" n

node.js - How to include node-sass in nwjs (on windows) -

i'm working on multi-platform project in nw.js (node-webkit) , has use node-sass. problem can't seem find way include without error on windows (x64). here's i've tried: require is error: dynamic link library (dll) initialization routine failed. build node-sass' built in script , require error: dynamic link library (dll) initialization routine failed. build node-gyp error: dynamic link library (dll) initialization routine failed. build nw-gyp (configure command fails) error: name 'component' not defined while evaluating condition 'os=="win" , component=="shared_library" in binding.gyp while trying load binding.gyp i've tested on windows 10 (x64), node v6.5.0, nw.js v0.16.1 , v0.17.0, node-sass (latest). thanks help! i faced similar issue (but on linux) , failed find answer why node-sass not work , how fix it. sass.js works me (worker+script). of course isn't convenient node-sass (i.e need handle i

How to add a serial number to my usb stick -

i have cheap usb stick. unfortunately stick has no serial number. is possible add own serial number stick? no, not possible in general. change usb descriptors , add usb serial number, have modify firmware of usb stick. it's unlikely procedure writing documented, or firmware available in source form. effort takes figure stuff out outweighs cost of buying better usb device. also, why need serial number? perhaps can store uuid of sort in filesystem of usb drive instead of in firmware of drive itself. however, link reprogramming usb devices might useful: https://nakedsecurity.sophos.com/2014/10/06/badusb-now-with-do-it-yourself-instructions/

python - Converting a PNG image to 2D array -

i have png file when convert image numpy array, of format 184 x 184 x 4. image 184 184 , each pixel in rgba format , hence 3d array. this b&w image , pixels either [255, 255, 255, 255] or [0, 0, 0, 255]. i want convert 184 x 184 2d array pixels either 1 or 0, depending upon if [255, 255, 255, 255] or [0, 0, 0, 255]. any ideas how straightforward conversion of this. if there 2 values in array say, scale , return 1 of dimensions: (arr[:,:,0] / 255).astype(int)

php - Custom display of posts of Facebook, Twitter, Linkedi and Google+ on your website -

is possible shows posts, feeds etc in customized manner on website? example if don't want use plugins provide embed on website show posts in rectangular box want show posts these social media sites in different manner. reference please visit website , scroll down section below latest news , testimonials find facebook, twitter, linkedin , google+ lorem ipsum text. seems website has not implemented feature (don't know if possible social sites) asking if need implement this possible? have implement on php website, if helps. in advance. although you're asking different embedding, still believe you're looking "embedding posts". social sites not want rebuild stream experience , put somewhere else -- additionally, content policies on these sites prohibits caching or storing posts because can become privacy issue. finally, if you're pulling lot of posts, frequently, these services, encounter api call limits. the following resources should started e

bash - Need grep statement to exclude lines -

i running ufw in "open" mode collect stats see if there attempts access server. ufw running in "medium" logging can see access server. when check ufw.log, need run through whole list manually. i use: grep 'in=eth0' uwf.log but still leaves many records me check manually what need is: grep must lines contain in=eth0 ( part easy) grep must ignore lines src=0.0.0.0 (these dhcp broadcasts) grep must ignore lines src=10.0.1.15 (10.0.x.x nagios checking ftp service) can please help, thank you. i use awk : awk '/in=eth0/ && !/src=0\.0\.0\.0/ && !/src=10\.0\.1\.15/' uwf.log since awk supports boolean operations, multiple conditions can expressed in pretty simple way.

asp.net - GridView, Add a new row dynamically grid and sql database by getting value from two textbox outside gridview -

i have gridview , above gridview have 2 textbox. when fill textbox , cleck add button, content should add gridview , sql database dynamically, , when click edit button presented in each row of gridview, should values above textboxes, add should change update button, after update gridview has populate again updated data. this html page design <body> <form id="form1" runat="server"> <asp:scriptmanager id="script1" runat="server"></asp:scriptmanager> <div> <table align="center" style="width:50%;"> <tr> <td class="auto-style1"> <asp:label id="label1" runat="server" text="country name" font-bold="true" forecolor="red"></asp:label> </td> <td> <asp:textbox id=&q

java - Get data in my RecyclerView -

i started work retrofit. in application have 1 recyclerview 2 viewholder's, trying data models, in logs coming type : @override public void onresponse(call<dropdown> call, response<dropdown> response) { dropdown jsonresponse = response.body(); log.d("type",jsonresponse.getform().getmgroupss().get(1).getmcontrols().get(2).gettitle()+""); adapter = new dataadapter(response.body()); recyclerview.setadapter(adapter); } how can display type in recyclerview, if there few types? next message: 09-13 09:20:40.958 2798-2798/com.random.secondproject e/recyclerview: no adapter attached; skipping layout dataadapter: public class dataadapter extends recyclerview.adapter<recyclerview.viewholder> { public static final string type_textview = "0"; public static final string type_editview = "1"; private dropdown mlist; public dataadapter(dropdown list) { this.mlist = list; } @ov