Posts

Showing posts from March, 2014

java - Iterate over click listeners on a button -

i have imageview i've assigned click listener. i'm trying figure out how give listener new function depending on user in loop. example, first click show textview, second click show another, , third click hide both. public void addoption(view view) { int index = 2; switch (index) { case 0: // if using index 0, set text index 1 text , change index 1 index = 1; findviewbyid(r.id.polloption3textinputlayout).setvisibility(view.visible); break; case 1: index = 2; findviewbyid(r.id.polloption4textinputlayout).setvisibility(view.visible); break; case 2: index = 0; findviewbyid(r.id.polloption3textinputlayout).setvisibility(view.gone); findviewbyid(r.id.polloption4textinputlayout).setvisibility(view.gone); break; } } how can go doing this? ...

html - Stretch text to fit width of div -

i have div fixed width, text inside div can change. is there way of setting, css or other, spacing between letters text fills div perfectly? as mark said, text-align:justify; simplest solution. however, short text, won't have effect. following jquery code stretches text width of container. it calculates space each character , sets letter-spacing accordingly text streches width of container . if text long fit in container, lets expand next lines , sets text-align:justify; text. here demo : $.fn.strech_text = function(){ var elmt = $(this), cont_width = elmt.width(), txt = elmt.html(), one_line = $('<span class="stretch_it">' + txt + '</span>'), nb_char = elmt.text().length, spacing = cont_width/nb_char, txt_width; elmt.html(one_line); txt_width = one_line.width(); if (txt_width < cont_wid...

How to read Spaces from a file in Matlab? -

i want read characters file including spaces, trying fileread = textread('myfile.txt', '%c'); disp('characters total') disp(length(fileread)) but result not correct because counting characters except space. so how do that, appreciated? i want read file spaces. image attached here so on textread (or better alternative textscan ) isn't super clear on how %c format specifier handles whitespace. if use single %c , going read one character @ time in scenario, whitespace still going treated delimiter since falls between 2 single-character matches. what documentation referring %c matching whitespace if specify expected length %c specifier ( %<length>c ), whitespace included in match. textread('z.txt', '%12c') % name z if want read in entire file character array, use fread '*char' data type low-level function accessing file contents if don't need parse them @ all. fid = fopen('z.txt...

iis 7.5 - How to host Owin application in IIS application -

i created owin application in vs 2015, default added following code: public void configureservices(iservicecollection services) { } // method gets called runtime. use method configure http request pipeline. public void configure(iapplicationbuilder app) { app.useiisplatformhandler(); app.run(async (context) => { await context.response.writeasync("hello world!"); }); } // entry point application. public static void main(string[] args) => webapplication.run<startup>(args); when compiled this, not generating bin folder. also, created iis application in iis 7 , tried accessing: http://localhost/owinapp . iis not recognizing request. reason don't have bin folder... works fine when directly run vs 2015. expecting work other web application. missing anything?

image processing - Face landmark detection error (dlib,python,ubuntu) -

i installed dlib on ubuntu , it's detector works, when want use predictor , using shape_predictor_68_face_landmarks.dat shows below message: ./face_landmark_detection.py shape_predictor_68_face_landmarks.dat ./100032540_1.jpg traceback (most recent call last): file "./face_landmark_detection.py", line 66, in <module> predictor = dlib.shape_predictor(predictor_path) runtimeerror: unexpected version found while deserializing dlib::shape_predictor. how can fix it? thanks

c++ - vector reseve then assign can improve performance -

if have assign char array vector ,is practice first reserve vector size assign array it? will improve performance? beacuse compiler no need allocate several time internaly should improve performance , not sure . assign taking in consideration before assigning? doese assign (reserve) allocate size first , insert/copy? note:-with assign mean assign function in vector (std::vector::assign) example:- void test_func(char* bigarray) { std::vector<char> v_data; int len=strlen(bigarray); v_data.reserve(len); v_data.assign(bigarray,bigarray+len); } i'm not sure why question got downvoted seems valid ask this, rather going away , inventing kind of way benchmark vector may or may not give erroneous results. anyway... if you've got decent sized array you're going assign vector, faster reserve() before assigning. however, there several caveats mean might not case. in fact, implementation dependent. your vector have...

Fetching parent and child value from a nested json in angularjs -

i'm new angularjs i'm facing issue have nested json, , using parent value header , values of child checkboxes. now, when want retrieve value of checkboxes have been ticked, want in format of { parent_name:child_name } stored in array. i'm using following sample data taken this thread. data: parents : [{ name: 'george', age: 44, children: [{ name: 'jack', age: 16, ischecked: 'true' },{ name: 'amy', age: 13, ischecked: 'false' }] }, { name: 'jimmy', age: 38, children: [{ name: 'max', age: 7, ischecked: 'false' },{ name: 'lily', age: 5, ischecked: 'false' },{ name: 'kim', age: 4, ischecked: 'true' }] }] and, current output looks this my html code is <div class="col-md-12 col-xs-...

r - Easy regex in gsub() function is not working -

i have started programming in r. currently, practicing feature engineering on famous titanic dataset. inter alia, want extract title of persons in dataset. i have these: montvila, rev. juozas johnston, miss. catherine helen and want these: rev. miss. my own approach not working. cant figure out problem is: gsub("([a-za-z:space:]+, )|(\.[a-za-z:space:]+)", "", data_raw$name) hope can me! great. kind regards, marcus i suggest regex replace text last chunk of letters followed dot. > x <- c("montvila, rev. juozas", "johnston, miss. catherine helen") > sub("^.*\\b([[:alpha:]]+\\.).*", "\\1", x) [1] "rev." "miss." or simpler regmatches solution: > unlist(regmatches(x, regexpr("[[:alpha:]]+\\.", x))) [1] "rev." "miss." or, if need check dot, "exclude" match, use pcre regex regmatches ( perl=true ) allows using lookaroun...

c# - Hangfire and Dapper insert throwing System.MissingMethodException Method not found: '?' -

i using dapper , dapper.contrib 1.50.0.0, , executing inside hangfire job. i trying insert 1 data so: using (var db = dbfactory.opendbconnection()) { var user = new user { id = id name = name, address = address, phonenumber = phonenumber, email = email }; db.insert(user ); } but keep getting exception, wrong? have used identical dapper , dapper.contrib version make sure there no versioning conflict. have cleansed project , delete bin folders found , rebuild, still getting error. system.missingmethodexception method not found: '?'. system.missingmethodexception: method not found: '?'. @ paraminfo72548414-c8a2-4ab0-a498-9eaa0c278243(idbcommand , object ) @ dapper.commanddefinition.setupcommand(idbconnection cnn, action``2 paramreader) @ dapper.sqlmapper.querymultipleimpl(idbconnection cnn, commanddefinition& command) @ dapper.sqlmapper.querymultiple(idbconnection cnn, string sql, object para...

Google maps style is not applying on all maps in java document (Android studio) -

this activitymaps.java : @override public void onmapready(googlemap googlemap) { mapstyleoptions style = mapstyleoptions.loadrawresourcestyle(this, r.raw.style_json); googlemap.setmapstyle(style); mmap = tools.configbasicgooglemap(googlemap); mmap.setmaptype(sharedpref.getmaptype()); mclustermanager = new clustermanager<>(this, mmap); is_map_ready = true; if (userloc != null) { movecameratocurrentlocation(); loadnearbyplaces(); } and other file (fragmentfind.java) maps style not applied: public void onresume() { super.onresume(); if (mmap == null && mapfragment != null) { mapfragment.getmapasync(new onmapreadycallback() { @override public void onmapready(googlemap googlemap) { mapstyleoptions style = mapstyleoptions.loadrawresourcestyle(this, r.raw.style_json); googlemap.setmapstyle(style); mmap = tools.configbasicgooglemap(goog...

Extract substring from string using php -

i need extract substring string using php. $string = 'this string conteined code:xyz123'; $code = substr($text, -1, strpos($string,'code:')); echo $code ; // return 3 i need whole code example xyz123 try code : $string = 'this string conteined code:xyz123'; $code = substr($string ,strpos($string,'code:')); echo $code; make sure helpful you.

php - Never ending do-while loop with regex -

i trying run series of patterns on xliff file. sample: <trans-unit id="1"> <source> "sausages". </source> <target> j'aime bien les « sausices » </target> </trans-unit> <trans-unit id="2"> <source> "sausages". </source> <target> j'aime bien les «sausices» </target> </trans-unit> i parse file, , run each pattern on each target element. foreach($patterns $p) { if (preg_match($p['find'], $tu[0]->target, $dummy)) { { $targettext = $tu[0]->target; $tu[0]->target = preg_replace($p['find'], $p['repl'], $targettext, -1, $count); } while ($count); } } for example, have array patters: $patterns[1] = array( 'find' => "/[«‹]\k(?!\x{00a0})\s/imu", 'repl' => "&#8...

sql server - How to transfer file to SFTP path using SSIS package? -

how transfer files provided sftp paths using ssis package. thanks in advance valuable replies. follow link.. works ,i implemented same. https://winscp.net/eng/docs/library_ssis#example thanks

typescript cannot find module which is defined in declaration file of npm linked local project -

i have module foo has declaration file builds/declarations.d.ts , mentioned in package.json : 'types' : './builds/declarations.d.ts' the declaration file declares things so: declare module '@my/module/lib/models/base' { export default class base { test():void; } } then in module bar have module foo linked npm link . , has files trying access classes foo: import base "@my/module/lib/models/base"; however compiler give error: cannot find module '@my/module/lib/models/base'. note working before when temporarily had separate declaration files, when @my/module/lib/models/base.d.ts existing file. but have bundled declarations nicely 1 file, , mentioned in package.json compiler can't find module. but does work when add declaration file tsconfig.json so: "files": [ "./src/index.ts", "./node_modules/@my/module/lib/models/declarations.d.ts" ] but thought whole point of ...

Is there any built-in Encoding Enum in C#? -

i have function receive encoding object parameter. however, think easier other programmers pass enum value instead of encoding object (especially programmers not use deal different encoding). couldn't find built-in encoding enum in c#... did miss or should create enum of own? the idea of using enum programmer may not know different encoding objects go principle of least astonishment. developers want alter encoding, know (or @ least, need to know) doing, , ought know how obtain encoding instance representing encoding want use. if don't, can search web ".net encoding codepage xyz" , directing them msdn page encoding.getencoding() . whereas if introduce new enum, google search ".net theblacksmurf.encodingenum codepage xyz" yield 0 results. don't cater people don't know doing. if instead you're going use enumeration, chances 1 developer does want change encoding , knows 1 use , how obtain it, can't utilize because di...

osx - Navigating Phoenix's or Elixir's Codebase in Vim using cTags -

this setup: mac os 10.12.1 vim 8.0.52 exuberant ctags 5.8 my .vimrc has: set tags=tags i generate tags file using ctags -r . within project root directory , generated file called tags in same folder. the ctags navigation within own project files work fine. whenever try see source code phoenix framework (or dependencies) e426: tag not found: mix how fix , navigate phoenix's source code? turns out i've somehow corrupted project's installation. after trying fix tags specific issue, decided give , move on. trying run mix phoenix.server got: unchecked dependencies environment test: (...) list of dependencies, including final one: * phoenix_ecto (hex package) dependency not available, run "mix deps.get" ** (mix) can't continue due errors on dependencies i have no idea how happened. ran mix deps.get again , had run npm install again. (phoenix uses brunch ) after that, ran $ ctags -r . on project's...

matlab - PCA in Julia MultivariateStats.jl -

i using pca in julia package multivariatestats.jl . trying covert old matlab script julia. however, cannot run matlab script anymore. dealing series of images. first want make sure got input matrix right. reshaped each image vector , put n images m x n matrix. think format of data correct, same matlab. generated pca model m = fit(pca, data) . matlab return [coeff,score,latent] . how in julia? a pca on data matrix x of m rows , n predictors merely svd on x , defined x = usv' . can reconstruct 3 objects based on matrices u , s , , v julia call u, s, v = svd(x) . if understand matlab pca documentation correctly, then score u latent s coeff vs and 1 recovers data x = score * coeff' . note if call svd pca, julia's svd function returns s vector, whereas in matlab svd returns s square matrix. when reconstructing x in julia, call x = u * diagonal(s) * v' , whereas in matlab can write x = u * s * v' . pca in matlab, latent vector...

haskell - Building project dependent on gtk2hs fails on lts-7.8 and later -

building project dependent on glib fails on lts-7.8 , later after cabal becomes 1.24.1.0. steps reproduce add glib project's .cabal file build-depends: base , gtktest , glib run following commands stack install gtk2hs-buildtools stack build result the following error occurred ... [debug] ignoring package cabal due wanting version 1.24.1.0 instead of 1.24.0.0 @(stack\build\installed.hs:196:5) ... -- while building package glib-0.13.4.1 using: c:\users\foo\appdata\local\programs\stack\x86_64-windows\ghc-8.0.1\bin\ghc.exe --make -odir c:\users\foo\appdata\local\temp\stack5512\glib-0.13.4.1\.stack-work\dist\b7fec021\setup -hidir c:\users\foo\appdata\local\temp\stack5512\glib-0.13.4.1\.stack-work\dist\b7fec021\setup -i -i. -package=cabal-1.24.0.0 -clear-package-db -global-package-db -package-db=c:\sr\snapshots\a78c6a89\pkgdb c:\users\foo\appdata\local\temp\stack5512\glib-0.13.4.1\setup.hs -o c:\users\foo\appdata\loca...

scipy - Python - binning Y and Z data according to binning on X data -

Image
i have list of x, y, z values, of give snippet here: x y z 0.015 34.11 0.21 0.015 34.38 0.22 0.015 34.16 0.16 0.015 33.95 0.18 0.0151 34.53 0.21 0.0152 34.26 0.24 0.0152 34.02 0.22 0.0152 34.1 0.22 0.0153 34.71 0.21 0.0154 33.94 0.15 0.016 33.82 0.21 0.016 34.17 0.22 0.0163 34.45 0.21 0.0163 34.02 0.2 0.0163 34.04 0.14 and on...i include sample give idea of how data like. i binning these data, in following way. first of all, perform binning in x , using binned_statistic scipy: from scipy.stats import binned_statistic x_bin_means = binned_statistic(x, x, bins=15, range=(0.0, 1.5))[0] output (keeping account of data, not snippet): [ 0.03590114 0.15124727 0.25215231 0.34849333 0.4460193 0.55067273 0.64496471 0.74935294 0.838232 0.95084737 1.032 1.1505 1.23775 1.334625 1.414 ] so far good. in essence, did dividing x values in 15 bins, assigning each bin single value, equal mean of values inside bin. now need to: 1) perform...

django - Python Social Auth - Redirect to a URL after raising an AuthException -

when user try login in website using google account check if gmail registered in db. this pipeline.py def check_email(request, backend, details, uid, user=none, *args, **kwargs): if backend.name == 'google-oauth2': # verifica se é um usuário jah existente pelo google, e que apenas vai fazer o login if uid , user: pass # se ele não existe é pq será registrado else: # pega o e-mail cara que vai ser registado email = details.get('email', '') # procura na db se existe algum email parecido, se existir volta pro login count = user.objects.filter(email=email).count() if count>0: raise authexception(backend, 'not unique email address.') the error raised @ browse: exception raised so, wondering how redirect login page again message. i tryed use httpredirect, works fine, not possible use django message framework during pipe...

xamarin.ios - How to mimic Android Bar on iOS? -

Image
my designer created layout: how can mimic on ios? tried creating segmented control didn't work because can't customized after ios7. @ moment i'm thinking uipagecontrol custom dots explained here: customize dot image of uipagecontrol @ index 0 of uipagecontrol my problem concept. segmented controls said used flatten/filter results according ios human guidelines while uipagecontrol has different pages... is best approach? if so, can make android tab bar? segmented control custom image uipagecontrol custom image uitabbar on top (read many bad things approach) something else if uipagecontrol indeed best/correct/possible approach how can make close image? , move top? thanks! short answer: don't that. you're trying implement android controls on ios. leads user confusion , app doesn't feel native app. instead, have designer create native app design both platforms. it looks me closest analog you're trying tab bar , tab bar control...

php - How to solve undefine index? -

this question has answer here: php: “notice: undefined variable”, “notice: undefined index”, , “notice: undefined offset” 23 answers how solve undefined index although have started session in top of header file shows undefined index? the following error shown:- notice: undefined index: signed_in in c:\xampp\htdocs\web_forum\header.php on line 26 line 26 if($_session['signed_in']) header.php <?php session_start(); ?> <!doctype html> <html> <head> <meta charset="utf-8"/> <meta name="description" content="a short description."/> <meta name="keywords" content="put, keywords, here"/> <title>webinar</title> <link rel="stylesheet" type="text/css" href="css/style.css"> </head> <body...

asp.net - Javascript could show hidden div -

what needed achieve clicking preview button (asp button, calls function), hidden preview section shows. didn't work below codes... not sure missed. looked through many answers here, strangely, none of them worked. appreciated if can provide thoughts / solution on this. in .aspx <style> #previewsection {display:none;} </style> in script, (edited point btpreview, still not working... ) <script type="text/javascript"> var previewbt = document.getelementbyid('btpreview'); previewbt.addeventlistener('click',function(){ previewsection.style.display = "block"; }) </script> the html: <div class ="container" id="inputsection"> <table class="table"> <tbody> <tr> <td style="width:60%"> <p>the question</p> <asp:req...

ios - PushViewController didn't work -

i have simple app, 2 empty page, first 1 have button, call action, code: let story = uistoryboard.init(name: "main", bundle: nil) let vc = story.instantiateviewcontroller(withidentifier: "testid") self.navigationcontroller?.pushviewcontroller(vc, animated: true) my second page got id "testid", it's 2 new page, don't change param, or nothing else. please make sure first view controller has navigation controller embedded it,as pushing view controller require navigation controller'.it surely work then.

angular - How do i add code completion for angular2 addons like font awesome? -

i have following angular-cli.json file angular2 application. able load bootstrap , font awesome in project, not code completion. { "project": { "version": "1.0.0-beta.19-3", "name": "web" }, "apps": [ { "root": "src", "outdir": "dist", "assets": [ "assets", "favicon.ico" ], "index": "index.html", "main": "main.ts", "test": "test.ts", "tsconfig": "tsconfig.json", "prefix": "app", "mobile": false, "styles": [ "styles.css", "./../node_modules/ng2-toasty/style-material.css", "./../node_modules/bootstrap/dist/css/bootstrap.css", "./../node_modules/font-awesome/css/font-aw...

c++ - Compiled library's headers not being able to reach each other -

i'm having issue regarding library called jsbsim. library not relevant, issues surrounding multiple cases of cyclic dependency in header files. background info: running centos 7 64 bit - libraries statically linked headers located in usr/local/include , corresponding .a , .la in usr/local/lib the directory structure /usr/local/include/jsbsim followed: initialization input_output math models simgear fgfdmexec.h fgjsbbase.h i'm running makefile following content: all: g++ *.cpp -ljsbsim -o output clean: /bin/rm -f output i'm writing wrapper jsbsim basic following skeleton: #include <jsbsim/fgfdmexec.h> class jsbsimwrapper { }; i following error when run makefile: compilation terminated. in file included /usr/local/include/jsbsim/fgfdmexec.h:47:0, jsbsimwrapper.hpp:7, main.cpp:1: /usr/local/include/jsbsim/initialization/fgtrim.h:53:23: fatal error: fgfdmexec.h: no such file or directory #include "f...

lightopenid - PHP | preg_match(): Unknown modifier '(' in C:\xampp\htdocs\Folder\index.php on line 38 -

i'm trying let people log in steam, using code: <?php require './includes/lightopenid/openid.php'; $_steamapi = "mykey"; try { $openid = new lightopenid('localhost'); if(!$openid->mode) { if(isset($_get['login'])) { $openid->identity = 'http://steamcommunity.com/openid/?l=english'; header('location: ' . $openid->authurl()); } else { echo "<h2>connect steam</h2>"; echo "<form action='?login' method='post'>"; echo "<input type='image' src='http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_small.png'>"; echo "</form>"; } } elseif($openid->mode == 'cancel') { echo 'user has canceled authentication!'; } else { if($openid->validate()) { ech...

sorting - AngularJS ng-table filter not working on nested fields -

i have problem filter in ng-table angularjs when use it, it's work {{p.quantite}}, {{p.montant}}, {{p.date | date:'dd/mm/yyyy'}} but not working others {{p.produitespece.produitfamille.libelle}}, {{p.produitespece.libelle}},{{p.clientclient.libelle }} this code: show_vente.html <div class="panel-body"> <h5 class="over-title margin-bottom-15" data-ng-init="displaydata()">liste <span class="text-bold">des ventes</span></h5> <div> <table ng-table="tableparams" show-filter="true" class="table table-striped"> <tr ng-repeat="p in $data"> <td ...

windows - Powershell not splitting string returned from function -

i trying import csv contains fictional places , hours each day of week fictional places open. the hours 5:00-4:00 format. have spaces. created function remove spaces. after function run, appears powershell can't run further operations on returned string (i.e. -split). the csv: node,sat,sun,mon,tue,wed,thu,fri pizzaplace,9:00 – 4:30,0,8:00-3:30,7:00 – 10:00,10:00 – 4:00,10:00 – 4:00,10:00 – 4:00 bigpharma,0,5:00 – 4:00,7:00-6:00,7:00-6:00,0,0,7:00-6:00 greenhouse,12:00-8:00,0,12:00-7:30,12:00-7:30,12:00-7:30,12:00-7:30,12:00-7:30 portapoty,12:00-8:00,closed,10:00-6:00,10:00-7:30,10:00-6:00,10:00-7:30,10:00-6:00 the ps1 script: function unk-ampm ($openstr) { $openstr -replace " "; } $csvinputs = import-csv samphours.csv; $srprbn = "our hours for"; $srpran = "are"; $dswed = "wednesday"; foreach ($csvline in $csvinputs) { $retailer = $csvline.node; [string] $openwed = unk-ampm $csvline.wed; write-host "va...

angularjs - Unable to load provider -

i trying use angular provider can dynamically load sub-modules within $routeprovider of angular application. however, getting 1 of 2 errors: error: [$injector:modulerr] failed instantiate module mainapp due to: [$injector:unpr] unknown provider: myrouteprovider error: [$injector:nomod] module 'mainapp' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument. here's have: main.js require.config({ baseurl : '', version : '1.0', }); require([ 'app', 'my-route-mod/my-route-mod.module', 'my-route-mod/my-route-mod.provider', 'main-app/main-app.config', 'main-app/main-app.run', /* other initial modules */ ],function(){ angular.bootstrap(document,['mainapp']); }); app.js (function(){ 'use strict'; /* global angular, $ */ angular.module('mainapp',[ 'myr...

mysql - Need Help to understand math on how to draw liner trendline in php -

i going through first answer on how calculate trendline graph? . answer says given trendline straight, find slope choosing 2 points , calculating: (a) slope = (y1-y2)/(x1-x2) then need find offset line. line specified equation: (b) y = offset + slope*x so need solve offset. pick point on line, , solve offset: (c) offset = y/(slope*x) i'm pathetic in math. need understand equation in programming term. lets have stock data containing date, open, high low, close , volume. if not wrong have calculate x axis first per answer calculate trendline when x-axis uses dates use mysql query calculate x1-x2( assuming difference between first , last date). , y axis last low price - first low price (still assuming). in next stage i'm stuck. how calculate x or offset , on third y? can please me understand it?

java - add views programmatically on DialogFragment leaves empty space -

given have custom dialog class extends dialogfragment . suppose have dialog shows doctor information in it, has booking schedules consist of string arraylist shows available date. in layout have prepared placeholder image, name, , have prepared vertical linear layout addviews programmatically of arraylist java class. i looping list addview linearlayout private doctor doctor; // has doctor.schedule = arraylist<string> @override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) { layoutsearchdoctordialogbinding binding = databindingutil.inflate(inflater, r.layout.layout_search_doctor_dialog, container, true); getdialog().getwindow().requestfeature(window.feature_no_title); binding.layoutschedule.removeallviewsinlayout(); (schedule schedule : doctor.schedule) { view view = inflater.inflate(r.layout.item_schedule, null); textview textdays ...

typescript - Call AngularJS 1.5 component's method from the controller? -

i have component plugged main page this <rs-dropdown></rs-dropdown> the component defined rsdropdowncomponent class reference rsdropdowncontroller, usual stuff... the component has $oninit() event handler calls datastore populate component data, event fired once component initialized. the problem dont want component start loading data oninit() event. i want able call component's method controller when want to. basically need somehow access instance of component controller , call it's load function. is possible? someone mentioned using ng-if, or making child component more lenient asynchronous inputs better approach if possible, there's many things can do. 1 - can use eventing, create simple event service signatures like: service.registereventhandler(id, function) service.unregistereventhandler(id, function) service.sendevent(id) register handler in child, , fire event parent when ready 2 - dark magic using 2-way bindings. in ch...

Attempt to invoke virtual method 'android.os.Parcelable android.os.Bundle.getParcelable(java.lang.String)' null object reference -

i making app in feature user can upload images , video server working on activity want use in fragment. try code effectively, efficiently , not getting error during compiling , app runs when click on fragment shows "unfortunately app has stopped " , in log cat getting error: java.lang.nullpointerexception: attempt invoke virtual method 'android.os.parcelable android.os.bundle.getparcelable(java.lang.string)' on null object reference and points line: public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); line ➦ fileuri = savedinstancestate.getparcelable("file_uri"); } i don't know whats wrong my code: public class tabfragment4 extends fragment implements view.onclicklistener{ view parentholder; private static final string tag = mainactivity.class.getsimplename(); int req_code = 100; int video_code = 20; string path; uri selectedimageuri; // camera activity reques...

java - What requirements does Ant place on attribute names? -

i can scriptdef run if use names attributes. apparently names "property" , "prop1", "prop2", etc. ok, other names (including "propn") not ok. ones ok , why? this works (using attribute name prop2 ): <project name="ant weird"> <property name="hostname" value="abc-de-fghijk0.lmn.opqr.stu"/> <scriptdef name="hostsubstring" language="javascript"> <attribute name="text" /> <attribute name="prop1" /> <attribute name="prop2" /> <![cdata[ var hn = attributes.get("text"); project.setproperty(attributes.get("prop1"), hn.replace(/[^0-9]/g,"")); project.setproperty(attributes.get("prop2"), hn.replace(/[^0-9]/g,"")); ]]> </scriptdef> <target name="test" description="helps me learn scriptdef"> <e...

javascript - Add opacity slider in R leaflet -

how can add slider in r leaflet app, controls opacity of specific layer? application, don't want use shiny (suggested here: adding sliders in r leaflet app ), since has exported stand-alone html page. in following example, have 2 cartodb layers want control opacity 1 of them, basemap layer. leaflet.js - set opacity layergroup slider contains useful information how add such slider. also, found out htmlwidgets::onrender function can used add javascript code htmlwidget. so tried following code, doesn't work. slider visible, doesn't anything. moreover, map pans when dragging slider. library(leaflet) leaflet() %>% addprovidertiles(provider = "cartodb.positronnolabels", group="basemap", layerid = 123) %>% addtiles("http://{s}.basemaps.cartocdn.com/light_only_labels/{z}/{x}/{y}.png", group="labels") %>% addlayerscontrol(basegroups="basemap", overlaygroups = "labels") %>% addcontrol(htm...

javascript - scrollmagic triggerHook -

heres deal. im trying use scrollmagic animate car using gsap once comes view. problem doing page loads not when item comes view, im not sure whats going on. went pretty drastic offset value , nothing (btw, im not programmer forgive ignorance). $(document).ready(function($) { var vehicle = $("#vehicle"), vehicle2 = $("#vehicle2"); // controller var controller = new scrollmagic.controller(); // 2. car timeline var tl = new timelinemax() tl.from(vehicle, 5, {right: "20",top: "0", opacity:1}) .to(vehicle, 0.3, {opacity:0}); // 2. car scene var scene = new scrollmagic.scene({triggerelement: "#trigger1", triggerhook:0, offset: 1000}) .settween(tl) .addto(controller); }); here's link codepen: enter link description here

php - creating dynamic navigation in zf3 -

i using zend framework3 in project. able create static navigation following docs link now have fetch menu data database create navigation. using have provide configuration module.config.php config file of album module. <?php namespace album; use zend\router\http\literal; use zend\router\http\segment; use zend\servicemanager\factory\invokablefactory; use zend\navigation\service\defaultnavigationfactory; use album\navigation\albumnavigationfactory; return [ 'controllers' => [ 'factories' => [ controller\albumcontroller::class => factory\albumcontrollerfactory::class, controller\indexcontroller::class => invokablefactory::class, ], ], // add section: 'service_manager' => [ 'factories' => [ 'navigation' => navigation\albumnavigationfactory::class, model\albumtable::class => factory\albumtablefactory::class, ...

php - How to share a Laravel app codebase in a Docker container while preserving permissions? -

i've created dockerfile containerize laravel app local development environment. so far i've achieved of need, however, every command ran container (like composer install , such) alter codebase files containerized root 's uid , generate permissions conflicts in host machine. so far, dockerfile https://github.com/timegridio/dockerfiles , my project codebase (in case needed). on research, i've tried hints given on this question , recommendations of article , believe seem pretty close of need. had no success aproaches , got errors (see question comments pasted outputs, did not want mix approach on question yet.). thanks time! everything make in build process (in dockerfile) won't alter have in host machine. happens after in docker exec or application alter files. when execute container specify host uid , gid: docker run -p 8000:8000 -v ~/timegrid/:/var/www/timegrid -u=<uid> -g=<gid> timegrid:latest everything made these ids. ...

Prolog: create new list structure of known list -

i trying take 1 list , create new 1 structure. the first list have this: list 1 out of x: [[4,2,5,1,1,7,4], [1,0,2,1,5,4,4], [2,8,0,2,2,6,2], [8,9,2,0,1,6,2], [6,2,0,3,0,2,2], [3,6,6,3,0,2,9], [6,2,1,4,3,3,9]] the code have @ moment this: onemap(v,[_,_,v]). listmap([],[]). listmap([h|t],[h1|t1]):- listmap(t,t1),onemap(h,h1). the problem here each line in list inside new list, instead want value inside line. part of output @ moment: [[_g21217,_g21220,[4,2,5,1,1,7,4]],[_g21202,_g21205,[1,0,2,1,5,4,4]],... looking this: [[_g21217,_g21220,4],[_g21202,_g21205,2],[_g21202,_g21205,5],... the solution: okay have after time found helped me double list problem: onemap(v,[_,_,v]). listmap1([],[]). listmap2([],[]). listmap1([h|t],[h1|t1]):- listmap1(t,t1),listmap2(h,h1). listmap2([h|t],[h1|t1]):- listmap2(t,t1), onemap(v,h1). if have smarter solution hear it.