Posts

Showing posts from August, 2014

c++ - How do I set a listener in Awesomium? ("Field type 'Listener' is an abstract class" error) -

i've been trying awesomium::webviewlistener working, whenever try allocate listener object "field type 'listener' abstract class" error. here's code: class listener : public awesomium::webviewlistener { public: void oncallback(awesomium::webview* caller, const std::wstring& objectname, const std::wstring& callbackname, const awesomium::jsarguments& args) { std::cout << "hello!" << std::endl; } }; // in gui class listener listener; // field type 'listener' abstract class view->setlistener(&listener); how supposed set listener if can't allocate listener-object? i've tried using boost::shared_ptr doesn't produce errors oncallback()-function never gets called. it 2 variants: awesomium::webviewlistener contains more 1 abstract method. if - should implement them create instance of derived class `listener...

ruby on rails - Multi check_box on array field of child resource creates new items -

i trying create multiple checkbox tags second level embedded documents. however, creates new objects. have models class paprasa include mongoid::document attr_accessible :id, :bkompetencijas, :bkompetencijas_attributes accepts_nested_attributes_for :etapa accepts_nested_attributes_for :bkompetencijas, :allow_destroy => true embeds_many :bkompetencijas , class_name: 'kompetencija', inverse_of: :paprasabk, :cascade_callbacks => true end #----------------------------------------------- class kompetencija include mongoid::document attr_accessible :id, :paprasabk, :paprasabk_attributes, :siekinys, :siekinys_attributes accepts_nested_attributes_for :paprasa, :allow_destroy => true accepts_nested_attributes_for :siekinys, :allow_destroy => true embedded_in :paprasabk, class_name: 'paprasa', inverse_of: :bkompetencijas embeds_many :siekinys, class_name: 'siekiny' , inverse_of: :kompetencija, :cascade_callbacks => true ...

Isotope load images progessively -

