Posts

Showing posts from September, 2012

javascript - UnitStepSize for regular time interval with Chartjs -

Image
i'm having troubles getting regular 15min time interval chart js graph. here setup of xaxis: xaxes: [{ type: 'time', ticks: { maxrotation: 90, minrotation: 80 }, time: { format: 'hh:mm', tooltipformat: 'hh:mm', unit: 'minute', unitstepsize: 15, displayformats: { 'minute': 'hh:mm', 'hour': 'hh:mm' }, min: 1502521200000, max: 1502553600000 } }] x data timestamps: 1502521200000 incidentally, want data frame start @ 1502521200000 , finish @ 1502553600000 first data point doesn't have label: help jsfiddle: https://jsfiddle.net/tn7ksfb6/ as @rc suggested remove min , max , actual step size working use stepsize instead of unitstepsize let m

playframework 2.0 - Play 2.4 java.lang.RuntimeException: There is no HTTP Context available from here -

i have application. on application start wake akka actor every 24 second. actor iterates through entities within jpa.withtransaction, job , sends email users. the problem within jpa.withtransaction method when calling render method (using render scala template) runtime exception thrown: there no htto context available here [error] - akka.actor.oneforonestrategy - jpa transaction failed 11:50:42 worker.1 | java.lang.runtimeexception: jpa transaction failed 11:50:42 worker.1 | @ play.db.jpa.defaultjpaapi.withtransaction(defaultjpaapi.java:107) ~[play-java-jpa_2.11-2.4.6.jar:2.4.6] 11:50:42 worker.1 | @ play.db.jpa.jpa.withtransaction(jpa.java:148) ~[play-java-jpa_2.11-2.4.6.jar:2.4.6] 11:50:42 worker.1 | @ utils.medicalvalidityactor.onreceive(medicalvalidityactor.java:35) ~[classes/:na] 11:50:42 worker.1 | @ akka.actor.untypedactor$$anonfun$receive$1.applyorelse(untypedactor.scala:167) ~[akka-actor_2.11-2.3.13.jar:na] 11:50:42 worker.1 | @ akka.actor.ac

jquery - javascript slider has a wrong size -

i have slider on page: http://en.expo.b24online.com/news/ js silder is: on document ready: $('#newscarousel').carousel({ interval: 4000 }).on('click', '.list-group li', function() { clickevent = true; $('.list-group li').removeclass('active'); $(this).addclass('active'); }).on('slid.bs.carousel', function(e) { if(!clickevent) { var count = $('.list-group').children().length -1; var current = $('.list-group li.active'); current.removeclass('active').next().addclass('active'); var id = parseint(current.data('slide-to')); if(count == id) { $('.list-group li').first().addclass('active'); } } clickevent = false; }); and on load: var boxheight = $('#newscarousel .carousel-inner').innerheight(); var itemlength = $('#newscarousel .item').length; var triggerheight = math.ro

Is == checking is slower than equals() in Java? -

i understand == checks reference equality , equals checks value equality. i want know if do if(int_value == int_value) if(int_value.equals(int_value)) these notion of actual code; not actual code. in java, 1 computed faster? yesterday 1 of coding solution showed "time exceed" when used == , worked when switched equals. yes matters when using equality checking million times in code. is == checking slower equals() in java? comparing 2 object references of time faster doesn't make sense compare objects in way. 1) compare 2 int (primitive), == operator should favored : int = ...; if(i == 1){ it natural , efficient way. 2) compare 2 integer (object), equals() way should favored: integer = ... integer j = ... if(i.equals(j)){ you have not use == == compare identity of objects , work in range not in , depends on how integer s instantiated. so don't use == in case. 3) compare integer int , equals() way should avoided

Except In Python Doesn't Response If File Doesn't Exist -

i search similar file names & want upload them user. my problem when want use try/except see files exists, if files exists, try & else blocks works correctly if file doesn't exists, doesn't show user text ... problem ? search = str(args[0]) pattern = re.compile('.*%s.*\.pdf' %search, re.i) files in filter(pattern.search, os.listdir('.')): try: requested_file = open(files, 'rb') except ioerror: bot.sendchataction(chat_id, 'typing') bot.sendmessage(chat_id, "this file doesn't exists") else: bot.sendchataction(chat_id, 'typing') bot.sendmessage(chat_id, "the file needed : " + files) bot.sendchataction(chat_id, 'upload_document') bot.senddocument(chat_id, requested_file, files) requested_file.close()

