Posts

Showing posts from February, 2015

python - Efficient nearest neighbour search when list is growing? -

i've been rewriting old maze type thing did fun, though instead of being maze it's bit more abstract , shrinks down, can't if location in locations search. i've done basic nearest neighbour search , have tried optimise little, it's still slow, in every 10x more nodes, 1000x more calculations needed (167 billion @ 10,000 nodes, collision checking), don't think there's more can done this. here's code edited work itself, nodes class , iterate through each 1 , grab size/location attribute (changed node[0] , node[1] ). imagine node_list has thousands of values. dimensions = 3 dimensions_range = range(dimensions) def collision_check(node_list, location, size, bounds=none): #check new node within bounds (if set) if bounds: in dimensions_range: if not bounds[0][i] + size <= location[i] <= bounds[1][i] - size: return true #find if nodes overlapping node in node_list: size_total = siz

javascript - select arrow dropdown list in IE is different -

Image
select arrow dropdown list in chrome this: but in ie select this: how fix visual bug in ie, make looks chrome?? every browsers have own dropdown arrow, can still customize using libraries.

.css file not uploading to server after .less compile phpStorm 10 -

i have main.less file contains @import number of .less files compile 1 main.css file. my main.less file: @import "imports/header"; @import "imports/content"; @import "imports/footer"; ...... in phpstorm 10 set file watcher compile main.less main.css . deployment options upload changed files on explicit saves (command s) on save, main.less file gets compiled if made change .less file. .less files made changes uploaded server. however, main.css not. have manually right click , upload server. i believe because phstorm looks changes before less compiled, compiles less , not notice changed main.css my folder structure less is: /stylesheets/ ____/imports/ ________/header.less ________/content.less ________/footer.less ________/ ......... ____/main.less ____/main.css my less file watcher settings are: name: less description: compiles .less files .css files uncheck immediate file synchronization check track root file

groups - Crystal Reports Dynamic Groupings -

i new in crystal reports don't know do how can make group formula: in main report if distinctcount ({prod.group_id}, {prod.id_no})=1 //group prod.group_id else if distinctcount ({prod.group_id}, {prod.id_no})>1 , ({prod.group_id}=previous({prod.group_id}) or {prod.group_id}=next({prod.group_id})) //group prod.doc_id else //group prod.group_id please me new in crystal reports , need make badly i have in main report: in group header , group {prod.group_id} sub_car sub_airplane some of sub reports working when group {prod.group_id} , sub reports works when group {prod.doc_id} you trying group result of grouping regroup not possbile way wrote formula because distinctcount ({prod.group_id}, {prod.id_no}) output of grouping. to achive need use sub report , pass distinct count use grouping in sub report. take section group footer b , place sub report there , using change sub report links pass distinctcount ({prod.group_id}, {prod.id_n

html - Having input type submit display something other than their value -

<input type = 'submit' value = '1'> ^---instead of input type displaying '1', display 'first page'. possible? with <input type="submit"> or <input type="button"> , it's not possible separate value that's sent label on button. if want that, need use <button> . <button type="submit" value="1">first page</button>

php - sending forum in background without page reload -

i have php forum sends information database , sends page stuck little problem. when submit forum page reloads. don't want. accomplish need forum reload in background. have looked way none of them me task. here code bellow. //this php file runs fourm <?php header("location: localhost:8888"); $servername = "localhost"; $username = "root"; $password = "root"; $dbname = "mydb"; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $value = $_post['firstname']; $sql = "insert myguests (firstname) values ('$value')"; if ($conn->query($sql) === true) { echo "<a href=https://twitter.com/angela_bradley>my twitter</a>"; } else { echo "error: " . $sql . "<br>" .

How do I set the time on an android digitalClock? -

i'm creating android application gets current time in different country/time-zone. i'm making there aren't many other apps on marketplace same job. i've got digitalclock underneath on app, how change time on clock - take on or off number of hours? example, may want clock display time in country. please excuse simple questions!

Database program issue in C++ -

