Posts

Showing posts from July, 2015

java - Junit testing correct log output from method? -

this question has answer here: what best way unit-test slf4j log messages? 5 answers i have following simple method within java application: method wish test: public void showoutputofidentifications(int age) { if(age>25){ logger.info("over 25"); }else{ logger.info("25 or under"); } } how can test method ensure logging should if value over/under 25? for reference: using junit framework mockito . logger slf4j . provided logger object, classic way replace mock. mockito known mock library, other around, pick one. mockito, like: logger_mock = mock(loggerclass.class); // inject logger_mock class test, use reflection change // private attribute classtotest.showoutputofidentifications(10); verify(logger_mock).info("25 or under");

c# - Why the length of zipped stream is always 10? -

i testing code. stuck following. ever write text , length of zipped stream 10? doing wrong? var instream = new memorystream(); var inwriter = new streamwriter(instream); str text = "helloworldsasdfghj123455667880fgsjfhdfasdferrbvbyjun hbwecwcxqsz edcrgvebrjnuj5juerqwetsrgfggshurhtnbvzkfjhguhgrgal;kjhao;rhl;zkfhg;aorihghg;oahrgarhguhh';aaeaeiaijeihjrhfidfhfidfidhh953453453"; inwriter.writeline(text); inwriter.flush(); instream.position = 0; var outstream = new memorystream(); var compressstream = new gzipstream(outstream, compressionmode.compress); instream.copyto(compressstream); compressstream.flush(); outstream.flush(); compressstream.flush(); outstream.position = 0; console.writeline(outstream.position); console.writeline(outstream.length); until close compression stream doesn't know you've finished writing - cannot complete compression algorithm. flushing flushes parts can flush, until been told have completed adding new bytes cannot f

java - Apache Karaf, can't inject entity manager -

i want use entity manager container, when try access java.lang.illegalstateexception: need active coordination persistence.xml <persistence-unit name="data-point" transaction-type="jta"> <jta-data-source>osgi:service/javax.sql.datasource/(osgi.jndi.service.name=dvdrental)</jta-data-source> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.postgresql82dialect"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="hibernate.connection.driver_class" value="org.postgresql.driver"/> <property name="hibernate.archive.autodetection" value="class"/> </properties> bluprint.xml <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/

javascript - How to hide table row has unchecked input using jquery -

i'm trying filter when button pressed show row has checked input in table. <table class="table"> <tr> <th>name</th> <th>inuse</th> <th></th> </tr> <tr> <td>foo 1</td> <td> <input checked="checked" class="check-box" disabled="disabled" type="checkbox" /> </td> <td> <a href="/additivesnames/edit/5">edit</a> | <a href="/additivesnames/details/5">details</a> | <a href="/additivesnames/delete/5">delete</a> </td> </tr> <tr> <td>foo 2</td> <td> <input checked="checked" class="check-box" disabled="disabled" type="checkbox" /> <

cumulocity - Esper create expression - ReferenceError: \"function\" is not defined -

is there problem calling expression inside expression ? cause when do: create expression int js:hextobin(hex) [ var bin = ''; (var = 0; <= hex.length - 1; += 1) { bin += ('0000' + parseint(hex.substr(i, 1), 16).tostring(2)).slice(-4); }; parseint(bin, 2); ]; create expression int js:gettemperature(hex) [ hextobin(hex.substring(4, 6)); ]; i got error \"hextobin\" not defined. (gettemperature#2). when put of code in gettemperature works properly. as said in expression in javascript , has no idea of esper. but expression not need contain single function. entry script can define multiple javascript functions within single expression if want structure code.

neural network - Caffe is teeing me that the LMDB created by convert_imageset is empty -

i working on cnn. for that, need 2 pairs of lmdb's (one testing, , 1 training). each lmdb in pair made out of images, 1 lmdb contains gt. so make 4 lists of images , feed convert_imageset. after feed lmdb's caffe. caffe constructs training net without problem, when comes testing net, tells me file empty. did go wrong?

jquery - How to make text of nested lis cascade -

