Posts

Showing posts from February, 2013

ios - Radom & Occasional EXC_BAD_ACCESS (code=1, addess=....) -

Image
i'm developing app using objective c++. random crash (not around 10% of launch times). problem stack traces have nothing relating code , different: i enabled zombie object didn't help. i spent couple of day on issues , tried many method find out source of crash still stuck it. do guys have ideas ?

REST API - a method that updates and creates different resources -

i trying organize rest api best can , have encountered problem making me sweat. in rest api there movies , movierequests . the system empty, , users can request movies, creating movierequests . administrator can accept such requests. when request accepted, request updated accepted , new movie created. for now, these existing routes: get /movies /requests post /requests but don't know action of "accept request , create corresponding movie". my 3 indecisive ideas are: 1 . 1 route requests update request , create new movie: patch /requests/:id 2 . 1 route movies request id parameter or in body update request , create new movie: post /movies?request=id or { "requestid": requestid } 3 . 2 separate routes, 1 requests update request , movies request id on body request create new movie, requires call each route accept request : patch /requests/:id post /movies { "requestid":...

html - How do I align the endpoints of my input-fields in form, using css? -

Image
i making copy of pen-and-paper character sheet rpg, way of learning html/css. got stuck right @ beginning when trying style form, holding background information character. currently i've managed make form of labels , input-fields picture left. pen-and-paper character sheet (and desired look) formatted 1 on right. below code i'm using. .sheet-character-background form input, label { margin-bottom: 10px; } .age-input { width: 60px; } <div class="sheet-character"> <div class="sheet-character-background"> <form> <label>name</label> <input type="text" name="attr_name"> <br> <label>race</label> <input type="text" name="attr_race"> <br> <label>gender</label> <input class="gender-input" type="text" name="attr_gender"> ...

c++ - CppUnit - how use unique_ptr in setUp() -

the code taken http://cppunit.sourceforge.net/doc/cvs/cppunit_cookbook.html here creating pointers on heap , deleted them in teardown() private: complex *m_10_1, *m_1_1, *m_11_2; public: void setup() { m_10_1 = new complex( 10, 1 ); m_1_1 = new complex( 1, 1 ); m_11_2 = new complex( 11, 2 ); } void teardown() { delete m_10_1; delete m_1_1; delete m_11_2; } void testequality() { cppunit_assert( *m_10_1 == *m_10_1 ); cppunit_assert( !(*m_10_1 == *m_11_2) ); } void testaddition() { cppunit_assert( *m_10_1 + *m_1_1 == *m_11_2 ); } }; but if use unique_ptr instead. lifetime of unique_ptr? deleted @ end of setup()? , should create instance in every test? possible avoid code duplication unique_ptr? private: std::unique_ptr<complex> m_10_1; std::unique_ptr<complex> m_1_1; std::unique_ptr<complex> m_11_2; public: void setup() { m_10_1.reset(new complex(10, 1)); m_1_1.reset(new comp...

c++ - Understanding AddressSanitizer global-buffer-overflow error -

