Posts

Showing posts from April, 2011

python - How can I change User_AGENT in scrapy spider? -

i wrote spider ip http://ip.42.pl/raw via proxy. first spider. want change user_agent. got information tutorial http://blog.privatenode.in/torifying-scrapy-project-on-ubuntu i completed steps tutorial , code. settings.py bot_name = 'checkip' spider_modules = ['checkip.spiders'] newspider_module = 'checkip.spiders' user_agent_list = ['mozilla/5.0 (iphone; cpu iphone os 5_1 mac os x) applewebkit/534.46 (khtml, gecko) version/5.1 mobile/9b179 safari/7534.48.3', 'mozilla/5.0 (linux; u; android 4.0.3; ko-kr; lg-l160l build/iml74k) applewebkit/534.30 (khtml, gecko) version/4.0 mobile safari/534.30', 'mozilla/5.0 (linux; u; android 4.0.3; de-ch; htc sensation build/iml74k) applewebkit/534.30 (khtml, gecko) version/4.0 mobile safari/534.30', 'mozilla/5.0 (linux; u; android 2.3; en-us) applewebkit/999+ (khtml, gecko) safari/999.9', 'mozilla/5.0 (linux; u; android 2.3.5; zh-cn; htc_incredibles_s710e build/grj90) applewebki...

swift - Can you extend an enum? -

i use enums store string values this: enum animals: string { case desccat = "i has attitude" case descdog = "how can help" case descgator = "i eat you" var s: string { { return self.rawvalue string } } } then access them this: print("dogs like:" + animals.descdog.s) my question can extend enums other struct or object don't have add var s: string {} property each enum? you want add property enums raw value string? sounds case constrained protocol extensions! extension rawrepresentable rawvalue == string { var description: string { return rawvalue } } this works because enums raw value automatically conform rawrepresentable protocol, , said protocol has associated type rawvalue tells type raw value is. now animals enum automatically inherit it: print(animals.desccat.description) // -> "i has attitude...

android - adding swipe inside onBindViewHolder RecyclerView -

hey guys im trying use swipe inside onbindviewholder because items database think doesnt seem work cuz app crashing. im using custom cursor adapter recyclerview https://gist.github.com/skyfishjy/443b7448f59be978bc59 here code. @override public void onbindviewholder(itemviewholder viewholder, cursor cursor) { mitems = cursor; final int id = cursor.getint(cursor.getcolumnindex(mydbhandler.column_id)); final string title = cursor.getstring(cursor.getcolumnindex(mydbhandler.column_title_reminder)); final string desc = cursor.getstring(cursor.getcolumnindex(mydbhandler.column_desc_reminder)); final string date = cursor.getstring(cursor.getcolumnindex(mydbhandler.column_date_reminder)); viewholder.title.settext(title); viewholder.itemview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { toast.maketext(context, string.valueof(id),...

php - Using grpc in Laravel, "Class 'Grpc\ChannelCredentials' not found." -

i trying use grpc in laravel project. this part of composer.json file: "require": { ... "datto/protobuf-php": "dev-master", "google/auth": "^0.7.0", "grpc/grpc": "dev-release-0_13", ... } i have generated php file proto file. placed in app/services/ , included in composer.json autoload.files section. have run composer install without issues. i have created route testing. has following code: $client = new vat_service\vatserviceclient('localhost:50051', [ 'credentials' => grpc\channelcredentials::createinsecure() ]); but receive response class 'grpc\channelcredentials' not found. when visit route. the laravel app running in homestead vagrant box. i don't know how proceed. missing dependency? did miss install something? i have solved problem, not sure of below steps solution. things tried: i installed grpc-beta in homestead box (...

c# - genrate json from mvc 5 asp.net controller -

my action in controller in entity t_panier (means shopping cart) contains object product contains list of carts(panires): public actionresult indexvm() { int iduser = 0; iduser = (int)session["iduser"]; ienumerable<t_panier> p = panser.getallproducts(iduser).asenumerable(); return json(p, jsonrequestbehavior.allowget); } i error : server error in '/' application . circular reference detected while serializing object of type 'system.data.entity.dynamicproxies.t_product_8a57351fb72b09de03561c95af908fe99ebff074229bdc8c61d7917d53f43a28'. t_panier : public class t_panier { public int id { get; set; } public int qu { get; set; } public double total { get; set; } public nullable<int> customer_id { get; set; } public nullable<int> product_fk { get; set; } public virtual t_customer customer { get; set; } public virtual t_product product { get; set; } } t_product : ...

