Posts

Showing posts from March, 2013

HTML form upload for ODT files / MIME type for *.odt -

i'm looking html form upload odt-files. need know parameter accept . <form method="post" action="upload.php" > <input type="file" name="file_upload" accept="" /> <button type="submit">upload</button> </form> with search in stackoverflow found have define correct mime type. for odt mime type application/vnd.oasis.opendocument.text the html code has that: <form method="post" enctype="multipart/form-data" action="upload.php" > <input type="file" name="file_upload" accept="application/vnd.oasis.opendocument.text" /> <button type="submit">upload</button> </form>

Automatically creating python script from GUI in Blender -

i have python script generated automatically actions in gui, such playing script replicate whole scene. the purpose able go on actions fine tooth comb later editing , revision. the idea seems intuitive, since every action in blender has equivalent python command (which displayed 1 clicks various buttons). one possible solution copy & paste info window. have searched 'history logging', 'history exporting', 'autocreate script', 'actions file', 'history file', , many variations on these themes - no avail.

javascript - Upload And Remove image -

i have upload button on web page, if upload image should show preview below , upload image should show next image , third should show next second image , on, , once click click "x" image should removed. here code <!doctype html> <html> <head> <meta charset=utf-8 /> <title>image preview</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script> <script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.js"> </script> <script> var blank="http://upload.wikimedia.org/wikipedia/commons/c/c0/blank.gif"; function readurl(input) { if (input.files && input.files[0]) { var reader = new filereader(); reader.onload = function (e) { $('#img_prev') .attr('src', e.target.result) .height(200); }; reader.readasdataurl(input.files[0]); }...

css - Is there any way to shape the submit button of the HTML form? -

Image
i'm creating html page forms. in want shape submit button arrow below (not below, i'm expecting 2d arrow)... is there way that... if you're interested using background image can use this: button{ background: transparent url(shape.jpg) no-repeat; border: none; box-shadow: none; width: 250px; /*img width*/ height: 350px; /*img height*/ }

html5 - Full screen in embedded videos from Youtube -