rest - cursor support for cassandra in java -

am writing rest service has cassandra storage. request body have {"offset":100, "startindex":200}. above request need fetch 100 rows starting 200th row. want done in cassandra. did go through setfetchsize , paging in cassandra couldn't make out out of it. below sample code fetching records table public interface cassandraaccessor { @query("select * usertable") result<user> getall(); } getdata method list<user> list = null; try { cassandraaccessor accessor = createaccessor(cassandraaccessor.class); result<user> result = accessor.getall(); list = result.all(); can me modify code meet requirement? in advance

c# - Print stretched when using ReportViewer 10 in windows 8.1 -

i using report viewer in windows forms application generate 1 of paper print source. when running application in windows 7, prints i.e. whatever rendered in report file printed in paper. when running application in windows 8.1, print stretched i.e. fonts stretched in paper print. the application details follows: target framework 3.5 visual studio 2010 reportviewer 10 32 bit program build. to check if issue not @ printer end, printed same font copy word file , printed expected. also, when printing report file, exported file .pdf print dialog , in exported pdf, fonts got stretched. what should resolve issue? regards,

c++ - viewing 3D point cloud by integrating custom C API with generic point cloud viewer -

i have tof (time of flight) camera. depth data camera can obtained in xyz format use of c apis, such given below - xcoordinate = ((int16_t *)xcoordinates)[x + y*xres]; ycoordinate = ((int16_t *)ycoordinates)[x + y*xres]; zcoordinate = ((int16_t *)zcoordinates)[x + y*xres]; i can start infinite while loop keep getting above co-ordinates scene in front of camera. however, visualization purpose 3d point cloud, want use apis provided @ http://pointclouds.org/documentation/tutorials/pcl_visualizer.php my questions therefore following : i able install pcl using precompiled binaries provided here - http://unanancyowen.com/en/pcl18/ . specifically, using vs 2015 (32 bit of course). hence installed pcl-1.8.1rc2-allinone-msvc2017-win32 binary application. using cmake able obtain .sln project sucessfully demo pcl application of cloudviewer (as given here - http://pointclouds.org/documentation/tutorials/cloud_viewer.php#cloud-viewer ). linking errors on compiling .sln project using v

Evaluate a simple Python expression -

i'm experimentig simple things in python , have different result when write same things in 2 different ways. (ord(x) + ^ ord(y[i])) % 255 i want expression equal example 57, since 5 ^ ord(y[5]) = 114 (with i=5 , y[i]='w').i thought since 114+198=312 , 312%255=57 ord(x) should 198, if write on python console: (ord(chr(198)) +5^ord(y[5])) % 255 188. instead if write: (ord(chr(73)) +5^ord(y[5])) % 255 want: 57 am missing somethings obvious here? why way of thinking wrong? working simpler case: >>> 1 + 1 ^ 1 3 if want xor done first, need put parentheses around it, like (ord(x) + (i ^ ord(y[i]))) % 255

Replace string in R with patterns and replacements both vectors -

let's have 2 vectors so: a <- c("this", "is", "test") b <- c("that", "was", "boy") i have string variable so: string <- "this story test" i want replace values in string becomes following: string <- "that story boy" i using loop want vectorized. how should this? if you're open using non-base package, stringi work here: stringi::stri_replace_all_fixed(string, a, b, vectorize_all = false) #[1] "that story boy" note works same way input strings of length > 1. to on safe side, can adapt - similar ruser's answer - check word boundaries before replacing: stri_replace_all_regex(string, paste0("\\b", a, "\\b"), b, vectorize_all = false) this ensure don't accidentally replace his hwas , example.

wercker how to show tests informations in the status badge -

Image
the information can show in github repo build status is there possible way show additional information, test coverage, skipped tests ... ? not @ moment. can add suggestion here

machine learning - Python program running in memory -

i have python program loads logistic regression model. trying make prediction new incoming data every 5 seconds. incoming data passed code command line argument. program runs ok dont want keep loading model every 5 seconds. there way have model loaded in memory? code below loaded_model = joblib.load(r'c:\lr_model.sav') dataset = ast.literal_eval(sys.argv[1]) result = loaded_model.predict(dataset) thank you memory bound process, once process exits it's memory freed. if want keep data loaded, you'll need rewrite program server process , setup communication protocol client ask new prediction (http seems fit here).

bayesian - MCMCglmm pairwise comparisons on interaction in R -