asp.net web api - Unable to generate Elmah.axd file of Elmah logging with Web API -

i have created web api only. in want use elmah logging. have installed nuget package of it. when try access elmah.axd file browser gives me error : 404 not found. , file not generated. have followed this link. do need additional generate/access file? i'm author of tutorial have linked to. created new web api project , installed elmah. /elmah.axd available. interested in seeing web.config if can update question that? also, can try validate web.config using elmah configuration validator here: https://elmah.io/tools/configvalidator

matlab - Animating a surf plot -

i've been tasked animating 3d helical flux tube in matlab , i'm unsure of how so. the animation experience i've had plotting 2d trajectories of 9 solar system planetary orbits, used following code (where z 27 column matrix columns ordered in sequence x,y,z 9 times represent 9 planets) % plot 9 empty plots p = plot3(nan(9), nan(9), nan(9)); k = 1:size(z, 1) % update of plot objects @ once set(p, {'xdata'}, num2cell(z(1:k, 1:3:25), 1).', ... {'ydata'}, num2cell(z(1:k, 2:3:26), 1).', ... {'zdata'}, num2cell(z(1:k, 3:3:27), 1).') drawnow end so, intuitively, have tried adapt helical flux tube have follows (where x, y , z 21 x 301 matrices , assume @ each time step must surf rows of x,y , z accordingly required time step): p = surf(nan(21,301), nan(21,301), nan(21,301)); k = 1:size(x,1) % update of plot objects @ once set(p, {'xdata'}, num2cell(x(1:k, :), [1 301]), ... ...

Using the edge weight for force directed layout (CoSE) in cytoscape.js -

i not sure how best utilize edge weight (e.g. strength of interaction between 2 interacting proteins) while generating force directed layout using cose plugin in cytoscape.js. provide pointers. should "idealedgelength" or "edgeelasticity"? (edit) following figure showing (a) , trying achieve (b). below parameters used generating layout. thanks, datta. ps: click view figure showing current (labelled "a") , expected (labelled "b") layouts. following layout options "a". var options = { name: 'cose', // called on `layoutready` ready: function () { }, // called on `layoutstop` stop: function () { }, // whether animate while running layout animate: true, // number of iterations between consecutive screen positions update (0 -> updated on end) refresh: 20, // whether fit network view after when done fit: true, // paddin...

algorithm - C++ Vector elements' index -

#include <iostream> #include <vector> int main() { std::vector<int> v = {1, 2, 3, 4}; } is there efficient way push "4" 1's place , push every other element next index. vector's element order {4, 1, 2, 3} instead. have thought of few ways, wondering if there elegant , more efficient way it. thanks in advance! this looks tailor-made std::rotate: std::rotate(v.begin(), v.begin()+3, v.end());

strip caffe's logging message from my own c++ program -

i making own c++ classification program using caffe library. want hide logging messages during caffe's model initialization step. according disable glog's "log(info)" logging , disable of logs setting environment variable glog_minloglevel=2 from command line. but, want remove logs executable itself, user can not turn on logs resetting glog_minloglevel value. i find way strip glog's logging message on compile time http://rpg.ifi.uzh.ch/docs/glog.html . says can remove logs this: > #define google_strip_log 1 // must go before #include! > #include <glog/logging.h> since application uses caffe's c++ library, needed rebuild caffe library adding following option add_definitions(-dgoogle_strip_log=2) caffe's cmakelists.txt. compile successful, when ran application new caffe library, stops segmentation fault error during model initialization step. bit more detailed error message running gdb this: program received sign...

SQL Server and MS Access database active on the same host computer -

is possible have both active on same computer , available users? i'm asking because have make c# application using sql server client has 1 available computer host sql server , machine has ms access database running on it. thanks access utilizes file-based database system, has no server components running, unlike sql server. can utilize both on same machine.

json - Transforming JSONArray string to Java POJO -

i trying fiddle objectmapper's properties achieve following, did dot find way till now context : we've following classes class x { : } class c { private string c1; private string c2; private list<x> c3; } input : string represents jsonarray. ex : "[ {..}, {..} ]" output : java class 'c' c1, c2 set null , c3 set input i not want transform input json string first , create instance of c myself , set c3 manually. can deserialize input json string described above

c# 4.0 - NHibernate queryover how to apply date isbetween without including the from and todate -

i trying write nhibernate queryover select records has been deleted between 2 dates. using isbetween().and(). how write if dont want include both fromdate , todate? here query: public ienumerable<deletedrecord> search( datetime deletedfrom, datetime deletedto ) { deletedrecord delalias = null; var query = session.queryover(() => delalias); query.where(() => delalias.deleteddate.isbetween(deletedfrom).and(deletedto)); return query.future<deletedrecord>(); } can me how achieve can bring records after deletedfrom date , before deletedto date? thanks just construct date in 2 steps: var query = session.queryover(() => delalias); if(youneedfromdate) //first step query = query.where(() => delalias.deleteddate >= deletedfrom); if(youneedtodate) //second step query = query.where(() => delalias.deleteddate <= deletedto); youneedfromdate , youneedtodate bool variables can pass function or different co...

model view controller - Maximum size Exceeded exception while uploading mp4 file to web api in mvc -

i trying upload mp4 format file web api rest sharp.but every time gives me maximum file size exceeded exception.i put <security> <requestfiltering> <requestlimits maxallowedcontentlength="1073741824" /> </requestfiltering> </security> this code in web api application web config file no result. calling web api other application in use nuget restshap call web api.please me. code call web api. var request = new restrequest("uploads", method.post); request.addfile("filename", server.mappath("/images/videoplayback.mp4"), "multipart/form-data"); request.addqueryparameter("participantsid", "2"); request.addqueryparameter("taskid", "77"); request.addqueryparameter("enteredansweroptionid", "235"); request.addqueryparameter("lat", "12.15"); request.addqueryparameter(...

php - file_get_contents does not find file -

the following code tries load file content string. // loads forecast json public function loadforecast() { try { $filename = "../../forecast/forecast.json"; echo "dateiname: '" . $filename . "'\n"; echo "pfad: '" . realpath($filename) . "'\n"; if ($forecastcontent = file_get_contents($filename) !== false) { echo "got content"; } else { echo "no content"; } } catch (exception $e) { echo "caught exception: " . $e->getmessage(); } } can tell me fault? i'm getting "no content". realpath print "" (empty string). my webspace hierachie is / backend my php file forecast forecast.json you have many ../ in path. need go 1 level common ancestor of backend ...

jquery - Change ruby variable in javascript -

this jquery obtain id in dropdown. $(document).ready(function(){ $('#installationsdropdown1 li a').on('click', function(){ id = $(this).html(); }); }); </script> <div class="ibox-content graph"> <%= high_chart('main-graph', @highcharts[id]) %> </div> how can pass dynamic variable id ruby code in view? you cannot pass variables javascript code ruby code. if understood correctly, have 2 choices: make ajax call when user clicks on link. call render "high_chart" method in div. you'll have create action, , js.erb view. : $("ibox-content.graph").html("<%= high_chart('main-graph', @highchart) %>"); your @highchart variable instantiated in controller using parameter send ajax call (your id instance). another method preload charts in ruby when page loaded. manage in js 1 want show.

vi - Vim: set 'cursor' keys hjkl to wasd also in normal and insert mode -

i have asked question here should add .vimrc map alt + a "h"; alt + s "j" , on. solution adding following .vimrc : noremap <esc>a h noremap <esc>s j noremap <esc>w k noremap <esc>d l now, problem is, solution not work in insert mode (but works in normal mode ). using imap results typing h,j,k,l, iunmap results error. how set .vimrc make alt + wasd works hjkl "cursor keys" in insert mode ? to make work in insert mode add .vimrc inoremap <esc>a <left> inoremap <esc>d <right> inoremap <esc>w <up> inoremap <esc>s <down> you have careful though, because may conflict other commands when you're switching out of insert mode. when instance want delete line you're editing, <esc>dd , these keybindings add d after next character.

javascript - How can I match first letter of every word except words in braces with Regex -

i've been trying forever. can match first letter of every word, can't exclude words in braces. for example: i can't (do) this, please (help) me. so should match - i , c , t , p , m - only. using \b\w matches first letters of word, doesn't exclude words in braces. i've tried negative lookahead, seems can't properly: (?!\(()\))\b\w also i've got problem unicodes. using (?:^| )[a-z]{1} or \b\w matches latin letters , have different unicodes, example: i (someone) ვიღაც. and in situation regex match i , a , s , not ვ . thanks different things considered. first need define letters can non-latin ones. see answer , comments . match letter let's use [\u00c0-\u1fff\u2c00-\ud7ff\w] as want in javascript, regex limited. word boundary \b cannot used not match specified letter range. lookbehind not available. need use negated class of specified letter. (?:^|[^'\u00c0-\u1fff\u2c00-\ud7ff\w-]) "word boundary...

boolean - jq - How to select objects where a field is 'false'? -

i'm having trouble implementing boolean checks jq. if have field "test" can boolean true or false, how use select find this? initially tried following: jq '.[] | select(.test=="false")' but think comparing strings here not work. the json boolean values true , false , drop quotation marks, e.g. select(.test == false) .

c# - How to tell if Task has been "observed"? -

this follow-up this question . i've read stephen toub's "tasks , unhandled exceptions" , think understand how tasks , exceptions work , "observed task" means. i cannot figure out how tell if task has been observed or not. possible @ without using reflection? i'd borrow @noseratio's code example: static async void observe(task task) { await task; } // ... var taskobserved = false; var task = dosomething() try { bool ready = await dosomethingelse(); if (!ready) return null; var value = await dothirdthing(); // depends on dosomethingelse taskobserved = true; return value + await task; } { if (!taskobserved) observe(task); } if tell whether task had been observed, made simpler , more readable: static async void observe(task task) { if (!task.wasobserved) await task; } // ... var task = dosomething() try { bool ready = await dosomethingelse(); if (!...

r - How to deal with spaces in variables when using factor()? -

i'm trying melt , factor csv table looks this: name l.i a.g.a.o.p e.ngo s.g.a.o.p l 29 7 19 5 1 21 g o p 7 5 5 3 0 1 e ngo 19 5 15 3 0 10 s g o p 5 3 3 19 5 18 1 0 0 5 0 3 21 1 10 18 3 12 with code: mylevels <- table$name table.m <- melt(table) table.m$name <- factor(table.m$name,levels=mylevels) table.m$variable <- factor(table.m$variable, levels=mylevels) the last factoring produces this: name variable value 1 l <na> 15 2 g o p <na> 3 3 e ngo <na> 6 4 s g or p <na> -11 5 <na> -4 6 <na> -2 7 l <na> 3 8 g o p <na> 4 9 e ngo <na> 1 10 s g o p <na> -2 11 academia <na> ...

javascript - webrtc ice_server never registeres as ice candidate -

i building webrtc client using turn , stun server. working if turning of firewall. when breakpoint on ice candidate function see ice servers not added ice candidate. this code: var rtc_configuration = { iceservers: [ {urls: "stun:numb.viagenie.ca"}, {urls: "turn:numb.viagenie.ca", username: "username", credential: "credential", credentialtype: "password"} ], bundlepolicy: "balanced", icetransportpolicy: "all", rtcpmuxpolicy: "negotiate", icecandidatepoolsize: 20, certificates: [] }; var peer_connection = new rtc_peer_connection(rtc_configuration); peer_connection.onicecandidate = pc_on_ice_candidate; but when breakpoint on onicecandidate funtion, default candidates added, , not ice servers in configuration. using last version of firefox. does have suggestion? i think issue because turn server...

c++ - Synchronization of 2 threads, how to? -

i trying develop c++ software has 1 thread controller (say controller) , 8 other threads (child threads) send/recv via tcp/ip. my software operated in loops: at beginning, child threads run in unlimited loop, in loop wait start signal controller. if awake signal controller, send/recv process. after signalling, controller wait stop signals child threads. after finishing send/recv, each of them send stop signal controller. if controller receive enough stop signals (8 stop signals of 8 child threads). copy data, start process again (next loop). for purpose, start software @ basic step: controller thread , 1 child thread, , child thread not anything. (i move on if works fine): in other words, controller send start signal child thread while child thread waiting it. right after receiving start signal, child thread sends stop signal. i execute software 1000 times first, works well, no, freezes usually. i wondering why happens. for better explanation, please refer code:...

Python quiz, using tkinter -

from tkinter import * import tkinter tk q = 0 s = -1 count = 0 correct = 0 incorrect = 0 question = ["is quiz","are sure","dont be","see not quiz"] answer = ["yes","yes","ok","ok"] answer_cap = ["yes","yes","ok","ok"] root = tk() name = tk.label(root,text = "gui quiz") name.pack() label = tk.label(root,text = question[0]) label.pack() entry = tk.entry(root) entry.pack() def out(): global q,correct,incorrect,s,count count = count + 1 ans = entry.get() print (ans) print (question[q]) print (answer[q]) if count < 4: if answer[q] or answer_cap[q] == ans : q = q + 1 entry.delete(0, end) correct = correct + 1 label.config(text = question[q]) else: q = q + 1 entry.delete(0, end) incorrect = incorrect + 1 ...

C++ to C# Code Conversion Types -

i trying convert following c# not getting expected results. c++ code: dword ccskw::getcs(cstring strfile) { try { cfile file(strfile, cfile::moderead); word wtemp = 0; word wcs = 0; const uint uimaxcharread = 2000; tchar c[uimaxcharread]; uint uicharread; #ifdef _unicode while(uicharread = file.read(c, uimaxcharread)) { for(uint i=0; < uicharread; i++) wcs ^= c[0]; } #else while(uicharread = file.read(c, uimaxcharread)) { for(uint i=0; < uicharread-1; i++) { wtemp = c[i]; i++; wtemp <<= 8; wtemp += c[i]; wcs ^= wtemp; } } #endif file.close(); return (dword)wcs; } catch(cfileexception *e) { e->r...

exception handling - Java , i keep getting StringIndexOutOfboundsException -

this supposed isolate names , scores , calculate average of scores. output should this: student name test 1 test 2 test 3 final average susan smith 76 78 90 100 88.80 susan boyd 100 88 79 88 88.60 alex chandler 88 99 77 66 79.20 but keeps throwing stringindexoutofboundsexception. why? this error: java.lang.stringindexoutofboundsexception: string index out of range: 0 @ java.lang.string.charat(string.java:646) @ calcweightedaverage.extractname(calcweightedaverage.java:49) @ calcweightedaverage.main(calcweightedaverage.java:30) here code: import java.util.*; //import java.util scanner import java.io.*;// import java io printwriter /** * class takes input file scores , outputs scores weighted average * * @author * @version 10/30/2015 */ public class calcweightedaverage { /** * method akes input file scores , out...

dataframe - R : understanding simplified script with brackets or hooks? -

i understand how works script : y <- y[keep, , keep.lib.sizes=false] in : keep <- rowsums(cpm(y)>1) >= 3 y <- y[keep, , keep.lib.sizes=false] i know d.f[a,b] can not find r-doc d.f[a, ,b] . i tried "brackets", "hooks", "commas"... :-( (sometimes prefer 1 not simplifie r script !) thanks in advance. subscripting data.frames takes 2 values: df[rows, columns] . third value optional arguments can use subscript. the common of drop=false in df[1:18, 3, drop = false] . done because when subset 1 column of data.frame, lose data.frame class. in specific case, seems using object looks data.frame added functionalities bioconductor package. @ methods tell how these work.

java - How to configure SonarQube 5.3 to tune what submodule / package is used to determinate coverage? -

i'm using sonarqube 5.3 , working mavenized java project containing 3 submodules. one of submodule webapp there not junit test, remove coverage % shown on main sonar page. also if possible, exclude package other submodule, entity package ... didn't find clear answer, tried add in webapp pom.xml : <sonar.coverage.exclusions>src/main</sonar.coverage.exclusions> but no luck. set through ui in administration > general settings > analysis scope > code coverage section

Rails: Where should I put this method? -

i have multiple models in application different types of content, , need whichever 1 published. @ moment, i'm using helper_method :latest_content in application controller. is best place put method? if so, how should write rspec tests it? sounds have common functionality across multiple models. rails has concerns allow that. # app/models/concerns/searchable.rb module searchable extend activesupport::concern module classmethods def last_content # ... here whatever content of :last_content end end end # app/models/model_x.rb class modelx < activerecord::base include searchable ... end # app/models/model_y.rb class modely < activerecord::base include searchable ... end

neo4j - Cypher LinkedList Match by index but "Don't know how to compare that." instead -

i having trouble match index , hoping can help. related discussion can found @ post: cypher linked list: how unshift , replace index first run following unshift query 3 times in order populate linked list relationships , nodes match (p {id: '123a'}) optional match (p)-[r:foo]->(c) p, r, collect(c) cs merge (cnew { id:'456b' // , '789c' , 'wxyz' }) create (p)-[rnew:foo { isfavorite:false, isopen:false, currenttab:'all', currentdate:2015-10-30t07:00:00.000z }]->(cnew) foreach (x in cs | create (cnew)-[:foo { isfavorite:r.isfavorite, isopen:r.isopen, currenttab:r.currenttab, currentdate:r.currentdate }]->(x) delete r) return p, rnew, cnew afterwords can fetch output query can see have 3 elements in linkedlist array under relationship label foo match ()-[r:`language-arts_allresources`]->() return r isfavorite false isopen false currenttab currentdate 2015-...

python - How to control size of widgets in Qt/PyQt/PySide grid layout -

i struck foolish annoying question. set different sizes 2 list widgets on grid layout, 1 above other. so, set 60% of form space upper widget , 40% lower widget. attempted use setrowstretch, without success. here code: import sys pyqt4.qtcore import * pyqt4.qtgui import * def window(): app = qapplication(sys.argv) win = qwidget() list1 = qlistview() list2 = qlistview() grid = qgridlayout() grid.setrowstretch(6, 4) grid.addwidget(list1) grid.setspacing(2) grid.addwidget(list2) win.setlayout(grid) win.setgeometry(300, 150, 350, 300) win.setwindowtitle("example") win.show() sys.exit(app.exec_()) if __name__ == '__main__': window() thanks assistance can provide. the first parameter of rowstretch method row number, second stretch factor. need 2 calls rowstretch , this: import sys pyqt4.qtcore import * pyqt4.qtgui import * def window(): app = qapplication(sys.argv) win = qwidget() ...

How to allow users to edit dynamic slim page templates in production for rails 4? -

essentially i'm trying implement way users can edit slim stored in database. for example use form create new page , insert html page in text field saved in database. want allow them edit page in slim. way html stored slim not plain html. if store slim in database how rails render html on client side in production? in other words rails automatically since view being render so: views/page/view.html.slim page.header page.content page.footer or have figure out way convert on fly? might making more complicated should i'm new if understand correctly want convert slim html , output in views. this directly slims doc. how processes slim files , outputs it. tilt.new['template.slim'].render(scope) slim::template.new('template.slim', optional_option_hash).render(scope) slim::template.new(optional_option_hash) { source }.render(scope) so in short slim::template.new(page/view.html.slim).render put in module make prettier , think you...

(Ruby) how to insert a pair into an array -

i have 2d array have name , slug of each school in database, pairs. want start array off empty , add each school one-by-one it. this have tried: <% schoolselect = [] %> <% @schools.each { |x| schoolselect += [x.name, x.slug] } %> however, adds name , slug of school array in session, instead of two-dimensional. use << instead of += : schoolselect = [] @schools.each { |x| schoolselect << [x.name, x.slug] } or better use ruby idiom map : schoolselect = @schools.map { |s| [s.name, s.slug] } this works, because map returns array.

qt - QCompleter for large models -

qcompleter works slow on large data sets (large models): when start input characters in qcombobox passes few seconds show auto-complete popup variants, when input 2nd char qcompleter not react on key press few seconds well. next characters works fine. model size 100k records. possible improve qcompleter performance or show popup after 2nd or 3rd input symbol? there examples? solution appears similar this: https://stackoverflow.com/a/33404207/630169 qcompleter uses qlistview in popup() . full solution speed-up qcombobox is: tweak combo: void comboboxtools::tweak(qcombobox *combo) { // performance reasons use policy on large models // or adjusttominimumcontentslengthwithicon combo->setsizeadjustpolicy(qcombobox::adjusttominimumcontentslength); // improve combobox view performance tweak((qlistview *)combo->view()); // improve combobox completer performance tweak(combo->completer()); } tweak dropdown/popup (view): void comboboxtools::t...

javascript - uikit, emberjs, and the { -

i trying use uikit theme of emberjs project. finding attributes uikit require { , } don't seem work. example button drop down requires: data-uk-dropdown="{mode:'click'}" but doesn't work when rendered in emberjs. if take {mode:'click'} off, works fine hover know js working. do need escape it? , let me know!

iphone - iOS App rejected iTunes 17.2 clause -

i've had app rejected due 17.2 clause 17.2: apps require users share personal information, such email address , date of birth, in order function rejected my app requires users create user account before able use app. data in app tied specific user. rather create custom login, seemed simple enough users signup facebook "one-click" account creation instead of having fill out new account form. used facebook graph sdk ios accomplish this. however, did not use other features facebook sdk , result of doing so, app rejected. have couple of uncertainties hoping answered. can implement custom create account without risk of getting app rejected? custom create account require fields such username, email, , account password. i read somewhere in order apple approve custom account creation, app must have sort of privacy policy. true? what classify "significant" use of facebook services justify use of facebook authentication? using features such share faceb...

multithreading - Java: notify() vs. notifyAll() all over again -

if 1 googles "difference between notify() , notifyall() " lot of explanations pop (leaving apart javadoc paragraphs). boils down number of waiting threads being waken up: 1 in notify() , in notifyall() . however (if understand difference between these methods right), 1 thread selected further monitor acquisition; in first case 1 selected vm, in second case 1 selected system thread scheduler. exact selection procedures both of them (in general case) not known programmer. what's useful difference between notify() , notifyall() then? missing something? simply put, depends on why threads waiting notified. want tell 1 of waiting threads happened, or want tell of them @ same time? in cases, waiting threads can take useful action once wait finishes. example set of threads waiting task finish; once task has finished, waiting threads can continue business. in such case use notifyall() wake waiting threads @ same time. another case, example mutually exclu...

Search through all levels of a PHP array -

apologies if duplicate question, i'm not familiar exact terminology i'm trying achieve i've been unsuccessful in searching answer far. i'm pretty green stuff, , following has come through trial , error - not because i'm under illusions it's right. here's i'm trying achieve: using textarea, clients enter custom opening times (one per line): day (name), date, status (open or closed), opening time, closing time. example: 'christmas day,2016-12-25,closed' or 'boxing day,2016-12-26,open,8:00,17:00'. this textarea content split array new line, , split again comma. using these arrays, search whether date today's date and, if is, show more content arrays (like opening time particular day), or - if there's no match - display regular opening hours (already set elsewhere). what i've got far (note i've retrieved $custom_dates variable content): $array = array(); $array = preg_split('/\r/', $custom_dates); /* sp...

angularjs - Load data from helpers before ng-class renders -

i'm working on project using meteor , angularjs. i retrieve data using helpers, , used ng-repeat show them. i'm using checklist-model ( http://vitalets.github.io/checklist-model/ ) list of checkbox choices. <li ng-repeat="t in types"> <div ng-class="nametagclass(t)">{{t.name}}</div> <input type="checkbox" data-checklist-value="t" data-checklist-model="chosentypes" class="sub-checkbox" /> </li> here ng-class function: $scope.nametagclass=function(type){ if($scope.chosentypes.indexof(type)>-1){ return "nametag active-nametag"; } return "nametag"; } the problem is, when ng-class calls function, data chosentypes aren't loaded yet, checked elements don't "active-nametag" class. (however, when data loads , check element, class changes fine) how can delay ng-class ...

Memory-safe way of audio playback in XNA -

i using xna's soundeffect class play sounds in game project. while memory management of directly soundeffect.play() ing effects relatively clear me ( soundeffectinstances internally created , added lists, , memory removed upon sound stopping), know advised when directly creating soundeffectinstances e.g. control audio playback (volume etc.) after instance.play() . currently, sound effects need control after creation use special class in constuctor creates new instance by: instance = loadeffect(indexinsoundlibrary).createinstance(); while in destructor of class calls: instance.dispose(); in summary, use collection of ~400 sound files (just filename) dynamically loaded whenever needed. make sense keep number of soundeffectinstances in memory (e.g. audio files in collection typically played creating soundeffectinstance (and not directly using soundeffect.play() )? are there limitations of how many soundeffectinstances can kept in memory @ time? just additional ...

java - Validating for Binary codes and repeating program without infinite loop -

i assigned make program converts binary decimal. got part done no problems have validate user inputs make sure put in binary or else should "try again" have keep program repeating using letter "y/y" continue or else exists without using infinite loop. have no idea how without infinite loop. thank you import java.util.scanner; class quiz4 { public static void main(string args[]){ scanner input = new scanner( system.in ); system.out.print("enter binary number: "); string binarystring =input.nextline(); system.out.println("output: "+integer.parseint(binarystring,2)); } } ok, you've posted code, need read (and understand) requirements. judging on post, concrete requirement not use "infinite loop" - interpret mean i'm allowed use conditional loop. so, assuming understand requirements, would: wrap existing code in do/while loop, since want evaluate @ end of ex...

c# - How to properly use instances in this example? -

i have multiple classes , want use functions in other classes. i'm facing problem , might know how solve it. class 1 inicio: master master = new master(ip1.text); master.show(); master slave = new master(ip2.text); slave.show(); arena arena = new arena(); arena.show(); class 2 master: arena arena = new arena(); public master(string ip) //inicio { initializecomponent(); _droneclient = new droneclient("192.168.1." + ip); ip_drone = "192.168.1." + ip; point p2 = arena.posicao_desej(); posicao_desejada = p2; public string ip_dron() { return ip_drone; } class 3 arena: master master = new master(""); //what insert here? dont want iniciate again string ip = master.ip_dron(); ip_drone = ip; the problem in master master = new master(""); if remove works cant use class. if use problem crash once forms master , arena open. how can instantiate instance correctly? error: make sure n...

ios - How do I run Python code for my function calculations in my Swift software App? -

i creating app user inputs 2 values (x , y). these 2 values used in function output answer displayed @ bottom of app. these calculations include gaussian covariance calculations, must done in python script, result in 1 final value outputted. can connect python file in swift app? i know how create xcode project external file can connect python, how do in swift project have built? implement algorithm in swift i don't think covariance particularly hard , if implement in open source upsurge library unbelievably better performance uses accelerate framework (i.e. specially tuned calls simd apple engineers have spent lot of time on). i added linear regression upsurge , @ least order of magnitude faster python/numpy code running on same machine.

c++11 - C++ std vector initalization in namespace -

this question has answer here: when use extern in c++ 5 answers im beginner in c++. created namespace , tried initialise std::vector of std::string objects, namespace variable namespace nshttpworker{ std::vector<string> nvmobileagents = { "mozilla/5.0 (linux; u; android 4.0.3; ko-kr; lg-l160l build/iml74k) applewebkit/534.30 (khtml, gecko) version/4.0 mobile safari/534.30", "mozilla/5.0 (linux; u; android 4.0.3; de-ch; htc sensation build/iml74k) applewebkit/534.30 (khtml, gecko) version/4.0 mobile safari/534.30", "mozilla/5.0 (linux; u; android 2.3; en-us) applewebkit/999+ (khtml, gecko) safari/999.9", "mozilla/5.0 (linux; u; android 2.3.5; zh-cn; htc_incredibles_s710e build/grj90) applewebkit/533.1 (khtml, gecko) version/4.0 mobile safari/533.1", "mozilla/5.0 (linux...

mercurial - extension 'hgflow' overrides command: flow -

the error message pop when input 'hg' command in ubuntu, include hg sta . happens after followed tutorial install hgflow repository. here error message: extension ' hgflow ' overrides command: flow the error message not show after remove "[extensions] flow = path/to/hgflow.py" $home/.hgrc file.

scikit learn - python sklearn KDTree with haversine distance -

i try create kd tree of wgs84 coordinates , find neighbors within radius from sklearn.neighbors.dist_metrics import distancemetric sklearn.neighbors.kd_tree import kdtree t = kdtree([[47.8665, 8.90123]], metric=distancemetric.get_metric('haversine')) but following error: valueerror: metric haversinedistance not valid kdtree how can use haversine distance in kd-tree? the k-d-tree can (to best of knowledge) used minkowski norms. there other trees such ball tree in sklearn, or covertree in elki work haversine distance because metric.

Parsing National Weather Service JSON with PHP -

i have been able parse actual .json files, link can't seem parse. http://forecast.weather.gov/mapclick.php?lat=36.321903791028205&lon=-96.80576767853478&fcsttype=json i thinking because link not .json file json formatted link... , having issues trying parse it... if start using... <?php $url = "http://forecast.weather.gov/mapclick.php?lat=36.321903791028205&lon=-96.80576767853478&fcsttype=json"; $json = file_get_contents($url); $json_a = json_decode($json,true); // <---------- current conditions ----------> // //display location $location_full = $json_a['location']['areadescription']; ?> and on page want display information have: <?php require 'req/weatherinfo.php'; ?> <!doctype html> <html> <head> <title>pawneetv weather</title> </head> <body> <?php echo $location_full; ?><p...

json.net - how to add property $type ONLY on root object -

i want modify json.net serializer add $type property objects implements given interface not property or nested objects. with typenamehandling.auto (default) { "propertya": 123, "propertyb": "foo", "propertyc": [1, 2, 3, 4] } with typenamehandling.all { "$type": "jsonnettypenamehandling.testevent, jsonnettypenamehandling", "propertya": 123, "propertyb": "foo", "propertyc": { "$type": "system.collections.generic.list`1[[system.int32, mscorlib]], mscorlib", "$values": [1, 2, 3, 4 ] } } what want { "$type": "jsonnettypenamehandling.testevent, jsonnettypenamehandling", "propertya": 123, "propertyb": "foo", "propertyc": [1, 2, 3, 4] } i experimenting custom contractresolver don't work: class program { static void main(string[] args) { ...