i want see screen full of embedded video getting black borders on left , right have included allow full screen in coding also.how remove borders , see stretched video? attaching code , screen shot .! screen shot of borders <iframe id="vid" width="100%" height="100%" src="https://www.youtube.com/embed/rdih8givr9i?autoplay=1&amp;modestbranding=0&amp;controls=0&amp;showinfo=0&amp;rel=0&amp;allowfullscreen=true"></iframe></div> the answer more complicated. "allowfullscreen" there displaying "fullscreen" button. (although it's kind of strange ) to make behave want to, have @ this explanation (the section " <iframe> ") basically, need put video in div full width of website (what did) , css magic make correct height.

ios - how to detect moving object in live video camera using openCV -

i using opencv ios application detect moving object in live video camera, not familiar use of opencv please me. other way welcome . - (void)viewdidload { [super viewdidload]; self.videocamera.delegate = self; self.videocamera = [[cvvideocamera alloc] initwithparentview:self.view]; self.videocamera.defaultavcapturedeviceposition = avcapturedevicepositionback; self.videocamera.defaultavcapturesessionpreset = avcapturesessionpreset352x288; self.videocamera.defaultavcapturevideoorientation = avcapturevideoorientationportrait; self.videocamera.defaultfps = 30; self.videocamera.grayscalemode = no; [self.videocamera start]; // cv::backgroundsubtractormog2 bg; } - (void)processimage:(cv::mat&)image { //process here cv::cvtcolor(image, img, cv::color_bgra2rgb); int fixedwidth = 270; cv::resize(img, img, cv::size(fixedwidth,(int)((fixedwidth*1.0f)* (image.rows/(image.cols*1.0f)))),cv::inter_nearest); //update model bg...

Speeding up complex Numpy Matrix multiplications (Point cloud) -

i have around 200 3d points need multiply rather complex 2d projection matrix. using numpy , loop, iterating through 3d point cloud, applying matrix transformations , getting data. this seems rather slow. there way might able vectorize this, or use kind of speed techniques (maps, pools etc.) f = matrix([ [735.4809, 0., 388.9476, 0.], [0., 733.6047, 292.0895, 0.], [0., 0., 1.0000, 0.] ]) vehiclerpy = self.getrt(roll=roll, pitch=pitch, yaw=0., x=imux, y=imuy, z=imuz); sonartocamera = self.getrt(roll=rtroll, pitch=rtpitch, yaw=rtyaw, x=rtx, y=rty, z=rtz); spacematrix = matrix([ [(sqrt(r**2 - (y/(cosd(roll)*cosd(pitch)))**2)*sind(theta))], [(y/(cosd(roll)*cosd(pitch)))], [(sqrt(r**2 - (y/(cosd(roll)*cosd(pitch)))**2)*cosd(theta))], [1] ]) finalmatrix = f*vehiclerpy*sonartocamera*spacematrix; uvmatrix = matrix([ [finalmatrix.item(0)/finalmatrix.ite...

jquery - Why doesn't My External Javascripts Run after an Ajax Call? -

i have code in index page pretty same other pages except contents in #content: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="author" content=""> <!--[if ie]><meta http-equiv='x-ua-compatible' content='ie=edge,chrome=1'><![endif]--> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <!-- title --> <title>home | ajax project</title> <!-- favicons --> <!-- styles --> <link rel="stylesheet" href="assets/css/bootstrap.min.css"> <link rel="stylesheet" href="assets/css/style.css"> </head> <body> <div class="nav-b...

html - Embedding an iframe in Wordpress does not work -

i need embed following code on self hosted wordpress installation - <iframe id="slydy" style = "border: none; max-width: 100%; min-width: 100px;" src = "http://slydy.co/users/tcc/01" width = "648" height = "435" frameborder = "0" marginwidth = "0" marginheight = "0" scrolling = "no" allowfullscreen = "allowfullscreen"> </iframe> but doesn't show up. i've installed same on @ least 2 other wordpress blogs , worked fine. what setting need tweak? probably 1 of these things: if website https blocked because iframe http. make sure in text ( not visual ) editing mode on post editing screen wp caching ?

javascript - Invalid characters in json response -

i unable process json response ,while accessing json response getting invalid characters in json response,so how can remove white space issues , invalid characters json response using php scirpt my json response : [{"keyword":"cosmetic dermatology","svol":4400},{"keyword":"dermatology associates","svol":22200},{"keyword" :"advanced dermatology","svol":40500},{"keyword":"dermatology clinic","svol":3600},{"keyword":"dermatology specialists","svol":3600},{"keyword":"dermatology consultants","svol":5400},{"keyword":"pediatric dermatology" ,"svol":3600},{"keyword":"what dermatology","svol":1900},{"keyword":"dermatology pictures","svol" :1300},{"keyword":"dermatological","svol":2400},{...

objective c - UitableView Search Text Sigbart Error - ios -

Image
i've implemented search bar (and display controller) in uitableview using code outlined below. when type in search text box following sigabrt error: terminating app due uncaught exception 'nsunknownkeyexception', reason: '[ valueforundefinedkey:]: class not key value coding-compliant key name.' i've re-reviewed tutorial i've been following , quadruple checked code cant find cause of error, can help? - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { if (tableview == self.searchdisplaycontroller.searchresultstableview) { return [self.searchresults count]; } else { return _restaurantsincity.count; } } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"restaurantcell"; uitableviewcell *cell = [_tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) {...

C++ constructor bug -

this question has answer here: why did error “error c2259: … cannot instantiate abstract class”? 3 answers this part of code : declaration in .h file : virtual bool operator==(const file& file) const = 0; and in .cpp file bool file::operator==(const file& file) const { return true; } i compilation error : 1>c:\users\talw\desktop\hw5\hw5\project1\main.cpp(76): error c2259: 'directory' : cannot instantiate abstract class 1> due following members: 1> 'bool file::operator ==(const file &) const' : abstract 1> c:\users\talw\desktop\hw5\hw5\project1\file.h(57) : see declaration of 'file::operator ==' please help. thanks this pure virtual operator overloading making class abstract can have function implementation in same class cannot insta...

javascript - How to properly set the data in swagger-js client for a PUT request which requires BOTH formData and path parameters? -

i have method requires both formdata , path parameters. how can set data in request? i using swagger-js v2. let's example below requires 3 parameters: resetpassword path parameter password formdata parameter repeat_password formdata parameter swagger_client.apis.users.resetpassword(<help!!>, function(response) { // success }, function(err) { // failure }); i'm not sure if still relevant stucked @ same problem , found solution. define parameter object this: var paramobj = { resetpassword: "resetpw", parametercontenttype: "multipart/form-data", password: formdata1, repeat_password: formdata2 }; then call with swagger_client.apis.users.resetpassword(paramobj,...

vb.net - Merging Data from Two Bindingsources -

i have 2 binding sources preloaded data 2 database tables @ time program loads(main form load) .in particular form,i want use data both tables,i mean data both binding sources(even including duplicates). there alternative way ,using sql query union both tables , binding control. but not practical because query return more 150000 rows or more(slows down),that ruin performance of whole system. so fellows,i looking other way using preloaded data in both bindingsources here also.please suggest me options.

csv - Python Script not creating file when run through Task Scheduler -

link python code running through task scheduler image link job detail on scheduler when running through job scheduler, python script not creating file in script directory (scraped data in csv files). tf-idf working perfect can't find files. it related environment. user running as? may try putting in few lines see thinks running. import os # print current working directory print "current working dir : %s" % os.getcwd() or go 1 step further , change dir want before processing begins. # first go "/var/www/html" directory os.chdir("/var/www/html" )

javascript - Promisify Nodemailer with bluebird? -

the nodemailer author has made clear he's not supporting promises. thought i'd try hand @ using bluebird, attempt @ doesn't seem catch errors nodemailer throws: var nodemailer = require('nodemailer'); var promise = require('bluebird'); // build transport promises var transport = promise.promisifyall( nodemailer.createtransport({...}) ); module.exports = { doit = function() { // use bluebird async return transport.sendmailasync({...}); } } then call doing: doit().then(function() { console.log("success!"); }).catch(function(err) { console.log("there has been error"); }); however, when providing invalid email, see this: unhandled rejection error: can't send mail - recipients rejected so, nodemailer error isn't being caught bluebird promise. have done wrong? can't what's wrong code top of head. i've ran similar problems promisification , decided it's easier pr...

oop - c# - static method or not, which one is the best? -

i know there posts on didn't find answer i'm looking for, , simple. i know calling method static or not (instanciation (oop)). example, using static: using system; namespace projet_test { class surfacescalcul { public static int calc_air(int a, int b){ int result = * b; return result; } } /* * ########################## * ########################## */ class mainclass { public static void main (string[] args) { console.writeline(surfacescalcul.calc_air(4,5)); } } } you call class(surfacescalcul).method , can access method. -- normal, using oop: using system; namespace projet_test { class surfacescalcul { public int calc_air(int a, int b){ int result = * b; return result; } } /* * ########################## * ########################## */ class mainclass { ...

c# - dateTimePicker1.Value < dateTimePicker2.Value = true when values are identical on runtime -

i have datetimepicker1 , datetimepicker2 controls loading on form1. both have same date , time on load. datetimepicker1.format = datetimepickerformat.custom; datetimepicker1.customformat = "yyyy-mm-dd hh:mm:ss"; datetimepicker2.format = datetimepickerformat.custom; datetimepicker2.customformat = "yyyy-mm-dd hh:mm:ss" when check if have different values using if (datetimepicker1.value < datetimepicker2.value) { console.writeline(datetimepicker1.value + " earlier " + datetimepicker2.value); } the statement returns true , writes console. not expect. expect return false. if increase each control's value 1 second, causing them still match, statement returns false expected , nothing written console. why less evaluation return true on load when both values identical? do not know how loading values. but, depending on precision looking (eg. in hours, minutes or second) can subtract 2 values , co...

hash - Is this a bad practice for storing passwords in PHP? -

i'm using crypt function in php hash passwords, along salt obviously. i'm generating salt calling md5 function on date function. , every time user logs in salt gets regenerated. is of bad in way? still relatively new php (and webdev) , i'm trying security right before deploy code. $salt = md5(date('m/d/y h:i:s a')); it considered bad practice many. here (some of) reasons: you using md5, weak, old, , fast calculate hash. the salt generated in predictable fashion. salt should different every user (even if registered in same second) , should more random date. you reinventing wheel. using crypt function hash passwords, there no reason not use getting secure salt. password_hash() built in function of php 5.5, , compatibility library versions older that. how use password_hash() tl;dr: use password_hash() generate salt , hash password, no need reinvent wheel in less secure fashion. credit given hobo sapiens mentioning password_h...

javascript - How should I handle promises and callbacks with waterline and bluebird? -

i'm having multiple problems while using sails because can't understand waterline promises , logic. i tried both built in bluebird promises , async.waterfall implementation , couldn't succeed. in few words, i'm writing code api performs db queries , triying use callbacks, it's never responding. this tried on pure promises: changeformation: function (request,response) { console.log("changeformation"); var lineupid = request.params.id; var newformation = request.param('formation'); var newlineup = request.param('lineup'); console.log("receiving" + newformation); if ( ["5-4-1", "5-3-2", "4-5-1", "4-4-2", "4-3-3", "3-5-2", "3-4-3"].indexof(newformation) === -1 ) { console.log("no válida"); return response.send(409, "la táctica elegida no es válida"); } lineup.findone({id: lineupid}). then(function (found...

How come GET doesn't retrieve Rails assets from "/" href path? -

when first load http://localhost:3000/ , assets loaded correctly onto home page: started "/" ::1 @ 2015-06-19 20:18:44 -0400 processing pagescontroller#home html rendered pages/home.html.erb within layouts/application (0.9ms) maker load (0.2ms) select "makers".* "makers" "makers"."id" = ? limit 1 [["id", 1]] completed 200 ok in 37ms (views: 36.0ms | activerecord: 0.2ms) started "/assets/jquery.js?body=1" ::1 @ 2015-06-19 20:18:44 -0400 started "/assets/application.css?body=1" ::1 @ 2015-06-19 20:18:44 -0400 started "/assets/jquery_ujs.js?body=1" ::1 @ 2015-06-19 20:18:44 -0400 started "/assets/parallax.js?body=1" ::1 @ 2015-06-19 20:18:44 -0400 started "/assets/turbolinks.js?body=1" ::1 @ 2015-06-19 20:18:44 -0400 started "/assets/events.js?body=1" ::1 @ 2015-06-19 20:18:44 -0400 started ...

mysql retrieve field names as part of recordset -

i have application must avoid processing of mysql recordset returned select query, since interacting return in way results in expensive vba operations (which crashes ms excel large data returns). instead pass recordset directly cell range. requires recordset formatted , sorted data server. i select query return recordset, first row of list of fields. find myself doing this (select 'ticker', 'name', 'revenue', 'eps') union (select ticker, name, revenue, eps, table ticker in ('blk','dov','esl','csco','fb','ame','axp','bac','beav','el','mmm','ibm')) order field(ticker, 'ticker','blk','dov','esl','csco','fb','ame','axp','bac','beav','el','mmm','ibm') which feels little bit ridiculous. there no mysql built-in function return field names record? ...

c++ - Largest data type which can be fetch-ANDed atomically? -

i wanted try , atomically reset 256 bits using this: #include <x86intrin.h> #include <iostream> #include <array> #include <atomic> int main(){ std::array<std::atomic<__m256i>, 10> updatearray; __m256i allzeros = _mm256_setzero_si256(); updatearray[0].fetch_and(allzeros); } but compiler errors element not having fetch_and() . not possible because 256 bit type large guarantee atomicity? is there other way can implement this? using gcc. if not, largest type can reset atomically- 64 bits? edit: avx instructions perform fetch-and atomically? so there few different things need solved: what can processor do? what mean atomically? can make compiler generate code processor can do? does c++11/14 standard support that? for #1 , #2: in x86, there instructions 8, 16, 32, 64, 128, 256 , 512 bit operations. 1 processor [at least if data aligned it's own size] perform operation atomically. however, operation ...

Can gnuplot use non-normalised scientific notation to label axis ticks? -

Image
i have plot generated gnuplot 4.4 on centos 6.6, y axis has auto-generated ticks following labels: 1.9e-05 1.8e-05 1.7e-05 1.6e-05 1.5e-05 1.4e-05 1.3e-05 1.2e-05 1.1e-05 1e-05 9e-06 is possible request, in gnuplot script, axis have consistent exponents? this: 19e-06 18e-06 17e-06 16e-06 15e-06 14e-06 13e-06 12e-06 11e-06 10e-06 9e-06 i think make values easier read , understand @ glance. i realise scientific notation conventionally normalised such coefficient sits in range [0,1] . i'd turn off. gnuplot can't automatically. need select desired exponent, scale data appropriately , add exponent manually format: exponent = -6 set format y '%.0f'.sprintf('e%d', exponent) scale = 10**(-exponent) plot 'data.dat' using 1:($2*scale) edit: specific example use gnuplots ability use scientifc powers (multiple of three): set terminal pngcairo enhanced font 'dejavu sans' set encoding utf8 set format y '%.0s✕10^{%s}' ...

performance - Android - Loading multiple text files into a RecyclerView -

i'm writing notetaking application android, , have recyclerview display grid of notes. each note has respective class called note. the note class knows/has: the filename (notes title) the file path note a loading method reads , returns text inside file the recyclerview reads arraylist of note. list populated scan of files in app's note directory, , note object created each file. i'm trying find best way load text recyclerview, displays preview of notes. i'm wondering if theres best way, or least stupid way this. ways can think of doing are: load every note's content @ once during initial scan , save string in note class in ram, downside being high ram usage alot of notes , text. load note's text in recylerview's onbindviewholder method, i'm worried if user scrolling through notes fast, , viewholder , note unbound before text loaded, there possible issues here. load each note's text in threadpool, increases performance same issue a...

java - Netty HTTP server with Spring framework -

i implementing netty application spring; however, application shuts down after starting without exception. my console output is: connected target vm, address: '127.0.0.1:62313', transport: 'socket' log4j:warn no appenders found logger (org.springframework.core.env.standardenvironment). log4j:warn please initialize log4j system properly. log4j:warn see http://logging.apache.org/log4j/1.2/faq.html#noconfig more info. disconnected target vm, address: '127.0.0.1:62313', transport: 'socket' server started process finished exit code 0 my code is: iserver : package org.crytek.server; /** * created eemrcag on 19.06.2015. */ public interface iserver { public void start(); public void restart(); public void stop(); } servernettyimpl : package org.crytek.server; import io.netty.bootstrap.serverbootstrap; import io.netty.channel.channel; import io.netty.channel.channelfuturelistener; import io.netty.channel.channeloption; import...

java - Add JDBC in Netbeans Maven Project -

i have created java maven project inside of netbeans. need access oracle database via java code. downloaded jdbc driver (.jar file) oracle, do include maven repository inside of netbeans? there link close want accomplish: http://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/ i not have maven installed on computer, have running inside of netbeans. what steps of adding jdbc driver inside of netbeans maven repository? cheers you there... not use netbeans, i'm sure somewhere under it, has maven installed. so, try locate mvn executable, , follow instruction provided in link posted, or official instructions it. another try run command install:install-file -dfile=<path-to-file> -dgroupid=<group-id> -dartifactid=<artifact-id> -dversion=<version> -dpackaging=<packaging> goal, inside netbeans (again, i'm not netbeans user, since other tools allow it, maybe netbeans same...). a google search sh...

java - Can't understand why my || is not working -

i'm trying make simple game (even without interface). supposed type action (attack or block). why ( enemy_hp > 0 || hp > 0 ) statement doesn't work? loop goes forever. public class game { public static void main(string[] args){ int hp = 10, enemy_hp = 10; string attack = "attack"; string block = "block"; scanner userinput = new scanner (system.in); while (enemy_hp > 0 || hp > 0) { system.out.println("it turn, attack or try block"); int your_block_chance1 = (int) (math.random() * 4); //chance block attack int enemy_block_chance1 = (int) (math.random() * 4); string action = userinput.next(); if (action.equals(attack)){ system.out.print("you attacked enemy , "); if (enemy_block_chance1 == 0) { system.out.println("he blocked it"); } ...

Minesweeper mistake in the game? -

Image
today started playing minesweeper fun. dont understand mistake in thinking. you can see, clicked on left field near 4 , 3. there number 2 near 3. okay think there can 3 mines in 8 blocks why did thinking wrong? would appreciate explaining mistakes number @ top. gambler92 i'm not familiar look. red mine was, crossed clicked, right? well, if @ 2 @ right border. there 2 mines @ top left , bottom right. under 2 can no mine. if @ 3, lower , left 4. there 2 known mines , there single cell right, had have mine.

python - Gsutil - Issue with downloading data from GCS buckets -

i have data in gcs buckets. have application runs gsutil command download data buckets , further processing. before i have gsutil 4.7 installed , had .boto file configured oauth refresh token, proxy host name, proxy port , project id. my application worked fine , data being downloaded calling following command via python subprocess module. "gsutil -m cp -r gcs_path destination_path" as pointed out above, command run within python application. now suddenly, noticed files being downloaded of lesser size observed in gcs buckets. example, if have file 49mb size, being downloaded partially/incompletely , size 0-20kb , on. this happening when gsutil being called within python application. moreever, stdout when application executing gsutil command shows 49mb out of 49mb downloaded. when go destination directory , check file sizes, way off. however, when try same gsutil command outside python application i.e. give following linux command in terminal, data d...

python - Window is closing immediately after I run program in PyQt 4 (anaconda) [PyCharm 4.5] -

so, trying run simple program (a window) in pycharm running anaconda 2.7 & pyqt4. whenever click run button opens program closes window fast me see it. may anyone, please help? thank you! p.s. i'm new programming. {__author__ = 'jay' import sys pyqt4 import qtgui app = qtgui.qapplication(sys.argv) window = qtgui.qwidget() window.show()} you need block execution of program after call window.show() window object remains active otherwise garbage collected. app.exec_() you. {__author__ = 'jay' import sys pyqt4 import qtgui app = qtgui.qapplication(sys.argv) window = qtgui.qwidget() window.show() app.exec_()} # added line

ios - Detect if UIImage is light or dark -

i need create smart detector can detect if uiimage light or dark, can on uilabel textcolor in opposite color, either black or white. can done in few lines or need hardcore coreimage manoeuvre? thanks! seeing if image "dark" or "light" won't work generally. part end putting text on have both light , dark parts if overall image might considered 1 or other. a common solution adding text random picture add partially transparent black background white text (or partially transparent white background black text).

javascript - How to use ngChange on a div (or something similar) -

i had input had ng-change on it, changed contenteditable div, can have little more control on can input. thing when changed input div, no longer able use ng-change . can obtain same effect/result? here how using in template: <div class="form-control" ng-model="search" ng-change="searchchanged()" contenteditable="true">{{seach}}</div> inorder support ng-model ng-change other form element, need create custom directive. example simple implementation below directive named contenteditable (much similar angular having internal directives input , form etc), have require ng-model , on keyup event set viewvalue , render ng-model. when setviewvalue ng-model , values different prev value angular evaluate ng-change expression. .directive('contenteditable', function() { return { require: 'ngmodel', restrict: 'a', link: function(scope, elm, attr, ngmodel) { ...

java - How to create a composite primary with JPA (or Hibernate) annotations -

i got problem common problem , decided share resolution here. the problem: have composite primary key in 1 of tables. need map jpa annotations. my pojo1: public class alarm { @id @column(name="alm_id") private string id; @column(name="alm_description") private string desc; @manytoone @joincolumn(name = "alm_norm_id") private alarm normalarm; //getters , setters } my pojo2: public class equipment { @id @column(name="equ_id") private string id; @column(name="equ_fixed_asset") private string fixedasset; @column(name="equ_service_tag") private string servicetag; //getters , setters } so have table primary key equipment + alarm , need map that. i didn't want create separate class handle primary key @idclass annotation. decided use @embeddedid , @embeddable annotations instead. result was: @entity @table(name="alarm...

java - Mockito error with method that returns Optional<T> -

i have interface following method public interface iremotestore { <t> optional<t> get(string cachename, string key, string ... rest); } the instance of class implementing interface called remotestore. when mock mockito , use method when: mockito.when(remotestore.get("a", "b").thenreturn("lol"); i error: cannot resolved method 'thenreturn(java.lang.string)' i thought has fact returns instance of optional class tried this: mockito.<optional<string>>when(remotestore.get("cache-name", "cache-key")).thenreturn (optional.of("lol")); but, error instead: when (optional '<'string'>') in mockito cannot applied (optional'<'object'>'). the time worked this: string returncachevaluestring = "lol"; optional<object> returncachevalue = optional.of((object) returncachevaluestring); mockito.<optional<obj...

java - TreeView - Jtree (NetBeans) How to add a description to a node -

im making simple treeview on netbeans , id know how can add description determined selected node, through button have function associate lable. click see treeview image here the link shows image of want do, clicking ">>" add description lable , associate selected node. this code ">>" button. private void add2actionperformed(java.awt.event.actionevent evt) { ltree2.settext(tf2.gettext()); } obviously isnt want, put here show want. you want create own class tree nodes, subclass of whatever you're using now, adding description field , corresponding accessors in subclass. example, if you're using defaultmutabletreenode : class mynode extends defaultmutabletreenode { private string description; ... public void setdescription(string descr) { description = descr; } public string getdescription() { return description; } } once you've done that...

asp classic - how to register asphttp.conn component -

i need enhancements classic asp application uses asphttp.conn. trying set application on system. have dll, not sure how install , set on system. can please steps register asphttp dll on system. did check asphttp dll documentation? http://www.serverobjects.com/comp/asphttp3.htm never mind. answer is: steps vary, depending on library (sorry, never used before asphttp dll) , on version of iis , of course version of operation system. in general steps library are step 0) find proper folder going store dll. if dll required 1 web site (let's "web01" web site only), keep them in folder "x:\inetpub\web01\dll\" step 1) regsvr32 yourdll.exe if have 64 bit os , 32 bit library (dll) should run c:\windows\syswow64\regsvr32.exe. if have 64 bit os , 64 bit library (dll) should run c:\windows\system32\regsvr32.exe. step 2) depending on folder, store dll. if store dll in windows\systemxx folder, may should skip step. otherwise perhaps needed add re...

json - My data is being written to Firebase database but i can't read it why? -

i'm new swift , databases. i'm trying read firebase database. i'm using example code provided here: https://www.firebase.com/docs/ios/guide/retrieving-data.html . i'm calling viewcontroller.swift file in override func viewdidload(){} func getrootref(){ // read data , react changes println("entered getrootref") myrootref.observeeventtype(.value, withblock: { snapshot in println("value1") println(string(stringinterpolationsegment: snapshot.value)) println("value2") }, withcancelblock: { error in println(error.description) println("error") }) println("left getrootref") } output: entered getrootref left getrootref viewcontroller3 viewcontroller4 value1 (function) value2 i not understand why "(function)" printing out instead of data. both read , write permission set true. making mac ap...

python - Run javascript on django login and logout events -

is possible execute javascript (in template) after successful login event or after successful logout event. if yes, how? i don't want asscociate login button click or logout button click on js level because clicking button not guarantee successful login/logout event i have lot of login , logout buttons, many templates , partials looking centralized solution by way using python-social-auth. here's how i'd approach it. make view has template contains js want execute on login (it blank page redirects somewhere else, or template extends template... there myriad of ways dry here, think). set social_auth_login_redirect_url , social_auth_new_user_redirect_url , and/or social_auth_new_association_redirect_url (whichever of decide use in step 3) in settings.py . make entry in urls.py makes view accessible either social_auth_login_redirect_url (or both social_auth_new_user_redirect_url , social_auth_new_association_redirect_url , if want execute new use...

Kivy Python - How to access parent object whithout root -

i not know python, don't know if problem more kivy or python. want call parents' method on click/press. cannot access root object ( attributeerror: 'issuebutton' object has no attribute 'root' ) nor global variable defined earlier ( nameerror: name 'global_screen_manager' not defined ) i using screenmanager switch screens , using listview listadapter create these buttons want call method talking about. funny thing not button has several parents above it, gridlayout . how can define root issuebutton @ bottom of py-file? there way call method on-detail_press issuescreen ? ok use global screenmanager or there preferred way pass reference? thanks in advance! here's code: github.com/timokramer/repodigger the py: #!/usr/bin/python3 # -*- encoding: utf-8 -*- kivy.app import app kivy.uix.screenmanager import screenmanager, screen kivy.uix.listview import listitembutton kivy.properties import objectproperty, listproperty kivy.network.ur...