Posts

Showing posts from June, 2011

xcode - Swift convert code to component for use multiple times -

i'm swift newbie , i'm trying achieve feels should easy lack of knowledge of storyboard + swift + terminology holding me back! i'd create horizontal scroller component achieves following design goals: i can add view in app few lines of code i can pass in array of values configure each of elements in scroller the scroller elements (cells?) designed in .xib file i can have multiple instances of scroller in view i've created simple example scroller has following structure: viewcontroller (horizontalscrollervc.swift) storyboard (used creating outlets, constraints , config) a uicollectionviewcell subclass (mycell.swift) a custom xib file class property set mycell.swift (mycell.xib) i imagine component might used in viewcontroller's viewdidload() method this: //**pseudo code** let data1 = ["a","b","c"] let data2 = ["1","2","3"] let scroller1:myscroller = scrollerfromdata(data:data1) sc

app.config in asp.net core 1.0 rc2 class library -

is possible read custom sections defined in app.config in .net core 1.0 class library project? in asp.net core web project custom sections read correctly config not accessible when called class library project. prior upgrade , in rc1 class library proj app.config sections being read not case after upgrade. is there setting in project.json missing or need create custom configuration provider? thanks insight.

html - Jsoup return tag with empty body -

i trying scrap data - http://www.giantbomb.com/bioshock-infinite/3030-32317/ . can required tag , content inside tag missing . element element = document.body().getelementbyid("site-main").getelementbyid("mantle_skin") .getelementbyid("wrapper").select("div.js-toc-generate").select("form.wikigroup").first().getelementbyid("site") .getelementbyid("default-content").select("aside.secondary-content.span4 ").first(); log.e("hi",element.tostring()); code works fine till second last call "select" . when add last "select" function empty tag body . output <aside class="secondary-content span4 "> </aside> as can see element found there no body though have 1 when looking @ html code . there solution ? this worked fine on java not in android . adding useragent() fix iss

vba - Fastest way to determine what value of a list appears first in a string -

