Posts

Showing posts from June, 2011

c++ - Open cv , Run code in tutorial of Finding contours in your image? -

i'm starting learn how use opencv libraries. i've downloaded , installed opencv 2.4.10 , , have run example " in tutorial of finding contours in image " using visual studio 2010. code compiles, every time run it, crashes, and showing error in image link following message: windows has triggered breakpoint in edgedetection.exe. this may due corruption of heap, indicates bug in >edgedetection.exe or of dlls has loaded. this may due user pressing f12 while edgedetection.exe has focus. the output window may have more diagnostic information. i don't know, reason.here's offending code: #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include <iostream> #include <stdio.h> #include <stdlib.h> using namespace cv; using namespace std; mat src; mat src_gray; int thresh = 100; int max_thresh = 255; rng rng(12345); /// function header void thresh_callback(int, void* )...

java - PDFBox import error in intellij -

pdfbox jar added in intellij(setting> project structure> modules> dependencies) , have added gradle dependency testcompile 'org.apache.pdfbox:pdfbox:2.0.1' in gradle build , build successful.even after importing 'import org.pdfbox...' in java file shows error cannot resolve symbol pdfbox. also tried file->invalidate caches\restart. sometimes, don't need open project structure dialog create library , add dependencies of module. case when there .jar files within project content roots. you can select such .jar files in project tool window , use these files create library. when doing so, able select library level , module dependencies new library should added. in similar way, can use directory containing .jar files create library. open project tool window (e.g. view | tool windows | project). select .jar file or files included in library, or directory contains .jar files of interest. select add library context menu. in create library d...

javascript - how to enable disable dropdown based on the previous selected dropdown using angular js? -

i have dropdown made ng-repeat have disable dropdowns based on condition eg: dropdown process should selected dropdown worktype should enabled: here html : <div class="subcellcreator" id="value"> <div ng-show="l.text" class="textbox"> <input type="text" ng-model="l.model" class="casetext" ng-click="check()" /> </div> <div ng-show="l.dropdown" class="styled-select"> <select ng-model="l.model" ng-options="opt opt in l.options" ng-click="check()" ng-change="changevalue(l.model,l.name)" class="caseselect" ng-disabled="checkdependent()"> <option value=""></option> </select> <div class="select-button"> <div class="small-arrow-down"></div> </div> ...

xml - XSL: how to improve this code? -

sorry, i'm learning xsl , display table this: | param1 | param2 | -------+------+--------- | p1.1 | p1.2 | p2 | -------+------+--------- | a11 | a21 | b01 | | a12 | a22 | b02 | now, have xml: <?xml version="1.0" encoding="utf-8"?> <tb> <col title="param1"> <row name="1"> <stats name="p1.1" >a11</stats> <stats name="p1.2" >a12</stats> </row> <row name="2"> <stats name="p1.1" >a21</stats> <stats name="p1.2" >a22</stats> </row> </col> <col title="param2"> <row name="1"> <stats name="p2" >b01</stats> </row> <row name="2"> <stats name="p2" >b02</stats> ...

javascript - jquery unable to access function parameter inside function with an ajax call? -

