Posts

Showing posts from September, 2010

ios - How can I access Collection View from delegate & datasource class? -

i have view controller contains collection view. collection view's delegate , datasource 1 custom class , can't access collection view class. class includes uicollectionviewflowlayout, uicollectionviewdelegateflowlayout, uicollectionviewdatasource. i tried accessing collection view typing self.collectionview didn't work, saying: "fatal error: unexpectedly found nil while unwrapping optional value (lldb)". tried setting static let variable points view controller containing collection view didn't work. delegates , datasources dataprovider, not more. extracting them own classes idea (object oriented design). these classes shouldn't implement more api of protocol , maybe private helper functions them. each protocol function provide access collection view giving reference first parameter. e.g. func numberofsections(in: uicollectionview)

web services - Oracle Database URL_HTTP Issue -

i'm trying invoke web service send encoded (base64 encoding) file name. shorter file name works fine, when file name increases after encoding pl/sql fails invoke web service , turns out bad request 400 error. based on our observation far have seen upto 65 chars worked once sent ~ 89 chars failed. *code snippet req := utl_http.begin_request(url, 'put',' http/1.1'); utl_http.set_body_charset('utf-8'); utl_http.set_header(req, 'username', username); utl_http.set_header(req, 'password', password); utl_http.set_header(req, 'content-type', 'application/octet-stream'); utl_http.set_header(req, 'content-length', '32767'); utl_http.set_header(req, 'accept-encoding', 'gzip'); utl_http.set_header(req, 'transfer-encoding', 'chunked'); filename := utl_raw.cast_to_varchar2 (utl_encode.base64_encode (utl_raw.cast_to_raw (ffile.file_name))); //encoding file name before

java - Javafx Choicebox - how to check if selected/activated -

i trying make simple app using javafx. i want make choicebox, , when choicebox activated - meaning if value selected - want code progress. this working: if ( choicebox.getselectionmodel().isempty()){ } why opposite not work? : if (! choicebox.getselectionmodel().isempty()){ } edit: have 2 layouts. 1 represents choicebox , 1 represents set of checkboxes. want accomplish checkboxes should appear when choicebox activated / value selected. if (! choicebox.getselectionmodel().isempty()){ secondlayout.setvisible(true); } try this: choicebox<string> cb = new choicebox(....); secondlayout.visibleproperty().bind(bindings.createbooleanbinding(() -> cb.getvalue() != null, cb.valueproperty())); as alternative can do: secondlayout.visibleproperty().bind(bindings.isnotnull(cb.valueproperty()));

database - MySQL mutual condition query with single table -

i receiving user_id 1 , 2 post. want hospital id sharing both user 4. user_hopitals table id | user_id | hospital_id 1 | 1 | 4 2 | 2 | 4 3 | 1 | 5 4 | 2 | 9 hospitals table id | name 4 | abc hospital 5 | xyz hospital 9 | def hospital i want data hospital_id | hospital_name 4 | abc hospital you can use self join , e.g.: select h.id. h.name user_hospitals uh1 join user_hospitals uh2 on uh1.hospital_id = uh2.hospital_id join hospitals h on uh1.hospital_id = h.id uh1.user_id = 1 , uh2.user_id = 2;

ASP.NET Core Dependency Injection inside Startup.Configure -

