Posts

Showing posts from March, 2011

javascript - How to have a jquery toggle hide/show functionality that acts as multiple filtering? -

in page have 3 text act filters show/hide respective classes. all items items a items b for example, when "all items" clicked, divs have class items hidden, , strikethrough line showing on "all items" text. the same goes other 2 options. the logical error facing when 3 combining, "all items" option. for example, if "all items" clicked, , "items a", "items a" appear, strikethrough on "all items" remains. you can see code below. how can fix "logical" errors , have filtering functionality? $(".itema").click(function() { $(".itema-item").toggle(800); $(".itema").toggleclass("striketrough-line"); }); $(".itemb").click(function() { $(".itemb-item").toggle(800); $(".itemb").toggleclass("striketrough-line"); }); $(".all-items").click(function() { $(".items").t...

php - Call woocommerce product data outside review order file -

how proper call / product information name, price, , product image, outside review-order.php file (woocommerce). i have tried adding: <p class="product-price-special"> <?php echo apply_filters( 'woocommerce_cart_item_subtotal', wc()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?></p> this makes woocommerce fields, elements etc. disappear. styles stays background colors , images, data related elements disappear. can use these apply filters /echo class inside review-order.php. how can call outside file?

html - Localstorage can't generate data Javascript -

i want generate new div element information input , not working correctly. have big problem saving , receiving data localstorage . spent 2 days researching issue. kind tell me problems? fiddle: https://jsfiddle.net/v5r653nd/1/ var nameaaaa = document.getelementbyid("nameofbook"); var author = document.getelementbyid("nameofauthor"); var year = document.getelementbyid("year"); function makejob() { testobjects.push({ name: nameaaaa.value, author: author.value, year: year.value }) localstorage.setitem('testobjects', json.stringify(testobjects)); if understood correctly problem, overwritting localstorage since @ start of script declare testobject empty array , later work on , replace localstorage values. so should retrieve localstorage value first , store in variable: var testobjects = localstorage.getitem("testobjects") ? json.parse(localstorage.getitem("testobjects")) : []; j...

javascript - Vue router-link exact active class -

i have 3 of menu tabs (i.e. router-link s) correspond 3 different routes: / --> home /users --> users /posts --> posts the first router-link going / has exact property applied, not receive active class when on /users or /posts . works cases, planning on allowing query parameters on / route. example: /?ref=producthunt in case, / router-link should still active. however, given have exact property on it, not matching url ref query parameter. outside of adding additional logic component test route , flip classes, there feature of router-link component can use solve this? if want use router-link navigate '/' ref query parameter, why not set ref query property in router-link ? still work exact . <router-link :to="{ path: '/', query: { ref: 'producthunt' } }" exact>home</router-link> check demo here . updated if talking vue-router 's setting issues, think url http://example.com/?...

java - Why is my Spring Boot application creating durable queue in one program and non-durable in another in RabbitMQ -

Image
i have 2 spring based programs. both of them publishes simple "hello world" message onto queues (gets created automatically) successfully. 1 program creates non-durable queue whereas other 1 creates durable. program not specifying parameters creating either of these. not sure how queue creation in spring framework works. basicapplication1.java @springbootapplication public class basicapplication1 { private static rabbittemplate rabbittemplate; private static final string queue_name = "helloworld.q"; @bean public queue queue() { return new queue(queue_name, false); } //creates "non-durable" queue in rabbitmq public static void main(string[] args) { try (configurableapplicationcontext ctx = springapplication.run(basicapplication1.class, args)) { rabbittemplate = ctx.getbean(rabbittemplate.class); rabbittemplate.convertandsend(queue_name, "hello world !"); } }...

ios - deleting a child from firebase when flagging a post -

i have been trying delete post firebase when post gets more 2 flags. have tried lot of ways , cannot figure out. have images attached appreciated! ` // 4 if poster.uid != user.current.uid { let flagaction = uialertaction(title: "report inappropriate", style: .default) { _ in postservice.flag(post) /// addedflag let flaggedpostref = database.database().reference().child("flaggedposts").child(postkey!) // 3 var flaggeddict = ["text": post.textdata, "poster_uid": post.poster.uid, "reporter_uid": user.current.uid] // 4 flaggedpostref.updatechildvalues(flaggeddict) // 5 let flagcountref = flaggedpostref.child("flag_count") flagcountref.runtransactionblock({ (mutabledata) -> transactionresult in l...

How can I pass a generic struct to a function in C? -

i'm beginner in c programming , have doubt pass generic struct function in c. here have: typedef struct { char name[20]; float price; } product; typedef struct { char name[20]; int type; } category; and want this: void changename(struct *s, newname[20]) { strcpy(s->name, newname); } if has asked that, please disconsider , sends me issue link. someone can me? thanks. using union one approach add structure containing union , containing pointers product , category structures, enum identify type of data in struct . union , or pointer it, passed change_name() function. here example work in c11. uses unnamed union member, not valid c99 code: #include <stdio.h> #include <string.h> typedef struct { char name[20]; float price; } product; typedef struct { char name[20]; int type; } category; typedef struct { enum { product, category } type; union { product *prod; category *cat...

Facebook app multiple users accessing -

i finished development of facebook app, access through admin account. need accessed multiple users registered app. took necessary permissions , made app public too. there app settings make accessible registered users. please me in this.

google maps api 3 - directions + road APIs for educational purpose -

my team members , university students doing our industrial project going predict arrival times ambulance cars patients , hospitals based on various factors. our system extensively querying google maps apis road , direction apis. there chance premium access these apis since used educational purpose? thanks:) google has google maps apis grants (premium plan free) available nonprofit organizations in united states. if organization meets these requirements can reach out google , apply grant described in following document: https://support.google.com/nonprofits/answer/3367237?hl=en hope helps!

java - how can i access the courseID variable from another class? -

i have fragment , java class. want access courseid variable in generator class fragmenrvrlist fragment. tried declare static variable doesn't allowed. how can it? thank in advance :) generator.java public class generator { public static list<dobjectvrlist> getdata(){ int courseid; list<dobjectvrlist> courses = new arraylist<>(); (int i=1; i<=8;i++){ dobjectvrlist course = new dobjectvrlist(); course.setid(i); courseid = course.getid(); switch (i){ case 1: course.settitlecourse("course "+i); course.setcoursedate("today @ 9 pm"); break; case 2: course.settitlecourse("course "+i); course.setcoursedate("today @ 9 pm"); break; case 3: course.settitlecourse("course " +i); course.setcoursedate("today ...

javascript - removing div child from parent element with jquery -

is possible remove div element parent (with class name container) without removing ul element inside foo-1 class ? <div class="container"> <div class="foo-1"> <ul class="toon"> <li>li 1</li> <li>li 1</li> </ul> </div> <div class="foo-2">foo 2</div> </div> you can exclude element containing such ul $('.container').children(':not(:has(ul.toon))').remove(); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="container"> <div class="foo-1"> <ul class="toon"> <li>li 1</li> <li>li 1</li> </ul> </div> <div class="foo-2">foo 2</div> </div> this ...

c++ - Pointer to function -

what mistakes mean? why when make types double, doesn't show same mistakes? c2556 'int div(int,int)': overloaded function differs return type 'div_t div(int,int)' c2371 'div': redefinition; different basic types c2491 'div': definition of dllimport function not allowed c2664 'int calculate(int,int,int (__cdecl *)(int,int))': cannot convert argument 3 'overloaded-function' 'int (__cdecl *)(int,int)' #include <iostream> using namespace std; int sum(int x, int y) { return x + y; } int subs(int x, int y) { return x - y; } int mult(int x, int y) { return x * y; } int div(int x, int y) { return x / y; } int calculate(int x, int y, int(*func)(int, int)) { return func(x, y); } void main() { cout<<"sum:"<< calculate(8, 4, sum)<<endl; cout << "subs:" << calculate(8, 4, subs) << endl; cout << "mult:...

python - How to map SQLAlchemy raw text query result to model instances? -

here's example flask app illustrates i'm trying do: """flask app list yummy desserts.""" # these dependencies: # flask 0.12.2 # sqlalchemy 1.1.13 # flask-sqlalchemy 2.2 # sqlalchemy-utils 0.32.14 # alembic 0.9.5 # flask-migrate 2.1.0 import click flask import flask flask.cli import with_appcontext flask_migrate import migrate flask_sqlalchemy import sqlalchemy sqlalchemy import orm, select, text sqlalchemy_utils import choicetype # use app, place file in './myproject/app.py', , # create file './autoapp.py' looks this: # myproject.app import create_app, config # app = create_app(config) # , set: # export flask_app=/path/to/autoapp.py class config(object): """configuration object.""" debug = true secret_key = 'secret-key' sqlalchemy_database_uri = 'postgresql://quicktest:quicktest@localhost/quicktest' sqlalchemy_track_modifications = false db = sqlalche...

How come my route isn't matching with React Router 4? -

i have routes file works expected: <route path="/app" render={({match}) => ( <switch> <route exact path={`${match.url}/`} component={home} /> <route path={`${match.url}/error`} component={error} /> </switch> </route> but when try hard code routes, not work. example: <route path="/app" render={({match}) => ( <switch> <route exact path={`app/`} component={home} /> <route path={`app/error`} component={error} /> </switch> </route> of course hard coding not want, in case wanted this <route path="/app"> <switch> <route exact path="app/" component={home} /> <route path="app/error" component={error} /> </switch> </route> and create app using children of route , not render prop. doing wrong, or how can accomplish this? react router v4 does...

r - Adding line breaks to concatenating functions? -

what command have use adding linebreaks while concatenating functions? here script: canada <- c(50, 50, 50) korea <- c(70, 70, 70) brazil <- c(100, 100, 100) fruit <- rbind(canada, korea, brazil) colnames(fruit) <- c("apple", "orange", "banana") 1 <- function(x){ x <- tolower(x) # assuming row names in lower case myrow <- fruit[x,] count <- sapply(seq_along(myrow), function(x, n, i) {paste0(x[i], "")}, x=myrow[1], n=names(myrow)) count[length(count)] <- paste0(count[length(count)]) count <- paste(count[1]) cat(tools::totitlecase(x), "has", count, "thousand farms") # general statement } here i've tried: cat(one("canada"), '\n\n', one("canada")) canada has 50 thousand farmscanada has 50 thousand farms i want this: canada has 50 thousand farms canada has 50 thousa...

python - Is it possible to read spin text from 1 file & write it in another text file without bracket in python3? -

i stuck & need guys. here want program do. have 1 text file named spin.txt contains spin text {something there|source|something here} baz {why not find out more|these guys} & have text file named write.txt want read spin.txt file & write write.txt file. have done. working fine problem getting when writing write.txt file adds bracket & ' - [' wrote here'] don't want want write text. using python 3x on windows 10. **my code :-** import re import itertools p = re.compile("(\{[^\}]+\}|[^\{\}]*)") spin_comments =open("c:\\users\\desktop\\spin.txt","r") file = str(spin_comments.readlines()) frags = p.split(file) def options(s): if len(s) > 0 , s[0] == '{': return [opt opt in s[1:-1].split('|')] return [s] opt_lists = [options(frag) frag in frags] write_text = open("c:\\users\\desktop\\write.txt","w") spec in itertools.product(*opt_lists): = ''.join(...

tensorflow - Dataset input from bmp images only 50% accurate -

i've created graph try: import bmp files , generate label based on filename (l/r). train network determine between left , right eye. evaluate network. i'm using new framework , in dataset. code runs, 50% accuracy (no learning happening). can check graph right , it's network need fix ? """ routine processing eye image dataset determines left/right eye using tensorflow api v1.3 """ __future__ import absolute_import __future__ import division __future__ import print_function import os import fnmatch import tensorflow tf six.moves import xrange # pylint: disable=redefined-builtin import nnlayers nnlayer image_size = 460 scale_size = 100 num_classes = 2 image_depth = 3 flags = tf.app.flags.flags # basic model parameters. tf.app.flags.define_integer('batch_size', 200, """number of images process in batch.""") tf.app.flags.define_integer('num_epochs'...

open file on server with notepad via windows cmd in python -

i trying opne file located on server using windows cmd. following thing: import os os.system('pushd '+ \\server\pathtofile) os.system('start notepad '+ nameoffile) the point works if enter hand in cmd. if try within python not work. error message: cmd.exe started path given above current directory. unc-paths not supported, therefore windows-directory used current directory. the actual error message in german, that's why translated , i'm not sure whether it's understandable or not. happens path notepad looking current file c:\windows instead of path indicated. windows doesn't support setting current directory unc path, , wouldn't have worked anyway since 2 separate os.system commands. you mount drive on path , use os.chdir , make more complex yet! you don't need current directory change. os.system deprecated, it's recommended use subprocess instead. so change code run command providing full path file: import ...

osx - Kext reference from connected user-space clients -

i'm using kext provides services 1 or more user-space clients communicate using iokit service. i'd each such client take reference on kext, wouldn't possible unload kext long there still available clients. according documentation can use ioserviceopen , ioconnectaddref , it's still possible unload driver using kextunload . kextstat shows no references taken on driver, references other drivers mentioned in documentation, thought above commands trick. index refs address size wired name (version) uuid <linked against> 1 100 0xffffff7f80a46000 0x9d90 0x9d90 com.apple.kpi.bsd (16.7.0) 410b3b98-9dab-4590-9086-7c57a5b3099a 2 8 0xffffff7f80fc3000 0x3940 0x3940 com.apple.kpi.dsep (16.7.0) fa744b47-913c-4b5d-8c16-2f8005d85935 3 127 0xffffff7f80a04000 0x21040 0x21040 com.apple.kpi.iokit (16.7.0) 80f2da67-c67b-4583-9b09-082db11f69fc ... 170 0 0xffffff7f80a04000 0x21040 0x321...

android - How to scrape HTML and put into TextView? -

i'm trying scrape html , display in textview on press of button calculator-esque app i'm making video game. supposed pull price of item url specified keep getting errors, , i've been stuck @ ages no luck, appreciated, thank you! package com.elyrs.webscrape; import java.io.ioexception; import java.io.inputstream; import org.jsoup.jsoup; import org.jsoup.nodes.document; import org.jsoup.select.elements; import android.graphics.bitmapfactory; import android.os.asynctask; import android.os.bundle; import android.app.activity; import android.app.progressdialog; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.textview; import android.widget.toast; public class mainactivity extends activity { // url address string url = "http://runescape.wikia.com/wiki/plank"; progressdialog mprogressdialog; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate)...

objective c - 3dModel skeleton presentation in iOS application and its horizontal rotation 360 degree -

i have ios application have present 3dmodel of skeleton , rotate horizontally 360 degrees. have searched lot didn't reach solid lead, appreciated.i doing project in objectivec you can scenekit .

android - DOES GPS RECEIVER WILL HAVE ADDRESS -

the gps receiver in every phone have different addresses identify uniquely or every receiver works same wanted know it no. regular gps receiver (as have in phone or car navigation) passive device , such not sending out data therefore there's no real need identify it.

canvas - how to not fire mouseDown and mouseUp events in click [javascript] -

i have canvas using three.js , of body. then need write drag , drop , click events in shapes in canvas i had found drag , drop should use mousedown , mouseup events writing click event have problem because when click in canvas events of mouse down , fired too. is way stop them being processed?

why github api return null for language field for repositories -

below example returns null in language field, not sure why returns null? https://api.github.com/repos/wycats/merb-more afaict language field signifies most-used programming language in repo. if no languages detected null. you can check list of languages with https://api.github.com/repos/:owner/:repo/languages if it's empty, you'll see null in general repo info. if it's got entries, should see most-used 1 instead - example try these urls: https://api.github.com/repos/testoob/testoob/languages https://api.github.com/repos/testoob/testoob

ng bootstrap - Passing instance of Date to ngModel for Datepicker -

i trying pass instance of date ngmodel datepicker. saw expecting ngbdatestruct. thus, created custom provider extends ngbdateparserformatter. hoped formatter/parser executed when receives input via ngmodel binding, isn't case. don't want format of dates before binding datepicker. there way accomplish this? saw pr pending .

c - How to get the value of stack pointer? (MIPS GCC) -

i trying call stack, reason following code returns wrong stack pointer: unsigned int stack_pointer = 0; __asm("la $26, %[spaddr]\n\t" "or $27, $0, $sp\n\t" "sw $27, 0($26)\n\t" "nop"::[spaddr] "m" (stack_pointer)); return stack_pointer; what missing here? to stack pointer use proper output constraint so: register unsigned sp asm("29"); asm("" : "=r" (sp)); note mips uses register return address, of course non-leaf functions might store on stack. to implement backtrace, can use builtins __builtin_return_address , __builtin_extract_return_addr described in gcc manual . also, if glibc available, has backtrace function, see man backtrace .

json - Show gist scripts in Vue js -

i working vue-js based website , showing data using json api. parse data using axios , returned response view. my json api contains html data including embed gist below <p>some informative text here <br /> <script src="https://gist.github.com/nisat19/8e8e2c03ecbf198daef168948548d481.js"></script> </p> in view, tried render data v-html <div v-html="content"></div> it parses html portion not render gist. i.e some informative text here /* gist script missing */ is there way parse script?

More Than One Facebook Numeric ID -

can single facebook account have more 1 unique numeric id? i.e. account can accessed using https://facebook.com/100002714722900 , https://facebook.com/1100786376688509 , how possible , if there's way how can find others 2nd numeric id?

javascript - Image Slideshow in js hanging app -

i have written method in javascript: function displayimage() { window.setinterval(function(){ (var = 1; <= 4; i++) { document.getelementbyid("img1").setattribute("src", "images/th-" + + ".jpg"); if(i==4){ i=0; } } }, 3000); } and calling method html page: . after 3 sec, application hangs , nothing happens. going wrong in this? in case for loop work 4 times after every 3000 milliseconds. need change 1 picture after each 3000 milliseconds. try this function displayimage() { var img = document.getelementbyid("img1"); var imgindex = 1; window.setinterval(function(){ img.setattribute("src", "images/th-" + imgindex + ".jpg"); imgindex = imgindex === 3 ? 0 : imgindex + 1; }, 3000); }

python - Airflow no module named for directory in airflow_home directory -

i'm working virtualenv. i'm trying use packages inside dag folders. current state of airflow_home directory is: airflow_home/airflow.cfg airflow_home/airflow.db airflow_home/dags/__init__.py airflow_home/dags/hello_world.py airflow_home/dags/support/inner.py airflow_home/dags/support/__init__.py hello_world.py has code: from datetime import datetime airflow import dag airflow.operators.dummy_operator import dummyoperator airflow.operators.python_operator import pythonoperator dags.support import inner def print_hello(): return 'hello world' dag = dag('hello_world', description='simple tutorial dag', schedule_interval='0 12 * * *', start_date=datetime(2017, 8, 20), catchup=false) dummy_operator = dummyoperator(task_id='dummy_task', retries=3, dag=dag) hello_operator = pythonoperator(task_id='hello_task', python_callable=print_hello, dag=dag) hello_from_inner_operator = pythonoperator(task_id='he...

Sharepoint 2013 Picture gallery display form, wanted to display big image when user click on thumbnail -

hi have requirement in sharepoint 2013 picture gallery when user click on thumbnail should open image not first dispform image details , when user click on preview image open image, wan when user click on thumbnail open big image. i thought can custom dispform in list there not able find tag display image without other information. the default list page dispform not able find html or xml code hide unwanted information name, date taken user name etc. want display big image. any appreciated not able find solution yet. 2010 easy in 2013 not able find yet. thanks

linux - Python subprocess command with pipe -

i want use subprocess.check_output() ps -a | grep 'process_name' . tried various solutions far nothing worked. can guide me how it? to use pipe subprocess module, have pass shell=true . however, isn't advisable various reasons, not least of security. instead, create ps , grep processes separately, , pipe output 1 other, so: ps = subprocess.popen(('ps', '-a'), stdout=subprocess.pipe) output = subprocess.check_output(('grep', 'process_name'), stdin=ps.stdout) ps.wait() in particular case, however, simple solution call subprocess.check_output(('ps', '-a')) , str.find on output.

amazon web services - How to output paths to JS/CSS/Images without https? -

i building new magento 2.1 site , looking guidance on configuring ssl. our networking path site follows ssl means apache - , therefore magento - not seeing connections on port 443 , therefore serving assets on http path. browser -> cloudflare (ssl on) -> aws elb (port 443 port 80) -> aws ec2 (magento on port 80) is there way have magento 2 output paths js/css/images using http(s)less approach such "//www.myseite.com/path-to-asset" or alternatively force server use https this. tries etting both secure , non secure url's https end in infinite redirect loop. thanks in advance

javascript - Getting a before/after slider to show multiple times on a page -

i've got comparison slider showing before , after images towards bottom of page. i'd replicate slider 3 more times on page, i'm unsure needs done code point: http://anna-test.webflow.io/eyebrows this current code have slider working: <script> var inkbox = document.getelementbyid("inked-painted"), colorbox = document.getelementbyid("colored"), fillerimage = document.getelementbyid("inked"); inkbox.addeventlistener( "mousemove", tracklocation, false); function tracklocation(e) { var rect = fillerimage.getboundingclientrect(); var position = ((e.pagex - rect.left) / fillerimage.offsetwidth)*100; if (position <= 100) { colorbox.style.width = position+"%"; } } inkbox.addeventlistener( "touchstart", tracklocation, false); inkbox.addeventlistener( "touchmove", tracklocation, false); </script> many thanks, alex

rust - Is there a way to destructure a struct partially? -

i have struct: struct threedpoint { x: f32, y: f32, z: f32 } and want extract two of 3 properties after instantiating it: let point: threedpoint = threedpoint { x: 0.3, y: 0.4, z: 0.5 }; let threedpoint { x: my_x, y: my_y } = point; the compiler throws following error: error[e0027]: pattern not mention field `z` --> src/structures.rs:44:9 | 44 | let threedpoint { x: my_x, y: my_y } = point; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `z` in javascript (es6), equivalent destructuring this: let { x: my_x, y: my_y } = point; .. field in struct or tuple pattern means "and rest": let threedpoint { x: my_x, y: my_y, .. } = point; there's more in the rust book .

python 2.7 - when resizing a image set only resizing one image -

when trying resize image set, resizing first image.how resize images? code: import numpy np import os import cv2 pic_num = 1 img = cv2.imread("e:\ele/"+str(pic_num)+'.jpg',cv2.imread_grayscale) resized_image = cv2.resize(img,(100,100)) cv2.imwrite("e:\eye/"+str(pic_num)+'.jpg',resized_image) pic_num += 1 if looping through files , change it, , don't worried time. then can use loop in python for example have pics 1 100 then can following: import numpy np import os import cv2 pic_num in range(1,100): img = cv2.imread("e:\ele/"+str(pic_num)+'.jpg',cv2.imread_grayscale) resized_image = cv2.resize(img,(100,100)) cv2.imwrite("e:\eye/"+str(pic_num)+'.jpg',resized_image)

emit dataChanged signal PyQt5 -

i not able emit datachanged signal model. under python 3.5.2, pyqt5.9.1. i tried @ least 4 different syntaxes, none of works me: different veiws of model updated when click on them... @pyqtslot() def setdata(self, index: qmodelindex, any, role=none): if role == qtcore.qt.editrole: row = index.row() color = qtgui.qcolor(any) if color.isvalid(): self._datas[row] = color # self.datachanged.emit(index,index) # doesn't work because pyqt5 changed signature # self.datachanged.emit(index, index, []) # doesn't update other views of same model # self.datachanged.emit(index,index,[qtcore.qt.editrole,]) # neither # self.data_changed.emit(index,index) # class method 'data_changed = pyqtsignal(qmodelindex,qmodelindex)', doesn't work return true return false this question how emit datachanged in pyqt5 marked solved, however, not able reproduce edit: verifiable exe...

php - How to insert the value of javascript into html -

this question has answer here: how add 2 days current date value of hidden input 3 answers how insert javascript variables database 1 answer i want javascript value html input value , insert database after user click submit <script> var currentdate = new date(); if (currentdate.getday() == 5) { var numberofdaystoadd = 4; //adding 4 skip sat. & sun. if friday } else { var numberofdaystoadd = 2; //adding 2 days if not friday } currentdate.setdate(currentdate.getdate() + numberofdaystoadd); var dd = currentdate.getdate(); var mm = currentdate.getmonth() + 1; var y = currentdate.getfullyear(); var someformatteddate = y + '-' + mm + '-' + dd; document.getelementbyid("display").innerhtml ...

matplotlib - 3D Points visualization in Python -

Image
i want visualize 3d points in python. used matplotlib toolkit, favorite. below sample code: import pypcd #https://github.com/dimatura/pypcd l = pypcd.pointcloud.from_path('left.pcd') t = pypcd.pointcloud.from_path('target.pcd') import matplotlib.pyplot plt mpl_toolkits.mplot3d import axes3d fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.scatter(t.pc_data['x'], t.pc_data['y'], t.pc_data['z'], c='b') ax.scatter(l.pc_data['x'], l.pc_data['y'], l.pc_data['z'], c='g') plt.show() unfortunately, plot took time load. slow interact also. noticed since number data points huge (approximately 217088), hence not rendering properly. any workaround, please? i had problems large amount of objects in matplotlib, , i'm using glscatterplotitem display multiple dots in 3d space. opengl based display function in pyqtgraph library. rendering time couple of seconds disply ru...

scikit image - What is the meaning of min_distance and min_angle in hough_line_peaks()? -

can explain min_distance , min_angle optional parameters, please ? http://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.hough_line_peaks for min_angle=n, thought check if next angle's line minimum superior n element in theta array being accepted. import numpy np skimage.transform import hough_line,hough_line_peaks iden = np.identity(200) hspace, angles, dists = hough_line(iden,theta=np.linspace(-np.pi/2,np.pi/2,1800)) # 0.1 degree resolution hspace, angles, dists = hough_line_peaks(hspace, angles, dists,min_distance=0,min_angle=20) # 2 degree minimum before accepting new line? print(hspace, angles*180/np.pi, dists) output : [200 126 124] [-44.9749861 -45.27515286 -44.67481934] [ 0.50088496 -0.50088496 1.50265487] the angle array shows i'm getting wrong this. parameter accepts integer, i'm not sure of ... i don't think there wrong function hough_line_peaks() itself. min_angle , min_distance define zone around foun...

android, how to get the value of a spinner? -

this sample app testing. i have mainactivity , secondactivity. spinner on secondactivity, text view on mainactivity display first item on spinner, when select item 2,3, or 4 on spinner , press submit button, still displays first item on drop down list. have 3 textfields spinner, value of textfields gets displayed correctly. here code secondactivity package com.example.example.sample_form; import android.content.intent; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.button; import android.widget.edittext; import android.widget.spinner; import android.widget.toast; public class secondactivity extends appcompatactivity implements adapterview.onitemselectedlistener { button btn2; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_second);...

parsing - How exactly is readsPrec supposed to work? -

i newbie haskell. making read instance of custom type, decimalfp : data integral => decimalfp = decimalfp {infprec :: bool, digits :: a, exp :: a} which used decimal floating-point type specific significant figures. i'm unsure how readsproc works, these issues: 1. why return type list? when this: prelude> readsprec 0 "21345 1223 -5" :: [(int, string)] i expected this: [(21345," 1223 -5"),(1223," -5"),(-5,"")] but actual result just: [(21345," 1223 -5")] so when readsprec return multiple elements? 2. return type seems biased? this works expected: prelude> readsprec 0 "245e-3" :: [(float, string)] it outputs [(0.245,"")] . when this: prelude> readsprec 0 "245e-3" :: [(int, string)] it outputs [] . expected [(245,"e-3")] . why happen? 3. first argument do? i know has operator precedence, exactly? edit: besides, here completed read insta...

node.js - Missing Script: Start, Heroku Deployment Error -

my node.js script unable deployed heroku , error comes in console saying i'm missing start script though have it. package.json { "name": "kash", "version": "1.0.0", "description": "", "main": "app.js", "scripts": { "test": "echo \"error: no test specified\" &amp;&amp; exit 1", "start": "node app.js" }, "author": "", "license": "isc" } app.js var express = require("express"); var request = require("request"); var bodyparser = require("body-parser"); var app = express(); app.use(bodyparser.urlencoded({extended: false})); app.use(bodyparser.json()); app.listen((process.env.port || 5000)); // server index page app.get("/", function (req, res) { res.send("deployed!"); }); // facebook webhook // used verification ...

google spreadsheet - setFormula() in script editor with spaces in sheets referenced by the formula -

when put formula on script editor using setformula() function, formula contains spaces 'abc list'!, shows syntax error when script saved. i saw answers mention putting + till looks '+abc list+'! didnt work (and if did, formula wouldn't work on normal cell). i'm curious - there no way write formulas reference sheets spaces in names in script editor? both of these work: spreadsheetapp.getactive().getsheetbyname('reports').getrange("g14").setformula('\'january 2017\'!a1'); spreadsheetapp.getactive().getsheetbyname('reports').getrange("g15").setformula("'january 2017'!a1");

scene2d - LibGDX - Actor group on scrollable table -

in game want draw 2-column table contains squares (like cards), , on them, 1 image , 2 labels (as row, @ top of card image, below 1 label , below other one). if put images in scrollable table, desired result, i'm trying add image , label on background. i have tried defining actor group , adding table, elements doesn't appear, extending image class , drawing other elements inside ondraw method, text doesn't move card background user scrolls. my table code follows: table scrolltable = new table(); scrolltable.align(align.topleft); scrolltable.add(new highscoreitem(game, colors.orange, "1º:fer", 30)) .width(190).height(150).space(30); scrolltable.add(new highscoreitem(game, colors.orange, "1º:fer", 30)) .width(190).height(150).space(30); scrolltable.row(); scrolltable.add(new highscoreitem(game, colors.orange, "1º:fer", 30)) .width(190).height(150).space(30); scrolltable.add...

python - Nltk classify based on single parameter -

i trying use naivebayesclassifier classify times spent in areas of smart home. my training data looks this: [[{'time': '00:00'}, 'in'], [{'time': '00:01'}, 'in'], [{'time': '00:02'}, 'out'], [{'time': '00:03'}, 'out'], [{'time': '00:04'}, 'out'], [{'time': '00:05'}, 'out'], [{'time': '00:06'}, 'out'], ......, [{'time': '08:06'}, 'in'], [{'time': '08:07'}, 'in'], [{'time': '08:08'}, 'in'], ... ] this code: classifier = nltk.naivebayesclassifier.train(training_data) start_date = datetime.strptime('2010-11-19 00:00', '%y-%m-%d %h:%m') end_date = datetime.strptime('2010-11-19 23:59', '%y-%m-%d %h:%m') test_data = [] while start_date < end_date: test_data.append(dict(time=start_date.strftime('%h:%m...

Angular 2 Cannot use directive form a nested module -

i trying define directive hide elements if user doesn't have claim. after define directive declare in application.module declarations. the problem unable use directive module nested inside of application.module. if use directive inside component 'next' application module works fine, when use directive component inside of nested module not recognized compiler , throws error , if declare directive again compiler throws again because being declared elsewhere. every module uses directive, needs have directive in declarations or have module in imports , has directive in declarations , exports create shared module @ngmodule({ imports: [], declarations: [mydirective], exports: [mydirective], } export class sharedmodule {} and import whereever want use directives or pipes it: @ngmodule({ imports: [sharedmodule], declarations: [], exports: [], } export class nestedmodule {} a directive can in declarations of 1 module. if want use directive...