Posts

Showing posts from June, 2010

visual studio 2013 - Display stored procedure result with Crytal Reports -

Image
i'm trying display results of stored procedure using crystal reports in visual studio 2013. feel should simple, i'm having trouble cross tab showing correctly. literally want returned result set (basically list of users , data, grouped user). thanks!

R - Extract factor predictor names from caret and glmnet lasso model object -

in below example, set df 3 variables, predict, var1, , var2 (a factor). when run model in caret or glmnet, factor converted dummy variable, such var2b. i'd extract variable names programmatically , match original variable names, not dummy variable names -- there way this? this example, real world problem has many variables many different levels , therefore, want avoid doing manually, trying substring out "b". thanks! library(caret) library(glmnet) df <- data.frame(predict = c('y','y','n','y','n','y','y','n','y','n'), var1 = c(1,2,5,1,6,7,3,4,5,6), var2 = c('a','a','b','b','a','a','a','b','b','a')) str(df) # 'data.frame': 10 obs. of 3 variables: # $ predict: factor w/ 2 levels "n","y": 2 2 1 2 1 2 2 1 2 1 # $ var1 : num 1 2 5 1 6 7 3 4 5 6 # $ var2 ...

javascript - Error 404 on static ressources whith parameters on get request -

i'm doing biomedical website node.js , encounter problem: in app.js (server file), have these code app.get('/disease/:orphanetid', function(req, res) { var orphanetid=req.params.orphanetid; res.render('pages/disease.ejs', {activetitle: "views"}); }); the problem static ressources needed in disease.ejs error 404. for example code in disease.ejs: <script src="static/js/domscripts.js"></script> in chrome console, see: (red cross) http://localhost:8080/disease/static/js/domscripts.js the thing is, static ressource @ http://localhost:8080/static/js/domscripts.js , there's string "disease" in url appeared... it's not url! and after testing stuff, figured out code working: app.get('/disease', function(req, res) { //var orphanetid=req.params.orphanetid; res.render('pages/disease.ejs', {activetitle: "views"}); }); so if don't have parameter, it's working, need it. f...

java - How to export JPA entity to xml file when using Hibernate -

given have application persistence layer managed jpa , hibernate, how can export arbitrary entity xml file? i know jaxb, seems more related eclipselink. if possible use hibernate jaxb, how can setup jaxb context hibernate metadata information? is there other way how achieve it?

php - How can I query on 3 tables using has-many-through relationship in Laravel 5.4 -

