Posts

Showing posts from August, 2010

vb.net - Window application freeze randomly -

Image
i facing random freeze issues in windows application. on profiling have found primary thread stacktrace not able find code due happens. have seen many thread on not able find appropriate solution. here's snapshot of stacktrace extraced profiler can point me in right direction find root cause of issue? wiki

how to test redis cluster -

i have redis cluster 3 masters. not interested in data persistence since caching solution. running v3.2 on windows. when stop 1 of servers manually see if can still access db, 'clusterdown cluster down error'. , that, have connect 1 of instances still working. don't see how solution high availability. hope missing something. ideas why can't access cluster when 1 of nodes down? thank you. cluster create command:ruby.exe redis-trib.rb create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 as said you're using 3 master nodes within redis cluster, visible if 1 of node down you'll clusterdown errors. to avoid these type of errors , high availability, better have slaves attached of master nodes(as shown in official redis cluster tutorial here ). there's reason have slave attached master higher availability. can read these lines mentioned in above redis cluster tutorial link. there 16384 hash slots in redis cluster, , compute hash slot of

javascript - Iterate through a JSON list with JS function -

i'm looking way append json results, i'm working list (array?) , there's multiple elements, know can add styling directly in js code i'm more comfortable method. how can iterate through elements , implement in divs, create similar divs next elements. the way achieve goal afaik this: $("#article").append(data[i].datetime + data[i].headline + "<br />" + "<hr />" + data[i].summary); <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>project js 02</title> <link rel="stylesheet" href="assets/main.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> </head> <body> <div class=&

javascript - Cannot redirect to another page using ngroute -

so using ngroute redirect other html pages. got off tutorial online when try run, not show message or doesn't go desired page. example, if want click on homepage on nav bar, should redirect homepage. if want redirect login page, should go login page. not sure wrong. enter code here this have: index.html <!doctype html> <html ng-app="homepageapp"> <head> <meta charset="utf-8"> <title>quiz homepage</title> <link rel="stylesheet" href="cs/homepage.css"> <script src="lib/angular.js"></script> <script src="js/home.js"></script> <!-- ng route --> <script type="text/javascript" src="i"></script> </head> <body ng-controller="maincontroller"> <h1>welcome online quiz management</h1> <div id="navigationbar"> <ul> <li><a href="

r - How to align rotated multi-line x axis text in ggplot2? -

