Posts

Showing posts from May, 2012

ios - How can i call search tableview delegate with SQLLite -

i prepared tableview. in screen below, there sqllite db. . search delegate function did not work. var dictionaries = [[string:anyobject]]() // var filtereddogs = [[string:anyobject]]() var searchcontroller: uisearchcontroller! var resultscontroller = uitableviewcontroller() func updatesearchresultsforsearchcontroller(searchcontroller: uisearchcontroller) { self.filtereddogs = self.dictionaries.filter{(dict:[string:anyobject]) -> bool in if dict.lowercasestring.containsstring(self.searchcontroller.searchbar.text!.lowercasestring) { return true } else { return false } } //update results table self.resultscontroller.tableview.reloaddata() } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! rowtableviewcell if t...

javascript - Jquery-ui autocomplete in bootstrap modal -

Image
the list of autocomplete jquery-ui shown behind modal seen in image, there way take front of modal able select it? this modal input data autocomplete database <div id="modalcart" class="modal fade" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title">modal title</h4> </div> <div class="modal-body"> <form id="myform" action="" method="post" class="form-horizontal"> <table class="table table-hover"> ...

Using Amazon Storage Gateway (File Gateway) vs regular Sync to Amazon S3 -

Image
i using aws s3 file storage. in instances application needs read , write 1000+ files 1 one s3. doing such operations on http slower , occupies bandwidth. approach 1 though of storing files locally in folder , i/o operations locally. , have cloudberry sync these files s3 bucket on daily schedule. approach 2 came across amazon storage gateway (file gateway). file gateway, configured s3 buckets available network file system (nfs) mount points. applications read , write files , directories on nfs. in turn, amazon storage gateway sync these files s3 bucket. which approach better option? i have never used amazon storage gateway assuming have host gateway on different server, i/o operation slower because i/o perform on network using unc path. amazon storage gateway has caching, cache files? aws storage gateway (file gateway) provides vm image run on local server. makes nfs mount available on network. connects in back-end amazon s3. files cached locally, c...

unit testing - C# Moq VerifySet throws Expression is not a property setter invocation for non-trivial setter -

in c#, moq verifyset throwing expression not property setter invocation. when setter non-trivial, when using setupproperty or setupset. here trivial example. notice antlers setter trivial , antlers2 setter not trivial.: public class dancer { public dancer(bool pismale) { ismale = pismale; } private bool _ismale; public virtual bool ismale { { return this._ismale; } private set { this._ismale = value; } } private bool _antlers; public virtual bool antlers { { return this._antlers; } set { this._antlers = value; } } public virtual bool antlers2 { { return this._antlers; } set { // females cannot have antlers if (ismale) this._antlers = value; else this._antlers = false; } } } here unit tests. second set of 3 (using antlers2) otherwise identical first set of 3 (using antlers)...

html - Is this proper Schema.org/Microdata markup for a building? -

i trying add microdata notation (using schema.org) website talks buildings. i’ve been reading lot i’m still having trouble figuring out use itemscope , itemtype , itemprop . can tell me if microdata/schema.org markup or if i’m missing something? <div class="infobox infobox_building" itemscope itemtype="http://schema.org/landmarksorhistoricalbuildings"> <!-- building name --> <h1 class="page_title">puente golden horn metro</h1> <!-- architect --> <div class="data_row architect" itemscope itemtype="http://schema.org/creator"> <div class="tag cell">arquitecto</div> <div class="value cell"> <a href="https://stage.wikiarquitectura.com/arquitecto/virlogeux-michel/" itemprop="person">michel virlogeux</a> <a href="https://stage.wikiarquitectura.com/arquitecto/kiran-h...

web api saving files to temporary folder but visual studio wants to compile them -

we have mvc web api in typescript code keeps getting placed here: c:...\webapi\obj\test\package\packagetmp\scripts\bowtie\bowtie.d.ts i don't midn code being copied temporary folder, visual studio tries compile code there , runs issues. have go folder, delete files, , compile again. why files copied directory? can tell visual studio not compile files? can tell not copy files location?

python - Why can't record log with option --log-file in ssserver? -

