Posts

Showing posts from February, 2014

java - How to cast to run superclass method -

this question has answer here: overriding methods in java , casting object parent class behavior 5 answers is there way use casting m1() method run in i1 class print in i1 class ? don't want run overridden method. class testclass extends i1 implements i2{ public void m1() { system.out.println("hello"); } public static void main(string[] args){ i1 tc = new testclass(); tc.m1(); } } class i1{ int value = 1; public void m1(){system.out.println("in i1 class");} } interface i2{ int value = 2; void m1(); } no, can't this. part of point of polymorphism able hide implementation detail classes lower down in hierarchy. can invoke superclass method, call inside overridden method. think this. maybe testclass important inside method m1 maintains in

Thinktecture Identity Server 3 Asp.Net Identity Sample, constantly getting 401 authorization denied -

i trying asp.net identity sample of identity server working in web api project, , beginner trying work on getting tokens , sending request apis using the bearer tokens. so using fiddler, can send request https://localhost:44333/core/connect/token following content: client_id=roclient&client_secret=secret&grant_type=password&username=bob&password=mypass&scope=read write offline_access , works fine, access token , refresh token. then have web api project in solution, has code use bearer token: app.useidentityserverbearertokenauthentication(new identityserverbearertokenauthenticationoptions { authority = "https://localhost:44333", validationmode = validationmode.validationendpoint, requiredscopes = new[] { "api1" } }); and test controller in api protected using [authorize] decorator. as said, fetching token works fine, when use fiddler send request api "401 authorization deni

c# - Using ComTypes.ITypeInfo.CreateInstance object's information to expose interfaces within a coclass -

i'm working unmanaged type libraries , reference files in c# (.net) application information out of them, such interfaces, functions, enums, etc, contain. have object of type comtypes.itypeinfo represents coclass. i've written code coclass's name, want list of names of interfaces contained within coclass. couldn't find "easy-access" properties in system.runtime.interopservices.comtypes namespace, meet end, i'm using itypeinfo.createinstance . understanding, doing can out com object of type object , desired information (i'm beginner @ com feel free point out i'm incorrect). i can way i've made call on coclass , got out object of type "object {system.__comobject}", i'm not sure go there. how can use coclass com object obtain names of interfaces contains? here's code i'm using coclass com object: //assume ti object below initialized object of typekind.tkind_coclass comtypes.itypeinfo ti; if(//condition know ti coclass)

How to I parse JSON list of dictionaries in javascript -