edit i the original error below came when compiling g++ 4.8 (installed devtoolset-2 on 32-bit centos 6). because __attribute__((no_sanitize_address)) doesn't work in cases on g++ 4.8, spent day compiling gcc 4.9 source. there no longer errors addresssanitizer! does mean gcc 4.8 produced defective code in first place? or addresssanitizer under 4.8 reported non-existent errors? or gcc 4.9 produces better code? or addresssanitizer under gcc 4.9 can't find errors? original addresssanitizer complains of global-buffer-overflow, don't understand why: aborts when calling method of object (via pointer base class): const char *typename = key->gettypename(); // <<<=== boom! i've ready many posts global-buffer-overflow being wrongly detected. 1 of them? how tell? (could vtable dvdbipstreaminfo object being corrupted? if so, wouldn't addresssanitizer catch that?) code outline: factory used create multiple objects via template. many other o...

angular2 routing - Angular routes pushed to array after creation not working in production -

i've created github repository has perfect example of issue. https://github.com/rjriel/dynamic-route-example the important part of code in repo in app.module.ts let mainroutes: routes = [{ path: "first", component: firstcomponent }] mainroutes.push({ path: "second", component: secondcomponent }) @ngmodule({ ... imports: [ routermodule.forroot(mainroutes), when running code in development (ie. ng serve ) both routes navigate correctly. however, when running code in production (ie. ng serve --prod ) second route added through mainroutes.push results in following error: error error: uncaught (in promise): error: cannot match routes. url segment: 'second' error: cannot match routes. url segment: 'second' @ t.bknc.t.nomatcherror (vendor.0828fd59ec5e6a599e72.bundle.js:1) @ e.selector (vendor.0828fd59ec5e6a599e72.bundle.js:1) @ e.error (vendor.0828fd59ec5e6a599e72.bundle.js:1) @ e.t14+.e._error (vendor.08...

Once applied dropout is applied ,how to keep the same structure for applying on the gradient (tensorflow) -

here do: i have nn (let's g(x)) i can output g(x) drop out (it drop out number of neurons) s fine me. but right after, i'd compute gradient of same g(x) (same hidden units dropped out). is there way memorize units dropped out , apply them gradient in tensorflow?

asp.net - Mime type for all files without extension in secured way -

to create universal link ios app, have provide following mime type on srever. few of team members have raised concern on security, after file without extension served client. is threat , how can prevent it? i tried set mime type particular file/ folder not possible. please help <staticcontent> <mimemap fileextension="." mimetype="application/json" /> </staticcontent>

php - Spotify API Assistance -

i work on project uses php pull favorite artists spotify account via api. enter spotify user name , password form , hit enter , have give me list of artists listen to. it looks have use these api functions: get list of current user's playlists get playlist's tracks (using above api call) get current user's saved tracks get current user's followed artists (if want display image or info artist) get artist (if want display info or photo of current user) get current user's profile i don't know started. saw there's library github don't want use that. can point me in right direction?

Changes in my java code in eclipse not show in application , even after liferay restart -

i have problem in eclipse 4.7 (oxygen) , liferay ide 3.1 when alter source code, changes have no effect . earlier working if restart liferay (was using liferay 2.6 , eclipse mars , java7) eclipse each time have dev ant-rebuild , after starting server changes reflect. have tried solution provided in other links (project -> build automatically) add project in server nothing seems work. based off answer previous comments have determined expecting see no supposed happen. if server running , make change java files (any file ending in .java) not see changes in browser (on gui) until save, compile, , deploy changes. so without additional tools need following ever .java change. save changes run ant compile target run ant direct deploy target you should see deployment happen in console , can refresh page , view changes. important note depending on change may need restart application container , clear temporary files. there few exceptions this. jsp cha...

How to remove blank row in Jasper reports -

this question in continuation : how hide textfield in report generated in specified format? depending on conditions when rows blank how remove ? in case 1 column hiding because (print non repeated rows), , 2 columns hidden becase of given condition (pdf.exclude) row blank. want remove blank row. can suggest ? i hope must using textfield, , navigate properties select textfiled tab , check blnk when null checkbox, if want remove line common tab tick remove line when blank. that's it

Akka Http | Graph with feedback makes the response hang -

i using stream source in akka http route. stream uses graph has feedback loop in it. when try action using wget, hangs. if remove loop , make plain left right stream, response terminates expected. see both requests broadcast-2 in proxy client , there output in wget response, hangs although see expected output. does know can causing this? actor "service" sends http xml request , transforms httpresponse. ive tried using connection pool , http.singlerequest, neither make difference, stream still hangs. ive included graph below route. //graph cycle def create(actor: actorref)(implicit log: loggingadapter, executioncontext: executioncontextexecutor, system: akka.actor.actorsystem, timeout: akka.util.timeout, materializer: akka.stream.materializer) = graphdsl.create() { implicit builder => import graphdsl.implicits._ import...

go - What is the Literal "Up" Key Escape Sequence in Golang -

i'm writing go program communicate server on telnet. has interactive little program (which have heard can made called "curses"--no familiarity there). while can send "enter" likes of "\r\n" find myself needing send "up" key. how write literal "up" key in go code, , appropriate escape sequences, in way send server? \x1b escape sequence. csi codes per this worked, \x1ba move cursor 1 row.

c# - Swipe gesture doesn't work when there is a pivot in UWP -

im designing uwp , want add swipe gesture open hamburger menu. however, in 1 of pages add in pivot, , swipe gesture doesn't open menu, instead switches pivotitem. how make them both alive in same page? here code swipe gesture: (thx http://blog.csdn.net/github_36704374/article/details/59580697 ) namespace humberger { public sealed partial class mainpage : page { private double x = 0; //用来接收手势水平滑动的长度 public mainpage() { this.initializecomponent(); this.manipulationmode = manipulationmodes.translatex; //设置这个页面的手势模式为横向滑动 this.manipulationcompleted += the_manipulationcompleted; //订阅手势滑动结束后的事件 this.manipulationdelta += the_manipulationdelta; //订阅手势滑动事件 } //手势滑动中 private void the_manipulationdelta(object sender, manipulationdeltaroutedeventargs e) { x += e.delta.translation.x; //将滑动的值赋给x } //手势滑动结...

copy - Excel VBA: Copying the desired data -

Image
i need write code copy data pertaining each unique id new csv file (meaning 1 csv file each unique id). i'm new excel vba. able copy entire data csv file. however, fail each unique id. sub exportcontract(control iribboncontrol) if thisworkbook.activesheet.name <> "contract" msgbox "please select contract tab , run again!" exit sub end if application.screenupdating = false accountname = thisworkbook.sheets("information").range("b4") path = application.activeworkbook.path sheets("contract").select sheets("contract").copy activeworkbook.saveas filename:=path & "\" & accountname & "_contract.csv", fileformat:=xlcsv, createbackup:=false activewindow.close end sub now, not code snip. but, real program incorporating solution provide, into. you need start @ first cell, move down , export each row. you're exporting csv, easier export writing text file, not via "sa...

python 2.7 - How to get the duration of a threshold breach in a pandas data frame? -

i'm looking suggested approach following time efficient in pandas. let's have dataframe looks this: [timestamp] [val] 2017-08-19 22:28:42.000 151 2017-08-19 22:28:42.001 127 2017-08-19 22:29:42.000 149 2017-08-19 22:34:10.000 127 2017-08-19 22:35:10.000 126 2017-08-19 22:36:10.000 132 2017-08-19 22:37:10.000 129 2017-08-19 22:39:10.000 124 how duration when val exceeds 127? so i'd expect answer of: 22:28:42 -> 22:28:42.001 22:29:42 -> 22:34:10.000 22:36:10 -> 22:39:10.000 i @ these date ranges , carry out actions like: how many datapoint there between dates value above 127 first sort data timestamp >> df['timestamp'] = pd.to_datetime(df['timestamp']) >> df = df.sort_values('timestamp') then find positions val changes lte or gt 127 >> df['changed'] = (df['val'] > 127).astype(int).diff().fillna(1).astype(int) >> df timestamp ...

r - do I still need to makeCluster if I'm already doing registerDoParallel(cl) -

reading vignette doparallel . are following 2 code blocks 1 , same? library(doparallel) no_cores <- 8 cl <- makecluster(no_cores) registerdoparallel(cl) pieces <- foreach(i = seq_len(length(pieces))) %dopar% { # stuff} is above same this: library(doparallel) registerdoparallel(cores = 8) pieces <- foreach(i = seq_len(length(pieces))) %dopar% { # stuff} must makecluster() when using doparallel if want use multiple cores? or single line enough registerdoparallel(cores = 8) on windows machine, these 2 examples equivalent. difference first example uses explicit cluster object , second uses implicit cluster object created when execute registerdoparallel . performance of 2 examples should same. on mac or linux machine, first example uses snow derived backend (exactly same on windows machine), using clusterapplylb perform parallel computations. second example uses multicore derived backend (which never available on windows), using mclapply pe...

Delete/Edite a client message in private Chat with Telegram Bots -

in private chat bot (a user , bot), possible edit/delete user messages? creating telegram bot registration. registration step, users insert password, , security considerations, want replace stars or delete it. idea? this seems provide s solution - https://github.com/yagop/node-telegram-bot-api/issues/328 . basically, there's deletemessage endpoint can use - https://core.telegram.org/method/messages.deletemessages , passing message id. when message (with it's id), delete it.

java - How to receive message from wildfly jms queue using consumer -

i encountered knotty problem when receiving message wildfly jms queue,my code blow: session producesession = connectionfactory.createconnection().createsession(false, session .client_acknowledge); session consumersession = connectionfactory.createconnection().createsession(false, session .client_acknowledge); apsschedule apsschedule = new apsschedule(); boolean success; messageproducer messageproducer = producesession.createproducer(outqueuemaxusorder); success = apsschedule.sendd90order(producesession,messageproducer, d90orderaps); if (!success) { logger.error("can't send aps schedule msg "); } else { messageconsumer consumer = consumersession.createconsumer(inqueuedeliverydate); data = apsschedule.received90result(consumersession,consumer); } then getting received90result(): pub...

Python print format for pipe sepatated -

this question has answer here: printing tabular data in python 4 answers printing lists tabular data 9 answers python format tabular output [duplicate] 6 answers could 1 please desired output. below script, output , desired output need help script: print "test | qa | result" print "test1 | load | passed" print "test2 | power load| failed" print "test3 | cpu device1 connected | passed " out put getting: test | qa | result test1 | load | passed test2 | power load| failed test3 | cpu device1 connected | passed desired output: test | qa | result test1 | load | passed test2 | power load | failed te...

arrays - PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" -

i running php script, , keep getting errors like: notice: undefined variable: my_variable_name in c:\wamp\www\mypath\index.php on line 10 notice: undefined index: my_index c:\wamp\www\mypath\index.php on line 11 line 10 , 11 looks this: echo "my variable value is: " . $my_variable_name; echo "my index value is: " . $my_array["my_index"]; what these errors mean? why appear of sudden? used use script years , i've never had problem. what need fix them? this general reference question people link duplicate, instead of having explain issue on , on again. feel necessary because real-world answers on issue specific. related meta discussion: what can done repetitive questions? do “reference questions” make sense? notice: undefined variable from vast wisdom of php manual : relying on default value of uninitialized variable problematic in case of including 1 file uses same variable name. majo...

java - Assert that page contents are correct with no extra elements in it -

i writing automation code , asked make test case assert page contents correct , if there element (text) in page test should fail have no idea how make test fail if there element in page suggestions me? driver.getpagesource().contains("text looking for"); you can use above in assert statement , verify. test passes if text(label) found else fails.

How to resolve "Parse error: syntax error" in PHP? -

this question has answer here: php parse/syntax errors; , how solve them? 11 answers i try many solution help.i try switch on short_tags_on no solution. i getting error: parse error: syntax error, unexpected end of file in c:\xampp\htdocs\photo_gallery\includes\functions.php on line 76 here code, wrong? <?php function strip_zeros_from_date( $marked_string="" ) { // first remove marked zeros $no_zeros = str_replace('*0', '', $marked_string); // remove remaining marks $cleaned_string = str_replace('*', '', $no_zeros); return $cleaned_string; } function redirect_to( $location = null ) { if ($location != null) { header("location: {$location}"); exit; } } function output_message($message="") { if (!empty($message)) { return "<p class=\"message\"...

php - How to add new uploaded image in assets Manager - GrapesJS? -

i have uploaded image using php , how can add in assets manager - grapesjs? please write demo code rather pasting link assets api the ajax call expects, result, json assets inside data key: { data: [ 'https://image/path', {type: 'image', src: 'https://image/path', height:350, width:250}, .. ] }

r - taskscheduleR can not find function. ERROR -

i've been trying package taskscheduler hourly information web. use package twitter mine user-information. set loaded library() , function available r, but. when set scheduler, scheduler works , black window appear. when check log file, see script don't run perfectly. error in function(): can not function, stopped execution. so try run script manually without clear enviroment, , works. not scheduler! i don't know why doesn't work, because function must loaded package() try require() - no change. so can me ?

c++ - IOCTL Driver SystemBuffer always NULL -

i have simple struct pass driver. here struct: typedef struct readstruct { ... } readstruct, *prreadstruct; here usermode application: dword dwreturn; readstruct reader{ ... }; writefile(hdriver, (lpcvoid)&reader, sizeof(readstruct), &dwreturn, null); here driver code, returns null readstruct. doing wrong? pio_stack_location piostackirp = null; prreadstruct readstruct; piostackirp = iogetcurrentirpstacklocation(irp); dbgprintex(0, 0, "writebufferedio\n"); if (piostackirp) { readstruct = (prreadstruct)irp->associatedirp.systembuffer; if (readstruct) { // place never if (readstruct->readsize) { readmemoutputclient(readstruct); } } } do_buffered_io flag should set in driverentry in deviceobject->flags . thanks user @rbmm pointing out.

javascript - How to send data in 2 dimensional array with ajax to the php page and print each dimension separately? -

Image
so,i have made page has multiple checkboxes. fetching data check boxes, storing data in 2dimensional array jquery. code looks this, htmlpage, <input type="checkbox" name="checkboxs[]" price="12" value="something1"> <input type="checkbox" name="checkboxs[]" price="15" value="something2"> <input type="checkbox" name="checkboxs[]" price="16" value="something3"> <div id='answer'></div> ... jq var data =[]; .find("input[type='checkbox']:checked").each(function (){ data.push($(this).val(),$(this).attr('price')); }); saving in data when consoled this, output :["corn bhel","15","corn tikki chat","15","corn dahi puri","15"] sending ajax., $.ajax({ type:'post', url:'check.php', datatype: 'htm...

c# - Data annotation throw exception instead of validation message -

in asp mvc use data annotation [stringlength(500)] public string comment { get; set; } and in controller : public actionresult applyvacation(request request , formcollection form) { if (modelstate.isvalid) { return view("success"); } } in view use : @html.validationmessagefor(model => model.comment, "", new { @class = "text-danger" }) and when enter value excced 500 string length throw exception instead of validation message exception : system.data.entity.validation.dbentityvalidationexception: validation failed 1 or more entities.

ionic framework - Ionic2: SVG icons don't appear -

i'm using ionic2: want use custom icon, follow link: ionic2-custom-icons but when use online svg icons appears in browser , works correctly when converted png icons svg don't appear.

ios - Firebase query - Find item with child that contains string -

i'm having bit of trouble firebase query. want query objects, objects child value contains string. far have looks this: firebase *ref = [[firebase alloc] initwithurl:@"https://dinosaur-facts.firebaseio.com/dinosaurs"]; [[[[ref queryorderedbykey] querystartingatvalue:@"b"] queryendingatvalue:@"b~"] observeeventtype:feventtypechildadded withblock:^(fdatasnapshot *snapshot) { nslog(@"%@", snapshot.key); }]; but gives objects have starting value of "b". want objects contains string "b". how do that? there no contains or fuzzy matching methods in query api, have guessed if you've scanned the api , the guide on queries . not has subject been discussed ad nauseam on [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ], i've touched several times on why 1 should use real search engine , instead of attempting sort of half-hearted search approach. there reason it's easier google website find results use built-in s...

python - How in a numpy array we can select just rows that are multiples of for example 3? -

i search numpy statement doing this: if a = [11,12,13,14,15,16,17,18,19,20,21] , b=3 then: c = [rows multiples of b]=[11,14,17,20] the following should work: a[::b] result: array([11, 14, 17, 20])

Android ffmpeg restreaming video bind failed address already in use -

i receiving udp streaming camera(go pro camera) , want re streaming stream remote server. here command have tried "ffmpeg -i 'udp://@10.5.5.9:8554' -fflags nobuffer -f:v mpegts -probesize 8195 -vcodec libx264 copy http://103.x.x.x:8090/feed1.ffm" in build.gradle have included following compile 'com.github.hiteshsondhi88.libffmpeg:ffmpegandroid:0.2.5' here code exec("ffmpeg -i udp://@10.5.5.9:8554 -fflags nobuffer -f:v mpegts -probesize 8195 -vcodec libx264 copy http://103.x.x.x:8090/feed1.ffm"); public void exec(string command){ try { // execute "ffmpeg -version" command need pass "-version" // now, can execute command here ffmpeg.execute(command, new executebinaryresponsehandler() { @override public void onstart() {} @override public void onprogress(string message) {} @override ...

encryption - How can I pass username/password as an encrypted via SoapClient in PHP? -

i using soapclient call wsdl web-service, , working fine, have send username , password encrypted text not plane text (my web service using https) , idea guys? $client = new soapclient("https://my-server/ws/student_api.php?wsdl", array('login'=> "test@test.ac.ae",'password' => "123456")); $client->__soapcall("getstudentlist", array("std_id1"));

web services - delphi - error while importing webservice deviceio.wsdl of Onvif -

when importing https://www.onvif.org/ver10/deviceio.wsdl delphi xe3 , generates following error: system error: -2146697191. line: 0 . i same error delphi 2007. have used wsdl importer many times first time have error. thanks

how to split the data from $_POST var_dump in php -

Image
hi guy's first time using var_dump in php function. don't know how split data var_dump maybe can me give example split data. hope method simple can understand. have try search in forum , can understand it. this data have got `var_dump please give me simple example that. please explain me. use code data. because 1st time. <?php include('../../connections/koneksi.php'); $tabledata = var_dump($_post); echo $array; ?> this actual data http://jsfiddle.net/minervaz/us4a9gkl/ you can't use echo display object or array.so use var_dump() or print_r() javascript code : <script type="text/javascript"> $(document).on('click','#display_data',function(e){ var converttabletojson = function() { var rows = []; $('.table-bordered tr:has(td)').each(function(i, n){ var $row = $(n); rows.push([ $row.find('td:eq(0)...

ruby - Failed to install gem mysql2 on Ubuntu 16.04.3 LTS -

when run gem install mysql2 command following error message: building native extensions. take while... error: error installing mysql2: error: failed build gem native extension. ... not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. ... see why extension failed compile, please check mkmf.log can found here: /home/lucivaldo/.rvm/gems/ruby-2.4.0/extensions/x86_64-linux/2.4.0/mysql2-0.4.9/mkmf.log extconf failed, exit code 1 gem files remain installed in /home/lucivaldo/.rvm/gems/ruby-2.4.0/gems/mysql2-0.4.9 inspection. results logged /home/lucivaldo/.rvm/gems/ruby-2.4.0/extensions/x86_64-linux/2.4.0/mysql2-0.4.9/gem_make.out looking @ log file described @ end of message noticed library missing. how solve problem? searching here in stack overflow itself, found solution problem similar following command, solves problem: sudo apt install libgmp3-dev

javascript - read image from firebase storage and view it in img with java script -

hi guys there example how read image fire base , show in img or others things know how upload , create child don't know how view in img please me var getdow let database=firebase.database(); var filebutton = document.getelementbyid("filebutton"); var imageurl = document.getelementbyid("image22"); var main = document.getelementbyid("imgelement"); var bildeurler =database.ref("bildeuler"); function largeurl(snap){ let url=snap.downloadurl; bildeurler.push(url); } filebutton.addeventlistener('change', function(e){ var file = e.target.files[0]; var storageref = firebase.storage().ref('kora/'+file.name); storageref.put(file).then((largeurl)); });

Using wait Processor in nifi -

Image
i need use wait processor terminating invokehttp processor in case of failure, have tried - how use wait\notify processor? , added distributecashmapserverservice putdistributemapcachprocessor (i have made host:localhost port 4557 both distributemapcachclient , server service), both of them still throws execpetion: here's screenshot of error message: should change server port? or configure way? here workflow:

c++ - How does the priority of :: and (expr) matter? -

my c++ textbook says there's 18 priority classes operators in c++. topmost class contains 1 operator, "scope resolution" operator (double colon, :: ). "expression grouping" operator falls 2nd class, there's "function call" operator. the priority :: , name(arg) (function call) seems clear me can think of a::b(c) , should evaluated (a::b)(c) . can't figure out when scope resolution operator , expression grouping operator can lead ambiguity if were in same priority class. a * b + c * (b + c) // parentheses "expression grouping" operators

java - How does WebView.loadurl work behind the scenes? -

i new android development. figured out loadurl function webview.java has following definition: public void loadurl(string url) { checkthread(); mprovider.loadurl(url); } where mprovider instance of interface webviewprovider. function not inside interface itself. now how calling function loads url when nothing anywhere in above mentioned places. is general programming concept don't understand. can please explain?

javascript - dragging an element with middle mouse button -

i drag element middle mouse button. i'm using jquery, , default, drag event set left mouse button. found 7 years old ticket on jquery ui guy asks implement option in draggable object. seems wasn't implemented, guy has working demo (it's right mouse button in demo) modified jquery file. don't want modify jquery source code. on this thread , manage make drag work when user shift + left mouse button . found this thread explains how enable/disable drag event. is there way middle mouse drag jquery? the following code allows me shift + left mouse button , that's not desired result. can't figure out how start drag when user uses middle mouse button. $(function(e) { var handler = function(e) { if (e.shiftkey) { $('.objects').draggable({ disabled: false }); } else { $('.objects').draggable({ disabled: true }); } }; $(documen...

node.js - Error: Handshake inactivity timeout while using sails-mysql on macOS Sierra -

Image
i've seen many answers yet i'm not able resolve issue. i'm using node 6.11.2, sails-mysql connect mysql xampp on macos sierra. i've tried increasing timeout in protocol.js nothing works. error: hook (`orm`) failed load! error: error (e_unknown) :: encountered unexpected error : not connect mysql: error: handshake inactivity timeout @ afterwards (/users/shubham/vscode/hirexl/node_modules/sails-mysql/lib/connections/spawn.js:72:13) @ /users/shubham/vscode/hirexl/node_modules/sails-mysql/lib/connections/spawn.js:40:7 @ handshake.onconnect (/users/shubham/vscode/hirexl/node_modules/sails-mysql/node_modules/mysql/lib/pool.js:54:9) @ handshake.sequence.end (/users/shubham/vscode/hirexl/node_modules/sails-mysql/node_modules/mysql/lib/protocol/sequences/sequence.js:96:24) @ /users/shubham/vscode/hirexl/node_modules/sails-mysql/node_modules/mysql/lib/protocol/protocol.js:399:18 @ array.foreach (native) @ /users/shubham/vscode/hirexl/node_modules/sails-mysql/node_modules/my...

docker - Jenkins not runing new junit test pipeline -

after genereate junit test jenkins find them there problem reports. here pipeline: pipeline { agent { node { label 'agent1' } } stages { stage('build') { steps { git "https://github.com/vforv/hapi-seneca-ts" sh ''' ./system/fuge/ci/docker-up.sh ./system/fuge/ci/docker-down.sh ''' } } stage('test') { steps { sh ''' ./system/fuge/ci/docker-up-test.sh ''' sh ''' mkdir -p test docker cp devtest_api_1:home/app/test/api.xml test/api.xml ''' } } } post { { junit 'test/*.xml' } } } this error get: error: test reports found none of t...

rust - Lifetimes when Deserializing JSON within a FromForm -

i'm having trouble understanding relationship between lifetimes on code. basically, have rocket api receives x-www-form-urlencoded data, 1 key: json . key contains, intuitively, json value, encoded percent-encoding, of struct message<t> . (i'm aware suboptimal api design, reverse-engineering work, have no option) to used request guard from<message<t>> , i'm implementing fromform . that, need implement fromform<'f> message<t> t implements deserialize<'de> . wrote impl signature impl<'f, 'de, t> fromform<'f> message<t> t: deserialize<'de> . to perform decoding, i: get "json" key of form data; url-decode value; parse json contained in value. bailing out possible. code doing (explicit type annotations reader's convenience): fn from_form(items: &mut formitems<'f>, strict: bool) -> result<self, self::error> { // json field let e...

authentication - 1 User Multiple Accounts 1 android app transfer data from login activity to splashscreen activity -

i'm developing app user must able switch between accounts. of i'm able allow app 1 account log in. how can allow user create account , switch between them in android app? update:- i'm able auth google button (firebase) i want in app! in login.class stored value of uid got firebase. want send data splashscreen check if uid==null redirect login , if uid !=null redirect mainactivity. login.class string mypreferences = "myprefs" ; string uid = "uidkey"; sharedpreferences sharedpreferences = login.this.getpreferences(context.mode_private); sharedpreferences.editor editor = sharedpreferences.edit(); editor.putstring("uid", uid); editor.putboolean("is_logged_before",true); //this line trick editor.commit(); toast.maketext(login.this,"uid:"+uid,toast.length_long).show(); ...

npm - peerDependency never fulfilled despite being installed correctly -

i having trouble understanding how correctly list dependencies in package.json . i have 3 projects want use together: a , b , c . a @ tag 1.0.0 want use in b , in b 's package.json have listed a range of ^1.0.0 peerdependency . b dependency of c . when install c , "[...] requires peer of a.git#semver:^1.0.0 none installed." correct since peer dependencies aren't installed automatically. add a 1.0.0 c 's dependencies , run npm install again – same message appears. why happen? since correct version on a included in c , b 's peerdependency should satisfied, message indicates not. i using npm 5 supports semver ranges git urls.

opencv is not working with tensorflow virtualenv -

i have installed tensorflow(virtualenv) on ubuntu(14.04) , installed opencv. opencv working python tensorflow(virtualenv) working python unable use tensorflow(virtualenv) , opencv python. opencv need there in virtualenv. can create symbolic link of cv2.so inside virtualenv, if have installed opencv globally. more details regarding creating symbolic link of opencv inside virtualenv,you can step 11 of following blog: http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/

php - How can I skip the first if statement occuring in a loop? -

i have made loop print table <tr> , <td> here code: echo "<tr>"; for($i = 0; $i < (int)count($fieldvalues); $i++){ echo "<td>" . $fieldvalues[$i] . "</td>"; if($i % 4 == 0){ echo "<td><input type='text'></td><td><input type='submit' value='add cart'></td></form></tr>"; } } i want skip first if statement in loop because condition $i % 4== 0 true when $i 0, is, 0 % 4 == 0 .the value of $fieldvalues 8. other method overcome appreciated. check not 0 in conditional. if(!empty($i) && $i % 4 == 0){ or if($i != 0 && $i % 4 == 0){ i'd use foreach rather for . a demo: https://3v4l.org/bg2ns

email - Sending feedback mail using java mail using jsp -

i trying send feedback email using java mail in jsp. code is <%@ page import = "java.io.*,java.util.*,javax.mail.*"%> <%@ page import = "javax.mail.internet.*,javax.activation.*"%> <%@ page import = "javax.servlet.http.*,javax.servlet.*" %> <% string result; string = "receiver@mail.com"; string = "sender@mail.com"; string host = "smtp.gmail.com"; properties properties = system.getproperties(); properties.setproperty("mail.smtp.host", host); session mailsession = session.getdefaultinstance(properties); try { mimemessage message = new mimemessage(mailsession); message.setfrom(new internetaddress(from)); message.addrecipient(message.recipienttype.to,new internetaddress(to)); message.setsubject("subject"); message.settext("message send"); transport.send(message); result = "sent message successfully......

ios - How to rotate a UIView around it's proper center without distortion / skew -

i've built own animation engine, , want set rotation of ui view on each frame render (60fps) i've made video showing problem currently. it's close, it's still rotating in strange way: https://www.youtube.com/watch?v=1zkk4r0-6i4 i've implemented custom customuiview class, inherits ui view. has translation, scaling , rotation properties, when transform matrix, 3 happen in same action. var t = cgaffinetransform( translationx: self.translation.x, y: self.translation.y ); // apply scaling t = t.scaledby( x: self.scaling.x, y: self.scaling.y ); // apply rotation t = t.rotated(by:self.rotation) self.transform = t and size , width set this: view.frame.size.width = parsesize(value, axis: "width") view.layer.bounds.size.width = parsesize(value, axis: "width") i'm trying set both of these properties, i'm not sure if correct. i've set anchor point lot, , tried overall center point of view well. the problem was ...

c# - ASP.NET Returning JSON with ASHX -

i creating autocomplete functionality website. far, javascript part over. also, can membershipuser object of user matches. i need return json in following format: { query:'li', suggestions:['liberia','libyan arab jamahiriya','liechtenstein','lithuania'], data:['lr','ly','li','lt'] } and code in ashx: public void processrequest (httpcontext context) { system.web.script.serialization.javascriptserializer jsonserializer; string query = context.request.querystring["query"]; system.web.security.membershipusercollection users = system.web.security.membership.getallusers(); context.response.contenttype = "application/json"; foreach (system.web.security.membershipuser user in users) { if (user.username.startswith(query.tolower())) { context.response.write(query + environment.newline); context.response.write(user.email); ...

html - <div> expand on click using Jquery -

i have been surfing internet find answer how make div go down, when clicked on it. have no got it. way, havent got code. thankfull, if give me explanation it. your question not obvious try answer it. usually insert divs inside div , set class or element hidden in css. then, when user clicks on div, change css property using js or jquery , set visible. <html> <head> <style> .hidden { visibility: hidden; } .show { visibility: visible; } .blue { background: blue; color:white; heigth:400px; } </style> <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256 hwg4gsxgfzhoseeamdoygbf13fyquitwlaqgxvsngt4=" crossorigin="anonymous"></script> </head> <div id="parent" class="blue"> click on div <div id="content" class="hidden"> .... content inside fi...

How to call IF - ELSE IF condition in a Windows batch script? -

we have hundreds of *.pdf files in folder. each *.pdf have naming convention abc_100_filename.pdf or abc_200_filename.pdf or abc_300_filename.pdf . in batch script call *.exe file follows: call test.exe 100 filename call test.exe 200 filename call test.exe 300 filename as there no if condition validate file, incorrectly load files incorrect id. expected result: test.exe 100 should called file abc_100_testfile.pdf . we mistakenly call test.exe 200 instead of file execution. how write if - else if condition call .exe file in batch script. if %str1:~0,7%==abc_100 (call test.exe 100 filename) pause if %str2%==abc_200 (call test.exe 200 filename) there no need call .exe provided number pass test.exe enclosed in _ use parsing for. @echo off /f "tokens=1-2* delims=_" %%a in ( 'dir /b/a-d "*_*_*.pdf"' ) test.exe %%b "%%a_%%b_%%c" a file name fixed structure delimiting elements distinct chars can parsed /...

Can i add jshell repl (java 9) to vscode's terminal panel? -

new vscode, search returns nothing. i'd add jshell terminal window. possible? try setting shellargs integrated terminal launch jshell . on mac, be: "terminal.integrated.shellargs.osx": [ "-l", "-c", "jshell" ]

matrix - How to send sparse vectors and matrices over ZeroMQ? -

i have matrix a (how many stories start way?) sparse. [ [0, 0, 0, 1.2, 0] [0, 0, 0, 0, 0] [3.5, 0, 0, 0, 0] [0 7, 0, 0, 0] ] i want send variants of , forth between processes using zeromq. assume client , servers of different languages have no common serialization format. here tasks. create a . complicated needing send "frame" of matrix, here (4,5) . update a[4,2] 7 6. take sparse vector v=[0,0,3.1,0,0] , multiply a , result back. i've been told sending byte streams best solution, can't find examples between different libraries , in sparse format. my default have python, c++ or chapel pairing if can speak those. as you know , brian, zeromq not problem here lets try re-wrap problem formulation first: chapel features use zmq; provide from zeromq point of view, not originator's side python , chapel ( or c++, you've mentioned above ) target environment decide on best choice of best serialisation strategy pro...

mongodb - Akka HTTP Json Marshalling -

i'm building simple rest api using akka-http , mongodb persistence. marshalling , unmarshalling http requests i'm using spray json. following mongodb documentation defined entities that: package entities import org.mongodb.scala.bson.objectid case class person( _id: objectid, firstname: string, lastname: string, email: string, emailconfirmed: boolean, telephone: string, ... ) object person { def apply( firstname: string, lastname: string, email: string, telephone: string, ... ): publisher = new publisher( new objectid(), firstname, lastname, email, false, telephone, ... ) } the problem approach have write lot of boilerplate code enable marshalling-unmarshalling: implicit object publisheritemformat extends rootjsonformat[publisher] { def write(publisher: publisher) = jsobject( "_id" -> jsstring(publisher._id.tostring), "firstname" -> jsstring(publisher.firstname...