i using cookie middleware authenticate user. have been following this official tutorial . inside startup class, excerpt configure method looks this: public void configure(iapplicationbuilder app, ihostingenvironment env, iloggerfactory loggerfactory) { // ... // cookie-based authentication app.usecookieauthentication(new cookieauthenticationoptions() { authenticationscheme = cookieauthenticationdefaults.authenticationscheme, automaticauthenticate = true, automaticchallenge = true, events = new customcookieauthenticationevents(app), }); // ... } the customcookieauthenticationevents class defined follows: public class customcookieauthenticationevents : cookieauthenticationevents { private iapplicationbuilder _app; private imyservice _myservice = null; private imyservice myservice { { if(_myservice != null) { return _myservice; } else { return _myservice = (imyservice) _app.applica

Passing arguments into the revealing Module pattern in Javascript -

how can pass arguments function when implementing revealing module pattern in javascript. have module this var globalmodule = (function() { function consolelog(texttooutput) { console.log(texttooutput); } return { consolelog: consolelog() }; })(); later on, when run globalmodule.consolelog("dummy text"); , undefined output. do function inside return object var globalmodule = (function() { return { consolelog: function(texttooutput) { console.log(texttooutput); } } })(); globalmodule.consolelog("dummy text"); simply same output achieved . object => function call .no need return object var globalmodule ={ consolelog: function(texttooutput) { console.log(texttooutput); } } globalmodule.consolelog("dummy text");

mysql - Which index to add here? -

this query ends in slow query log because join without index. index add , where? simple query takes anywhere 500ms 1,2s. guess should complete within 100ms. select users.*, user_roles.apirequests, user_roles.downloadrequests, now() users inner join user_roles on user_roles.id = users.role users.rsstoken = '775e155c780ed5af9119f797f814c714' limit 1; see query , show create tables: https://kopy.io/icz1z for query: select u.*, ur.apirequests, ur.downloadrequests, now() users u inner join user_roles ur on ur.id = u.role u.rsstoken = '775e155c780ed5af9119f797f814c714'; the best indexes users(rsstoken, role) , user_roles(id) . have second index, because id declared primary key. you can include apirequests , downloadrequests in index on user_roles : user_roles(id, apirequests, downloadrequests) . might small optimization -- counsel against because id primary key , row size small.

postgresql - Postgres - Homebrew Install Cannot Find Server Files Multiple Versions -

i trying use postgres on machine , realized time ago had installed database software after running brew install postgres , receiving error: postgresql-9.4.5_2 installed . there decided install homebrew/services able run postgres in background , launched , closed background job brew services start postgresql==> started postgresql (label: homebrew.mxcl.postgresql) however, when run postgres received error of: postgres not know find server configuration file. must specify --config-file or -d invocation option or set pgdata environment variable. when followed answer on so, cat /usr/local/var/postgres/server.log received following error: log: skipping missing configuration file "/usr/local/var/postgres/postgresql.auto.conf" fatal: database files incompatible server detail: data directory initialized postgresql version 9.3, not compatible version 9.4.5. which makes me think had older version of postgresql installed needs removed. i tried psql , receive

ftpwebrequest - C# FtpWebResponse Download throttling -

i tried create ftp download application. , want throttle downloads noob @ wrote can not control speed exactly, mean when write 1024*1024 bytes per second downloads between 400 , 1700 kb's per second need on , told noob please tell answer noobs. thank , sory bad english :d (note: code includes progressbar , label shows download speed per second) (note 2: need download big files must use backroundworker , can not use ram keep file before write hdd, need download file hdd directly) here download code: ftpwebrequest ftpwbreq = webrequest.create(textbox1.text) ftpwebrequest; ftpwbreq.method = webrequestmethods.ftp.getfilesize; ftpwebresponse ftpwebres = ftpwbreq.getresponse() ftpwebresponse; bytes_total = convert.touint64(ftpwebres.contentlength); ftpwebres.close(); ftpwebrequest request = (ftpwebrequest)webrequest.create("ftp://"+url); request.method = webrequestmethods.ftp.downloadfile; request.credentials =

html - Bootstrap 4 Layout not working as expected when used with forms -

i working bootstrap 4 on form. now, when using form along grid classes, not work supposed to. output can seen here http://www.henryspike.tk/testform what had expected see whole 12 columns divided 4-4-4 each containing input field stacks up. <div class="row"> <div class="col-md-12 offset-md-1"> <div class="row"> <form class="form"> <div class="col-md-4"> <div class="form-group"> <label for="name">name</label> <input class="form-control" type="text" name="name" id="name" placeholder="eg. john doe" required> </div> </d

javascript - Trying to Bundle CSS with ExtractTextPlugin -

i'm trying bundle css 1 file webpack. i've got working scripts.but error css: module not found: error: can't resolve 'circle.css' in 'c:\projects\tag-validator-front2\src\css'. here's webpack config: var extracttextplugin = require('extract-text-webpack-plugin'); module.exports = { entry: ["./src/ts/main.js","./src/css/css.js"], module: { loaders: [ { test: /\.jsx?$/, loader: "babel-loader" }, { test: /\.css/, loader: extracttextplugin.extract("css") } ] }, plugins: [ new extracttextplugin("styles.css") ], output: { filename: "public/bundle.js" } } main.js scripts , working, css.js isn't. here's css.js: "use strict"; import circlestyles 'circle.css'; i'm importing 1 right until working, of css in directory , in sub folders.

Install multiple versions of MongoDB on linux -

how can setup multiple versions of mongodb on ubuntu 16.04? mongodb 3.4.1 , running on system , wanted setup mongodb 2.6 other application. because our application running on mongodb 2.6 having db driver not compatible mongodb 3.4 hence wanted run both mongodb version on same linux server. tried follow below link couldn't succeed. how can install 2 versions of mongodb parallely in ubuntu 12.04 ? multiple versions of mongo multiple instances of mongo db on same server to that, must have both versions of mongodb available on system. for instance, let's have downloaded 2.6 version binaries /opt/mongo/26/ , other version's @ /opt/mongo/34/ , run both versions of database daemon on different ports: /opt/mongo/26/mongod --dbpath /data/26/ --port 27017 /opt/mongo/34/mongod --dbpath /data/34/ --port 28018

json - How to put weather underground forecast icons -

i´m new program python , trying put icons weather underground forecast, in line labelimg1 don´t show icon , dont give error. can helpme. i put here part of code. in advance. url = " http://api.wunderground.com/api/xxxxxxxxx/forecast/q/pt/lisbon.json " temp = urllib.request.urlopen(url) json_string = temp.read().decode('utf-8') parsed_json = json.loads(json_string) high = parsed_json['forecast']['simpleforecast']['forecastday'][0]['high']['celsius'] low = parsed_json['forecast']['simpleforecast']['forecastday'][0]['low']['celsius'] con = parsed_json['forecast']['simpleforecast']['forecastday'][0]['conditions'] day = parsed_json['forecast']['simpleforecast']['forecastday'][0]['date']['day'] high1 = parsed_json['forecast']['simpleforecast']['forecastday'][

java - PATCH request method: field mapping -

i'm implementing patch request method in restful service (spring, java). i'm consuming dto objects in controller methods. i'm using dozer map dto's entities. with patch request method have obvious problem: field null value mean either entity field should updated null, or entity field should left unchanged. having looked through posts in internet, decided accept in uri parameters list of fields nulled explicitly (i'll refere list nullfields ). other fields stay unchanged if received value null. now can see 3 possible ways implement solution: to have dozer map objects usual, skipping fields null values. explicitly set fields nullfields null. have iterate on values of nullfields , invoke appropriate setter methods of entity. don't option because have change field-to-setter mapping every time add, delete or rename object fields. same above - dozer maps objects, set of fields null explicitly - using reflection. wouldn't have maintain field-to-set

php - Magento 2 Custom Select Field for Category Admin -

i want add custom attribute category in magento 2. attribute has select field custom options. need reference create this. i can create normal text field attribute, select field can't join options select field. can me out ? try link https://gielberkers.com/adding-custom-category-attributes-magento-2-1/#comment-3831 by way show code , can't without see code

awk to count and print header row of file -

i using combination of head , awk count number of fields in header row of tab-delimited file . below seems close want print header names in file on newline. there better way start. thank :). file index chr start end ref alt awk current output head -n 1 file | awk -f'\t' '{print nf " fields detected in file"}' 6 fields detected in file desired output 6 fields detected in file index chr start end ref alt try - $ awk ' {print nf " fields detected in file"} end {print}' f 6 fields detected in file index chr start end ref alt or $ awk ' {print nf " fields detected in file"rs $0;exit}' f 6 fields detected in file index chr start end ref alt

Is there any way to do Adaptive payment in payeezy payment gatway? -

i need integrate " https://developer.payeezy.com/ " payment method in website. have transfer amount in 2 account single transaction. like, admin added 10% commission each transaction. customer pay $100 transaction merchant $90 , admin $10 per transaction. is there way direct payment 2 account in single api call process? thanks.

android wifi - Show another activity when no internet connection -

i working on webview client app in android studio. have working splashscreen. i want check internet connection, or check if webpage available. if not, go activity webview activity. you can simple thing load webpage using custom webviewclient overriding onpageerror method , starting activity in method. class customwebviewclient extends webviewclient(){ onreceivederror(webview view, webresourcerequest request, webresourceerror error){ startactivity(new intent(this,your_second activity.class)); }} and set webview client webview.setwebviewclient(new customwebviewclient());

sql - Adding table in the stored procedure code -

i new sql. have stored procedure need add 2 columns of table "dbo.additionprojectdetails". here projectid primary key. below code snippet cant add whole here. help? select pbd.proj_id, case when phase =1 'phase i' when phase=2 'phase ii' tasktype,area_name,projectname,os_name,ptcdd.remarks projectdetails (nolock) pbd inner join projecttestprocessdetails (nolock) ptpd on pbd.proj_id =ptpd.proj_id inner join projecttestcycledet (nolock) ptcd on ptcd.proj_id=pbd.proj_id inner join projecttestcycleduration (nolock) ptcdd on ptcdd.proj_id=pbd.proj_id inner join projecttestprocesscostdetails (nolock) ptpcd on ptpcd.proj_test_prepareid=ptpd.proj_test_prepareid inner join areamaster on am.area_id =pbd.areaid inner join projectmaster pm on pm.projectid =pbd.platformid inner join

laravel and phantomjs cookie -

i trying pass laravel cookie when executing phantomjs, cant working. //this on phantom js script phantom.addcookie({ 'name': 'laravel_session', 'value': laravel_cookie, 'domain': domain, 'path': '/' }); but should laravel_cookie be? i tried various options emulating browser should hold recognized logged in user: session::getid() crypt::encrypt(session::getid()) none of work, ideas?

ios - Facebook App Invite not working -

i'm trying add facebook app invite this: let content:fbsdkappinvitecontent = fbsdkappinvitecontent() content.applinkurl = url(string: "https://fb.me/...") content.appinvitepreviewimageurl = url(string: "http://...") let dialog = fbsdkappinvitedialog() dialog.content = content dialog.delegate = self dialog.fromviewcontroller = self dialog.show() relevant info.plist keys: <key>facebookappid</key> <string>...</string> <key>facebookdisplayname</key> <string>blanket</string> <key>lsapplicationqueriesschemes</key> <array> <string>fbapi</string> <string>fbapi20130214</string> <string>fbapi20130410</string> <string>fbapi20130702</string> <string>fbapi20131010</string> <string>fbapi20131219</string> <string>fbapi20140410</string>

Java Firebase cloud message . Send message to all -

i want send message device send 1 device how send message : can send message 1 user , when remove @ method send message: json.put("to", tokenid.trim()); a message not send nobody when have line send message 1 user . how can send message every 1 ? static void send_fcm_notification(string tokenid, string server_key, string message) { try { url url = new url(fcm_url); // create connection. httpurlconnection conn; conn = (httpurlconnection) url.openconnection(); conn.setusecaches(false); conn.setdoinput(true); conn.setdooutput(true); //set method post or conn.setrequestmethod("post"); //pass fcm server key conn.setrequestproperty("authorization", "key=" + server_key); //specify message format conn.setrequestproperty("content-type", "application/json"); //create json object & pass value js

android - Changing background Color of DrawerLayout -

i'm trying change color of drawerlayout in app <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:backgroundtint="#ffffff"> as seen above, i've tried android:background , android:backgroundtint both don't seem working. appreciated set background color second embedded view, e.g. listview in example: <android.support.v4.widget.drawerlayout android:id="@+id/drawer_layout" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:opendrawer="start"> <include layout="@layout/activity_navigation_app_bar"

.net - SignalR 2 - Reconnect -

i have win forms .net 4.5 signalr server on windows 2012. clients win forms applications using .net 4 framework on windows xp sp3. currently have 400 clients connected , server have onreconnect() event fires more expected (every 20-40 sec). clients have connection.ensurereconnecting(); my question : normal behavior of longpolling transport.

javascript - jQuery resize function not working in Chrome -

i have webpage large header image @ top of page occupies entire view width , height. found helpful snippet online avoided strange resizing issue happens on mobile when url bar disappears. before including code below, header image increase in size when url bar disappeared because view height become larger. code works except problem persists on ios chrome app. here appreciated i have decided take new approach solving problem since url bar height on safari , chrome vary. cause unwanted complications , difficult have adjustment work on both browsers. new approach taking when viewing webpage on tablet or mobile, set height view height on load , have stay @ height. have updated jquery code below have far, still not work expected. link webpage html: <div class="intro-bg"> <div class="intro-bg-item"> <div class="intro-bg-item-image" style="background-image: url(css/images/pb/home-banner.jpg)"></div><!--

PHP str_replace not replacing quotes -

hello have following code witch scans string , suppose replace double quotes &quot; . problem finds double quotes, replaces them &quot; adds &quot; end of it. dosnt replace quote. dont understand im doing wrong. here code: $lineocc31 = substr_count($text, '"'); if($lineocc31 < '1'){ $text = $text; }else{ $text = str_replace('"', '&quot;', $text); } $string = 'something " in it'; echo htmlentities($string); output: &quot; in it see here https://3v4l.org/afrni

html - PHP not sending email for contact form -

this question has answer here: php mail function doesn't complete sending of e-mail 22 answers after filling in required fields contact form supposed process information inputted user , sent off in email format receiver in instance website owner. after page auto refreshes nothing happens. appreciated. have included code below has php embedded. <!doctype html> <html lang="en"> <head**strong text**> <meta charset="utf-8"> <title>contact - dream occasions</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> <link rel="icon" href="images/favicon.ico" type="image/x-icon">

android - ImageView not showing image in activity -

i made app use default camera take photo displays on image view.problem is, image not show in image view. tried many ways no solution. mainactivity.java: public class mainactivity extends activity { private static final int activity_start_camera_app = 0; static final int request_image_capture = 1; private imageview mphotocapturedimageview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mphotocapturedimageview = (imageview) findviewbyid(r.id.capturephotoimageview); } public void takephoto(view view){ intent callcameraapplicationintent = new intent(); callcameraapplicationintent.setaction(mediastore.action_image_capture); startactivityforresult(callcameraapplicationintent, activity_start_camera_app); } protected void onactivityresult(int requestcode, int resultcode, intent data) { toast.maketext

javascript - Only first value added gets displayed in ng2-chart linechart -

Image
i have simple line chart want add values when user clicks on button. whatever reason first value added (after initial values) displayed , values afterwards kind of cut of. i'm aware of this similar issue i'm using labels , it's still not working correctly me. i've made plunkr version of problem, here code: template: <div style="display: block"> <canvas basechart [options]="chartoptions" [data]="chartdata" [labels]="chartlabels" [charttype]="charttype"></canvas> </div> <button (click)="addrandomvalue()">add random value</button> component: export class chartcomponent implements oninit { public charttype: string; public chartdata: number[]; public chartlabels: string[]; public chartoptions: = { responsive: true, maintainaspectratio: false }; ngoninit(): void {

Loading CSS and JS using HTTPS on Wordpress -

i'm trying force https on wordpress site, styles , scripts don't loading. when display page source code chrome can see styles , scripts use http loading, don't understand why. i set https in wordpress general/settings website url , wordpress url. it's fresh wordpress install default theme. i tried add in wp-config.php if ($_server['http_x_forwarded_proto'] == 'https') $_server['https']='on'; it works when want login https://www.mywebsite.com/wp-admin , wordpress display me message: "sorry not allowed access page" any idea? have done replace on database replaces old http urls https? use seperate tool this. place directory in folder have wp-config.php , should connect automaticly database. make backup beforehand; https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

java - Create a dummy PsiFile in IntelliJ -

i'm writing plugin intellij idea changes source code through project's psi. in 1 of classes piece of code , in order apply changes on need create dummy psifile contain code, can't seem find way that. i tried extending psitestcase (although isn't test) doesn't work, because there no initialization of test class. is there way create such file?

python - How does one check if a variable is a sympy expression? -

i wanted check python variable sympy expression. easy check if sympy variable with: isinstance(arg, symbol.symbol) but can't find how do: isinstance(arg, sympy.expression) is possible check if python variable holds sympy expression or variable? as quick check did: expr2 = x-y type(expr2) <class 'sympy.core.add.add'> but don't want have giant series if statement clause checking each possible type of maths expression. seems redundant/silly. it nice able detect when variable of type of sympy related thing , act on (and maybe later check if expression or more detailed...) i think need sympy.expr instead of sympy.expression : in [164]: expr2 out[164]: x - y in [165]: type(expr2) out[165]: sympy.core.add.add but if @ __bases__ of type: in [166]: type(expr2).__bases__ out[166]: (sympy.core.expr.expr, sympy.core.operations.assocop) and so: in [167]: isinstance(2, sympy.expr) out[167]: false in [168]: isinstance(x, sympy.expr)

regex - Want a pattern for preg_match() for given input according to current situation... PHP -

if decimal separator ( point(.) or comma(,) , thousand separator (comma(,) or point(.)) present incoming value should handled pattern. current code if (!preg_match('/^((?:(?:\-?[\d' . $thousandseparator . ']+(?:' . $decimalseparator . '\d+)?)|\s*))\s*(.*)$/', $value, $matches)) { throw_error; } case 1 - $decimalseparator = '.'; $thousandseparator = ','; allowed cases - 45,789.45 45,789.45 cm 789 cm 789.45 cm 1,789 cm 78,789,756.45 not allowed cases - 45.789,78 45.789,78 cm 78.7.78,78 7.8,5 7.8 cm case 2 - $decimalseparator = ','; $thousandseparator = '.'; allowed cases - 45.789,78 45.789,78 cm 789,45 1.789 cm 789 not allowed cases - 45,789.45 45,789.45 cm 789 cm 789.45 cm 1,789 cm 78,789,756.45 78,78,78 cm note - 'cm' centimeter variable, there can inch, mm, km, etc. unit can present or not, if there, need handled. have put unit randomly, please not conside

java - using sleep() in swing -

public class testframe extends jframe { public testframe() { setbounds(10, 10, 500, 500); setlocationrelativeto(null); setdefaultcloseoperation(3); } public static void main(string[] args) throws interruptedexception { testframe tf = new testframe(); tf.add(new jbutton("test1")); tf.setvisible(true); thread.sleep(2000); tf.getcontentpane().removeall(); tf.add(new jbutton("test2")); system.out.print("show test"); } } i want program show jbutton("test2") after 2 seconds. add thread.sleep(2000) after test1 . but don't know why program stops @ showing test1 jbutton , not showing test2 jbutton , "show test" message can sucess print out short answer, don't. swing single threaded framework, means thing blocks event dispatching thread prevent updating ui or processing new events (making ui it's hung, caus

docker-compose, new container version and logs persistence -

quite common use-case docker-compose: a application's code pulled repository using git. a docker-compose.yml looking this: version: '2' services: web: build: ./myapp when want deploy new version pull latest version of code make docker-compose --build -d . works except each time make update erases past logs accessible using docker-compose logs . understand why docker behaves way (even if docker-compose recreates container same name it's still brand new container, it's quite logical logs flushed). still, it's not practical. any 1 has solution ? preferably 1 does not involve modifying images or using volumes store logs. (because should whole point of docker logs, not having worry that). you redirect output log file when starting containers, like: docker-compose --build --no-color --force-recreate &> logs & instead of docker-compose logs tail logs anytime want.

Why is my nested while loop not working? -

i'm programming in robotc, vex 2.0 cortex. i'm using encoders make robot go straight. this code: void goforwards(int time) { int tcount = 0; int speed1 = 40; int speed2 = 40; int difference = 10; motor[lm] = speed1; motor[rm] = speed2; while (tcount < time) { nmotorencoder[rm] = 0; nmotorencoder[lm] = 0; while(nmotorencoder[rm]<1000) { int rencoder = -nmotorencoder[rm]; int lencoder = -nmotorencoder[lm]; if (lencoder > rencoder) { motor[lm] = speed1 - difference; motor[rm] = speed2 + difference; if (motor[rm]<= 0) { motor[rm] = 40; motor[lm] = 40; } } if (lencoder < rencoder) { motor[lm] = speed1 + difference; motor[rm] = speed2 - difference;

deep learning - Where is the implementation of Convolution of tensorflow -

how tensorflow implements convolution operations? know it's based on eigen library , trace launchgeneric.launch in /tensorflow/core/kernels/conv_ops.cc, goes? guess in /third_party_eigen3/unsupported/eigen/cxx11/src/neuralnetworks/spatialconvolutions.h, checked build file under eigen3 , seems file not included compile library. the gpu implementation cudnn. think you're right on cpu implementation, , it's included in build eigen's build file via "eigen/**" (recursive wildcard).

javascript - Hover a element while dragging another element Dragula -

here want drop element when folder collapsed. dragula bag enabled , highlighted when dragged element hovered on other li elements. html code <div drag-folders="folder"> <ul dragula="'folder-bag'"> <li id="{{folder.id}}" ng-repeat="folder in $ctrl.folders" ng- mousemove="$ctrl.makeextradragulafolderbigger(folder.id)"> <div ng-show="$ctrl.shouldshowchildren[folder.id]" ng- click="$ctrl.shouldshowchildren[folder.id] != $ctrl.shouldshowchildren[folder.id]"> right-arrow </div> <div ng-hide="$ctrl.shouldshowchildren[folder.id]" ng- click="$ctrl.shouldshowchildren[folder.id] != $ctrl.shouldshowchildren[folder.id]"> right-arrow </div> <div>{{folder.name}} </div> <ul ng-show="$ctrl.shouldshowchildren[folder.id]" dragula="'folder-ba

C# data chart in x axis shows multiple times cities windows form -

guru's please halp poor padawan. i'm trying display chart values gave in database. in x- axis want example 1 city called "rotterdam", gives me multiple times rotterdam in x-axis other rows. the chart talking about this code using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace windowsformsapplication1 { public partial class form2 : form { public form2() { initializecomponent(); } private void form2_load(object sender, eventargs e) { // todo: line of code loads data 'official_databasedataset.fietsdiefstal' table. can move, or remove it, needed. this.fietsdiefstaltableadapter.fill(this.official_databasedataset.fietsdiefstal); } private void datagridview1_cellcontentclick(object sen

hibernate - How to declare a collection of embeddables which are embedded in another class -

Image
i've got following classes: and following java code: @entity class person implements serializable { // ... @embedded private address address; // ... } @embeddable class address implements serializable { // ... @manytoone @joincolumn(name = "cityid") private city city; } @entity class city implements serializable { // ... // correct way? @onetomany(mappedby = "city") private list<address> addresses; // or should this? // @onetomany(mappedby = "???") // private list<person> persons; // ... } my question is: should city class contain collection of addresses or collection of persons? can choose?

html - Javascript trigger submit button -

this question has answer here: what queryselectorall, getelementsbyclassname , other getelementsby* methods return? 7 answers i tried googled nothing helped me. want trigger following button: <input class="btn btn_large btn_green" value="go" type="submit"> if element id work charm: document.getelementbyid('btn btn_large btn_green').submit(); but since can't assign id button isn't working. if try call via document.getelementsbyclassname("").submit(); it isn't working. thanks in advance you can try document.queryselector() : you can select class using "." , click element submit. var button = document.queryselector('.btn.btn_large.btn_green'); console.log(button); button.click(); <input class="btn btn_large btn_green" value="go&q

How can I detect 'any' ajax request being completed using jQuery? -

i have page can insert javascript / jquery manipulate output. don't have other control on page markup etc. i need add element via jquery after each present on page. issue elements generated via asynchronous call on existing page occurs after $(document).ready complete. essentially, need way of calling jquery after page has loaded , subsequent ajax calls have completed. there way detect completion of ajax call on page , call own custom function insert additional elements after newly created s ? unfortunately doesn't apply since seems op isn't using $.ajax() or jquery ajax method loading content, leaving here in case future googler's doing this. you can use any of global ajax events meet needs here , you're after $.ajaxcomplete() or $.ajaxsuccess() . for example: $(document).ajaxsuccess(function() { alert("an individual ajax call has completed successfully"); }); //or... $(document).ajaxcomplete(function() { alert("all

getting the type of element from array C -

i wondering if possible in c type element in array. have following code, have manually specify type, remove second argument. #define foreach( func, type, list)do {\ int num_elements = sizeof(list) / sizeof(type);\ int iter;\ for( iter = 0; iter < num_elements; iter++)\ func(list[iter]);\ }while(0) void display(int n) { printf("\n%d\n", n); } int main(void){ int list [] = { 1,2,3,4,5,6,7,8,9,10}; foreach(display, int, list); return 0; } for purpose of question - can use sizeof operator on elements of array - sizeof(list[0]) if using gcc (or gnu), there extenstion called typeof . can sizeof(typeof(list[0])) but c way of doing directly use sizeof element.

Mongodb Muliple averages based on a different column -

using mongodb aggregate, there way have query return weight average on scale , average of scale 1 , average of scale 2 all returned in same query? this example of entry in data set { "profile" : "p1", "avgweight" : 639, "time" : "2017-04-14t05:17:42.000z", "scale" : 1, "weight" : 1504, "target" : 680 } my query running averaging weight accrost scales ( might not help, better have more info ) [{ "$match": { "time": { "$gt": moment(start).format("yyyy-mm-dd hh:mm:ss"), "$lt": moment(end).format("yyyy-mm-dd hh:mm:ss") } } }, { "$group": { "_id": { "hou

c++ - Queuing a call in headers -

the goal allow header files "register" initializer function main can iterate on functions , call them. i've stumbled upon solution uses __attribute__ , seems gcc-only ( https://stackoverflow.com/a/37082249/7867841 ). // header1.h void myinitializer(){} register_this(&myinitializer); // header2.h void myinitializer2(){} register_this(&myinitializer2); // main.cpp ... for_each_registered_ptr(){ call_ptr(); } // calls myinitializer , myinitializer2 ... is there universal solution this? functions can switched classes or types if that's easier implement. you can abuse static function locals this, avoiding static initialization order fiasco. in init.h , have this: #ifndef init_h #define init_h #include <vector> // can changed std::function<...> or whatever need. typedef void (*init_fn)(); // returns int can used in variable initializer. int register_initializer(init_fn fn); std::vector<init_fn> & get_initializers();

c++ - Is it good practise to encapsulate a vector using stl iterator? If it is? How could it be done? -

i new c++ , implement encapsulation vector. #pragma once #include <vector> using namespace std; class cell { public: cell(); cell(const cell& cell); void setvector(vector<int> vector[]); vector<int> getvector(void)const; private: vector<int> m_vector; }; i read stl iterators, know if practice implement setvector() method way? if is, give me examples on how done? instead of exposing whole vector, via reference or iterators, should expose member functions of std::vector need. or more precisely: should expose functionality of std::vector need. look @ members provided std::vector : need cell expose, say, allocator_type , back , pop_back , operator>= or shrink_to_fit ? a more robust solution achieves actual encapsulation , not superficial pseudo-encapsulation explicitly delegate required vector member functions cell member functions. example, if need size , individual element access, why not add size me

simulink - "Path" when using signalbuilder command in matlab -

i'm trying use signalbuilder command in matlab script add signal builder block in specific existing model every time try message invalid block path so think problem path variable used in command can't figure out right format it. model have signal_building.mdl. when path empty ( [] ) new model created specified signal builder. code follows: time = 0:0.1:10; data = {sin(time),sinh(time),(time);cos(time),cosh(time),(time).^2;tan(time),tanh(time),sqrt(time)}; groupnames = {'triangular', 'hyperbolic', 'algebric'}; signames = {'data_1','data_2','data_3'}; path = 'c:\users\me\desktop\matlab_learning\signal_building.mdl'; block = signalbuilder(path, 'create', time, data, signames, groupnames); so, i'll appreciate 1 can correct way defining path path path (i.e. heirarchy) within model want block placed. it's not path of simulink model within computer's file structure. for instance,