pip install shadowsocks and set configuration in /etc/shadowsocks.json . sudo ssserver -h |grep log --log-file log_file log file daemon mode i want record log shadowsocks server in /home/user/ss.log. let's create ssserver daemon. format1: sudo vim /etc/systemd/system/ss.service [unit] description=shadowsocks after=network.target [service] user=root execstart=/usr/bin/python /usr/local/bin/ssserver -c /etc/shadowsocks.json --log-file /home/user/ss.log [install] wantedby=multi-user.target sudo systemctl daemon-reload sudo systemctl restart ss no record in /home/user/ss.log after many web page opened via shadowsocks. bug argument --log-file in ssserver or not? no use write : execstart=/usr/bin/python /usr/local/bin/ssserver --log-file /home/user/ss.log -c /etc/shadowsocks.json format2: sudo vim /etc/systemd/system/ss.service [unit] description=shadowsocks after=network.target [service] user=root standardoutput=journal standarderro...

New Google Sites Intranet Search -

i creating intranet site using new google sites. have tried many search products, , nothing works because not public url. products or methods suggest work? thought creating own search engine, dont want start scratch unless there no other options.

loopbackjs - loopback email verification testing -

i've built rest api loopbackjs , writing tests, starting testing authentication of user. have project set email verification user should not able log in until have verified email address. test have written passes status 200 res.body.email , fail user has not verified email. how can configure test http status reflects unauthorized user needs verify email before gaining access api: here's user.spec.js 'use strict'; const app = require('../server.js'); const request = require('supertest'); const api = request('http://0.0.0.0:3000/api'); let member, uid, token; describe('member', () => { beforeall((done) => { app.listen(done); member = app.models.member; }); afterall((done) => { app.close(done); }); describe('it should resolve', () => { it('a member.find', () => ( member .find() .then(res => console.log(res)) )); }); describe('/member...

gsp - Grails save method, doesn't recall method correctly if has error -

i have 2 method create new domain: first 1 modified create() method, instead of respond subdomain created parameters in form (inside newsubdomain view), pass userdomainlist gsp can create select it. def newsubdomain() { def currentuser = springsecurityservice.getcurrentuser() def domainlist = currentuser.domains //an hasmany domain user def subdomain = new subdomain(params) [subdomain: subdomain, domainlist: domainlist ] } second 1 save() method def savesubdomain(subdomain subdomain) { if (subdomain== null) { notfound() return } if (subdomain.haserrors()) { respond subdomain.errors, view:'newsubdomain' return } subdomain.save flush: true redirect(controller: "controller", action: "action") } subdomain must have unique name, if create subdomain same name, want show error message on top of newsubdomain view, happens, when recall ...

html - Unable to get form to submit with basic PHP and Bootstrap, validation working but no posting -

i'm sure has been asked many times before, being amateur not of others answers work case. this php form i'm including on html page email removed <?php $nameerr = $emailerr = $phoneerr = $messageerr = ""; $name = $email = $phone = $message = ""; $to = "email@gmail.com"; $from = "email@site.com"; $headers = "from: $email \r\n"; $subject = "new submission"; $body = "new loan request: \n $message"; mail(to,from,subject,headers,body) if ($_server["request_method"] == "post") { if (empty($_post["name"])) { $nameerr = "name required"; } else { $name = test_input($_post["name"]); } if (empty($_post["email"])) { $emailerr = "email required"; } else { $email = test_input($_post["email"]); } if (empty($_post["phone"])) { $phoneerr = ""; } else { $phone = test_input...

text parsing - Is there any other way of lexing JavaScript into token excep contect free grammar provided in ECMAScript specification? -

i looking state machine representation transformation of javascript string tokens, there other alternative representations? state machine or automata's representation? javascript can't tokenized finite-state automaton, because goal symbol each successive token determined state of syntactic parse @ point.

java - How sql works and why this result is returned? -

Image
hi i'm using preparedstatement in java execute query in db. the table: when comes update, delete , insert it's fine, when comes select( ex. i've done "select ?,?,?,?,? person" , set strings afterwards) , following result returned: i'm assuming because it's strings replacing ? did not come out expected:(please correct me if it's wrong) expected sql: "select no,name,tel,birthday,address person" actual sql: "select \"no\",\"name\",\"birthday\",\"address\" person" i've tested second 1 in in navicat: i'd understand why executing query statement return result this? if here's java code: // data assist object public class dao { static string jdbcurl; static string username; static string password; static{ try { class.forname("com.mysql.jdbc.driver"); resourcebundle rb = resourcebundle.getbundle("...

ibm midrange - C# Call QRCVDTAQ in AS400 hit Error code 3426 -

below error detail, pls help. additional message information message id . . . . . . : cpiad08 severity . . . . . . . : 40 message type . . . . . : diagnostic date sent . . . . . . : 17/07/26 time sent . . . . . . : 14:30:08 message . . . . : host server communications error occurred on recv() - length. cause . . . . . : error code 3426 received while processing recv() - length function host server communications. recovery . . . : see listed message(s) determine the cause of error; if necessary, correct error , issue request again. bottom press enter continue. f3=exit f6=print f9=display message details f12=cancel f21=select assistance level ...

cocos2d-x 2.x label render is blur on windows -

Image
currently, need produce windows version of our game. quality of label render pool. looks this: there way improve it? i have found answer here: fixes font rendering on windows #4885

Having error while using laravel-mix in mix.sass(); -

i'm experiencing error. can me this. using laravel-mix mix.sass('resources/assets/sass/main.scss', 'public/css/app.css'); issue here : error failed compile 2 errors 9:38:15 error in ./resources/assets/sass/main.scss module build failed: @import "node_modules/bulma/sass/utilities/intial-variables.sass"; ^ file import not found or unreadable: node_modules/bulma/sass/utilities/intial-variables.sass. parent style sheet: stdin error in ./resources/assets/sass/main.scss module build failed: modulebuilderror: module build failed: @import "node_modules/bulma/sass/utilities/intial-variables.sass"; i'm not used using sass, requirement me, can save time in customizing app's , feel. these customization. // fonts @import url(...

javascript - MultiValueDictKeyError when using DropzoneJS with Django -

Image
i'm making profile picture feature website, started using dropzonejs i'm having issue submitting file. picture drop zone fine, appears "x" on it, , when hover on picture can see multivaluedictkeyerror error. same error when click submit button without selecting file. assume issue file isn't being submitted button ? how do that? html/js: <script type='text/javascript'> dropzone.options.mydropzone = { init : function() { var submitbutton = document.queryselector("#submitbtn") mydropzone = this; submitbutton.addeventlistener("click", function() { mydropzone.processqueue(); }); this.on("addedfile", function() { document.getelementbyid('submitbtn').style.visibility = "visible"; }); this.on('addedfile', function(){ if (this.files[1]!=null){ this.removefile(this.files[0]); ...

denormalization - Automatic denormalizing by query -

i wonder if it's possible create logic automatically creates denormalized table , it's data (and maintains it) specific sql-like query. given system user can maintain data model , data. data stored in "relational" tables, tables used user maintain data. if wants display data on webpage has write query (sql) automatically turn denormalized table , kept up-to-date when updating/deleting relational data. let's got query this: select t1.a, t1.b t1 t1.c = 1 the logic automatically create denormalized table copy of needed data according query. it's view (i wonder if views more performant approach). whenever query (give name) needed business logic replaced simple query on new table. any update in t1 search queries t1 involved , update denormalized data automatically, performance win update rows infected (in example 1 row). that's point i'm not sure if it's achievable in automatic way. example query simple, if there queries joins, aggregation...

c# - Xamarin Forms ListView SelectedItem Binding Issue -

listviews follow itempicker/selector pattern of ui controls. speaking, these types of controls, regardless of platform have selecteditem, , itemssource. basic idea there list of items in itemssource, , selecteditem can set 1 of items. other examples comboboxes (silverlight/uwp/wpf), , pickers (xamarin forms). in cases, these controls async ready, , in other cases, code needs written in order handle scenarios itemssource populated later selecteditem. in our case, of time, bindingcontext (which contains property bound selecteditem) set before itemssource. so, need write code allow function correctly. have done comboboxes in silverlight example. in xamarin forms, listview control not async ready, i.e. if itemssource not populated before selecteditem set, selected item never highlighted on control. design , ok. the point of thread find way make listview async ready itemssource can populated after selecteditem set. there should straight forward work arounds can implemented on oth...

maps - Swift MapKit not showing directions to pin -

Image
i have written code drop pin , show directions on mapkitview , reason pin drops directions not show on map. welcome, thank you. import uikit import mapkit import corelocation class viewcontroller: uiviewcontroller, cllocationmanagerdelegate, mkmapviewdelegate { @iboutlet weak var mapview: mkmapview! let locationmanager = cllocationmanager() var movedtouserlocation = false func clean() { mapview.removeannotations(mapview.annotations) mapview.removeoverlays(mapview.overlays) } func locationmanager(_ manager: cllocationmanager, didchangeauthorization status: clauthorizationstatus) { switch status { case .denied, .restricted: print("disable parental controles") case .notdetermined: manager.requestwheninuseauthorization() default: manager.startupdatinglocation() } } func mapview(_ mapview: mkmapview, didupdate userlocation: mkuserlocation) { ...

Is standalone angular UI grid is possible? -

i wondering whether angular ui grid standalone possible. all of examples use $http.get seem need server angular work. please me creating desktop or standalone app using technology. the examples using $http.get pulling data rest service, if want to, can assign own data grid data through $scope.gridoptions.data = (location of data).

reactjs - Only a ReactOwner can have refs. error using react-rails -

i'm getting error basic react-rails based app. only reactowner can have refs. might adding ref component not created inside component's render method, or have multiple copies of react loaded here component code refs are. var newitem= react.createclass({ handleclick() { var name = this.refs.name.value; var description = this.refs.description.value; $.ajax({ url: '/api/v1/items', type: 'post', data: { item: { name: name, description: description } }, success: (response) => { console.log('it worked!', response); } }); }, render() { return ( <div> <input ref='name' placeholder='enter name of item' /> <input ref='description' placeholder='enter description' /> <button onclick={th...

excel - Python convert multiple content in a CSV file cell to multiple columns -

i new in using python. have number of csv files , read files , write them in single excel. input: the csv files consists of number of columns , there grouping of content in specific cell output expected: the output need break down specific cell , write in same column the code writing is: csv_folder = "file" book = xlwt.workbook() fil in os.listdir(csv_folder): sheet = book.add_sheet(fil[:-4]) open(csv_folder + fil) filname: reader = csv.reader(filname) = 0 row in reader: j, each in enumerate(row): sheet.write(i, j, each) += 1 book.save("output.xls") it if provide example script.

c++ - Does boost::shared_ptr<TTransport> close connection once destroyed? -

i have small code snippet uses thrift network communications. int main() { while (true) { boost::shared_ptr<ttransport> socket(new tsocket("localhost", 9090)); boost::shared_ptr<ttransport> transport(new tbufferedtransport(socket)); boost::shared_ptr<tprotocol> protocol(new tbinaryprotocol(transport)); calculatorclient client(protocol); try { transport->open(); client.ping(); cout << "ping()" << endl; // following line commented out intentionally //transport->close(); } catch (texception& tx) { cout << "error: " << tx.what() << endl; } } } my question is: boost::shared_ptr close connection once destroyed? if yes, transport->close(); can commented out without problems, right? looking @ the source , don't see ttransport doing in destructor. however, destructor of tsocket ( src ), call it's close() fun...

c# - Exe works without the published DLLs -

i have dot net 4.0 project build using vs2017 . application 32 bit x86 . when publish application, , exe 8 dlls such system.io , system.net.* , system.runtime , system.threading . when copy exe , dlls directory runs without issues. created directory , copied exe file directory , ran it. works. we planning deploy exe windows 2003 (dot net 4.0) , machines. less files deploy, better. question is, need dlls files? how it still works without them? thanks in advance (i love backticks ).

raytracing - Raytracer -- Why are there speckles on the edges of my spheres? -

Image
my raytracer generating following image: i've checked normals many times , i'm quite confident not problem. else have ideas? what @alnitak said in comments. speckles appear because of self intersection. can occur during implementation of shadows well. if have implemented shadows check if shadow ray generates point on surface, if add small constant example "0.001" generate ray little further surface avoid self-intersection.

javascript - Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement' in Wordpress site -

Image
i cross domain exception on wordpress site. this wordpress site contains several 3rd party plugins may call resources other domains. that's reason far think this. so, there way fix ?

javascript - Edge browser XMLHttpRequest abort is not working -

var xhr = new xmlhttprequest(); var method = "get"; var url = "https://developer.mozilla.org/"; xhr.open(method,url,true); xhr.send(); xhr.abort(); when run code in microsoft edge browser xhr call abort not working. test code in chrome , mozilla, working fine.

docker - Possible to initialise Consul Key Value store at startup? -

i can initialise consul services @ startup using /consul/config directory. able initialise application settings consul kv store when start consul container. possible? there several projects might interesting scenario: https://github.com/zerotens/consul-kv-bootstrap https://github.com/cimpress-mcp/git2consul https://github.com/cimpress-mcp/fsconsul

java - RxJava Subscribe not working -

i have following code - package com.test.rxjava; import org.reactivestreams.subscriber; import org.reactivestreams.subscription; import io.reactivex.flowable; public class app1 { public static void main(string[] args) { subscriber<integer> subscriber = new subscriber<integer>() { @override public void onsubscribe(subscription s) { } @override public void onnext(integer t) { system.out.printf("entry %d\n", t); } @override public void onerror(throwable t) { system.err.printf("failed process: %s\n", t); } @override public void oncomplete() { system.out.println("done"); } }; flowable.just(123).subscribe(subscriber); } } i expecting execute code in onnext method.however nothing happens.however if replace last ...

scheduled tasks - sos berlin scheduler -- job chain - how to trigger other job after job timeout -

i'm using sos berlin scheduler (version linux-x64 1.10.5). normally when job in job_chain timeout, scheduler kill job process , send email. so, based on this, want trigger other job. but, have tried 2 ways doesn't work. way 1: add function “spooler_task_after()” in job. i guess failure because job create process on linux system, while job timeout scheduler kill job process, kill function “spooler_task_after()” code: <job timeout="00:00:09"> <script language="shell"><![cdata[ echo aa sleep 10s echo bb ]]></script> <monitor name="exit_code" ordering="0"> <script language="java:javascript"><![cdata[ function spooler_task_after(){ var exitcode = spooler_task.exit_code; spooler_log.info ("exit code is: " + exitcode); /* call other job */ result = true; return result; } ...

Google Calendar Event ID global or not? -

is event id unique globally on whole google or in calendar? it looks this: 2tdcb4eepthqj01qltpi4txfcs id: opaque identifier of event. when creating new single or recurring events, can specify ids. provided ids must follow these rules: characters allowed in id used in base32hex encoding, i.e. lowercase letters a-v , digits 0-9, see section 3.1.2 in rfc2938 length of id must between 5 , 1024 characters id must unique per calendar due globally distributed nature of system, cannot guarantee id collisions detected @ event creation time. minimize risk of collisions recommend using established uuid algorithm such 1 described in rfc4122. if not specify id, automatically generated server. note icaluid , id not identical , 1 of them should supplied @ event creation time. 1 difference in semantics in recurring events, occurrences of 1 event have different ids while share same icaluids. about event: visibility of event. optional. possible values are: "default" - u...

json - D3 - not all children nodes are shown at the same time -

Image
i'm trying create network graph based on example . tried using json file have doesn't show nodes @ same times. { "name":"plant", "children":[ { "name":"delonix regia", "children": [ { "id" : "family", "name" : "fabaceae", "size": 10000 }, { "id" : "common name", "name" : "semarak api", "size": 10000 }, { "id" : "habitat", "name" : "humid", "size": 10000 } ] }, { "name":"ixora javanica", "children": [ { "id" : "family", "name" : "fabaceae", "size": 10000 }...

cocoapods - How do I use a pod inside of a private pod -

i have created private pod, let's call private, , contains common functionality want share across apps. (i'm not sure matters it's private, that's situation.) private depends on third-party pod, let's call thirdparty. private has own podfile, specifies uses thirdparty normal syntax: pod thirdparty private builds fine. i have podspec private, specifies: s.dependency thirdparty the podspec lints fine. i have app, let's call app. app has podfile, , specifies uses private pod private, such: pod private using private pod in way has worked fine, until tried use thirdparty in private. now, when build app, error in file private says: no such module thirdparty what gives? i've tried specifying app needs pod thirdparty in app's podfile well, no luck.

python - Convert Value History to Plot in Swift 3 -

Image
i have pretty simple coupled bvp system solve , plot. made simple, powerful python code. however, swift doesn't so hell trying integrate swift , gave (if has proven solution such integration, ears). c++ easier integrate has ode solvers in odeint. decided own little algorithm in swift, isn't bad in terms of calculations. problem converting value history plot. after have tried searching, nothing useful seems show up. @ moment, have in playground , part under "// display final solution in history" shows plots when click value histories of x , v there. i need produce graph python did me. import uikit typealias solver = (double, double, double) -> void struct { var th1 = 0.0 var tc2 = 0.0 var deltat = 0.0 init(th1: double, tc2: double, deltat: double) { self.th1 = th1 self.tc2 = tc2 self.deltat = deltat } func solveusingsolver(solver: solver) { solver(th1, tc2, deltat) } } func solveeuler(th1: doub...

c# - Send Controller data to Reactjs -

i need save employee details database. idea send employee data controller reacjts json format , reactjs should call webapi post method . webapi take care of saving data in sql server. my web api code: //insert new employee public ihttpactionresult createnewemployee(employeemodels emp) { using (var ctx = new employee()) { ctx.tempemp.add(new tempemp() { id = emp.id, name = emp.name, mobile = emp.mobile, erole = emp.erole, dept = emp.dept, email = emp.email }); ctx.savechanges(); } return ok(); } my controller : [httppost] public jsonresult createnew(employee model) { return json(model); } kindly provide suggestion send employee model reactjs. im new reactjs. im trying pass data controller reactjs. here code first need create model javascript obje...

c++ - How to populate an array of struct from an sqlite3 query? -

i working on native winapi application using cpp , sqlite. have simple listbox in window populate values sqlite table have following sqlite query c++ code: sqlite3 * db = null; sqlite3_stmt * stmt; int i, db_qry; const char * tail; const char * sqlselect = "select * my_friends"; db_qry = sqlite3_open("friends.db", &db); if(sqlite3_prepare(db, sqlselect, -1, &stmt, &tail) == sqlite_ok) { while(sqlite3_step(stmt) != sqlite_done) { for(i = 0; < sqlite3_column_count(stmt); i++) { const unsigned char * p = reinterpret_cast<const unsigned char *> (sqlite3_column_text(stmt, 0)); const char * finaltext = (const char *)p; //method poulating listbox somewhere addstringlist(hlist,_t(finaltext)); } } sqlite3_finalize(stmt); } sqlite3_close(db); based on loop used in sqlite query use, need on how c...

Ubuntu 16.04 cannot connect to Canon Pixma MP560 Printer? -

operating system: ubuntu 16.04 printer: canon pixma mp560 i have setup printer on wireless network. can change settings of printer through entering ip address in browser. when try add printer in ubuntu. used find printer when type in printers ip address in host , click probe nothing happens. i installed , when adding printer, printer picked automatically: apt-cache search bjnp sudo apt-get install cups-backend-bjnp

NativeScript StackLayout with gap between child elements -

i'm using nativescript stacklayout component layout elements. what best approach create gap between child elements of stacklayout? you can use margin in css layout. in xml: <stacklayout> <label text="hey there,"></label> <label text="world!"></label> </stacklayout> in css: stacklayout label { margin: 10; }

ios - About strong reference cycles for closures in Swift -

Image
i have defined class called person . code: class person { var closure: (() -> ())? var name: string init(name: string) { self.name = name print("\(name) being initialized") } deinit { print("\(name) being deinitialized") } } then use person in class called viewcontroller : class viewcontroller: uiviewcontroller { var person = person(name: "john") let astr = "john cute boy" override func viewdidload() { super.viewdidload() person.closure = { print("\(self.astr)") } person.closure!() } } in opinion, picture of memory code : so, above picture, in opinion, cause strong reference cycle between 3 instances, can not leak instruments , have confusion. does code cause strong reference cycle? if not, when arc deallocate instance of person ? method named deinit in per...