Posts

Showing posts from August, 2014

Continuously drawing object using Qt and C++ -

i have 1 problem can't solve using internet. have label , set pixmap on it. put on main window (widget) button (qpushbutton) too. want that: if click on button on pixmap drawn circles continuously if click button second drawing must stopped function pause() the second 1 easy, it's empty slot: void pause() {} but @ first i've tried use loop while(true) draw(); but crashed program (loop). any idea how solve it? you should never block main thread. cause os consider application has hanged. in fact practice move code, execution takes more 50 milliseconds thread keep main thread responsive, in case of qt, gui thread. you should use event driven approach, not block thread. class yourclass : public qobject { // qobject or derived q_object public: yourclass() { connect(&timer, &timer::timeout, this, &yourclass::draw); } public slots: void start() { timer.start(33); } void pause() { timer.stop(); } private: qtimer ...

javascript - Wordpress - Video Popup Not Working -

i created own wp theme. added js carousel. in each part of carousel have description , video below it. can see here @ www.tvstartup.com problem video suppose pop play not work. in cases , in others not. here sample of code: <div class="carousel_item"> <div class="image"> <img src="<?php echo get_template_directory_uri(); ?>/images/final/internet-tv.png" alt="internet tv" /> </div> <div class="caption"> <h2>internet tv</h2> <p>ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehender.</p> <div class="btn-wrap"> <div class="button"> pricing </div> <div class="button" id="contact"> ...

python - Filter data using pandas -

i have data id date sec buy 5211153 2016-06-13 18:48:55 119 1 5211153 2016-06-13 18:50:54 66 0 5211153 2016-06-13 18:57:09 2 1 5211154 2016-06-13 18:57:12 118 0 5211154 2016-06-13 18:59:08 20 0 5211154 2016-06-13 18:59:34 25 0 5211154 2016-06-13 18:59:59 11 0 5211154 2016-06-13 19:00:11 12 1 i want print data buy = 0 before every buy = 1 . try code for i, (id, date, buy) in enumerate(zip(ids, dates, buys)): if buys[i] == 1: print ids[i], dates[i] while buys[i-1] != 1: print dates[i - 1], buys[i - 1] but return not want desire output: 5211153 2016-06-13 18:57:09 1: 5211153 2016-06-13 18:50:54 5211154 2016-06-13 19:00:11 1: 5211154 2016-06-13 18:57:12 5211154 2016-06-13 18:59:08 5211154 2016-06-13 18:59:34 5211154 2016-06-13 18...

ruby on rails - Get validation errors only on #valid? -

i have model field validating content in field. using activerecord validations check presence of content. however, want able save, update, etc, without checking validity. want validity @ 1 specific time, , retrieve errors it. validates :my_content_in_field, presence: true, if: :should_validate attr_accessor :should_validate i want pass valid? and fail valid?(should_validate: true) and after failed validation want updates , saves work per usual. possible? want leverage activerecords error messages, not validate otherwise. at end of day on friday, may missing obvious. i'm not sure can call valid?(should_validate: true) . valid? method may called 1 parameter called context (see docs ). should read a great post on validation contexts . this should work: class mymodel < activerecord::base validates :something, on: :should_validate ... end m = mymodel.new m.valid? # no validation happens m.valid?(:should_validate) # validates ...

Spring web socket - Cannot locate BeanDefinitionParser for element [message-broker] -

i'm trying add spring-websocket dependency in spring web app. i have added dependency in pom.xml: <dependency> <groupid>org.springframework</groupid> <artifactid>spring-websocket</artifactid> <version>4.2.4</version> </dependency> and have created xml configuration equivalent @enablewebsocketmessagebroker, indicated here: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-enable so, have spring-socket-context.xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:websocket="http://www.springframework.org/schema/websocket" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/websocket http://www.sp...

javascript - DOM keeps being rebuilding with angular-selectize ng-repeat and track by -

