Posts

Showing posts from July, 2011

Thread 1 Signal SIGABRT iOS -

import uikit @uiapplicationmain class appdelegate: uiresponder, uiapplicationdelegate { var window: uiwindow? func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // override point customization after application launch. return true } func applicationwillresignactive(application: uiapplication) { // sent when application move active inactive state. can occur types of temporary interruptions (such incoming phone call or sms message) or when user quits application , begins transition background state. // use method pause ongoing tasks, disable timers, , throttle down opengl es frame rates. games should use method pause game. } func applicationdidenterbackground(application: uiapplication) { // use method release shared resources, save user data, invalidate timers, , store enough application state information restore application current state

java - Android how to use Environment.getExternalStorageDirectory() corretly -

android how use environment.getexternalstoragedirectory() how can use environment.getexternalstoragedirectory() read/write image sd card ? or there better way it? i did use source download e save image: try { url url = new url(urlbaseimagem + icone); urlconnection conection = url.openconnection(); conection.connect(); // useful can show tipical 0-100% progress bar int lenghtoffile = conection.getcontentlength(); // // download file inputstream input = new bufferedinputstream(url.openstream(), 8192); // output stream //file sdcard = environment.getexternalstoragepublicdirectory(download_service); file sdcard = environment.getexternalstoragedirectory(); file directory = new file(sdcard.getabsolutepath() + "/cardapioweb/rest/"); if(directory.exists() == false){ directory.mkdirs(); } file outputfile = new file(direc

unity3d - Camera rotation within a prefab -

Image
i trying create multiplayer game in unity3d using diablo camera system. wherever click on screen. system working fine in singleplayer did not need include camera in player prefab. facing problem camera rotation affected rotation of prefab parent. hierarchy looks this: there script added camera looks this: using unityengine; using system.collections; public class maincameracomponent : monobehaviour { public gameobject reaper; private vector3 offset; void start () { offset = transform.position - reaper.transform.position; } // update called once per frame void lateupdate () { transform.position = reaper.transform.position + offset; } } when run game camera stays behind character, while want stay @ same rotation. if order character walk north see back, if walk south wanted see front. notice how shadow changes, (thus rotation) face of model. tldr: want child camera ignore rotational change of parent , static. whilst letting camera position guided parent. far k

Java exceptions contract of Iterator remove -

i'm implementing iterator utilises iterator, of not know, whether supports remove() method or not. consider following edge case: underlying iterator not support remove() , iterator next() has not yet been called. do violate interface contract, if remove() throws – in situation – illegalstateexception instead of unsupportedoperationexception ? (as next() called, underlying remove() can called, throw appropriate unsupportedoperationexception .) if so, how refactor code check whether underlying iterator supports remove() or not? an example: <t> iterator<t> getsetviewiterator(collection<t> collection) { iterator<t> uniqueitr = new hashset<>(collection).iterator(); return new iterator<t>() { private t current = null; private boolean hasremoved = true; @override public boolean hasnext() { return uniqueitr.hasnext(); } @override public t next() {

r - When using ggplot2, can I set the color of histogram bars without potentially obscuring low values? -

Image
when calling geom_histogram() color , , fill arguments, ggplot2 confusingly paint whole x-axis range, making impossible visually distinguish between low value , 0 value. running following code: ggplot(esubset, aes(x=exectime)) + geom_histogram(binwidth = 0.5) + theme_bw() + scale_x_continuous(breaks=seq(0,20), limits=c(0,20)) will result in this visually unappealing. fix that, i'd instead use ggplot(esubset, aes(x=exectime)) + geom_histogram(binwidth = 0.5, colour='black', fill='gray') + theme_bw() + scale_x_continuous(breaks=seq(0,20), limits=c(0,20)) which result in the problem i'll have no way of distinguishing whether exectime contains values past 10, few occurrences of 12, example, hidden behind horizontal line spanning whole x-axis. use coord_cartesian instead of scale_x_continuous . coord_cartesian sets axis range without affecting how data plotted. coord_cartesian , can still use scale_x_continuous set breaks , coord

javascript - Angular 2 retrieve selected checkboxes -

i have checkbox (a customer may have many accessories): customer.component.html: <div class="checkbox" *ngfor="let accessory of accessories"> <label> <input type="checkbox" [(ngmodel)]="accessory.selected" (ngmodelchange)="oncheckboxchange(accessory)"> {{ accessory.name }} </label> </div> customer.component.ts: oncheckboxchange(accessory: any) { if (accessory.selected == true) { this.selectedaccessories.push(accessory); } else { let = this.selectedaccessories.indexof(accessory); if (i != -1) { this.selectedaccessories.splice(i, 1); } } } i have method can save selected checkboxes in 1 array example: customer: customer; accessories: any[]; selectedaccessories: any[]; ngoninit() { this.accessoryservice.get().subscribe( accessories => this.accessories = accessories ) if (this.routeparams.get('id')) { let id = th

escaping in awk and bash script -

i'm trying change numbers in column 2, 3, , 4 of files. that, have following script for in 0.8 0.9 1 1.1 1.2; original=10.9398135077 fraction=`bc <<< "$i*$original"` convert=0.529177 awk '{printf "%-2s %10.5f %10.5f %10.5f\n", $1, ($2*"\$fraction"*"\$convert"), ($3*"\$fraction"*"\$convert"), ($4*"\$fraction"*"\$convert")}' temp2_${i}.txt > coord_${i}.txt done and temp2_0.8.txt looks following: cu -0.000000000 0.000000000 -0.000000000 cu 0.500000000 -0.000000000 0.500000000 cu 0.000000000 0.500000000 0.500000000 cu 0.500000000 0.500000000 0.000000000 s 0.398420013 0.398420013 0.398420013 s 0.898420013 0.398420013 0.101579987 s 0.398420013 0.101579987 0.898420013 s 0.101579987 0.898420013 0.398420013 s 0.601579987 0.601579987 0.601579987 s 0.898420013 0.101579987 0.601579987

angular - too much glue in angular2 DI or there is another way? -

in angular 1.x services injected specifying registered name. example using typescript: // appointments.ts export interface iappointmentservices { retrieve(start: date, end: date): appointment[] } // appointment-services.ts: class appointmentservices implements iappointmentservices { retrieve(start: date, end: date): appointment[] { ... } } angular.module('appointments') .service('appointmentservices', appointmentservices); // appointment-controller.ts class appointmentcontroller { constructor (private service: iappointmentservice) { } // pay attention 'appointmentservices' registered name // not hard reference class appointmentservices static $inject = ['appointmentservices'] } pay attention controller implementation has no reference in way file nor class implements service but in angular 2, accomplish similar di have in these lines: import {component} 'angular2/core'; import

html - Perl CGI - Picking Radio Values for Specificity -

i've got little perl cgi quiz working on, i'm stuck on it. html code follows: <p class="question"><br>1. answer number 1 </p> <ul class="answers"> <input type="radio" name="q1" value="a" id="q1a"><label for="q1a">1912</label><br/> <input type="radio" name="q1" value="b" id="q1b"><label for="q1b">1922</label><br/> <input type="radio" name="q1" value="c" id="q1c"><label for="q1c">1925</label><br/> <input type="radio" name="q1" value="d" id="q1d"><label for="q1d">summer of '69</label><br/> </ul> the cgi program picking name radio button parameter value. perl code follows: if ( param(&q

python - sympy and mpmath give "TypeError: cannot create mpf" when using the erf() function within solveset() -

i have 4 input variables (floats): xmax xmin percentage mode and want solve following (rather long) equation s: > (1/2+1/2*erf((log(xmax)-(log(mode)+s**2))/(sqrt(2)*s))-(1/2+1/2*erf((log(xmin)-(log(mode)+s**2))/(sqrt(2)*s))) - percentage == 0 i want use mpmath , sympy solve equation, gives me following error message: typeerror: cannot create mpf 0.707106781186547*(-s**2 - 0.287682072451781)/s my code follows: from mpmath import erf, log, sqrt sympy import symbol, solveset, s percentage = 0.95 mode = 2 xmin = 1. xmax = 1.5 s = symbol('s') eqn = (1/2+1/2*erf((log(xmax)-(log(mode)+s**2))/(sqrt(2)*s))-(1/2+1/2*erf((log(xmin)-(log(mode)+s**2))/(sqrt(2)*s))) - percentage) solveset(eqn, s, domain=s.reals) mpf float type created mpmath. i think narrowed down problem erf() function, returns emptyset() when run solveset(log(xmax) - (log(mode) + s ** 2), s, domain=s.reals) i cannot figure out try next, appreciated! i thought issue math equa

php - Radio buttons checked however passing NULL to database -

i have 4 groups of radio buttons presented unchecked user. user needs check 1 radio button each group. when submit form, error that, example, picture_6.tif value being passed null . i using codeigniter , form being submitted via post. wonder if tell me i'm doing wrong. <form action="/log" method="post" accept-charset="utf-8"> <table class="static"> <tbody> <tr> <td><input type="radio" name="picture_6.tif" value="0" class=""></td> <td><input type="radio" name="picture_7.tif" value="0" class=""></td> <td><input type="radio" name="picture_8.tif" value="0" class=""></td> <td><input type="radio" name="picture_9.tif" va

python - xml parsing issue encoding error -

i have xml file this <?xml version="1.0" encoding="utf-8"?> <tw> <tweet> <yazi>atılacak tweet 1</yazi> <resim>resim.png</resim> </tweet> <tweet> <yazi>atılacak tweet 2</yazi> <resim>yok</resim> </tweet> </tw> i'm trying read with import xml.etree.elementtree ett e = ett.parse("tweet.xml").getroot() but error, xml.etree.elementtree.parseerror: encoding specified in xml declaration incorrect: line 1, column 31 why? how can fix this, searched lot , xml file looks ok. don't understand why can't read file. you have invalid utf-8 char in file, e.g. xml file iso-8859-1 encoded... or can try utf-8 instead of utf-8

c++ - Cannot use nullptr in Shared Library (Android, iOS) in Visual Studio 2015 -

i created cross-platform shared library (android, ios) in visual studio 2015 got compiler error "use of undeclared identifier 'nullptr'" when add following line in cpp of shared library , tried compile android library: void* p = nullptr; that quite strange since nullptr keyword since c++11. what makes stranger when created cross-platform opengl es2 application (android, ios, windows universal) , added line again (in simplerenderer.cpp) , compiled android app, got complied! so guess there should way use nullptr (and think there should other problems well) in android part of shared library (android, ios) since works in opengl es2 application (android, ios, windows universal) . settings need adjusted. know how make work? i found it! in project property window, go c/c++ > language , set c++ language standard c++11. sorry having asked stupid question.

Update label based on Key in Dropdown menu Tkinter Python -

hi trying update label based on key selected drop down menu (using dictionary). unsure how can update label. thankyou. have made attempt below doing wrong due lack of knowledge. thankyou from tkinter import * tkinter.ttk import * import csv class dictionarygui: '''display gui allowing key->value lookup''' def __init__(self, parent, row, column, dictionary): self.dictionary = dictionary self.selection = stringvar() self.value = stringvar() username_label = label(parent, text="key:") username_label.grid(row=row, column=column) keys = list(sorted(dictionary.keys())) self.selection.set(keys[0]) select = combobox(parent, textvariable=self.selection, values=keys, width=8, command=self.update()) select.grid(row=row, column=column+1) name = label(parent, textvariable=self.value) name.grid(row=row, column=column+3) def update(self): self.value.set(self

swift - NSApplication menubar does not respond as expected in nib-less Cocoa application -

i have following single file of code, in i'm trying create cocoa application basic functionality in little code possible without using nibs or xcode. have been getting of information following blog post, in equivalent objective-c code has been posted: ( http://www.cocoawithlove.com/2010/09/minimalist-cocoa-programming.html ). major change have made appdelegate class manage window, typically done in xcode projects. import cocoa class appdelegate: nsobject, nsapplicationdelegate { var window: nswindow override init() { self.window = nswindow() self.window.setframe(nsrect(x: 0, y: 0, width: 1280, height: 720), display: true) self.window.collectionbehavior = .fullscreenprimary self.window.stylemask = nstitledwindowmask | nsclosablewindowmask | nsminiaturizablewindowmask self.window.title = "main window" } func applicationdidfinishlaunching(notification: nsnotification) { window.makekeyandorderfront(self)

http - Why should I usually choose the socket protocol for implementing other protocols? -

suppose want implement client ftp and, maybe, sftp well. programming language irrelevant. go ahead , choose socket library programming language x , implement ftp client. , that's it. my question is, why did have choose socket library or socket protocol? why neither http library, nor icmp, nor ssh, nor ip, nor else? ... why did have choose socket library or socket protocol? why neither http library, nor icmp, nor ssh, nor ip, nor else? you did not need to chose socket library. there variety of higher level libraries in various programming languages let use application protocol without bothering socket layer. examples http bindings libcurl various languages, lwp perl, requests python... . ... implementing other protocols? of course if want implement instead of use application protocol explicitly decide not use of existing libraries specific protocol. should use layer below protocol want implement. implementing protocols http transport layer (i.e. use so

html - How can I create a CSS sliding menu? -

Image
i attempted create hamburger menu similar this: reference: http://tympanus.net/tutorials/responsiveretinareadymenu/ however reason here's got: here's css: /*= icon boxes --------------------------------------------------------*/ ul.icon-menu {margin-top:29px;} li.icon-box {width: 120px; height: 120px; list-style: none; left: -47px; position: relative; margin-bottom: 3px;} li.icon-box.home {background: #e74c3c;} li.icon-box.aboutme {background: #1dd0ad;} li.icon-box.portfolio {background: #3498db;} li.icon-box.blog {background: #f1c40f;} li.icon-box.contact {background: #f39c12;} .icon-box h2{museo500-regular; font-size: 20px; text-shadow: 1px 1px 2px rgba(150, 150, 150, 1);} .icon-box {display: block;} i.fa { position:absolute; pointer-events:none; color:white ; margin:20px 0 0 20px } /*= title boxes --------------------------------------------------------*/ .icon-box.home h2 { z-index: -999; position: absolute; top: 0; left: 0

haskell - Are applicative transformers really superfluous? -

there lot of talk applicative not needing own transformer class, this: class apptrans t lifta :: applicative f => f -> t f but can define applicative transformers don't seem compositions of applicatives! example sideeffectful streams : data mstream f = mstream (f (a, mstream f a)) lifting performs side effect @ every step: instance apptrans mstream lifta action = mstream $ (,) <$> action <*> pure (lifta action) and if f applicative, mstream f well: instance functor f => functor (mstream f) fmap fun (mstream stream) = mstream $ (\(a, as) -> (fun a, fmap fun as)) <$> stream instance applicative f => applicative (mstream f) pure = lifta . pure mstream fstream <*> mstream astream = mstream $ (\(f, fs) (a, as) -> (f a, fs <*> as)) <$> fstream <*> astream i know practical purposes, f should monad: joins :: monad m => mstream m -> m [a] joins (mstream stream) = (a,

c# - How to set an automatic BufferSize? -

i'm using socket.beginreceive method in order receive data connected clients. however, messages send may vary in size. example, 1 message may 100,000 bytes in size , other may 3 bytes in size, , 100,000 bytes message sent! there way of setting the buffersize value automatic value usage of socket.receive ? set buffer size maximum unit transmission (mtu) size of ip packet (64 kb). never exceeds size because larger messages fragmented transmitted easier.

Change small_image size Magento -

i need change small image size on magento community. here´s why, not fit global product window. link here i tried @ \app\design\frontend\default\magik_pinstyle\template\catalog\product\list.phtml , flushed image cache not work. i can see it`s 265px image when search resize(265) dont find anything. this located in app/design/frontend/default/magik_pinstyle/template/catalog/product/view/media.phtml . copy file on app/design/frontend/base/default/template/catalog/product/view/media.phtml if don't have on template. on line 68 (in base media.phtml) you'll find line: $_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->htmlescape($this->getimagelabel()).'" title="'.$this->htmlescape($this->getimagelabel()).'" itemprop="image" />'; your photos don't fit frame because .product-view .product-im

utf 8 - How to change SAS session encoding dynamically -

i writing sas script work in batch. encoding of sasapp session utf8 , tables (in oracle database , sas datasets) has utf8 encoding. have 1 compiled macro can work wcyrillic encoding (it crashes error if use utf8 session encoding). macro doesn't work tables, performs auxiliary actions. the question is: how dynamically change session encoding utf8 wcyrillic before macro invoked , change utf8 after executed. i don't think there way change session-level encoding option . documentation page indicates can set when session first started: valid in: configuration file, sas invocation i think best can override session encoding option every individual encoding-dependent statement in problematic macro - i.e. specifying encoding=wcyrrlic on every file , infile , filename , %include , ods statement generated macro. alternatively, if have sas/connect write code signs on session encoding=wcyrillic specified in invocation options run macro, dumping output parent ses

Android viewPager image slide right to left -

i want add image slide. cannot make slide right left. (for languages arabic or hebrew) i checked replies in stackoverflow, can not find clear solution. i write here whole code. please write me clearly, not professional mainactivity; package com.manishkpr.viewpagerimagegallery; import android.app.activity; import android.os.bundle; import android.support.v4.view.viewpager; public class mainactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); viewpager viewpager = (viewpager) findviewbyid(r.id.view_pager); imageadapter adapter = new imageadapter(this); viewpager.setadapter(adapter); } } here imageadapter.java; package com.manishkpr.viewpagerimagegallery; import android.content.context; import android.support.v4.view.pageradapter; import android.support.v4.view.viewpager; import android.view.view; import android.view.viewgroup;

c# - How to type text into hidden fields in .net using selenium and chrome driver -

i getting error while entering text hidden fields using .sendkeys() in web automation using selenium , chrome driver. i got 1 similar question here, not getting how implement in .net how ? i using vb.net c# ok me. as far know, have use ijsexecutor. see example below: string script = "arguments[0].setattribute('value', arguments[1]);" iwebelement thehiddenfield = driver.findelement(by.id("the-hidden-field")); ((ijavascriptexecutor)driver).executescript(script, thehiddenfield, "here new value");

javascript - React, Ember-data -

i use ember-data in ember.js projects, learn react. question is: technics used in react achieve same functionality ember-data? i'd to: have models if i've changed model in 1 place, changes visible in other component have model's methods like: fullname(){ return this.get('name')+' '+this.get('secondname'); }

javascript - Invariant Violation: Invalid tag: 'use strict'; -

while transpiling following index.js file, error: invariant violation: invalid tag: 'use strict'; i using babel-core , react , react-dom . my index.js file: import react 'react' import { render } 'react-dom' import { router, route, browserhistory, indexroute } 'react-router' import app './components/app' import home './components/home' import funddetail './components/funddetail' render(( <router history={browserhistory}> <route path="/" component={app}> <indexroute component={home}/> <route path="/fund/:id" component={funddetail}/> </route> </router> ), document.getelementbyid('content')) my .babaelrc file: { "presets": ["es2015"], "plugins": ["transform-strict-mode", "transform-react-jsx"] } server code: var react = require("react"); var reactdom

view - Load XIB into ViewController Xamarin? -

it possible create , load view custom xib in xamarin? in objective-c like: self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"viewcontroller" bundle:nil]; self.window.rootviewcontroller = self.viewcontroller; 1 - create xib file (example myview). 2 - in .cs related xib file add static creator method: partial class myview : uiview { public myview (intptr handle) : base (handle) { } public static myview create() { var arr = nsbundle.mainbundle.loadnib ("myview", null, null); var v = runtime.getnsobject<someview> (arr.valueat(0)); return v; } } 3 - add myview viewcontroller : public partial class viewcontroller : uiviewcontroller { myview v; public viewcontroller (intptr handle) : base (handle) { } public override void viewdidload () { base.viewdidload (); v = myview.create();

ios - Xcode project run in one device but not in another -

i'm testing xcode project in simulator , in 2 iphones 6. both iphones identical , bought on same time. couple of years ago. phone #1 running on ios 9.3.2 , phone #2 running on 9.3.1. have xcode pros deployment target of 9.3. xcode version 7.3 i can run xcode project in simulator fine , when plugged phone #2, on #1, execute fewer lines #2 , stops. i have went though paths in article , deleted of these 1 @ time: ~/library/developer/xcode/deriveddata/ ~/library/developer/xcode/ios devicesupport/ ~/library/developer/xcode/archives/ ~/library/developer/coresimulator/devices ~/library/application support/iphone simulator/ i have tried restarted xcode in every of steps above, , restarting iphone plugging when loads. nothing worked like said code phone #1 runs little bit, stops executing further lines. stepped through code see why , phone #1. there no error, execution stops, @ same place, little earlier. phone #2 runs code fine , returns results. what's going on

objective c - How to handle AVPlayer when device changes orientation? -

my app supports portrait orientation. have used avplayerviewcontroller in 1 screen. app has uinavigationviewcontroller , uitabbarviewcontroller. when device rotated landscape mode during video play, having hard time change frame? how can achieve this? should change frame of avplayerview? nsnumber *val = [nsnumber numberwithint:uiinterfaceorientationlandscapeleft]; [[uidevice currentdevice] setvalue:val forkey:@"orientation"]; or ask visible view controller : - (uiinterfaceorientation)preferredinterfaceorientationforpresentation { return self.currentviewcontroller.preferredinterfaceorientationforpresentation; } - (bool)shouldautorotate { return self.currentviewcontroller.shouldautorotate; }

c - Why printf("test"); does not give any error? -

if int x=printf("test"); executes safely, without error in c because printf returns int value (the length of data has printed.) if not storing integer value: printf("text"); why don't error this? many functions in c return something. whether programmer decides value them - , ignoring return code leads bugs... in case of printf() , return value seldom useful. provided allow following code: int width; width = printf("%d", value); // find out how wide while (width++<15) printf(" "); width = printf("%s", name); while (width++<30) printf(" "); i'm not saying that's code (there other ways too!), describes why function return value isn't used often. if programmer decide ignore return value, there isn't compiler error - value merely forgotten. it's bit buying something, getting receipt, , dropping on floor - ignore returned value. the latest compilers can instructed flag cod

php - Check how many different values there are and return them -

is there way check how many rows different value ( in case ) "subject" are. for example: in database have 5 rows. subject of row 1 = 1 subject of row 2 = 5 subject of row 3 = 3 subject of row 4 = 1 subject of row 5 = 8 i want have return like: 1,5,3,8 can notice 1 not showed twice. does maybe know way done? thanks! if want return deduplicated values: select distinct subject yourtable; if want know how many times subject appears in table: select subject, count(subject) yourtable; if want count unique subject values: select count(distinct subject) yourtable;

Windows Authetication on Jmeter -

i have application of web type. here catch. login windows machine username / password. once application opens automatically logs in windows username , password. how way designed. now, added authorization manager , gave of it, still says 401 error invalid username , password. it ntlm authentication. can me this? how jmeter supports ntlm. thanks. appreciate help. the http authorization manager needs populated follows: username: must match “user logon name” windows domain password: windows domain password domain: should “what see in windows security pop-up” real browsers do. if uncertain can type qualified domain name field can use “domain” or “domain.local”. other fields “base url” , “mechanism” can left is. can find full example here: https://www.blazemeter.com/blog/windows-authentication-apache-jmeter

android - ADT - any way to preview Views inside a ScrollView? -

i have quite large layout placed inside scrollview. in graphical editor, don't have possibility preview elements you'd have scroll, since they're "cut off" screen. pisses me of. there adt settings don't know about? try show in tablet 10.1 preview

javascript - How can I completely exit from inside a .forEach that is inside a function -

i have method: wordformdirty = (): boolean => { var self = this; angular.foreach(self.word.wordforms, function (wf, key) { var wordformngform = 'wordformngform_' + wf.wordformid if (!self[wordformngform].$pristine) { return true; } }); return false; }; from see never returns true. can give me advice how can implement form that's not pristine make wordformdirty() method return true. can try this, in case, if i've undestand issue, first time there value true result set true otherwise remains false wordformdirty = (): boolean => { var self = this; var result = false; angular.foreach(self.word.wordforms, function (wf, key) { var wordformngform = 'wordformngform_' + wf.wordformid if (!self[wordformngform].$pristine) { result = true; } }); return result; };

javascript - Experiencing something odd when using THREE.Raycaster for collision detection (r68) -

i've been using three.raycaster test collisions many things in game engine far, it's great , works well. however, i've run quite peculiar cannot seem figure out. point of view, logic , code sound expected result not correct. perhaps i'm missing obvious thought i'd ask help. i casting rays out center of top of group of meshes, 1 one, in circular arc. meshes children of parent object3d , goal test collisions between origin mesh , other meshes children of parent. test rays, using three.arrowhelper . here's image of result of code - http://imgur.com/ipzyusa in image, arrowhelper objects positioned (origin:direction) how want them. yeah, there's wrong picture, code produces is: var degree = math.pi / 16, tiles = this.tilescontainer.children, tilesnum = tiles.length, raycaster = new three.raycaster(), raydirections, raydirectionsnum, rayorigin, raydirection, collisions, tile, i, j, k; (i = 0; < tilesnum; i++) { tile = t

java - Jacoco coverage and Kotlin default parameters -

Image
i having following constructor: open class ipfs @jvmoverloads constructor(protected val base_url: string = "http://127.0.0.1:5001/api/v0/", protected val okhttpclient: okhttpclient = okhttpclient.builder().build(), protected val moshi: moshi = moshi.builder().build()) { now when measuring coverage misses when defaults used. way out can imagine write tests in java use other constructors - stay in pure kotlin - there way this? update: using constructors ipfs() in tests - think on generated java bytecode converted constructor 3 parameters - , thing jacoco sees since you're using @jvmoverloads annotation, compiler generate 3 overloaded constructors. annotation used able omit parameters in plain java. @target([annotationtarget.function, annotationtarget.constructor]) annotation class jvmoverloads instructs kotlin compiler generate overloads function substitute d

ios - How to create a half sliding ViewController -

Image
how can create half sliding window (from right left) shows above last clicked view in airbnb application? currently there have: when click on profile tab want show such view above last 1 clicked. here how storyboard looks like: is there native way can implement this? there lot of applications using approach not see easy way it. thanks! try taking @ this: slidemenucontrollerswift it quite easy implement , works nicely.

php - check if client press on option tag -

i need check if isset $_post of 'option' tag. for example, know when client pressed on 'select' tag i'm doing this: <?php if (isset($_post['select_tag'])) { echo 'the client pressed on select tag'; } ?> <form method="post"> <select name="select_tag"> <option value="1">1st</option> <option value="2">2nd</option> <option value="3">3rd</option> </select> </form> i need know if client press on value 1, 2 or 3, there way check it? in $_post['select_tag'] selected value selectbox if (isset($_post['select_tag'])) { echo 'the client pressed on select tag '.$_post['select_tag']; } output: the client pressed on select tag 1.

python - Merge two csv files based on key and secondary key -

i merge 2 csv files follows: csv1: formula,solver,runtime,conflicts cbs_k3_n100_m403_b30_13.cnf,swdia5by,0.001842,318 cbs_k3_n100_m403_b30_13.cnf,glucose,0.001842,318 csv2: formula,entropy,num sols cbs_k3_n100_m403_b30_13.cnf,0.202,707286 desired output: formula,solver,runtime,conflicts,entropy,solutions cbs_k3_n100_m403_b30_13.cnf,swdia5by,0.001842,318,0.202,707286 cbs_k3_n100_m403_b30_13.cnf,glucose,0.001842,318,0.202,707286 so did intersection between keys of 2 dictionaries (csv's), , used list comprehension keysa = set(dict1.keys()) keysb = set(dict2.keys()) keys = keysa & keysb ... [[key] + dict1.get(key, []) + dict2.get(key, []) key in keys] but there 'duplicate' rows (which need) field formula same field solver isn't, , output is: formula,solver,runtime,conflicts,entropy,solutions cbs_k3_n100_m403_b30_13.cnf,swdia5by,0.001842,318,0.202,707286 how can keep rows using list comprehension? or in other way appreciate help edit - add

ruby on rails - In gVim, can't generate controller appropriately -

i'm windows user. when try :rgenerate controller blog , gvim giving me message: :!ruby bin/rails generate controller blog >c:\users\ergash~1\appdata\local\temp\vie2 a31.tmp 2>&1 shell returned 1 and doing nothing! should next? the author of plugin tim pope helped me headache. if use :rgenerate not working, if use instead :rails generate working properly. problem don't know exactly, working now. thanx "tpope"! here link github repo

javascript - JS - then and waiting for a promise -

a common topic know want confirm understanding on world of js , promises. so have following segment of code failing in then block doesn't wait segment above finished. namely i'm not getting final/correct value of okcheck . var okcheck = false; user.findone({publicid: id}, function (err, userinfo) { if ( userinfo.checked.indexof(id) > -1 ){ okcheck = true; } }) .then(function() { //do additional stuff using boolean okcheck } so fix - understand need use return - correct? var okcheck = false; user.findone({publicid: id}, function (err, userinfo) { if ( userinfo.checked.indexof(id) > -1 ){ okcheck = true; } return okcheck; }) .then(function() { //do additional stuff using boolean okcheck } is correct - namely guaranteed i'll have final value of okcheck? thanks. from understand need use return - correct? yes. return ing value doesn't influence timing-related. the point valu

Wrap every 5 items in jQuery for each -

hi trying grouped elements inside foreach loop. couldn't figured yet. $select.children('option.active,option.enabled').each(function(i, option) { var $option = jquery(option), selectid = $option.parent('select').attr('id'); $variationitems.find('input[type="radio"]') .filter('[name="'+selectid+'"]') .filter('[value="'+option.value+'"]') .parents('.mspc-variation:first').show() $variationitems.find('input[type="checkbox"]') .filter('[name="'+selectid+'"]') .filter('[value="'+option.value+'"]') .parents('.mspc-variation:first').show() if( <= 5 ){ $variationitems.wrapall('<div class="grouped-section-1"/>'); }else if ( <= 10) { $variationitems.w