i'm new javascript , need iterate through json list of dictionaries create list each key. here's json: [ { "date": "aug. 14, 2015", "reel": "reel 1", "job": "color correction", "status": "in progress", "completion": "60" }, { "date": "aug. 14, 2015", "reel": "reel 1", "job": "conform", "status": "in progress", "completion": "70" }, { "date": "aug. 14, 2015", "reel": "reel 2", "job": "scanning", "status": "complete", "completion": "100" }, { "date": "aug. 12, 2015", "reel": "reel 1

objective c - May I implement one function of protocol in subclass? -

i modified it. problem if want have subclass inherit baseparticipant, may re-implement func performevent inside subclass? example: class cyclingparticipant: baseparticipant, participant { init(name: string) { super.init(name: name, preferredevent: event.cycling) } func performevent(event: event, distance: distance) throws { } } but compiler said "redundant conformance of cyclingparticipant protocol participant . class baseparticipant: participant { var name: string var preferredevent: event var racetime: int var couldnotfinish: bool //var performedevent: event // in swift, class accepts protocol must impletment funcs inside protocol init(name: string, preferredevent: event) { self.name = name self.preferredevent = preferredevent self.racetime = 0 self.couldnotfinish = false } func getname() -> string { return self.name } func getpreferredevent() -> event { return self.preferredevent } func isdisqualified() -> bool {

Java code - number of files in a JAR -

i want find number of files jar contains. there way without looping through this: while (enumentries.hasmoreelements()) { enumentries.nextelement(); count++; } i want have number of files before loop through entries. seems not elegant loop through them twice. you can use size() count number of entries that's loop return. uses jarfile f = new jarfile(new file("path.jar")); system.out.println(f.size());

javascript - Highcharts addPoint function show nothing -

in first case apologize bad english i'm french :d so tried show timed data on highchartsjs. i try receive data using ajax , made function add point want. but when try load see information on cursor no point shown ! :/ here success function on ajax request : success: function(resultat){ function addpoint(){ var chart = $('#graphresult').highcharts(); for(i in resultat){ chart.series[0].addpoint([date.utc(year, month, day, resultat[i]["time"].split(":")[0]), resultat[i]["value"]], true); } } $('#graphresult').highcharts({ chart: { type: 'spline', events: { load: addpoint } }, title: {

eclipse - Find a project or plug-in in Ecilpse workspace -

so have 300 plug-ins , features in workspace @ given time. , want filter package explorer view, show projects have, say, xyz in name. there way this? i can't seem find way search projects in search dialogs either. feel should straightforward can't seem recall how right now, if ever possible. using eclipse 4.4.2, on windows 7. try custom package explorer plugin . here can filter resources.

node.js - Prana Side Car Service to Service Call -

i running strange problem. have implemented prana sidecar nodejs based service. node service uses prana host uri locate , call service. of services in docker containers. looks have directly call node service first in order prana work. otherwise getting following error: 21:00:46.080 [http-nio-9003-exec-1] debug o.s.c.n.zuul.web.zuulhandlermapping - mapping [/sqlprana] handlerexecutionchain handler [org.springframework.cloud.netflix.zuul.web.zuulcontroller@44cddafb] , 1 interceptor 21:00:46.106 [http-nio-9003-exec-1] info o.s.c.n.z.filters.proxyroutelocator - finding route path: /sqlprana 21:00:46.106 [http-nio-9003-exec-1] debug o.s.c.n.z.filters.proxyroutelocator - servletpath=/zuul 21:00:46.107 [http-nio-9003-exec-1] debug o.s.c.n.z.filters.proxyroutelocator - path=/sqlprana 21:00:46.107 [http-nio-9003-exec-1] debug o.s.c.n.z.filters.proxyroutelocator - matching pattern:/sqlparser/** 21:00:46.108 [http-nio-9003-exec-1] warn o.s.c.n.z.f.pre.predecorationfilter - no route f

javascript - Alert after executing php script while not leaving current page -

this question has answer here: how fix “headers sent” error in php 11 answers i have page 2 submit buttons using if ($_post['action'] == 'test sms') executed code "test sms" button. need execute code php script give alert box while not leaving page. i keep reading ajax way , i've tried, index.php , updateuserconfig.php on different servers, cross-domain errors. it seems i'm not using header() function correctly current code want. executes script without leaving page, i'm not getting alert popup. i've tried redirect js, won't redirect until "ok" clicked on alert button, until browser directed empty page don't want. i've tried using js on index.html, alert before script executed, , don't have easy access php variable alert phone number test text sent to. index.html <form action="u

.net - How do I publish multiple NuGet packages from a single solution in TeamCity? -

i have visual studio 2015 solution 3 c# projects depend on each other: project -> project b -> project c i each of these projects have own independently versioned nuget packages in teamcity. automatically build , publish nuget packages downstream projects. for example, assuming projects start @ version 1.0.0.1, if project updated v1.0.0.1 v1.0.0.2, project b should incremented v1.0.0.2 , rebuilt reference project v1.0.0.2, in turn triggers project c incremented v1.0.0.2 , rebuilt reference project v1.0.02 , project b v1.0.02. but if project c updated v1.0.0.2 v1.0.0.3 in isolation, neither project nor project b should built , versions numbers should not incremented. i aware of -includereferencedprojects nuget option, not sure how prevent teamcity patching assemblyversioninfos of upstream projects. is there way in teamcity or there alternative solution problem?

How to store a 2D array in a regular array? Java -

basically want able store 2d array such this int [][] preferredmoves = { {0,0}, {0, arrlength}, {length%2, arrlength}, {0, length%2}, {arrlength, 0}, {0, length%2}, {arrlength, arrlength}, {length%2, length%2}, {arrlength, length%2}, {length%2, 0} }; in single int [] moves; array. i'm sure possible since i'm storing list..., can't seem find information on anywhere... or maybe not possible? edit dealing matrices. want store list in single array return array use elsewhere. so every time call it, have this... int row = computer.moves()[0]; int col = computer.moves()[1]; i need loop through single array, contains 2d array multiple times.. not sure if meant, drop internal { ... } convert one-dimensional array: int [] moves = { 0, 0, 0, arrlength, length % 2, arrlength, 0, length % 2, arrlength, 0, 0, length % 2, arrlength, arrlength, length % 2, length % 2,

excel - Pull data from Website into VBA -

Image
this might fall under dumb question newbie. don't know start in vba. tried few different approaches on web trying pull data site i'm trying , of them failed miserably. can me (more or less show me) how pull data website? https://rotogrinders.com/projected-stats/nfl?site=fanduel it wouldn't let me data->import. here have far. keep getting stuck on line t = 0 (table.length - 1). sub test1() dim appie object set appie = createobject("internetexplorer.application") dim table object dim t integer dim r integer dim c integer appie .navigate "https://rotogrinders.com/projected-stats/nfl?site=fanduel" .visible = true end while appie.busy doevents loop set table = appie.document.getelementbyid("proj-stats") t = 0 (table.length - 1) r = 0 (table(t).rows.length - 1) c = 0 (table(t).rows(r).cells.length - 1) thisworkbook.worksheets(1).cells(r + 1, c + 1) = table(t).rows(r).cells(c).innertext next c next r

python - Two point segment plot in matplotlib -

Image
how can plot 2 point line segment plot shown in following figure the data below x = [1,2,3,4,5,6] y = [1.2,1.2,-2.1, -2.1, 4.1, -4.1] #these y values in pair such need solid line connect these equivalent values , dotted line between pair , next pair. does achieve hoping? import numpy np import matplotlib.pyplot plt x = [1, 2, 3, 4, 5, 6] y = [1.2, 1.2, 2.1, 2.1, -4.1, -4.1] plt.plot(x, y, 'm--') pair_x_array = np.reshape(x, (-1, 2)) pair_y_array = np.reshape(y, (-1, 2)) i, pair_x in enumerate(pair_x_array): pair_y = pair_y_array[i] plt.plot(pair_x, pair_y, 'm', linewidth=3) plt.show()

Change comma color of a number in javascript or jquery -

did have trick change color of comma in number : 1,850,358 withtout addind css class, styles, or html separators : 1<span class="red">,</span>850<span class="red">,</span>358 i quite out of ideas.. use style? 1<span style="color:red">,</span>850<span style="color:pink">,</span>358 the better way define angularjs directive or polymer web component turns specified characters color. markup this: <character-magic char="," color="#fa1122">you notice in text, every comma has specific color. isn't great, no?</character-magic> in end, component/directive still inline styling mentioned above style.

python - Stop a tornado.TCPServer without waiting for connections to close -

the docs tornado.tcpserver.tcpserver.stop say: requests in progress may still continue after server stopped however, test robustness want simulate full crash of server. is there preferred way abruptly terminate tornado.tcpserver? in particular want terminate open sockets ungracefully . edit so don't think stop terminates existing connections. following code prints 1, 2 from tornado import gen tornado.ioloop import ioloop tornado.tcpserver import tcpserver tornado.tcpclient import tcpclient port = 9000 class server(tcpserver): @gen.coroutine def handle_stream(self, stream, address): while true: bytes = yield stream.read_bytes(5) yield stream.write(bytes) server = server() server.listen(port) @gen.coroutine def client(): client = tcpclient() stream = yield client.connect('127.0.0.1', port) yield stream.write(b'hello') result = yield stream.read_bytes(5) assert result == b'hello

sql - Unable to find Restore Database Option in SSMS -

Image
i trying restore .bak file in sql server using ssms. unable find restore database option in menu bar, when right-clicked on database. what can possible reason that? need change ssms settings. using sql server management studio 2014. it's not possible restore .bak file azure sql database. migrate data azure sql database, see documentation: https://azure.microsoft.com/en-us/documentation/articles/sql-database-cloud-migrate/

Create onmouseover/onmouseout functions dynamically with javascript? -

so here example of function need replicate: document.getelementbyid('img1').onmouseover = function() { document.getelementbyid('img1').style.width = expandto + '%'; expandcompensate(1); } document.getelementbyid('img1').onmouseout = function() { expandreset(); } the situation have for loop creating div elements, , number of them dynamic. of right now, have creating 4 div elements, created 4 iterations of above functions img1 , img2 , img3 , img4 . have onmouseover , onmouseout functions created dynamically based on how many div elements i've decided create (based on variable). is there way this? here code context (it's not much), there comments in js explanations everything. part i'm trying automate @ bottom: https://jsfiddle.net/4w0714su/3/ and here working example context of i'm trying achieve: http://www.ericsartor.ca/imgwide fyi: image picked random, needed high res images. doing practice! c

scala - Integrate BigQuery with Spark -

how can connect spark google's bigquery? i imagine 1 use spark's jdbc functionality communicate bigquery. but jdbc driver found starschema old. if answer involves jdbc should url parameter like? from spark docs : rdd.todf.write.format("jdbc").options(map( "url" -> "jdbc:postgresql:dbserver", "dbtable" -> "schema.tablename" )) you can use bigquery connector hadoop (which works spark): https://cloud.google.com/hadoop/bigquery-connector if use google cloud dataproc ( https://cloud.google.com/dataproc/ ) deploy spark cluster, bigquery connector (as gcs connector) automatically deployed , configured out of box. but can add connector existing spark deployment, whether runs on google cloud or anywhere else. if cluster not deployed on google cloud you'll have configure authentication (using service-account "keyfile" authentication). [added] answer other question ( dataproc +

sharepoint 2013 - AppFabric unable to create a DataCache (LMTRepopulationJob FAILS) -

Image
well first of all, learning sharepoint 2013 , have been following few tutorials, far setup farm , seems working except service being logged event viewer every 5 minutes: the execute method of job definition microsoft.office.server.userprofiles.lmtrepopulationjob (id 1e573155-b7f6-441b-919b-53b2f05770f7) threw exception. more information included below. unexpected exception in feedcacheservice.bulklmtupdate: unable create datacache. spdistributedcache down.. i found out job configured execute every 5 minutes but regarding assumption spdistributedcache down, verified , running as can see, running, checked host cache via sp powershell ( get-cachehost , get-cacheclusterhealth ) , still seems fine yet when execute command get-cache getting default value, , have read there should listed cache types like: distributedaccesscache_xxxxxxxxxxxxxxxxxxxxxxxxx distributedbouncercache_xxxxxxxxxxxxxxxxxxxxxxxx distributedsearchcache_xxxxxxxxxxxxxxxxxxx

Use Subquery in FROM clause Hibernate HQL -

this hql query, , throwing " invalid token select" . how can implement it, read hibernate doesn't support subquery in clause. select subq.workitemid ,subq.subject, subq.workitemcrtddt, subq.workitemduedt, subq.workitemrcpntnm, subq.workitemcrtrnm, subq.lkworkitemstatuscd,subq.lkworkitemprioritycd (select wi workitem wi, workitemrecipient wir wi.workitemid = wir.workitem.id , (wi.workitemcreateuserid=:userid or (wir.recipientid= :userid or (wir.recipientid= :alluserid , wir.recipientorgid= :userorgid)))) subq your query rewritten regular select, need resolve subq correct alias. assuming: table: workitem has columns: workitemid , subject, workitemcrtddt, workitemduedt, workitemcrtrnm, lkworkitemstatuscd, lkworkitemprioritycd table: workitemrecipient has columns: workitemrcpntnm then query be: select wi.workitemid ,wi.subject, wi.workitemcrtdd

java - Unexpected Type -

i'm new java. having problem block of code. attempting find minimum number of coins needed pay amount (in example 398 cents). i'm getting error unexpected type. required: variable. found: value. after attempt subtract on lines 20, 25, 30, 35, 40, 45 , 50. want subtract value. think have use method i'm unsure how. appreciated. public class makingchange { public static void main(string[] args) { int = 398; int b; int c; int d; int e; int f; int g; int h; int j; int k; int i; int l; int m; int n; int o; if (a > 0) { if (a >= 200) { = (int) / 200; - * 200 = b; } else { = b; } if (b >= 100) { j = (int) / 100; b - j * 100 = c; } else { b = c; } if

C structs NxN intersection -

this question has answer here: self referential struct definition? 9 answers i have script a.h #include b.h typedef struct b b; typedef struct a; struct a{ val1; b val2; } b.h #include a.h typedef struct b b; typedef struct a; struct b{ val1; b val2; } how can make work? can create val1 , give him val1.val2=xx val1.val2.val1=xx or val2.val1=xx isn't working. you're trying create struct contains copy of itself. can't work. can create pointer itself: typedef struct b b; typedef struct a; struct b{ *val1; b *val2; };

javascript - Get confused by the scope in angularJS -

i'm learning angulajs video introduction angular.js in 50 examples , it's awesome i'm confused since #46. we, say, want nation's information json file , display it, , have directive definition: countryapp.directive('country', function () { return { scope: { country: '=country' }, restrict: 'a', templateurl: 'country.html' }; }); and invoke directive country in html: <ul> <li ng-repeat="country in countries" country="country"></li> </ul> my question is: exact meaning of 4 different nouns "country" is? first 2 in directive scope(country: '=country' ), last 2 in html(country="country"). understand first 1 variable definition in directive, should change name such dir_country, can't work ! here's example different: <li ng-repeat="country in countries" country-dir="cou

coding style - Difference between #ifdef __linux and #ifdef __unix in C++ header file -

i've seen boilerplate header file code dealing different os's, following: #ifdef __win32 //windows #elif __linux //linux #elif __unix //all unix not captured above #endif if __unix catches unices not captured __linux , why not use __unix ? i'm assuming it's sort of safeguard, "if __linux isn't enough, use this". however, there has reason both used, instead of having catch-all __unix (once again, assumption may wrong). what's deal? as have been stated in comments unix , linux 2 different operating systems , although large amount of software compatible have separate licensing structure. means number of tools available in linux not available in unix , vice versa. example of unix's zfs file system cannot distributed under same license linux , result support not included in stock linux kernels (although possible compile custom kernel support). in terms of particular boiler plate covering basis , used take advantage of

python - Need to fix x-axis and y-axis for a graph so that I can clearly see the representation -

i have image being produced output in python(spyder). numbers on y-axis cluttered, , impossible read them. how can make graph such every number on y-axis clear read. want change length of x-axis, user can idea of value each bar corresponds on x-axis. hard read @ point. so, yes want change both x-axis , y-axis in own ways mentioned above. please me this. using import matplotlib.pyplot plt, please don't change that. please follow link below image of graph getting. http://i57.tinypic.com/6g8obb.png here code: temparray = mynumpread[:,1] barh = plt.subplot(111) width = 0.8 barh.barh(range(len(states)), temparray) barh.set_ylim(-width,len(states)+width) barh.set_yticks(np.arange(len(states)) + width/2) barh.set_yticklabels(states, rotation=0) plt.title('population state') plt.xlabel('population') plt.ylabel('state ticker') plt.grid(true) plt.show() thank help. your question difficult answer because code not reproducible without variables ,

excel - how to create range from a list of python dicts? -

i'm using openpyxl evaluate worksheet. there 1 row on worksheet contains column_group names in merged cells. created list of dicts column_group key , column number value col_groups= [{u'layer': 1}, {u'single ended': 17},\ {u'single ended': 22}, {u'edge coupled': 27}] now want create group_name:(start_column:end_column) dictionary using col_groups this closest i've been able get. group_cols = [] x, d in enumerate(col_groups): try: group_cols.append({col_groups[x].keys()[0]:(col_groups[x].values()[0],(col_groups[(x+1)].values()[0] - 1))}) except: group_cols.append({col_groups[x].keys()[0]:(col_groups[x].values()[0],tap_sh.max_column)}) typing group_cols @ python shell prompt gives: [{u'layer': (1, 16)}, {u'single ended': (17, 21)}, {u'single ended': (22, 26)}, {u'edge coupled': (27, 33)}] the output looks ok method feels bit hackish- suggestions more pythonic app

html - flexslider 2 ul with "slide" class doesn't show up with bootstrap -

i'm trying use flexslider 2 bootstrap 3 .the problem after place flexslider 2 codes , run page , ul "slide" class out of page . have @ following pictures , know problem . http://i.stack.imgur.com/6mowv.jpg http://i.stack.imgur.com/83kox.jpg i don't know if has conflict bootstrap 3 .how should fix ? thanks in advance

How to add Android actionmenu text -

how add text view in action bar show data in android application. following menu.xml <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:context=".mainactivity"> <menu> <item android:id="@+id/action_log" android:title="@string/action_log" android:showasaction="never"/> <item android:id="@+id/account_log" android:title="@string/accountlog" android:showasaction="never"/> <item android:id="@+id/logout" android:title="logout" android:showasaction="never"/> </menu> </menu> any changes required in strings.xml? change android:showasaction="never" to android:showasaction="ifroom" please check correct case of ifroom, not quite sure.

php - Inner join in datamapper codeigniter -

i have 2 table products , categories , want products category name. product table(products) id (auto_increment) | name(varchar) | category_id(int) | price(decimal) | user_id(int) category table(categories) id(auto_increment) | name(varchar) required query : select * products p inner join categories c on (p.category_id = c.id) p.user_id = 1 model product.php class product extends datamapper { var $has_many = array('category'); var $validation = array( 'name' => array( 'label' => 'name', 'rules' => array('required', 'trim', 'alpha_dash', 'min_length' => 3), ), 'category_id' => array( 'label' => 'category id', 'rules' => array('required', 'trim', 'alpha_dash'), ), 'price' => array( 'label' => 'price', 'rules' =>

google maps - resizeevent is not firing -

i using meteor-google-map. trying resize map google.map.event.trigger(googlemaps.maps.examplemap , resize) problem it's not working. map hidden in tab whenever open tab map not shows. tried using resize function not doing anything. can tell me why not displaying code added map html <body> <div class="row"> <ul> <li><a href="#what">what</a></li> <li><a href="#where">where</a></li> </ul> </div> <div id="what" class="col s12"> </div> <div id="where" class="col s12"> <div class="map-container"> {{> googlemap name="examplemap" options=examplemapoptions}} </div> </div> </body> map.js template.body.helpers({ examplemapoptions: function() { // make sure maps api has loaded if (googlemaps.loaded()) { // map initialization option

an iOS app for my classifieds ads website -

im learning swift2 using xcode 7 , want create ios app classifieds ads website! not programmer believe can make myself if can give me tips on way connect data site app! should have separated database or can relay on contents on website transferred app! if there way please let me know! apprecaite ! there many ways can go accomplishing need do. create link website using var url = nsurl(string:"your website address") if url != nil { let task = nsurlsession.sharedsession().datataskwithurl(url!, completionhandler.{(data, response, error) ->void in if error != nil { //handle error } else { //what }} you go creating table cells having links particular item on website. how implement you. can creating online db using cloud service , link app.

c - Find all possible arrangements of a n numbers in an array -

i have array contains lets [25,15,8,20] want find possible arrangements of numbers possible. expected output: 25 15 8 20 25 15 20 8 25 20 15 8 25 20 8 15 25 8 20 15 25 8 15 20 15 25 8 20 15 25 20 8 15 20 25 8 15 20 8 25 15 8 20 25 15 8 25 20 20 25 15 8 20 25 8 15 20 8 25 15 20 8 15 25 20 15 25 8 20 15 8 25 8 15 20 25 8 15 25 20 8 25 15 20 8 25 20 15 8 20 15 25 8 20 25 15 void print(int *num, int n) { int i; ( = 0 ; < n ; i++) printf("%d ", num[i]); printf("\n"); } int main() { int num[n]; int *ptr; int temp; int i, n, j; printf("\nhow many number want enter: "); scanf("%d", &n); printf("\nenter list of numbers see combinations:\n"); (i = 0 ; < n; i++) scanf("%d", &num[i]); (j = 1; j <= n; j++) { (i = 0; < n-1; i++) { temp = num[i]; num[i] = num[i+1]; num[i+1] = temp; print(num, n); } } return 0; } the above program not giving possib

How to get HTML selected value and process in C? -

i got code in c shows list of directories in specific path , need show these directories in html select: /* * listdir.c - leer archivo de un directorio */ #include <stdio.h> #include <stdlib.h> #include <dirent.h> void err_quit(char *msg); int main(int argc, char *argv[]) { dir *dir; struct dirent *mydirent; int = 1; if(argc != 2) { //puts("uso: listdir {pathname}"); //exit(exit_failure); argv[1]="/home/maudev"; } if((dir = opendir(argv[1])) == null) { err_quit("opendir"); } printf("%s%c%c\n","content-type:text/html;charset=iso-8859-1",13,10); printf("<title>carpetas</title>\n"); printf("<h3>carpetas</h3>\n"); printf("<select>\n"); while((mydirent = readdir(dir)) != null) { printf("\n<option value='%s'>%s",mydirent->d_name,mydirent->d_nam

javascript - How to change model and render Marionette view from another view -

i' ve got layoutview in marionette. give onrender method: onrender: function() { this.showchildview("content", new canvasview({ model: this.model })); this.showchildview("library", new libraryview()); this.showchildview("properties", new propertiesview({ model: this.model })); } in content there model, contains svg elements(for ex. line, ellipse...) properties. need change model in propertiesview. example need change line width or color , rerender "content" child view. how this? propertiesview consists of input sets. example: line color: <input type="text" id="id_2" name="style" value= <%= linecolor %>> you can use backbone event system . every time set model change event fires. in propertiesview can add events user interaction. on every input set content model: ui: { 'style': 'inp

use php to add html header and footer section to a particular page -

i have 2 php pages called header.php , footer.php.they used add header , footer every page have. have include them every page.but problem when try add content in mid section goes directly under header section.what reason behaviour? here in particular code h1 tag not visible.it goes under header portion. index.php: <?php include('header.php'); ?> <h1>this page</h1> <?php include('footer.php'); ?> header.php: <html> <head> <style> </style> </head> <body> <div id='head'> <span ><a href='#' id='top'>myphp</a></span> <ul id='huls'> <li><a href='#'>home</a></li> <li><a href='#'>faq</a></li> <li><a href='#'>log in</a></li> <li><a href='#'>about us</a></li> </ul&g

How can I do Hapi with AngularJS, Webpack + TypeScript -

basically mean stack without mongodb , express. never dived in angular want see magic is. i followed getting started guide. folder structure looks this: hapiserver |--static |--routes | |--api.js |--server.js |--angular-test | |--src | | |--polyfill, .ts , stuff | |-- .ts, .json, karma stuff ng serve compile webpack , serve files on port 4200 karma. i use hapi i'm more familiar hapi , koa express. also, 50% of code implemented. what should do? feasible? thanks edit: i use hapi - don't know how works angular , setup angular-cli made me, if there can suggest (except "stick that") feel free comment.

Is using many boolean columns faster than a longer string in MySQL combined with PHP? -

in mysql, faster use: many boolean columns (for example 100) varchar(100) string (consisting of 0 , 1) the advantage of first option ability read , update specific values only. in second 1 have handled via php. the possible disadvantage of first option may column count if whole row has selected (or more of them). in second option 1 varchar value selected per row , rest handled via php. not sure one. ps: around column count answer change if @ all? as see it, use of long varchar column , consist many properties inside it, wrong , because maintenance , handling bad , difficult , , lead many errors hard spot. each indication should have column of it's own , , optimizer should know how deal many boolean columns efficiently .

angularjs - Using selected in a directive -

i have following works in controller. when adding directive dosent work, , expect selected dosent work in directives. directive("multiselectlist", function () { return { scope: { datasource: "=", datasourceselected: "=" }, template: "<div class='col-md-12'> \ <div class='button-group'> \ <button type='button' class='btn btn-default btn-block btn-sm dropdown-toggle' data-toggle='dropdown'><span class=''>turbinenumber</span> <span class='caret'></span></button> \ <ul class='dropdown-menu' style=''> \ <li style='padding-left:10px;' ng-repeat='c in datasource'> \ <label style='font-weight:100;'> \ <input type='

javascript - ASP.Net MVC 5 Passing data to modal -

i need pass object modal. have : @for (int = 0; < @model.count; i++) { <div id="contentdiv" style="margin: 10px"> <div class="form-group"> <div> day : @model[i].day.day / hour : @model[i].hour </div> <div class="form-group"> <button id="reservationbutton" class="btn-default btn-lg" disabled="@model[i].ishourtaken()" onclick="@($"openmodalpopup('{i}')");">book</button> </div> </div> </div> } my js : function openmodalpopup(id) { $('#mymodal').modal(); }; and modal : <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel"> <div class="modal-dialog" role="document"> <div

java - Multiple markers at this line - txt_status_iap_3 cannot be resolved or is not a field -

i changed inappactivity.java file , got error: multiple markers @ line - txt_status_iap_3 cannot resolved or not field - txt_status_iap_4 cannot resolved or not field default code doesn't cause error: txtstatusiap.settext( getresources().getstring(r.string.txt_status_iap_1) + " " + getmoney() + " " + getresources().getstring(r.string.txt_status_iap_2) ); i want add: txt_status_iap_3 txt_status_iap_4 how can it?

ios - Move view with keyboard using swift 3 -

i have app has text field on lower half of view , have navigation controller bottom of page. how go moving view upwards while typing can see i'm typing , moving down original place when keyboard disappears? don't want move navigation controller you have observe changes in keyboard frame , act accordingly show uiview (uitextfield, uitextview etc.) above keyboard. notificationcenter apple documentation: https://developer.apple.com/documentation/foundation/notificationcenter other answers @ stackoverflow: how make uitextfield move when keyboard present? here quick example of view controller: import uikit class exampleviewcontroller: uiviewcontroller { // mark: - properties @iboutlet weak var exampletextview1: uitextview! @iboutlet weak var exampletextview2: uitextview! @iboutlet weak var exampletextview1bottomconstraint: nslayoutconstraint! @iboutlet weak var exampletextview2bottomconstraint: nslayoutconstraint! var exampletextview1bottomcon

Ionic cordova build Android failed -

i need build android app ionic cordova, there problem i'm not able solve, hoping advice. my ionic info follows: cli packages: (/usr/local/lib/node_modules) @ionic/cli-plugin-proxy : 1.4.6 @ionic/cli-utils : 1.10.0-alpha.b34c24dc ionic (ionic cli) : 3.10.0-alpha.b34c24dc global packages: cordova cli : 7.0.1 local packages: @ionic/app-scripts : 2.1.4 cordova platforms : android 6.2.3 ionic framework : ionic-angular 3.6.0 system: node : v6.9.1 npm : 4.1.2 os : macos sierra use sudo ionic cordova build android , there's error show: cordova-android-play-services-gradle-release play_services_version: 11.+ android_home=/users/neolee/library/android/sdk java_home=/library/java/javavirtualmachines/jdk1.8.0_111.jdk/contents/home subproject path: cordovalib exception in thread "main" java.lang.runtimeexception: timeout of 120000 reached waiting exclusive access file: /var/root/.gradle/wrapper/dists/

mysql - Eloquent Inner Join count -

i want count rows in table "links" links.page_id = pages.id. $link_item = link::where('links.friendly_url', $id) ->join('pages','pages.id','=','links.page_id') ->select('pages.description pdescription', 'pages.name', 'pages.photo pphoto', 'pages.id pid', 'links.*') ->get(); return view('site.link', compact('link_item')); how can it? just add ->count() end of query have it, or can $link_item_count => $link_item->count();

vue.js - How to stop router from a component? -

there component takes action , person should not leave without having saving there method beforedestroy() works fine, not understand how stop transition. rather, link changes, component has not yet deleted. you should using router's navigation guards ( https://router.vuejs.org/en/advanced/navigation-guards.html ) , register guard on router.beforeeach((to, from, next) => { // ... })) method. then need call next(false) cancel navigation after checking component dirty.

How can I execute SELECT query without prompt dialog box in access? -

i have form text box named fchname , subform of queryworkersub query named queryworker "select query". needs parameter. i'd execute query without prompt dialog box , updating sub form can't find way that. (i want queryworker executed without prompt updating sub form) private sub fchname_exit(cancel integer) dim qdf dao.querydef dim prmchname dao.parameter dim dbs database, rst recordset set dbs = currentdb set qdf = dbs.querydefs("queryworker") qdf.execute 'causes runtime error of 3065. because of select query set rst = qdf.openrecordset(dbopendynaset, dbseechanges) 'does not update subform of queryworkersub me.queryworkersub.form.requery' updates sub form shows prompt. rst.close set rst = nothingend set dbs = nothing end sub

php - RecursiveDirectoryIterator to echo list separated by folders -

is there way recursivedirectoryiterator echo files in subfolders separately based on folder , not together? here example. have folder (event), has multiple subfolders (logo, people, bands). subfolder names vary events, can't set inside these three, need "wildcard" option. when use recursivedirectoryiterator echo out images these folders, works, separate these based on subfolder, echoes out folder name , images within below , repeats next folder , on. right use this: <?php $directory = "path/to/mainfolder/"; foreach (new recursiveiteratoriterator(new recursivedirectoryiterator($directory,recursivedirectoryiterator::skip_dots)) $filename) { echo '<img src="'.$filename.'">'; } ?> so, how make echo like: logo image, image, image people image, image, image ... thanks in advance useful tips , ideas. for me, code more readable when put objects variables descriptive names pass on when instantiating o

html - How to get sub attribute value using cheerio in javascript -

i using cheerio library data scraping. trying value of tag using below var sparkline = $(this) .find("td") .eq(7).text; html <td><a href="/currencies/bitcoin/#charts"><img class="sparkline" alt="sparkline" src="https://files.coinmarketcap.com/generated/sparklines/1.png"></a></td> it returns undefined there no value of td tag , child tag. know how img src value here ? it works below html var sparkline = $(this) .find("td") .eq(6).text; html <td class="no-wrap percent-24h negative_change text-right" data-usd="-4.85" data-btc="0.00" >-4.85%</td>

Inheriting from generic WeakEventManager creates error -

i want make weakeventcollectionweaver bind multiple observablecollection s together. i inherit this: public class weakeventcollectionweaver<t> : weakeventmanager<observablecollection<t>, notifycollectionchangedeventargs> { } but error: cs1729 weakeventmanager<observablecollection<t>, notifycollectionchangedeventargs> not contain constructor takes 0 arguments i looked , believe not have implement constructor. why error there? it not possible inherit class. has private constructor (hence no default constructor), descendant classes cannot call it. take @ source of class here: https://referencesource.microsoft.com/#windowsbase/base/system/windows/weakeventmanagert.cs,a795c952f2e86713

amazon sqs - can this code can be translated to stateful akka streams? -

Image
i'm trying listen sqs using akka streams , messages it's q using code snippet: of course code snippet messages one-by-one (then ack it): implicit val system = actorsystem() implicit val mat = actormaterializer() implicit val ec = executioncontext.fromexecutor(executors.newfixedthreadpool(iothreadpoolsize)) val awssqsclient: amazonsqsasync = amazonsqsasyncclientbuilder .standard() .withcredentials(new classpathpropertiesfilecredentialsprovider()) .withendpointconfiguration(new endpointconfiguration(sqsendpoint, configuration.regionname)) .build() val future = sqssource(sqsendpoint)(awssqsclient) .takewhile(_ => true) .mapasync(parallelism = 2)(m => { val msgbody = sqsmessage.deserializejson(m.getbody) msgbody match { case right(body) => val id = getid(body) //do stuff message may save state according id } future(m, ack()) }) .to(sqsacksink(sqsendpoint)(awssqsclient)) .run() my question is: can several messages, , save

php - Why XMLReader repeat mysql insert function inside while and can't stop? -

i using xmlreader import huge xml file elements mysql database. xml contains 1 547 772 tags (element) named 'record'. xml example <?xml version="1.0" encoding="utf-8"?> <record><name>ДОШКІЛЬНИЙ НАВЧАЛЬНИЙ ЗАКЛАД №1 ЗАГАЛЬНОГО РОЗВИТКУ УЖГОРОДСЬКОЇ МІСЬКОЇ РАДИ ЗАКАРПАТСЬКОЇ ОБЛАСТІ</name><short_name>ДНЗ №1</short_name><edrpou>34888585</edrpou><address>88000, Закарпатська обл., місто Ужгород, ВУЛИЦЯ М.ВОВЧКА, будинок 47, "А"</address><boss>НАКОНЕЧНА ОЛЕНА АНАТОЛІЇВНА</boss><kved>85.10 Дошкільна освіта</kved><stan>зареєстровано</stan><founders><founder>УПРАВЛІННЯ ОСВІТИ УЖГОРОДСЬКОЇ МІСЬКОЇ РАДИ, розмір внеску до статутного фонду - 0.00 грн.</founder>...</founders></record>... for mysql connection use function connectbase(){ include __dir__ . '/../../settings/sql.set.php'; $mysql = mysqli_connect(

c# - Can't set ASP.NET Core console logging below Information -

i can't seem debug or trace statements displayed in console. in startup.cs configure(...) have: loggerfactory .withfilter( new filterloggersettings { {"assettrader", loglevel.debug}, {"microsoft", loglevel.warning}, {"system", loglevel.warning}, }) .addconsole(); in controller action have: this._logger.logtrace("trace"); this._logger.logdebug("debug"); this._logger.loginformation("info"); this._logger.logwarning("warn"); but console output shows 2 entries: info: assettrader.controllers.homecontroller[0] info warn: assettrader.controllers.homecontroller[0] warn i have tried loggerfactory.addconsole(loglevel.debug) , same result. gist of simple test project reproduce issue: https://gist.github.com/modo-lv/66e3209f89e986423397928630ba5f9a solved, tseng 's comment , answer here . in case, removing loggerfact

java - MalformedParameterizedTypeException when starting the server when defining 2 services which uses each other -

i have 2 service classes defined in ejb configuration file. servicea interface serviceaimpl implementation of serviceb other interface servicebimpl implementation of that each service needs other service internal operations. ejb configuration definition this public servicea getservicea(){ return new serviceaimpl(getserviceb()); } public serviceb getserviceb(){ return new servicebimpl(getservicea()); } but when start server there org.springframework.beans.factory.beancreationexception saying initialization of bean failed; nested exception java.lang.reflect.malformedparameterizedtypeexception any ideas solve , in better way