Posts

Showing posts from March, 2015

javascript - Function that receives a parameter and returns it with no modifications -

i can not figure out usefulness function: // quick function retrieve parameters in format compatible ajax request var getrequestparameters = function(params){ return params; }; i'm seeing in web project, used before every $.ajax() call. can please enlighten me? it's extension point. serves central point add/remove/customize parameters @ point in future if needs of project change. @ present, doesn't anything, apparently it's there on theory may something. you've said it's used before every $.ajax call, suggests you're using jquery. means it's bit redundant jquery's own ajaxsend , that's not big deal. for example, suppose @ point in future needed add unique identifier every ajax request sent. you'd have modify 1 function: var id = 0; var getrequestparameters = function(params){ params.__uniqueid = ++id; // or perhaps copy params first return params; }; ...and you'd have on of ajax requests. ...

html - How to put text newar text at buttom op page -

Image
i trying put few form, near each other @ bottom of page. try css, nothing work. this css: #dcustomer,#dorder,#admin{ text-align:inline-block; } #uadmin,#uorder,#ucustomer,#add { float:right; vertical-align:10px; } this example 1 of form: <form action="admincontrol.php" id="uorder" method="post"> <h3><b><u>update order</b></u> </h3><br> order number: <input type="text" name="onumber"><br><br> product name: <input type="text" name="product_name"><br><br> customer name: <input type="text" name="name"><br><br> customer number: <input type="text" name="cnumber"><br><br> e-mail: <input type="text" name="email"><br><br> phone number: <input type="text" name=...

Disable multiple statements in PHP PDO -

is there way disable multiple statement queries in pdo? method works drivers supported? alternatively, there known filter detect multiple statements in string? i know prepared statements can better prevent sql injection risks, there reasons why can't use them in case. you barking wrong tree. multiple statement not synonym sql injection. it's subset, small one, out of zilliards other possible ways exploit injection. therefore should protect injection, not multiple statement. this, query sent database api have 100% hardcoded in script. achieve that, substitute variables in query placeholders.

Subset a dataframe according to matches between dataframe column and separate character vector in R -

i want use chacracter vector to: find rows in dataframe contain single or greater matches vector in comma delimited list within column of dataframe subset dataframe retaining rows matches example data look<-c("id1", "id2", "id5", "id9") df<-data.frame(var1=1:10, var2=3:12, var3=rep(c("","id1,id3","id1,id9","",""))) df var1 var2 var3 1 1 3 2 2 4 id1,id3 3 3 5 id1,id9 4 4 6 5 5 7 6 6 8 7 7 9 id1,id3 8 8 10 id1,id9 9 9 11 10 10 12 where output like: var1 var2 var3 1 2 4 id1,id3 2 3 5 id1,id9 3 7 9 id1,id3 4 8 10 id1,id9 the match between var3 column greater 1 value look vector. is there base r solution doesn't involve using strsplit on var3 column? 1) create appropriate regular expression , perform grep. requested n...

azure cloud services - Elevated rights for HttpListener -

i have created wcf service (wshttpdualbinding) , published on azure app service. next created azure web job consume service. when call wcf service (hosted on azure). gives addressaccessdeniedexception . exception log linked here. exception log i think, issue of elevated rights template using not provide .csdef file. , azure cloud service not in subscription.

c# - Call async method with callback from sync UI thread -

