Posts

Showing posts from September, 2010

javascript - How to extend the class which inherits Backbone.Events? -

i'm trying create following structure of classes using backbone.js inheritance model: backbone.events -> parent -> child child should call initialize parent, unfortunately not work. parent methods , properties not visible. please help. my code var parent = function() { this.initialize.apply(this, arguments); }; _.extend(parent.prototype, backbone.events, { initialize: function() { // parent init }, }); var child = function() { this.initialize.apply(this, arguments); }; _.extend(child.prototype, parent, { /* inherits parent */ initialize: function() { // need call `parent init` code // need init myself (child) // not work // parent methods , properties not visible parent.prototype.initialize.call(this, arguments); } }); just use following approach: function parent() { this.initialize.apply(this, arguments); }; _.extend(parent.prototype, backbone.events, { init

permissions - How to preserve ownership with cmake "install directory" directive? -

use_source_permissions preserves permissions expected: install( directory dir/ destination dest use_source_permissions ) however, ownership of files not preserved when run sudo make install am missing something, or there's no way of accomplishing cleanly cmake? edit: cmake version 3.5.2 operating system arch linux i came simplest example think of reproduce issue , still, same happening. cmake_minimum_required(version 2.8 fatal_error) install(directory ${cmake_current_source_dir}/to_install destination $env{home} use_source_permissions) then run: mkdir build cd build cmake .. sudo make install the original permissions are: .──[drwxr-xr-x guicc ] test-cmake    ├── [-rw-r--r-- guicc ] cmakelists.txt    └── [drwxr-xr-x guicc ] to_install    ├── [-rw-r--r-- guicc ] file1.txt    └── [-rw-r--r-- guicc ] file2.txt while resulting permissions following: .──[drwxr-xr-x root ] to_install ├── [-rw-r--r-- root

c++ - Kernel doesn't wait for events -

i have problem kernel invocation. code looks this: std::vector<cl::event> events; ... queue.enqueuewritebuffer(arrayfirst, cl_false, 0, sizeofarray, null, null, &arrayevent); events.push_back(arrayevent); queue.enqueuewritebuffer(arraysecond, cl_false, 0, sizeofarraysecond, this->arraysecond, null, &arraysecondevent); events.push_back(arraysecondevent); kernel(cl::enqueueargs(queue, events, cl::ndrange(512), cl::ndrange(128)), arrayfirst, arraysecond); and when run it, doesn't go inside kernel code, when change "make_kernel" invocation this: kernel(cl::enqueueargs(queue, arraysecondevent, cl::ndrange(512), cl::ndrange(128)), arrayfirst, arraysecond); it goes inside kernel, don't have surety memory "arrayfirst" allocated correctly, check documentation of opencl 1.2 wrapper , found invocation should looks this: cl::enqueueargs::enqueueargs(commandqueue &queue, const vector_class<event> &events, ndrange offset, nd

javascript - Active Directory - use Current Logged User inside web application, its possible? -

take follow situation in mind: 1) user login in windows desktop machine active directory domain. 2) after logged in, user open web browser , type , url need login web app current login/session/token of active directory, automatically. example: after log on active directory, user open url http://intranet.myplace.com , , first page opened need detect credentials of current logged in user of ad. it possible ? cant find nothing acess ad credentials javascript. no, not possible client approach. regardless of using javascript or activex: need on server side. besides activex limit browsers, can ok in company environment think in. javascript not able query login context of client. , if should verify on server. to achieve describe need use kerberos or challenge response based techniques offered iis or apache. if want secure approach find able configure server.

php - Get full file paths in ProcessWire ServicesPages API -

i'm building app using processwire . i'm using servicepages module expose data rest-like api. however, files seem outputted this: reel_poster: { basename: "breakdown-2015-poster.jpg", description: "", tags: "", formatted: false, modified: 1468541707, created: 1468541707 } how actual path / url of file referenced? need path in js app, can't use php api. i've posted this on forums , seems there's not lot of activity there. so, if read this forum post correctly , way create url assembling manually. need 3 things that: the base path file assets. the id of page field attached. the image name. we know base path file assets /site/assets/files/ . can this, given have page object api: var basepath = '/site/assets/files/'; var imagepath = basepath + page.id + '/' + page.image_field.basename; this should work. think. yes. tested , works.

