Posts

Showing posts from July, 2011

javascript - Phantomjs cannot open a page that browser opens -

i have phantomjs script tries open url. phantomjs returns error: unable load resource (request id:undefinedurl:http://foo.bar/tree/nav_value/27) error code: 203. description: error downloading http://foo.bar/tree/nav_value/27 - server replied: not found but when open url http://foo.bar/tree/nav_value/27 chrome browser, there's no problem , page loaded correctly! this script: // read phantom webpage '#intro' element text using jquery , "includejs" "use strict"; var page = require('webpage').create(); var system = require('system'); if (system.args.length != 2) { console.log("please pass 2 argument") } var company_id = system.args[1] console.log("c", company_id) page.onconsolemessage = function(msg) { console.log("message", msg); }; page.onresourceerror = function(resourceerror) { console.log('unable load resource (request id:' + resourceerror.id + 'url:' + resourcee

Load bootstrap datatable on dropdown change -

i new jquery/bootstrap datatables , trying use 1 in application. i have modal popup in have select dropdown. when select dropdown value changes make call server , display datatable grid in modal. when modal popup loads don't want display grid, not empty one. want display grid when dropdown value changes. grid has reload every time dropdown value changes. i have been trying combinations of parameters it's not working. tried using 'ideferloading', 'bdeferrender', table.ajax.reload() etc it's not working expected. below code grid loaded when modal popup loads first time. $(document).ready(function (){ var table = null; $("#usertype").change(function() { var usertype = $(this).val(); if (usertype == "test") { table = $('#example').datatable({ 'ajax': { 'url': '/test/getallplatforms?itemid=' + $('#itemi

c - Filling array gives unexpected values -

i have serious problem when filling array. functions looks this: int s_in[]; /* array filled lot of integer values */ for(frame=0; frame<maxframes; frame++){ left = 240*(frame-1) + 1; right = 240*(frame +1); int x[right-left+1]; /* 480 long */ for(i=left-1;i<right;i++){ x[i] = s_in[i]; } when try print out values stored in x[] each run, either empty x[] or random numbers not appear in s_in[]. can problem solved kind of memory management? there 2 problems in line: x[i] = s_in[i]; on first iteration, when aboce line executed, values of variables are: frame: 0 left: -239 i: -240 the code attempts read outside of bounds of s_in[] , write writes outside of bounds of x[] . this undefined behaviour . it's difficult provide fix code without knowing how information laid out in s_in[] . assuming frame 240 bytes , on each iteration want copy values 2 consecutive frames s_in[] x[] , code should along these lines: int s_in[]; /* arra

postgresql - How to connect a particular user and create database using PostgresSQL and ubuntu -

i need help. need create databse inside using prticular username , import .sql file using postgressql , ubuntu.i have created 1 user using below command. sudo -u postgres createuser user1 -s i need command create 1 database spesh under particular owner , import spesh.sql it. please me. create db spesh owner user1 sudo -u postgres createdb "spesh" -o user1 import sql dump spesh database sudo -u postgres psql spesh < 'file_path.sql'

android - Appcompat Activity Giving issues for version 24.0.0 -

i want work coordinator layout , gradle file includes following dependencies, compile 'com.android.support:appcompat-v7:24.0.1' compile 'com.android.support:design:24.0.1' but gives me following error, exception while inflating <vector> org.xmlpull.v1.xmlpullparserexception: binary xml file line #17<vector> tag requires viewportwidth > 0 @ android.support.graphics.drawable.vectordrawablecompat.updatestatefromtypedarray(vectordrawablecompat.java:541) @ android.support.graphics.drawable.vectordrawablecompat.inflate(vectordrawablecompat.java:478) @ android.support.graphics.drawable.vectordrawablecompat.createfromxmlinner(vectordrawablecompat.java:441) @ android.support.v7.widget.appcompatdrawablemanager$vdcinflatedelegate.createfromxmlinner(appcompatdrawablemanager.java:736) @ android.support.v7.widget.appcompatdrawablemanager.loaddrawablefromdelegates(appcompatdrawablemanager.java:359) @ android

php - more than one guard in route -

i use laravel framework want use more 1 guard in route : route::group([ 'middleware' => 'jwt.auth', 'guard' => ['biker','customer','operator']], function () {} i have script in authserviceprovider.php below in boot section: $this->app['router']->matched(function (\illuminate\routing\events\routematched $event) { $route = $event->route; if (!array_has($route->getaction(), 'guard')) { return; } $routeguard = array_get($route->getaction(), 'guard'); $this->app['auth']->resolveusersusing(function ($guard = null) use ($routeguard) { return $this->app['auth']->guard($routeguard)->user(); }); $this->app['auth']->setdefaultdriver($routeguard); }); that work 1 guard in route 'guard'=>'biker' how change code in authserviceprovider.php work

android - Why would a background thread spawn its own Handler & Looper -

why background thread spawn own handler & looper modify ui's component .i know in simple terms: looper : loop , execute tasks in message queue handler : posting tasks queue have @ snippet took article in internet public class myactivityv2 extends activity { private handler muihandler = new handler(); private myworkerthread mworkerthread; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mworkerthread = new myworkerthread("myworkerthread"); runnable task = new runnable() { @override public void run() { (int = 0; < 4; i++) { try { timeunit.seconds.sleep(2); } catch (interruptedexception e) { e.printstacktrace(); } if (i == 2) { muihandler.post(new runnable() { @overr

authentication - PHP ldap_get_entries() return count=zero -

Image
i trying authenticate users' login against ldap(server mac el capitan). i can connect , bind ldap server. i can search , sort result. but when perform "ldap_get_entries",i received "zero" entry. i've tried stackoverflow google's second page. any suggestions or idea why might happening? code - <?php session_start(); // starting session $error=''; // variable store error message if (isset($_post['submit'])) { if (empty($_post['email']) || empty($_post['password'])) { $error = "username or password invalid"; } else { $usernamelogin=$_post['email']; $passwordlogin=$_post['password']; $username = stripslashes($usernamelogin); $password = stripslashes($passwordlogin); echo "user name ".$username; echo "</br>"; $ldapuser = "uid=xxxxxx,cn=users,dc=dns1,dc=xxxxxxxx,dc=com"; $ldappass =

Required fields in scala map -

i have jsonmap : map[string , any] , extracting 3 required field map //case class exception handling case class parserexception(message: string) extends exception(message) val id = jsonmap.getorelse("id", throw parserexception("id required.")) val type = jsonmap.getorelse("type", throw parserexception("type required.")) val location = jsonmap.getorelse("location", throw parserexception("location required.")) if json don't have required value exception raised.is there better way in scala implement required field extract ? expected : if field missing json , code should throw exception..if mandatory fields available program flow should move next step. lift map partial function missing keys mapped none , defined keys some(value) ; example, scala> val m = map("id" -> 1, "loc" -> 2) m: scala.collection.immutable.map[string,int] = map(id -> 1, loc -> 2) scala> m.l

Define list of shapefiles in same folder (List.Vector) to use in For Loop -- Geospatial Modeling Environment -

i trying create list of shapefiles in geospatial modeling environment using list.vector. works , produces following list. list.vector(in="d:\buffers", match="*.shp"); d:\buffers\objectid_1.shp, d:\buffers\objectid_10.shp, d:\buffers\objectid_100.shp, d:\buffers\objectid_1000.shp, d:\buffers\objectid_10000.shp...... i loop through different shapefiles using isectpolypoly function. code is: list<-list.vector(in="d:\buffers", match="*.shp"); (i in 1:length(list)) { isectpolypoly(in=paste(i), poly="d:\polygons\agri.shp", field="p_", thematic=true, proportion=true); }; i receive following error. error: loop has not been specified correctly. length function not appear refer defined vector. so appears if not defining "list" correctly able use in loop. cannot find clear answers on how this. can me change code can define list of shapefiles , loop through shapefiles in list?

java - JMeter bugs when trying to stress test localhost server -

Image
i trying stress test localhost server. have configured http request defaults correctly, image attached. view results tree panel shows jmeter trying send request ${host}. using v 3, current latest release. please help. http request defaults defaults . if leave server name or ip input "home page" request blank - value picked http request defaults if override server name of ip else - in case ${host} - default value discarded. so need go "home page" http request sampler , delete ${host} server name or ip input. detailed information: why it's important use jmeter's http request defaults

javascript - Why json_decode return NULL with hash symbol -

use $.post send array js php file: $.ajax({ url: window.location + "crawler/", type: "post", datatype: "json", data: { wartosc: zmienna }, success: function (odp) { tab = json.stringify(odp); $.post(window.location + "crawler/return_data", { data: tab //tab->array }, function (data) { $('#wynik').html(data); $('.pobierz').show(); } ) } }) before use json_decode() in php using var_dump($_post['data']); array looks this: string(612) "[{"nazwa":"http://wp.pl/","adres ip":"212.77.98.9","kod odpowiedzi":301,"roboty":"-","tytul":"-","slowa kluczowe":"-","opis&quo

asp.net web api - How to access HttpContext.Current.Application on OWIN Startup -

i need fill httpcontext.current.application["translations"] on owin startup, httpcontext.current null there. should use application_start() in global.asax.cs or bad idea? what alternatives have? httpcontext not available @ start cannot exist without request. startup class runs once application, not each request. try accessing in beginrequest handler in global.asax.cs . protected void application_beginrequest(object sender, eventargs e) { base.application["translations"] = "my value here"; }

How to convert 007898989 to 7898989 in Python -

i trying convert 007898989 7898989 in python using following code: long(007898989) however leads following error: >>> long(007898989) file "<stdin>", line 1 long(007898989) ^ syntaxerror: invalid token how can convert number correctly? indeed, doing this: a = 007898989 will raise error syntaxerror: invalid token , easiest way convert long be: on python 2 a = long("007898989") print trying cast on python 3 give nameerror: name 'long' not defined , so, i'd best solution below one on python 2/3 a = int("007898989") print(a)

php - Symfony 2: Check name of host and redirect -

my website listens 2 domains: one.example.com , two.another-example.com. when user visits contact page via " http://one.example.com/contact ", automatically redirect user " http://two.another-example.com/contact ". content of page same, url different one. in controller in contactaction use following code check host: /** * @route("/contact") */ public function contactaction(request $request) { if ($request->gethost() == 'one.example.com') { // redirect } ... the redirect not work. 99% sure because of gethost() -check, why included part of code. does see solution? you can use other ways in javascript <script> var = window.location.href ; if(a =="your_first_domain_link") { window.location.href = "your_2nd_domain_link" } </script> hope helps

c# - Why does vb.net allow class names to be parameter names? -

i have seen sub looked this: private sub dosomething(byref placeholder placeholder) 'do placeholder object end sub i wonder why allowed. can name few languages not allowed. able have methods same return, parameters , names if 1 of them shared , other instance-level. for example, let suppose there class named bird , there object this dim bird = new bird("duck doggers") bird.fly() make sure duck doggers flies, however, bird.fly() make birds fly, if, instance ienumerable updated upon each constructor run of bird , bird.fly iterate ienumerable , call fly each item. far can see, impossible in vb.net, since fly either shared or instance-level. there possible problem (besides unclarity) if parameter name same class name instance said parameter? i not have c# in front of me, wonder whether naming of parameter class possible there. this common naming pattern majority of vb developers. of stems vb being case-insensitive. without being all

android - How to call onCreate of application class while running activity tests using Espresso -

in android app, have application class extends multidexapplication . let's call myapplicationclass in oncreate() of myapplicationclass.java , set static variables. in oncreate() method of activities variables using static methods. public class myapplicationclass extends multidexapplication { private static string value; public static void setvalue(string value) { myapplicationclass.value = value; } public static string getvalue() { return myapplicationclass.value; } } now using espresso framework, writing ui tests activity using following code public class myactivitytest{ @rule public activitytestrule activitytestrule = new activitytestrule(myactivity.class); @test public void testbuttonisvisible() { //some test code. } } after running test android studio, oncreate() method of myactivity gets called , tries static variables. value of variables null. reason simple. oncreate() of myapplicationclass.java doesn't calle

Passing Date value to NetSuite via API -

when populating date field in netsuite via api (e.g sales order start date), required specify timestamp + timezone, though timestamp isn't shown in netsuite. does know logic netsuite using covert date+timestamp date? for example, when pass date+time of oct 1 2016 00:00:00 utc, see sept 30 2016 in netsuite. other times, see date appear oct 1 2016 in netsuite. logic seems inconsistent. can explain logic? for me depended on timezone, , timezone of account writing netsuite. i had issue in past. resolved setting integration user account have gmt timezone. after that, dates/times have appeared correct each user, based on timezone (set in preferences).

concurrency - How does a C++ std::mutex bind to a resource? -

does compiler check variables being modified between lock , unlock statements , bind them mutex there exclusive access them? or mutex.lock() lock resources visible in current scope? given m variable of type std::mutex : imagine sequence: int a; m.lock(); b += 1; = b; m.unlock(); do_something_with(a); there 'obvious' thing going on here: the assignment of b , increment of b 'protected' interference other threads, because other threads attempt lock same m , blocked until call m.unlock() . and there more subtle thing going on. in single-threaded code, compiler seek re-order loads , stores. without locks, compiler free re-write code if turned out more efficient on chipset: int = b + 1; // m.lock(); b = a; // m.unlock(); do_something_with(a); or even: do_something_with(++b); however, std::mutex::lock() , unlock() , std::thread() , std::async() , std::future::get() , on fences . compiler 'knows' may not reorder loads , stor

Read JSON files from Spark streaming into H2O -

i've got cluster on aws i've installed h2o, sparkling water , h2o flow machine learning purposes on lots of data. now, these files come in json format streaming job. let's placed in s3 in folder called streamed-data . from spark, using sparkcontext, read them in 1 go create rdd (this python, not important): sc = sparkcontext() sc.read.json('path/streamed-data') this reads them all, creates me rdd , handy. now, i'd leverage capabilities of h2o, hence i've installed on cluster, along other mentioned software. looking h2o flow, problem lack of json parser, i'm wondering if import them h2o in first place, or if there's go round problem. when running sparkling water can convert rdd/df/ds h2o frames quite easily. (scala, python similar) should work: val datadf = sc.read.json('path/streamed-data') val h2ocontext = h2ocontext.getorcreate(sc) import h2ocontext.implicits._ val h2oframe = h2ocontext.ash2oframe(datadf, "my

html - How do I prevent a dropdown menu to move/affect content/elements of a web page? -

i have searched both here , elsewhere on internet answer, have not found has solved problem. tried include relevant code only, sorry if included irrelevant. i have made navigation bar 4 alternatives (or 4 buttons, if prefer), fourth 1 dropdown menu 3 additional alternatives visible while hovering on fourth button. have added image web page, problem having that, while hovering fourth alternative , displaying dropdown menu, image moves. i make picture, , additional content matter, stays @ same place while cursor hovering on fourth alternative. html: <body> <div id="logoquotebar"> </div> <a class="navbutton1" href="#"> navbutton 1 </a> <a class="navbutton2" href="#"> navbutton 2 </a> <a class="navbutton3" href="#"> navbutton 3 </a> <a class="navbutton4" href="#"> navbutton 4 </a> <div class="dropdowncontent"

python - Word count: 'Column' object is not callable -

Image
from pyspark.sql.functions import split, explode sheshakespearedf = sqlcontext.read.text(filename).select(removepunctuation(col('value'))) shakespearedf.show(15, truncate=false) the dataframe looks this: ss = split(shakespearedf.sentence," ") shakewordsdfa =explode(ss) shakewordsdf_s=sqlcontext.createdataframe(shakewordsdfa,'word') any idea doing wrong? tip says column not iterable . what should do? want change shakewordsdfa dataframe , rename. just use select: shakespearedf = sc.parallelize([ ("from fairest creatures desire increase", ), ("that thereby beautys rose might never die", ), ]).todf(["sentence"]) (shakespearedf .select(explode(split("sentence", " ")).alias("word")) .show(4)) ## +---------+ ## | word| ## +---------+ ## | from| ## | fairest| ## |creatures| ## | we| ## +---------+ ## showing top 4 rows spark sql columns not data

Angular 2: Can't resolve all parameters for Router -

goal get routing working without losing sanity. error error: can't resolve parameters router: (?, ?, ?, ?, ?, ?, ?, ?) app.routing.ts import { modulewithproviders } '@angular/core'; import { routes, routermodule } '@angular/router'; import { navbarcomponent } './navbar/navbar.component'; import { customercomponent } './customer/customer.component'; export const approutes: routes = [ { path: '', redirectto: 'customers', pathmatch: 'full' }, { path: 'customers', component: customercomponent }, ]; export const routing: modulewithproviders = routermodule.forroot(approutes); app.module.ts import { ngmodule } '@angular/core'; import { formsmodule } '@angular/forms'; import { browsermodule } '@angular/platform-browser'; import { routing } './app.routing'; import { appcomponent } './app.component'; import { navbarcomponent } './navbar/navbar.componen

How to modifying the behaviour of the Python logging facility? -

i change way in messages debug , info level displayed when using python's native logging facility. "change", not mean altering format adding logical level. example: # global variable set @ time of initializing logging. required_verbosity_level = 7 # variable passed each call logger. supplied_verbosity_level = 5 so when creating logger pass global requirement. logger = loggerbridge(required_verbosity_level = 7) then when call method, pass appropriate level: logger.debug('this debug message.', supplied_verbosity_level = 5) so internally, logic (5<7) , make message visible due fact supplied value meets required one. however, in following case: logger.debug('this debug message.', supplied_verbosity_level = 11) the message will never visible supplied value higher required value. question is: best place implement such behaviour? right now, tried couple of things based on inheriting current logger class , overriding internal behavi

algorithm - Minimum makespan for matrix -

given a b, matrix required partition m n blocks in such way maximum of sum of elements in each block minimized. https://www.researchgate.net/publication/220570172_partitioning_a_matrix_to_minimize_the_maximum_cost a matrix = [aij] of nonnegative integers must partitioned p blocks (submatrices) corresponding set of vertical cuts parallel columns , set of horizontal cuts parallel rows. each block associated cost equal sum of elements. problem finding matrix partitioning minimizes cost of block of maximum cost. how can implement this?

ios - Swift 2 to Swift 3.0 motionManager -

i converting app swift 2 swift 3 , i'm trying use cmmotionmanager, gives me error when try call .startaccelerometerupdates() function... no clue what's wrong though. this how initialize manager: let motionmanager = cmmotionmanager() trying call function: motionmanager.startaccelerometerupdates(to: operationqueue.main) { [weak self] (data: cmaccelerometerdata?, error: nserror?) in self!.outputaccelerationdata(data!.acceleration) } error: cannot convert value of type '(cmaccelerometerdata?, nserror?) -> ()' expected argument type 'cmaccelerometerhandler' (aka '(optional, optional) -> ()') thanks! the cryptic error message boils down this: in swift 3 nserror bridged error instead. write code , problem should go away: motionmanager.startaccelerometerupdates(to: operationqueue.main) { [weak self] (data: cmaccelerometerdata?, error: error?) in

MongoDB unwind multiple arrays -

in mongodb there documents in following structure: { "_id" : objectid("52d017d4b60fb046cdaf4851"), "dates" : [ 1399518702000, 1399126333000, 1399209192000, 1399027545000 ], "dress_number" : "4", "name" : "j. evans", "numbers" : [ "5982", "5983", "5984", "5985" ] } is possible unwind data multiple arrays , paired elements arrays: { "dates": "1399518702000", "numbers": "5982" }, { "dates": "1399126333000", "numbers": "5983" }, { "dates": "1399209192000", "numbers": "5984" }, { "dates": "1399027545000", "numbers": "5985" } from version 3.2 can $unwind on both of arrays, $c

visual studio code - VSCode launch.json for vagrant plugin -

i try set launch.json vagrant-plugin on windows. current version this: { "version": "0.2.0", "configurations": [ { "name": "launch vagrant", "type": "ruby", "request": "launch", "cwd": "${workspaceroot}", "program": "${workspaceroot}/bin/vagrant", "args": ["up"], "env": { "vagrant_cwd": "${workspaceroot}/development" } } ] } when starting plugin now, vagrant misses external dependencies. error: the executable 'curl' vagrant trying run not found in %path% variable. error. please verify software installed , on path. adding needed dependencies path sound trouble ( cp.exe , dir.exe , ...). i tried: "env": { "path&quo

java - I have an error doing a select in SQLITE -

i'm trying @ onupgrade() in android java app: try { db.execsql("select fechacontrol parametres", null); } catch(exception e) { e.printstacktrace(); db.execsql("alter table parametres add column fechacontrol bigint"); } my problem is, column fechacontrol exists, end in exception block, app crashes because of duplicated column name. doing wrong? thanks all. execsql(anything, null) throw illegalargumentexception due null bindargs. that's why end in catch . there execsql(string) overload executing sql without bindargs. however, database upgrades should not done this. schema version number stored in database file , param in onupgrade() . use information deduce needs updated.

reactjs - React.js stepper -

hello trying build footer stepper inform users in app. footer(stepper) component : export default class footer extends component { render() { return ( <muithemeprovider> <div classname="row"> <div classname="footer"> <div classname="container-fluid" style={containerstyle}> <div classname="col-sm-12"> <div classname="steps" style={stepstyle}><img src={trailergray} href="" width="60px" height="60px" style={{margin:25}} alt=""/></div> <div classname="steps" style={stepstyle}><img src={clockicon} href="" width="60px" height="60px" style={{margin:25}} alt=""/></div> <div classname="steps" style={stepstyle}><img src={shieldgrey} href="" width="6

java - ElasticSearch JVM Heap goes over 75% and nodes are dead -

Image
i running elasticsearch cluster 3 nodes. each node has heap size of 12g - es_heap_size=12g . i uploading stats marvel can see moment nodes dead in moment jvm heap on 75%. after restart nodes runs fine again. until next peak. on every peak on graph nodes not responding anymore. some ideas? edit: jvm heap usage last hour is graph looking fine?

android - Animate pie diagram as a background of TextView from one state to another -

i setting background of textview in android pie diagram. have used layerdrawable of arcshape (s) , set background. here code that: final shapedrawable arcgreen = new shapedrawable(new arcshape(-90, correctangle)); arcgreen.getpaint().setcolor(contextcompat.getcolor(this, r.color.feedback_score_3)); final shapedrawable arcred = new shapedrawable(new arcshape(-90 + correctangle, 360 - correctangle)); arcred.getpaint().setcolor(contextcompat.getcolor(this, r.color.feedback_score_1)); final drawable[] layer = {arcgreen, arcred, mask}; final layerdrawable ld = new layerdrawable(layer); msvaralayout.getchildat(i).setbackground(ld); now, want animate background when value of correctangle changes. 1 of options see use valueanimator , go initial value new correctvalue , each time inside onanimationupdate() callback create new layerdrawable object changed values , set background. other way have been drawables (s) in background first(which shapedrawable(<arcshape>) objects

python 3.x - Dill failed to load back numpy arrays after loading back numpy record arrays -

all: i'm trying save data in python program dill binary file. program used both regular numpy array , numpy record array. i'm having problem on loading regular numpy arrays if saved both numpy record arrays , regular arrays. problem can demonstrated following simple code: import dill pickle import numpy np class testdill: def __init__(self, data): self.data =data # numpy record array type persontype = [('name', 'a32'), ('age', '<i2'), ('salary', '<i4'), ('weight','<f8')] person = np.zeros(2, dtype=persontype, order='f') d = np.random.randn(5) d1 = testdill(d) d = np.random.randn(5) d2 = testdill(d) d = np.random.randn(5) d3 = testdill(d) f= open('testdill.dat', 'wb') pickle.dump(person, f) pickle.dump(d1, f) pickle.dump(d2, f) pickle.dump(d3, f) f.close() f= open('testdill.dat', 'rb') person2 = pickle.load(f) d11 = pickle.load(f) d21 =

create time with format character P in php -

i have utc time 15:00:00 timezone based utc offset +03:00 when tried create new time using utc time+utc offset , shows 12:00:00. but need time 18:00:00 please give me suggestions. $utc_offset="+03:00"; date("d m, y h:i a", strtotime("15:00:00 ".$utc_offset)) the code posted parses string '15:00:00 +03:00 . in plain english, string means "the local time 15:00 (3 pm) , located in timezone 3 hours @ east of gmt/utc". corresponding utc time 12:00 . it happens php has default timezone set utc (i guess default value in php.ini , didn't change it). why date() prints 07 sep, 2016 12:00 pm . for me code prints 07 sep, 2016 03:00 pm because in timezone @ utc+3 , php.ini uses default. don't use date() (or of date/time functions). of them don't know timezone, others work local time. use datetime classes instead. can handle timezones , code shorter , more clear. your concrete problem easy solve:

angularjs - When loading dynamic component using Angular 2 RC6, component life cycle events are not invoked -

when loading component dynamically using following method, constructor said component invoked none of life cycle events (eg. ngafterviewinit or ngoninit). let component = getcomponent(name); const factory = this.componentfactoryresolver.resolvecomponentfactory(component); this.componentref = this.target.createcomponent(factory); is correct implementation rc6, if so, bug? edit i have managed fix issue. fyi, how hooked above code parent components life cycle methods. more information can found here , example of implementation can found here .

ios - numberOfRowsInSection not overriding Attributes Inspector -

Image
in swift 2 , working on uitableview dynamically create cells based on contents of dictionary. dictionary has 38 entries. when manually set table view section have 38 rows in attributes inspector, works expected. however, isn't ideal, , i'd rather use numberofrowsinsection count of dictionary , create rows/cells way. when att inspector set 1, out of bounds error. terminating app due uncaught exception 'nsrangeexception', reason: '*** -[__nsarrayi objectatindex:]: index 1 beyond bounds [0 .. 0]' here code: import swiftyjson import uikit class ourtableviewcontroller2: uitableviewcontroller { @iboutlet weak var menubutton: uibarbuttonitem! var labels = [string: uilabel]() var strings = [string]() var objects = [[string: string]]() override func viewdidload() { super.viewdidload() tableview.datasource = self tableview.delegate = self self.tableview.registerclass(uitableviewcell.self, forcellreus

plsql - Inside an Oracle 12 "package", how do I make a variable or function or procedure accessible or not accessible? -

i'm former java developer, using oracle's sql-developer create oracle "packages." oracle's websites indicate it's possible create oracle "package" in objects (variables, functions, procedures) accessible "outside" scope of package, while others accessible "inside" package. i.e., i'm trying (pseudocode!), intentionally superficially resembles java. so, i'm asking, "how 1 implement functionality similar (java's) public , private in oracle pl sql package"? ("see 'oracle keyword' enough point me in right direction.) thanks in advance! create package // header **public** number nvisibleoutside := 1; **private** number nnotvisibleoutside := 14922016; public procedure pvisibleoutside (); public function fnotvisibleoutside(); /* other stuff */ // body /* actual code of pvisibleoutside , fnotvisibleoutside(); */ end a; oracle uses package specification , package body. effect

ruby on rails - rmagick installation issue on ubuntu 16.04 -

i'm trying install rmagick 2.13.1 legacy rails application on ubuntu 16.04. following error when bundle install : gem::installer::extensionbuilderror: error: failed build gem native extension. /home/uping/.rubies/ruby-1.9.3-p194/bin/ruby extconf.rb checking ruby version >= 1.8.5... yes extconf.rb:128: use rbconfig instead of obsolete , deprecated config. checking gcc... yes checking magick-config... yes checking imagemagick version >= 6.4.9... yes checking hdri disabled version of imagemagick... yes checking stdint.h... *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --r

Alfresco - Disable LDAP Group Synchronization -

in our project's client having ldap no groups configuration. they're have single flat users directory/configuration. hence want disable group synchronization, have no clean , precise answer situation. i have similar problem this: https://forums.alfresco.com/forum/installation-upgrades-configuration-integration/configuration/alfresco-32-ldap-user-sync does alfresco support disable group synchronization? if so, how achieve this. thanks, [bayu]

postgresql - Configuring postgres free space per page -

we have update heavy table experiencing lot of bloat (10x). want increase free-space left unused in each page, make more updates write new mvcc tuple on same page (helping take advantage of heap tuples more effectively). i'm pretty sure i've seen way configure "free space left per page" on per table basis @ point, life of me can't find it. possible? thanks! you searching fillfactor . -- set 80% new data postgres=# alter table boo set (fillfactor = 80); alter table

javascript - Get request parameters inside socket -

i want create new document in mongodb collection every time socket run, these collections should belong page @ at. right hardcording pageid this io.on('connection', (socket) => { const pageid = '57cc491c95f2513e5aad2590'; socket.on('new nodes', (positions) => { document.create({pageid: pageid}, (err, doc) => { // ... }); }); }); but want id req.params.pageid inside express route app.route('/pages/:pageid').get((req, res) => { // ... }); the socket.io connection stands on own , isn't part of express route handler. so, can't directly access req.params.pageid socket.io connection because request on , done when socket.io connection arrives. so, you're going have include additional information either when connect socket.io or when send particular socket.io message indicates page id. so, have couple of choices: when connect page, can include query parameter on connect url indicates

sh - POSIX way to find the path of foo without `which`? -

i've encountered machine not have which . how find path executable foo without which in posix compliant shell script, if foo might not present? the code have following: if which appears available according type which exiting 0, use it otherwise use type foo , depending on type says (does output contain of following: keyword, builtin, alias, hash, function), grab path according position in output. the main problem this, @chepner , man page point out, type stdout in unspecified format. my other problem foo might not ever exit, can't execute see happens. want inspect first need know is. i feel find / -type f -name foo 2>/dev/null take long. suppose iterate on $path find directly. which approach best? iterating on $path or approach in 2 bullets above, or other approach? need solution portable.

sql - Transpose comma seperated data into rows - some clarification -

let have data id string ------------------- 1 john, adam based on below query transpose comma seperated data rows select a.[id], split.a.value('.', 'varchar(100)') string (select [id], cast ('<m>' + replace([string], ',', '</m><m>') + '</m>' xml) string tablea) cross apply string.nodes ('/m') split(a); now, know reason have '.' , <m> in our query? pn: instead of flagging post please let me know delete post if should not post. if print out string within cast, see text string has been turned xml string. '.' in split command merely location in start parsing xml.

python - Not able to download pyxplorer package using pip? -

i referring url profile data , profile data need pyxplorer inside of python interpreter when try install pyxplorer package gives me error like: collecting pyxplorer not find version satisfies requirement pyxplorer (from versions: ) no matching distribution found pyxplorer command install package is: pip install pyxplorer i know below link data profiling(pyxplorer) 1) https://github.com/grundprinzip/pyxplorer 2) http://nbviewer.jupyter.org/github/grundprinzip/pyxplorer/blob/master/pyxplorer_stuff.ipynb the links have tried are: 1) pip cannot install anything 2) could not find downloads satisfy requirement newrelic-plugin-agent thanks in advance. it looks pyxplorer package on pypi invalid , doesn't contain release data. have @ releases key of json pyxplorer - it's empty array, normal packages more this . the best solution install directly github, so: pip install git+https://github.com/grundprinzip/pyxplorer (you may need use sudo on unix

Access User Form unintentionally altering data table records -

i have been using ms access aid in generating pdf reports based on table. have created form contains text box entering client's name (this value in main table) , button when clicked runs code: private sub cmdprintrecord_click() dim strreportname string dim strcriteria string strreportname = "current sp report" strcriteria = "[owner]='" & me![owner] & "'" docmd.openreport strreportname, acviewpreview, , strcriteria end sub the idea here generate individual pdf report based on clients name. the above procedure has been able however, have encountered run it, data in table affected, client name field. for example: i'll run report client "anthony" , shows 10 products correct, if go , run same report again show 11 products. if procedure here altering data table. how can troubleshoot issue , or there alternatives recommended? thanks. attached ms link obtained source code: https://support.

java - Mockito: When is @Mock object get initialized and which constructor it calls -

i'm trying figure out how mockito working behind in order debug. wondering object @mock annotation, when initialized? like, before @before or after @before? and if there're several different constructors, how mockito determines constructors call? and if use jmockit @mocked instead, there different answers of questions above? thank you! mock objects created mockito don't call constructor or static initializer. (this achieved through objenesis in older versions of mockito, , bytebuddy in newer versions.) consequently, of fields uninitialized, , no side effects in constructors happen @ including exceptions might see thrown. in contrast, spy objects do have constructors called . mockito default calling no-argument constructor (public or private) if don't initialize field, , can call constructor of choice inside initializer. the order of @mock annotation initialization depends on technique use initialize mocks: if use mockitojunitrunner , mocks

python - Python3, json causes TypeError but simplejson doesn't -

i'm running latest python3 (with anaconda distribution) , have problem standard library installed json causes traceback: traceback (most recent call last): file "c:\users\think\anaconda3\lib\site-packages\werkzeug\serving.py", line 193, in run_wsgi execute(self.server.app) file "c:\users\think\anaconda3\lib\site-packages\werkzeug\serving.py", line 181, in execute application_iter = app(environ, start_response) file "c:\users\think\my_server.py", line 148, in __call__ return self.wsgi_app(environ, start_response) file "c:\users\think\my_server.py", line 144, in wsgi_app response = self.dispatch_request(request) file "c:\users\think\my_server.py", line 80, in dispatch_request return getattr(self, 'on_' + endpoint)(request, **values) file "c:\users\think\my_server.py", line 54, in on_xapi_request json_data = self.load_json(re

windows 10 - Show colors in output of bash script or bash -c -

i'm using new bash shell on windows 10, i'm pretty sure happens on platforms. $ ls a.out a.out green. $ bash -c "ls" a.out here, a.out normal colored. how second case behave first? you have enable colors: bash -c "ls --color=auto" try also: bash -i -c ls

html - Tiny MCE editor center tag issue -

i facing issue using tiny mce editor below: i have html data center tag when tried align content left using tiny mce editor alignment options not working still showing me center tag in source code. can body me on if have content html center tag tiny mce editor alignments options can work. any suggestion appreciated. vik

nginx - ICU version compatibility Symfony 3.1 -

i have problem installing symfony 3.1 in php7, nginx , ubuntu 16.04, have error: intl icu version installed on system outdated (55.1) , not match icu data bundled symfony (57.1) latest internationalization data upgrade icu system package , intl php extension. how can solve issue? can change symfony , use ic 55.1 instead of icu 57.1? i presume when run: php bin/symfony_requirements this warning , can safely ignore message. i've response similar questions on this. see url more details: https://github.com/symfony/symfony/issues/15007

c++ - Is it a bad design decision to manually call the destructor in the following case? -

so working on oop/c++ skills , stumbled upon following case: i making game populated entities, have eat in order survive. can either eat other entities or food. in order achieve behaviour created edible interface forces every implementing class create getnutritionalinformation() method calculate how saturated unit after feasting. so whole thing supposed work code-wise: std::unique_ptr<entity> e1(new entity); std::unique_ptr<entity> e2(new entity); std::cout << "pre feasting energy: " << e1->getnutritionalinformation() << std::endl; e1->eat(*e2); std::cout << "after feasting energy: " << e1->getnutritionalinformation() << std::endl; after operation c1 s energy should higher before, value randomly assigned during creation of entity. in order simulate death of eaten entity want manually kill while being eaten. achieved following way: void entity::eat(edible& subject) { this->energy +=

python - Storing a service account with Flask-SQLAlchemy -

i'm writing small hipchat plugin using flask , flask-sqlalchemy local database. want admin able setup service account external service meant integrate with. because username/password of service accounts needs stored can used integration make api calls can't use non-reversible hashing methods storing password. are there recommendations how approach passwords or database can better secured? you can encrypt data before storing them in database. pycrypto 1 of libraries can utilize. it easy encrypt text using des/ecb pycrypto. key ‘10234567’ 8 bytes , text’s length needs multiple of 8 bytes. picked ‘abcdefgh’ in example. >>> crypto.cipher import des >>> des = des.new('01234567', des.mode_ecb) >>> text = 'abcdefgh' >>> cipher_text = des.encrypt(text) >>> cipher_text '\xec\xc2\x9e\xd9] a\xd0' >>> des.decrypt(cipher_text) 'abcdefgh' here short article pycrypto .

c++ - Is it possible to initialize an object in a class function, not in constructor -

hey looking see if there way me initialize member object in class function. meaning not use member initializer list. i don't want: foo::foo(): bar(), barbar(){} but want: foo::setup(){bar(); barbar() } hope can me out here.

java - Query of a query in SQLite / Android -

i've been modeling queries in ms access show want , how want them before translate them on android app. however, results require 2 queries final results -- 1 query bunch of joins, , second query joins first query additional tables. if combine them didn't see way to. anyways, there way in sqlite allows me efficiently? edit: example: customers table: id, custname orders table: id, custid, itemid items table: id, itemname query1: select orders.id orderid, orders.custid, orders.itemid, customers.custname orders left join customers on orders.custid = customers.id; query2: select query1.orderid, query1.custid, query1.itemid, query1.custname, items.itemname query1 left join items on query1.itemid = items.id; i know in case can combine these two, let's pretend sufficiently complex had keep them separate. want way results of query2 in android app (which uses sqlite). every query, regardless how complex is, can used subquery in query's clause: select