i have list of strings in column on sheet (let "a"), this: bjs-lax-gru can-ord-mia-bog nrt-lax-jfk-lim and have different list on different sheet (let "b"), this: lax mex mia jfk so want know value of second list appears first in each string of first list, , need write value next string. in example, get: b bjs-lax-gru lax can-ord-mia-bog mia nrt-lax-jfk-lim lax i wrote following code, works perfectly: dim aux integer dim cur string j = 1 sheets("a").cells(rows.count, "a").end(xlup).row aux = 100 cur = "" k = 1 sheets("b").cells(rows.count, "a").end(xlup).row if instr(sheets("a").cells(j, 1).value, sheets("b").cells(k, 1).value) < aux , instr(sheets("a").cells(j, 1).value, sheets("b").cells(k, 1).value) <> 0 cur = sheets("b").cells(k, 1).value aux = instr(sheets

Rotate a buffered image in Java -

Image
i trying rotate buffered image in java. here code using: public static bufferedimage rotate(bufferedimage bimg, double angle){ int w = bimg.getwidth(); int h = bimg.getheight(); graphics2d graphic = bimg.creategraphics(); graphic.rotate(math.toradians(angle), w/2, h/2); graphic.drawimage(bimg, null, 0, 0); graphic.dispose(); return bimg; } i have looked numerous stack overflow questions , answers on topic , not been able figure out why image chopped way when try rotate it. here example showing loaded image: loaded image after click rotate button calls above function buffered image , 90.0 angle: chopped image can me understand happening , how fix it? thanks! as always, internet rescue. so, code hobbled other resources/post/blogs return new image sized contain rotated image public bufferedimage rotateimagebydegrees(bufferedimage img, double angle) { double rads = math.toradians(angle); double sin = math.ab

php - How do I pass all elements of an array (of unknown length) to a function as separate parameters? -

this question has answer here: how bind mysqli bind_param arguments dynamically in php? 4 answers i have array in php may contain data such this: $data = array("apples", "oranges", "grapes", "pears"); i want pass these values mysqli bind_param function. example this: $stmt->bind_param("ssss", $data[0], $data[1], $data[2], $data[3]); my question how can produce same results above if length of array unknown? example may five, ten or 15 elements long. with php 5.6 or higher : $stmt->bind_param(str_repeat("s", count($data)), ...$data); with php 5.5 or lower might (and i did) expect following work: call_user_func_array( array($stmt, "bind_param"), array_merge(array(str_repeat("s", count($data))), $data)); ...but mysqli_stmt::bind_param expects parame

ios - Scroll Down SFSafarViewController -

i highly doubt it, there way scroll specific location in sfsafariviewcontroller? in regular wkwebview, doing easy. need call [self.webview.scrollview setcontentoffset:cgpointmake(0, 100)]; . i've considered trying sfsafariviewcontroller evaluate javascript , way wkwebviews can. if not possible please let me know. according the documentation , not use case sfsafariviewcontroller . the user's activity , interaction sfsafariviewcontroller not visible app, cannot access autofill data, browsing history, or website data if need interact web view, use web view( uiwebview or wkwebview ). sfsafariviewcontroller meant provide browser features within app. not have control on going on within view.

php - Propel - retrieve all tables -

i have output of schema tables using propel. when referencing particular tablemap $users = userstablemap::gettablemap(); $map = $users->getdatabasemap(); $tables = $map->gettables(); //yields object, holds users table is there way not use particular table (e.g. users ) have more general approach? there bit outdated question here faces same problem. should make custom query or parse schema.xml retrieve tables? update some of solutions given below answers produce empty array $map = propel::getservicecontainer()->getdatabasemap(); //w & w/o string argument $tables = $map->gettables(); //an empty array there's no way in current version 2 retrieve table maps 1 call. why: need load table maps incredible slow , have no total "map"/"array" listing available table maps available @ buildtime. in propel3 however, possible. the solution should follow parsing schema.xml: how check if table names valid in propel? what can addi

Python: Return all Indices of every occurrence of a Sub List within a Main List -

this question has answer here: elegant find sub-list in list 4 answers i have main list , sub list , want locate indices of every occurrence of sub list found in main list, in example, want following list of indices returned. >>> main_list = [1,2,3,4,4,4,1,2,3,4,4,4] >>> sub_list = [4,4,4] >>> function(main_list, sub_list) >>> [3,9] ideally, function should ignore fragments of sub_list, in case [4,4] ignored. also, expect elements single digit integers. here second example, clarity: >>> main_list = [9,8,7,5,5,5,5,5,4,3,2,5,5,5,5,5,1,1,1,5,5,5,5,5] >>> sub_list = [5,5,5,5,5] >>> function(main_list, sub_list) >>> [3,11,19] maybe using strings way go? import re original = ''.join([str(x) x in main_list]) matching = ''.join([str(x) x in sub_list]) starts = [match.st

javascript - AngularJS keypress event listener - NOT INPUT ELEMENT -

i trying create div responds keypress events, arrow , down arrow. when div open, want window/document respond specific keypress events. i've seen jquery solutions, i'd rather not use jquery. what's best way accomplish this? specifically, have different audio volume images , want these images change each keypress. $scope.keypress = function($event) { $scope.key = $event.keycode }; you can write in div ng-keydown="keypress($event)" codepen url reference- http://codepen.io/nagasai/pen/beeqre -

sql - Improve Function performance in Postgresql -

following function creating temp table , populating data in it. that temp table supposed displayed on click of button on website. steps tried improve performance: 1. modified postgresql.conf file. 2. added index in temp table create or replace function lastonemonth() returns void $body$ declare query1 text; query2 text; var_loop1 record; dealername text; cur_minus_2_month text; var_sum_of_quantity numeric; var_net_value numeric; var_average_price_nsr numeric; begin execute 'drop table if exists lom cascade'; execute 'create temp table lom ( dealer_name text primary key , sum_of_quantity numeric, net_value numeric, average_price_nsr numeric)'; execute 'create unique index dealer_name_idx on lom (dealer_name)'; query1:= 'select distinct dealer customernotorderdb_temp month in ( to_char( now() - interval ''2 month'', ''yyyymm'') , to_char( now() - interval ''3 month'', &

jquery - Page reloading on Ajax success -

i have form segmented 3 divs, displayed in an accordion style , submitted in ajax call, seems page reloading because displayed accordion divs hide following call. think have prevented default action correctly seems missing something. //------------------ accordion ------------------------------------- $('.heading').on('click', 'img', function() { var x = $(this).parent().next('div'); $(x).slidetoggle(function() { if($(x).not(":hidden")) { $(this).prev().find('img').attr('src','images/triangle_red_up.jpg'); } if($(x).is(":hidden")) { $(this).prev().find('img').attr('src','images/triangle.jpg'); } }); }); ajax //------------------ form submit ----------------------------------- $('form').submit(function(e) { e.preventdefault(); var datastring = $(this).serialize(

java - Where can I find the exception stack traces in OpenShift Tomcat Cartridge -

so deployed war file containing jhipster app (angularjs+spring boot) on openshift tomcat 7 cartridge. can open reach application no problems (the front end) once try login (interaction backend) error. normally check exception stacktrace in console of eclipse ide if debugging application locally. i checked logs in app-root/logs/jbossews.log see app deployed logs. : info: deploying web application archive /var/lib/openshift/57582f677628e108ba000096/app-root/runtime/dependencies/jbossews/webapps/root.war jun 10, 2016 10:43:18 org.apache.catalina.startup.hostconfig deploywar info: deployment of web application archive /var/lib/openshift/57582f677628e108ba000096/app-root/runtime/dependencies/jbossews/webapps/root.war has finished in 29,121 ms jun 10, 2016 10:43:18 org.apache.coyote.abstractprotocol start info: starting protocolhandler ["http-bio-127.8.28.129-8080"] jun 10, 2016 10:43:18 org.apache.catalina.startup.catalina start info: server startup in 29501 ms not ap

perl - Emboss Cons for getting consensus sequence for many files, not just one -

i installed , configured emboss , can run simple command line arguments getting consensus of 1 aligned multifasta file: % cons create consensus sequence multiple alignment input (aligned) sequence set: dna.msf output sequence [dna.fasta]: aligned.cons this perfect dealing 1 file @ time, have hundreds process. have started write perl script foreach loop try , process every file, guess need outside of script run these commands. clue on how can run command line friendly program getting single consensus sequence in fasta format aligned multifasta file, many files in succession? don't have use emboss- use program. here code far: #!/usr/bin/perl use warnings; use strict; $dir = ("/users/roblogan/documents/clustered_barcodes_aligned"); @arrayoffiles = glob "$dir/*"; #put files in directory array #print join("\n", @arrayoffiles), "\n"; #diagnostic print foreach $file (@arrayoffiles){ pri

jquery - .success UncaughtSyntaxError: Unexpected identifier -

i baffled why receiving 'unexpected identifier' error code. thing changed url. i working on project , while waiting project partner setup heroku, diverted fake api. here's code: $('#username-submit').click(function() { var userlinks = $('.user-links') console.log('test'); $.ajax({ method: 'get', //this git request url: 'http://jsonplaceholder.typicode.com' //link api created beforesend: function(xhr) { xhr.setrequestheader('authorization', 'user name'); //takes username , authorizes datatype: 'json', .success(function(data) { console.log(data); }) } }) }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> you've got beforesend handler little bit wrong, or rather brackets , commas. this should fix it: $('#username-submit').clic

python - gensim with error of GPU memory access -

Image
i practicing natural language processing gensim word2vec before training language model, follow instructions below http://www.52nlp.cn/%e4%b8%ad%e8%8b%b1%e6%96%87%e7%bb%b4%e5%9f%ba%e7%99%be%e7%a7%91%e8%af%ad%e6%96%99%e4%b8%8a%e7%9a%84word2vec%e5%ae%9e%e9%aa%8c i use process_wiki.py trying pre-process text data downloaded wiki. however, encountered error message below (to find out wrong, add print in code) here process_wiki.py , error message i not know how fix it. please give me help, thank sincerely!

sql - Using ONLY Entity Relationship Diagram to Query MYSQL Format [BRAIN CHALLENGE] -

Image
normally query using tables , schema in case have use entity relationship diagram query on piece of paper in mysql format. these making things complicated. require example question. question: based on data above inner join s written this: select * wines inner join carry on wines.wine_id = carry.wine_id notice diagram relationship between wines , caries shows 0 many (1..1 - 0..*). notice wine_id not listed in carry table column list implied throught relation. next want know price today (hint: since table carry table has price_start_date , price_end_date implies prices not fixed , need use these fields): where price_start_date <= curdate() , curdate() <= price_end_date to prices below $15: where price_start_date <= curdate() , curdate() <= price_end_date , price_on_carry < 15 question 1 query below (you need add relevant column names): select * wines inner join carry on wines.wine_id = carry.wine_id price_start_date

HBase performance with large number of scans -

i have table hundred of million records. table contains data servers , events genereated on them. following row key of table: rowkey = md5(serverid) + timestamp [32 hex characters + 10 digits = 42 characters] one of use case list events time t1 t2. this, normal scan taking time. speed things, have done following: fetch list of unique serverid table (real fast). divide above list in 256 buckets based on first 2 hex characters of md5 of serverids. for each bucket, call co-processor (parallel requests) list of serverid, start time , end time. the co-processor scan table follow: for (string serverid : serverids) { byte[] startkey = generatekeyserverid, starttime); byte[] endkey = generatekey(serverid, endtime); scan scan = new scan(startkey, endkey); internalscanner scanner = env.getregion().getscanner(scan); .... } i able result quick fast approach. concern large number of scans. if table has 20,000 serverids above code making 20,000 scans. impact overall p

angular filters - AngularJS - get Length of filtered data -

i trying length of filtered data, instead length of actual data, have filtered data has attribute placed . my plunk demo result got total 3 notifications 2 quantities of v 4 vanilla should prepared 3 quantities of power cut should prepared result expect total 2 notifications 2 quantities of v 4 vanilla should prepared 3 quantities of power cut should prepared html <p class="ordercounter">total {{getorderfoods(reduce).length }} notifications</p> <div ng-repeat="(key,data) in getorderfoods() | filter: {confirm: 'placed'} | groupby:'name'"> <p><span>{{reduce(data)}}</span> quantities of <span>{{key}}</span> should prepared </p> </div> controller $scope.getorderfoods = function() { var orderfood = []; $scope.reduce= function(data){ return data.reduce(function(previousvalue, currentvalue, currentindex, array) { return previousvalue + parseint(currentvalue.qty);

java - Liferay - Set guest permission on custom field/expandocolumn -

i've added custom field user sign-up page (create_account.jsp) creating expando column via hook plugin. however, field not visible until enable guest permissions on through admin ui. i need able programmatically, through hook plugin. exhaustive research leads me believe following code should trick: role guest = rolelocalserviceutil.getrole(companyid, roleconstants.guest); resourcepermissionlocalserviceutil.setresourcepermissions( companyid, expandocolumn.class.getname(), resourceconstants.scope_individual, string.valueof(expandocolumn.getcolumnid()), guest.getroleid(), new string[] { actionkeys.view, actionkeys.update }); but doesn't. anyone got ideas? i tried same code yours , worked me. in opinion problem in "expandocolumn.getcolumnid()". how retreive object expandocolumn? tried with table id , name: expandocolumn expandocolumn = expandocolumnlocal

Python IDLE is refusing to save and is the crashing when I try to save a file with a specific comment -

i running python 2.7. wrote code in idle. found not save file. if repeatedly try save, idle crashes completely. found if removed following comment, save: #add fourth parameter, end, find function specifies stop looking. warning: exercise bit tricky. default value of end should len(str), doesn't work. default values evaluated when function defined, not when called. when find defined, str doesn't exist yet, can’t find length. oddly, found if truncated comment following, can save: #add fourth parameter, end, find function specifies stop looking. warning: exercise bit tricky. default value of end should len(str), doesn it not seem length of comment, version, comment split two, not save: #add fourth parameter, end, find function specifies stop looking. warning: exercise bit tricky. default value of end should len(str), doesn #’t work. default values evaluated when function defined, not when called. when find defined, str doesn’t exist yet, can’t find length. i imagi

objective c - scroll top navigation bar similiar to flipkart app ios -

i have logo on navigation bar. beneath it, have searchbar 3 bar buttons on both sides. searchbar , bar buttons put in uiview beneath navigationbar. want implement functionality small pinch of scroll on tableview user, navigationbar should move above animation scroll , should come down animation scroll down. along this, searchbar should occupy position of logo while scrolling , should come @ original position when scrolling down. this same functionality implemented in flipkart app on home page. tried using sqtshynavigationbar cocoa controls https://github.com/cbpowell/sqtshynavigationbar , not adjust position of search view. please me this.

java - ImageButton over another image -

Image
well, see whatsapp , tinder application. "change profile picture" option same besides button over. how can this? there lib? or shape ? use code : <framelayout android:gravity="center" android:layout_centerinparent="true" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingbottom="24.0dip" android:paddingleft="0.5dip" android:paddingright="0.5dip" android:paddingtop="35.0dip" android:background="#ff26a69a" xmlns:android="http://schemas.android.com/apk/res/android"> <de.hdodenhof.circleimageview.circleimageview xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/profile_image" android:layout_width="178.0dip" android:layout_height="178.0dip" android:src="@drawable/ic_setting

c# - Is it possible to patch a dotnet function on the fly -

recently found architect-often-used .net program has implemented function wrongly. patched it using ilspy , reflexil in static way of modifying binaries . however, annoying need patch , remove strongnamecheck again when new minor version releases. (btw, author believes feature instead of bug) hopefully, program supports assemblies plugin. , target a public non-static member function in public class can directly called plugins. there way patch function on fly ? i use apihook tricks in unmanaged c++ dotnet different thing. in case, want modification still valid after assembly unloads (so more similar patch, not hook). don't monkey patch code. add functionality code base , call function. or write adapter class wraps underlying assembly, neater. if author of code thinks it's not bug may in there reasons don't understand , part of number of bug fixes.

php - Using sessions to confirm login -

i creating page select form that, depending on option selected, display different information. before user can page must login. continue check if logged in using session otherwise redirect user login. if $_session["admin_username"] exists logged in else not logged in. the issue trying set session when users go between selection option. set session action in form tag. thought set session if select form used resets wether select form used or not. destroys checking login. is there way around this? thanks! here code: <?php require_once("../include/connection.php"); ?> <?php require_once("../include/functions.php"); ?> <?php require_once("../include/sessions.php"); ?> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html lang="en"> <style type="text/css"> div {position: relative; left: 300px} &

c# - how to use unity3d webgl content in a asp.net mvc view? -

i have unity webgl project , asp.net mvc project. i need show webgl content in view. the first thing came mind copy content of index.html unity gave me , paste in .cshtml file , change addresses. when incorrect header error pops up. am doing thing wrong or wrong. should change method entirely? i added these file extensions web.config <staticcontent> <!-- unity 5.x --> <remove fileextension=".mem" /> <mimemap fileextension=".mem" mimetype="application/octet-stream" /> <remove fileextension=".data" /> <mimemap fileextension=".data" mimetype="application/octet-stream" /> <remove fileextension=".memgz" /> <mimemap fileextension=".memgz" mimetype="application/octet-stream" /> <remove fileextension=".datagz" /> <mimemap fileextension=".datagz" mimetype="application/octet-stream" />

r - likert plot showing percentage values -

Image
below, have r code plots likert plot. set.seed(1234) library(e1071) probs <- cbind(c(.4,.2/3,.2/3,.2/3,.4),c(.1/4,.1/4,.9,.1/4,.1/4),c(.2,.2,.2,.2,.2)) my.n <- 100 my.len <- ncol(probs)*my.n raw <- matrix(na,nrow=my.len,ncol=2) raw <- null for(i in 1:ncol(probs)){ raw <- rbind(raw, cbind(i,rdiscrete(my.n,probs=probs[,i],values=1:5))) } r <- data.frame( cbind( as.numeric( row.names( tapply(raw[,2], raw[,1], mean) ) ), tapply(raw[,2], raw[,1], mean), tapply(raw[,2], raw[,1], mean) + sqrt( tapply(raw[,2], raw[,1], var)/tapply(raw[,2], raw[,1], length) ) * qnorm(1-.05/2,0,1), tapply(raw[,2], raw[,1], mean) - sqrt( tapply(raw[,2], raw[,1], var)/tapply(raw[,2], raw[,1], length) ) * qnorm(1-.05/2,0,1) )) names(r) <- c("group","mean","ll","ul") gbar <- tapply(raw[,2], list(raw[,2], raw[,1]), length) sgbar <- data.frame( cbind(c(1:max(unique(raw[,1]))),t(gbar)) ) sgbar.likert<- sgbar[,2:6] require(gr

mongodb - Can't install Bitnami MEAN stack on Windows 10 -

Image
i beginner bitnami mean stack , facing problem installing bitnami mean stack on windows 10. downloaded setup https://bitnami.com/stack/mean and when try installing goes fine before finishing installation says bitnami stopped working in popup , installation fails. same setup runs fine when try on windows 7 machine. can please. i had exact same problem version win64 3.2.7. downloaded version 3.0.2 this link version 3.0.2 (i disabled antivirus windows defender during installation. not sure made difference) it works charm.

visual studio 2012 - Remote File to Variables (C#) -

i attempting create reader type of file used old toontown online. patcher.ver . have tried reading variables dictionary page hosted at, cannot seem work! webrequest request = webrequest.create(form1.patcherbaseurl + "/patcher.ver"); webresponse response = request.getresponse(); stream data = response.getresponsestream(); string html = string.empty; using (streamreader sr = new streamreader(data)) { html = sr.readtoend(); var dic = file.readalllines(html) .select(l => l.split(new[] { '=' })) .todictionary(s => s[0].trim(), s => s[1].trim()); string patchverstrserver = dic["patcher_version_string_server"]; this code attempting use. keep getting exceptions "illegal characters in path" the file trying read located at: http://dolimg.com/toontown/uk/patcher.ver thanks if can help! new c# , couldn't seem find related this. try code below. there lines in html commented out used skip these lines

android - when do I need to use dialogfragments -

i have fragment button after pressing button should open alertdialog has 2 buttons images, 1 image each button (no text on buttons). 1 dialog button opens gallery pick photo , pass fragment other opens camera take photos , pass same fragment. should use dialogfragment or can create alertdialog in fragment , ok? don't when need use dialogfragments "dialogfragment various things keep fragment's lifecycle driving it, instead of dialog. note dialogs autonomous entities -- own window, receiving own input events, , deciding on own when disappear (by receiving key event or user clicking on button)." source : dialog fragments | android developers "this easy. dialogfragment fragment. can fragment provide while other objects can't? it's lifecycle callbacks. so dialogfragment, can powerful , makes code cleaner. have ever seen window leaks if didn't close dialog when activity getting destroyed? prevent that, have ever tried close di

python - Unresolved references in PyCharm -

Image
i downloaded old project repository , there lot of unresolved references now, how can fix them? if working virtualenv have configure project let pycharm know interpreter should used , dependencies. https://www.jetbrains.com/help/pycharm/2016.1/adding-existing-virtual-environment.html

mongodb - Trigger middleware on mass operations in Mongoose -

based on documentation mongoose seems middleware triggered operations on models, i.e. not communicate database directly. means if wanted trigger middleware mass removal, example, i'd have do: users.find().exec(function (err, users) { users.foreach(function (user) { user.remove(); }); }); is there better way perform mass operations on models in mongoose still triggers middleware?

unity3d - Unity : To rotate 3d Object to align 2D isometric field -

Image
i want rotate car align isometric field above picture. but have idea that. do have of idea solve it? most quasi-isometric games use this: x = 30, y = 45 degrees rotation of course, might need flip values between axis or make 1 negative align world. generally, recommend choose either approach: in 3d , position orthographic camera looks isometric/dimetric, want to. or stick 2d isometric sprites together. might run many more problems otherwise.

Fortran runtime error: End of file when reading input data -

i'm running code , i'm getting same end. trying read input file , returns error: fortran runtime error: end of file in other post said put in iostat specifier code looks this: integer :: m integer :: st open(unit = 13,action='read',file='data_inp.dat',status='old') read (13,*, iostat = st) m write (*,*) st write (*,*) m allocate(winkel(m),energie(m)) = 1,m read(13,*),winkel(i),energie(i) end and input file looks this: 12 -17.83 -0.019386527878 -15.83 -0.020125057233 -12.83 -0.020653853148 -11.83 -0.020840036028 -9.83 -0.020974157405 -8.83 -0.021056401707 -6.83 -0.021065517811 -5.83 -0.020992571816 -4.83 -0.020867828448 -1.83 -0.02069158012 now terminal prints -1 iostat , changing number m. if first read command causing error, check extraneous characters before or after "12" in input file, if created on 1 platform (windows?) , using on platform (linux? mac?)

c# Unity container constructor injection of list<childs> -

i know how can inject list of child objects of abstract class constructor using xml config. e.g.: class test { public test(list<a> instances) // list should have instance of b & c { } } abstract class { } class b: { } class c: { } thanks!!! you can use following config if change type of test 's constructor argument on ilist<a> : <configuration> <configsections> <section name="unity" type="microsoft.practices.unity.configuration.unityconfigurationsection, microsoft.practices.unity.configuration"/> </configsections> <unity xmlns="http://schemas.microsoft.com/practices/2010/unity"> <namespace name="system.collections.generic" /> <namespace name="consoleapplication1" /> <assembly name="consoleapplication1" /> <container> <register type="a" mapto="b" name="b" />

Creating custom widgets for ruby gem dashing.io - Or combining widgets elements -

i'm working dashing ruby gem , combine elements of graph , number widgets. elements of graph , include up/down percentage arrow number widget. i've never done work ruby , understand there few files within widget might need changed. i've setup few nice widgets , i'm using job pull data redis db populate. i've added following graph.html page: <p class="change-rate"> <i data-bind-class="arrow"></i><span data-bind="difference"></span> </p> this has no effect, , i'm sure i'm missing in 1 of many files makes work. your on right track, , i've put similar in order complete trying need send data 2 new data binds, done jobs file , graph.coffee file. i'm not sure how you're getting graph data redis jobs erb file want setup couple new variables, example have used nownumber , lastnumber . these number valuation performed on. jobs/jobname.erb send_event('graph&

java - Behavoir of Threads with AtomicInteger -

the following problem on mock exam ocp java se 7 programmer ii exam. solution says answer 0, colleagues , not sure answer isn't between -5 , 5 (which choice) clarify us? here code: import java.util.concurrent.atomic.atomicinteger; class atomicvariabletest { private static atomicinteger counter = new atomicinteger(0); static class decrementer extends thread { public void run() { counter.decrementandget(); // #1 } } static class incrementer extends thread { public void run() { counter.incrementandget(); // #2 } } public static void main(string []args) { for(int = 0; < 5; i++) { new incrementer().start(); new decrementer().start(); } system.out.println(counter); } } thanks! running multiple times log

Cakephp 3 loading HasOne inside HasMany association -

i using cakephp 3.2.10 i able load associated data hasone association , hasmany association. however, have 1 hasone inside table associated hasmany, , gives error. i have following tables companies company_revenues currencies states countries. companiestable class has hasone associations states,countries , works. companiestable has hasmany association companyrevenuestable, , works. companyrevenues table has hasone association currencies, gives error. my relevant code : companiestable.php <?php namespace admin\model\table; use cake\orm\table; use cake\orm\query; use cake\orm\ruleschecker; class companiestable extends table { public function initialize(array $config) { $this->primarykey('company_id'); $this->addassociations( [ 'hasone' => [ 'countries' => [ 'classname' => 'countries','foreignkey' => '

javascript - how check if element exists in array? -

is there way check if track_id exists on array? here array structure, tried use indexof . {"playlist":[{track_id : 1}, {track_id : 2}, {track_id : 3}]} use array#some method var obj = { "playlist": [{ track_id: 1 }, { track_id: 2 }, { track_id: 3 }] }; var search_id = 2; var found = obj.playlist.some(function(v) { return v.track_id == search_id; }); console.log(found);

javascript - VertX Webserver static content webroot -

i've got 2 projects i've created: a web ui built using webpack a vert.x webserver written in java built using gradle i want find way bring resulting build dir contents of first project second webroot server using statichandler . is aware of clean way this? want preserve 2 git projects because using webpack dev server development of ui , feels cleaner have them separated. i looking @ potentially using bitbucket pipelines build on repo, bringing assets generated first project build of second i'm facing issues. you create gradle task before depends on jar task (so runs before it) executes webpack compile resources directory. when jar task runs bundles compiled webpack code.