Image
here example of have: x <- head(mtcars) x$rn <- rownames(x) x$rn[5] <- 'hornet\nsportabout' library(ggplot2) ggplot(x, aes(x = rn, y = mpg)) + geom_point() + theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1)) ggsave('test.png', width = 3, height = 3) the plot looks this: as can see, 'hornet\nsportabout' close next 1 , move little bit left. expected x-axis text looks one: i thought should set vjust = 0.5 , move axis text down. tried severial combinations of vjust , hjust , still can not desired output. there way axis.text aligned shown in second plot (manually created libreoffice draw) ggplot2? this plot exported default width , height rstudio . picture exported default values also can same using package grdevices . code this: library(grdevices) png("test1.png",width = 592, height = 379, units = "px") ggplot(ggplot(x, aes(x = rn, y = mpg)) + geom_point() + theme(axis.text.x = e

swift - Binding textfield text to enable button not working -

i new reactive programming, , bond framework specifically. know may doing things wrong in basic understanding of programming technique. situation: i have uitextview , "approve" uibutton . want approve button enabled when text in textview not nil. have tried adding these lines of code viewdidload method in viewcontroller . textview.reactive.text.observenext{(text) in self.message = text print(text) } textview.reactive.text.map { $0 != nil}.bind(to: approvebuttonoutlet.reactive.isenabled) the first action works (printing text happening on every input change). second 1 not work, button enabled both when text not nil , when is. any appreciated. you can try like rac(self.approvebuttonoutlet, enabled) = [self.textview.rac_textsignal map:^id(nsstring *text) { return @(text.length > 0); }]; i'm not sure how in swift 3 try like rac(self.approvebuttonoutlet, enabled) = self.textview.rac_textsignal.map({(text: s

php - How to prevent Goo.gl opens links via API? -

i'm using goo.gl service shorten registered users activation link. once user clicks link gets activated. noticed new registered users automatically activated after shortening activation link. i've stopped shortening service , send long url , works fine without getting activated means urls send goo.gl opened. there way prevent goo.gl opening links while shortening via api? if not what's service can count on instead of google? $apikey = 'key'; $postdata = array('longurl' => $longurl); $jsondata = json_encode($postdata); $curlobj = curl_init(); curl_setopt($curlobj, curlopt_url, 'https://www.googleapis.com/urlshortener/v1/url?key=' . $apikey); curl_setopt($curlobj, curlopt_returntransfer, 1); curl_setopt($curlobj, curlopt_ssl_verifypeer, 0); curl_setopt($curlobj, curlopt_header, 0); curl_setopt($curlobj, curlopt_httpheader, array('content-type:application/json')); curl_setopt($curlobj, curlopt_po

multithreading - Qt C++ - How to pass data from a worker thread to main thread? -

i trying perform interthread communication in qt (c++). have worker thread calculations , want workerthread return results main thread when done. therefor use connect, know debugging, signal being emit slot isn t being executed , don t understand why. the relevant pieces of code: webcamclass::webcamclass(qobject *parent) : qobject(parent) { workerthread = new qthread(this); workerclassobj = new workerclass(); //connect image connect(workerclassobj, signal(mysignal(qpixmap)), this, slot(myslot(qpixmap))); //connect(&workerclassobj, workerclass::mysignal(qpixmap), this, webcamclass::myslot(qpixmap)); connect( workerthread, signal(started()), workerclassobj, slot(getimage()) ); workerclassobj->movetothread(workerthread); } void webcamclass:: foo() { workerthread->start(); } void workerclass::getimage() { qint64 successfailwrite; qimage img; qpixmap pixmap; ... stuff pixmap... qdebug()<<"going e

machine learning - Training convolutional nets on multi-channel image data sets -

i trying implement convolutional neural network scratch , not able figure out how perform (vectorized)operations on multi-channel images rgb, have 3 dimensions. on following articles , tutorials such this cs231n tutorial , it's pretty clear implement network single input input layer 3d matrix there multiple data points in dataset. so, cannot figure out how implement these networks vectorized operation on entire datsets. i have implemented network takes 3d matrix input have realized not work on entire dataset have propagate 1 input @ time.i don't know whether conv nets vectorized on entire dataset or not .but if are, how can vectorize convolutional network multi-channel images ? wiki

ListenerObject not found in imports for Ehcache 3? -

i trying implement listener ehcache 3.3.1 project using code below. can suggest solution listenerobject? can't seem find anywhere,except on docs page got code from import java.util.logging.level; import java.util.logging.logger; import org.ehcache.cache; import org.ehcache.cachemanager; import org.ehcache.config.builders.cacheconfigurationbuilder; import org.ehcache.config.builders.cacheeventlistenerconfigurationbuilder; import org.ehcache.config.builders.cachemanagerbuilder; import org.ehcache.config.builders.resourcepoolsbuilder; import org.ehcache.event.eventtype; public class cachehandler{ private logger log = logger.getlogger(this.getclass().getname()); private string cachename="basiccache"; public cache cache; public cachehandler(){ if(cache==null) cache=initcache(); } private cache initcache(){ cacheeventlistenerconfigurationbuilder cacheeventlistenerconfiguration = cacheeventlistenerconfigurationb

c++ - Best way to store coords: struct of uints or double? -

i have geo coordinates in format n000.11.22.333 e444.55.66.777. milliseconds necessary precision. need perform calculations calculate coord given coord0, angle , distance. sure want keep precision not less milliseconds. , other calculation algorithms use trigonometric functions result. solution better: 1) use struct contains degrees, minutes, seconds , milliseconds uints , overload operators manipulate them; 2) use double type , convert coords decimal view calculations. think float type not enough stable on these calculations. be used qt 5.9 x64 project, msvc 2017, win platform only pick whichever easiest (almost double). double more accurate ruler or careful surveyor. lots of navigation software uses single 32-bit integer lat , 1 long. wiki

How to convert String to Struct (in Swift) -

i have struct like, struct loginconstants { struct selectors { let testa = "test1234" } } and class like, class login: xctestcase { override class func setup () { // below constant have value "loginconstants" let localconstants = "\(string(describing: self))constants" } } ... here have struct-name string format in localconstants . my question how can access loginconstants properties localconstants string? note: know can access loginconstants() directly. planning create parent class can access ***constants struct dynamically. thanks help! objective-c has ability this, swift not. if give class objective-c name via @objc attribute, can use objective-c runtime functions access name. however, not possible struct. it's not best way go anyway. better solution rethink trying do, , access struct type directly rather name. wiki

django model get_absolute_url not working -

i have seen example of using above method directly on model instance book. not working actually. method removed in latest versions? here code. in [24]: django_tag out[24]: <tag: django> in [22]: django_tag.get_absolute_url() --------------------------------------------------------------------------- attributeerror traceback (most recent call last) <ipython-input-22-bde20b3ec098> in <module>() ----> 1 django_tag.get_absolute_url() attributeerror: 'tag' object has no attribute 'get_absolute_url' i looked dir function. don't show such method exists. i'm using django v. 1.11. in [25]: dir(django_tag) out[25]: ['doesnotexist', 'multipleobjectsreturned', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', 

c# - EF Core 2.0 ThenInclude with WHERE -

there happen following relationship in db: cartentry -> product -> producttext <- culture so, every product, can set title, desc etc each supported culture. im switching stored procedures ef, , therefore have migrate sp items in cart localized name. well, have feeling, isnt elegant: public actionresult index(cartindexviewmodel vm) { vm.cart = db.cart .include(cart => cart.product) .theninclude(pt => pt.producttext) .theninclude(c => c.culture) .where(t => t.token == contexthelper.gettoken(httpcontext)) .tolist(); foreach (model.cart cart in vm.cart) { model.producttext pt = cart.product.producttext.first(n => n.culture.name == cultureinfo.currentculture.name.tolowerinvariant()); cart.product.title = pt.title; cart.product.description = pt.description; cart.product.link = pt.link; } ret

powershell - issues come up when trying to start hdp sandbox in docker on win10 -

ps c:\users\suyu\downloads> .\start_sandbox-hdp.ps1 checking docker daemon... docker , running found hdp sandbox image hdp sandbox container exists starting hdp sandbox... error response daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"c:/program files/git/usr/sbin/sshd\": stat c:/program file s/git/usr/sbin/sshd: no such file or directory" error: failed start containers: sandbox-hdp starting processes on hdp sandbox... error response daemon: container 5f62ead9ab9599301f173fed3347a1399f7ca66a1164867aadffd826eac1422d not running error response daemon: container 5f62ead9ab9599301f173fed3347a1399f7ca66a1164867aadffd826eac1422d not running error response daemon: container 5f62ead9ab9599301f173fed3347a1399f7ca66a1164867aadffd826eac1422d not running error response daemon: container 5f62ead9ab9599301f173fed3347a1399f7ca66a1164867aadffd826eac1422d not running error response daemon: container 5f62ead9ab9599301f173fed3347a13

scala - Cannot modify Seq.head -

i'm learning scala, , got confused seq.head. scala> x = array(1, 2, 3) x: array[int] = [i@545e9f15 scala> x res64: array[int] = array(1, 2, 3) scala> x(0) res65: int = 1 scala> x.head res66: int = 1 scala> x(0) += 1 scala> x.head += 1 <console>:13: error: value += not member of int x.head += 1 ^ scala> x.head = 1 <console>:12: error: value head_= not member of scala.collection.mutable.arrayops[int] x.head = 1 ^ scala> seems there's implicit conventions happening beneath. but scala api, type of array.head int (in case): def head: t so why can modify element? the key difference in question between x(0) += 1 (which works), , x.head += 1 (which fails). x(0) += 1 equivalent x(0) = x(0) + 1 , syntaxic sugar x.update(0, x.apply(0) + 1) . instruction increases value of x(0) . x.head returns , int , immutable, x.head += 1 fails. wiki

android - Is it possible to have a truck navigate on public lanes? -

i need compute route trucks allowed use bus lanes. possible compute , have navigation on kind of routes ? what i've tried far : using routeoptions.transportmode.public_transport, it's designed pedestrians using public_transport using routeoptions#setpublictransporttypeallowed(transittype.bus_public, true); routeoptions.transportmode.truck not affect routing. wiki

r - Horizontal scrolling in Rmarkdown -

i have wide table many columns able display neatly horizontal scroll in r-markdown. have read documentation , tried following ```{css} pre code, pre, code { overflow-x: scroll !important; } ``` as setting options(width = 1000) in code chunk. both methods fail. kable(mat) ) displays row names , column names stacked on top of each other, avoid x-overflow any recommendations appreciated. here full dataset: > dput(mat) structure(list(`jul 2016` = c(0.108624566189299, 1.76516237793691, 0.24654630490587, 0.336005341665282, 1.00201353799076, 1.36940398901225, 3.66411692441857, 0.927558916609414, 0.691046979743987, 0.450146262999624, 0.917686009737563, 0.140224124770612, 0.843074107500625, 1.05518907118113 ), `aug 2016` = c(0.495219146367162, 0.391441250685602, 1.54749462052876, 0.173654376994818, 0.633756110444665, 0.631372984033078, 0.18316258961296, 0.182683125603944, 3.05005361690094, 3.94560365916646, 1.23740167125376, 0.104842279106379, 1.19900375879825, 0.885

c# - How to update a ListView with a Button click in different pages? -

i've 2 different xaml pages, in first 1 i've button , in other page listview. i've done binding stuff , create "model" class. listview: <listview x:name="listaeventos" itemssource="{x:bind eventos}" fontfamily="segoe ui emoji"> <listview.itemtemplate> <datatemplate x:datatype="data:evento"> <stackpanel orientation="horizontal"> <textblock text="{x:bind minuto}" style="{themeresource captiontextblockstyle}" verticalalignment="center"/> <textblock text="{x:bind segundo}" style="{themeresource captiontextblockstyle}" verticalalignment="center"/> <textblock text="{x:bind icono}" margin="10,0,0,0" verticalalignment="center"/>

android - Facebook webview fails when shared -

final edit bug. after filing report addressed. edit i trying user id in webview of facebook messenger bot. works fine on mobile, yet fails on desktop (web). should not case. messenger 2.1 release statement gives following quote: desktop support extensions sdk: new feature extend functionality across mobile , web, creating consistent experience across devices. now, features user id , sharing used accessible on mobile available on desktop well. provides developers easier way test , debug when implementing webview , chat extensions. there 2 ways user id messenger extensions: getuserid() , getcontext() . docs state getuserid() not available on desktop, make no mention of getcontext() . howevew, there bug report states getcontext() call not yet available on desktop. the docs mention no other ways of getting user id. how 1 supposed that? as kicker, if read original question, see getcontext() work on desktop (web), if webview opened through link sent directly

c# - Converting stream to base 64 -

i working xamarin forms , received image in stream. now, need convert base64 send webservice how can ? i trying: protected async task pickimage() { try { stream stream = await dependencyservice.get<ipicturepicker>().getimagestreamasync(); //stream.gettype<uri>(); if (stream != null) { image image = new image { source = imagesource.fromstream(() => stream), backgroundcolor = color.gray }; cadastrar_foto_perfil.source = imagesource.fromstream(() => stream); byte[] imagedata = new byte[stream.length]; stream.read(imagedata, 0, system.convert.toint32(stream.length)); string _base64string = convert.tobase64string(imagedata); user.cont_imagem = _base64string; } if (device.os == targetplatfor

android - Accessing MainActivity once BOOT_COMPLETE is received -

i have reminder app notify me @ given time when next reminder array of objects due. i trying make set notification again on boot. i have boot receiver set in manifest, how access information mainactivity once phone has booted, given app hasn't been opened yet? i hoping use - public class bootreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { log.i("regularreminders","onreceive"); new mainactivity().setnotifications(); } } but returns null error within notification once tries run method in mainactivity, app crashes emulator boots , see in logcat - java.lang.runtimeexception: unable start receiver com.androidandyuk.regularreminders.bootreceiver: java.lang.nullpointerexception: attempt invoke virtual method 'int java.util.arraylist.size()' on null object reference this points line - if (reminders.size() >= 0) { i did wonder if save notification message

How to use laravel and node.js together to implement video chat? -

i want implement video chat in laravel5.3, video chat switched node.js. said other part of project based on laravel,now communication of laravel , node.js needed , think of 2 choices if not wrong: 1-consider whole video chat (client_side , server_side) implemented node.js special part or module , send request laravel that, module work, want know if possible , how? 2-consider laravel blade client side of video chat, have problem load node_modules in laravel blade. load node_modules in blade below : <script src="{{url('admin/js/node_modules/socket.io-client/dist/socket.io.js')}}"></script> and faced problem, have below question: 1-is possible load node_modules in laravel blade? 2-if first question true how load node_modules in laravel blade correctly? wiki

angular - Router couldn't navigate normally with listener("renderer2") in Angular4 + Cordova, -

description: in project, set android phone's "backbutton" event fired through cordova interface (document event). result: after click "back button", view turn blank. the router outlet console did success changed /home(i have done log in: router-outlet active event) when view to blank(and thought did change route), click diff router-outlet(footer), , home appear ! ps: router.navigate work if didn't use renderer2 listener code: constructor(private render: renderer2, private router: router,) { this.render.listen('document', 'backbutton', ()=>{ this.backbuttonevent(); }) } private backbuttonevent(){ this.router.navigate(['/home']).then( ()=>{ console.error('navigate success'); }, ()=>{ console.error('navigate failed'); } } using zone.run solved problem. ngzone maintain rerendering in angular. i guess problem met caused event listener outside of angula

sql - SUM DISTINCT VALUE ON JOIN -

order_id ========= id price 10 10 b 20 b 20 c 30 c 30 d 40 d 40 client ================== client name id 1 clientinc. 1 clientinc. 1 clientinc. b 1 clientinc. b 1 clientinc. c 1 clientinc. c 1 clientinc. d 1 clientinc. d i have 2 tables need join (order_id , client) , want sum price distinct order_id , create report below: desired solution ======================== id name sum(price) 1 clientinc. 100 this current query using: select merchant, name, sum(price) order_id join client b on a.id = b.id group merchant, name it displaying following output summarizing every order_id, problem want sum distinct order id: current wrong report ====================== id name sum(price) 1 clientinc. 200 select merchant, name, sum(price) ( select distinct id,price order_id ) join client b on a.id = b.id group merchant, name; wiki

multithreading - Java Multiple threads using a client socket -

i'm creating server based chat program has multiple worker threads each handling client on socket. has single server socket passes off client worker thread. public static void main(string[] args) { executorservice executor = executors.newfixedthreadpool(5); serversocket serversocket = null; try { serversocket = new serversocket(4001); system.out.println("listening server"); while (true) { socket socket = serversocket.accept(); system.out.println("connected"); random rand= new random(); int port=4001+rand.nextint(5); worker worker = new worker(port); executor.execute(worker); system.out.println("thread started"); new printwriter(socket.getoutputstream(), true).println(port); socket.close(); system.out.println("closed"); // break; } } catch (ioexception e)

void(* resetDevice) (void) = 0; What kind of a function is this? -

void(* resetdevice) (void) = 0; this function declaration stumbled upon, no definition found later. kind of function this? do? return? this pointer void function accepting no parameters. pointer named resetfunc , initialized null. library code later initialize point real function. able call with resetdevice(); now, function exactly, have no idea - depends on environment/libraries, have not specified. guess arduino, can read bit more here http://forum.arduino.cc/index.php?topic=385427.0 wiki

python - How to select Food-related images from a variety of images -

currently crawling instagram , lots of pictures, firstly filter data select pictures relating food. used tag filter, know, many posts nit have tags , also, many tags need considered. there idea how find pictures relating food variety of pictures. looking forward reply. wiki

Strange running times in C++ loops -

Image
so, i'm writing program, optimization key factor. however: during optimization, notice function considered relatively simple, taking way long run. since, in comparison, more difficult function taking way shorter. whole relevant section // simple function int get_chunk_index(std::vector<chunk> chunks, int x, int y) { glm::vec3 target = glm::vec3(x * 40, 0, y * 40); (int = 0; < chunks.size(); i++) { if (chunks[i].trans.getpos() == target) { return i; } } return -1; } // end simple function if more functions, feel free ask, quite large program, can't include everything here. ps: chunks ever 0->40 in size. a few simple options. 1) chunks being passed value, creates complete copy of vector being passed. try passing const reference (i.e. const std::vector<chunk> &chunk ) instead. 2) rather passing x , y , , creating glm::vec3 (whatever - it's non-standard) them, change fun

Preferred way of resetting a class in Python -

based on this post on codereview . i have class foo in python (3), of course includes __init__() method. class fires couple of prompts , thing. want able reset foo can start procedure on again. what preferred implementation? calling __init__() method again def reset(self): self.__init__() or creating new instance? def reset(self): foo() i not sure if creating new instance of foo leaves behind might affect performance if reset called many times. on other hand __init__() might have side-effects if not attributes (re)defined in __init__() . is there preferred way this? you hold instance work in class attribute. whenever want reset class, reassign new instance attribute. here how implement approach: class foo: instance = none # single instance def __init__(self, ...): # initialize instance if foo.instance not exist, else fail if type(self).instance none: # initialization type(self).instance =

loopbackjs - Is there a way to create a "global" hook that will fire regardless of the model requested -

i want able add row count every model have. know how add using remote or operational hook, far can tell have add code each model want use on. instead, want write 1 hook trigger regardless of model requested. you can leverage mixin functionality. in model-confg.js specify location of mixins: { "_meta": { "mixins": [ "loopback/common/mixins", "loopback/server/mixins", "../common/mixins", "./mixins" ], ... }, ... } create mixin in designated mixins folder (e.g. server/mixins/<mixin-name>.js ) : module.exports = function(model, options) { model.observe('before save', function event(ctx, next) { // row count logic next(); }); }; add mixin model: { "name": "mymodel", "base": "persistedmodel", "properties": { ... }, ... "mixins": { "mixinname": true

c# - Gembox: Modify Comment Size -

i'm using gembox 37.3.30.1030. i'm adding comments cells not displayed due small comment size. don't see properties can resize comment. can help? thanks! you can define excelcomment 's size specifying topleftcell , bottomrightcell . example: excelfile workbook = new excelfile(); excelworksheet worksheet = workbook.worksheets.add("sheet1"); excelcomment comment = worksheet.cells["b2"].comment; comment.text = "lorem ipsum dolor sit amet, consectetur adipiscing elit."; comment.topleftcell = new anchorcell(worksheet.columns[3], worksheet.rows[5], true); comment.bottomrightcell = new anchorcell(worksheet.columns[6], worksheet.rows[20], false); //comment.isvisible = true; workbook.save("sample.xlsx"); note there no auto-fitting or auto-sizing or similar comments content, you'll have set size yourself. try creating rough approximation adjust comment's size based on number of lines or number of characters in

programming languages - What does this explanation of callback mean? -

i saw sentence programming language pragmatics, scott the programmer wants handler—a special subroutine—to invoked when given event occurs. handlers known callback functions, because run-time system calls main program instead of being called it. i don't quite understand explanation of reason of event handlers named "callback". what 2 cases mean: "the run-time system calls main program" "being called it", i.e. run-time system called main program? thanks. wiki

java - Collect a Dataset in Spark Asynchronously -

like rdds have collectasync() , there way collect dataset asynchronously in spark? yes collectasync() way collect dataset asynchronously. in rdd operation, collectasync() has no latency on other hand collect(). val value = rdd.collect() //rdd elements copied spark driver val value = rdd.collectasync() //no copy here value.get() //now, rdd elements copied spark driver wiki

anko - kotlin java.lang.NoSuchMethodError: No static method OnTouchListener -

internal var mtouchlistener: view.ontouchlistener = ontouchlistener { v, event -> detector!!.ontouchevent(event) when (event.action) { motionevent.action_down -> if (autoscroll) { stopautoscroll() } motionevent.action_up -> if (autoscroll) { startautoscroll() } else -> { } } false } i have custom view class. why error occur? caused by: java.lang.nosuchmethoderror: no static method ontouchlistener(lkotlin/jvm/functions/function2;)landroid/view/view$ontouchlistener; in class landroid/widget/framelayout; or super classes (declaration of 'android.widget.framelayout' appears in /system/framework/framework.jar:classes2.dex) @ cn.qssq666.banner.banner.(banner.kt:332) @ cn.qssq666.banner.banner.(banner.kt:0) @ cn.qssq666.banner.banner.(banner.kt:0) @ java.lang.reflect.constructor.newinstance0(native method)  @ java.lang.reflect.constructor.n

Windows 10 notifications in python -

i've tried lot of methods found online create notification bubbles through python, none of them work. suspect has windows not allowing them script, how can solve this? for example, using the balloontip snippet , , in own script: import balloontip following either of these doesn't show toast. w=balloontip.windowsballoontip('asdf', 'qwerty') balloontip.balloon_tip('asdf', 'qwerty') i've tried using win10toast package still no such luck. what's weirder solutions entirely unrelated python don't work. example this powershell script creates icon in tray message won't show. try import modules used in snippet, , include snippet in script. might need install win32api using pip install pypiwin32 might identify problem/check if indeed problem windows notifications in general. i able create notification adding following code end: balloon_tip("test title", "test message") check if have block

Strip just <p> tags in PHP -

i have set of <p></p> tags wrapping set of data, data includes other tags such <script></script> content contain number of different tags. i need remove paragraph tags content example below $text = "<p><script>example text inside script.<script></p>"; i see strip_tags function believe remove tags. how go removing paragraph? thanks. try this, works <p> , <p class='class'> : $text = "<p class='class'><script>example text inside script.</script>ss</p>"; echo preg_replace("/<\\/?p(.|\\s)*?>/","",$text); here working example wiki

php - Using External SMTP Wordpress on VPS -

i've installed webmin on vps server , installed postfix outgoing mail. use ubuntu operating system i use smtp plugin wordpress site. i've set smtp settings zoho smtp , i'm sure setting ok. when try send message smtp test email wordpress plugin, got message the smtp debugging output shown below: 2017-08-22 14:27:26 connection: opening smtp.zoho.com:587, timeout=300, options=array ( ) 2017-08-22 14:27:26 connection: failed connect server. error number 2. "error notice: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: temporary failure in name resolution 2017-08-22 14:27:26 connection: failed connect server. error number 2. "error notice: stream_socket_client(): unable connect smtp.zoho.com:587 (php_network_getaddresses: getaddrinfo failed: temporary failure in name resolution) 2017-08-22 14:27:26 smtp error: failed connect server: php_network_getaddresses: getaddrinfo failed: temporary failure in n

Breaking text in Android's TextView -

i have text string lorem ipsum dolor sed eiusmod tempor sit am. which display on screen. phones can display whole sentence in single line, while others not wide , display sentence this: lorem ipsum dolor sed eiusmod tempor sit am. which looks ugly. better break more evenly, this: lorem ipsum dolor sed eiusmod tempor sit tempor sit am. how make sure textview never breaks text single word takes whole line? remark: api 23 introduced breakstrategy attribute (see link ) textview , solve problem. unfortunately, not supported lower versions. there work-around here? wiki

Calculate up to two decimal places in Python -

Image
this question has answer here: display float 2 decimal places in python 5 answers i want calculate 2 decimal places in calculations can't for example: a = 93 b = 1 c = float(93/1) print c i want print : 93.00 but print : 93.0 is there function or there way this? use explicit format float print("%.2f" % round(c,2)) test on jupyter https://try.jupyter.org/ wiki

list - sort points in order to have a continuous curve using python -

Image
i have list of unsorted points: list = [(-50.6261, 74.3683), (-63.2489, 75.0038), (-76.0384, 75.6219), (-79.8451, 75.7855), (-30.9626, 168.085), (-27.381, 170.967), (-22.9191, 172.928), (-16.5869, 173.087), (-4.813, 172.505), (-109.056, 92.0063), (-96.0705, 91.4232), (-83.255, 90.8563), (-80.7807, 90.7498), (-54.1694, 89.5087), (-41.6419, 88.9191), (-32.527, 88.7737), (-27.6403, 91.0134), (-22.3035, 95.141), (-18.0168, 100.473), (-15.3918, 105.542), (-13.6401, 112.373), (-13.3475, 118.988), (-14.4509, 125.238), (-17.1246, 131.895), (-21.6766, 139.821), (-28.5735, 149.98), (-33.395, 156.344), (-114.702, 83.9644), (-114.964, 87.4599), (-114.328, 89.8325), (-112.314, 91.6144), (-109.546, 92.0209), (-67.9644, 90.179), (-55.2013, 89.5624), (-34.4271, 158.876), (-34.6987, 161.896), (-33.6055, 164.993), (-87.0365, 75.9683), (-99.8007, 76.0889), (-105.291, 76.5448), (-109.558, 77.3525), (-112.516, 79.2509), (-113.972, 81.3335), (2.30014, 171.635), (4.40918, 169.691), (5.07165, 166.974

java - Accessing REST request path parameters in servlet -

i have written rest web service . i trying path parameters of the request in httpservlet. my request is /api/test/{name}/{city} how can access value name , city? public class simplehttpserver extends httpservlet { @override public void doget( httpservletrequest request, httpservletresponse response ) throws ioexception { //how can access value name , city } } wiki

batch file - Compile c code using gcc without installing mingW/cygwin -

i have visual studio installed in system. corresponding compiler , environment variables set. when try compile c file using cl command, works fine. zipped mingw system , extracted system. have in d:/mingw . have created batch file compiling c file. contents of batch file are, set gccpath=d:/mingw/bin %gccpath%/gcc.exe -c -std=c99 -o myc.o ../myc.c -i..\. when run batch file, producing few errors. 1 such error stdio.h:209:71: error: macro "snprintf" requires 5 arguments, 4 given the above error might due fact compiler takes stdio.h of visual studio instead of mingw's default header file. error is, error: previous declaration of 'xxxxfun' here what should change in batch script compile c file using mingw. compilation process successful when use visual studio, throws error if use gcc same set of files edit: fixed latter error. first error doesn't occur when stdio.h included @ first. if include stdio.h @ middle of include section, error com

Neo4j Cypher pattern comprehension -

this neo4j sandbox query tests: neo4j browser: https://10-0-1-223-34371.neo4jsandbox.com/ direct neo4j http: http://54.89.60.35:34371/browser/ username: neo4j password: capacities-complement-deputies ip address: 54.89.60.35 http port: 34371 bolt port: 34370 i have following cypher query: match (parentd)<-[:defined_by]-(ch1:characteristic)<-[v1:has_value_on]-(childd) not (ch1)<-[:depends_on]-() , parentd.id = 1 return v1 which correctly returns following data(1 record): { "totalhistoryvalues": 0, "available": true, "description": "integer value 1", "value": 10 } but inside of following query pattern comprehension: match (parentd)-[:contains]->(childd:decision) parentd.id = 1 * match (childd)-[ru:created_by]->(u:user) optional match (childd)-[rup:updated_by]->(up:user) ru, u, rup, up, childd skip 0 limit 100 return ru, u, rup, up, childd decision, [ (parentd)<-[:defined_by]-(ent

python - CNN model converges very fast -

i training cnn model text dataset(domain names) of 1 million entries. model seem converge fast. gives me 94% accuracy in 1 epoch. ideas why happening? def build_model(max_features, maxlen): """build cnn model""" model = sequential() model.add(embedding(max_features, 8, input_length=maxlen)) model.add(convolution1d(6, 4, border_mode='same')) model.add(convolution1d(4, 4, border_mode='same')) model.add(convolution1d(2, 4, border_mode='same')) model.add(flatten()) #model.add(dropout(0.2)) #model.add(dense(2,activation='sigmoid')) #model.add(dense(180,activation='sigmoid')) #model.add(dropout(0.2)) model.add(dense(2,activation='softmax')) return model output during first 3 epochs: 950000/950000 [==============================] - 232s - loss: 0.1764 - categorical_accuracy: 0.9356 - fmeasure: 0.9356 - precision: 0.9356 - recall: 0.9356 - val_loss: 0.157

database - Oracle 11g vs Oracle 12c JDBC connection string -

we have 2 jdbc connection strings, first oracle 11g database: jdbc:oracle:thin:@[hostname]:[port]:[service_name] second 1 oracle 12c database: jdbc:oracle:thin:@(description=(failover=on)(connect_timeout=5)(transport_connect_timeout=3)(retry_count=3) (address_list=(load_balance=off) (address=(protocol=tcp)(host=<primary_db_hostname>)(port=<db_port>)) (address=(protocol=tcp)(host=<secondary_db_hostname>)(port=<db_port>))) (connect_data=(service_name=<service_name>)))    second connection string says failover mechanism in place, if primary db fails, have still second 1 should automatically take load. question: possible first connection string ensures failover mechanism, hidden client , configured in database internals? wiki

angularjs - Issue for calling 2 function with with one click and 1st should save before 2nd -

this question has answer here: how add many functions in 1 ng-click? 3 answers how can add 2 function 1 ng-click . try : ng-click="save(); send();" but want save first send. both function having api calls. call function ng-click="callto2functions()" $scope.callto2functions =function(){$scope.save();$scope.send();} wiki

python - How do I make a program that shows a simple loading screen? See below for more details -

i wrote - import time timeout = time.time() + 2 dot, = ".", 0 while timeout > time.time(): print ("loading" + dot*i, end = "\r") time.sleep (0.1) if == 3: = 0 else: += 1 it runs fine till "loading...", need go "loading" , loop till time expires. ps - i'm running on windows powershell. after 3 dots return , draw 1. 2 previous ones remain! just include (3-i) whitespaces after dots print ("loading" + dot*i + ' '*(3-i), end = "\r") by way, sleep of 0.1 make dots fast, try bigger sleep better visualization wiki

angular - Typescript file in Chrome devtool is different than code in VS Code -

so i've been struggling debug typescript file have in our enterprise app. let's call fetch-effects.ts , it's typescript file ngrx/effects. know there's chrome debugger extension visual studio code, can't work since our app structured oddly, has hostapp needs run, along 1 of child apps, child app iframe inside hostapp. both of them running simultaneously on different ports locally on machine. anyway, can't debugger work vs code, , team told me place debugger; in code , check chrome devtools in browser. i've been doing trying debug .ts file , it's showing different code in devtools compared code in vs code. debugger hits on right file in random line, file not exact copy of code in vs code. i've tried restarting chrome, , hard refresh, i've managed make show same 1 time. know i'm doing wrong? wiki

java - Unable to find elements in modal popup using selenium -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i need confirm modal popup. have form fill , have move next page. when click continue, modal popup appears asking if details filled correct? there 2 button , other description on it. 1 button reads cancel , other says yes, information correct. tried switching modal element driver.switchto().frame(0); // there 1 popup however, whatever webdriver after results in nullpointerexception no webelement found. this trying webelement modalbuttoncontainer = autoutils.findelementbyclassname(modaloverlay, "modalbuttoncontainer"); webelement modalbutton = autoutils.findelementbyclassname(modalbuttoncontainer, "buttonclass"); modalbutton.click(); but results in nullpointer . how click modalbutton ? if recall correctly driver.switchto().frame(0); switches

Compare value between 2 datagridview c# -

i have 2 datagridviews. datagridview1 has 3 rows , datagridview2 has 2 rows.how compare values between them. exa: datagridview1 datagridview2 id name id name 1 3 c 2 b 4 3 c i want compare: 1 vs 3, 1 vs 4, 2 vs 3, 2 vs 4, 3 vs 3, 3 vs 4. i use code below works incorrect. for (int = 0; < datagridview1.rowcount; i++) { (int j = 0; j < datagridview2.rowcount; j++) { i++; string grid2 = datagridview2.rows[j].cells[1].value.tostring(); string grid1 = datagridview1.rows[i].cells[1].value.tostring(); if (grid1 == grid2 || datagridview2.rows[0].cells[1].value.tostring() == datagridview1.rows[0].cells[1].value.tostring() ) { datagridview1.rows.removeat(i); } } } 1) if want iterate through collection using loop not wise increment indexing variable additionally in code line: i++; it increme