i finished yet tour of debugging , @ loss once more. the problem when open program , press buttons, takes me whole movie database display, though in 2nd menu. i sorry bothering silly homework questions, , have 1 more. how display first 5 movies(5 lines) file out program.) how print first 5 lines(the first 5 lines txt fail) , previous 5 again? my rather pathetic try listed below.example: @ first have memento , godfather. print next 5 godfather ii , shawshank redemption, leon, bittersweet life,se7en.now previous 5:memento, godfather,godfather ii, shawshank redemption, leon. #include <iostream> #include <string> #include <fstream> using namespace std; void sisend(); /*input*/ string valik(); /*choice*/ void kogukuvand(); /* whole display of database */ void valjumine(); /* program quit*/ void sisendvoivaljumine(); /*quiting output file or not*/ void viisjuurde(); /* input further 5 lines file */ void viismaha(); /* input previous 5 lines file*/

javascript - How to validate if there is at least one checkbox selected out of 3 checkboxes in angularjs -

ok code: <input name="chkbx1" type="checkbox" ng-model="loanreferdata.prop1" ng-class="submitted?'ng-dirty':''" required>prop 1</input> <input name="chkbx2" type="checkbox" ng-model="loanreferdata.prop2" ng-class="submitted?'ng-dirty':''" required>prop 2</input> <input name="chkbx3" type="checkbox" ng-model="loanreferdata.prop3" ng-class="submitted?'ng-dirty':''" required>other</input> <span class="error" ng-show="((frmloanrefer.chkbx1.$dirty || submitted) && frmloanrefer.chkbx1.$error.required) || ((frmloanrefer.chkbx2.$dirty || submitted) && frmloanrefer.chkbx2.$error.required) || ((frmloanrefer.chkbx

c++ - Need alternatives to WinAPI -

because of recent question closed, here's different approach same question. i have found trying learn winapi difficult , isn't required of time able take advantage of native features (thanks spook ) , need different approach. i prefer c++ , have little experience qt, because i'd take advantage of platform specific features , qt not viable solution. i care portability , .net might not viable unless there way use local resources instead of ones included in .net framework installer. so please enumerate alternatives can start studying able these things. for example if make uses aero transparency this or if need program able manipulate other windows such minimize/maximize them tools can use other winapi? i'm not sure understand, because there nothing hindering using platform specific features if use qt (or other x-platform framework). separate specific features in different complilation units different platforms wish support. there' not more th

Access escaped JSON in mySql Query -

Image
i'm running mysql query this: select * reserror errordescription '%ensure name dob , gender exist in ssr docs%' this returns results like: +-----------+--------------------------------------------+ | id | errordescription | +-----------+--------------------------------------------+ | 1 | {\r\n \"details\": \"invalid - ensure.... | +-----------+--------------------------------------------+ the full text of errordescription field escaped json object this: {\r\n \"details\": \"invalid - ensure name dob , gender exist in ssr docs \",\r\n \"session\": {\r\n \"flighttype\": \"worldspan\",\r\n \"pt\": \"hf\",\r\n \"fl\": \"pdx\",\r\n \"tl\": \"phx\",\r\n \"xmlconnectionid\": \"9\",\r\n \"flightdetails\": {\r\n \"issuingcarriercode\"

javascript - what is happening in this code and what will be the basic implementation of the following without the "with" keyword -

i going through code base creating multi-platform package management , module system javascript. i found path of code extracting withing function associated "exports" variable. have attached code snippet below, , on running snippet find "print" object gets extracted function. want know 2 things:- how code working? can code implemented in more easier way without statement? var context = { exports: {} }; var fn = (function(args) { with(args) { return function logger() { exports = { print: function(res) { console.log(res); } } } } }); fn = fn(context); fn.call(); context.exports.print('hello world'); //prints hello world first, evaluating non-string pointless. remove eval call , use function. technically, with statement this: the with statement adds object environment record computed object lexical environment of current execution context. exe

Accessing Objective-C variables/functions from Swift -

suppose have connector named connector.m (written in objective-c). , create new connector written using swift, named connector.swift. access of variables , methods swift. have create bridging-header , write import of header file of connector. can't access of global variables on objective-c class. connector.m nsstring * const khttp_method_get = @"get"; connector.swift public class connector: nsobject { var parentconnector : connector override init() { self.parentconnector = connector } func test() { print(parentconnector.khttp_method_get) //--> error : value of type 'connector' has no member 'khttp_method_get' } } is possible this? thanks. add following line in connector.h. extern nsstring * const khttp_method_get; include connector.h bridging header file.