i using isotope on website have built - used position lots of jpegs, along filtering system - works well, load of page slow think isotope has issues loading lots of images... the code using below: $(window).load( function() { // init isotope var $grid = $('.workgridwrapper').isotope({ // options itemselector: '.workgriditem', percentposition: true, masonry: { // use element option columnwidth: '.grid-sizer' }, filter: '.initialload' }); // store filter each group var filters = {}; $('.filtergridinner').on( 'click', 'a', function() { var $this = $(this); // group key var $buttongroup = $this.parents('.button-group'); var filtergroup = $buttongroup.attr('data-filter-group'); // set filter group filters[ filtergroup ] = $this.attr('data-filter'); // combine filters var filtervalue = concatvalues( filters ); // set filter isotope...

session - The connection to the server was reset while the page was loading , if we use F5 load balancer to access asp.net pages -

i deployed asp.net application in 2 asp.net servers , users access application through f5 load balance. here facing issue when user idle on asp.net page 10 min , , after when user click button on page, , page can not displayed message appers in ie, and in firefox below message connection server reset while page loading. in iis default session timeout value 20 min in f5 tcpip time out value :10 min if machinekeys in config on both servers identical, upping timeout 20 minutes should work. if doesn't work, or don't have rights so, you'll need keep-alive in asp.net application like in question

postgresql - Optimize SQL query with 3 FOR loops -

i have working sql query. however, very slow. looking way optimize it. create table trajectory_geom ( id serial primary key, trajectory_id bigint, user_id bigint, geom geometry(linestring, 4326) ); insert trajectory_geom (trajectory_id, user_id, geom) select p.trajectory_id, p.user_id, st_transform(st_makeline(p.geom), 4326) point p group p.trajectory_id ; $$ declare urow record; vrow record; wrow record; begin wrow in select distinct(p.user_id) point p loop raise notice 'user id: %', wrow.user_id; vrow in select distinct(p.trajectory_id) point p p.user_id = wrow.user_id loop urow in select analyzed_tr.* trajectory_start_end_geom analyzed_tr analyzed_tr.user_id = wrow.user_id , st_intersects ( ( analyzed_tr.start_geom ) , ( select g.ge...

angularjs - Very uninformative error with SQLite query -

i'm using apache cordova hybrid mobile application platform. i'm using following plugin cordova-sqlite-storage handling sqlite. syntax identical of websql. considering used angularjs have database set in factory, here how i've called query ran against database without problems: query: function(query, params, callback) { try { factory.database.transaction(function(tx) { if(callback) tx.executesql(query, params, callback, function(transaction, error) { console.log("error"); }); else tx.executesql(query,params); }); } catch (e) { console.log("error: ", json.stringify(e)); } } however today, changed. please note "error" callback not present, in case not fire anyway. so issues follows: the query not execute, or believe, because application hangs @ point. the query not fire failed or success callbacks. the catch block fired uninform...

Python script closes after some iterations -

i wrote piece of code , when run goes smooth until gets "czz", beginner , not know problem.. if tell me doing wrong. idea behind code try find 3-letters domains available ".ro" import urllib2 import urllib import string urllib2 import request, urlopen, urlerror, httperror string import ascii_lowercase f = open('3-letters.txt', 'w') x in ascii_lowercase: y in ascii_lowercase: z in ascii_lowercase: req = request("http://"+x+y+z+".ro") try: response = urlopen(req) except httperror e: f.write("http://"+x+y+z+".ro\n") except urlerror e: f.write("http://"+x+y+z+".ro\n") else: print "bad "+x+y+z f.close(); one problem not closing connections after don't need them longer, can response.close() . in finally block ensure executed. ...

java - Modular calculator getting data inside a String array -

i'm stuck on problem codeabbey . don't want answer entire thing. this meat of question: input data have: initial integer number in first line; one or more lines describing operations, in form sign value sign either + or * , value integer; last line in same form, sign % instead , number result should divided remainder. answer should give remainder of result of operations applied sequentially (starting initial number) divided last number. my problem logic. far realize there operator, space , number. number thought of using char c = src.charat(2); and operator i'd use same thing. i'd use bunch of if-else statements figure out rest. how do in large scale? how read of numbers in , every 1 of them? nudge on right direction help. import java.util.scanner; public class challenge14 { static scanner in = new scanner(system.in); public static void main(string[] args) { system.out.println("enter first number: ...

r - Using the nodes argument for centrality metrics in sna -

i trying calculate centrality metrics specific node within graph using statnet (i can't use igraph since doesn't have metrics i'd like). how use nodes argument of these functions specify this? example, take prestige # use faux.magnolia.high dataset ergm (1461 vertices , 974 edges) library("ergm") data(“faux.magnolia.high”) # try calculating node 1 sna::prestige(faux.magnolia.high, nodes = 1, gmode = "graph") 1 # try calculating node 2 sna::prestige(faux.magnolia.high, nodes = 2, gmode = "graph") na looks bug in degree-related versions of prestige . work calculations done on whole graph: sna::prestige(faux.magnolia.high, gmode = "graph")[2] see skye's full response on statnet mailing list: http://mailman13.u.washington.edu/pipermail/statnet_help/2016/002175.html

reflection - Injecting code to track events on Delphi -

i have big , old application written in delphi version 2007 on decade , in order rewrite intend understand parts/features of used majority of users. the idea came track objects clicks , window creations populate log or analytics tool google analytics or deskmetrics quantitative , qualitative data in order on decision making. to achieve that, i'm trying figure out easiest path respecting current version limitations. 1 of possibilities exploring understanding how implement generic code somehow "injected/reflected" in class level instantiated objects may among other things, call function passing parameters identify , function take action log info using best tool. the real solution far copying , pasting function call on several thousands of onclick/oncreate methods , i'd avoid while open other possibilities may come out on thread. thanks!

ios - Setting boundary for PanGesture for imageView -

i working on emoji photo app users can add emoji on photos phone , share on instagram , more. users can zoom, rotate, , drag emojis anywhere want decorate photos , want set boundary emoji can't dragged outside photo. setting boundary seems work except when user drags emoji fast (swiping fast) - emoji can dragged outside photo , disappear completely. attaching code handlepan , screenshot of app. can see why/how emoji can move outside boundary when user drags fast? appreciated. thanks! @ibaction func handlepan(recognizer:uipangesturerecognizer) { if(deletemode) { return } let translation = recognizer.translationinview(self.view) var centerx: cgfloat! var centery: cgfloat! var ipadleftboundary: cgfloat! if let view = recognizer.view { if(is_ipad) { ipadleftboundary = 55 } else { ipadleftboundary = 0 } print("panelbackground.frame.origin.x: \(panelbackground.frame.origin.x)...

Is it possible to add a pyqtgraph to a PySide app without using a QLayout? -

i want add pyqtgraph plot existing pyside application. of existing examples use qlayout of form achieve this: from pyside import qtgui import sys import pyqtgraph app = qtgui.qapplication(sys.argv) my_widget = qtgui.qwidget() btn = qtgui.qpushbutton("my button", my_widget) plot = pyqtgraph.plotwidget() plotlayout = qtgui.qvboxlayout() plotlayout.addwidget(plot) my_widget.setlayout(plotlayout) my_widget.show() app.exec_() is possible add pyqtgraph plots widget without adding layout first? i'm guessing need because i'm trying add widget widget. pyqtgraph provide more qpushbutton or qlabel, can directly added widget? the widget pyqtgraph.plotwidget() (which in above code). add parent widget other widgets pyqtgraph.plotwidget(parent) (see documentation list of constructor arguments). place @ coordinates (0,0) inside parents widget default size (i don't know size or how determined - have dimensions (0,0) or equally small). however, typically hie...

openxml sdk - Chart is not refreshing after updating Embedded excel part in open xml sdk 2.0 -

i trying update embedded excel part of chart in power point other excel file, updating embedded excel file chart. one thing noticed is, once come "edit data" option can able see update in chart. please me how refresh chart in open xml i using following code, presentationdocument mydestdeck = presentationdocument.open(@"presentation1.pptx", true); presentationpart prespart = mydestdeck.presentationpart; slidepart slidepart = prespart.slideparts.firstordefault(); chartpart chartpart1 = slidepart.chartparts.firstordefault(); embeddedpackagepart embeddedpackagepart1 = chartpart1.embeddedpackagepart; embeddedpackagepart1.feeddata(new filestream(@"output12.xlsx", filemode.open, fileaccess.readwrite)); prespart.presentation.save(); mydestdeck.close(); please help thanks in advance, i have worked open xml in .docx context, suspect having same problem had when wanted update embedded ...

python - Error serving large files when using Flask and Tornado -

i serving large static files ~70 mb, able download files when working in flask alone, getting error below when using tornado , flask. exception ignored in: <bound method future.__del__ of <tornado.concurrent.future object @ 0x32c61acc>> traceback (most recent call last): file "/home/user/virtual/lib/python3.4/site-packages/tornado/concurrent.py", line 333, in __del__ file "/usr/local/lib/python3.4/traceback.py", line 181, in format_exception file "/usr/local/lib/python3.4/traceback.py", line 153, in _format_exception_iter file "/usr/local/lib/python3.4/traceback.py", line 18, in _format_list_iter file "/usr/local/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter file "/usr/local/lib/python3.4/linecache.py", line 15, in getline file "/usr/local/lib/python3.4/linecache.py", line 41, in getlines file "/usr/local/lib/python3.4/linecache.py", lin...

javascript - Dropzone.js as a profile photo uploader. How to do it? -

Image
i have form edits user profile, , want async profile photo upload. layout looks this: the behaviours have have are: dropzone should load current photo server (done, used mockfile , working); i'd disable drag/drop functionality, don't know if possible; to change picture, user should click "change pic" button , dropzone should open "browse..." window, user selects photo , when click ok dropzone should automatically remove mockfile, change thumbnail , upload new picture asynchronously. anyone me this?

unicode - Why don't emojis render in my HTML and/or PHP? -

in effort learn more font rendering/encoding i'm more curious why when copy , paste emojis 😇🐵🙈 blank <html> page , save .html file locally on machine, or start local php server , serve files above emojis in there, either show weird characters (😇ðŸµðŸ™ˆ) or blank, respectively. yet know when type them straight stack overflow ask textarea, render correctly in browser, , displayed intended when viewing page. my understanding since mac osx ships correct emoji fonts, should rendered that. disconnect between html page you're looking @ right now, , local 1 saved on computer? and recommended reading appreciated! :) errr.... 😀 when web server sends file browser, send set of http headers well, relaying information content type, caching, etc. content-type header informs browser encoding used: content-type: text/html; charset=utf-8 if open file locally browser gets file , has guess encoding. can declare encoding in html head : <meta charset="utf...

Git svn clone creates empty repository -

i have simple svn repository 1 commit adding 1 file. have directory trying run git svn clone of directory. output: initialized empty git repository in /home/ncantrel/gstest/trunk/.git/ /usr/bin/perl: symbol lookup error: /usr/lib/perl5/vendor_perl/auto/svn/_core/_core.so: undefined symbol: perl_gthr_key_ptr git: 'svn' not git command. see 'git --help'. did mean this? svn despite not recognizing command, still creates git repository name of svn repository empty. have tried -s , -r commands , same thing. unfortunately don't know linux version running, quick googeling on undefined symbol error brought page up: http://jtes.net/2011/12/03/perl-perl_gthr_key_ptr-problems/ it states "fedora provides number of prebuild perl libraries". maybe distro that, too. article suggests use cpan reinstall needed library. type sudo cpan , enter force install svn::core . hope helps.

Using azure mobile services how do I download a blob from a private container? -

i using azure mobile services store images web application. have managed upload images private container. i've followed logic in introductory guide ( http://code.msdn.microsoft.com/windowsapps/upload-file-to-windows-c9169190 ), i.e. when uploading file database sas generated node script called when inserting record table. one of reasons use approach mobile apps storage key not stored within application source itself. conforming idea struggling find example of how download images. perhaps should update read function same table , have return sas can used accessed image. does sound reasonable or better approaches? assistance appreciated. it sounds me on right track. if storing image in private container , want mobile device read yes, want produce sas allows reading , device. device code can make call directly against blob storage using sas url retrieve image. this applies if want container private. if container public returning url (like have in article link ...

xna - Where to call SetRenderTarget? -

i'd change rendertargets between spritebatch.begin , spritebatch.end . know works: graphicsdevice.setrendertarget(target1); spritebatch.begin() spritebatch.draw(...) spritebatch.end() graphicsdevice.setrendertarget(target2); spritebatch.begin() spritebatch.draw(...) spritebatch.end() but i'd make work: spritebatch.begin() graphicsdevice.setrendertarget(target1); spritebatch.draw(...) graphicsdevice.setrendertarget(target2); spritebatch.draw(...) spritebatch.end() i've ever seen doing this, didn't find reason why. edit: little more why want this: in project, use spritesortmode.immediate (to able change blendstate when want), , iterate through sorted list of sprites, , draw them all. want apply mutli passes shader on sprites, not all! i'm quite new shaders, understood, have draw sprite on intermediate 1 using first pass, , draw intermediate sprite on final render target using second pass. (i'm using gaussian blur pixel shader). that's why i...

java - "Unable to load resource" because of "ZipException: invalid entry size" -

i have java 8 project creates dozen jnlp applications. have built , run them on windows successfully. jnlp launches correctly through javaws . transfer .tar solaris machine via ftp (in binary mode) , sa deploys via tomcat. when visit url launch jnlp on network, application error. the exception is: com.sun.deploy.net.faileddownloadexception: unable load resource: https://example.com/webstartdev10g/dev/apps/libs/xerces.jar @ com.sun.deploy.net.downloadengine.actiondownload(unknown source) @ com.sun.deploy.net.downloadengine.downloadresource(unknown source) @ com.sun.deploy.cache.resourceproviderimpl.getresource(unknown source) @ com.sun.deploy.cache.resourceproviderimpl.getresource(unknown source) @ com.sun.javaws.launchdownload$downloadtask.call(unknown source) @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$work...

swift - Removing object from Array -

how can remove specific object array of string. array = ["mac","iphone","ipad"] is there method delete specific string in array, example wanted remove "iphone", without using removeatindex(1) use filter purpose var array = ["mac","iphone","ipad"] array = array.filter() { $0 != "mac" } print(array) // print ["iphone", "ipad"]

filter - Primefaces export filtred data -

i have problem primefaces data export. export works fine after started using filter got empty file, find solutin here: dataexporter returns empty rows after filtering . still doesn't work correctly. when press export file results not results after filtering. how can achieve it? thanks i find out problem, had wrong set scope in managed bean. when changed if request view works.

ios - Finding and combining duplicate entries in an array -

im new here correct me if i've formatted incorrectly (also new swift) i'm trying take array of dates , numbers , if of dates same combine numbers 1 entry. so this //this how format data after pull core data var dateandentry = [(string, double)] //i've split them 2 seperate arrays sorting, feel theres better way don't know var dates = ["01/01/2016", "02/01/2016", "02/01/2016", "04/01/2016", "05/01/2016", "06/01/2016","07/01/2016","07/01/2016"] var entries = [-14,2,8,9,-1,8,25,6] becomes var dates = ["01/01/2016", "02/01/2016", "04/01/2016", "05/01/2016", "06/01/2016","07/01/2016"] var entries = [-14,10,9,-1,8,19] i've tried doing can makes new array contains new values rather allowing me duplicated values, combine, insert @ index delete original entries in 2 arrays. func combineduplicates(dates: [string]) -> [...

tcl - Keep mysql connection open -

i'm making eggdrop tcl script write activity of several public irc channels database (over time 10 15 channels think). have 2 options how handle database connection in mind. an user says -> open mysql connection database -> insert information user said -> close connection start bot -> open mysql connection database -> insert information when there channel activity -> wait more information etc. i think it's better use case 1, when there channel activity think opening , closing connection every time cause massive server load , slows things down drastically after while. what's best way this? if want keep connection open call mysql::ping $dbhandle from time time. this can done this: proc keepmysqlopen {dbhandle} { mysql::ping $dbhandle after 2000 [list keepmysqlopen $dbhandle] } .... set dbh [mysql::open ...] keepmysqlopen $dbh ... an other option use mysql::ping before accessing db, should according mysqltcl ma...

operating system - Why would you not allocate all available memory to the heap? -

i developing small hobby os learning experience , trying wrap head around kernel memory management. trying wrap head around memory allocation via heap mechanism. what not clear on following: in several implementations have reviewed, there code expand , contract heap. why not use available memory heap(s). else there (besides small region kernel code) requires memory?

jquery - How to select shape on canvas and return its name? -

i draw several shapes on canvas using jcanvas library function: var factorycounter = 1; $(".atom").click(function() { //get element tag id var atomid = jquery(this).attr("id"); var elementref = "#el" + factorycounter; $("canvas") .drawimage({ source:'images/' + atomid + '.png', layer: true, name: "myatom" + factorycounter, //i need value fillstyle: "#36b", strokestyle: '#36b', strokewidth: 0.3, x: 36, y: 28, width: 45, height: 35, radius: 100, ccw: true, draggable: true, click: function(layer) { console.log("name") //here need return "name", don't know how. } }); factorycounter++; as can see each shape has own unique name. i'd create function returns name of selected...

solr - Partial Update of documents -

we have requirement documents index in solr may periodically need partially updated. updates can either a. add new fields b. update content of existing fields. of fields in our schema stored, others not. solr 4 allow fields must stored. see update new field existing document , http://solr.pl/en/2012/07/09/solr-4-0-partial-documents-update/ questions: 1. there way solr can achieve this. we've tried solr joins in past wasn't right fit our use cases. on other hand, can elastic search , linkedin's senseidb or other text search engines achieve ? for now, manage re-indexing affected documents when need indexed thanks solr has limitation of stored fields, that's correct. underlying lucene requires delete old document , index new one. in fact lucene segments write-once, never goes modify existing ones, markes documents deleted , deletes them real when merge happens. search servers on top of lucene try work around problem exposing single endpoint that...

Viewing the docker container name in syslog -

i have docker-compose.yml file many services. whenever run docker-compose up , see names of services , it's awesome. the problem names of services not visible in syslog. tips? docker-compose.yml mydocker: image: mydocker command: echo mydocker log_driver: syslog log_opt: syslog-address: "<url-goes-here>" yourdocker: image: mydocker command: echo log_driver: syslog log_opt: syslog-address: "<url-goes-here>" running command myawesomeserver/temp$ docker-compose creating temp_mydocker_1 creating temp_yourdocker_1 attaching temp_mydocker_1, temp_yourdocker_1 mydocker_1 | yourdocker_1 | temp_mydocker_1 exited code 0 temp_yourdocker_1 exited code 0 gracefully stopping... (press ctrl+c again force)

Oracle 11g XE ignores my statment after putting value form variable in trigger -

Image
i want specification doctor , department tables make sure manager of department same specification of while inserting .. create or replace trigger check_dept_man after insert on department each row declare spec varchar2(30); dept_name varchar2(30); begin dept_name := :new.dept_name; select dr_specialisation spec doctor dr_id= :new.manager_id; if ( dept_name != spec ) raise_application_error(-20353,"error man"); end if; end; this error get: this department table: create table "department" ( "dept_id" number(3,0), "dept_name" varchar2(30), "manager_id" number(3,0), "manage_date" date, "location" varchar2(6), "number_of_doctors" number(3,0), "number_of_nurses" number(3,0), constraint "dept_id_pk" primary key ("dept_id") enable, constraint "dept_name_uq" unique ("dept_name") enable ) ; and doc...

Detect hard press iOS with JavaScript -

this question has answer here: ios 3d touch api using javascript web app 2 answers so wondering new hard press detection on newer ios devices, possible detect such thing without being actual app? by this, mean possible detect using javascript or of sorts. frank, don't see relating question on so, @ least far web programming concerned. to state hypothesis, doubt it's possible @ i'm sure it's hardware event isn't passed forward through safari (or whatever browser) javascript engine. simply curious question, answers appreciated. in advance. regards, emanuel edit: here's tl;dr of other answer: no, not ios; desktop forcetouch trackpad. save people time. here's catch: according this , safari app supports using new api, other browsers yet support it. i did not test it, because don't have iphone 6s or macbook forcetouch-trac...

css - Why is html-tidy forcing my styles onto one line? -

html-tidy insists on minifying style block single line. this: <style> p { background-color: red; } #first {border: 2px solid blue} </style> gets tidied this: <style>p { background-color: red; } #first {border: 2px solid blue}</style> i want keep <style> block readable, i'd take variation long treats <style> block level element, don't see way force that. closest option can see new-blocklevel-tags , doesn't have impact , doesn't make sense option anyway. how stop html-tidy minifying css blocks inside of style tags? what call minifying removal of indenting. minifying mean complete removal of spaces, tabs , line breaks code, outputting 1 line, compressing css in 1 file , javascript in another. tidy not capable of preserving original indenting of markup input receives. that’s because tidy starts building clean parse tree input, , parse tree doesn’t contain information original indenting. tidy pretty...

javascript - How To Detect Mouse Move ONLY on Horizontal Move (To Left or to Right Move) -

can please take @ this demo , let me know how can detect mousemove() when mouse moving left or right? basically happening jquery detecting mousemove event when mouse moving top down or down top need disable , detect mouse move event on moving horizontally. $( "#target" ).mousemove(function( event ) { var msg = "handler .mousemove() called @ "; msg += event.pagex + ", " + event.pagey; $( "#log" ).append( "<div>" + msg + "</div>" ); }); #target{width:500px; height:120px; background:yellow;} <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="target"> move here </div> <div id="other"> trigger handler </div> <div id="log"></div> record last position of mouse , if horizontal position has changed, run code. var lastx = 0; $( ...

c# - Partially vertically scroll -

i have listbox contains 2 columns - column 1 contains toggle button, column 2 contains expander multiple controls within it. if expander collapsed, overall scrolling of listbox works fine. however, if expander open , expander contains large quantity of items, listbox scroll entire row size, not showing part of expander list. this similar placing image in list box larger viewable area of list box. in case, if click scrollbar, want "step" down image, without scrolling off screen in 1 click. is there setting listbox allow partial scrolling i've described? listbox defined in xaml , controls added via c# code. have tried turning on smooth scrolling setting scrollviewer.cancontentscroll false? controls whether scrollviewer scroll item @ time, or smoothly partial items available. "scrollviewer allows 2 scrolling modes: smooth pixel-by-pixel scrolling (cancontentscroll = false) or discrete item-by-item scrolling (cancontentscroll = tru...

Run code on application startup Phoenix Framework (Elixir) -

were put code want run when application/api starts in vanilla phoenix application? let's want make sure mnesia tables created or configure logger backend. other thing runtime configuration. mention in documentation it's not clear me 1 define/change runtime configuration. endpoint.ex seems place initial configuration done looking @ docs can't find callback allow me run code once @ startup. put in application callback module. name of application: lib/my_app.ex in start/2 function. 2nd line of module should have use application .

java - How to debug requests in spring 4? -

i've got app in spring, uses spring rest , spring mvc. i've got controller on post adds comment. method looks this: @requestmapping(method = requestmethod.post) public list<comment> addcomment(comment comment) { return service.addcomment(comment); } i'm sending request of type "application/json" data set {author:"text", "text":"commenttext"}, , when i'm debugging inside of method, null values on both properties. comment model: @entity public class comment { @id @generatedvalue private long id; private string author; private string text; public comment() { } public comment(string author, string text) { this.author = author; this.text = text; } public string getauthor() { return author; } public void setauthor(string author) { this.author = author; } public string gettext() { return text; } public void s...

node.js - Error deploying node app to heroku -

i'm relatively new node, , have been having issues deploying node web app heroku... seems have how i'm creating mongoose connection in server file. here error logs i'm getting: 2016-01-06t00:41:30.384170+00:00 heroku[web.1]: state changed starting crashed 2016-01-06t00:43:56.191644+00:00 heroku[web.1]: state changed crashed starting 2016-01-06t00:43:57.774259+00:00 heroku[web.1]: starting process command `node server/server.js` 2016-01-06t00:44:00.138974+00:00 app[web.1]: listening on 4568 2016-01-06t00:44:00.172982+00:00 app[web.1]: 2016-01-06t00:44:00.172992+00:00 app[web.1]: /app/node_modules/mongoose/node_modules/mongodb/lib/server.js:236 2016-01-06t00:44:00.172994+00:00 app[web.1]: process.nexttick(function() { throw err; }) 2016-01-06t00:44:00.172994+00:00 app[web.1]: ^ 2016-01-06t00:44:00.172995+00:00 app[web.1]: error: connect econnrefused 127.0.0.1:27017 2016-01-06t00:44:00.172996+00:00 app[web.1]: @ object.e...

codenameone - implement select/cut/paste in TextArea -

how can implement tradition menu items copy / cut / paste / selectall in codenameone textarea i can these things if happen remember keystrokes, don't see hooks them programmatically. since on-device editing native cut/copy/paste work thru touch , menu implicitly appear. wouldn't want programmatically in codename one, e.g. right don't have api selected text either since concept pretty different between platforms. there display.copytoclipboard & display.getpastedatafromclipboard aren't text field selection purpose. rather use case of moving data within/between apps.

php - File Upload inside regular form not getting uploaded -

i have file upload input attribute inside regular form upload photo. <form class="reg-page" action="phpmailer/sendemail.php" method="post" enctype="multipart/form-data"> <div class="form-group"> <label>name <span class="color-red">*</span> </label> <input type="text" class="form-control margin-bottom-20" name="name" required> </div> <div class="form-group"> <label>email <span class="color-red">*</span> </label> <input type="text" class="form-control" name="email" required> </div> <label class="control-label">photo <span class="color-red">*</span> </label> <input type="file" class="file" name="photo"> <input type=...

powershell - Better alternative to pivot rows into columns -

trying stack these columns in powershell, , works! however, feels there should easier way this. please let me know if have alternatives accomplish same goal $lines = @' 5 b d7 e c f '@ $lines = $lines.split("`n") $max = $lines | % {$_.trim().split(' ').count} | sort -desc | select -f 1 $count = 0 $obj = new-object psobject foreach ($line in $lines) { $obj | add-member -membertype noteproperty -name $count -value $line $count++ } ($x = 0; $x -lt $count; $x++) { ($y = 0; $y -lt $count; $y++) { $obj.$y.trim().split(' ')[$x] } } desired output this: 5 b c d7 f e here's more random example of input , desired output. script: $alpha = 65..90 | % { [char]$_ } $lines = ($i = 0; $i -lt $alpha.count; $i ++) { $line = '' $cols = get-random -minimum 1 -maximum 6 ($j = 0; $j -lt $cols; $j++) { $line += $alpha[$i+$j] + ' ' } $line.trim() $i = $i + $cols - 1 } $lines = $line...

javascript - How to update data in the React Lifecycle? -

i have question regarding data updates in react lifecycle. the newstable child component receives props (query) parent component, calls database , renders table. parent send updated props (new queries) table can updated. if parent fires same query twice, table shouldn't update (that is, shouldn't keep hitting database identical queries). now, use shouldcomponentupdate handle this, use "debounce" library. here's code snippet: import react 'react'; var newstable = react.createclass({displayname: "newstable", getdefaultprops: function() { return { }; }, getinitialstate: function() { return { query: null }; }, componentwillmount: function() { this.loaddata(this.props.query); }, componentdidmount: function() { }, componentwillunmount: function() { }, loaddata: function(query) { // time-consuming async, return "data" ...

ios - How UIViewController interact with Storyboard under the hood -

i'm new ios development , stupid question experienced guys... when create new ios project in xcode, viewcontroller class , storyboard sets custom class viewcontroller . looks there "storyboard" class holding instance of viewcontroller , however, cannot find "storyboard" class defined. even though know how create multiple subclasses of uiviewcontroller handle different views interaction following tutorials, still find uncomfortable associate these subclasses storyboard selecting them in storyboard panel. rather see "storyboard" class holding array of uiviewcontroller . so question is, how these uiviewcontroller interact storyboard under hood? thanks roughly, happens follows: app launches. app loads storryboard. depending on app's navigation structure, app instantiates each view controller inside storyboard needed. the storyboard contains detailed information on: which custom subclass of uiviewcontroller , uinavigt...

excel - Running macros at scheduled time when pc is locked -

background: windows 7, office 2010 i have 2 macros running buttons, 1 macro calculates , extracts data , other macro selects specific range , sends email specified email. may know how can 2 macros run @ scheduled time when pc locked - i.e. (on 'switch user' screen)? thank , sincerely appreciate can get! sub tempo() tps = + timevalue("00:01:00") 'your refresh rate application.ontime tps, "message_ctrl" end sub sub message_ctrl() call module1.test 'your macro call tempo 'this relaunch schedule when test() finished end sub here exemple refresh every minutes, can define day or anything. need start once tempo() or message_ctrl() start cycle. maybe @ workbook_open. key here application.ontime function.

tcl - extracting particular values from output -

i have pagent router output set pagent_ouput "interface: ethernet2/3 packetfilter: 2500 123bps 456.123pps packetfilter: 2300 345bps 345.548pps interface: ethernet3/4 packetfilter: 2500 123bps 896.163pps packetfilter: 2300 345bps 675.748pps" ethernet interfaces varies....i want extract pps value each ethernet interface want { {456.123 345.548} {896.163 675.748}} if pagent_output varies set pagent_output "interface: ethernet2/3 packetfilter: 2500 123bps 456.123pps packetfilter: 2300 345bps 345.548pps packetfilter: 2300 645bps 445.548pps packetfilter: 2300 745bps 545.548pps interface: ethernet3/4 packetfilter: 2500 123bps 656.123pps packetfilter: 2300 345bps 745.548pps packetfilter: 2300 345bps 845.548pps packetfilter: 2300 345bps 945.548pps interface: ethernet3/5 packetfilter: 2500 123bps 156.123pps packetfilter: 2300 345bps 255.548pps packetfilter: 2300 345bps 375.548pps packetfilter: 2300 345bps 395.548p...

surfaceview - Android app not responding when closed -

i working on game android, , when close app crashes. think because doing render null canvas. when null check, program doesn't crash, doesn't reopen after has been closed. here thread's run: public void run() { canvas canvas; log.d(tag, "starting game loop"); long begintime; // time when cycle begun long timediff; // time took cycle execute int sleeptime; // ms sleep (<0 if we're behind) int framesskipped; // number of frames being skipped sleeptime = 0; while (running) { canvas = null; // try locking canvas exclusive pixel editing // in surface try { canvas = this.surfaceholder.lockcanvas(); synchronized (surfaceholder) { begintime = system.currenttimemillis(); framesskipped = 0; // resetting frames skipped // update game state this.gamepanel.update(); // render sta...