this question has answer here: the calling thread cannot access object because different thread owns it.wpf 6 answers im stuck here... have xaml page ui , want call async function everytime user interacts ui. use signalr networking: public static class protocolclient { private static hubconnection hubconnection; private static ihubproxy protocolhubproxy; public static async void connect(string server) { hubconnection = new hubconnection(server); protocolhubproxy = hubconnection.createhubproxy("protocolhub"); protocolhubproxy.on<body>("bodieschanged", body => //call callback return body ); await hubconnection.start(); //wait connection } public static async void sendtouch(touch touch) { body body = await protocolhubproxy.invoke<body>("ge...

Java Hibernate OneToOne Exception Mapping Error? -

i have follow classes @entity @table(name = "seek") public class seek implements serializable { @id @generatedvalue(strategy = generationtype.identity) private int id; @notnull @valid @onetoone(mappedby="url") private url url; } @entity @table(name = "url") public class url implements serializable { @id @generatedvalue(strategy = generationtype.identity) private int id; @onetoone(cascade = cascadetype.all) @joincolumn(name = "idseek", referencedcolumnname = "id") private seek seek; } my url table has idseek column, seek table doesn't have relationship column url table. the exception receive is: org.springframework.beans.factory.beancreationexception: error creating bean name 'seekdao': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private org.hibernate.sessionfac...

python - When tested http POST with chrome POSTMAN, it doesn't work in django -

Image
i use django 1.9.7 & python 3.5 i implement creating user mechanism , tried test postman(chrome application), doesn't work , shows belows: forbidden (csrf cookie not set.): /timeline/user/create/ this code : urls.py from django.conf.urls import url from. import views app_name = 'timeline' urlpatterns = [ # ex) / url(r'^$', views.timeline_view, name='timeline_view'), # ex) /user/create url(r'^user/(?p<method>create)/$', views.user_view, name='user_view'), ] views.py from django.contrib.auth import authenticate, login, logout django.shortcuts import render, httpresponse timeline.models import * def timeline_view(request): return httpresponse('hello world') def user_view(request, method): if method == 'create' , request.method == 'post': print("hi") username = request.post.get('username') username = request.post.get('u...

Robots.txt for application -

is possible application within website have own robots.txt file? for example, have site running under http://www.example.com , has robots.txt file. we have seperate site running application under domain: http://www.example.com/website-app is possible keep robots.txt file seperate application or need put stuff application main root robots.txt? the robots.txt file needs reside in /robots.txt , there no way tell crawler can found anywhere else (like favicons example). if can should add root robots.txt (or put application on subdomain instead can have own file). if want control specific pages individually can use <meta> -tags instead, described @ robotstxt.org . since needs put on every page have crawler visit (but not index) @ least 1 page, won't follow other pages (unless tell to). small application in subdirectory might ok solution.

c# - Model binding in ASP.NET Core to map underscores to title case property names -

i have model class want bind query string in asp.net mvc core (rc2) application. i need support underscores in query string keys confirm oauth specs, want work title case property names in application. my model class looks this: class oauthparameters { public string clientid {get; set;} public string responsetype {get; set;} public string redirecturi {get; set;} } so i'd bind query strings client_id , response_type , redirect_uri it. is there way asp.net mvc core automagically or through attribute annotation? i've read articles writing custom model binders, these seem (1) overly complex i'm trying achieve , (2) written rc1 or earlier in mind , of syntax has changed. thanks in advance. you can use fromquery attribute's name property here. example: public class oauthparameters { [fromquery(name = "client_id")] public string clientid { get; set; } [fromquery(name = "response_type")] publi...

java - Implementing a Generic Model with basic CRUD operation using ORMlite for Android -

i have abstract classes use base models. sake of simplicity talk root abstract class called model - needs handle repetitive ormlite operation. before each crud operation, needed apply logic standard models. point can implement save, update, , delete on calling object, without having repeat code. abstract public class model<model extends model, child extends childmodel> { private final list<child> mchildren = new arraylist<>(); private class<child> mchildclass; private class<model> mmodelclass; protected runtimeexceptiondao<model, long> mrtedao; public model(class<model> modelclass, class<child> childclass) { this.mchildclass = childclass; this.mmodelclass = modelclass; this.mrtedao = app.getopenhelper().getrtedao(this.mmodelclass); } // codes omitted... public void save() { // object before continuing mrtedao.create(this); } public void delete() { ...

spring - How to clean two databases after running JUnit test method using Flyway -

i have junit test method makes call 2 different services , both services running different data sources , of course in 2 transaction managers. so have configured flyway use h2 data base , implemented junit test method below. @runwith(springjunit4classrunner.class) @transactional public class datacontrollertest extends baseintegrationtest { @test public void testdatasave() throws exception { // test code call controller internally calls 2 services. assertequals(1, jdbctestutils.countrowsintable(this.jdbctemplate, "database1table1")); assertequals(1, jdbctestutils.countrowsintable(this.anotherjdbctemplate, "database2table1")); } } so question test method creating records in h2 database , want clear data after running test. <bean id="txmanager" class="org.springframework.jdbc.datasource.datasourcetransactionmanager"> <property name="datasource" ref="datasource1" /> <...

php - Error While installing FOSREST Bundle Symfony2 -

i trying install "fosrest" bundle create restful web services ionic framework can run services in symfony2.3.7 run on ionic framework angular.js etc.but getting following error. doctrine/mongodb 1.0.3 requires ext-mongo >=1.2.12,<1.5-dev -> requested php extension mongo has wrong version (1.6.6) installed. my composer.json following: { "name": "symfony/framework-standard-edition", "license": "mit", "type": "project", "description": "the \"symfony standard edition\" distribution", "autoload": { "psr-0": { "": "src/" } }, "require": { "php": ">=5.3.3", "symfony/symfony": "2.3.*", "doctrine/orm": ">=2.2.3,<2.4-dev", "doctrine/doctrine-bundle": "1.2.*", "twig/extensions": "1.0.*...

How can I make a program get a variable inside a loop? (java) -

i making program asking age isn't working. first asks how old are, scanner module , puts age inside variable. want output @ end age, needs int, if put string or else gives error: exception in thread "main" java.util.inputmismatchexception @ java.util.scanner.throwfor(unknown source) @ java.util.scanner.next(unknown source) @ java.util.scanner.nextint(unknown source) @ java.util.scanner.nextint(unknown source) @ org.asking.age.main(asking.java:18) i want let him instead of error): please enter number between 1 , 100, if enter else number between 1-100. , if put in wrong number has 'restart', , if number has end. i tried loop: (i = age scanner) while(i>100 || i>0) { if (a < 100 || > 0) { system.out.println("please enter number between 1 , 100"); system.out.println("how old you?"); scanner s = new scanner(system.in); int = s.nextint(); ...

Azure Web App First time loading is slow -

wep app runs in azure , "always on" set "on" still first time loading (e.g. first time in day.) takes on minute load web page. can give suggestion how remove waiting time, because not acceptable wait such long time web page open?

html - Why does this margin flows outsite its parent? -

i have div mainlogo inside div logo. now, when give margin on top, flows outside outer divs. want when give margin-top, should displace downward, instead of flowing margin outside parent. .header { width: inherit; height: 100px; background-color: #0080ff; box-shadow: 0.5px 0.5px 0.5px 0.5px grey; } .headerdiv img { width: 80px; } .headerdiv { width: 1020px; margin: 0 auto; height: inherit; position: relative; } #mainlogo { height: 80px; width: 350px; margin-top: 10px; } <div class="header"> <div class="headerdiv"> <a href="onlinequiz login.php"> <div id="mainlogo"> <img src="images/logo.png"></img> </div> </a> </div> </div> why happen , how can solve it? tricky margin spec. this page has explanation of behavior running into. if don't want change #mainlogo white...

git - Jenkins Plugin failure error -

i'm getting failure message on adding plugin , tell me why i'm getting error: hudson.util.ioexception2: failed download http://updates.jenkins-ci.org/download/plugins/credentials/2.1.4/credentials.hpi (redirected to: http://ftp.tsukuba.wide.ad.jp/software/jenkins/plugins/credentials/2.1.4/credentials.hpi) @ hudson.model.updatecenter$updatecenterconfiguration.download(updatecenter.java:822) @ hudson.model.updatecenter$downloadjob._run(updatecenter.java:1184) @ hudson.model.updatecenter$installationjob._run(updatecenter.java:1365) @ hudson.model.updatecenter$downloadjob.run(updatecenter.java:1162) @ java.util.concurrent.executors$runnableadapter.call(executors.java:471) @ java.util.concurrent.futuretask.run(futuretask.java:262) @ hudson.remoting.atmostonethreadexecutor$worker.run(atmostonethreadexecutor.java:110) @ java.lang.thread.run(thread.java:745) caused by: java.io.ioexception: inconsistent file length: expected 928684 got 884511 @ ...

Error instantiating Typescript Class (Error not a constructor) -

i new typescript , having trouble basic class instantiation. i have namespace recordsservice class record declared inside of it. want able create records within recordsservice, access them via public methods other methods , such. export namespace recordsservice { let records: array<record> = new array(); function init () { let record1 = new record(new date(), 1); } init(); export function getallrecords() { return records; } class record { constructor (public date: date, public id: number) { this.date = date; this.id = id; } } } the above doesn't throw transpiling error when ran console error below typeerror: record not constructor(…) line errors let record1 = new record(new date(), 1); how can create new record in case? plunker, view console log see error: https://plnkr.co/edit/fnk8b1zwa5hl3i7wantq?p=preview you need move record class above init functio...

PHP killed console app -

hellow, got script this: $worker = new wordworker($somefile); $changedfile = $worker->replace()->save(); the script handles word file, when file size more 1.5 mb , when run script console, get: /usr/local/bin/php: line 6: 45771 killed ld_library_path=/usr/jails/php54_2/lib:/usr/jails/php54_2/usr/local/lib /usr/jails/php54_2/usr/local/bin/php -c /usr/jails/php54_2/usr/local/etc/php-cli.ini -d extension_dir=/usr/jails/php54_2/usr/local/lib/php/extension_dir -d zend_extension=/usr/jails/php54_2/usr/local/lib/php/extension_dir/ioncube/ioncube_loader_fre.so "./yii" "order-queue/execute-orders" any set_time_limit or ini_set('memory_limit') cant me. @ least, when start script browser ok.

PHP, split .docx into paragraphs (PREG_SPLIT , "/\.\n/u") -

i trying read docx , **split parts first using docxconversion class ** first function read_docx private function read_docx(){ $striped_content = ''; $content = ''; $zip = zip_open($this->filename); if (!$zip || is_numeric($zip)) return false; $zip_entry = zip_read($zip); while ($zip_entry = zip_read($zip)) { if (zip_entry_open($zip, $zip_entry) == false) continue; if (zip_entry_name($zip_entry) != "word/document.xml") continue; $content .= zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); zip_entry_close($zip_entry); }// end while zip_close($zip); $content = str_replace('</w:r></w:p></w:tc><w:tc>', " ", $content); $content = str_replace('</w:r></w:p>', "\r\n", $content); $content = str_replace("</w:p>", "\r\n", $content); $pattern = "...

javascript - Show Data on click a parent angular -

please new new angular , trying don't know if possible. have json data , want render option on click of item. want achieve show models of phone on click of name, , on click of phone model show phone parts. whenever click on phone undefined in console. my app.js file (function(){ var app=angular.module('repairshop',[]); app.controller('phonecontroller',function($scope){ this.phones = [ { name: 'apple', model: [{ name: 'iphone 5'}, {name: 'iphone 6'},{name: 'iphone 6s'}], part: [{name:'ear phones'},{name:'external speakers'},{name:'screen guard'},{name:'charger'}] }, { name: 'samsung', model: [{ name: 's4'}, {name: 's5'},{name: 's6'}], part: [{name:'ear phones'},{name:'external speakers'},{name:'screen guard'},{name:'charger'}] }, { ...

android - Animate map Marker in GoogleMaps API -

Image
i trying create custom marker looks that: i have drawable in xml looks that: <solid android:color="#0093e8"/> <size android:width="120dp" android:height="120dp"/> is possible add "wave effect" marker , waves fading out gradually (as in picture)? also, animation should playing (without need of user tap on map marker) have do? thanks! i did pretty similar used groundoverlay instead of marker, first defined custom animation: public class radiusanimation extends animation { private groundoverlay groundoverlay; public radiusanimation(groundoverlay groundoverlay) { this.groundoverlay = groundoverlay; } @override protected void applytransformation(float interpolatedtime, transformation t) { groundoverlay.setdimensions( (100 * interpolatedtime) ); groundoverlay.settransparency( interpolatedtime ); } @override public void initialize(int width...

c# - Add-Migration fails because EntityFrameworkCore.Tools is not installed -

Image
i want create console application ef core following tutorial: http://ef.readthedocs.io/en/latest/platforms/full-dotnet/new-db.html . my problem is, cannot execute statement add-migration as described in tutorials. shows me: pm> add-migration myfirstmigration cannot execute command because 'microsoft.entityframeworkcore.tools' not installed in project 'src\appef'. add 'microsoft.entityframeworkcore.tools' 'tools' section in project.json. see http://go.microsoft.com/fwlink/?linkid=798221 more details. all added assemblies: what wrong? update the statement dotnet restore works , dotnet-ef --help not work @ all. and can see, statement execute in project folder. as few people mentioned in comments, microsoft.entityframeworkcore.tools needs added tools section of project.json. i've tested project.json latest (july 2016) versions of ef core , tooling packages, , works: { "buildoptions": { ...

OpenGL: how to get number of samples of a Texture -

given opengl name of texture, how query whether texture multisample texture , how many samples allocated with? you cannot query texture object find out what texture target is . that's have remember. if have been given texture, , don't know if gl_texture_2d_multisample or not, only way find out try bind every single texture target. after each bind, check see if got opengl error. if didn't , that's right target. once know target is, can query number of samples glgettexlevelparameter mipmap level 0, using enum of gl_texture_samples . all of above true if don't have access arb_direct_state_access/opengl 4.5. newer apis, don't have know texture's target anymore. can call glgettexturelevelparameter on texture object itself; if gl_texture_samples parameter zero, not multisample image.

javascript - Button is not displaying in FireFox -

i using button triggers 4-5 other buttons animation. working fine in chrome not in firefox i have used fullscreen background video in current project, button, in firefox, when inspect elements, shows there, browser not displaying element @ all. inspiration taken - http://codepen.io/phenax/ 'use strict'; (function (document, win) { var animation_time = 600; var btn_move_limit = 30; var item_showing = false; var classname = { show_items: 'menu--list__show', revolve: 'menu--list__revolve', button_cross: 'bar__crossy' }; var $el = { toggle_btn: document.queryselector('.js-menu--toggle'), menu_items: document.queryselector('.js-menu--list'), items: document.queryselectorall('.js-item') }; var constrain = function constrain(val, lim) { return val > lim ? lim : val < -lim ? -lim : val; }; var setbuttonposition = function setbut...

android - Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished with non-zero exit value 1 -

i new android development , tried run project; insted plugged in own mobile phone(android) usb , ran got 1 error: error:execution failed task ':app:transformclasseswithmultidexlistfordebug'. com.android.build.api.transform.transformexception: com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\program files\java\jdk1.7.0_79\bin\java.exe'' finished non-zero exit value 1 build.gradle file: apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "24.0.0" defaultconfig { applicationid "com.example.axel.test" minsdkversion 15 targetsdkversion 23 versioncode 1 versionname "1.0" multidexenabled true } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree...

angularjs - Angular JS directive is not working as expected -

i have written simple angularjs custom directive seem missing something. code available at <!doctype html> <html ng-app="myapp"> <head> <meta charset="utf-8" /> <title>angularjs plunker</title> <script data-require="angular.js@*" data-semver="2.0.0" src="https://code.angularjs.org/2.0.0-beta.6/angular2.min.js"></script> <link rel="stylesheet" href="style.css" /> <script src="menudirective.js"></script> <script src="script.js"></script> </head> <body> <hello-world></hello-world> </body> </html> directive (function(){ angular.module('helloworld',[]) .directive('helloworld',helloworld); function helloworld() { return { replace:true, restrict: 'ae', template: '<h3>hello world!!</h3>' ...

Protocols and Extensions swift -

i new swift , learning swift "the swift programming language(swift 3 beta)". below simple example book of protocol extension protocol exampleprotocol { var simpledescription: string {get} mutating func adjust() } class simpleclass: exampleprotocol { var simpledescription: string = "a vert simple class." var anotherproperty: int = 69105 func adjust() { simpledescription += "now 100% adjusted." } } var = simpleclass() a.adjust() let adescripition = a.simpledescription struct simplestructure: exampleprotocol { var simpledescription: string = "a simple structure" mutating func adjust() { simpledescription += "(adjusted)" } } var b = simplestructure() b.adjust() let bdescription = b.simpledescription extension int: exampleprotocol{ var simpledescription : string { return "the number \(self)" } mutating func adjust() { self ...

java - Mocking a generic class with an abstract version of said class -

i'm attempting mock abstract class, i've seen, don't think it's possible. have classes use generics, must extends specific abstract class. there's whole group of them , have been mocked successfully. abstract class has 1 method deals returning generic , looks this: public abstract class childpresenter <t extends childview> { private t view; public abstract t getview(); } the class testing has following in it: public class parentpresenter { private concretechildpresenter1 childpresenter1; private concretechildpresenter2 childpresenter2; private concretechildpresenter3 childpresenter3; private concretechildpresenter4 childpresenter4; list<childpresenter> childpresenters; } in constructor, these classes injected in, using google guice, set variables, , added list of child presenters. the method under test 1 iterates on of childpresenters objects , runs method getview() . i attempted way in test class: public c...

fortran - store multi dimensional arrays to be operated on along all the dimensions -

foreword the fortran program i'm writing should deal 1d, 2d , 3d problems depending on ndims , can 1, 2 or 3 , read input file. in these cases quantity/ies of interest can stored in arrays (one named phi ) of rank dims ( allocatable(:) or allocatable(:,:) or allocatable(:,:,:) ), or in arrays of rank 3 ( allocatable(:,:,:) third dimension set equal 1 in 2d or both second , third dimensions equal 1 in 1d); both cases explained in this answer . first approach seems more elegant me, in following assume second one, simpler. these quantities have operated on several subroutines (e.g. mysub ) along ndims dimensions (along "pencils" should give graphic idea), should call like select case (ndims) ! 3d case case (3) j = ... k = ... call mysub(phi(:,j,k)) end end = ... k = ... call mysub(phi(i,:,k)) end end = ... j = ... call mysub(phi(i,j,:)) end end ! 2d case case (2) j = ... k = ... call ...

c# - Why dll files must be copied into windows folder in Windows 10? -

i have interesting problem. well, develop addon application. addon .net com dll , register using regasm.exe (i created script register dll) the dll requires several dlls 2 dlls xxx.dll , log4net.dll common, means other dlls use these dlls. i created setup using installshield limited version. copy dlls program files , works in windows 8. and after tried work on windows 10, got error "could not load file or assembly or 1 of dependencies... " after that, made deep logging , found out, these 2 dlls needed windows folder. when copy these 2 dlls windows folder, works. so,the same setup file works on windows 8 not in windows 10. i run setup file admin rights, cant understand why that. why application looks dll files under windows folder in windows 10? is there config or? created 2 setup files now. setup windows 10, copies externally 2 dlls windows

r - inner_join or merge remain second id colum -

i have conducted inner_join or merge function in r. want remain second id column "di" in result. library(dplyr) ab<-data.frame(id=(c("pdm.999993856","pdm.999960488")),oi=rep("r",2),stringsasfactors = false) to<-data.frame(di=c("pdm.999993856","pdm.999960488"),kl=rep("foo",2),stringsasfactors=false) inner_join(ab,to, by=c("id"="di")) we can try %>% mutate(id = di) %>% inner_join(., ab, = "id")

javascript - AngularJs application not working in chrome but working in other browsers -

i trying simple application not supported in google chrome browser. trying call html within html page. using ng-include directive. code working in other browsers firefox. here code: test.html <!doctype html> <html> <head> <script src="angular.min.js"></script> <script src="newscript.js"></script> <link href="styles.css" rel="stylesheet" /> </head> <body ng-app="mymodule"> <div ng-controller="mycontroller"> <div ng-include="'etable.html'"></div> </div> </body> </html> etable.html <table> <thead> <tr> <th>name</th> <th>gender</th> <th>salary</th> </tr> </thead> <tbody> <tr ng-repeat=...

visualization - Visualizing probability distribution Spotfire -

Image
for every row have probability distribution on language topics. looks this: comment | topic 1 | topic 2 | topic 3 bla bla | 0.8 | 0.1 | 0.1 bli bli | 0.2 | 0.7 | 0.1 blo blo | 0.1 | 0.2 | 0.7 i want show average probabilities on current filter in bar plot, can zoom specific comments or combinations of comments, topic per bar. how can use different variables different bars in spotfire? edit: here loose paint example 3 topics: so there two, or more approaches can this. simplest to, on bar chart shows everything: right click > create details visualization > select visualization want. now, clicking on single or combination of bars in "main" bar chart render data in details visualization, based off data. can manage marking limit visualizations right click > properties > data tab , set marking , limit data using markings. another, less clean approach, limit data custom expression. in properties > data...

unity3d - How to select a UI button based on a time triggered gaze input using GVr and unity? -

i using unity5 , gvr.i trying implement menu user stares @ button 5secs button enabled.can please me? have implemented reticle , detects button.i not sure how , should add time trigger. attach script button object: [requirecomponent(typeof(button))] public class interactiveitem : monobehaviour, ipointerenterhandler, ipointerexithandler { public image progressimage; // add image child button object , set image type filled. assign field in inspector. public bool isentered = false; recttransform rt; button _button; float timeelapsed; image cursor; // use initialization void awake () { _button = getcomponent<button>(); rt = getcomponent<recttransform>(); } float gazeactivationtime = 3; void update () { if(isentered) { timeelapsed += time.deltatime; progressimage.fillamount = mathf.clamp(timeelapsed/gazeactivationtime,0,1); if(timeelapsed ...

javascript - Access extensions in the chrome://extensions page -

this question has answer here: can access chrome:// pages extension? 3 answers here mainfest.json : "content_scripts": [ { "all_frames": true, "css": [ "css/event.css" ], "matches": [ "\u003call_urls>" ], "run_at": "document_start" } but cannot find content script in chrome://extensions/ page help!!! you can on pc enabling chrome://flags/#extensions-on-chrome-urls , adding necessary url, chrome://extensions/ , "matches" in manifest.json such extension won't possible install on normal browser due invalid scheme error. to avoid fatal error, don't use manifest.json inject content script/style, manually in background or popup script via chrome.tabs.insertcss or chrome.tabs.executescript : chrome://flags : enable extensions on chrome:...

java - JPA and how to think about relationships -

i learning jpa relationships (@onetoone, @manytoone, ...) , talk people how model entities, more confused getting. here's example yesterday: lets have relationship between person , address . db stores address.id fk in person s table "address_id". relationship onetoone or onetomany? i've heard people argue each , both have reasons why feel way. one individual argued "is manytoone since address_id not unique each record. same address_id used on , on again in person s table. argues have onetoone, fk in person s table have unique directed in jsr spec". another individual states "when think person record, have more 1 address ? if not, it's onetoone; why complicate matter" i confused true. on 1 hand, first person able bring jsr spec , talk me through it. on other hand, have developer on 20 years experience (and highly respected) telling me keep simple. can please clarify me thank you! i'll take association pe...

ruby on rails - Migration for changing belongs_to association -

i have model called categories belong product i'd them belong store instead. have several thousand of these i'd create migration adds store_id categories , then, gets associated product.store.id it's current association , adds store_id . after i'd remove product association. does know how , safely achieve that? should add association in wrong direction, can use change_table reverse association: class createfavorites < activerecord::migration[5.0] def change create_table :favorites |t| t.belongs_to :article t.timestamps end end end class removearticlefromfavorites < activerecord::migration[5.0] def change change_table :favorites |t| t.remove_references :article end end end class addfavoritetoarticles < activerecord::migration[5.0] def change change_table :article |t| t.belongs_to :favorite end end end

json - Binding in List with XML -

i want use xml bind list data of json file. here code: xml view: <list headertext="positions" items="{/positions}"> <objectlistitem title="{positions>id}"> </objectlistitem> </list> index.html var opositionsmodel = new sap.ui.model.json.jsonmodel(); opositionsmodel.loaddata("model/positions.json"); sap.ui.getcore().setmodel(opositionsmodel); model/positions.json { "positions": [ { "id": 123456, "article": "abcde", "amount": 12 }, { "id": 654321, "article": "edcba", "amount": 21 } ] } i can't see, what's wrong. "no data" time. there nothing in console saying there problem here. your binding title attribute not correct. want bind directly id attribute of positions , no need specify model: <list...

How to get a `td` text under a specific `th` in a table with Jsoup? -

following extracted rows table; <table class="infobox vevent" style="width:22em"> <caption class="summary">adobe shockwave player</caption> <tr> <td colspan="2" style="text-align:center"><a href="/wiki/file:adobe_shockwave_player_logo.png" class="image"><img alt="adobe shockwave player logo.png" src="//upload.wikimedia.org/wikipedia/en/thumb/8/8e/adobe_shockwave_player_logo.png/64px-adobe_shockwave_player_logo.png" width="64" height="64" srcset="//upload.wikimedia.org/wikipedia/en/thumb/8/8e/adobe_shockwave_player_logo.png/96px-adobe_shockwave_player_logo.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/8/8e/adobe_shockwave_player_logo.png/128px-adobe_shockwave_player_logo.png 2x" data-file-width="165" data-file-height="165"></a></td> </tr> <tr> <th scope="row...

dynamic - Dynamically create a cmdlets/module in PowerShell -

this want achieve , can't find this. i want create remote module proxy, module available on remote server. i know how work remoting want creates cleaner script files. to give example. if want execute mycmdlet module mymodule on remote computer this $block={ # invoke cmdlet module named mycmdlet mycmdlet -parameter1 -parameter2 } invoke-command -computername "" -scriptblock $block but land import-module mymoduleremote mycmdlet -computername "" -parameter1 -parameter2 please noticed mymodule not installed on client machine. i re-write module invoke-command wrapper each cmdlet not purpose. remot-ify mymodule creating proxy equal proxy per cmdlet , parameter. get-help should work @ least parameter composition. i have couple of ideas i'm not sure if possible. create powershell module e.g. psremotify probe module on remote server , generate code. if chose write files file system should possible, if reflection on cmdlets. i...

javascript - Preview multiple uploaded images in symfony -

i wanna preview images javascript before uploading it, i'm working in symfony & use filetype form.. here code : {% block content %} {{ form_start(form, {'attr': {'id': 'image_form', 'class': 'form-horizontal container'}} ) }} <div class="col-md-6"> <div class="form-group"> <div class="col-md-3 text-right"> {{ form_label(form.name, 'images upload :', {'label_attr': {'class': 'control-label'}}) }} </div> <div class="col-md-8"> <div id="wrapper" style="margin-top: 20px;"> {{ form_widget(form.name, {'attr': {'id' : 'fileupload'}}) }} </div> {{ form_errors(form.name) }} </div> ...

php - Validation rule for file upload in update Scenario -

i have file upload option in form. have added field in model , added vlaidation rules below. [['file1'], 'file', 'skiponempty' => false, 'extensions' => 'pdf,png,jpg', 'maxsize' => "10485760", 'toobig' => "maximum upload file size 10mb"] in edit mode, file field not required. need skip required field validation update scenario if user choose file in update form, extension, size need validated. i changed rule below. [['file1'], 'file', 'skiponempty' => false, 'extensions' => 'pdf,png,jpg', 'maxsize' => "10485760", 'toobig' => "maximum upload file size 10mb", "on" => ["insert"]], [['file1'], 'file', 'skiponempty' => true, 'extensions' => 'pdf,png,jpg', 'maxsize' => "10485760", 'toobig' => "maximum...

xml - Filter element by attribute with namespace in E4X -

i have xml this: <product xmlns="http://www.example-schame.org" product-id="5555555"> <display-name xml:lang="x-default">default name</display-name> <display-name xml:lang="en-gb">english name</display-name> <display-name xml:lang="it-it">italian name</display-name> </product> i want default name, e.g. 1 attribute xml:lang="x-default". i tried as var name = product["display-name"].(@["xml:lang"] == "x-default"); but returns me undefined. ideas? you missing namespaces. you need have default namespace, have 1 defined product element. you need have xml namespace, lang attribute of namespace here sample code var product = <product xmlns="http://www.example-schame.org" product-id="5555555"> <display-name xml:lang="x-default">default name</display-name> <...