ember.js - Ember push record in model and update template -

i have route in ember app: model: function(params, transition) { var self = this; return ember.rsvp.hash({ photo: self.store.find('photo', params.id), comments: self.store.query('comment', {id: params.id}) }); }, actions: { newcomment: function(comment) { var record = this.store.createrecord('comment', comment); } } the template: {{#each model.comments |comment|}} <div class="card"> <div data-userid="{{comment.userid}}"> <b>{{comment.username}}</b> </div> <div> {{comment.content}} </div> <span class="hide-on-small-only">{{i18n 'createdat_lbl'}}: </span>{{format comment.createdat type='date'}} </div> {{/each}} {{post-comment newcomment='newcomment' comments=model.comments}} and comment model: export default ds.model.ext

Sitecore login fails when user clicks remember me -

i trying resolve issue users stack trace if click "remember me" on sitecore login page. i can replicate issue if use incorrect login. server error in '/' application. username description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.invalidoperationexception: username source error: unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. stack trace: [invalidoperationexception: username] sitecore.caching.userprofile.userprofilecache.removeuser(string username) +223 sitecore.caching.cachemanager.clearsecuritycache(string username) +32 [targetinvocationexception: exception has been thrown target of invocation.] system.runtimemethodhandle.invokemethod(object target, object[] arguments, signature sig, boolea

openstack - DevStack: unable to create Neutron Network -

i following doc install openstack in ubuntu: https://wiki.opendaylight.org/view/ovsdb:ovsdb_openstack_guide however, unable create neutron networks. following error: $ neutron net-create my-private-net neutron subnet-create $(neutron net-list | grep 'my-private-net' | awk '{print $2}') 10.254.0.0/24 --name my-private-subnet --ip-version 4 --gateway 10.254.0.1 --allocation-pool start=10.254.0.2,end=10.254.0.254 discovering versions identity service failed when creating password plugin. attempting determine version url. internal server error (http 500) discovering versions identity service failed when creating password plugin. attempting determine version url. internal server error (http 500) my local.conf [[local|localrc]] host_ip=192.168.0.3 floating_range=1.2.3.128/25 fixed_range=10.11.12.0/24 fixed_network_size=256 flat_interface=eth0 admin_password=stack mysql_password=stack rabbit_password=stack service_password=stack service_token=1a672b16de58d47d4

How can I activate React Dev tool without choosing from menu? -

i have windows compunter, , install vmware under windows, install latest mac os x under vmware,then install latest xcode, react native under mac os x. mac os x using faking display driver not good. example, android studio under mac os x flicker terribly impossible stand it. xcode works fine mac os enough developing react native app until react native 0.18.0. with version of react native, can open xcode , run rn app iphone 6s plus emulator. when press command + d,the react devtool pop on chrome. rn 0.18.0, when press command + d, menu( litter flicker wierd because emulator never flicker) pop on emulator , cannot select item in menu( guess because poor faking display driver). have no way access devtool under rn 0.18.0

assembly - MIPS - Branching convention with bne -

in lecture, our professor said there reason behind using bne in branching rather using beq (and left figure out), example shown below. if ( == j ) i++ ; j-- ; which compiles down to bne $r1, $r2, l1 # branch if ! ( == j ) addi $r1, $r1, 1 # i++ l1: addi $r2, $r2, -1 # j-- also, in link , being implied convention in mips assembly implement conditional branching in negation manner. best bet was, keeping common case simple - , therefore fast-, because intuitively if checking equality expect more become equal, , therefore pc branch when not equal. think pushed hard make reasonable, still couldn't distinguish core difference between implementing in beq or in bne . appreciate if explains why. consider code if had used beq . might end this: beq $r1, $r2, l1 l2: addi $r2, $r2, -1 # j-- ... ... l1: addi $r1, $r1, 1 #i++ j l2 or this: beq $r1, $r2, l1 addi $r2, $r2, -1 # j-- j l2 l1: addi $r1, $r1, 1 #i++ addi $r2, $r2, -1 # j-- l2:

Find last occurring value within record in PostgreSQL -

i'm not new sql, new postgresql , struggling adapt current knowledge in different environment. i trying create variable captures whether or not stays active , skips , or churns within 0/1 time series variable. example, in data below, dataset include variables id , time , , voted , , create variable "skipped": id time voted skipped 1 1 1 active 1 2 0 skipped 1 3 1 active 2 1 1 active 2 2 0 churned 2 3 0 churned 3 1 1 active 3 2 1 active 3 3 0 churned the rule coding "skipped" pretty simple: if 1 last record, person "active" , zeroes count "skipped", if 0 last record, person "churned". the record id = 1 skip because id non-zero @ time 3 after being 0 @ time 2. other 2 cases, 0 final value "churned". can help? i've bee

c# - return a specific datafrom wcf -

my method this: public list<civartransporteservice.model.cliente> getclientes() { using (civartransporteservice.model.civartransportemodelcontainer context = new model.civartransportemodelcontainer()) { return context.cliente.tolist(); } } and cs: public interface icatalogsservice { [operationcontract] list<civartransporteservice.model.cliente> getclientes(); } actually getclientes return fields of clientes database need name of client how this? thx you can use linq select extension method name column. need update method signature return list of string now. assuming name property of client entity public list<string> getclientes() { using (var context = new model.civartransportemodelcontainer()) { return context.cliente.select(x=>x.name).tolist(); } } and interface signature well public interface icatalogsservice { [operationcontract] list<string> g

java - How to make an On/off 'signal lamp' using DataInputStream? -

i'd make program can send signal through network using datainputstream have trouble algorithm. the program simple actually. need making 2 guis. 1 color button (red, yellow, , blue button), 1 3 shapes changes color when click button. so here client (signal buttons) code connect.addactionlistener(new actionlistener(){ public void actionperformed(actionevent e){ try{ string str = tf.gettext(); s = new socket(str,54321); out = s.getoutputstream(); dos = new dataoutputstream(out); system.out.println("connection succeeded"); }catch(exception ex){ system.out.println("connection error"); } } }); jbutton disconnect = new jbutton ("切断"); disconnect.addactionlistener(new actionlistener(){ public void actionperformed(actionevent e){ try{ dos.close(); out

c# - how to find the word and split the integer and characters in a string -

please tell me question answer please ... string ss="pradeep rao having 2years exp"; in above string want find word of years(or) year , if match the word,i wnt split word string s="2"; string s1="years(or)year" thanks pradeep easiest way regular expression so: regex = new regex("(\d+)(years?)"); match match = regex.match(ss); if(match.success) { string s = match.groups[1]; string s1 = match.groups[2]; }

how to use * in sh string comparison -

how correctly use * in sh? tried googling couldn't find anything. following echo ture. why that? file="test test" if [ "$file" != "te"* ] echo true else echo false fi to avoid potential problems, when using posix shell, should consider using old expr regex or match expressions. choices are: #!/bin/sh file="test test" if [ $(expr "$file" : "te.*") -gt 0 ] echo true else echo false fi or if [ $(expr substr "$file" 1 2) = "te" ] echo true else echo false fi not elegant, proper tools shell. short explanation of each , expr syntax each is: string : regularexp : returns length of string if both sides match, returns 0 otherwise match string regularexp : same previous 1 substr string start length : returns substring of string starting start , consisting of length characters

vba - DLookup round up double number from table to decimal number when display in the form -

i'm trying use dlookup display data additive chemical listing table. here data related field: table name : additive chemical listing field name : fda limit field size : double data type : number the code below didn't have error. displaying data table. has round double number's data decimal number automatically. how stop rounding data? = dlookup("[additive chemical listing].[fda limit]", "[additive chemical listing]", "[additive chemical listing].id = " + me.tradename1.column(3)) thank , warmest regards.

arrays - Split string with only first instance java -

i have below response telnet server string response = "i:barco@noiclt22815||k:cms||o:regetperspectivelist||a0:googlep||a1:yahoop||a2:gmail||a3:test||a4:hello||a16:cctv barco||a17:cctv: corridor cc||a18:cctv: dr andy warhol||a19:cctv: dr gaudi (analog)||a20:cctv: dr miro||a21:cctv: entrance cc||a22:cctv: gaudi demo room megapixel||"; i want attributes value e.g a0, a1 etc , therefore write below logic string[] strings = response.split("[||]"); list<string> list = new arraylist<>(); (string string : strings) { if (string.contains(":")) { string[] attributes = string.split(":"); if (attributes[0].startswith("a")) { list.add(attributes[1]); } } } but problem string.split(":") split gives me string array requires 2 length size string array only. e.g. response a17 attribute gives me "cctv" attributes[1] , "corridor cc" attributes[2] requires &qu

gcc - Install Visual C++ Compiler on Windows without installing whole Visual Studio -

note question can duplicate of this or this question. but please don't close duplicate without reading entire question. i'm trying install npm module browsersync on windows, , reading documentation, found module uses node-gyp requires c++ compiler on windows build native extension. , leads installation of visual studio (community edition do). after going through above linked questions (which noted duplicates of current question), found windows sdk used ship c++ compiler visual studio required have c++ compiler. so concern is, need download , install hefty 6 gb vs community edition c++ compiler build browsersync on windows? or there way via gcc windows? p.s. earlier faced similar situation installing node-oracledb . thanks. @niall covered can actual c++ compiler, if you're looking further information on problem there's walkthrough on how node-gyp , running on windows on github issues page standalone compiler.

Android how to move scrollview child to top programatically -

Image
i have scrollview contains numerous views on linearlayout .i have implemented expand , collapse layouts. onclick of view,it either expand or collapse.so when view expands,i want programmatically move scrollview such view comes on top of screen.see image below i want move scrollview length shown on red line. child of scrollview contains textview (4:status bar notification) , imageview .further scrollview may or maynot contains views above or below textview imageview combination. have used customscrollview findout scroll y public int newy=0; @override protected void onscrollchanged(int x, int y, int oldx, int oldy) { super.onscrollchanged(x, y, oldx, oldy); this.newy=y; } for have used following logic public void translateview(view view){ int[] xy =new int[2]; //view = imageview view.getlocationonscreen(xy); int scrolly = xy[1]+view.getbottom(); //screenheight =screenheight of phone if(scrolly>screenheight){ //heading te

How to update date and time in matlab gui -

function demo1() h.f = figure('name','demo1'); set(h.f,'units','pixels','position',get(0,'screensize'));% adjust figure size per screen size h.pb1 = uicontrol('style','push',... 'units','pixels',... 'position',[400 800 280 30],... 'fontsize',14,... 'string', datestr(now)); % datestr(now) used current date , time end how can real time clock in gui this not easy task perform , may want think design. wrapped in class, not necessarily. in case not want may able modify underlying java objects, seems overworking this. have instead structured in more c-style manner placing data in struct , writing functions taking struct argument. however, since matlab not support passing memory locations need return struct after modifying it. i have

c# - How to Export Multiple Data Tables to Multiple Worksheets Inside a Single Excel File -

below c# code export single table data, need export 3 tables data 1 single excel file. need export multiple data tables multiple worksheets inside single excel file. protected void lnkbtn_submit_click(object sender, eventargs e) { datetime fromdate = datetime.parseexact(txt_fromdate.text, "mm/dd/yyyy", cultureinfo.invariantculture); datetime todate = datetime.parseexact(txt_todate.text, "mm/dd/yyyy", cultureinfo.invariantculture); bo.dateused = fromdate; bo.dateused2 = todate; datatable dt = bl.get_registrationdetailsbydate(bo); gv_regdetails.datasource = dt; gv_regdetails.databind(); session["fromdate"] = txt_fromdate.text; session["todate"] = txt_todate.text; if (gv_regdetails.rows.count > 0) { session["registrationtable_date"] = dt; btnexport.visible = true; } else { session["registrationtable_date"] = null; btnexport.vis

hashmap - How to get the size of String java.util.Map.Entry.getKey() in java? -

i tried options not required output. the question how size of m.getkey() i tried m.getkey().length , m.getkey().size not find. system.out.print("\n duplicate words: "); for(map.entry<string, integer> m: map.entryset()){ if(m.getvalue()>tostringarray.length-1) ); system.out.print(m.getkey() + " "); } the output ( hi output) the output needed (5) //hi output total count 5 suggestions welcomed. i beginner java here full code import java.io.file; import java.io.fileinputstream; import java.io.file; import java.io.filenotfoundexception; import java.io.ioexception; import java.util.hashmap; import java.util.map; import java.util.scanner; import org.apache.commons.io.ioutils; public class testduplicatewordnew { public static void main(string[] args) throws exception { /* reading text content file */ fileinputstream fistargetfile = new fileinputstream(new file("e:\\testfolder\\à®®ிரளச் செய்யுà®®் à®®ிலரபாவின் கதை! isha ta

android - ResourceNotFoundException though there is a resource -

i'm trying create spinner non-selectable text displayed when dropdown not displayed " --select option-- ". have created custom spinner adapter , layout file textview " --select option-- " using second answer of so post . i'm getting 6912-6912/com.examp.three e/androidruntime﹕ fatal exception: main android.content.res.resources$notfoundexception: resource id #0x7f04004e exception though have passed layout file constructor. what doing wrong? i debugged app , value getnothingselectedlayout 2130968654 . kept break point @ return layoutinflater.inflate(nothingselectedlayout, parent, false); . value of getnothingselectedlayout still same. after point, when press f8, goes choreographer.class before crashing like @kumar ranjan said in comments of answer, checked r.java class resource id error log said not there. found id assigned support_simple_spinner_dropdown_item in r.java file. found resource id #0x7f04004e shown in error log in r.java f

java - Oracle doesn't remove cursors after closing result set and statement, while using PreparedStatement -

i facing issue in preparedstatement . open cursor count increases every time preparedstatement created , executed , not come down . closing result, statement after each execution . make sure things not happening due other piece of code, created simple jsp , executed code . connection connection = null; set<long> prodids = new hashset<long>(); prodids.add(5877462198l); prodids.add(782414147l); prodids.add(5547149987l); prodids.add(550424780l); prodids.add(5547045538l); prodids.add(5883926198l); prodids.add(5537432075l); prodids.add(81317072l); prodids.add(5618071249l); prodids.add(5630549908l); prodids.add(698964409l); prodids.add(822090000l); prodids.add(614679729l); prodids.add(5512339613l); prodids.add(81317068l); prodids.add(5688111900l); prodids.add(5512339611l); prodids.add(5894594380l); prodids.add(969040343l); prodids.add(827515204l); prodids.add(5626593095l); prodids.add(501511677l); prodids.add(1094656287l); prodids.add(5560791888l); prodids.add(641347103l

ios - How to randomly choose an element from coredata swift -

import uikit import coredata class period1controller: uiviewcontroller, uitextfielddelegate { @iboutlet weak var entername: uitextfield! @iboutlet weak var presentname: uitextview! @iboutlet weak var independcestatue: uitextfield! @iboutlet weak var driverselection: uitextfield! var entitys = [nsmanagedobject]() var namelist : [string] = [] var period1 = "" var period1namelist = "" override func viewdidload() { super.viewdidload() } func setvalues() { namelist = [entername.text!] } //this button saving element core data @ibaction func setname(sender: uibutton) { setvalues() item in namelist{ period1 += (item + " ") period1namelist += item } let context = (uiapplication.sharedapplication().delegate as! appdelegate).managedobjectcontext let entity = nsentitydescription.entityforname("entity", inmanagedobjectcontext: context) let otherentity = nsmanagedobject(entity: entity!, insertintom

c# MVC - inheritance and interfaces -

i'm new this. please bear me. i have class called crmobject inherited few other classes contact. want code interface use child-classes of crmobject. need unity.mvc repositories. right have interface each child-class, there should better way , that's why i'm here. glad links , examples this. pocos: public class crmobject { [key] [column(order = 0)] public int id { get; set; } public bool isprocessed { get; set; } public string error { get; set; } public long partneroid { get; set; } public ordnungsbegriffetypetype ordnungsbegrifftyp { get; set; } [required] public string ordnungsbegrifftypstring { get; set; } public string ordnungsbegriffwert { get; set; } public crmjob job { get; set; } [foreignkey("job")] [column(order = 1)] public int jobid { get; set; } } [table("contacts")] public class contact: crmobject { public datetime kontaktam { get; set; } public string

c# - WPF Control disappears when is is animated with DoubleAnimation -

i have textbox(toanimate) , button(toclick). when click button, textbox disappears. should move on x position 20 units. did wrong? //double left = canvas.getleft(toanimate); returned wrong value. translatetransform tanl = new translatetransform(); vector pos = visualtreehelper.getoffset(toanimate); double left = pos.x; toanimate.rendertransform = tanl; doubleanimation doua = new doubleanimation((left + 20), left, timespan.fromseconds(3)); tanl.beginanimation(translatetransform.xproperty, doua);

android - Retrofit - java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT -

i trying parse own json, getting jsonsyntaxexception , here how json looks: { "type":"success", "value":[ { "id":1, "title":"title - 1", "name":{ "first":"first - 1", "last":"last - 1" }, "hobbies":[ "writing code - 1", "listening music - 1" ] }, ..... ] } log says: e/app.retrofit_chucknorries.mainactivity$2: error: com.google.gson.jsonsyntaxexception: java.lang.illegalstateexception: expected begin_array begin_object @ line 7 column 12 path $.value[0].name 01-21 12:41:52.156 28936-28936/app.retrofit_chucknorries w/system.err: retrofit.retrofiterror: com.google.gson.jsonsyntaxexception: java.lang.illegalstateexception: expected begin_array begin_object @ line 7 column 12 path $.valu

java - Storing a date with LocalDate -

i trying store previous date in localdate object, not sure how. have been using own class until now, apply java.time.localdate library. help? my code: localdate thedate = new localdate(theyear, themonth, theday); error message: localdate thedate = new localdate(theyear, themonth, theday); try this: the java 8 java.time.localdate class has no public constructors, public class test { public static void main(string[] args) { int theyear=2016; int themonth=1; int theday=21; localdate thedate = localdate.of(theyear,themonth,theday); system.out.println(thedate); } }

tags - facebook doesn't see image when sharing -

i trying share this page facebook tags not seen. if use facebook test tool: http://developers.facebook.com/tools/debug/og/object?q=http%3a%2f%2fwww.watchfit.com%2farticle%2fthe-health-benefits-of-honey%2f124 it shows 302 error page, though don't see why. these facebook tags: <\meta property="og:title" content="the health benefits of honey" /\> <\meta property="og:url" content="http://www.watchfit.com/article/the-health-benefits-of-honey/124" /\> <\meta property="og:description" content="health benefits of honey. medical benefits of honey, manuka honey. 2 recipes leon cookbook" /\> <\meta property="og:site_name" content="watchfit.com" /\> <\meta property="og:image" content="http://www.watchfit.com/uploads/articles/224x224/1363093263.jpg" /\> anyone knows cause? look @ debugger response , you'll see tell image small, despite being

javascript - Select Custom Attribute from nested LI -

i have menu item looks below, in case have parent groupid=5 analytics. trying to-do when click on li want select link-id ... got work easily. no problem comes in, how can select link-id="22" , link-id="23" without triggering link-id=21 because in case link-id=21 sub menu. html <li groupid="5"> <a href="#"> <i class="fa fa-line-chart"></i> <span class="nav-label">analytics</span> <span class="fa arrow"></span> </a> <ul sub-groupid="5" class="nav nav-second-level"> <li link-id="13"><a href="#">overview</a></li> <li link-id="19"><a href="#">social report card</a></li> <li

javascript - How to use onBlur event on Angular2? -

how detect onblur event in angular2? want use with <input type="text"> can me understand how use it? use (eventname) while binding event dom, () used event binding. use ngmodel 2 way binding mymodel variable. markup <input type="text" [(ngmodel)]="mymodel" (blur)="onblurmethod()"> code export class appcomponent { mymodel: any; constructor(){ this.mymodel = '123'; } onblurmethod(){ alert(this.mymodel) } } demo alternative(not preferable) <input type="text" #input (blur)="onblurmethod($event.target.value)"> demo

printing - How can i get a printer's make and model in Java? -

i'm working on java application shares printers server, , need application make , model of printers shares. i know question has been asked 3 or 4 times nobody seems have found answer. i've tried code : printservice[] printservices = printservicelookup.lookupprintservices(null, null); (printservice printer : printservices){ system.out.println(printer.getdefaultattributevalue(printermakeandmodel.class)); system.out.println(printer.getattribute(printeruri.class)); } the first print returns null string , second 1 gets nullpointerexception . some researches lead me page : http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4673400 it seems it's know "bug" , don't understand evaluation. i'm thinking workaround make , model sending snmp request printers don't know thing snmp , i'm not sure there single snmp command make , model of printer. if has idea on how achieve this, either using