hiturl = function (searchurl, nbcity) { $.ajax({ context: this, type: 'get', headers: { "sourceid": "1" }, url: '/webapi/xyz/abc/?' + searchurl, datatype: 'text', success: function (json) { d_usedsearch.similarcars.showsimilarcarlink(searchurl); }); when put breakpoint on 1st line of success of jquery success callback, unable access 'searchurl' in console. undefined. how access this? that's because ajax asynchronous: code function executed parallel code in ajax call. take this answer solution problem.

BOLT won't render the HTML? -

i inputting following html in bolt's wsywig editor: <p>build <strong>profitable products</strong> through</p> what rendered also: <p>build <strong>profitable products</strong> through</p> what expecting is: build profitable products through i have checked config.yml file check if there exists html option no luck. have typed normal wysisyg view or in code view? there button on editor switch source code view can insert html directly.

c# - Azure DocumentDB , Search In Dictionary with LINQ -

hi getting error while using query = query.where(r => r.features.containsvalue(fueltype)); here model public class vehicleresponse { [jsonproperty(propertyname = "id")] public string id { get; set; } public vehicle vehicle { get; set; } public list<string> photourls { get; set; } public string videourl { get; set; } public dictionary<string, string> features { get; set; } public list<string> equipments { get; set; } public vehicleresponse() { this.photourls = new list<string>(); } } documentdb not supporting "containsvalue" method. how should change linq query ? thank you. if define features this: "features": { "tkey": "tk1", "tvalue": "tv1" } you change : query = query.where(r => r.features...

javascript - Some control functions not working in leaflet map after adding bxslider -

Image
i using bxslider in 1 of web application. slider had been initiated successfully. had created separate div displaying maps using leaflet. moment when add slier pan , popup function in map not working. may know wrong?there no error in browser console though. $(document).ready(function () { $('.slider1').bxslider({ slidewidth: 150, minslides: 0, maxslides: 7, moveslides: 5, slidemargin: 20, onsliderload: function(){ $.material.init(); var map = l.map('map').setview([21.14985, 79.080598], 4); var mapquest = l.tilelayer('http://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.png',{ subdomains: '1234', type: 'osm' }).addto(map); var osm = l.tilelayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://osm.org/...

Implementing pagination with Java servlets, MySQL, and Javascript for the front end -

i'm having trouble going through , visualizing how accomplish pagination on large dataset mysql database, java servlets, , using javascript display results. i working on personal project small dataset try , learn java servlets / mysql / javascript. have movie database movie names , other attributes in mysql: create table `movies` ( `id` int(11) not null auto increment, `title` varchar(100) not null default '', `year` int(4) not null, ) engine=innodb default charset=latin1; i have movie java bean: // movie bean import java.io.serializable; public class movie implements serializable { // instance variables private long id; private string title; private int year; public movie() {} // setters public void setid (long id) { this.id = id; } public void settitle (string title) { this.title = title; } public void setyear (int year) { this.year = year; } // getters...

amazon web services - limiting aws ec2 users -

is possible create sub-account or sub-user limited in can see and/or in aws based on tags example? i have tried using policies, instances wouldn't work, because can't limit on resource level. makes either can controll , see everything, or nothing @ all. is there have missed? the question scope wide. please study iam guides , play around iam policy generator condition. playing around arn allow wildcard, still need define explicit prefix/suffix wildcard values. ec2, need understand ec2 resource arn , possible need mix "condition" add restriction. here example of using policy generator policies allow run,start , stop instance, , restrict ec2 resource tag serverx. when attach policy user, can following task. may need add further condition make sure user doesn't see instances belongs others, enforcing tag name creation yourself. { "version": "2012-10-17", "statement": [ { "sid"...

How to filter out certain objects in a table with certain ids? (Rails 4, Postgresql) -

before ask question, provide context. i have 3 models interact each other. scoreboard has many teams. team belongs scoreboard. the following use through table. scoreboard many-to-many user.(let's call scoreboard.followers) team many-to-many user.(let's call team.members) i have team_members controllers following method: team_member#new method: def new @selected = true @scoreboard = scoreboard.find(params[:scoreboard_id]) @team = team.find(params[:team_id]) @team_members = @team.members @followers = @scoreboard.followers.search(params[:search]).paginate(page: params[:page], per_page: 50) end what i'm attempting display scoreboard followers in new.html.erb view. can search through them , add members team associated same scoreboard. here's new.html.erb view: <%= form_tag(new_scoreboard_team_team_member_path, :method => "get", id: "member-search-form", autocomplete: "off...

sql server 2012 - check constraint -

Image
i'm using sql server 2012 management studio. below have write. appreciate help. alter table [tablename] check add constraint [constraintname] check (([column]='a' or [column]='b' or [column]='c' or [column]='d')) but when generate script through sql server 2012 management studio, getting below statements.. alter table [tablename] nocheck add constraint [constraintname] check (([column]='a' or [column]='b' or [column]='c' or [column]='d')) go alter table [tablename] check constraint [constraintname] why generated script first constructed nocheck , apply check on table? happen if create check constraint without nocheck? the generated script uses nocheck, constraint created, if values in table don't comply. better automatically generated script, because ensures database schema created or amended correctly. i thought @ first, second statement in generated script ensure query optimizer conside...

angularjs - How to set modify header in Firefox while writing protractor test for Angular JS? -

i have been able find juliemr's code creating firefox profile, follows: var q = require('q'); var firefoxprofile = require('firefox-profile'); exports.getfirefoxprofile = function() { var deferred = q.defer(); var firefoxprofile = new firefoxprofile(); firefoxprofile.setpreference('browser.newtab.url', 'https://www.angularjs.org'); firefoxprofile.encoded(function(encodedprofile) { var multicapabilities = [{ browsername: 'firefox', firefox_profile : encodedprofile }]; deferred.resolve(multicapabilities); }); return deferred.promise; }; however, i'm not able figure out how modify headers.

List in Customer Paramater Report not being Refreshed -

my customer parameter list not being refreshed after save , reopen crystal report. i created report in 2011 , when run report, customer paramameter comes list of customers choose from. when save , reopen it, list seems disappear. any ideas how fix ? mentioned reuseparametervaluesonrefresh can not set anywhere in crystal reports 2011. problem has disappeared . not sure root cause . vary strange.

php - How to fix session not starting after unsetting a variable -

please have been trying fix not working out right me. have session started after logging out using unset($_session['variable'] , unable login session not setting. please me out. note: unable login after unsetting variable. //this login.php <?php session_start(); ob_start(); $msg = ""; if (isset($_post['login'])){ include "dbconnect.php"; if($_session['emaill'] !== null){ $emaill= $_session['emaill']; $password = $_post['password']; if (empty($emaill && $password) == false){ $sql = "select * `sono` `email`='$emaill' && `password`='$password'"; $check = mysqli_query($dbconnect, $sql) or die (mysqli_error($dbconnect)); $result = mysqli_num_rows($check); if ($result > 0){ $emaill= $_session['emaill']; header ('location: h...

c# - How to select data via partial view -

i have partial view returns list of users address's, need user able select one, when press "submit" along other details takes details selected address returns controller, there know how assign want. how this? examples , appreciated here controller creating order, view beneath; [httppost] public actionresult addressandpayment(formcollection values, string id) { var order = new order(); tryupdatemodel(order); //sets date , username order.username = user.identity.name; order.orderdate = datetime.now; //order gets saved storedb.orders.add(order); storedb.savechanges(); //order gets processed var cart = shoppingcart.getcart(this.httpcontext); cart.createorder(order); //save again, total not saving until storedb.savechanges(); return redirecttoaction("complete", new ...

admin - Magento2 : Update category, URL key already exists error -

i have created new category , not visible in navigation menu of now. adding products via code , working. now editing category show in navigation menu, throws error "url key specified store exists". i tried to: unassigned products, throws same error. changed url, left blank or changed value of url. please let me know. clear db table url_rewrite but! categories only. otherwise mess cms pages links. after doing error should gone.

jquery - animate scrolling matching the name not working fine -

$("a.scroll").click(function(){ if(this.hash){ //get rid of hash var hash = this.hash.substr(1); //get position of <a name> var $toelement = $("a[name="+hash+"]"); var toposition = $toelement.offset().top - 250; //scroll/animate element $("body,html").animate({ scrolltop : toposition },1000,"easeoutexpo"); return false; } }); if(location.hash){ var hash = location.hash; window.scroll(0,0); $("a[href="+hash+"]").click(); } when trying match name string , scrolling location hiding behind header, header fixed.. on scrolling.. and facing problem when resize window, header takes space , scrolling hides content behind.. how fix it// the <a> element doesn't have hash member. check console errors before posting. need href attribute's content. might needing this: $("a.sc...

symfony - FOSElasticaBundle and Gedmo translatable -

i want use foselasticabundle on symfony2 project. both bundles correctly configured , functionals. i use gedmo translatable handle multilingual cannot find how implement gedmo translations in elastic mapping or build elastic query results chosen locale. anyone experienced problem ?

javascript - no run function jquery on mobile -

i have animation on scroll page in jquery, in mobile wired. how can set-up jquery not show animation in mobile browser? tin main.js have other function want keep both browser. if animation: $(function() { var $elems = $('.animateblock'); var winheight = $(window).height(); var fullheight = $(document).height(); $(window).scroll(function() { animate_elems(); }); function animate_elems() { wintop = $(window).scrolltop(); $elems.each(function() { $elm = $(this); if ($elm.hasclass('animated')) { return true; } topcoords = $elm.offset().top; if (wintop > (topcoords - (winheight * .90))) { $elm.addclass('animated'); } }); } }); thanks!

Django Template Save operation result into a variable -

i have listing counter "2370" , page shows "12" item want calculate pages number, did solution below {% widthratio listing.total_count 12 1 %} so, how can save result variable? {% set total_pages = widthratio listing.total_count 12 1 %} this 1 didn't work if choose rohans comment, if write own templatetags, use assignment_tag ( https://docs.djangoproject.com/en/1.7/howto/custom-template-tags/#assignment-tags , exists since django 1.4). @register.assignment_tag def page_numbers(total_items, items_per_page): if not total_items: return 0 # int divisions round down (1 / 12 = 0), add 1 cover return total_items / items_per_page + 1 within template should use; {% page_numbers listing.total_count 12 page_nrs %}

javascript - intercept form submit response -

i want intercept form's submit response via javascript. submit done submit button or jquery's .submit() (with no params). there way intercept submit response like; .submit().done(callback) i know .submit() not have support this, creating post request finding every input in form , getting values data object pass .post() method seems bit clumsy me. besides there no advantage of using <form> tags in html in approach. any suggestions this? no, can't. besides, when .submit() or click submit button, page unloads , new page loads. means java script on page gone there no point in having callback.

javascript - Generate PDF Report in Meteor js -

i close generate pdf report in meteor js many folks out there. code runs till end, ends having error { [error: enoent, open 'report.pdf'] errno: 34, code: 'enoent', path: 'report.pdf' } below code snippet using generate pdf list. layout.html <head> <style type="text/css"> {{css}} </style> </head> <body> {{> template.dynamic template=template data=data}} </body> report.html <body> <div class="container"> {{#each voters}} <h4>{{name}}</h4><br> {{/each}} </div> </body> server/method.js var total = voters.find() meteor.methods({'generate_pdf': function() { console.log("--------inside pdf generation module----------"); var fs = npm.require('fs'), future = npm.require('fibers/future'), fut = new future(), filename = "report.pdf...

jquery fade doesnt work after clone? -

i have div has animation attached , animation works perfectly, when clone effect not work more? jquery $(document).ready(function () { $('button').bind('click', function () { var parents = $(this).parents('.display'); parents.clone(true).appendto('body'); }); $('img').fadein("slow"); }); html <html> <div style="display:block; position:relative;" class="display"> <div> <button class="close">close</button> <h3>camera ready</h3> <p>lorem ipsum dolor sit amet etc...</p> </div> <img src="" /> </div> </html> try this... $(document).ready(function () { $("button").on("click", function () { var parents = $(this).parents(".display"); parents.clone(true).appendto(...

java - How to scroll to bot of listview -

this question has answer here: listview scroll end of list after updating list 9 answers i have list view filled data server , when user swipe bot add 8 items list problem scroll go top every time when user scroll. how can set scroll got last item in list. tried listview.smoothscrolltoposition(merchantadapter.getcount()); it's not working here implementation of refresh method swipyrefreshlayout = (swipyrefreshlayout) rootview.findviewbyid(r.id.refreshsales); swipyrefreshlayout.setonrefreshlistener(new swipyrefreshlayout.onrefreshlistener() { @override public void onrefresh(swipyrefreshlayoutdirection direction) { if (direction == swipyrefreshlayoutdirection.bottom) { index++; swipyrefreshlayout.setrefreshing(false); showlist(); progressbar.dismiss(); ...

git branch - git checkout with different node_modules folder -

i have 2 branches, 1 called "gh-pages" , other "master" branch. both having separate folders "node_modules", different. , untracked! so when checking out e.g. "gh-pages" branch follows git checkout gh-pages i need way specify git should not remove (but save) tracked, untracked files , folders (like "node_modules" folder) "master" branch. , load tracked files , folders "gh-pages" branch , untracked files , folders. is there simple way or need remove untracked files , folders each checkout 2 not come cross? this not possible in git. definition untracked files part of file system , not git's version control. git checkout updates files in working tree match version in index or specified tree. if no paths given, git checkout update head set specified branch current branch. so when checkout branch working copy of files in branch. since untracked files node_modules not part of specific b...

html - CSS to change image URL -

how can use entirely separate css file change/override url image image.png? <div id="id1" class="class1"> <div id="id2" class="class2"> <div class="class3"> <div id="id3"> <a class="logo" href="http://domain.com" tabindex="-1"> <img src="https://image.png"></img> </a> </div> </div> </div> </div> thanks much! you can't change css, need javascript that. if trying change image on example hover, remove img-tags , use div instead on set background-image. in css can create block change image on hover.

android - Suppressing Keyboard popup for a single Edittext -

long story short, have date picker dialog pops on click edittext attribute. working fine, except when dialog pops soft keyboard. not want disable keyboard other attributes on page, , not want leave is, because not sloppy , clunky, means user can mess lovely formatted date object goes nicely in database. not good. i've tried disabling element in xml file both clickable , editable, no avail. code below, usual. <edittext android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/edittextexpirydate" android:inputtype="date" android:hint="card expiry date" android:editable="false" android:clickable="false" android:layout_below="@+id/edittextsecuritycode" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_alignright="@+id/spinnercardtype" android:lay...

swing - Detecting Hough circles JAVA OpenCV -

Image
i confused exception is. first time coding detection program public static void chargement(mat img) { nbyte = (int) (img.total() * img.elemsize()); buffer = new byte[nbyte]; img.get(0, 0, buffer); } public static point[] detectcercle(mat img, int rayon) { mat circles = new mat(); point[] circleslist = null; imgproc.houghcircles(img, circles, imgproc.cv_hough_gradient, 1, 60, 200, 20, 30, 0); system.out.println("#rows " + circles.rows() + " #cols " + circles.cols()); double x = 0.0; double y = 0.0; int r = 0; (int = 0; < circles.rows(); i++) { double[] data = circles.get(i, 0); (int j = 0; j < data.length; j++) { x = data[0]; y = data[1]; r = (int) data[2]; } circleslist[i] = new point(x, y); } return circleslist; } public static void main(string[] args) { system.loadlibrary(core.native_library_name); mat matimage1 = imgc...

haskell - Relational Mapper for C# that keeps the relational model -

currently application uses ado.net , manual mapping of results. the reasons are: many orms seem have rather unpredictable side-effects lazy loading orms not give developer power sql can provide i dislike code thats generated in build-step the approach things hand has proven rather (too) tedious, not able find orm solves these problems c#. a promising appoach seems to map sql programming language used (make edsl database access). i found several of projects in haskell: opaleye haskelldb esqueleto those projects can add type saftey id columns, cannot make join on columns not related. are there similar projects c# still developed , allow pocos (or otherwise unit-testable design)?

ibm mq - Error AMQ4036 when trying to add a QueueManager to a Cluster in IBM MQ? -

i trying setup mq cluster has following config there 3 host machines, ubuntuvm-1, ubuntuvm-2 , ubuntuvm-3 ubuntuvm-1 has 1 full repository queue manager , 1 partial repository queue manager. qm_fr1, qm_pr1 ubuntuvm-2 same above. qm_fr2, qm_pr2 ubuntuvm-3 has 1 partial repository queue manager, qm_pr3 following steps have taken i have created cluster receiver channels on each queue manager point own queue manager. i have created cluster sender channels point @ least 1 full repository. have made sure channels correct, see tests pass when run them through mq explorer. i error when using mq explorer, try add qm_fr1 queue manger cluster (cluster1). following error. access not permitted. not authorized perform operation. (amq4036) severity: 10 (warning) explanation: queue manager security mechanism has indicated userid associated request not authorized access object. why getting error , how fix this? please shout if want me provide more details.

mysql - Table with many columns or many small tables? -

i created table has 30 columns. create table "settings" ( "column1" integer primary key, ... ... "column30" ) however, can group them , create different table can have foreign keys primary table. best way follow? or number of columns small it's same way follow? it depends on data , query do. best 1 big table if need extract columns always if need update many fields @ same time if fields or quite have not null values best many little tables if data "sparse" means not many columns have values can imagine split them in different tables , create record in child table if not null values exists if extract few related fields @ 1 time if update related fields @ 1 time better names each column (for example instead of domicile_address , residence_address can have 2 columns named address in 2 tables residences , domiciles) the problem can use both solutions depending situation. usage analysis must done choose ...

pdo - how to fix Allowed memory size PHP -

this question has answer here: fatal error: allowed memory size of 134217728 bytes exhausted (tried allocate 87 bytes) 5 answers i following error: fatal error: allowed memory size of 134217728 bytes exhausted (tried allocate 65488 bytes). <?php session_start(); require'class/db.php'; $db = new clsdb(); $getrows = $db->getrows("select * category"); echo "<form method=\"post\" action=\"category.php\"> <table>"; while($row = $getrows->fetch()){ ?> <tr><td><input type="checkbox" name="checkbox[]" value="<?php echo $row['catid'] ?>"><?php echo $row['catname'];?></td> <br /> </tr> <?php } ?> </table> <input type="submit" ...

Appending to lists in Python -

i trying continually add values list; keeping values there until program exits. import sha1 def stored_hash(hash): hashes = [] hash_extend = [hash] hashes.extend(hash_extend) return hashes loop = 1 while loop == 1: data= raw_input('enter text hash: ') hash = sha1.run(data) store = stored_hash(hash) print store i have program called sha1 creates hash of input text. want store hash in list above hashes , able add more each time loop completes list getting larger , larger. how go this? i'm bit lost why can't append value end of list , print whole list out existing hash values present. @ moment 1 hash value no matter how many times loop completes. do need make global list? just pass list in argument: import sha1 def stored_hash(store, hash): store.append(hash) store = [] loop = 1 while loop == 1: data = raw_input('enter text hash: ') hash = sha1.run(data) stored_hash(store, hash) prin...

python - Mongoengine filter query on list embedded field based on last index -

i'm using mongoengine django. i have embedded field in model. list field of embedded documents. import mongoengine class orderstatuslog(mongoengine.embeddeddocument): status_code = mongoengine.stringfield() class order(mongoengine.dynamicdocument): incr_id = mongoengine.sequencefield() status = mongoengine.listfield(mongoengine.embeddeddocumentfield(orderstatuslog)) now want filter result on order collection based on last value in status field. e.g. order.objects.filter(status__last__status_code="scode") i guess there no such thing __last . tried approach mentioned in docs http://docs.mongoengine.org/guide/querying.html#querying-lists didn't work. i can solve looping on documents in collection thats not efficient, how can write query efficiently. i'm not sure mongoengine can (yet). afaik, you'd need use aggregation pipeline. in mongo shell, using '$slice' , $arrayelemat operators: db.order.aggregate([{ $p...

Error: XML document structures must start and end within the same entity -

i new xml , getting below error: error: xml document structures must start , end within same entity input xml: <?xml version="1.0" encoding="iso-8859-1"?> <root> <test> <access1>113al</access1> <access2>119al</access2> </test> <test> <access2>115al<s/access2> <access3>116al</access3> </test> <test> <access4>118al</access4> <access5>119al</access5> </test> <copies> <test2> <access>113al</access> <copy>y</copy> </test2> <test2> <access>113ax</access> <copy>n</copy> </test2> </copies> </root> your xml not well-formed. in general, error indicates wrong range of start , end tags. in particular in case, have stray s in 1 of closing access2 tags: <access2>115al<s/access2> here xml problem resolved; well-formed (and ...

php - Can't find value in select2 ajax loading in yii2 -

i use select2 ajax loading. code link: http://demos.krajee.com/widget-details/select2 . when enter words field, display data/value, can't automatic select data/value according words enter field. so, select2 select first data/value , display value. what's problem? these codes: _form.php $url = url::to(['/paket/jsonlist']); $citydesc = empty($model->no_induk) ? '' : penerima::findone($model->no_induk)->nama; echo $form->field($model, 'no_induk')->widget(select2::classname(), [ 'initvaluetext' => $citydesc, // set initial display text 'options' => ['placeholder' => 'search city ...'], 'pluginoptions' => [ 'allowclear' => true, 'minimuminputlength' => 1, 'language' => [ 'errorloading' => new jsexpression("function () { return 'waiting results......

python - odoo 8 multiple page navigation controller -

i have created module in odoo 8. purpose of module create page link page. mean @ first main template rendered , there link sub page. works fine till main page. have controllers.py, models.py, views(default.xml). in openerp .py value of 'data' : 'views/default.xml'. controller : @http.route('/test/', auth='public') def index(self, **kw): return http.request.render('test.main',{ 'root':'/test' }) @http.route('/test/sub', auth='public') def sub(self, **kw): return http.request.render('test.sub',{ 'root':'/test' }) in template, u have 2 ids ( namely main , sub ) <openerp> <data> <template id='main'> <div class='body'> test body click go next page : <a t-attr-href = "#{ root }/sub">next page</a> </div> <div class='footer'...

javascript - Highcharts heat map not displaying properly -

i'm trying create heat map using highcharts it's not loading (just lines instead of heat map itself). i'm loading data json file: chart: { type: 'heatmap', margintop: 40, marginbottom: 80, plotborderwidth: 1 }, xaxis: { categories: $scope.loaddays() }, yaxis: { categories: $scope.loadhours(), title: null, reversed: true }, series: [{ name: null, borderwidth: 1, data: [], datalabels: { enabled: true, color: '#000000' } }] $scope.getheatmapdata = function(data) { var response = []; $scope.data = data; if(data && $scope.data.timestamps && $scope.data.info) { $scope.data.timestamps.foreach(function(element, index) { if ($scope.data.info[index]) { response.push([ moment(element).day(), moment(element).hour(), $scope.data.info[index] ]); } }); } return response; }; the data being logged correctly console but, reason, heat map is...

python - max, min value of list of lists at 1st column -

hey have short question. lets have list of lists, example: ([[[362, 239]], [[362, 367]], [[386, 367]], [[386, 239]]]) how can max value column 1 , 2 seperatly answer example should be: col1_max = 386, col2_max = 367 i tried: col1_max = max(cnts.iteritems(), key=operator.itemgetter(1))[0] print col1_max but here errorcode: "attributeerror: 'list' object has no attribute 'iteritems'" thanks :d update: 1st deepspace hlp far i phrase question again in different way right want write code to detect objects centers of these the code far is: import imutils import cv2 import os, os.path dir = 'pics/' numberofpictures = len([name name in os.listdir(dir) if os.path.isfile(os.path.join(dir, name))]) for in range(0, numberofpictures): image = cv2.imread('pics/' + str(i) + '.png', 0) thresh = cv2.threshold(image, 60, 255, cv2.thresh_binary)[1] cnts = cv2.findcontours(thresh.copy(), cv2.re...

How does wordpress display plugins? -

i can sort of see logic in displaying plugin information via shortcode. i'd assume putting shortcode on post, add echo do_shortcode post file. what don't understand when there no shortcode, such rating plugin using. the plugin has folder in website information stored. information displayed on front page (post rating) there no code in index.php calls of plugin files. where wordpress call plugin files loaded , how can see file being loaded? the vast majority of plugins use hooks in order implement functionality. can find list of these hooks on wordpress developer site here . one of commonly used examples wp_enqueue_scripts , used implement front-end styling , javascript files. take wordpress stack exchange , here , more information on how filters , hooks powered.

javascript - Dynamically refresh a part of the template when a variable is updated golang -

Image
in golang, possible refresh part of template when variable updated ? can find in angular.js instance. basically in code, lookup adresses postcode in ajax, display list of addr found postcode. here sample of template : at moment, ajax calls go routine. don't want result in js , build html result of ajax call. i like, if possible, update addresses value (it's array) build list of addr dynamically. any clue ? the template engine not support out-of-the-box. so have implement yourself. it's not hard. here steps should follow achieve it: 1. refactor templates separate template renders addresses on own using {{define "name"}} action. may put in different template file , include in current place using {{template "name"}} action, or may leave in original place , use new {{block "name" pipeline}} t1 {{end}} action (introduced in go 1.6) defines template , executes @ once. 2. modify/create handlers make sure have hand...

android - RecyclerView GridLayoutManager: change column width -

Image
i have recyclerview , gridlayoutmanager. columns width equal want first column 80dp width. possible? example: recyclerview width 5 columns final columnscount = 5; recyclerview.width = 500dp column0.width = 80dp column 1-2-3-4 width = (recyclerview.width - column0.width) / columnscount any advice? edit: code public class testrecyclerviewadapter extends recyclerview.adapter<recyclerview.viewholder> { private static final int view_type_start = 0; private static final int view_type_progress_item = 1; private layoutinflater inflater; public testrecyclerviewadapter(context context) { this.inflater = layoutinflater.from(context); } @override public int getitemviewtype(int position) { if (position == 0) { return view_type_start; } else { return view_type_progress_item; } } @override public recyclerview.viewholder oncreateviewholder(viewgroup parent, int viewtype) { ...

AWS API Gateway - Encoding -

Image
i want create mock service , return static json message. when write "kayıt dondurmuş" , becomes "kay?t dondurmu?" how can fix encoding problem? attach sample result view topic. this appears display issue console - this. however, actual invocation use correct unicode characters. have confirmed test input in test invoke deployed invoke. thanks, ryan

ruby on rails - Can Devise allow multiple emails for password recovery? -

i have following situation: person model includes userable : class person < activerecord::base include userable end this userable has many emails: module userable extend activesupport::concern included has_one :user, as: :userable has_many :emails, as: :emailable, dependent: :destroy end end email has model too: class email < activerecord::base belongs_to :emailable, polymorphic: true validates :address, presence: true, format: { with: /\a[a-za-z0-9._%+-]+@([a-za-z0-9.-]+\.)+[a-za-z]+\z/} end and finally, user model: class user < activerecord::base # devise properties devise :database_authenticatable, :rememberable, :trackable, :timeoutable, :recoverable end i'm trying create "forgot password" thing recover user password sending email user. problem 'email' not method @ user . so, when load path "users/password/new" gives me error: undefined method `...

sorting - Ranking in Excel, when I want the top n I get the top n+1 (or n+x) -

i have list in excel , i'd select higher 3 results, , 3. seems easy conditional formatting in example: 1 | 2 | 3 | 4 | 5 | 6 44 | 78 | 98 | 45 | 52 | 98 where 2nd, 3rd , 6th number highlighted. the problem appears this: 1 | 2 | 3 | 4 | 5 | 6 44 | 78 | 78 | 45 | 87 | 98 excel highlight 2nd, 3rd, 5th , 6th number, because first 2 (the third on sorted list) equal. how can make excel select 1 of them? (the solution doesn't need use conditional formatting, tools available on excel can used, formulas vb, simplicity it's desirable). for conditional formatting, need break tie. 1 way count number of times value appears in previous comparisons. this change conditional formula to =(rank(a2,$a$2:$f$2)+countif($a$2:a$2,a2)-1)<=3 note absolute positions used in cases, , relative in others. breakdown: rank(a2,$a$2:$f$2) - rank formula. know one, you're using now countif($a$2:a$2,a2) - count number of times value appears - note refere...

ms access - Is there a way for a .mdb file to be emptied by itself -

i must read .mdb file on 15 minutes interval. problem file emptied each day @ 15:45 pm. , somehow loose data in interval gap. i have searched cron jobs/scheduled task on server , found nothing know if there way set .mdb database empty @ specific time? thanks there no built-in way configure access database empty itself. has done either vba-code/macros inside database or external application/script accessing database , deleting everything. if database emptied @ specific time without user interaction, there has kind of scheduled task this. if absolutely data deleted, might possible whole database overwritten fresh/empty template somewhere. - still has done scheduled task. if database stored on network share, accessible other computers, task deleting data might run on computer.

c - Connection loss detection with poll() -

i making client server application. in application if client went down server try reconnect ( i.e. if recv() on server side returns 0 value server go accept connection ). want modify server allowing connect multiple clients. thought of using poll() server check on each client sometime. wanted know poll how can check if connection client lost? when use multiplex io poll , can handle connection shutdown following events: pollin when there data read, , when read or recv function call, make sure checked return value, typically return value of 0 indicates connection has been shutdown. same previous single client version. pollrdhup indicates peer has closed connection, or shut down writing half of connection. pollerr other errors. when 3 event triggered, means client has closed connection or there errors on socket, typically close sockets.