i'm relatively new r , trying figure out go. i'm trying break down interaction term have in mcmcglmm code haven't been able so. i'm aware of way using lme not mcmcglmm. my code following: mcmcglmm(victimmean~gender+year+gc.esttl+disability2+gc.friends+disability2:gc.esttl, random =~school, data = fdnona) (gc.esttl = emotional symptoms) i want pairwise comparison on interaction investigate whether children disability , emotional symptoms more @ risk of victimisation children disability without emotional symptoms. hope that's clear enough! really, appreciate help/advice! thanks in advance.

mongodb - how to run js file in mongo using springs -

i use following code run mongo script in js through spring data scriptoperations scriptops = mongooperation.scriptops(); // execute script directly executablemongoscript echoscript = new executablemongoscript("function(x) { return x; }"); object ob=scriptops.execute(echoscript, "directly execute script"); system.out.println(ob); // register script , call later scriptops.register(new namedmongoscript("runjs", "d:\\gstr3\\gstr3b.1.a.js")); scriptops.call("runjs", "execute script via name"); the "echoscript" run "runjs" gives error: caused by: com.mongodb.commandfailureexception: { "serverused" : "/10.144.113.138:27017" , "ok" : 0.0 , "errmsg" : "referenceerror: runjs not defined :\n_funcs1@:1:24\n" , "code" : 139 , "codename" : "jsinterpreterfailure"} @ com.mongodb.commandresult.getexception(commandresult.java:71) @

android - Sending Arbitrary data with notification style Firebase cloud messaging -

i have short question. want send custom value cloud function listens onwrite events in firebase database. code cloud function: const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeapp(functions.config().firebase); exports.pushnotification = functions.database.ref('/chats/notifications/{pushid}').onwrite( event => { var values = event.data.val(); const payload = { notification: { title: values.username, body: values.message, sound: "default", displayname: values.username, uid: values.recieveruid }, }; const options = { priority: "high" }; return admin.messaging().sendtotopic(values.recieveruid, payload, options);}); and database structure looks this: chats -notifications -some id -username: fdsdf -uid: 9043554 how can send uid device? way in code not work displayname... how supposed it you can pass arbi

excel vba - Rename the newly created sheet based on active cell in Sheet1 -

i newbie @ vba , have problem solve, more simple, sure. here problem: i have table company names in column a. want select cell company name, click button run macro creating new sheet based on template, , rename newly created sheet name of selected cell in sheet1 (company name). the macro works, have problem renaming it. appriciated. comments on code in general useful. here code: sub newsheet() dim wb workbook dim ws worksheet dim activewb workbook dim filepath string application.screenupdating = false application.displayalerts = false on error resume next set wb = application.workbooks.open(filepath) wb.worksheets(1).copy after:=activewb.sheets(activewb.sheets.count) activewb.activate activesheet.name = worksheets("arkusz1").activecell.value wb.close false application.screenupdating = true application.displayalerts = true end sub if need use activecell , can use code below: dim shtname string shtname = activecell.value2 ' <-- save value of ac

express - Node.js read src value from html and get images -

i developing small app (playing around upgrade skills) build static websites using node.js, express , gulp. app consist of pug template engine build html , asset folder, static files resides (images, css, js). the images folder has lot of images init , not using of them. however, want is; to able read in html file (index.html) retrieve path of images fetch images being used asset directory copy images , create structure in destination folder index.html , images zip final output folder of website if possible. below structure of app. |- battlefield |- app |- assets |- images |- views |- html |- index.html |- pug |- index.pug |- dest here gulpfile.js // requiring gulp var gulp = require('gulp'); var sass = require('gulp-sass'); var pug = require('gulp-pug'); var browsersync = require('browser-sync'); var nodemon = require('gulp-nodemon'); gulp.task('hello', func

java - JAXB : Read non-static attributes into a collection -