Stirling's approximation in c language -

i'm trying write code in c calculate accurate of stirling's approximation 1 12. here's code: #define pi 3.1416 #define eulernum 2.71828 float stirling_approximation(int n) { int fact; float stirling, ans; fact = factorial(n); stirling = sqrt(2.0*pi*n) * pow(n / eulernum, n); ans = fact / stirling; return ans; } int factorial(int input) { int i; int ans = 0; (i = 1; <= input; i++) ans += i; return ans; } int main(void) { int n; printf(" n\t ratio\n"); (n = 1; n <= 12; n++) { printf("n: %2d\t %f\n", n, stirling_approximation(n)); } return 0; } i'm getting recursive calculation correctly, stirling's approximation method value way off. , what's more puzzling answers n = 1, 3 correct. i think has calling approximation function main function. know must such simple mistake i've been trying fix entire day! please me? thank you! you inco

MSBuild cannot find a reference - ReactJs.NET -

after upgrading newtonsoft.json version 9.0.0 , reactjs.net packages 2.5.0, transformbabel.proj stopped working: <?xml version="1.0" encoding="utf-8" ?> <project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" defaulttargets="transformbabel"> <!-- reactjs.net - transpile javascript via babel --> <usingtask assemblyfile="$(outputpath)\react.msbuild.dll" taskname="transformbabel" /> <target name="transformbabel"> <transformbabel sourcedir="$(msbuildprojectdirectory)" /> </target> </project> returning following: transformbabel.proj(6, 3): error msb4018: "transformbabel" task failed unexpectedly. [exec] transformbabel.proj(6, 3): error msb4018: react.tinyioc.tinyiocresolutionexception: unable resolve type: react.ireactsiteconfiguration ---> system.typeinitializationexception: type initializ

actionscript 3 - Error #1009 and randomInterval() in as3 -

i used given code animation templates scripted rain. code looks this: stop(); // number of symbols add. const num_symbols:uint = 175; var symbolsarray:array = []; var idx:uint; var drop:rain; (idx = 0; idx < num_symbols; idx++) { drop = new rain(); addchild(drop); symbolsarray.push(drop); // call randominterval() after 0 given ms. settimeout(randominterval, int(math.random() * 10000), drop); } function randominterval(target:rain):void { // set current rain instance's x , y property target.x = math.random()* 800-50; target.y = math.random() * 50; //randomly scale x , y var ranscale:number = math.random() * 3; target.scalex = ranscale; target.scaley = ranscale; var tween:string; // ranscale between 0.0 , 1.0 if (ranscale < 1) { tween = "slow"; // ranscale between 1.0 , 2.0 } else if (ranscale < 2) { tween = "medium"; // ranscale between 2.0 , 3.0

use a tag html on onclick javascript function -