Image
how can make background color spread on line without width:100% <ul> <li style="background-color:#33ff33">11 <ul> <li style="background-color:#cc3333">22 <ul> <li style="background-color:#336633">33 </li> </ul> </li> </ul> </li> </ul> this i'm trying achieve you can use css text-indent property making indentation in element text. if don't want use it, can use jquery .wrap() wrapping div around text of li , set margin-left div . $("li").each(function(i){ $(this).contents().eq(0).wrap("<div/>"); $(this).find("div").css("margin-left", * 40); }); ul { padding: 0px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></

java - Find one record with two conditions instead of one in hibernate -

there 3 tables a,b , c, follows: a: id ip b: id cid sip dip c: id in a.java ,i want set <c>, a's ip smaller b's dip , bigger b's sip,and b's id joint c's id. follows: @jointable(name="a", joincolumns={@joincolumn(name ="sip", referencedcolumnname = "ip"),@joincolumn(name ="dip", referencedcolumnname = "ip")}, inversejoincolumns={@joincolumn(name ="cid")}) @wherejointable(clause="ip::inet between sip::inet , dip::inet") but didn't work. has happened come against problem before? you looking joincolumsorformulas . i'm not sure how table structure is, , trying join, below working example of join joins on (primarykey) @joincolumn - sku , ids match query in @joinformula @onetoone @joincolumnsorformulas({ @joincolumnorformula(formula = @joinformula(value = "(select a.id uk_products a.asin != '' , a.product_name != 

javascript - Meteor import all files in a directory -

i'm having issue while trying import files in 1 of directories. this works: import '../pages/guidance/target_access_client_relationships.js'; while doesn't: import '../pages/guidance'; what doing wrong? planning have quite lot of files in 'guidance' , i'd rather not have import every single file individually. thanks! the way know use index.js , import file inside it. ex: dir index.js import './filea.js' import './fileb.js' dir b index.js import './filea.js' import './fileb.js' and can make parent dir , import both parent dir index.js import './dirb' import './dira'

c# - mono - The name SqlContext does not exist in the current context -

i've been using database migration tool .net called dbup in windows projects long time, , had make sure worked on mono (under mac os x). i downloaded latest releases of mono (4.4.1.0) , xamarin (5.10.1.6) studio, project build fails @ line of code: sqlcontext.pipe.send("info: " + string.format(format, args)); the error follows: engine/output/sqlcontextupgradelog.cs(9,13): error cs0103: name `sqlcontext' not exist in current context this code compiles fine on windows using visual studio. can see sqlcontext class contained in system.data.dll assembly. however, seems missing in mono. is .net class not implemented in mono or have take additional steps working?

c# - Object doesn't rotate in Unity 5.3 -

Image
for unknown reason object doesn't rotate on trigger enter, print object's tag, collision detection alright. private void ontriggerenter(collider collider) { print(collider.gameobject.tag + " entered"); transform.rotate(0,45,0); } script attached door want rotate has rigidbody , box collider attached. ideas? also noticed 3 errors when rotating manually, see pic:

laravel - Long running remote script ( PHP to Python) -

i have created site in laravel. where use below code result external python script. $ssh = new \phpseclib\net\ssh2("11.111.11.11", 22); ignore_user_abort(true); set_time_limit(0); $ssh->settimeout(0); $result = $ssh->exec("python /url_to_remote_python_file $site $keywords ", $output, $ret_code); if array takes arround 3 minutes complete works fine. i found out problem php call hanging long time, when python script has finished not sending php call hangs, how can be? but when request larger array python script timeout below code. 502 bad gateway nginx 1.8.0 i tried follow link prevent nginx 504 gateway timeout using php set_time_limit() still getting 502 bad gateway when calling exsternal python script, can exsternal server problem? i whould make work manualy before making run cron job, whould @ possible.? i have tried put script in laravel queue system. there works if script runs 3 minutes. if script runs for, lets 10 minutes queue lis

Scala function => as parameter -

could kindly explain me why following /** * returns set transformed applying `f` each element of `s`. */ def map(s: set, f: int => int): set = x => exists(s, y => f(y) == x) is not equivalent to def map(s: set, f: int => int): set = x => exists(s, f(x)) where "exists" function returns whether there exists bounded integer within s (the first argument) satisfies p (the second argument). why need specify "y => f(y) == x"? million! exists 's second argument has type int => boolean (right?), in other words, expects function int boolean . now, f(x) doesn't conform type - has type int . - y => f(y) == x creates function correct type, returns true if input equals x . if excess characters bug - can shorten bit using anonymous argument '_': def map(s: set, f: int => int): set = x => exists(s, f(_) == x)

ios - Read Data from Firebase and put it in Cells in TableView -

so want amount of holes uialert , put them in database , receive them in other view controller fill example 18 cells each have title 1 - 18, don't know how example 18 cells , cell 1 have title 1 , cell 2 have title 2 , on. here's database: structure here's want add holes tableview: class holesviewcontroller: uitableviewcontroller { //todo add cells firebase inside courses.child //g/l input data in next viewcontroller //firebaserefrences var ref = firdatabasereference.init() var holes: [firdatasnapshot]! = [] override func viewdidload() { //viewdidload //refrences firebase ref = firdatabase.database().reference() let coursesref = ref.child("courses") var holes: [firdatasnapshot]! = [] print() //snapshot coursesref.observeeventtype(.childadded, withblock: { snapshpt in //self.courses.append(snapshpt) //self.tableview.reloadda

c# - Does the New keyword call an inherited object's function? -

in c#, if have object inherits object, , inherited object has function same name base object, if want call base object's function when inherited object's function called, should use new keyword? if not, how best way call both functions? here example: public partial class formtest : form { public new void refresh() { testfunction(); } } basically, asking if refresh function of form object called when refresh function of formtest object called. also, refresh function of form object called first, or called after refresh function of formtest object. using new keyword indicate explicit base class method refresh should hidden. refresh method of base class not called in case. in order call base class method use base.refresh() in refresh method of formtest class.

sqlite - Right way to store data of android app -

i'm develop android app wish publish play store well. app have 2 activities activity - 1 display listview user. each item of listview have image , little description. each item can clicked further infomation product. upon clicking item, user sent activity - 2 activity - 2 this activity display bigger picture of product , more details product. now, i'm thinking how i'm going store data. , have come following options:- local database since, i'm sure app use limited amount of data may updated in 2 - 3 months. can store data in sqlite database. but, think way insert data in sqlite database writing insert query each row (i can wrong here). so, time consuming me , doesn't practice well.. remote database this second option, can create tables in remote database , fetch contents there in list views. but! don't want depend on internet time. want data present @ finger tips of user 24/7. 1 resolution problem can store data remote local database. but, p

Getting a unique hardware ID with Python -

i have process requires me identify different machines, , i'm not sure what's best way it. not want save id on text file or something, want generate hardware every time need (in case text id gets deleted or something) i've checked uuid , , seems ok i'm not sure. i've taken @ uuid.getnode() , have 2 problems it: one part says "if attempts obtain hardware address fail, choose random 48-bit number eighth bit set 1 recommended in rfc 4122", means may different unique on systems reason - there way identify time failed , generate else? another part says: " “hardware address” means mac address of network interface, , on machine multiple network interfaces mac address of 1 of them may returned.", means if have 2 different network adapters, each call may 1 of them? that's not me. if have better way of obtaining unique id machine, can generate each time , won't have worry deletion of or - i'd glad hear it. of attempts find have fai

java - How to retrieve process variable in Camunda-bpm? -

while reading ( https://docs.camunda.org/manual/7.5/user-guide/process-engine/variables/ ) not sure how retrieve variable? at moment struggling find out how access set process variables. tried is: i have simple bpmn process in have start event, 1 service task , end event, starting process passing 2 variables (a&b) , service task implementing following java class: public class addition implements javadelegate { public void execute(delegateexecution exe) throws exception { system.out.println("inside calculator again"); integer x = (integer) exe.getvariable("a"); integer y = (integer) exe.getvariable("b"); int add = x+y; system.out.println("addition of 2 number is"+add); exe.setvariable("add",add); } i starting process follows: public void sayhello(processengine processengine) { map<string,object> variables = new hashmap<string, object>(); variable

c# - How to get the series data from Excel -

Image
i have following requirement. while import excel(it consists chart) need chart series data excel. how can get? using c# this excel file... need candle series data.. can please this if export .csv xls can: string[] lines = system.io.file.readalllines(@"yourfolder\yourcsv.csv"); // display file contents using foreach loop. string[] arr; foreach (string line in lines) { //you array each cell value arr=line.split(";") //do want arr[1] suppose col interested } or if want use .xls file format use linqtoexcel suggested here optimal way read excel file (.xls/.xlsx)

sql - Mysql Period Column and Junction Table -

our technical adviser in school advised me start creating master tables of entities before creating junction tables. encouraged me use composite primary keys instead of composite unique keys columns. he told spend of time database before programming gui need make sure table design won't cause problems. so let's say, one class has or belongs many schoolyear = true one schoolyear has many classes = true makes me think having 3 tables, (design 1): table 1: classes id pk name yearlevelid junction table 2: schoolyearclasses id pk ai classid -- fk references classes(id) schoolyearid -- fk references schoolyear(id) table 3: schoolyear id pk ai schoolyearstart schoolyearend is better this (design 2): classes id pk ai name yearlevelid -- fk references yearlevel(id) schoolyearid -- fk references schoolyear(id) schoolyear id pk ai schoolyearstart schoolyearend i need professional advice here because i'm sure guys dealt many systems involv

apache spark - Map slices of RDD/Dataframe based on column value in PySpark -

i have dataframe 1 below: timestamp key value 2016-06-29 88 2016-06-28 89 2016-06-27 90 2016-06-29 b 78 2016-06-28 b 79 2016-06-27 b 80 2016-06-29 c 98 2016-06-27 c 99 the goal convert rdd of panda.series in efficient way. want result: (a, pandas.series) (b, pandas.series) (c, pandas.series) so want operate on slice of dataframe has same key , give output tuple of (key, pandas.series) every slice. things tried/ thoughts: spark-ts seems ideal use, seems python version broken. tried window function, it's not suitable such cases. instead of read them in bulk, read based on key convert panda.series , repeat. slow - not viable. any ideas/suggestions achieve in fast , efficient manner?

javascript - Circle Pack Layout D3 - remove add nodes on new data -

i have situation want users browse 3 different data sets using circle pack layout. using bostock's zoomable circle packing . i have added 3 options additionally loads data , creates new nodes. here chartid passed these elements. function changedataset(chartid) { console.log(chartid); //console.log(nodes); //add new chart data depending on selected option if(chartid === "plevels") { root = json.parse(newkmap_slevels); focus = root; nodes = pack.nodes(root); } else if (chartid === "pduration") { root = json.parse(newkmap_sduration); focus = root; nodes = pack.nodes(root); } else { root = json.parse(newkmap_stype); focus = root; nodes = pack.nodes(root); } refresh(); } then have refresh function, not understnading how remove existting nodes, , add new ones based on new data set. showing transition animations nice also. currently trying remove , recreate initial elements, chart goes blank when that. var refresh = functi

sql - Access Query Hangs w/ Where instead of Join on Memo field -

access 2013 update [1 clean reasons], data, [final crosswalk] set [final crosswalk].cr_id = [1 clean reasons].[cr_id] (((data.reason)=[1 clean reasons].[reason])); i'm trying build record id crosswalk table, "final crosswalk", need join data.reason = 1 clean reasons.reason, it's memo field - statement. i can view query, can't export or update. i'm assuming it's issue resource requirements of statement (the table has ~1m records).

Unable to Build and Run Android App after adding google play service com.google.android.gms:play-services:9.2.0 -

hi using android map , have used com.google.android.gms:play-services:9.2.0. after adding service ,unable run app. gives error message shown in below - information:gradle tasks [:app:assembledebug] error:registry editing has been disabled administrator. error:registry editing has been disabled administrator. error:registry editing has been disabled administrator. information:3 errors information:0 warnings information:see complete output in console

python - Why does '() is ()' return True when '[] is []' and '{} is {}' return False? -

from i've been aware of, using [], {} or () instantiate objects returns new instance of list, dict or tuple respectively; new instance object a new identity . this pretty clear me until tested , noticed () () returns true instead of expected false : >>> () (), [] [], {} {} (true, false, false) as expected, behavior manifested when creating objects list() , dict() , tuple() respectively: >>> tuple() tuple(), list() list(), dict() dict() (true, false, false) the relevant piece of information find in the docs tuple() states: [...] example, tuple('abc') returns ('a', 'b', 'c') , tuple([1, 2, 3]) returns (1, 2, 3) . if no argument given, constructor creates new empty tuple, () . suffice say, isn't sufficient answering question. so, why empty tuples have same identity whilst others lists or dictionaries not? in short: python internally creates c list of tuple objects first element contai

algorithm - How to mathematically obtain camera trace path from video -

i have aerial video of (approximately flat) view (no depth maps required). i want obtain shape of ground path camera center passed upon. the path not have correct correspondence worl'd north, or have world coordinates. have approximately same shape, if affine transformed. i have each frame, matrix represents affine transformation between frame , previous frame, @ accuracy, meaning have matrix each pixel in frame, gives location of pixel in consecutive frame. given camera moving, how can obtain shape (over time) of ground path of spot on ground in center of frames (=the trace)? more generally, question knowing relative center of frame, each frame, correspondence first frame. any leads, answers benefit me great deal. let's call transformation between frame i , i+1 t . let's @ point p[i] = (xi,yi) in frame i . if want know point in frame i+1 need apply transformation t on point p[i] , new point p[i+1] = t(p) . in order path camera did start fra

Are there NPAPI testing tools? -

i'm using firebreath build plugin downloads application , runs (something simple). know browsers dropping npapi support, need run plugin in old versions of browsers (e.g. ie 6, firefox 38, chrome 31). i'd know if there tools testing plugin's in variety of environments (e.g. firefox on linux,windows, safari on osx). far, i'm doing, setting each environment (windows, linux, mac) , building/installing plugins manually. think cross browser testing tools i've found on internet won't help, because don't allow plugin install. i couldn't find on research, in advance any browser automation tool capable of instrumenting pages on of platforms can test npapi, since runs in browser... so, selenium, example.

javascript - Automatic click for <a> with class name -

i created audio playlist using <ul> , <li> , javascript code automatically plays next song when 1 song ends , working well. but have tracks in slider, , want slider move along, song changes. is there way can have javascript click button next slide well? code next slide: <a class="lsnext"></a> javascript: $(window).load(function(){ var audio; var playlist; var tracks; var current; init(); function init(){ current = 0; audio = $('audio'); playlist = $('#playlist'); tracks = playlist.find('li a'); len = tracks.length - 1; audio[0].volume = 1; audio[0].play(); playlist.find('a').click(function(e){ e.preventdefault(); link = $(this); current = link.parent().index(); run(link, audio[0]); }); audio[0].addeventlistener('ended',function(e){ current++; if(current == len){ current = 0; link = playlist.fi

c# - Gmail Inbox view after using MVC -

i have creating mvc5 projects. in project part have email send. have finished email send gmail inbox. want show inbox gmail using mvc. have below code using email send public actionresult contactus(mailmodel objmodelmail, httppostedfilebase fileuploader) { if (modelstate.isvalid) { string = "email"; //example:- sourabh9303@gmail.com using (mailmessage mail = new mailmessage(from, objmodelmail.to)) { mail.subject = objmodelmail.subject; mail.body = objmodelmail.body; if (fileuploader != null) { string filename = path.getfilename(fileuploader.filename); mail.attachments.add(new attachment(fileuploader.inputstream, filename)); } mail.isbodyhtml = false; smtpclient smtp = new smtpclient(); smtp.host = "smtp.gmail.com"; smtp.enablessl = true; networkcredential networkcredential =

c# - Mathematical operations on packed numerical values -

given following code packing 4 byte values uint . private static void pack(byte x, byte y, byte z, byte w) { this.packedvalue = (uint)x | ((uint)y << 8) | ((uint)z << 16) | ((uint)w << 24); } is possible apply mathematical operators *, +, / , - on value in manner can unpacked correct byte equivalent? edit. to clarify, if attempt multiply value packed value uint result = this.packedvalue * other.packedvalue then unpack using following... public byte[] tobytes() { return new[] { (byte)(this.packedvalue & 0xff), (byte)((this.packedvalue >> 8) & 0xff), (byte)((this.packedvalue >> 16) & 0xff), (byte)((this.packedvalue >> 24) & 0xff) }; } i wrong results. here's full code sample showing expected , actual result. void main() { uint x = packuint(128, 128, 128, 128); uint y = (uint)(x * 1

How to SELECT with IF clause in mysql over query -

i want select columns id_thread , no_tlp , , nama (contact name) but not number save on tb_contact (eg: sms addres sms-gateway, have auto name value) so if nama = null set 'nama'='no_tlp' select id_thread, no_tlp, if(tb_contact.`nama` = 'null' set nama = no_tlp) nama tb_sms left join tb_contact on tb_sms.`no_tlp` = tb_contact.`no_tlp` group id_thread asc that's query didn't work, somebody me please try this;) select id_thread, tb_contact.`no_tlp`, if(tb_contact.`nama` null, tb_contact.`no_tlp`, tb_contact.`nama`) nama tb_sms left join tb_contact on tb_sms.`no_tlp` = tb_contact.`no_tlp` group id_thread asc or use coalesce like: select id_thread, tb_contact.`no_tlp`, coalesce(tb_contact.`nama`, tb_contact.`no_tlp`) nama tb_sms left join tb_contact on tb_sms.`no_tlp` = tb_contact.`no_tlp` group id_thread asc

java - Flashlight app doesn't always stop when receiving calls -

i trying make flashlight turn off whenever call or sms message received. works in devices (i.e. huawei devices) flash light doesn't turn off when reject incoming call. relevant code: else{ if(phonemanager.getcallstate() == telephonymanager.call_state_ringing){ if(prefs.getboolean("call", true)) { log.e("call", "start -> type:" + prefs.getstring("type", "")); string tp = prefs.getstring("flash_type", ""); if(!tp.equals("")) flash.startcallflashlight(getindex(tp)); else flash.startcallflashlight(1); laststate = telephonymanager.call_state_ringing; } } else if(laststate == telephonymanager.call_state_ringing && ( phonemanager.getcallstate() == telephonymanager.call_state_offhook ||

javascript - React + Redux: submit multi-component form -

suppose have component contains input field. second component b contains submit button. 2 components aren't linked directly (e.g 2 leaf in 2-depth tree) on submit need retrieve input value, how resolve in react + redux environment? the obvious solution came mind bind react component's refs redux state, in way state has reference input value (accessed through state.fieldname.input.value). in submit button component (remember has no direct relations input component) mapstatetoprops return onclick prop function can access state , input values , can "impure" job (e.g. db request) so code should this: //components/testform.jsx class testform extends component { render() { return <forminput ref={(ref) => this.props.registerformfield(ref)} value=... ... /> } } //redux/actions/index.js const registerformfield = (field) => { return { type: actionty

javascript - SCRIPT src not loaded after append in to HTML using jQuery -

i developing application required load new html , append current page html. now, loaded new html using jquery ajax in new loaded html have <script> display audio play . issue when script load script tag loaded html not display not loaded. i used: <script src="link of js file create audio" type="text/javascript"></script> above code not display / not loaded after append. i append like: var html = '<div> <h1>header</h1> <div>contain area</div> <script src="link of js file create audio" type="text/javascript"></script></div>' $("#container").append(html); but not working. 1 have idea in it. thanks you can use jquery getscript(); $.getscript( "url/for/script.js" ) .done(function( script, textstatus ) { console.log( 'script loaded' ); }) .fail(function( jqxhr, settings, exception ) {

android - CoordinatorLayout, FAB and container layout conflict -

Image
i have main activity drawer have container layout replace each fragment fragmentmanager . i want add fab 1 of child fragments hide/show on scroll im not sure im doing wrong , get: layout: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitssystemwindows="true" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent&

c# - Actual resolution of secondary screen for custom DPI -

i'm working on adaptation of application custom dpi values (windows scaling). if i've understood correctly, scaling makes applications think, resolution smaller, is. example, having 125% scale, if have 1920x1080 resolution, actual size of maximized window 1536x864. , sure, may cause problems, if control sizes , positions code. for now, i'm using next values positioning etc: systemparameters.fullprimaryscreenwidth , systemparameters.fullprimaryscreenheight "virtual" (scaled) resolution; screen.primaryscreen.workingarea.width , screen.primaryscreen.workingarea.height original resolution; from values, easy scaling value, can used in positioning , sizing. but of values primary screen. if need positioning , sizing secondary screen, might have different actual (and, therefore, different "virtual") resolution? for i'm getting screen this var screen = screen.fromhandle(new system.windows.interop.windowinterophelper(application.curren

ios - Minimize and run an app in the background -

can app go background execution , minimize itself, execute code perform action (recording screen specific) in ios swift. programming guide: background execution this should started. can't want longer 3 minutes , won't able put in on app store.

ios - TableViewCell Data from Firebase Database -

Image
so want holes database , put them in tableview don't know how. cant figure out how cells title number of hole. here database: here viewcontroller: import uikit import firebase class holesviewcontroller: uitableviewcontroller { //firebaserefrences var ref = firdatabasereference.init() var holes: [firdatasnapshot]! = [] override func viewdidload() { //viewdidload //refrences firebase ref = firdatabase.database().reference() let coursesref = ref.child("courses") //snapshot coursesref.observeeventtype(.childadded, withblock: { snapshpt in self.holes.append(snapshpt) self.tableview.reloaddata() }) } override func viewdidappear(animated: bool) { //viewdidappear } override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return self.holes.count } override func tableview(t

ember.js - Intellij with ember error: "you have to be inside an ember-cli project in order to use build command" -

i have created project configured use ember-cli on webapp folder before launching resulting code, error when ember compiler called. here pictures: [picture1] [picture2] 2 here project folder. have done ember init on webapp folder: enter image description here is related ember or related run configuration? this duplicated. mention in post, should run ember init in folder. don't have ember project structure yet

android - Failed to Connect To Tango - Qianru -

Image
whenever try launch tango apps on dev kit, error failed connect tango or system unavailable, please restart app or system i did factory reset when got device, , prompted ota update. build number kot49h.160624 tango core has updated through play store - qianru v1.37:2016.06.13 after few seconds of "hold tight" message, i'm either presented error - or device stays on "hold tight". i've rebooted device, updated apps via play. occurs on unity apps android sdk apps. the tango debug overlay doesn't show information at loss here. how tango work? turns out physical defect unit. cracked open , discovered 1 of contacts had come loose. i gently pushed silver tab in centre in, works fine now.

android - Save In-app Billing subscription status in Firebase Database -

so, in-app billing docs suggest save subscription status , expiration date on server , make validation call google play near subscription expires. i wondering, how validate this, before saving firebase database, not user save status , date in database? as far know can integrate google play app firebase analytic purpose. missing something?

c# - What is wrong with this Entity Framework code? (add some entity) -

public class calendar { databasecontext db = new databasecontext(); public list<day> getdays() { user user = user(session["user"]); return user.days.tolist(); } public void addday() { user user = user(session["user"]); var day = new day { date = datetime.now, userid = user.userid }; db.days.add(day); db.savechanges(); } } i call getdays method first , returns list count = 3. then call addday method , call getdays method again , count still 3! please me. what's wrong?

css - Why isn't this media query working? -

i trying trigger smaller image pages on website when viewed on smaller screen/device. i've written page(s) , isn't working. either applies pages, unintentionally or not @ all. @media screen , (min-width : 240px) , (max-width : 667px) { .page-id-59, img { height: 80%; width: 80%; } } also what's best way this? should load small size of image or download large size , scale screen? not sure best thing is. the page-id in query identify specific page isn't doing that. thanks .page-id-59, img { you saying "all items class 'page-id-59' or items tag img " you should remove comma

reactjs - Webpack split scss into separate css files -

i'm writing react application, using webpack , sass. want try css modules , i've faced troubles. first, understand, can't use .scss modules, that's why idea convert .scss files .css files (eg. link.scss -> link.css, main.scss -> main.css, etc.) , connect them react component. can't make webpack split .scss files separate .css files. i've tried different configurations, time main.css, concatenates .scss files. guess not best way me. so, me correct configuration split .scss files .css. or maybe there way use .scss modules in app. in advance. this webpack configuration var webpack = require('webpack'); var path = require('path'); var extracttextplugin = require("extract-text-webpack-plugin"); module.exports = { devtool: 'inline-source-map', entry: [ 'webpack-hot-middleware/client', './src/index.jsx' ], output: { path: path.join(__dirname, './dist'),

Oracle SQL - SUM data based on a result from a nested query -

i have nested query supposed following: bottom query creates column named "initiative" , flags records in column based on "bu_id". then subqry, uses lag function check if records came 5 years back. based on "custid" , "initiative" (which defined in step 1). finally, top query created column named "transaction_flag" flag records 'new' or 'existing'. query checks if there transactions 60 months back. please see query below: select "region" , "country" , "custid" , "customer" , "vertical" , "date_yearmonth" , "date_year" , "order_value" , "initiative" , max(case when to_date("prev_fym_initiative",'yyyymm') >= add_months (to_date("date_yearmonth",'yyyymm'), -60) 'existing' else 'new' end) "transaction_flag" ( select subqry."region" , subqry."

c# - How to make request with encoded URL in .NET 4.5+? -

Image
today encountered interesting problem. following code doesn't work correctly. public static void main() { string html; var requesturi = new uri("https://en.wikipedia.org/wiki/c%c3%b4te_d%27ivoire"); var httpwebrequest = (httpwebrequest)webrequest.create(requesturi); using (var httpwebresponse = (httpwebresponse)httpwebrequest.getresponse()) { using (stream responsestream = httpwebresponse.getresponsestream()) { string characterset = httpwebresponse.characterset; using (var streamreader = new streamreader(responsestream, characterset != null ? encoding.getencoding(characterset) : encoding.utf8)) { html = streamreader.readtoend(); } } } } the problem in url decoding. in uri constructor original string automatically decoded , result " https://en.wikipedia.org/wiki/côte_d 'ivoire". requesting url results in 304 location " https://en.wikipedia.org/wiki/c%c3%b4te_d%27ivoire "

android - Why Listbox items change order position and colour background after do scrolling in Firemonkey? -

Image
i developing multi-device application in firemonkey main class has listbox component items. each of these items has same custom style. my problem when have many items in listbox , have scroll vertical see rest of items. in case, listbox has strange behaviour , when scroll after doing scroll down item's components (a button example) have changed background colour , items have changed order inside listbox. for example, if had: item 1 item 2 item 3 after scroll have: item 2 item 3 item 1 this change random. each time different. real example (process steps): load main class listbox. do vertical scrolling down see rest of items. do vertical scrolling upward return top of list. the items have changed position in listbox , button (component of each item) changes background color. why have behaviour in listbox?? how can solve , listbox not change items order neither background colour of components? i not know if there property block items in

google spreadsheet - How to use a function as a criteria in COUNTIF -

i have bunch of columns holds scores 3-1 1-4 1-0 2-2 . i count columns winning, ie. left number higher right one. i have formula know if column winning : =left(h2; find("-"; h2)-1)-right(h2; find("-"; h2)-1) what want use formula within countif , along line : =countif(a1:a10; "left(current_column; find("-"; current_column)-1)-right(current_column; find("-"; current_column)-1)") is there way can single formula ? complex filtering can done filter , , results can counted counta . example: =counta(filter(a:a, left(a:a, find("-", a:a)-1) > right(a:a, find("-", a:a)-1))) the first argument of filter range filtered; second formula based on range (or range same row count) returns true or false. rows formula evaluates true returned.