Posts

Showing posts from September, 2013

returning a multidimensional array with explicit return type in c++ -

i have class has member defined as: float u[2][2]; now have accessor function , return reference array. so, have like: const float & [2][2] mat() const { return u; } is there way return using kind o syntax rather pointer syntax (i think makes things more explicit). it's awkward, but: const float (&mat() const)[2][2] { return u; } using typedef or decltype might better, eg: const decltype(u) &mat() const { return u; } or: using mat22 = float[2][2]; const mat22 &mat() const { return u; } (this latter 1 suggested daniel h. in comments). or, in c++14, just: const auto &mat() const { return u; }

How to plot mixed-effects model estimates in ggplot2 in R? -

Image
i have 2x2x2 factorial design 1 random effect. data (dat) follows: colour size level marbles set blue large low 80 1 blue large high 9 2 blue small low 91 1 blue small high 2 1 white large low 80 2 white large high 9 1 white small low 91 2 white small high 2 1 i want plot 2 models: mod1 <- lmer(marbles ~ colour + size + level + colour:size + colour:level + size:level + (1|set), data = dat) mod2 <- lmer(marbles ~ colour + size + level +(1|set), data = dat) i use following code plots: pd <- position_dodge(0.82) ggplot(dat, aes(x=colour, y=marbles, fill = level)) + theme_bw() + stat_summary(geom="bar", fun.y=mean, position = "dodge") + stat_summary(geom="errorbar", fun.data=mean_cl_boot, position = pd)+ + facet_grid(~size) i'm unsure on how replace terms coefficients model estimates. ideas on how can plot ...

(Android)changing the game window size and re-positioning it -

i'm making top-down shooter android platform , i'm trying screen portrayed in added image( orange rectangles virtual buttons). following code being run before game starts change game window size fit device's screen: ///display properties display_width=display_get_width(); display_height=display_get_height(); ideal_width=0; ideal_height=display_height; aspect_ratio=display_width/display_height; ideal_width=round(ideal_height*aspect_ratio); //ideal_height=round(ideal_width / aspect_ratio); //perfect pixel scaling if(display_width mod ideal_width != 0) { var d = round(display_width/ideal_width); ideal_width=display_width/d; } if(display_height mod ideal_height != 0) { var d = round(display_height/ideal_height); ideal_height=display_height/d; } //check odd numbers if(ideal_width & 1) ideal_width++; if(ideal_height & 1) ideal_height++; for(var i=1; i<=room_last; i++) { if(room_exists(i)) { room_set_view(i,0,true,0,0,720,1280,60,60,720,1280,0,0,0,0,-...

react native - How to test a Saga with an API call? -