hi im having problem tag in html, want use tag call java script function have on folder js have javascripts. tried looking answers didnt find answer solve problem. know function working because if try using input onclick insted of onclick working, in terms of aesthetics tag works better. have code this function in a folder /myproject/source files/js function formhash(form, password) { // create new element input, our hashed password field. var p = document.createelement("input"); // add new element our form. form.appendchild(p); p.name = "p"; p.type = "hidden"; p.value = hex_sha512(password.value); // make sure plaintext password doesn't sent. password.value = ""; // submit form. form.submit(); } and html page has this: <div class="user_login"> <form action="includes/process_login.php" method="post" name="login_form">

java - How can the code be stopped if a method returns true? -

public static void fbdeathcheck() { if (php <= 0) { } } private static int fbenemyhp = 10, fbenemystr = 2, fbenemydef = 2, fbenemyspd = 2, fbenemyatk = 1; public static void firstbattle(string[] args) { string nextmovefirstbattle = ""; int dodgechancefb = 0; while(fbenemyhp > 0 && php > 0) { system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n\n"); system.out.println("-----battle mode-----"); system.out.println("enemy | hp " + fbenemyhp + " |"); if (nextmovefirstbattle.equalsignorecase("dodge") && dodgechancefb == 1) { system.out.println("dodged!"); } else { system.out.println(""); } system.out.println("commands:"); system.out.println("attack, dodge"); system.out.println(""); system.out.println("you | hp " + php + &q

Manipulating PHP arrays using references like JS objects -

i manipulating array, shown below, in javascript. http://ideone.com/vh43id <?php $root = array( 'nodes'=>array( '1'=>array( 'id'=>'1', 'nodes'=>array( '4'=>array( 'id'=>'4', 'nodes'=>array( '5'=>array( 'id'=>'5', 'nodes'=>array() ) ) ) ) ), '2'=>array( 'id'=>'2', 'nodes'=>array() ), '3'=>array( 'id'=>'3', 'nodes'=>array() ) ) ); foreach ($root['nodes'] $_node_id => &$_root_node) { $_put_parent = function (&$_

android - Drawing a repeated image (tile) along a path -

i trying repeat image resources along path, done shapes in patheffect . below 2 images of have vs. i'm trying achieve. what achieved using pathdashpatheffect triangle shapes: screenshot my desired outcome should this: desired here code: import android.annotation.suppresslint; import android.content.context; import android.graphics.bitmap; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.path; import android.graphics.pathdashpatheffect; import android.graphics.patheffect; import android.util.attributeset; import android.view.motionevent; import android.view.view; public class imagelineview extends view { private paint mpaint; private bitmap mdrawingbitmap; private canvas mdrawingcanvas; private path mpath; private paint mbitmappaint; private static final int background_color = color.white; private static final int center_stroke_width = 10; public imagelinevi

xml - Blogger Page Layouts depending on Page Type -

hello everyone? new on here , hope guys can me out problem have. i'm creating blogger template , wanna show post's first image, excerpt , read more button on home page. have succeeded in doing that. problem nothing shows when try show posts heading, , entire post content on post page. please me out <b:includable id='main'> <!-- return on home page --> <b:if cond='data:blog.pagetype == "index"'> <b:loop var='i' values='data:posts'> <!-- post tile --> <h2><data:i.title/></h2> <!-- if there image or images in post, first 1 --> <b:if cond='data:i.firstimageurl'> <img expr:src ="data:i.firstimageurl" expr:alt="data:post.title"/><br/> </b:if> <!-- snippet of post --> <data

tcl - Editing files in clearcase view -

i have worked cvs used open tcl script ide editplus, have shift clearcase environment., when set view alone , can see our files., how can open , edit files in ide? you need open file using full path of said file in clearcase view. in snapshot view, path regular filesystem path: # windows c:\path\to\snap\view\avob\path\to\file # unix /path/to/snap/view/vobs/avob/path/to/file but dynamic view, view mounted in mvfs (multiversion filesystem) mount point (m:/ on windows, /view on unix) # windows m:\adynview\avob\path\to\file # unix /view/adynview/vob/vobs/avob/path/to/file on unix, can "set view" ( cleartool setview ), make view starts in /vobs : /vobs/avob/path/to/file

c++ - How to dynamically include libs in Visual Studio 2013 -

Image
i followed this guide compile debug dlls tesseract now got ddls include in project. added lib directory in linker/lib dir, lib name in linker/input , in include dir put location of "baseapi.h" . included in project "baseapi.h". however compile errors when try example compile following line: tesseract::tessbaseapi *myocr = new tesseract::tessbaseapi(); i lot of errors intellisense: variable "tesseract::tess_local" intellisense: declaration has no storage class or type specifier. the files following: looking @ library's code, tess_local macro used before several function definitions inside api/baseapi.h , defined in ccutil/platform.h . if you'd followed the instructions , you'd have seen need to: include leptonica’s allheaders.h, , tesseract-ocr’s baseapi.h , strngs.h. this pull in need.

android - Check Touch out of relative layout -

i want check touch x,y position in activity know out of relativelayout or not. override ontouch event activity not working fine. you have this.. in activity have override dispatchtouchevent so in oncreate find view relativelayout yourlayout = (relativelayout) findviewbyid(r.id.yourlayout); and @override public boolean dispatchtouchevent(motionevent ev) { float touchpointx = ev.getx(); float touchpointy = ev.gety(); int[] coordinates = new int[2]; yourlayout.getlocationonscreen(coordinates); if (touchpointx < coordinates[0] || touchpointx > coordinates[0] + yourlayout.getwidth() || touchpointy < coordinates[1] || touchpointy > coordinates[1] + yourlayout.getheight()){ //do action } return super.dispatchtouchevent(ev); }

javascript - Add inertia to camera controls (Three.js) -

i've setup scene camera remains in fixed point in center of scene. user can pan camera around clicking (and holding) , dragging left mouse button. when user releases left mouse button, motion of camera stops. scene based on 1 of three.js demos see here there bunch of event handlers used create target position camera lookat : function ondocumentmousedown( event ) { event.preventdefault(); isuserinteracting = true; onpointerdownpointerx = event.clientx; onpointerdownpointery = event.clienty; onpointerdownlon = lon; onpointerdownlat = lat; } function ondocumentmousemove( event ) { if ( isuserinteracting === true ) { lon = ( onpointerdownpointerx - event.clientx ) * 0.1 + onpointerdownlon; lat = ( event.clienty - onpointerdownpointery ) * 0.1 + onpointerdownlat; } } and in update loop have: // lat , long have been calculated in event handlers cursor click location lat = math.max( - 85, math.min( 85, lat ) ); phi = three.mat

node.js - Node-Red: Create server and share input -

i'm trying create new node node-red. udp listening socket shall established via config node , shall pass incoming messages dedicated nodes processing. basic have: function udpserver(n) { red.nodes.createnode(this, n); this.addr = n.host; this.port = n.port; var node = this; var socket = dgram.createsocket('udp4'); socket.on('listening', function () { var address = socket.address(); loginfo('udp server listening on ' + address.address + ":" + address.port); }); socket.on('message', function (message, remote) { var bb = new bytebuffer.frombinary(message,1,0); var coedata = decodecoe(bb); if (coedata.type == 'digital') { //handle digital output // pass digital handling node } else if (coedata.type == 'analogue'){ //handle analogue output // pass analogue handling node } }); socket.on(&q

c++ - How can i get all the text until a space don't come in Qstring? -

Image
hello want ultil space in line occur example in given picture able whole string using getter method parent window dont want date time part getting https://www.youtube.com/watch?v=vxw6odvmmpw sun nov 1 20:29:30 2015 while want https://www.youtube.com/watch?v=vxw6odvmmpw can me used qstring left right cant working properly. //qstring input holds data... qstring output = input.section(' ', 0, 0); section sees string fields seperated seperator character ( ' ' in case) , returns section given start section (0) upto , including end section (0). assuming white space in inputstring spaces, if not, change ' ' correct seperator character.

immutability - Why is Java's BigDecimal class not declared as final? -

while checking source code of java's bigdecimal class, surprised not declared final class : class bigdecimal public class bigdecimal extends number implements comparable<bigdecimal> immutable , arbitrary-precision signed decimal numbers. (from oracle docs ) is there specific reason or did developers forget add keyword? practice not declare immutable classes final? the same goes biginteger , not string declared final. quote https://blogs.oracle.com/darcy/entry/compatibly_evolving_bigdecimal : however, there possible complication here since bigdecimal not final , since has public constructors, can subclassed. (as discussed in effective java, item 13, favor immutability, this design oversight when class written .) (emphasis mine). since java has favored backward compatibility, making final out of question: break existing subclasses. that said, when using date, assume no-one ever subclasses bigdecimal, , bigdecimal should used if im

php - Get an image extension from an uploaded file in Laravel -

i have been trying extension uploaded file, searching on google, got no results. the file exists in path: \storage::get('/uploads/categories/featured_image.jpg); now, how can extension of file above? using input fields can extension this: input::file('thumb')->getclientoriginalextension(); thanks. you can use pathinfo() function built php that: $info = pathinfo(storage_path().'/uploads/categories/featured_image.jpg'); $ext = $info['extension']; or more concisely, can pass option get directly; $ext = pathinfo(storage_path().'/uploads/categories/featured_image.jpg', pathinfo_extension);

scala - How can I specify multiple constructors in the case class? -

i'm trying create case class multiple constructors: object app { def main(args: array[string]) { val = something("abc", 100500, _ % 2 == 0) val b = something(true, 10, 20) println(s"$a - $b") } } case class something(s: string, n: int, p: int => boolean) { /* additional constructor -- wrong way! -- imposible invoke outside class def this(b: boolean, x: int, y: int) { this("", 0, (i: int) => % x + y == 0) } */ } so far code doesn't work: error:(10, 23) type mismatch; found : boolean(true) required: string val b = something(true, 10, 20) ^ to fix need create companion object hold apply function represents new constructor something class: object { def apply(b: boolean, x: int, y: int) = { new something(if (b) "" else "default", 0, _ => { (x + y) % 2 == 0 }) } } it inconvenient. maybe there other way place multiple cons

arrays - mongo native addToSet not working when update 2 fields at the same time -

mongo native addtoset not working when update 2 fields @ same time this way not ok db.col.findandmodify( {_id: 'abcxyz123'} ,[['_id','descending']] ,{$addtoset:{field_1: 'aaa'}, $addtoset:{field_2: 'aaa'}} ,{new: true}, function(err, result) { console.log(result.value) //field_1: [], field_2: ['aaa'] //it should field_1: ['aaa'], field_2: ['aaa'] }); this way works ok db.col.findandmodify( {_id: 'abcxyz123'} ,[['_id','descending']] ,{$addtoset:{field_1: 'aaa'}} ,{new: true}, function(err, result) { console.log(result.value) //field_1: ['aaa'], field_2: [] //it ok }); you doing wrong syntax $addtoset is: { $addtoset: { <field1>: <value1>, ... } } so here is: db.col.findandmodify( ... { $addtoset: { field_1: 'aaa', field_2: 'aaa' }

jpa - Starting wildfly 9 with eclipselink -

i switched glassfish wildfly 9 , use eclipselink since using before. added eclipselink.jar in c:\wildfly-9.0.2.final\modules\system\layers\base\org\eclipse\persistence\main folder. , did following added module.xml : <resource-root path="eclipselink.jar"> <filter> <exclude path="javax/**" /> </filter> in persistence.xml : <provider>org.eclipse.persistence.jpa.persistenceprovider</provider> error : 16:53:17,021 warn [org.jboss.modules] (serverservice thread pool -- 58) failed define class org.eclipse.persistence.jpa.rs.exceptions.jparsexceptionmapper in module "org.eclipse.persistence:main" local module loader @45283ce2 (finder: local module finder @2077d4de (roots: c:\wildfly-9.0.2.final\modules,c:\wildfly-9.0.2.final\modules\system\layers\base)): java.lang.linkageerror: failed link org/eclipse/persistence/jpa/rs/exceptions/jparsexceptionmapper (module "org.eclipse.persistenc

javascript - Meteor- Use a Blaze template in a React template from a route -

i developing reactive web app through meteor utilizing templates:tabs package, designed create tabular interface. plan on displaying data table within these tabs , sending queries different databases depending on tab selected similar cars.com . the app has flowrouter links 2 different routes, , want tabs present 1 of them. router wish have displaying tabs follows. #router.jsx flowrouter.route('/', { action() { mount(mainlayout, { content: (<landing />) } ) } }); i need create following template: template name="mytabbedinterface"> #tabs.html {{#basictabs tabs=tabs}} <div> <p>here's content <strong>first</strong> tab.</p> </div> <div> <p>here's content <strong>second</strong> tab.</p> </div> <div> <p>here's content <strong>third</strong> tab.</p> </div> {{/basictabs}} </template> here

c++ - Can a member function be used anywhere a free function can using std::function? -

i have code (courtesy of progschj on github) have adapted exemplify question. maketask moves function , arguments maketask makes packaged_task. created task executed whereupon future returned caller. slick, able member function well. if put func struct, f&& in maketask fails errors noted in code. #include <future> #include <memory> #include <string> #include <functional> template<class f, class... args> auto maketask( f&& f, args&&... args )-> std::future< typename std::result_of< f( args... ) >::type > { typedef typename std::result_of< f( args... ) >::type return_type; auto task = std::make_shared< std::packaged_task< return_type() > >( std::bind( std::forward< f >( f ), std::forward< args >( args )... ) ); std::future< return_type > resultfuture = task->get_future(); ( *task )( ); return resultfuture; } struct { int func( int nn, std::string str

forms - How to fill XFA from using iText so it is Foxit Reader comptible -

i used examples available on web create application able xml structure of xfa form , set filled. important code looks this: public void readdata(string src, string dest) throws ioexception, parserconfigurationexception, saxexception, transformerfactoryconfigurationerror, transformerexception { fileoutputstream os = new fileoutputstream(dest); pdfreader reader = new pdfreader(src); xfaform xfa = new xfaform(reader); node node = xfa.getdatasetsnode(); nodelist list = node.getchildnodes(); (int = 0; < list.getlength(); i++) { if ("data".equals(list.item(i).getlocalname())) { node = list.item(i); break; } } transformer tf = transformerfactory.newinstance().newtransformer(); tf.setoutputproperty(outputkeys.encoding, "utf-8"); tf.setoutputproperty(outputkeys.indent, "yes"); tf.transform(new domsource(node), new streamresult(os)); reader.close(); } p

How to detect whether a user is on homepage using javascript/jquery in Osclass classifieds script -

how detect whether user on homepage using javascript/jquery in osclass classifieds script. i know similar function available in osclass php helpers i.e. osc_is_home_page() need in javascript/jquery. enqueue script if home page. more helpful. if(osc_is_home_page()){ osc_register_script('script_id', 'scripturl', 'dependency'); osc_enqueue_script('script_id'); }

c# - MSTest does not read config item on Jenkins -

i have normal web api 2 project , ms unit test project test it. webapi2 project reads web.config in webapiconfig class using configurationmanager.appsettings["filename"] . created app.config in unit test project same config item, set property copy always make sure copied same folder test dll resides. when run unit test locally in visual studio 2015, great. when run test on jenkins server failed. exception message on jenkins server obvious code reading config file gets blank data. i browsed jenkins server workplace , see 2 files app.config , mytest.dll.config there. file has been copied properly. reading config still failed. anyone might have clue? i found solution enable nonisloation mode in jenkins.

javascript - How does youtube use ajax -

if go visit youtube video , click video ( e.g related video ) see page not entirely refreshing, main video , related videos change, rest of page remains is. wondering how that, if it's ajax why url updating? i've seen technique on other famous websites , wondering how works?! you can change url without reloading page, if browser supports it. combined ajax , see behavior seeing.

firebase database - Does firebase3 storage url changes with time or location -

i wondering if can save url storage in database , retrieve link every time want image? right now, calling following function each time need image , slow. afraid link might change depending on user , time? storage.ref(thisevent.eventimginreference).getdownloadurl().then(function (url) { //here add image url thisevent.eventimglink=url; // $scope.$apply(); }).catch(function (error) { }); download urls change if revoke download token in firebase console, it's totally fine if store them in database.

javascript - Empty params object in express.js middleware -

const app = express(); var router = require('express').router({mergeparams: true}); const payloadmiddleware = (req, resp, next) => { console.log('a:',req.params); const {params, query} = req; const payload = req.body; req.my_params = { params, query, payload }; next(); }; router.use(payloadmiddleware); router.get('/inventory/:itemid/price', async function getprice(req, res, next) { console.log('b', req.my_params); console.log('c', req.params); } app.use(bodyparser.urlencoded({extended: true})); app.use(bodyparser.json()); app.use('/', router); server = app.listen(port); get /inventory/abc/price?a=1&b=2 yields a: {} # unclear why empty b: { params: {}, query: { a: '1', b: '2' }, payload: {} } c: {itemid: 'abc'} so i'm confused: expect middleware find params in req , construct new object, , assign req my_params , pass inventory handler. , partially happening, in qu

javascript - Uncaught TypeError: Cannot set property 'backgroundColor' of undefined -

function put_to_cart_event(prodtitle, price, clicked_cell){ var td = clicked_cell; alert(td); put_to_cart_({title: prodtitle, price: price}, function () { td.style.backgroundcolor = '#859de6'; // <--- problem }); } the alert giving [object object] , meaning the clicked_cell available , accessable, right? what missing here? the function being called this: $('.abindenwarenkorb').on('click', function(){ var productname = $('#productname').text(); var price = $('#price').text(); var in_stock = $('#in_stock').text(); var clicked_cell = $('#clicked_cell').val(); //value set $('#clicked_cell').val($(this)); put_to_cart_event(productname, price, clicked_cell); // <-- call }); its because clicked_cell doesn't have style property. output clicked_cell variable in console.log?

ios - moving between xib/nib files in swipe navigation -

Image
i need move between xib/nib files using uibutton s can't connect buttons, there way in if i'm connecting 2 xib/nib files? you cannot use segues in nib/xibs. transition 1 nib-based view controller another, have hook button @ibaction programmatically transitions next view controller. open nib, choose assistant editor, , control -drag button down the code , create @iboutlet performs @ibaction : and in @ibaction , write code programmatically transition other nib (in case, i'm calling routine pushes next view controller using navigation controller). for swipe gestures, idea largely same. first, drag swipe gesture object library onto view: then control -drag swipe gesture code in assistant editor, specify it's "action", , write code transition next scene: note, if want make swipe gestures interactive (i.e. transition coordinated user's gesture, allowing them pause, complete, or cancel gesture), it's more complicated, can done

python - pythoncom crashes on keylogger with skype -

this question has answer here: pythoncom crashes on keydown when used hooked applications 3 answers this source code: import pythoncom, pyhook, sys def onkeyboardevent(event): if event.ascii==5: sys.exit elif event.ascii !=0 or 8: f = open('output.txt', 'r+') buffer = f.read() f.close() f = open ('output.txt', 'w') keylogs=chr(event.ascii) if event.ascii==13: keylogs = ('\n') buffer +=(keylogs) f.write(buffer) f.close() # return true pass event other handlers return true # create hook manager hm = pyhook.hookmanager() # watch mouse events hm.keydown = onkeyboardevent # set hook hm.hookkeyboard() # wait forever pythoncom.pumpmessages() whenever run skype, , type something, error in cmd. typeerror: keyboardswitch() missing 8 required positional arguments: '

exrm - Attaching to Elixir application fails to provide prompt -

i able attach elixir application deployed, can't seem give commands (no iex prompt). seems form-feed character getting in way, prompt after attaching: attaching /var/www/tmp/erl_pipes/avant_garden/erlang.pipe.1 (^d exit) ^l the application works (it's web application, , can access pages browser served it). can't console. anyone have experience this?

Python 2.7 mean, sum of the list -

i new python , having assignment trying sum , averge of list read txt file. code have come is: def filetolist (filename): result = [] try: f = open (filename,'r') l in f.readlines (): result.append (l.strip()) return result except ioerror: print ('file name not correct!') return [] infile = raw_input ('please enter file.txt : ') lines = filetolist (infile) list in lines: print (l) it works , returns values struggling how calculate them? i assume input file contains floats, 1 number per line. following program ignores blank lines , takes care of edge case when there not numbers @ all. btw don't exception handling. hides actual reason. imho it's better not handle exception. give user better feedback went wrong. def calc_stats(filename): sum = 0.0 cnt = 0 line in open(filename,"rt"): line = line.strip() if not line: co

python - Windows localhost file path for Pandas.read_csv() -

http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html#pandas.read_csv i'm having trouble setting read local file on windows machine (win 10 ee). tried: http://127.0.0.1/my/path and http://10.0.2.2/my/path neither worked, explicitly opened port 8888 (not sure if it's 1 open) , tried local_ip:8888/my/path all of these return error saying machine refused connection. i'm misunderstanding simple here, i'm not sure , google isn't helping.

html - Stacking absolute elements with transform -

i'm building form custom absolutely positioned dropdown. other input fields animated in using transform: translatey . can't dropdown stack on top of below input elements. i've simplified problem following: html: <div class="a"></div> <div class="a top"> <div class="b"></div> </div> <div class="a"></div> css: .a { transform: translatey(10px); position: "relative"; background: red; height: 50px; margin-top: 10px; z-index: 1; opacity: 0.8; } .b { position: "absolute"; top: 0; height: 100px; width:25px; background: blue; } .input.top { z-index: 10; } the following fiddle illustrates problem: https://jsfiddle.net/m817ffqy/1/ i've experimented transform-style: flat , setting translatez , i've not been able desired effect.. instead of: position: "relative"; position: "

How can i post a complex JSON object to a server via POST in android? -

i have complex json objects, want post server via http post request. have seen many examples volley library, work simple key-value pairs (hashmap). can advice library handles posting of complex json objects? i don't know reference of library works jsonobjcet have working code asynctask here ,which sending jsonobjects server : private class backgroundoperation extends asynctask<string, void, string> { @override protected string doinbackground(string... params) //your network connection code should here . string response = postcall("put webservice url here"); return response ; } @override protected void onpostexecute(string result) { //print response here . log.d("post response",result); } @override protected void onpreexecute() {} @override protected void onprogressupdate(void... values) {}

Packaging a Python library with an executable -

i finished module , want package it. i've read documentation , question packaging python application not sure how proceed when don't have package import script launch instead. the project looks that: project/ |-- readme |-- requirement.txt |-- driver.py |-- run.py |-- module_1 | |-- __init__.py | |-- class_1.py | |-- class_2.py |-- module 2 |-- |-- __init__.py |-- |-- class_1.py |-- |-- class_2.py in order launch tool do: python run.py arg1 --option arg2 driver.py imports other modules , defines driver class , functions. run.py imports driver.py , parse arguments, setups logger , calls function 1 after others job. i'm not sure configuration of setup.py , need global __init__.py @ root? i've understand, able import project not launch script run.py arguments. from other readings, maybe should try tell driver.py package , use entry_points option of setup() . don't understand how of properly. thank kind help! generally, distri

javascript - How to read valid base64 file in Android? (cordova) -

i need read pdf filesystem in android in order send server. cannot seem read valid data however. i have tried readasdataurl appears fastest. value returned (after removing mime type) invalid base64. // read file filesystem window.resolvelocalfilesystemurl(path, function (fileentry) { fileentry.file(function (file) { var reader = new filereader(); reader.onloadend = function (evt) { // test base64 valid var patt = /^(?:[a-za-z0-9+/]{4})*(?:[a-za-z0-9+/]{2}==|[a-za-z0-9+/]{3}=)?$/; var b64 = evt.target.result.split(",", 2)[1]; console.log("is valid base64? " + patt.test(b64)); // false! var bytes = atob(b64); // failed execute 'atob' on 'window': string decoded not correctly encoded. }; //reader.readastext(file); reader.readasdataurl(file); }, function (err) { console.error(err); }); }, function (

php - I have an object, but error says I'm making a function call on a non-object -

i'm working infusionsoft sdk. i've reached roadblock in trying make api calls. any call make ends same call member function getrefreshtoken() on non-object error (not getrefreshtoken() though). when var_dump, see object.. so, gives? object(infusionsoft\infusionsoft)#182 (13) { ["url":protected]=> string(42) "https://api.infusionsoft.com/crm/xmlrpc/v1" ["auth":protected]=> string(51) "https://signin.infusionsoft.com/app/oauth/authorize" ["tokenuri":protected]=> string(34) "https://api.infusionsoft.com/token" ["clientid":protected]=> string(24) "actual client id" ["clientsecret":protected]=> string(10) "actual secret key" ["redirecturi":protected]=> string(65) "http://benjamin_redden.dev/wp-content/plugins/ajaxisform/auth.php" ["apis":protected]=> array(0) { } ["debug":protected]=> bool(false) ["httpcl