i write jaxb implementation read/unmarshall below xml. challenge here how read attributes names not defined. in below example, keys can vary a1 an. question is, can use jaxb here? if yes, how write node.java class? <?xml version="1.0"?> <node a1="blabla" a2="xyz" a3="application" a4="dfd" a5="dfd" ... > </node> public class node { //what done here? } you can use @xmlanyattribute : @xmlrootelement public class node { @xmlanyattribute private map<qname,string> attributemap; //getters , setters } source : https://docs.oracle.com/javase/7/docs/api/javax/xml/bind/annotation/xmlanyattribute.html

elasticsearch - Wrong sum with aggregations -

i'm trying run query: get my_index/_search { "size": 0, "query": { "bool": { "filter": [ { "query_string": { "query": "_exists_:products_count", "default_operator": "and" } } ] } }, "aggs": { "pid": { "terms": { "field": "pid", "size": 15, "order": { "products_counter": "asc" } }, "aggs": { "products_counter": { "sum": { "field": "products_count" } } } } } } the results are: { "took": 5, "timed_out": false, "_shards": { "total": 12, "successful": 12, "failed": 0

java - How to make authenticated django rest api call from android client? -

i making android app has django rest api backend , want make authenticated network calls using token given user when he/she has logged in. i using retrofit make requests backend. here doing right attempt make authenticated network call rest api. @override public void loadallusers() { call<list<user>> call = userserviceapi.loadallusers(); call.enqueue(new callback<list<user>>() { @override public void onresponse(@nonnull call<list<user>> call, @nonnull response<list<user>> response) { if (response.issuccessful()) { list<user> users = response.body(); eventbus.post(new loadallusersevent(users)); } else { eventbus.post(new failloadallusersevent()); log.d(tag, response.message()); } } @override public void onfailure(@nonnull call<list<user>> call, @nonnull throwable t) {

c++ - Atmel Studio 7: USART interrupt handler provided by ASF library works once only in case of encountering infinite loop in main()? -

currently, using usart_read_buffer_job function provided asf library. placed function inside while(1) loop below: int main() { pieces of code initialization; while(1) { usart_read_buffer_job(); while(1) // second infinite loop { other pieces of code; } } } it works first interrupt handler call. however, after returning handler, no longer able call interrupt handler. program kept running within second infinite loop , not able execute usart_read_buffer_job() again. cause of handler 's malfunction. in case, purpose jump usart interrupt handler regardless of number of infinite loops being executed in main(). of course, not using asf, issue solved manually set handler still wonder how issue solved other functions provided asf. looking forward getting response community soon. thank you, thanks quick response. the code working on confidentials. hence, share asf library functions , explain briefly how work. in asf, typically, have 2 f

javascript - How to change transition style in a slider from fade to slide -

i've created slideshow put in beggining of website but, new in stuff, i've created connecting snippets i've found in websites, , image transition style fade , want change slide, , don't know how it. can me, please? here slider code: <div class="slider" id="main-slider"> <!-- outermost container element --> <div class="slider-wrapper"> <!-- innermost wrapper element --> <img src="http://lorempixel.com/1024/400/animals" alt="first" class="slide" style="width:100%" /> <!-- slides --> <img src="http://lorempixel.com/1024/400/business" alt="second" class="slide" style="width:100%" /> <img src="http://lorempixel.com/1024/400/city" alt="third" class="slide" style="width:100%" /> <a class="prev" onclick="plusslides(-1)">

Save Image From URL in a Specific Location in Android -

i'm creating app downloads images off internet! images downloaded without problem! problem downloaded in unknown folder,and downloaded images not seen in gallery app! how can download images in specific gallery folder visible in gallery well? in advance! download method: downloadmanager dm = (downloadmanager) getsystemservice(context.download_service); uri uri = uri.parse(url); downloadmanager.request request = new downloadmanager.request(uri); request.setdescription("downloading wallpaper").settitle("downloading"); request.setnotificationvisibility(downloadmanager.request.visibility_visible_notify_completed); mydownloadreference = dm.enqueue(request); toast.maketext(wallpaper.this, "downloading..", toast.length_short).show(); } image url bitmap try { url url = new url("http://...."); bitmap image = bitmapfactory.decodestream(url.openconnection().getinputstream()); } catch

sql server - c#: Error on running the code -

while running code after successful compilation, have error incorrect syntax near keyword 'end'. though code formatted have error. someone, please me rectify problem. code below; using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using system.data.sqlclient; namespace order { public partial class form2 : form { public form2() { initializecomponent(); } sqlconnection abc = new sqlconnection(@"data source=ipc\sqlexpress;initial catalog=nml;integrated security=true"); sqlcommand command = new sqlcommand(); //sqldatareader dataread = new sqldatareader(); private void button1_click(object sender, eventargs e) { abc.open(); command.commandtext = "insert tbl_rec(qcode,warp,ply,blend,tends

directx - DX12 Descriptor Heaps management -

so after watching dx12 binding videos , reading through docs, i'm not 100% sure if understood correctly how manage heaps. let me explain wan't achieve in application: during initialisation, i'll filling 2 heaps, 1 holding samplers , other 1 holding srv, cbv , uav. heaps contain resources application using during life time. now starts interesting part. build root signatures, i'll using part root descriptor tables. as know, table hold ranges, range being base shader slot, number of descriptors , other settings. let me show , example: root parameters 0 - root_table 1 - root_table 0 root_table cbv b1 cbv b6 srv t0 srv t2 1 root_table sampler s1 sampler s4 as shown in example, there can ranges non sequential (for example b0,b1,b2 , b3) but, during command list recording, can do: id3d12descriptorheaps* heaps[2] = {mcbvsrvuavheap,msamplerheap}; mcmdlist->setdescriptorheaps(2,heaps); mcmdlist->setgraphicsrootdescriptortable(0, mcbvsrvuavheapgpuhanlesta

api - How to get twitter accessToken from java? -

i'm creating web application needs details of user's twitter account. how can twitter accesstoken , access twitter api. when searching this, found had create application in twitter developers site dont want @ all. i've created simple web application in java, in need use twitter api. possible??? please me out. generally speaking, stack overflow / stack exchange work best when have specific code question can clarify you. question broad less simple provide direct solution. in order access details of user's twitter account, need use twitter api . twitter uses oauth authentication, you'll need code login flow user accesstoken. need register app twitter on apps.twitter.com in order consumerkey , consumersecret uniquely identify app. since you're using java, might find twitter4j useful library helping this. comes pretty samples should understand you'll need build.

Conditional tag for wordpress archive first page only -

i’m trying place widget on first page of category archive using widget logic wordpress. able place widget in category archive using is_archive(‘category1’) places on archive pages, want widget appear of first archive page. how do this? there query_var can access, 'paged', not set if there 1 page or contains number of current page i cannot test right now, assume should work: //get current page number, default 1 $current_page = get_query_var('paged', 1); if ($current_page == 1){ //your code }

Any simple way to add .profile to ssh? -

i installed node.js nvm , register additional folder executables. adds new path $path variable , , somewhere in 1 of .profile files . so, when log in via ssh manually works, npm available. but, when try execute remote script ssh myhost.com "npm install" it fails npm not found . it happens because when run ssh remotely doesn't load .profile . is there easy way fix it? i.e. somehow tell ssh use same env if log in manually? the .profile loaded login shells explained in manual page bash. can modify command run login shell: ssh myhost.com "bash -l -c 'npm install'"

php - Force the write database connection on Laravel relationships -

i'm using separate read , write connections in laravel app: 'mysql' => [ 'write' => ['host' => env('db_host_write', 'localhost'),], 'read' => ['host' => env('db_host_read', 'localhost'),], 'driver' => 'mysql', 'port' => env('db_port', '3306'), 'database' => env('db_database', 'very'), 'username' => env('db_username', 'secret'), 'password' => env('db_password', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => false, 'engine' => null, ], normally, if i'd force write connection used, i

javascript - Check whether Given number is happy or not -

this code check given number happy number . think trying wrong logic. var num = 5239; var sum = 0; while (num > 0) { sum += math.pow(num % 10, 2); num = math.floor(num / 10); console.log(num) } console.log(sum); if (num == 0) { alert("happy number") } else { alert("not happy number") } please correct me correct result. https://jsfiddle.net/g18tsjjx/1/ if understood happy number is, should correct. $(document).ready(function() { var num = 1; var = 0; (i; < 10000; i++) { num = newnumber(num); } num == 1 ? alert("it's happy number") : alert("it's not happy number"); }); function newnumber(num) { var sum = 0; var temp = 0; while (num != 0) { temp = num % 10; num = (num - temp) / 10; sum += temp * temp; } return sum; }

javascript - When element is 'display:none', how can I upload a image file? -

i'd upload file selenium. page url below. <div class="async-upload__thumb item-image__area"> <div class="fab-dialog__thumb-drop-zone async-upload__thumb-drop-zone"> <p class="async-upload__thumb-msg" display="none">select image</p> <input type="file" accept="image/jpeg,image/gif,image/png" multiple="" style="display:none"> </div> </div> but input element display="none" uploaded file code. driver.findelement(by.xpath("//input[@type='file']")).sendkeys("test.jpg"); i got error this: element not visible , may not interacted command duration or timeout: 24 milliseconds how can upload image file? i not sure work or not, can remove style attribute. webelement element = driver.findelement(by.xpath("//input[@type='file']")) javascriptexecutor js = (javascriptexecutor)driver;

javascript - Datatables Bootstrap theme not applying when using ReactJS -

i new requirejs, please gentle! below link html , js , if run see datatable initialized correctly not applying bootstrap theme. link problem: https://jsfiddle.net/sajjansarkar/c2f7s2jz/2/ what doing wrong? below js (in case fiddle doesnt work): requirejs.config({ paths: { 'jquery': 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery', 'bootstrap': 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min', 'datatables': 'https://cdn.datatables.net/v/bs/dt-1.10.12/b-1.2.2/b-colvis-1.2.2/b-html5-1.2.2/cr-1.3.2/fh-3.1.2/kt-2.1.3/r-2.1.0/sc-1.4.2/se-1.2.0/datatables.min', }, shim: { 'bootstrap': { deps: ['jquery'] }, 'datatables': ['jquery', 'bootstrap'], } }); require([ 'jquery', 'bootstrap', , 'datatables' ], function($, bootstrap, datatables) { 'use strict'; $('#example').datat

c# - Automapper map source to dest with custom object -

how can map: object: ( class cashcasedto { string caseid {get;set;} double casetotalamount {get;set; } to: public class cashcase { public string id { get; set; } } public class cashcasedifference { public decimal amount { get; set; } } i have problem mapping amount difference.amount . what should use? custom value resolver or converter? this conversion supported default in latest version.

vba - Windows("ETY Tracker V1.2.xlsm").ScreenUpdating = False -

could please solve problem facing,when run program throwing me error "object dosen't support property or method" private sub workbook_open() 'application.visible = false 'application.screenupdating = false windows("ety tracker v1.2.xlsm").screenupdating = false userform1.show end sub please help...i tried both application .visible close active workbooks have, , application.screenupdating not allow me edit or open other sheet other present user form. are trying hide workbook , show form? private sub workbook_open() thisworkbook.windows(1).visible = false userform1.show end sub or hide excel , show form? won't close workbooks - they're inside application in hidden. private sub workbook_open() application.visible = false userform1.show end sub

ios - this class is not key value coding-compliant for the key UserEmailAdresLogin -

this question has answer here: what mean? “'nsunknownkeyexception', reason: … class not key value coding-compliant key x” 63 answers back @ again noob question. for reason following error: 2017-07-25 14:29:00.589401+0200 yiives[1416:534883] *** terminating app due uncaught exception 'nsunknownkeyexception', reason: '[ setvalue:forundefinedkey:]: class not key value coding-compliant key useremailadreslogin.' now way green see problem on own, please enlighten me. it not let me load login view. how can make happen :d i run following code: import uikit class loginviewcontroller: uiviewcontroller { @iboutlet weak var backgroundbutton: uibutton! @iboutlet weak var useremailadresinput: uitextfield! @iboutlet weak var userpasswordinput: uitextfield! @iboutlet weak var userlogin: uibutton! @iboutlet weak var userfo

AND-OR conditions in firebase query Javascript -

couldn't found answers on google docs neither on stack, have ask this. how hit query or condition in firebase servers. basically, want check if specific chat conversation exist in database. chat can have 2 types of ids (steveandjacob or jacobandsteve), how can check if either 1 of them exist in db? here code have wrote. var currentuserid = localstorage.getitem('currentuserid'); var chatid = currentuserid+''+anotheruserid; var chatid2 = anotheruserid+''+currentuserid; var ref = firebase.database().ref('messages/conv').orderbychild('chatid').equalto(chatid); ref.on('value', function(snapshot) { if (snapshot.exists()) alert ("exist"); else alert ("not exist"); }); how done?

c - NEON: Optimize code -

i playing arm neon , have written following functions, 1 in c, 1 neon intrinsics compare speeds. functions compare 2 arrays. parameter cb number of bytes divided 8: inline uint32_t is_not_zero(uint32x4_t v) { uint32x2_t tmp = vorr_u32(vget_low_u32(v), vget_high_u32(v)); return vget_lane_u32(vpmax_u32(tmp, tmp), 0); } uint32_t sum_neon(const uint8_t *s1, const uint8_t *s2, uint32_t cb) { const uint32_t *s1_cmp = (uint32_t *)s1; const uint32_t *s2_cmp = (uint32_t *)s2; cb *= 2; while (cb--) { uint32x4x2_t cmp1 = vld2q_u32(s1_cmp); uint32x4x2_t cmp2 = vld2q_u32(s2_cmp); uint32x4_t res1 = vceqq_u32(cmp1.val[0], cmp2.val[0]); uint32x4_t res2 = vceqq_u32(cmp1.val[1], cmp2.val[1]); if (!is_not_zero(res1)) return 1; if (!is_not_zero(res2)) return 1; s1_cmp += 8; s2_cmp += 8; } return

angular - Angular2 DateTime parse error -

i want create fields such create date, update date, etc. but when these dates shown, minute 0-9, shows hh:2:ss should logically hh:02:ss . inside file came me network tab; network tab - incoming data want this frontend display format; frontend layout <div style="display:flex;"> <span class="editlabel form-control">{{ 'created_at' }} :</span> <div class="form-addcontrol form-control"> {{data.created_at | date:"dd.mm.yyyy hh:mm:ss"}}</div> </div> i did research, nobody mentioned it. glad if me. in advance.. you need convert "data.created_at" date format , can use datepipe 1.replace symbol split time , date ("t"). 2.parse numbers in array. 3.create date new date(year,mouth,day,hours,mins,seconds) . 4.use datepipe.

wordpress - Custom taxonomy and Custom post type error on class-wp-post-type.php -

with custom taxonomy, in local work correctly when try on domain-test see error message: invalid argument supplied foreach() in domainsite/wp-includes/class-wp-post-type.php on line 634 the 634 code line reffered error this: /** * registers taxonomies post type. * * @since 4.6.0 * @access public */ public function register_taxonomies() { foreach ( $this->taxonomies $taxonomy ) { register_taxonomy_for_object_type( $taxonomy, $this->name ); } } i search solution or workaround didn't find problem. this taxonomy registration : function tipiricetta_taxonomy() { $labels = array( 'name' => 'tipiricette', 'singular_name' => 'tipiricetta', 'menu_name' => 'tipo ricetta', 'all_items' => 'tutti tipi ricetta', 'parent_item' => 'genitore tipo ricetta&

jquery - How to two have a field in my pop up editor which is not my grid -

in kendo grid popup editor in need 2 have drop down list mix of(concat somehow) 2 fields in grid,so how can have that?in following want have drop down list shows(model & producer) in pop editor, @ time of saving each part should seat in field $("#turbingrid").kendogrid({ // debugger; datasource: datasource, scrollable: false, columns: [ { field: 'deviceip', title: 'deviceip', width: '100px', id: 'deviceip' }, { field: 'producer', title: 'producer', width: '80px', editor: productnamedropdowneditor, }, { field: 'model', title: 'model', width: '220px' }, { field: 'devicetype', title: 'devicetype', width: '100px',editor: devicetypeslist }, { field: 'description', title: 'description', width: '220px' }, { field: 'username', title: &#

hibernate - Jhipster upgrade -

in our organization have several jhipster generated projects, done version 3.0.0 , haven't upgraded them since. i've been working on upgrading 1 of them past 5 days, please find breakdown below: i have tried 3 different approaches: 1.- use jhipster:upgrade tool steps: this process break down several steps such as: 1.- creating local npm folder able install generators different jhipster versions no persmission issues 2.- erasing old installations of yo , jhipster 3.- cloning project , creating dev branches 4.- erase .jhipster folder entities not affected upgrade 5.- once upgrade code runs, need tweak several files/dependencies mvn clean/install works complications after applying these steps, find 2nd level cache hibernate refuses work, asking me include classes in cache, try several fixes/workarounds such as: 1.- deleting liquibase project 2.- configuring databaseconfiguration.java old settings , downloading old versions of libraries

html - javascript get scroll of child div -

i have structure this: <div> <div id="scrollid" style="height:100px;"> content here </div> </div> <script> document.getelementbyid("mydiv").addeventlistener("touchstart", myfunction); function myfunction() { // want position } </script> i want distance top, when user start scrolling (actually touching in mobile). final purose implementing pull refresh child div . any idea? try following. <div> <div id="scrollid" style="height:100px;" onscroll="myfunction();"> content here </div> </div> <script> document.getelementbyid("mydiv").addeventlistener("touchstart", myfunction); function myfunction() { document.getelementbyid("scrollid").scrolltop; // want position } </script>