i have saga export function* mysaga(api, action) { const response = yield call(api.service, action); yield put(navactions.goto('page', { success: response.ok })); } that calls api , return value navigate screen passing api call result ( response.ok ). it('test', () => { // ... const gen = mysaga(api, action); const step = () => gen.next().value; // doesn't run api const response = call(api.service, {}); expect(step()).tomatchobject(response); // ok // error, cannot read property 'ok' of undefined expect(step()).tomatchobject( put(navactions.goto('page', { success: response.ok })) ); }); since it's not running api call response doesn't defined. i don't know should test scenario. how test second step of saga? by default, yield expression resolves whatever yielded. however, can pass value gen.next method , yield expression resolved passed there. so should trick (untested): con...

html - setting the focus on the nav bar -

does know css , html code can use set focus on nav bar. in other words want page tab such home page highlighted when user on home page. if user go's contact page contact page nav bar tab should highlighted. you can in html/ccs providing pages have classes or id's. using home example: html <body class="home">... <li class="home>...</li><li class="other>...</li> css .home li.home { ... } .other li.other { ... } this won't set :focus give visual effect desire.

android - Copy file with hook -

i'm working ionic application , need replace mainactivity generated, new 1 create. since use ibm mfp analytics plugin , other tests. the hook creates: #!/bin/bash gulp build in hook folder have: hooks ---- before_build ---- mainactivity.java all_before_build.sh lo que necesito es agregar este hook la linea cp mainactivity.java platforms/android/src/cl/my_app/android/ however, when execute hook error: cp: cannot stat 'mainactivity.java': no such file or directory i know error not find file mainactivity.java , if is, explained above directory. edit the previous problem solved, leaving full path of mainactivity.java, when run application, works fine opens notepad code.

javascript - How to make keydown or keypress to be handled only by the current focused element -

i have sort of single web page app in have 2 different views (divs) displayed both in same time on page. the first view has ui grid on navigation feature have eventlisteners keydown , keypress detect tab or arrow keys being pressed , navigate cell cell on grid. in second view have form many fields , 1 of them textarea multiline input (see biography field in the md-input demo page ). textarea needs navigation on lines while editing. when arrow keys pressed both grid , textarea react , navigation occurs in both when textarea focused. i have tried apply $event.stoppropagation(); , event.stopimmediatepropagation() on grid root element when textarea focused didn't work. possible prevent keydown , keypress handlers being executed in whole first view , let happen in second view ? how prevent happen in element , children ?

customization - iTop - Get caller's IP in tickets -

in itop, how possible save caller's ip address in tickets (user request , incident) i tried modify datamodel.itop-tickets.xml in extension module. added field named 'ip' in <methods> section can not client's ip using $_server['remote_addr'] . <methods> <method id="dbinsertnoreload" _delta="redefine"> <static>false</static> <access>public</access> <type>overload-dbobject</type> <code><![cdata[ public function dbinsertnoreload() { $omutex = new itopmutex('ticket_insert'); $omutex->lock(); $inextid = metamodel::getnextkey(get_class($this)); $sref = $this->maketicketref($inextid); $this->set('ref', $sref); $ikey = parent::dbinsertnoreload(); $omutex->unlock(); return $ikey; $this->set('ip', $_server['r...

logging - Servicemix - Removing the text field from a log entry -

i using servicemix route between activemq queues. <bean id="kubeactivemq" class="org.apache.activemq.camel.component.activemqcomponent"> <property name="brokerurl" value="tcp://172.9.9.6:30785" /> </bean> <camelcontext xmlns="http://camel.apache.org/schema/blueprint"> <route> <from uri="kubeactivemq:queue:///smx_consumes_from_here" /> <to uri="log:ebipmastermessage?level=info&amp;maxchars=0" /> <to uri="kubeactivemq:smx_produces_here-2" /> </route> </camelcontext> the custom logger using configured follows. # root logger log4j.rootlogger=debug, out, stdout, osgi:vmlogappender log4j.throwablerenderer=org.apache.log4j.osgithrowablerenderer # avoid flooding log when using info level on ssh connection , doing log:tail log4j.logger.org.apache.sshd.server.channel.channelsession=info #...

PHP array in another array issue -

hy, trying output in array in implode function gives me weird error. code below. $users_balance = users::all_uww_balance(); // query take balance users $users_pay = array(); foreach($users_balance $user_balance) { $users_pay[] = formatbtc(converttobtcfromsatoshi($user_balance->balance)); } $users_wallet = users::all_uww_wallet(); query take addresses users $users_pay_wallet = array(); foreach($users_wallet $user_wallet) { $users_pay_wallet[] = $user_wallet->wallet; } try { $withdrawinfo = $block_io->withdraw(array('amounts' => implode(", ", $users_pay), 'to_addresses' => implode(", ", $users_pay_wallet) )); echo "status: ".$withdrawinfo->status."\n"; echo "executed transaction id: ".$withdrawinfo->data->txid."\n"; echo "network fee charged: ".$withdrawinfo->data->network_fee." ".$withdrawinfo->data->network....

c# - Entity Framework 'column does not allow nulls' -

yet again amazing entity framework has failed make simple, simple... have created basic set of models, company, county, user's have m:1 relationship company. have table created called companyusers believe generate table design like. however cannot enter basic user database claiming cannot have null userid though setting id. i understand table design weird, may want switch m:m relationship , having table setup nice that. secondly, having data in 3 tables makes writing sql queries easier because of joins. exact error: system.data.sqlclient.sqlexception: cannot insert value null column 'userid', table 'ssi.database.context.software.dbo.users'; column not allow nulls. insert fails. seed: var _company = new company() { companyid=1, name="company inc." }; var _counties = new list<county>() { new county(){ name="place1" }, new county(){ name="place2"} }; context.companies.addorupdate(_company); ...

linux - install profile manager mobileconfig file via command line with smb or afp with no mount -

i manage network of mac's , usual install macs profiles via command line so /usr/bin/profiles -i -f /users/shared/turstprofile.mobileconfig what copy profiles users shared folder 1 task , run unix command install them. wondering if possible access file via smb or afp instead of locally without need mount share first? or have mount? something like /usr/bin/profiles -i -f //server.domain.com/profiles/turstprofile.mobileconfig

hyperledger fabric - hyperledger_fabric first-network fails with BAD_REQUEST -

this question similar first network in hyperledger except attempting run automated scripts described here: http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html rather executing steps manually. when run supplied scripts, following output: build first network (byfn) end-to-end test channel name : mychannel creating channel... core_peer_tls_rootcert_file=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerorganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt core_peer_tls_key_file=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerorganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key core_peer_localmspid=org1msp core_vm_endpoint=unix:///host/var/run/docker.sock core_peer_tls_cert_file=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerorganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt core_peer_tls_enabled=true core_peer_mspconfigpath=/opt/gopath/src/github.com/hyperle...

c# - Create custom xml (ASP.NET MVC) -

i have method values database here code public iqueryable<timetable> gettimetables() { return db.timetables; } here model of timetable public partial class timetable { public int id { get; set; } public string company { get; set; } public string inn { get; set; } public string startday { get; set; } public string startpause { get; set; } public string endday { get; set; } public string endpause { get; set; } } i need generate xml values this <data> <worker id="000000000000"> <start>2016-08-08t08:00:00</start> <pause>2016-08-08t13:15:49</pause> <continue>2016-08-08t13:15:49</continue> <end>2016-08-08t13:15:49</end> </worker> <worker id="000000000001"> <start>2016-08-08t08:00:00</start> <pause>2016-08-08t13:15:49</pause> <continue>2016-08-08t13:15:49</continue> <...

node.js - AWS MongoDB Instance not reachable from Web Server Instance -

i have 2 ec2 instances first 1 node js app server second 1 mongo db server. cant reach database server app server or else. i can ping app server(private , public ip adress) mongodb server cant ping mongodb server(private , public ip adress) app server. can ssh both. the mongodb server has mongod config file network field : network bind: [0.0.0.0, private_ip_of_instance] anyway believe cant problem. can access mongo db within instance , query well. status of mongod service on mongodb server active. the output log of mongo db instance says waiting connections on port 27017 my nodejs environment on app server has config file points private_ip of mongo db server instance on port 27017 along database name. the ufw firewall of mongodb instance has following status 22 allow anywhere 27017 allow public_ip_address 27017 allow private_ip_address 80/tcp allow ...

java - Activity send data to Fragment with interface -

Image
i want activity send fragment. have error see below photo. activity fragment data send. want when listview onclick fragment il value temp data. fragment want see humidity value ,temp value when setonitemclicklistener mainactivity.java public class mainactivity extends appcompatactivity { private string text ; private textview textview, textview2,textview3,textview4; private searchview searchview; private listview listview ; private string[] il={"adana", "adıyaman", "afyon", "ağrı", "amasya", "ankara", "antalya", "artvin", "aydın", "balıkesir", "bilecik", "bingöl", "bitlis", "bolu", "burdur", "bursa", "Çanakkale", "Çankırı", "Çorum", "denizli", "diyarbakır", "edirne", "elazığ", "erzincan", "erzurum", "eskişehir...

php - Laravel - Count registrations status per event -

struggling relationships - using laravel 5.4, have 3 tables event id name other fields.. registration id event_id status_id other fields... status id name other fields... status model public function registrations() { return $this->hasmany(registration::class); } event model public function registrations() { return $this->hasmany(registration::class); } registration model public function statuses() { return $this->belongsto(status::class, 'status_id'); } public function events() { return $this->belongsto(event::class, 'event_id'); } and eventscontroller looks public function findregistrations($id) { $viewevent = event::find($id)->registrations; return view('events.details', compact('viewevent')); } i need count number of statuses per event, because have different statuses new revie...

mysql - How to count new users in last month in SQL? -

Image
i want know how many new users have last month, , how many of them have turned buyers while can not figure out smoothly.the following coded. select count(distinct(product_id)) order_table o inner join customer_table c on o.customer_id=c.customer_id datediff(month,order_date,getdate())<=1 and there question has confused me lot: category have highest year year growth in terms of revenue in 2016? this should it... select count(customer_id) customer_table customer_id in ( select customer_id order_table ) , datediff(month, first_visit, getdate()) <= 1

apache - How can I setup a django site in a vps -

i trying setup django site in vps, hosted in hostgator. have done on apache server once in different system. httpd.conf file did not have nameserver , multiple enteries whm , cpanel on system. followed documentation , successful it. vps bit confused. tech guys in hostgator not helping. help appreciated. in advance. i can't work apache. first tried apache configurations end nginx tutorial: https://www.shellvoide.com/hacks/installing-django-application-with-nginx-mysql-and-gunicorn-on-ubuntu-vps/

notepad++ - how to use regex to add leading zero -

this question has answer here: using regex add leading zeroes 10 answers question - shortest form of regex add leading 0 found pattern? i want add leading 0 number matches regex pattern [(][0-9][0-9][0-9][0-9][-][0-9][0-9][0-9][0-9][-][0-9][0-9][)] i using notepad++. in notepad++ regex replace, use $n represent nth capture group replacement: search for: [(]([0-9][0-9][0-9][0-9][-][0-9][0-9][0-9][0-9][-][0-9][0-9])[)] replace with: (0$1)

3 Histograms on one axis - Matplotlib python -

Image
i trying create graph has 3 histograms on 1 axis. want them overlap each different color. insides semi-transparent. whenever use multiple colors rgb alpha 0.5, colors overlap , create nasty color. how portray 3 graphs without producing nasty color? still want graphs overlap in same nature, in way aesthetically pleasing. have seen graphs overlap, can still see each histograms color distinctly. thanks you may use colors call "good graph" follows: import matplotlib.pyplot plt import numpy np; np.random.seed(42) x1 = np.random.rand(15)*3 x2 = np.random.rayleigh(size=15) x3 = np.random.binomial(3,0.7,size=15) bins= np.linspace(0,4,11) kw = dict(bins=bins, histtype='step', fill=true) plt.hist(x1, fc=(.14,.57,.14,.4), ec=(.14,.57,.14, 1), **kw) plt.hist(x2, fc=(.16,.16,1.0,.4), ec=(.16,.16,1.0, 1), **kw) plt.hist(x3, fc=(1.0,.14,.14,.4), ec=(1.0,.14,.14, 1), **kw) plt.show()

c# - Unity transform.LookAt() not updating with a moving target -

my camera casts ray centre of screen , have object looks @ direction. problem is, made such keys rotate camera, there's new centre, , ray camera moves object doesn't @ new direction here's code: void update (){ int x = screen.width / 2; int y = screen.height / 2; //get centre of screen camera ray ray = camera.main.screenpointtoray (new vector3 (x, y)); debug.drawray (ray.origin, ray.direction * 1000, new color (1f, 0.922f, 0.016f, 1f)); //set object direction object.transform.lookat (ray.direction); } i'd appreciate this, thank you! i found solution. instead of looking @ ray direction, got point ray using getpoint , made object @ that. it's working fine now.

Android data binding on drawable -

i hv 2 shape drawables, rounded_corners.xml , rounded_corners_red.xml used show valid text input , invalid text input respectivly. i want drwable set dynamically when user click on login button such if valid text show rounded_corners.xml , if invalid show rounded_corners_red.xml. below how hv put in layout xml. <edittext android:id="@+id/et_ip" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@={systemsettings.isvalid ? @drawable/rounded_corners : @drawable/rounded_corners_red}" android:text="@={systemsettings.serverip, default=@string/ip_host}" android:textcolor="#000000" /> i want drawable applied dynamically based on isvalid observable varible defined in model class. code compiles no errors. gives run time error java.lang.runtimeexception: found data binding errors. ****/ data binding error ****msg:the expression ((systemsettingsisvalidget) ? (getdrawablefromre...

flask - How to save markdown from a WTForm in a database using SQLAlchemy? -

i have blog making create posts in 'edit' route using markdown in text area box. however, when save post, converts of formatting in weird ways. instance, when have apostrophe, such in word doesn't this: doesn&amp;amp;#39;t here form code: class item(db.model): __tablename__= 'item' id = db.column(db.integer,primary_key=true) title = db.column(db.string(80),unique=false) content = db.column(db.string(80),unique=false) x = db.column(db.float) y = db.column(db.float) category_id = db.column(db.integer, db.foreignkey('category.id')) order = db.column(db.integer) def __init__(self,title,content,x,y,category_id,order): self.title = title self.content = content self.x = x self.y = y self.category_id = category_id self.order = order here edit route handles saving object in sqlalchemy: @app.route('/edit/<itemid>',methods=('get','post')...

javascript - Cannot load static text from local file into js variable with jQuery $.GET -

i'm developing google chrome extension. have static countrylist.js file placed locally in same folder file code below. want load countrylist.js content js variable of second file, code doesn't work, though works if countrylist.js placed on remote server. doing wrong? can not place on server because forbidden chrome extensions. var countrylist = $.get("countrylist.js" + localstorage.uid + "&ver=" + localstorage.version, function () { callback() } possible duplicate: how can load local file using jquery? (with file://) get requires http connection, without local web server won't work. while can open , read file using html5, can't load javascript resource way. if page loaded locally, you'd load js using script tag. <script type='text/javascript' src='/objectdata.js'></script>

shiny - Suddenly I get "Error : $ operator is invalid for atomic vectors" -

i've been developing shiny app no issues. when try run following error: error : $ operator invalid atomic vectors warning: error in $: $ operator invalid atomic vectors stack trace (innermost first): 68: tag 67: tags$a 66: tag 65: tags$li 64: fun 63: lapply 62: buildtabset 61: tabsetpanel 60: tag 59: tags$div 58: div 57: tabpanel 56: tabsetpanel 55: tag 54: tags$div 53: div 52: fluidrow 51: tag 50: tags$div 49: div 48: hidden 47: tag 46: tags$div 45: div 44: taglist 43: attachdependencies 42: bootstrappage 41: fluidpage 1: runapp error : $ operator invalid atomic vectors however, there's no indication of error occurring doesn't specify variable. know cause such error? app has 1000s of lines of code it's not practical share here.

xaml - Setting Grid RowDefinitions/ColumnDefinitions properties in a style -

suppose have 2 or more grids share same structure (rows/columns count , properties equal). is possible create style , set rowdefinitions / columndefinitions ? i have tried that. exception when application tries parse xaml: xamarin.forms.xaml.xamlparseexception: position 14:9. property value null or not ienumerable my source code: <stacklayout> <stacklayout.resources> <resourcedictionary> <style targettype="grid"> <setter property="rowdefinitions"> <setter.value> <rowdefinition /> <rowdefinition /> </setter.value> </setter> </style> </resourcedictionary> </stacklayout.resources> <grid> <label grid.row="0" text="(grid #1) row #1" /> <label grid.row=...

Parse Android SDK issue -

i'm developing app use parse sdk. working years ago, not working , crashing. debugging on android studio 2.2.3 , debug app when generated apk file , installed on phone, app crashed. when debugging on android studio 2.3.3, crashed , couldn't debug it. here log of crash fatal exception: main process: com.steaklocker.steaklocker, pid: 2308 java.lang.illegalaccesserror: method 'void bolts.task.()' inaccessible class 'bolts.taskcompletionsource' (declaration of 'bolts.taskcompletionsource' appears in /data/app/com.steaklocker.steaklocker-1/base.apk:classes10.dex) @ bolts.taskcompletionsource.(taskcompletionsource.java:18) @ com.p...

algolia - How can I display lvl1 options in a separate container? -

a widget of mine defined so: search.addwidget( instantsearch.widgets.hierarchicalmenu({ container: '#hierarchical', attributes: ['region.lvl0', 'region.lvl1'], cssclasses: { active: 'active' }, templates: { item: menutemplate } }) ); this leads navigation display so: region.lvl0 region.lvl0 (selected) > region.lvl1 > region.lvl1 > region.lvl1 region.lvl0 region.lvl0 is possible render lvl1 facets in separate container? instance, lvl0 displayed in list format. when user selects lvl0 region, dropdown populates lvl1 facets in separate area refine search further. if isn't possible, possible current lvl1 attributes , manually send query algolia new attribute (similar algolia search helper)? thanks! you can take @ connectors encapsulate logic needed making search widgets. you'll have provide function in order rendering you'd see.

c++ - How to toggle click event using SDL? -

what i'm trying accomplish: when user clicks in game, tile user clicks on display border if user clicks again (anywhere) border goes away what have far: when user clicks in game, border appears around selected tile what can't seem figure out (i've tried can think of) how border go away after click about code: i have mouseinput class checks if left mouse button pressed. i'm using boolean variables try toggle variable display tile border (if clicked) or not display border (if clicked again). code have allow border display can't go away on click. can't show things tried (been trying 2 days , can't remember did lol). sumary of code far: bool toggle; // set false in constructor bool justpressed; // set false in constructor bool justreleased; // set false in constructor void mouse::update() // custom mouse class updating function (updates position, etc) { input.update(); // mouseinput class updating function. if (input.left() ...

angular material - AngularJS: Not able to store data to an object -

i'm trying store captured data form in object using angular-material dialog box form capture. related part of controller looks like $scope.attendees = [{ firstname: "", lastname: "", email: "", phone: "" }]; $scope.addattendee = function(ev) { $mddialog.show({ controller: dialogcontroller, templateurl: 'views/regform.tmpl.html', parent: angular.element(document.body), targetevent: ev, clickoutsidetoclose:true, fullscreen: $scope.customfullscreen // -xs, -sm breakpoints. }) }; function dialogcontroller($scope, $mddialog) { $scope.hide = function() { $mddialog.hide(); }; $scope.cancel = function() { $mddialog.cancel(); }; $scope.saveattendee = function(attendee) { str = json.stringify(attendee, null, 4); $mddialog.hide(attendee); ...

php - How to write a function for a separate post template that will be applied by category? Wordpress -

good afternoon, there such task. there 2 categories, , posts of these 2 categories 1 post template should used. use code, not fit, have create separate template each category. (and need have 1 template). add_filter('single_template', 'check_for_category_single_template'); function check_for_category_single_template( $t ){ foreach( (array) get_the_category() $cat ){ if ( file_exists(templatepath . "/single-category-{$cat->slug}.php") ) return templatepath . "/single-category-{$cat->slug}.php"; if($cat->parent){ $cat = get_the_category_by_id( $cat->parent ); if ( file_exists(templatepath . "/single-category-{$cat->slug}.php") ) return templatepath . "/single-category-{$cat->slug}.php"; } } return $t; } this function changes below whould work. i assume have templatepath defined. also need go slides ...

python 2.7 - Adding the three highest numbers out of four randomly generated numbers -

i'm randomly generating 4 numbers. 4 numbers want take highest 3 , add them together. using variables r1, r2, r3, , r4 how go doing this? // in c++ float f1 = 1, f2 = 2, f3 = 3, f4 = 4; float sum = f1 + f2 + f3 + f4; sum -= min(f1, min(f2,min(f3, f4); cout << "answer = " << sum << endl; answer = 9

c# - ASP.NET MVC Binding Value in View -

struggling value drop down, passed controller db inserting. starts simple class each item in drop down. public class selectlisturgencynum { public string text { get; set; } public string value { get; set; } } then in view model create list of these objects such.. public class createviewmodel { public change changevm { get; set; } public list<requesttype> rtypes { get; set; } public list<selectlisturgencynum> listurgency { get; set; } } finally controller populate list displayed in dropdown. public actionresult create() { var urgnums = new list<selectlisturgencynum>(); for(int = 1; < 6; i++) { urgnums.add(new selectlisturgencynum() { text = i.tostring(), value = i.tostring() }); } var viewmodel = new createviewmodel { listurgency = urgnums }; return view(viewmodel); } i used 1 - 5 make simpler understand. my view creates ddl...

php - Undefined index error, multiple db connections in file -

i have php file/script running in powershell meant connect 1 db server, select info, connect db/server , insert info. i having problems connections, have working, except when run script in powershell slew of errors, 5 exact (which matches records in database currently) undefined index. this affects line 51 through 55 happen end of code, values section, starting on duplicate key line. table in mysql workbench has exact same column names, index values, etc. test table has execute script testing in workbench. calling values incorrectly in insert statement? <?php $servername = "//"; $username = "//"; $password = "//"; $servername2 = "//"; $username2 = "//"; $password2 = "//"; // create connection $conn = new mysqli($servername, $username, $password); $conn2 = new mysqli($servername2, $username2, $password2); // check connection if ($conn->connect_error) { ...

if statement - Why does python use 'else' after for and while loops? -

i understand how construct works: for in range(10): print(i) if == 9: print("too big - i'm giving up!") break; else: print("completed successfully") but don't understand why else used keyword here, since suggests code in question runs if for block not complete, opposite of does! no matter how think it, brain can't progress seamlessly for statement else block. me, continue or continuewith make more sense (and i'm trying train myself read such). i'm wondering how python coders read construct in head (or aloud, if like). perhaps i'm missing make such code blocks more decipherable? it's strange construct seasoned python coders. when used in conjunction for-loops means "find item in iterable, else if none found ...". in: found_obj = none obj in objects: if obj.key == search_key: found_obj = obj break else: print 'no object found.' but anytime se...

python - End literal block in list item -

i have list item in rst file put literal block into, unable literal block end properly. this rst: 1. item 1 (not literal) 2. item 2:: mycode.example() description of code shown above (not literal) i paragraph starting description outside literal block above it, still part of list item #2. workaround have been able come this: 1. item 1 (not literal) 2. item 2: :: mycode.example() description of code shown above (not literal) this allows non-literal text return previous level of indentation, making way want to. however, have :: in first line of list item. is possible end literal block explicitly in way allow :: stay in first line of list item? yes. whitespace tricky. have 1 leading space in code , line starting "description". try this: 1. item 1 (not literal) 2. item 2:: mycode.example() description of code shown above (not literal) note first letters of item , description vertically align , code blocks in...

Heroku Java WAR app that was working now failing: "Unable to access jarfile webapp-runner-7.0.40.0.jar" -

This summary is not available. Please click here to view the post.

easier way to format lines of code in Java to make your job easier? -

i making application uses api , prints out information thing. gets api , if system.out.println(result.getplayer().get("displayname")); return display name of player searching for. wondering if there way make result.getplayer().get("displayname") variable because have hundreds of statistics need gather. possible have line of code called displayname ? sorry if don't understand. i suggest make special statistics/logging class has static methods this. example case, following class can used both name , print it. of course can combine them single method if want 1 functionality. public class statslog { public static string getplayerdisplayname(final result result) { return (result == null) ? null : result.getplayer().get("displayname"); } public static void printplayerdisplayname(final result result) { final string displayname = getplayerdisplayname(result); if (displayname != null...

tensorflow - How to Retrain Inception's Final Layer for New Categories -

i used retraining example inception on tf retrain inception error if try classify image. used following code - code classification wrong or there problem memory allocation? import tensorflow tf import sys # change see fit image_path = 'c:/tmp/test.jpg' # read in image_data image_data = tf.gfile.fastgfile(image_path, 'rb').read() # loads label file, strips off carriage return label_lines = [line.rstrip() line in tf.gfile.gfile("c:/tmp/output_labels.txt")] # unpersists graph file tf.gfile.fastgfile("c:/tmp/output_graph.pb", 'rb') f: graph_def = tf.graphdef() graph_def.parsefromstring(f.read()) _ = tf.import_graph_def(graph_def, name='') tf.session() sess: # feed image_data input graph , first prediction softmax_tensor = sess.graph.get_tensor_by_name('final_result:0') predictions = sess.run(softmax_tensor, \ {'decodejpeg/contents:0': image_data}) # sort show labels of first predictio...

apache kafka - JDBC source connect producing duplicate messages -

i using confluent 3.2.1 platform. use-case incrementally read oracle table based on timestamp column , send records kafka topic using jdbc source connect. running connect in distributed mode on 3-node cluster. connector config below -- { "name" : "voice_source_connector_jdbc", "config" : { "connector.class" : "io.confluent.connect.jdbc.jdbcsourceconnector", "connection.url" : "jdbc:oracle:thin:crystal/crystal123@x.x.x.x:1521:testdb", "mode" : "timestamp", "tasks.max" : 1, "query" : "select * crystal.voiceedrs", "timestamp.column.name" : "rec_timestamp", "topic.prefix" : "voice" } } i tried many times different combination of parameters times getting duplicate rows subsequent inserts oracle table after first insert. if insert 100 rows @ beginning, 1...