i'm using angularjs angular-selectize module. to populate page elements need use this: index.html <selectize ng-repeat="select in selects_data track $index" config="selectizeconfig" options="select.options" ng-model="selects_models[select.name]"> </selectize> controller.js $scope.update_data = function(){ //i'm using angularjs resource json data server $scope.selects_data = statestablecontrol.get({'path': $scope.element.path}, function(data){ //success angular.foreach(data, function(item){ $scope.selects_models[item.name] = item.current_id }); }, function(error){ //error } ); }; $scope.update_data(); $interval($scope.update_data, 3000); no matter whether use track $index , track select.name or don't use @ all, of <selectize></selectize> elements redrawing every time upd...

c# - Using context connection=true for SqlConnection -

i have simplified class: public abstract class basedaservice { private readonly string _connectionstring; protected basedaservice(string connectionstring) { _connectionstring = connectionstring; } protected idbconnection openconnection() { idbconnection connection = new sqlconnection(_connectionstring); connection.open(); return connection; } } here connection string comes config file. use credentials config files whilst doing: new sqlconnection("context connection=true") can adapt connection string in config file or manipulate 'connection' instance of idbconnection achieve this? i suggest use sqlconnectionstringbuilder class // default parameter set false can still use // same code before , change spots // context required protected idbconnection openconnection(bool usecontext = false) { string newconstring = _connectionstring; if(usecontext) { ...

ant - hbm2dll java.lang.ExceptionInInitializerError -

i'm trying use ant taks hbm2dll every time try execute it, have java.lang.exceptionininitializererror. here's ant task: <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.hibernatetooltask" classpathref="generatepath"/> <!-- copy hibernate properties file generated.path --> <copy todir="${basedir}/${output.path}/${generated.path}/classes" file="${basedir}/${input.path}/${data-model.path}/hibernate.properties"/> <hibernatetool destdir="${basedir}/${output.path}/${generated.path}/classes"> <jpaconfiguration persistenceunit="${data-model-package}.dm_${data-model-version}"/> <classpath> <path location="${basedir}/${output.path}/${generated.path}/classes" /> </classpath> <property key="default-cascade" value="save-update"/> <property key="defaultcascade" value="sa...

ios - How to change UITableView content insets only if keyboard covers view? -

i have view controller contains tableview. reuse view controller in multiple places in app, inside of split view controller , within popover on ipad. i added observers listen keyboard showing/hiding, , change content insets based on keyboard height. works whenever view controller full screen height, doesn't work in popover, popover resizes , tableview not covered keyboard, leaving me bunch of empty space. is there solution this? how can change content insets if keyboard covers view? you need find how of table view keyboard cover, , set inset much. /* keyboard rect (which screen coordinates) in tableview coordinates */ cgrect endframescreen = [[note.userinfo objectforkey:uikeyboardframeenduserinfokey] cgrectvalue]; cgrect endframewindow = [tableview.window convertrect:endframescreen fromwindow:nil]; cgrect endframeview = [tableview convertrect:endframewindow fromview:nil]; if (!cgrectintersectsrect(tableview.bounds, endframeview)) { /* keyboard not cover our ...

html5 - Javascript Canvas Blank Image -

i trying make tshirt customizer fabricjs. working fine .. can upload image , load canvas. image placed on tshirt, if want see(or send server) canvas image blank image. my code : document.getelementbyid('imgloader').onchange = function handleimage(e) { var reader = new filereader(); reader.onload = function (event) { var imgobj = new image(); imgobj.src = event.target.result; //imgobj.crossorigin = 'anonymous'; $('#imagecanvas').val(event.target.result); imgobj.onload = function () { // start fabricjs stuff imgobj.width = 100 imgobj.height = 100 var image = new fabric.image(imgobj); image.set({ top: 100, left: 100 , padding: 10, cornersize: 10, }); //image.scale(0.1).setcoords(); ...

Increment %z hex numbers with VIM? -

is there way increment %z hex numbers vim? typically can doing ctrl + a normal numbers. unfortunately using old school system uses %z rather 0x denote hexadecimal numbers. i've tried set nf=hex but sadly works 0x hex numbers. come across before? haven't found on google machine. i don't know %z prefix; tried quick , dirty function increment numbers %z0f; want? should able add mapping (but not since used in function!) :map <c-p> :call myincrement()<cr> of course should customize according needs; line 17 reset position of cursor after incrmeenting; may want replace l:c l:b (or maybe l:a ) , choose most. function! myincrement() let l:l = line(".") let l:c = col(".") let l:a = 0 let l:b = 0 let l:s = search('%z[0-9a-f]\+', 'bcw',l:l) if l:s == l:l let l:a = col(".") let l:s = search('%z[0-9a-f]\+', 'ecw',l:l) let l:b = col(".") if ((l:a...

svn - How to make git commit only tracked files -

i've started use git , it's driving me nuts. if i'm understanding way git works correctly: even if file tracked have add staging pool before committing it. only files in staging pool committed local repository. when non tracked file added staging pool 'git add' automatically becomes tracked file. when tracked file deleted 'git rm' (or 'git rm --cached' if don't want deleted fs) delete 'action' inserted staging pool implemented in local repository on next 'git commit'. however, if have 100 tracked files have been modified adding them individually in preparation commit pretty tedious. when svn commit root of tree subversion default commit tracked files have been modified added 'svn add' or deleted 'svn rm' . so question is, there single git command 'svn commit' does, i.e. add , commit tracked files have been modified or deleted , not add every single solitary file in tree staging pool? ...

jpa - Entity Session bean - Persist Data into table and use the created Id to persist another table -

am new jpa , have learned lot forum. have problem. i have 2 tables (members , member_next_of_kin). memberid auto incremental column in members table the member_next_of_kin has referenced column memberid members tabke mandatory i have method create new member. public void addmember(members member) { try { createnewmember(member); nok.setmemberid(getmemberid()); addnextofkin(nok); } catch (exception e) { context.setrollbackonly(); } } public members createnewmember(members member) { memberfacade.create(member); return memberid; } my aim persist create member , return created memberid , use insert in nextofkin table. please show me how within transaction. memberid returning null. in jpa model required behavior relationship - in case @onetomany instead of plain reference identifier of other entity. jpa object-relational mapping, think in terms of oo design. lets try model possible based on informati...

java - How to get attribute value? DomParser -

this question has answer here: getting attribute value in xml element 3 answers i have method: private static void print(nodelist nodelist) { (int = 0; < nodelist.getlength(); i++) { node t = nodelist.item(i); if (t.getnodetype() == node.element_node) { system.out.println("node: " + t.getnodename()); system.out.println("values " + t.gettextcontent()); system.out.println("------------------------------"); } if (doc.haschildnodes()) { print(t.getchildnodes()); } } } it displays contents of xml document: <card> <thema>people</thema> <type sent="true">advertising</type> <country>india</country> <year>1966</year> <authors>...

garmin - Entering the main menu in the Connect IQ Simulator -

i unsuccessful entering main menu in connect iq fenix3 simulator. tried holding "up" key in watch, there way so? it's been few months since used environment, far can remember "watch simulators" not support button press. used round watch simulator, has buttons on simulator fires actions required. after compile , deploy though works 100%. would nice if of them had that.

magento - Add custom CSS file in the header for only one language -

i want add custom css file arabic language. i found how add css file local.xml this <action method="additem"><type>skin_css</type><name>css/custom_style.css</name></action> but want specify 1 language only. any idea how implement behavior? in layout file can use code outside of default tag <layout version="0.1.0"> <store_arabic> <reference name="head"> <action method="addcss"> <stylesheet>css/custom_css.css</stylesheet> <params>media="screen"</params> </action> </reference> </store_arabic> <default> ... </default> </layout> 'arabic' store code.

Python convert list of one element into string with bracket -

how convert python list containing 1 element string bracket? more 1 element, easy me just use tuple(list['a','b']) returns tuple ('a','b') if element one, returns ('a',) rather want return ('a') sample: mylist = ["a", " b"] print tuple([s.strip() s in mylist]) >> ('a', 'b') mylist = ["a"] print tuple([s.strip() s in mylist]) >> ('a', ) #rather want return ('a') avoid relying on default __repr__() method, format strings, might change. be explicit intent instead print "('" + "', '".join(mylist) + "')"

c# - ASP.NET Web Application with Windows Authentication not working inside Web Server -

build intranet site mapped sub domain address under windows authentication hosted on web server (windows server 2012 iis 8).authentication works fine when tested outside web serve under same domain. issue: unable authenticate application inside web server using sub domain address though prompt of user name & password not authenticate because of not resolves external style sheet & images. following current setting asp.net web application web site address: subdomain.domain.xx\subsite application pool using integrated windows authentication iis 8 authentication setting: asp.net impersonation & windows authentication status enabled using default iis port iis binding: default port mapped subdomain.domain.xx unsigned iis binding: default port mapped blank hosted server ip address. please advice setting missing sort issue.. first, make sure logging in domain, e.g. yourdomain\yourusername. you test page shows thinks (identity). may running applicat...

github - Git errors while pushing -

Image
i input "git add -a" , gives me error: "fatal: unknown index entry format 65540000". i looked every other sources , not figure out means. then, tried pushing using sourcetree , got error below: all added codes , few imagefiles. not sure causing problem. last commit did month ago, btw. first commit after upgraded xcode 7.0 version. thanks this first commit after upgraded xcode 7.0 version then try clone again repo xcode7, , add change in new local repo. should work better in clone entirely managed new xcode.

loops - Incompatible types: Card cannot be converted to java.lang.String -

i keep getting error code. can't seem find problem. i'm not sure because looked in text book , gives me similar method except different variables. i'm on bluej. public int findfirstofplayer(string searchstring) { int index = 0; boolean searching = true; while(index < cards.size() && searching) { string cardname = cards.get(index); // error highlights index if(cardname.contains(searchstring)) { searching = false; } else { index++; } if(searching) { return -1; } else { return index; } } } here problem, , if used eclipse or idea, highlight you. string cardname = cards.get(index); obviously, cards not compatible string, can't assign way, because collection card not of type string aka arraylist<string> cards can either: string cardname = cards.get(index).tostring(); or string cardna...

How to add a new Image every few seconds in a innerHTML tag without breaking "<br>" JavaScript, HTML5 -

i trying create basic game ledges jump on, wanted figure out. question is, using innerhtml tag insert new image every few seconds, when breakes <br> itself. how add new image in innerhtml tag without breaking? function landt() { document.getelementbyid("land01").innerhtml += "<pre><img src =\'images/platform00.png\'></pre>"; movemyp(); } function movemyp() { var thistimer = settimeout(movemyp, 500); moveblock1 = moveblock1 - 10; document.getelementbyid("land00").style.left = moveblock1 + "px"; } your images inside pre block element . you can modify display css property inline or redesign code not use pre tag. have considered using createelement function instead of innerhtml ? difference explained here

javascript - Send User Name in URL from google sites to internal IIS page -

how send name of user logged on page google sites (intranet) page located on iis server. example: matheus logged on intranet (google sites). upon entering home page, run script take user name created in google sites. example variable "webspace.user.username" or other location. , create tag following feature: how send name of user logged on page google sites (intranet) page located on iis server. example: matheus logged on intranet (google sites). upon entering home page, run script take user name created in google sites. example variable "webspace.user.username" or other location. , create tag following feature: <a href="ip servidor?variable="+nomeuser> access </a> build method of recovering in iis page url variable: querystring function (parameter) { var loc = location.search.substring (1 location.search.length); param_value var = false; var params = loc.split ( "&"); ...

python - Inferring whether an integer/string is a unix timestamp -

let's have list of different integers (either integers, or strings), such as: 1,2,100,84,12,109 i know fair degree of accuracy probably not unix timestamp series. however, following series of numbers, estimate be: 1446250200, 1446250220, 1446240220 is there way estimate whether list of integers unix timestamp series? need have function date parsing -- 1 guesses whether field integer or timstamp (and if guesses incorrectly user can override that). function like?

php - CodeIgniter: passing value in the main page using Ajax -

i need pass value in index() of controllor called product. here jquery code: $(document).ready(function(){ $('.call-edit-pdf').on('click',function(){ var vid = $(this).data('id'); $.ajax({ type: 'post', data:{vid:vid}, url:'<?php echo site_url('product');?>', success: function(result) { $('#val-ajax').html(result); } }); }); }); this product controller public function index(){ //pass value in related view $data['c_vid'] = $this->input->post('vid'); $data['modal_edit_pdf'] = $this->load->view('modal/edit-pdf', $data, null, true); .... } using scripts above cannot pass value in index() of product controller. not know if jquery url wrong or not: url:'<?php echo site_url('product');?>' your quotes buggy. use url:'<?php echo site_url("product");?>', or url:'<?php echo site_url(\...

html - Fixed Navigation with Dropdown -

so have been working on designing navigation in css. want fixed navigation dropdown menu on couple. can etiher top navigation or dropdown can't both. have suggestions? css: body {margin: 0; font-family: 'sf comic script';} .topnav-brand { float: left; margin-left: 30px; padding: 15px 15px; font-size: 24px; line-height: 20px; height: 24px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25); } .topnav-brand:hover, .topnav-brand:focus { text-decoration: none; color: #5e5e5e; background-color: transparent; } ul.topnav { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #7a003d; background-image: -webkit-linear-gradient(top, #ad0057 0%, #7a003d 100%); background-image: -o-linear-gradient(top, #ad0057 0%, #7a003d 100%); background-image: -webkit-gradient(linear, left top, left bottom, from(#ad0057), to(#7a003d)); background-image: linear-gradient(to bottom, #ad0057 0%, #7a003d 100%); background-repeat: repeat-x; filter: progi...

angularjs - Angular directive for form elements -

i want create directive used form elements input,textarea,select... my code: app.directive('input', function() { return { restrict: 'e', priority: -1000, require: '^?required', link: function (scope, element, attrs, ctrl) { element.on('focus', function (e) { element.addclass('validate'); }); } }; }); when try use common directive doesn't work don't have idea why... <input common-directive type="text" name="name" placeholder="firstname" ng-model="profile.name" ng-minlength="2" required />

downloading transaction history from paypal -

i'm trying transfer , process paypal transactions made on web web-based system use tracking our sales history. while may seem easy , common problem, i'm striking out on approach accomplishing this. ipns not option (long story, trust me) apparently rest api lets download transactions created rest api not ones originated web page (seems pretty silly) reviewing "classic" apis see bunch of interfaces none focused on downloading transaction histories. so - big question - what's best way download transaction histories? thanks, steve if api doesn't offer data want, have automate browsing , scraping task. suggest selenium and/or python requests + lxml.

vector - Barcode file reading c++ -

forum. i've been bit stuck few days in lab assigned last week. it's supposed lab write code program acts pos (point of sale) system allowing user put items in cart , @ checkout display each item ordered, price, quantity , total. here more detailed list of requirements assignment can whole picture: no global variables or global constants allowed in lab, except file name. your program must read inventory data stored in file labdata.txt , load data 4 separate vectors: a. 1 vector barcodes b. 1 vector product description c. 1 vector quantity available (inventory) d. 1 vector unit price (must contain prices 2 decimal places read file) not using vectors earn 0 lab. these parallel vectors. the data file provided has 4 items. file format is: bar code, item description, inventory quantity, , unit price must add 2 more items file use. use real items found in household in order store real barcodes , product names. can determine price , quantity available. when...

sql - How to Query Data for Certain Result -

okay here data set event_id | workernumberid 3 | worker1 3 | worker2 3 | worker2 3 | worker3 5 | worker4 5 | worker5 3 | null 5 | null i want query return below. though eventid 3 has 2 'worker2's still want count 1 non null item because same. event_id | workernumberidcount (a count of not null items) 3 | 3 5 | 2 thoughts? try this select event_id,count(distinct workernumberid) workernumberidcount tablename workernumberid not null group event_id

javascript - keep spring form select value -

i use spring mvc 4 bring list , show on website <s:select path="almacenesbyalmori.codalm" id="select1" name="select1" onchange="tr_enviaralmacen('select1');" items="${listalmacen}" itemvalue="codalm" itemlabel="nomalm" class="form-control input-sm"></s:select> <script> function tr_enviaralmacen(sel){ var cbox = document.getelementbyid(sel); var valor = cbox.options[cbox.selectedindex].value; var red = "getprodxalm?cod_alm="+valor; location.href = red; } </script> as can keep option of select spring form selected reloading page? view rendered server everytime refresh(i mean 'hard refresh' without browser caching) page, means model refreshed , proper selected values injected in view(the values wich posted , saved). to keep selected option while refresh page have use ajax. need http po...

css3 - Multiply bested DIV, inner div full height with flexbox only - possible? -

i have complex layout in have div generated javascript dynamic height, called ".outer" . div has nested divs, leading div called ".target". need target div @ ".outers" height. , don't want address inner divs since varying markup generated js framework. i not want set height via js, can not set position absolute nor relative in ".outer" html: <div class="outer"> <div class="inner"> <div class="anotherinner"> <div class="target"> div should outer's height no matter how many divs between target , outer ".inner" </div> </div> </div> </div> css: body { background: #000; } .outer { background: #333; height: 500px; /* not pixel value, example*/ display: flex; flex-direction: column; flex-wrap: wrap; justify-content: flex-start; align-content: stretch; align-items: stretch; } .inner {...

json - How to set a default value for hashtable in ruby? -

is there anyway set hashtable's default value in ruby after filling hashtable json.parse() in ruby? you can set hash's default value method hash#default_proc . for example, suppose: h = { :a=>1, :b=>2 } and if h not have key k want h[k] return empty array. so: h.default_proc = ->(h,k) { [] } # write h.default_proc = ->(*) { [] } h[:a] #=> 1 h[:b] #=> 2 h[:c] #=> [] h #=> { :a=>1, :b=>2 } # h unchanged if want add key , value hash: h.default_proc = ->(h,k) { h[k] = [] } h[:a] #=> 1 h[:b] #=> 2 h[:c] #=> [] h #=> {:a=>1, :b=>2, :c=>[]}

dashDB query node: Error: [IBM][CLI Driver][DB2/LINUXX8664] SQL0964C The transaction log for the database is full. SQLSTATE=57011 -

i using nodered , dashdb , when perfomring inserts on database getting following message on debug nodered: dashdb query node: error: [ibm][cli driver][db2/linuxx8664] sql0964c transaction log database full. sqlstate=57011 you may need commit data more often. know how data inserting , how committing it? this article talks increasing size of log file, if running dashdb on bluemix may not have access setting: http://www-01.ibm.com/support/docview.wss?uid=swg21365131

javascript - how to connect mongoDB to server? -

i trying data mongodb while connecting server .i inserted 1 value in mongodb this > use abc switched db abc > db.ac.insert({name:"naveen"}) writeresult({ "ninserted" : 1 }) > show collections ac system.indexes and try value this var express=require('express'); var app =express(); var mongoclient = require('mongodb').mongoclient; var assert = require('assert'); app.get('/',function(req,res){ console.log("connected server."); mongoclient.connect(url, function(err, db) { assert.equal(null, err); var collection = db.collection('ac'); console.log(collection) console.log("connected correctly server."); db.close(); }); }) var url = 'mongodb://localhost:27017/abc'; app.listen(3000,function(){ console.log('server runninngn') }) i getting error why ? macbook-pro:expressjs naveenkumar$ node index.js server run...

asp.net mvc 3 - Date & time is not inserted proper for special price while add product in nopcommerc -

i using nopcommerce version 3.60 & database on sql server 2012. store date time utc+5.30 have set after refer post http://www.nopcommerce.com/boards/t/12054/where-does-the-default-timezone-come-from.aspx i have try enter special price start date 1-jan-2015 , special price end date 31-jan-2016 , try save got error of "the value '1/31/2016 12:00 am' not valid special price end date." that didn't why comes have enter proper , in text box shows 1/31/2016 12:00 am , if change 31/1/2015 12:)) am saved , show in special price end date textbox 31-jan-16 12:00:00 am . so facing issue. please provide me setting bug. so nopcommerce bug. 1 have face issue tell me that, , checked in database of product table has datatype datetime .

node.js - Redis -nodejs simple program -ERROR -

i getting error simple nodejs redis commands. error getting. /home/veera/radha/node_modules/redis-client/lib/redis-client.js:394 var callback = originalcommand[originalcommand.length - 1]; ^ typeerror: cannot read property 'length' of undefined @ client.onreply_ (/home/veera/radha/node_modules/redis-client/lib/redis-client.js:394:51) @ maybecallbackwithreply (/home/veera/radha/node_modules/redis-client/lib/redis-client.js:143:30) @ replyparser.feed (/home/veera/radha/node_modules/redis-client/lib/redis-client.js:183:29) @ socket. (/home/veera/radha/node_modules/redis-client/lib/redis-client.js:337:28) @ socket.emit (events.js:95:17) @ socket. (_stream_readable.js:765:14) @ socket.emit (events.js:92:17) @ emitreadable_ (_stream_readable.js:427:10) @ emitreadable (_stream_readable.js:423:5) @ readableaddchunk (_stream_readable.js:166:9) and code is, var client = require("./redis...

android - notify image moved to another folder -

i beginner android programmer. create project hiding image. but, have problem in project. that: use method move photo folder a folder .b (here how hid image gallery) . sure picture in folder a deleted , moved folder .b . however, when open image gallery application still see picture displayed @ folder a . this method copy picture folder .b : public static string copyfile(string path) { //to do: create folder .b file pathfrom = new file(path); file pathto = new file(environment.getexternalstoragedirectory() + "/.b"); file file = new file(pathto, filetoname); while (file.exists()) { filetoname = string.valueof(system.currenttimemillis()); file = new file(pathto, filetoname); } inputstream in = null; outputstream out = null; try { in = new fileinputstream(pathfrom); out = new fileoutputstream(file); byte[] data = new byte[in.availa...

How can I create a simple system wide python library? -

i see there built in packages can import script like: from datetime import date today = date.today() print today how can create simple package , add system library can import datetime in above example? you're trying make module. start installing setuptools package; on either windows or linux should able type pip install setuptools @ terminal installed. should able write import setuptools @ python prompt without getting error. once that's working, set directory structure containing setup.py , folder project's code go in. directory must contain file called __init__.py , allows import directory though it's file. some_folder/ | setup.py | my_project/__init__.py in setup.py , drop following content: # setup.py setuptools import setup setup(name="my awesome project", version="0.0", packages=["my_project"]) in my_project/__init__.py , drop stuff you'd able import. let's say... # my_p...

jpa - Trying to add a report, but I keep getting this privelages error in Cuba Studio -

can me why error. sqlsyntaxerrorexception: user lacks privilege or object not found: report_group you can try update database studio menu: run -> update database. after restart application.

dockerfile - From inside the docker container i want to copy the file in to the host machine -

i have docker container runs jar , creates output json file. there way can copy file folder in docker host before docker run exits ? .i have tried below approach , works fine. docker run image1 docker cp <container id>:<path in container> <host file path> above command copies file container docker host. work have ensure container doesn't exit in mean time (by using sleep in program thats run in jar). better approach copy file host within container. the best decision have shared volume container: docker run -v /volume/on/your/host/machine:/volume/on/container image1 you can read more here https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/

ios - Unexpected delay after pushing view controller -

i have tab bar controller, inside 1 of tabs have 3 container view controllers. 1 can presented, others removed @ moment. views controllers defined in xib. in 1 of containers have table view. when click on cell have push view controller. first time launch app have delay when pushing view controller. after go table view , push again, there no delay. i print time when in didselectrowatindexpath , in viewdidload of new controller, , delay between 2 , 4 seconds. this code use pushing view controller: eventdetailsviewcontroller *eventdetailsvc = [[eventdetailsviewcontroller alloc]init]; events *event = [self.events objectatindex:indexpath.row]; eventdetailsvc.curentevent = event; nsdateformatter *f2 = [[nsdateformatter alloc] init]; [f2 setdateformat:@"dd mmmm, hh:mm:ss.sss a"]; nslog([f2 stringfromdate:[nsdate date]]); dispatch_async(dispatch_get_main_queue(), ^{ [self.navigationcontroller pushviewcontroller:eventdetailsvc animated:yes]; }); usually don...

unit testing - Getting return value problems with unittest patch() in python -

i trying use mock.patch unittest code, getting strange result. important part of code: @mock.patch('benchmark.scenarios.networking.feature.ssh') @mock.patch('benchmark.scenarios.networking.feature.subprocess.call') def test_run_for_success(self, mock_subprocess, mock_ssh): mock_ssh.ssh().execute.return_value = (0, '100', '') mock_subprocess.call().return_value = 'mocked!' result = {} self.feature.run(result) when run ssh in code, returned value: (0, '100', '') , good! however, when run subprocess.call() returned value: <magicmock name='subprocess.call()' id='139806699670096'> what doing wrong? 'mocked!' returned value. you using mock.return_value wrong, , on wrong object; whenever want set return value foo() , use foo.return_value , not foo().return_value . moreover, mock_subprocess points subprocess.call already , don't call attribute on that! in other...

javascript - dcjs.leaflet from addons The popup in Choropleth doesn't work -

in dc.leaflet version 0.2.3 choropleth chart popup doesn't work or doesn't rendered. wrong or happens else? happy fix need help. .renderpopup(true) .popup(function(d,feature) { return feature.properties.name+" : "+d.value; }); anyway, appreciated https://github.com/dc-js/dc.leaflet.js/issues/22 thanks in advance the popup in addons did not work me. however, can apply same logic standard dc_leaflet.markerchart function , achieve popups. here example usage worked: var marker = dc_leaflet.markerchart("#demo1 .map", groupname) //map formatting .dimension(restaurantnames) .group(restaurantsgroup) .width(700) //was 600 .height(500) .center([43.733372, -79.354782]) //was 42.69,25.42 .zoom(11) //was 7s .cluster(true) //was true .valueaccessor(function(kv) { return kv.value.count; }) .locationaccessor(function(kv) { return [kv.value.latitude,kv.val...

java - Importing a text file to NetBeans -

Image
the drive contains text file i mailed netbeans project .txt file . tried convert zip file , import not working. how can use now? the file in question rar file has had extension changed txt . if in file itself, can seen in heading of contents rar! , rest of information directories , compressed information. if file extension changed .rar problem remedied (not zip, attempted before). result in working rar file following contents:

How to expose Hystrix Stream on Spring Actuator port? -

i using jetty embedded server in spring boot application. to handle requests provide custom handler that. @slf4j @configuration @enablewebmvc @springbootapplication public class main { public static void main(string... args) { new springapplicationbuilder().sources(main.class).run(args); } @bean public embeddedservletcontainercustomizer customizer(jettyrequesthandler mycustomhandler) throws malformedurlexception { return new embeddedservletcontainercustomizer() { @override public void customize(configurableembeddedservletcontainer container) { if (container instanceof jettyembeddedservletcontainerfactory) { customizejetty((jettyembeddedservletcontainerfactory) container); } } private void customizejetty(jettyembeddedservletcontainerfactory jetty) { jetty.addservercustomizers((jettyservercustomizer) server -> { ...

android - ListView Inside CardView not Showing its full length -

hellow i've implemented listview inside cardview problem got is, cardview not expanding on adding list item. can me,how slove issue? have gone through different posts on stackoverflow cannot find solution :( code below //this listview adapter class public class employmenthistoryadapter extends baseadapter { public arraylist<employmenthistory> memploymenthistories; private context context; public employmenthistoryadapter(arraylist<employmenthistory> memploymenthistories, context context) { this.memploymenthistories = memploymenthistories; this.context = context; } @override public int getcount() { return memploymenthistories.size(); } @override public object getitem(int position) { return position; } @override public long getitemid(int position) { return 0; } @override public view getview(int position, view convertview, viewgroup parent) { view v = null; employmenthistory emphistory = memploymenthistories.get(position); if (co...

angularjs - triggering $onChanges for updated one way binding -

i'm happy "new" $onchanges method can implement in component's controller. seems triggered when bound variable overwritten outside component, not (for instance) when item added existing array it intended behaviour or bug? there way of listening updates input bindings, besides doing $scope.$watch on it? i'm using angular 1.5.3 first tl;dr array bounded via one-way binding, watch expression added not check object equality uses reference checking. means adding element array never fire '$onchanges' method, since watcher never 'dirty'. i've created plnkr demonstrates this: http://plnkr.co/edit/25pdle?p=preview click 'add vegetable in outer' , 'change array reference in outer' , @ 'number of $onchanges invocation'. change latter button. complete explanation grasp going on, should check angular code base. when '<' binding found, following code used set watch expression. case '<':...

algorithm - Building an AVL Tree out of Binary Search Tree -

i need suggest algorithm takes bst (binary search tree), t1 has 2^(n + 1) - 1 keys, , build avl tree same keys. algorithm should effective in terms of worst , average time complexity (as function of n ). i'm not sure how should approach this. clear minimal size of bst has 2^(n + 1) - 1 keys n (and case if full / balanced), how me? there straight forward method iterate on tree , each time adding root of t1 avl tree , removing t1 : since t1 may not balanced delete may cost o(n) in worst case insert avl cost o(log n) there 2^(n + 1) - 1 so in total cost o(n*logn*2^n) , ridiculously expensive. but why should remove t1 ? i'm paying lot there , no reason. figured why not using tree traversal on t1 , , each node i'm visiting , add avl tree: there 2^(n + 1) - 1 nodes traversal cost o(2^n) (visiting each node once) adding current node each time avl cost o(logn) so in total cost o(logn * 2^n) . , best time complexity think of, question is, can done ...

What is the Google Client ID? -

this first post far i'll try precise question. use google analytics on website, , can track different users client ids. can link them in anyway google + accounts ? also, can blacklist client ids google analytics (the dev team working on website may end in data being biased)? if yes, how can determine specific user's id ? i know not entirely related coding, haven't found answer question far. thank help, just read clientid https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientid , cant link clientid sites

c++ - Multiply vec3 with mat4 using glm -

at moment, convert vec3 vec4 , multiply matrix, , cast vec3 code: glm::vec3 transformed = glm::vec3(matrix * glm::vec4(point, 0.0)) it works, think not way calculate it. possible apply mat4 on vec3 , without casting vec4 , back? when working opengl wise stick homogeneous coordinates . 3d space these 4d vectors fourth element equals 1. when calculations in 4 dimensional space, no conversions needed anywhere. also note in example, lose translation may have been recorded in transformation matrix. if want keep you'll need use 1 4th element, not 0. appendix f of red book describes how , why homogeneous coordinates used within opengl.

Why bool is not regarded as boost::true_type in C++? -

the following codes come example code illustrate how use boost::type_traits. use 2 methods swap 2 variables. easy understand when 2 variables integer (int) type traits correspond true_type. however, when 2 variables bool type not regarded true_type more. why happen? thanks. #include <iostream> #include <typeinfo> #include <algorithm> #include <iterator> #include <vector> #include <memory> #include <boost/test/included/prg_exec_monitor.hpp> #include <boost/type_traits.hpp> using std::cout; using std::endl; using std::cin; namespace opt{ // // iter_swap: // tests whether iterator proxying iterator or not, , // uses optimal form accordingly: // namespace detail{ template <typename i> static void do_swap(i one, two, const boost::false_type&) { typedef typename std::iterator_traits<i>::value_type v_t; v_t v = *one; *one = *two; *two = v; } template <typename i> static void do_swap(i one, two, const...