i have searched many posts still confused. don't wanna use double query access info . i'm following example works on getting result without condition wanna apply condition on village table\model detailed below: tables\models detail province: id, name .... district: id, name, province_id .... village: id, name, status, district_id .... edit province has many district . (one-to-many relationship) district has many villages . (one-to-many relationship) here my question how province can access village info using has-many-through relationship on following criteria, select village data district_id =some_value , status =some_value. note: might suggest best. thanks in advance it assumed have these tables provinces -id -name districts -id -name -province_id villages -id -name -district_id -status class province extends model { public function villages(){ return $this->hasmanythrough(...

Angularjs stripping out query string -

i have route defined as application.component('myapp', { template: '<ng-outlet></ng-outlet>', $routeconfig: [ {path: '/person', name: 'person', component: 'person', useasdefault: true}, ], bindings: {$router: '<'} }); whenever go localhost3000/person?eye=blue redirects localhost:3000/person . how angular maintain query string? add preservequeryparams in route config.

javascript - How to preserve values between pages using knckout? -

i building web app using asp .net mvc , knockout user can add/remove items shopping cart. there 2 pages, homepage shows special offers, , second shows offers model behind same. in each page can bind values page controls if user adds item cart other parts automatically updated. problem lose data when change page. there anyway in knockout can keep these changes between pages. best bet far has been store data on server , retrieve server again when go new page. hope can :) i chose take @matt.kaaj approach working now. quote here: it best practice store added item in database whenever add item cat .you can use browser's cookies or local storage not can rely on. – matt.kaaj

Pentaho: Kettle/Spoon: Combining multiple data after inserts -

Image
i'm using pentaho's kettle/spoon load customer. can't figure out how join 2 or more transformations after they're complete source / | \ | b \ | / insert data (database alpha) source data id, name, ssn, email, cancall, emailstatus (database beta) a) inserts email status table if doesn't exist returns id b) inserts pii table if doesn't exist returns id insert data emailstatustable 1, can_email 2, can_not_email pii table 1, "johnson, john", "todays_date" 2, "jackson, jillian", "todays_date" customertable 1, 1 (pii table id), "jjohnson@blah.com", true (can call), 1 (email status table id) 2, 2 (pii table id), "jill_jack@home.com", false (can call), 2 (email status table id) i can't figure out how make "insert data" portion work. please. combination lookup/update step solve problem easily

Azure Media Services Encoding Job Callback to URL -

using rest api, able upload file azure media services local machine , start encoding job. need poll job status see when done. but, want azure media services send request callback url when done. there way this? take @ our notifications features supports webhooks. https://docs.microsoft.com/en-us/azure/media-services/media-services-dotnet-check-job-progress-with-webhooks it integrates azure functions - if want host callback in azure functions , leverage webhook trigger in there. have examples of doing here: https://github.com/azure-samples/media-services-dotnet-functions-integration/tree/master/101-notify-webhooks

vue.js - Rails Vuejs Webpacker: Passing instance variable data -

i trying learn how build app rails 5.1 vuejs, generated via webpacker gem. $ rails new myvueapp --webpack=vue how pass instance variable data forth between vue components, data in/out of database? let's example have user model username , email fields. there simple example of how pass instance variable, @user, data controller component? i believe there 2 ways this: (1) in controller, has render :json => @user , use fetch api or axios retrieve data in .vue component. -or- (2) use example <%= javascript_pack_tag 'hello_vue' %> <%= content_tag ... %> in view. when <%= javascript_pack_tag 'hello_vue' %> example, can see "hello vue!" data in component "message" variable, having trouble finding example of instance variable data, eg: @user data, being passed in , out of rails. any examples of how pass @user data appreciated. thank you. i'm not 100% sure trying accomplish, can think of 2 way...

How do I change raw Axis2 message? -

i able implement logic modify inbound http/https messages before message axiom parsed. example may want replace instances of string "replaceme" space in inbound xml. i may want restrict when logic executed - service type, message type or may want system-wide. how go this? many thanks.

javascript - How do I get TestScheduler to tick in RxJs5? -

i'm trying write sample unit test observable.interval in rxjs version 5. i'm running following code, observable fires once, not 20 times, anticipated. it('does interval thing synchonously', ()=> { let x = []; let scheduler = new rx.testscheduler(); let interval$ = rx.observable.interval(500, scheduler).take(20); interval$.subscribe( value => { x.push(value); console.log(value) }, ); for(let = 0; < 20; i++) { scheduler.flush(); } expect(x.length).tobe(20); }); how make testscheduler move observable forward 10000 milliseconds? my understanding testscheduler intended used marble testing , works observables composed returned createcoldobservable , createhotobservable methods. instead, use virtualtimescheduler - upon testscheduler based: let scheduler = new rx.virtualtimescheduler(); let interv...

bash - Abnormal termination of GNU Octave script -

on i686 / 32-bit dual cpu, fresh debian stretch installation, i've installed octave 4.2.1 , run ./mytest after providing execution privileges: #!/bin/bash ./mytest.m where test.m reads #!/usr/bin/octave exit(0) the result is: terminate called after throwing instance of 'octave::exit_exception' panic: aborted -- stopping myself... attempting save variables 'octave-workspace'.. save 'octave-workspace' complete octave exited signal 6 but program intended exit normally. same result replacing exit quit , terminates correctly when starting $ octave -q --no-gui , > quit . what's wrong here? update: in meanwhile, showed up: http://savannah.gnu.org/bugs/?49271 , question be: can non-octave configuration solve problem? (confirmed: octave 4.0.0 not reproduce error.)

uitableview - Update values stored in random generated keys in Firebase - Swift -

Image
currently trying update many values of alarms such label, time, repeateddays, etc. in app, once user creates alarm displayed in tableview. once click alarm on tableview, should able edit values. of works in ui part, in firebase when save edits have done alarm, new alarm object created. values alarm updated once edited(and saved), instead of adding new alarm. below structure in firebase of app: here snippet of code show have tried do: override func prepare(for segue: uistoryboardsegue, sender: any?) { if segue.identifier == "save" { var alarmrefkey = alarmref.key //the unique alarm key let displayalarms = segue.destination as! displayalarms //unwind segue destination if alarm != nil {//alarm object, if there alarm, can edit print("there alarm.") let timeformatter = dateformatter() timeformatter.timestyle = dateformatter.style.short timepicker.ad...

python - How can I scrape videos from a YouTube search? -

i want search specific keyword , scrape videos urls. i know code paste not going that, want show have done. chrome_path = r"c:\users\admin\documents\chromedriver\chromedriver.exe" driver = webdriver.chrome(chrome_path) driver.get("https://www.youtube.com/results?sp=caisaggbubq%253d&q=minecraft") links = driver.find_elements_by_partial_link_text('/watch') link in links: links = (links.get_attribute("href")) how can scrape links , save them file? here code gives title , url of video light , easy :) from bs4 import beautifulsoup import urllib.request def searchvid(search): responce = urllib.request.urlopen('https://www.youtube.com/results?search_query='+search) soup = beautifulsoup(responce) divs = soup.find_all("div", { "class" : "yt-lockup-content"}) in divs: href= i.find('a', href=true) print(href.text, "\nhttps://www.youtube....

sql - Using a range filter in a greatest-n-per-group subquery has very poor performance -

i've got simple query (being used subquery in greatest-n-per-group situation). state_id primary key - else non-unique. select max(states.state_id) max_state_id states states.created >= '2017-06-10 21:53:38.977455' , states.created < '2017-06-26 07:00:00' group states.entity_id; the problem is, query horrifically slow, , don't believe order of multicolumn index can solve way it's written. ends using where; using index; using temporary; using filesort in case it's not clear: we're trying here latest state_id each entity_id between 2 timestamps. we instead max(states.created) (rather max(states.state_id) ) better anyway, don't have state_id outer query join on. here's full query including outer part give full context: select states.state_id states_state_id, states.domain states_domain, states.entity_id states_entity_id, states.state states_state, states.attributes states_attributes, states.event_id states_event_id,...

python - How to create a dictionary where the keys are the elements in a list and the values are numbers from 1 to n? -

let's have list l1 = [a,b,c,d,e] , want map dictionary contain following {a:1, b:2, c:3, d:4, e:5} i know how in naive way, more 'pythonic' the naive way: dic = {} j = 1 in list1: dic[i] = j j += 1 how using dictionary comprehension: >>> {v: k k, v in enumerate(l1, 1)} {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}

arrays - Ajax DATA changes sorting -

im doing ajax call wordpress site. works perfect except order (sort) of data coming out success function. if print_r ($service) validate correct custom order want but after send using: (php file) public function closest_services() { global $wpdb; $servicios_repetidos = $_post['servicios_repetidos']; $lat = $_post['latitud']; $lng = $_post['longitud']; $categoria = array(); $unit = $_post['unit']; $distancia = $_post['radius']; if ( $unit == 'km' ) { $earth_radius = 6371.009 / 1.609344 ; } elseif ( $unit == 'mi' ) { $earth_radius = 3958.761; } $sql = $wpdb->prepare( " select distinct p.id service_id, p.post_title service_title, map_lat.meta_value loclat, map_lng.meta_value loclong, %f * 2 * asin(sqrt( power(sin(( %f - map_lat.meta_value ) * pi()/180 / 2), 2) + co...

android - How to save the image automatically when using camera intent from my app? -

when using camera intent app opening camera after clicking asks save image when click image using mobile camera app saves automatically. using camera intent opens same inbuild camera app why thid dual behaviour? also how make camera save image automatically when using camera intent app try this @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); //get image camera if (requestcode == camera_click_result && resultcode == result_ok) { dialog2.dismiss(); bitmap photo = null; try { photo = mediastore.images.media.getbitmap( getcontentresolver(), imageuri); } catch (ioexception e) { e.printstacktrace(); } selectedimage = getresizedbitmap(photo, 900) try { //write file filename = "your file name.extension"; file fi...

javascript - how can i get my local variable in loop to change global variable in node js using express framework ?? -

i have object array results parallel asynchronus callback, next process want insert objact array results table using looping for, dont handle status insert. var boolean = false; if(results.code.success === true){ for(i=0; i<req.body.id_barang.length; i++){ detail[i] = { "id_transaksi" : results.code.id_transaksi, "id_barang" : req.body.id_barang[i], "qty" : req.body.qty[i], "sub_total" : parseint(req.body.sub_total[i].replace(/,.*|\d/g,''),10) } connection.query("insert detail_transaksi set ? ", detail[i], function(err, rows){ if(err){ null } else{ boolean = true; } }) } } var output = {"success" : boolean} res.send(output); to expand on jfriend00's answer, function(err, rows) callback function execute once query resolved. meanwhile, rather waiting query resolve, var output = {...

python - I want to use scrapy just download .jpg picture -

i have question want down load .jpg image. used follow code found still download .png or .gif picture. can me ? #coding:utf-8 scrapy.spiders import spider scrapy.selector import selector jianshu.items import jianshuitem import scrapy scrapy.crawler import crawlerprocess class jiansider(spider): name = "jiantu" allowed_domains = [] start_urls= [ "https://tieba.baidu.com/p/5227563995" ] def parse(self, response): sel = selector(response) sites = sel.xpath('//div/img/@src').extract() item = jianshuitem() item['image_url'] = response.xpath('//div/img/@src').extract() url in item['image_url']: list_photo = url.split('.') photo_type = list_photo[len(list_photo)-1] print photo_type if photo_type != 'jpg': #print url item['image_url'].remove(url) ...

classpath - How to create a Scala presentation compiler inside Ammonite REPL? -

i want create scala presentation compiler in ammonite repl, got error of missing dependency 'object scala in compiler mirror' . i have tried workaround mentioned in object scala in compiler mirror not found - running scala compiler programatically . unfortunately not work. how make work? welcome ammonite repl 1.0.0 (scala 2.12.2 java 1.8.0_131) if ammonite, please support our development @ www.patreon.com/lihaoyi @ import scala.tools.nsc.settings import scala.tools.nsc.settings @ import scala.tools.nsc.interactive.global import scala.tools.nsc.interactive.global @ import scala.tools.nsc.reporters.consolereporter import scala.tools.nsc.reporters.consolereporter @ val settings = new settings() settings: settings = settings { -d = . } @ settings.usejavacp.value = true @ val reporter = new consolereporter(settings) reporter: consolereporter = scala.tools.nsc.reporters.consolereporter@4a24170b @ val compiler = new global(settings, reporter) error: error while l...

python - IN Query not working for Amazon DynamoDB -

Image
i check retrieve items have attribute value present in list of value provide. below query have searching. unfortunately response return empty list of items. don't understand why case , know correct query. def search(self, src_words, translations): entries = [] query_src_words = [word.decode("utf-8") word in src_words] params = { "tablename": self.table, "filterexpression": "src_word in (:src_words) , src_language = :src_language , target_language = :target_language", "expressionattributevalues": { ":src_words": {"ss": query_src_words}, ":src_language": {"s": config["source_language"]}, ":target_language": {"s": config["target_language"]} } } page_iterator = self.paginator.paginate(**params) page in page_iterator: entry in page["items"]: entries.appen...

keras - What‘s wrong with my loss function? The loss is nan as soon as I start training -

i using keras, , loss funtion below. shape of y_true , y_pred suppose (,15,15,8,5). last 5 x,y,w,h,conf of box. hope can me. thanks! the output while training like: 8/1666 [..............................] - eta: 1662s - loss: nan - acc: 0.8994 the loss function is: def custom_loss(y_true, y_pred): ### adjust predictions # adjust x , y pred_box_xy = tf.sigmoid(y_pred[:, :, :, :, :2]) # adjust w , h pred_box_wh = tf.exp(y_pred[:, :, :, :, 2:4]) * np.reshape(anchors, [1, 1, 1, box, 2]) pred_box_wh = tf.sqrt(pred_box_wh / np.reshape([float(s_grid), float(s_grid)], [1, 1, 1, 1, 2])) # adjust confidence pred_box_conf = tf.expand_dims(tf.sigmoid(y_pred[:, :, :, :, 4]), -1) y_pred = tf.concat([pred_box_xy, pred_box_wh, pred_box_conf], 4) ### adjust ground truth # adjust x , y center_xy = 0.5 * (y_true[:, :, :, :, 0:2] + y_true[:, :, :, :, 2:4]) center_xy = center_xy / np.reshape([(float(w_image) / s_grid), (float(w_image) / s_grid)], [1, 1, 1, 1, 2]) true_box_xy = center_xy - t...

python - Tracks gotten from user are different from tracks searched -

i having problems soundcloud's api. put, track objects should identically returned api not. tracks received client.get('tracks', q='some search') different tracks received client.get('users/%s/tracks % some_user.id) . tracks received search (first example) have attribute of likes_count whereas second example not. another thing noted favoritings_count of search returned track 0. value of same parameter, returned user gotten track 26. this last 1 not know if intended, values of favoritings_count user track different values of likes_count of searched track. here question itself: problem api or python wrapper? there workaround? thanks in advance. here simple test code made show these differences: import soundcloud client_id = 'your_id' client = soundcloud.client(client_id=client_id) user = client.get('users', q='mrjw', limit=1)[0] user_track = client.get('users/%s/tracks' % user.id, limit=1)[0] print('...

css - In Atom, how do I style the line that shows in between tabs when a tab is grabbed? -

Image
i having hardest time trying figure out how style line. i know class called is-drop-target can't scroll through list of styles figure out styles applied properties because cursor holding tab class show , scrolling not allowed when cursor holding something. i've tried properties background-color , border-color , color none of them worked. i've tried pseudo-elements ::before , ::after neither of worked either. any suggestions appreciated. thanks! edit: using ui theme named seti-ui . https://atom.io/themes/seti-ui the class name line when dragging tabs around named placeholder . try code below see mean. .placeholder { background-color: yellow !important; }

javascript - gulp-rev generating new file name for same code base -

working on codebase has used yeoman angular generator (1.4.x) . gulp-rev getting used , it's generating new file (hash) name every single time same code base, how can keep same file hash? here's main task that's building (i suppose), gulp.task('html', ['inject', 'partials'], function () { var partialsinjectfile = gulp.src(path.join(conf.paths.tmp, '/partials/templatecachehtml.js'), { read: false }); var partialsinjectoptions = { starttag: '<!-- inject:partials -->', ignorepath: path.join(conf.paths.tmp, '/partials'), addrootslash: false }; var htmlfilter = $.filter('*.html', { restore: true }); var jsfilter = $.filter('**/*.js', { restore: true }); var cssfilter = $.filter('**/*.css', { restore: true }); return gulp.src(path.join(conf.paths.tmp, '/serve/*.html')) .pipe($.inject(partialsinjectfile, partialsinjectoptions)) .pipe($.useref()) ...

javascript - Passing dynamic styles to my element in VueJS -

i trying make type of progress bar track percentage of tasks completed. want v-bind:styles , pass {width: dynamicwidth + '%'} in order control progression of bar. far have created computed variable return percentage complete want bar display, , have set dynamic style in data object export default{ data: function () { return { numquotes: databus.numquotes, numbera: 30, barwidth: { width: this.barwidthcalculated +'%' } } }, computed: { barwidthcalculated: function(){ return this.numquotes * 10; } } } i added element dom see happening. <div id="trackerbar"> <div id="trackerbaractual" v-bind:style="barwidth"> <h2>{{numquotes}}/10</h2> <p>{{barwidthcalculated}}</p> </div> </div> my bar stays fixed @ 100%, dont see interpolation on dom. establishe...

node.js - nvm-windows: not able to run globally installed software -

i have installed different version of node using nvm on windows 7. using node v8.0.0. installed express globally npm install -g express but when try create new app using express testapp , following error message: 'express' not recognized internal or extenal command. this problem globally installed node modules. got it! have install express-generator , give express command

javascript - How to write a function with an Observable? -

i want create function returns observable .the description of function follows: the function should delayedalert(message:string, time:number) returns observable . the function should contain settimeout function inside delayedalert prints message after set ' time ' value. ex: delayedalert(message, time){ return new observable//how implement settimeout function here? use observable.create create observable, , in first callback, write logic populate observable, in case settimeout . function delayedalert(msg, time) { return observable.create( observer => settimeout(() => observer.onnext(msg), time)); } then use it: delayedalert("hi, sally", 1000).subscribe(msg => alert(msg)); however, if using observables, don't need use settimeout ; use delay instead, applied of , creates observable individual value(s): function delayedalert(msg, time) { return observable.of(msg).delay(time); } since it's easy write way, do...

python - Django - No display on browser after deployment on ubuntu server -

i have deployed django project in our personal ubuntu server using apache2 , mod-wsgi. unable display on browser. shows "error" @ corner of page. please suggest if doing wrong. my settings.py: import os # build paths inside project this: os.path.join(base_dir, ...) base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) secret_key = 'blah blah blah' # security warning: don't run debug turned on in production! debug = true allowed_hosts = [] admins = ( 'surajitmishra@gmail.com', ) # application definition installed_apps = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'mod_wsgi.server', 'publications', '....', 'crispy_forms', 'widget_tweaks', ] logging = { 'version': ...

java - HTTP Status 500 - Servlet.init() for servlet spring threw exception here is my code -

controller,service , dao in different package userser interface , userservice class on package com.service userda interface , userdao class on package com.dao , controller on package com.controller please me , if doing on same package working different package not working thankyou @controller public class usercontroller { @autowired public userser userser; @requestmapping(value="/get") public void dummytest() { system.out.println(userser.sayhii()); } } @service("userser") public class userservice implements userser{ @autowired public userda userda; public string sayhii() { return userda.say(); } } @repository("userda") public class userdao implements userda { public string say() { return "hiiiiiiiiiiiii"; } } web.xml * <servlet> <servlet-name>spring</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servl...

cgi - source command not working when used in Perl script -

consider below code: #!/usr/bin/perl use strict; use warnings; $value="export pi = 3.14"; open(in,">>/root/.bashrc"); print in $value; close(in); `source /root/.bashrc`; i want create env variable using perl script. i've given 777 permissions root folder .bashrc file. $value in script getting appended .bashrc when use "env " or "printenv" display env variables, cant see 1 appended .bashrc.i guess source command not working, because when source .bashrc file cl showing in env list.please me out or suggest way.thanks in advance. the backticks start subshell process source executed. , subshell exit , perl script not effected. have tried $env{pi}=3.14;? alter environment of running perl script , afterwards created subprocesses. use strict ; use warnings ; $env{test} = 'yo.' ; $subshelled = qx!echo \$test! ; chomp $subshelled ; printf "subshelled result: '%s'\n" , $subshelled ; $subshell...

c++ - why mqtt packets are not getting subscribed after a long time using mosquitto? -

we using mosquitto library in cpp. did establish connection is: mosqpp::lib_init(); connect_async(host,port, keepalive); loop_start(); then publish , subscribe worked fine long time, after while packets queued , not published. how overcome issue?

html - how find file name in a server source using php -

i have link.when clicking on link pdf file downloaded. trying save file folder. static name getting saved,but want save actual name,is possible? if knows please me. sample url:- http://www.intercoat.de/index.php?option=com_jdownloads&itemid=206&task=finish&cid=341&catid=178&lang=en am attaching code below. have array of links above sample link fetching array foreach($li $lm) { $i++; $file_info = new finfo(fileinfo_mime_type); $mime_type = $file_info->buffer(file_get_contents($lm)); if($mime_type=='application/pdf') { echo $lm.$i.'<br>'; $filecontent = file_get_contents($lm); file_put_contents('./uploads/myfile'.$i.'.pdf', $filecontent); } } now files not saving exact name,it saves myfile1,myfile2 ..etc cant take base name because file name not in url.that urls source of file. knows please help try this foreach($li $lm) { $i++; ...

rethinkdb update query with nested array of objects -

below structure i've been working. criteria want update status of nodename present in node2 in single query. "nodelist": [ { "nodename": "node1", "status": "not ready" }, { "nodename": "node2", "status": "ready" }, { "nodename": "node3", "status": "ready" } ] appreciate help!! try query:- r.db("your_database").table("your_table_name") .get('id') .update({ nodelist: r.row('nodelist').map(function (newstatus) { return r.branch( newstatus('nodename').eq('field_value'), newstatus.merge({status: 'new value'}),newstatus) }) });

c++ - Dynamically allocating array of a custom class and overloading operators -

the last couple of days i've been trying figure out how make dynamically allocated array of class made. 1 of them includes class made here classes: template<typename t> class bst // binary search tree class { private: node<t> * root; int size; public: bst() { root = null; size = 0; } /*void * bst::operator new[](size_t a) //tried both "bst::" , without { void * p = malloc(a);//24 return p; }*/ //there more functions cut out } and template <typename t> class node //a node binary search tree { public: int key; t data; node * left; node * right; node * parent; //public: node<t>() { key = null; data = null; left = null; right = null; parent = null; } //more stuff below it's getting , setting data } in main() i'll try make array of bst objects line: bst<char> * t = new bst<char>[ n ]; ...

bash - How to send a html file using mails in shell script? -

Image
i want store matrix's data in html file , send email in outlook ,my code looks follows: printf "<!doctype html>" printf "<html>" printf "<head>" printf "<style>" printf "</style>" printf "</head>" printf "<body>" printf "<table>" printf "<tr>" printf "<th>total</th>" printf "<th>stillfail</th>" printf "<th>pass</th>" printf "<th>scripterror</th>" printf "<th>apiname</th>" printf "</tr>" printf "<tr>" echo ((j=1;j<=num_rows;j++)) printf "<tr>" ((i=1;i<=num_columns;i++)) printf "<td>" printf "${matrix[$j,$i]}" printf "...

c# - ASPxGridView DeleteRow not deleting on another control callback -

i'm using devexpress's gridview , have code deletes selected gridview row control's customcallback, the line gridfrom.deleterow(int.parse(rowkey[2])); retrieves correct visibleindex not remove row gridview. databind not refreshes gridview's data , requires refreshing of page data update protected void aspxtreelist1_customcallback(object sender, devexpress.web.aspxtreelist.treelistcustomcallbackeventargs e) { string[] rowkey = e.argument.split('|'); string strconnectionstring = configurationmanager.connectionstrings["dbname"].connectionstring; using (sqlconnection conn = new sqlconnection(strconnectionstring)) { string query = "delete table id=@id"; using (sqlcommand cmd = new sqlcommand(query, conn)) { conn.open(); cmd.parameters.addwithvalue("@id", rowkey[0]); cmd.executenonquery(); ...

android - How to know when service is started after calling startService() method to send otto event? -

i have alarmreceiver( brodcastreceiver ) starts downloadservice( service ) after check if service not running state context.startdownloadserviceifnotrunning()// kotlin extension function check service state after line sending otto event started service busstation.getbus().post(downloadevent()) // line fired before start of service but download service not receiving event registerd event. after debugging have found otto event firing before service starts therefore not receiving event so there way know when android service started receive events otto you can add parameter intent. how use parameters, not otto? intent serviceintent = new intent(this,downloadservice.class); serviceintent.putextra("key", "value"); startservice(serviceintent); and, onstart of service, can use parameters. @override public void onstart(intent intent, int startid) { super.onstart(intent, startid); bundle extras = intent.getextras(); if(extras ...

angularjs - How node module include in Core angular project -

i working in angular 1.5 , need integrate module in project project in core angular , module in npm need add files in project you can use in project npm install <package_name> or if you're using bower can like bower install <package_name>

amazon web services - AWS outbound rule for ECS hosts in VPC -

i'm trying setup ecs hosts outbound rules not allow whole world, similar this issue . ideal way point directly nat-gateway according amazon , not possible: note security groups cannot directly associated nat gateway. instead, customers can use ec2 instance security groups outbound rules control authorized network destinations or leverage network acl associated nat gateway’s subnet implement subnet-level controls on nat gateway traffic. how setup proxy or acl ecs hosts? this reference architecture should helpful you, contains cloudformation template automatically sets you, can learn configuration containers: https://github.com/awslabs/ecs-refarch-cloudformation

oracle - Container database -

Image
i'm kind of new oracle databases. when i'm create database there option called : create container database i'm not sure mean can explain please? "someone explain in few lines make less confusing " have heard of docker? it's oracle databases. you you're starting out. advice ignore pluggable containers , start learning oracle sql. when can read documentation without being confused should have @ containers. containers highly neat, chargeable enterprise license not many organizations use them right now. not knowing containers isn't of hindrance.

vue.js - VueJS Filter Not Working -

why filter not work? error says: [vue warn]: failed resolve filter: uppercase. not sure why filter not working. also, best way code functionality? there ways this, or suggested ways? i'm not sure using $refs, maybe can simpler, effective use of reusable components. i'm trying emulate ajax response using random message , status instead. link: jsbin <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>js bin</title> </head> <body> <div id="app"> <login-alert ref="refalert"></login-alert> <p> <button @click="showme">random alert</button> </p> </div> <script src=" https://unpkg.com/vue"></script> <template id="template-alert"> <div v-if="showalert"> <d...

Firebase Rest API Streaming error: Connection gets closed when child has huge data in it -

i trying stream firebase rest api: i have around 500mb of data in firebase path, when initiate stream connection it, first wait 2min , end closing connection response pasted below. request: curl -lv -x -h "accept: text/event-stream" https://{url} -o backup.txt after trying 5 times, have received these response: response: data requested exceeds maximum size can accessed single request. response: { "error" : "internal server error." } my question not how download data, how add stream listener child in firebase database has huge data in it. when add listener path mentioned in request, close connection because of previous data present, how achieve this? the error data requested exceeds maximum size can accessed single request suggest cannot perform request trying because large. you need split multiple requests , join them afterwards.

javascript - SignalR client not firing server code -

Image
i testing signal basic string. client side not firing server code , there no error. added [hubname("myhub1")] , [hubmethodname("getvaluestring")] in because if not javascript complaint client undefine , methodname not found. after added 2 meta in. there no error server code not fire. please. client script (function () { // defining connection server hub. debugger var myhub = $.connection.myhub1; // setting logging true can see whats happening in browser console log. [optional] $.connection.hub.logging = true; // start hub $.connection.hub.start(); // client method being called inside myhub constructor method every 3 seconds myhub.client.getvaluestring = function (servertime) { // set received servertime in span show in browser $("#newtime").html(servertime); }; }()); server script [hubname("myhub1")] public class myhub1 : hub { public void hello() { clients...

mysql - ActiveRecord::ConnectionNotEstablished and load_missing_constant:NameError: uninitialized constant Rails::Railtie -

i've spent better part of 2 days on this, , things keep getting broken. started when added couple environment variables .zshrc file, , installations of rails stopped working, after removed env variables. rails getting confused find gems? ruby: 1.8.7 rails: 2.3.16 database adapter: mysql update think i've solved it. case of missing gems required (not sure ones exactly) took care of both rail. issue required letter_opener gem, required me use specific_install (0.2.3, not 0.3.3, looks uses different ruby). (what nightmare!) when load console, warning: ~/.rvm/gems/ruby-1.8.7-head/gems/activesupport-2.3.16/lib/active_support/dependencies.rb:466:in 'load_missing_constant':nameerror: uninitialized constant rails::railtie even though console loads, if try retrieve activerecord object e.g. user.last, activerecord::connectionnotestablished exception. furthermore: >> activerecord::base.configurations => {} the database.yml file fine because pulled st...

multithreading - F# update list in multiple threads at same time -

i new f# maybe solution can clear someone, can not find it. imagine game world of world chunks (similar minecraft), more players. in theory language c++, java, or c# can modify multiple chunks of world @ same time. 2 or more players try place or remove block in different chunks , these actions can change state of world without affecting each other long no more 1 action in each chunk happening. serializing happen when multiple players in 1 chunk perform modification. my understanding of f# need serialize these actions on global level , no 2 actions can happen in same time in entire world, because update function need actual world state update params(like add/remove blok) , return new world state . example world state contains chunk list . is there way world update in parallel? can world state stored differently allow update multiple chunks @ same time? it sounds need ensure each chunk has 1 action run @ time. can protect pieces of state storing them inside mai...

angular - Angular2 multiple emitted events from any action on page -

everyone. started learn angular2 time ago , lately i've confronted issue can't understand solve properly. here component: have cut out excess code simpler @component({ moduleid: module.id.tostring(), selector: "editor-group", providers: [], template: ` <div class="section-box" > <div *ngfor="let attr of attrlist" > <editor-block [structure]="opts" ></editor-block> </div> </div> ` }) export class editorgroup implements oninit { attrlist: string[]; opts: = csseditordpy[1]; constructor(private editorservice: editorservice, private _contextservice: contextservice) {} ngoninit() { this.attrlist = ['option1']; } } here have variable "opts" set data check working, transferring child component . so, hard coded case working expected , no magic happens, when i'm trying d...

x86 - How to print the length of a string in assembly -

i learning assembly using following hello world program section .text global _start ;must declared linker (ld) _start: ;tells linker entry point mov edx,len ;message length mov ecx,msg ;message write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data msg db 'hello, world!', 0xa ;our string len equ $ - msg ;length of our string the original question had meant length of string. mean number of chars or length in memory (number of bytes)? check wanted print variable len. how can that? naively tried define new variable len2 equ $ - len and instead run mov edx,len2 ;message length mov ecx,len ;message write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80...