Posts

Showing posts from August, 2015

python - Split or Extract Strings into Arguments of Function? -

lets have function takes string arguments. want dynamically generate them. there not seem way plug in easily. how done? see example here i_take_strings('one', 'two', 'and_the_letter_c') s = 'one 2 and_the_letter_c' i_take_strings(x x in s.split()) #python thinks i'm retarded attempt s.split() returns list can pass function variable arguments prepending * follows: i_take_strings(*s.split())

ios - Unable to set initial radius of one SCNSphere -

i able add twenty small spheres of, say, radius 0.5 scene. however, when attempt add one sphere, no matter radius specify, sphere appears default radius of 1.0. here code i'm using add 1 sphere. merely put code inside loop add twenty spheres -- works fine. func drawspheres() { var x:float = 0.0 var radius:cgfloat = 0.5 let spheregeometry = scnsphere(radius: radius) let spherenode = scnnode(geometry: spheregeometry) spherenode.position = scnvector3(x: x, y: 0.0, z: 0.0) self.rootnode.addchildnode(spherenode) } am missing obvious? the problem seeing scene kit trying smart. working expected. to able render scene, scene kit needs camera point of view. if scene contains camera, automatically made point of view. if scene doesn't have camera in it, scene kit has create own (or fail render together, less preferable). when scene kit creates own "default" point of view, tries adapt content of scene fills view best possible (a slig...

android - How to launch a car navigation to location from the app -

you might find question silly, can't find it. don't know how call tutorial need. i want application after clicking button start example waze , pass on address user can navigate it. if direct me should great. if want launch waze app specifically, can use url scheme @ waze.com/about/dev launch app. don't know of intent protocol or url scheme that's shared , navigation apps.

How to insert tab separated data from text file which has more than 1 million records into a SQL Server table using C#? -

i insert raw data file here in form of .txt , tab separated data sql server table. i perform operation of c# application, stumble upon how file has more 1 million records in it. i appreciate , pointers on this. e.g. have raw data file (tab separated) named myfile.txt , create table in sql server database. file have values may have various form of datatypes, (e.g. has datetime part, integer value, nvarchar string etc.) , have create sql server table same columns , corresponding datatypes. .txt file below 2015-07-28 18:41:07 9f4768273621d04da45e732932278497 sam 2015-07-27 18:41:07 9f4768273621d04da45e732932278497 ricky 2015-07-26 18:41:07 9f4768273621d04da45e732932278497 roxy table structure formed should appear below: date time userid username 2015-07-28 18:41:07 9f4768273621d04da45e732932278497 sam 2015-07-27 18:41:07 9f4768273621d04da45e732932278497 ricky 2015-07-26 18:41:07 9f4768273621d04d...

javascript - Change form submit button text after submition -

how change submit button text after submit?? have form button . change button text click next after submit form. <form> <div class="form-group"> <div class="rightbox"> <label for='phone'>phone</label></div> <div class="leftbox"> <div class="col-sm-12"> <input class="text-box single-line" data-val="true" name="phone" type="tel" value="" /> </div></div> </div> <div class="form-group"> <div class="rightbox"> <label for='phone'>mobile</label></div> <div class="leftbox"> <div class="col-sm-12"> ...

java - Dependency conflict in integrating with Cloudera Hbase 1.0.0 -

i tried connect play framework (2.4.2) web application cloudera hbase cluster. included hbase dependencies in bulid.sbt file , used hbase sample code insert cell table. however, got exception seems dependency conflict between play framework , hbase. attached sample code , build.sbt files well. grateful resolve error. [error] [07/21/2015 12:03:05.919] [application-akka.actor.default-dispatcher-5] [actorsystem(application)] uncaught fatal error thread [application-akka.actor.default-dispatcher-5] shutting down actorsystem [application] java.lang.illegalaccesserror: tried access method com.google.common.base.stopwatch.<init>()v class org.apache.hadoop.hbase.zookeeper.metatablelocator @ org.apache.hadoop.hbase.zookeeper.metatablelocator.blockuntilavailable(metatablelocator.java:434) @ org.apache.hadoop.hbase.client.zookeeperregistry.getmetaregionlocation(zookeeperregistry.java:60) @ org.apache.hadoop.hbase.client.connectionmanager$hconnectionimpl...

PHP-DI Register Instance for ctor Injection -

i'm using php-di , using twig in project. i'd register instance of $twig php-di instance injected ctor argument on objects it's needed. i'd use php definitions , avoid phpdoc annotations, , have read http://php-di.org/doc/php-definitions.html here's basic example: $builder = new containerbuilder(); $builder->adddefinitions(['twig_environment' => $twig]); $container = $builder->builddevcontainer(); then have $twig ctor argument in other classes. possible? clear, don't want have create definition each object uses $twig. public function __construct(\twig_environment $twig) { $twig->render('homepage.twig'); } the error i'm getting indicates php-di trying create new instance of twig_environment instead of using instance created. this correct, except method call create container: $container = $builder->builddevcontainer(); that creates entirely new container , ignores have configured above ;) (it's ...

Converting PHP Curl request of PAYGATE API to python -

i not familiar php , curl, need convert advance php curl post request python equivalent. it's code payment gateway site called paygate, , using sample php api developer.paygate.co.za/ . code tried convert python below: <?php //the paygate payxml url define( "server_url", "https://www.paygate.co.za/payxml/process.trans" ); //construct xml document header $xmlheader = "<?xml version=\"1.0\" encoding=\"utf-8\"?><!doctype protocol system \"https://www.paygate.co.za/payxml/payxml_v4.dtd\">"; // - construct full transaction xml $xmltrans = '<protocol ver="4.0" pgid="10011013800" pwd="test"><authtx cref="abcqwerty1234" cname="patel sunny" cc="5200000000000015" exp="032022" budp="0" amt="10000" cur="zar" cvv="123" rurl="http://localhost/pg_payxml_php_final.php" nurl="h...

apache - Mod rewrite to remove subdirectory and file extension without breaking DirectoryIndex -

i have site pages in subdirectory this... http://www.example.com/pages/myfile.php i want url this... http://www.example.com/myfile where both subdirectory called pages , .php file extension removed url. my latest (partial) attempt... options -indexes +followsymlinks directoryindex index.php rewriteengine on rewritebase / rewritecond %{document_root}/pages%{request_uri}\.php -f [or] rewritecond %{document_root}/pages%{request_uri} -d rewriterule ^(.*)$ /pages/$1.php [nc,l] however, totally breaks directoryindex . when go http://www.example.com/ or http://www.example.com/foo/ , 404 error instead of defaulting index.php defined directoryindex . apparently, treats file name instead of recognizing lack of file name (directory) , attempting use index.php . i tried incorporating this solution mine, fixed directoryindex issue, broke else. is there solution? please include detailed explanation within answer can learn where/how going wrong. try in roo...

tfsbuild - Absence of "Build Quality" in new Visual Studio Online Build System -

what happened "build quality" in "new" visual studio online build system (the modular build system released in summer 2015)? seems can work build quality in ui , api old xaml- based builds not builds based on new build definitions. there alternative concept or did miss something? the release management tool knows build has been deployed , takes on status. you can use release management locally this, or can wait new release system announced @ build , built tfs & vso.

ios - Linker Errors Facebook Parse -

i added pffacebookutils.initializefacebookwithapplicationlaunchoptions(launchoptions!) , got 9 linking errors feel many people have gotten before. first time working facebook in app , added every framework, header, , filled in info.plist i had unwrap launchoptions can me out on how rid of these mach-o linker errors. updated error log ld: warning: directory not found option '-f(1)' ld: warning: auto-linking supplied '/users/fabricemulumba/documents/facebooksdk/fbsdksharekit.framework/fbsdksharekit', framework linker option @ /users/fabricemulumba/documents/facebooksdk/fbsdksharekit.framework/fbsdksharekit not dylib undefined symbols architecture x86_64: "_objc_class_$_pffacebookutils", referenced from: __tmacso15pffacebookutils in appdelegate.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) maybe using old version of facebook's framework? i've checked lib...

How can I remove white lines which is larger then Threshold value in binary image ? (matlab) -

Image
i have binary image want remove white lines larger threshold value (like 50 pixel). original image: input , output image : my idea: i want count white pixels located in each rows , if (( number of white pixel > threshold value )) remove line. please edit , complete code. close all;clear all;clc; =imread('http://www.mathworks.com/matlabcentral/answers/uploaded_files/34446/1.jpg'); i=im2bw(i); figure, imshow(i);title('original'); thresholdvalue=50; [row,col]=size(i); count=0; % count number of white pixel indexx=[]; % determine location of white lines larger.. i=1:col j=1:row if i(i,j)==1 count=count+1; %count number of white pixel in each line % should determine line here %need here else count=0; indexx=0; end if count>thresholdvalue %remove corresponding line %need here end en...

c# - Fastest-single-write multiple-read collection -

simple question, complex problem: a lot of data coming in network on single socket, faster 1 thread can consume. in fact, dispatching work threadpool takes time. so add incoming items blockingcollection<t> , dispatch them on separate thread. however, @ times of high usage, can still take long. tried stripping blockingcollection<t> , concurrentqueue<t> implementations remove extraneous features made little difference. what kind of single-write multi-read concurrent queue implementation beat blockingcollection<t> ? data must consumed asap.

html - Form with drop-down lists -

i have html form in script drop-down lists. example: <select name="1"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <select name="2"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> as can see, options in both lists identical. should do, stop user selecting same option? example, if user selects option "b" list "1", , tries select option "b" list "2", want selected option list "1" disappear, user can't submit same values... sorry english. hope made myself clear... you can validate form this. tested working code: <html> <head> <script> //put javascript function in header. validates 1 click submit button function val...

c++ - How to set Focus on a specific widget -

i'm trying implement gui various widgets opengl project. have main widget drawing scene. opengl widget associated key , mouse events, therefore focus should on it. i've noticed if click on push button, focus moved button means focus no longer associated opengl widget. clicking widget mouse not changing focus. 1 of solution turn off focus widgets except opengl widget in gui follows ui->processbutton->setfocuspolicy(qt::nofocus); ui->quitbutton->setfocuspolicy(qt::nofocus); ui->clearbutton->setfocuspolicy(qt::nofocus); ui->textedit->setfocuspolicy(qt::nofocus); ui->groupbox->setfocuspolicy(qt::nofocus); if have many widgets, solution annoying if add widgets later on. question is there solution set focus on specific widget? your solution fine, shouldn't enumerating widgets manually: // c++11 (auto widget : findchildren<qwidget*>()) if (! qobject_cast<qopenglwidget*>(widget)) widget->setfocuspolicy(qt::nofoc...

c# - What pattern to use to be more flexible? -

i building interface read, validate, convert , store data. in way 2 systems can cummunicate each other. i have created generic flow works fine , extensible: iprocessor< p, s> -> proces() : void iprovider -> getitems() : ienumerable< string> ivalidator -> validate(string) : void iparser< p > -> parse(string) : p imapper< p, s> -> map(p) : s istorage< s> -> save(s) new processor(iprovider, ivalidator, iparser< p>, imapper< p, s>, istorage< s>) the problem there business rule states p must mapped s1 or s2 depending on value. how alter structure, more flexible? add interface: ibusinessrule<p, s> -> maptos1(p) : bool initialize mapper it: new mapper(ibusinessrule<p, s>) p.s. mean s1 : s , s2 : s .

jquery - Filtering table using URL parameters -

can correct me on how these codes work-in know these not working code’s having trouble on how pass url parameters name , start date. want filter name peter , start date on filter passing url parameter of name. table working if apply code setting url code not worked. nothings happen. can me? <!doctype html> <html ng-app="mytable"> <head> <title>project 43</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.0/angular.min.js"></script> <script type="text/javascript"> var mytable = angular.module('mytable', []); mytable.controller('tablectrl', function ($scope, $http) { $http.get("http://staging.api.sample.com/events.json", {headers: {authorization: 'vunyhxbpkfh7dxkl40acq1o2jdeivrrdsds'}}) .success(function (response) { ...

sftp - how to connect to winscp with username and ppk file from java program -

i have generate , put files on winscp using java program. connecting box (with winscp ), use following credentials: host name: username: port: private key file: i searched through how retrieve file server via sftp? , found below code: import com.jcraft.jsch.*; public class testjsch { public static void main(string args[]) { jsch jsch = new jsch(); session session = null;`enter code here` try { session = jsch.getsession("username", "127.0.0.1", 22); session.setconfig("stricthostkeychecking", "no"); session.setpassword("password"); session.connect(); channel channel = session.openchannel("sftp"); channel.connect(); channelsftp sftpchannel = (channelsftp) channel; sftpchannel.get("remotefile.txt", "localfile.txt"); sftpchannel.exit(); session.disconnec...

Error when trying to use the Cardslib library: unable to find attribute android:foregroundInsidePadding -

when trying implement cardslib library in app, error every time try run app: error: in foregroundlinearlayout, unable find attribute android:foregroundinsidepadding however, upon looking through attrs.xml file library, found foregroundlinearlayout , attribute there. idea might causing this? this issue comes requirement of upgraded build tools, referred here . in case needed change in build.gradle from. ... compilesdkversion 23 buildtoolsversion "21.1.2" ... to ... compilesdkversion 23 buildtoolsversion "22.0.1" ... if using android studio , don't have latest build tools installed, prompted wizard can install automatically.

ssl - Meteor error: failed: WebSocket is closed before the connection is established -

i have been @ days , can't seem find solution this. have live website, , installed ssl certificate , made website available on https. what's strange @ first website worked on https. day or live , working well. next day checked , site giving me error: websocket connection 'wss://domain.com/sockjs/421/dto72qfy/websocket' failed: websocket closed before connection established. the navigation bar loads , sidebar loads, content doesn't, it's stuck in 'loading' template. if check domain in http website working fine. i using meteor (mup) upload site , digital ocean. 1 of few things have changed mup.json ... // configure environment "env": { "root_url": "https://website.com/" //"port": 80 }, "ssl": { "pem": "./ssl.pem" //"backendport": 80 }, ... i'm not sure how deal websockets , why have problems in https. if has gotten meteor app work m...

reflection - How do I get an access to type information in TypeScript from another (development-time) program? -

i list of function's arguments' types in typescript. got obvious glance on google search results, typescript lacks java-kind reflection. i've thought there kind of compiler api such data ide development needs etc., i've found none. so how access type information in typescript program (build tool, lint etc.)? i've thought there kind of compiler api such data ide development needs etc., i've found none. its called "typescript language service". there docs : https://github.com/microsoft/typescript/wiki/using-the-language-service-api also have oss project uses : https://atom.io/packages/atom-typescript has stuff ast viewer , quickfix architecture : https://github.com/typestrong/atom-typescript/blob/master/contributing.md#quickfix also have book compiler docs http://basarat.gitbooks.io/typescript/content/docs/compiler/overview.html

php - wordpress pagination not showing -

i have custom query on wordpress page. query looks this: $args = array( 'post_type' => array( 'tworca' ), 'orderby' => 'title', 'order' => 'asc', 'posts_per_page'=>12, 'post_parent' => 0 ); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args['paged'] = $paged; // query $the_query = new wp_query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); ... content of query..... } ?> <nav> <?php previous_posts_link('&laquo; newer') ?> <?php next_posts_link('older &raquo;') ?> <?php wp_pagenavi(); ?> </nav> <?php } else { echo 'no results'; } /* restore original post data */ wp_reset_postdata(); ?> but pagination doesn't show. idea why? have read many posts similar problem, solution add 'paged' p...

Using Solrj 5.2.1 with Maven -

i created new maven project solrj dependency: <dependency> <groupid>org.apache.solr</groupid> <artifactid>solr-solrj</artifactid> <version>5.2.1</version> </dependency> it compiles correctly if try use solrj code application crushes following exception: slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. exception in thread "main" java.lang.noclassdeffounderror: org/apache/commons/logging/logfactory @ org.apache.http.impl.client.closeablehttpclient.<init>(closeablehttpclient.java:58) @ org.apache.http.impl.client.abstracthttpclient.<init>(abstracthttpclient.java:287) @ org.apache.http.impl.client.defaulthttpclient.<init>(defaulthttpclient.java:128) @ org.apache.http.impl.client.systemdefaulthttpclient.<init>(syst...

c++ - QT exec() command crash -

i´m developing application in qt 4.7.3. application called matlab(simulink) using mexfunction (*.mexw32) when try open dialog using dialog.exec() command, form displayed "non responding application" instantaneously. after that, matlab crashes. if try open dialog using dialog.show() command, works fine. i have no idea of whats going on, since both commands somehow similar, described here does know happening? dialog.exec() spins local event loop doesn't integrate 1 matlab spinning. crash. conversely, you're banking on matlab doing right thing far own event loop being compatible qt's requirements goes. doesn't hold on platforms, unfortunately, although on windows seems work. you should never using exec() outside of main anyway.

Creating an "Upvote" button using simple HTML form and PHP -

i'm trying create simple upvote button in html form uses php update mysql database. know there better implementations ajax etc i'm looking use simple html , php. i've been able update database using input type="number" form element can't update when try changing input type="submit" value=1 . html <form action="send_formdata.php" method="post"> <label>digs</label> <input type="submit" name="digs" id="digs" value=1> </form> php (in send_formdata.php) <?php $link = mysqli_connect("mysql.xxxxxx.com","xxxxx","xxxx","xxxxxx") or die("failed connect server !!"); mysqli_select_db($link,"xxxxxx"); if(isset($_request['submit'])){ $errormessage = ""; $digs=$_post['digs']; if ($errormessage != "" ) { ...

Wireshark doesn't show outgoing traffic -

for reason, when open wireshark, displays incoming packets (and broadcast), isn't single outgoing traffic. searched in google , there interfering software, none of them active on computer. does knows why happen , how fix it? if have "dne lightweight filter" checked in network adapter properties, uncheck it.

Android camera api SCENE_MODE_HDR not supported in Nexus 5? -

my nexus 5 isn't supporting hdr scene mode of camera api (as camera2 api). due manufacturer support? if so, want implement hdr scene mode in custom camera app in stock camera? i tried using both camera apis none supporting scene_mode_hdr parameter. using android.hardware.camera api: (logs hdr mode not supported) list<string> scenemodes = params.getsupportedscenemodes(); if (scenemodes.contains(camera.parameters.scene_mode_hdr)) { log.d("hdr", "hdr mode supported"); params.setscenemode(camera.parameters.scene_mode_hdr); } else { log.d("hdr", "hdr mode not supported"); } and using android.hardware.camera2 api: (logs hdr mode not supported) cameracharacteristics characteristics = manager.getcameracharacteristics(cameraid); int[] scenemodes= characteristics.get(cameracharacteristics.control_available_scene_modes); boolean ishdrsupported = false; (int scenemode : scenemodes) { if (scenemode == cameracharacteri...

Java: is there a way to construct a max-heap from an array in O(n) using PriorityQueue? -

correct me if i'm wrong, think priorityqueue(collection c) constructor create min-heap collection in time o(n). however, couldn't find constructor can pass both collection , comparator (in order convert min-heap max-heap). wondering if there way construct max-heap array (say, int array) in o(n) using priorityqueue? no, having set of elements arranged in min-heap not provide advantage rearranging them max-heap. also, seem assuming priorityqueue constructors accept collection have o(n) asymptotic complexity. that's plausible -- -- not documented, not safe rely on it.

javascript - Barcode Scanner Phonegap not working -

i trying include barcode scanner plugin phonegap (phonegap 5.1.1) , can't make work ( https://github.com/phonegap/phonegap-plugin-barcodescanner ) first of all, installed plugin running: phonegap plugin add phonegap-plugin-barcodescanner then have javascript function: function leerbarcode(){ //navigator.notification.alert("llega leerbarcode", alertdismissed, "mensaje", "ok"); cordova.plugins.barcodescanner.scan(function (result) { alert("we got barcode\n" + "result: " + result.text + "\n" + "format: " + result.format + "\n" + "cancelled: " + result.cancelled); }, function (error) { alert("scanning failed: " + error); }); } when click on button calls function, doesn't launch camera. please, can me?

Azure Storage Not Showing in Visual Studio 2015 Server Explorer -

i've installed visual studio 2015 , cloned repo visual studio online account. code written visual studio 2013 , environment see azure storage account (i.e. tables, queues , blobs) under azure connection section on server explorer. visual studio 2015 can see azure connection section includes app service, mobile service, notification hubs , sql database no storage. any ideas? i ran same problem. decided upgrade latest of azure sdk 2.7. fixed server explorer panel , added in new panel called cloud explorer. going. here link: https://azure.microsoft.com/blog/2015/07/20/announcing-the-azure-sdk-2-7-for-net/

jms - how to read only specific queue messages based on message header property -

i have list of messages in activemq queue. each message has custom header property value. how should able access messages custom header property value = 123.? i using below pick message queue. how pick messages or single message has customheaderproperty =123.? consumertemplate consumertemplate = camelcontext.createconsumertemplate(); exchange ex = consumertemplate.receive("activemq:queuename",10000); string data = ex.getin().getbody(string.class); string number = ex.getin().getheader("customproperty", string.class); use message selectors on consumer. selector sql query. write mycustomheader = 123 . here pretty cheat sheet . since tagged question apache-camel, guess working camel setup. in case, need supply selector camel. from("activemq:queue:myqueue?selector=mycustomheader%3d123"). .

ios - Upload UIImage in dispatch_async -

i have problem. call method in dispatch_async . in callmethod2 in different object uploading image [nsurlconnection sendasynchronousrequest . after upload, doesn't show me response. (however when call callmethod2 without dispatch_async, works great). can problem? dispatch_async(dispatch_get_global_queue( dispatch_queue_priority_default, 0), ^(void){ [offline callmethod1]; [offline callmethod2]; }); upload image [nsurlconnection sendasynchronousrequest:request queue:[nsoperationqueue currentqueue] completionhandler:^(nsurlresponse *response, nsdata *data, nserror *error) { nslog("never show me me log"); }]; you're calling nslog on thread isn't main thread (aka calling asynchronously) won't see nslog must run on main thread. you can have completion block notify other way when it's done. best way i've found using https://github.com/kseebaldt/deferred allows send promise saying (i promise i'll thing , notify when it...

php - [Symfony2][SwiftMailer] You have requested a non-existent parameter "sender_name" -

i install new bundle project in symfony2 , swiftmailer return error. you have requested non-existent parameter "sender_name". swiftmailer configuration swiftmailer: transport: %mailer_transport% host: %mailer_host% encryption: %mailer_encryption% username: %mailer_user% password: %mailer_password% spool: { type: memory } try add sender_name parameter in parameters.yml , in config.yml add swiftmailer: sender_name: %sender_name%

git - How to have two local folders sync bidirectionally and automatically on OS X? -

i in workflow regularly have install application locally, , sync folders of application installed locally svn repository hosted in folder on computer. i have created workflow using hardlink command-line utility. first deleted folders in local installation of application, , used hardlink command line utility link svn repo folders folders created in local installation directory. the problem workflow is slow , requires manual input, doesn't work if need repeat process regularly (which do). i have tried other bidirectional file synchronization programs (unison etc), seem not cover need have, synchronization happens automatically without need run given program. based on this, thinking of writing bash script automate process me. beyond writing bash script, there simpler process have overlooked? have looked @ free file sync : https://www.freefilesync.org/ ? you can set folders sync, , export script file. i've never had need have done automatically, assume sho...

c++ - Downcasting and Virtual Functions -

i asked question in interview , unsure of behaviour in following case : class { virtual fun1(){...} virtual fun2(){...} }; class b : public { virtual fun1(){...} virtual fun2(){...} }; now if, a* aobj = new a; b* bobj = (b*) aobj; does bobj have access b's methods because of virtual keyword or not because it's pointing object of aobj ? can me how downcasting affects access ? assigning address of base-class object derived-class pointer undefined behavior . can happen: calling bobj 's functions can invoke b 's functions, can invoke a 's functions, can crash program, or format hard drive. depend on compiler , optimization options.

jsf 2 - How to cancel form without validation phase in JSF? -

i have xhtml form 2 buttons: "ok" , "cancel". both buttons calls methods of @viewscoped managed bean (accept() , cancel(), example). moreover, xhtml has viewparam , validation. in managedbean state controlled boolean variable edit . method cancel turns edit variable false . the question is: how can call cancel() method of managedbean without validation step? say, pressed "new record" button , change mind. want cancel edit operation , when push "cancel" button - validation error appears, managedbean changes state browse (variable edit turns false ). need - hide validation error message, or skip validation phase during post request. if use request, afraid viewparam lost, because view updated. is way skip validation phase in jsf? thank wasting time. if use request, afraid viewparam lost, because view updated. performing full page refresh using right way (provided you've @viewscoped bean). cover mentioned pr...

c# - Word document Page Setup takes forever -

the following 2 code lines cause program somehow not continue rest of methods code: microsoft.office.interop.word.application wordapp = new microsoft.office.interop.word.application(); wordapp.displayalerts = microsoft.office.interop.word.wdalertlevel.wdalertsnone; document = wordapp.documents.add(); document.pagesetup.topmargin = 5; document.pagesetup.orientation = wdorientation.wdorientlandscape; the application not freeze. every single breakpoint after these lines never reached. if take these lines out, rest of code runs through , works fine. resolved: problems cause network printer. because word needs connection printer set page setup , couldn't establish connection printer, waited. setting default printer 1 solved issue.

Matlab get amount of clipping -

hi trying measure amount of clipped samples in audio files matlab. means want number of samples @ fullscale value (at min , max). should count them when there @ least 2 following samples @ value. my code far: for = 1 :20 filename = ['elektro',num2str(i) '.wav']; unclipped = audioread(filename); summemax = sum(1 ==unclipped); summemin = sum(-1==unclipped); summe = summemin +summemax; str=sprintf('%d ',summe); disp(str); end as see counting every sample , need loop , if statements detect if there more 1 sample @ fullscale value. i tried loop j = 1 : length(unclipped) takes long method. anyone have suggestions how this? as @daniel pointed out in his answer previous question of yours, can find samples @ maximum reached by maxreached = max(unclipped(:))==unclipped; to remove places maximum reached 1 sample, can use morphological opening structuring element [1,1] : clippedsamples = imopen(maxreached, [1 ...

javascript - Using dynamic "non Domain" Arguments in Typo3 Extbase Controller -

form-elements added javascript fluid-form not passed argument. how right way? how dynamically add form-fields javascript? expected behavior: form submmitted "subscribesubmitaction" validation of "subscribesubmitaction" fails fallback "subscribeaction" called "$subscription" set , assigned ( not happening ) - instead "$subscription" allways null (but subscription.test set in fluid-form) my guess: the propertymapper removing "subscription.childs" because not in "trustedproperties" - how can add them? why "$subscription" allways null - have no idea! controller: namespace vendor\extension\controller; class eventcontroller extends \typo3\cms\extbase\mvc\controller\actioncontroller { public function initializeaction() { if ($this->arguments->hasargument('subscription')) { //try add "subscription.childs" propertymapperconfigur...

How to read OLE Object of Package Part for reading of embedded zip file in java? -

hi new comer java developer of ole object of package part. facing issue read embedded zip docx file in current project. have read docx file , package part read embedded object . returns packagepart class. we need read zip file has excel files. confuse how read data excel files. i using code this.: - packagepart ppart = null; iterator<packagepart> piter = null; list<packagepart> embeddeddocs = document.getallembedds(); if (embeddeddocs != null && !embeddeddocs.isempty()) { piter = embeddeddocs.iterator(); while (piter.hasnext()) { ppart = piter.next(); //system.out.println(ppart.getpartname().getextension()); system.out.println(ppart.getinputstream()); } } } catch (exception e) { e.printstacktrace(); } this code provides output like java.io.bytearrayinputstream@2862c542 java.i...

objective c - iOS "open in" while the app is already running -

i have gotten "open in" feature work in app developing open files. implementing application:didfinishlaunchingwithoptions: , using uiapplicationlaunchoptionsurlkey file url options dictionary, i'm not sure when application open. any appreciated, thanks. if app open, application:didfinishlaunchingwithoptions: won't called again. application:openurl:sourceapplication:annotation: called. note if app wasn't open, application:didfinishlaunchingwithoptions: called , application:openurl:sourceapplication:annotation: called (unless returned no in didfinishlaunchingwithoptions signify cannot open url in question). so best place process "open in" feature inside openurl . how depends on app, if user interaction involved , if different view controllers need behave differently, approach create , post nsnotification inside openurl describe "open in" action, , have subscribers elsewhere in app act accordingly.

javascript - nodejs stream pipe into already piped N streams -

i want pipe 1 stream n piped streams, code below returns here2 doesn't go in first transform stream. seems piped streams doesn't behave 1 stream. 'use strict'; var stream = require('stream'); var through2 = require('through2'); var pass = new stream.passthrough({objectmode: true}); var transform1 = through2.obj(function(obj, enc, done) { console.log('here1'); this.push(obj); done(); }).pipe(through2.obj(function(obj, enc, done) { console.log('here2'); this.push(obj); done(); })); pass.write({'hello': 'world'}); pass.pipe(transform1).on('data', function(data) { console.log(data); }); the pipe method returns destination stream. transform1 stream 2nd stream in pipe chain. writing pass stream 2nd stream (hence output 'here 2'): try this: pass.pipe(through2.obj(function(obj, enc, done) { console.log('here1'); this.push(obj); done(); })).pi...

javascript - how add function beforeSend in callback -

i have quetion jquery, how add function beforesend & success code : $("body").on("click", "#br-submit-assets", function(e) { var form = $(this).parents("form"); var btn = $(this); form.ajaxsubmit(function(ret) { $("#loadding").html('<i class="fa fa-spinner fa-pulse"></i>'); $(".career-notif").parent("div").remove(); var html = generate_alert(ret.result.status, ret.result.msg); btn.parent("div").before(html); }); return false; }); it's work me want display #loading before send data : beforesend: function () { $('#loading').append('<i class="fa fa-spinner fa-pulse"></i>'); }, try this beforesend: function () { $('#loading').show(); } success : function(data){ $('#loading').hide(); } and in html add div this <di...

magento gives error while creating form -

i want build form. tried lot below code gives me error. error: 2015-08-03t08:49:26+00:00 err (3): recoverable error: argument 1 passed mage_adminhtml_block_widget_form::setform() must instance of varien_data_form, instance of mage_adminhtml_block_system_config_form given, called in c:\xampp\htdocs\magentobigcom\app\code\core\mage\adminhtml\block\system\config\form.php on line 315 , defined in c:\xampp\htdocs\magentobigcom\app\code\core\mage\adminhtml\block\widget\form.php on line 119 2015-08-03t08:49:26+00:00 err (3): recoverable error: argument 1 passed varien_data_form_element_abstract::setrenderer() must implement interface varien_data_form_element_renderer_interface, instance of sample_bigcom_block_adminhtml_form_edit_file given, called in c:\xampp\htdocs\magentobigcom\app\code\core\mage\adminhtml\block\system\config\form.php on line 438 , defined in c:\xampp\htdocs\magentobigcom\lib\varien\data\form\element\abstract.php on line 164 and code here: <?php class sampl...

windows - 03/08/2015 was unexpected at this time batch script error -

first, should mention context code, designed check whether automatic maintenance task on computer (or windows refers it, "regular maintenance") had been started yet on same day (if so, last run date , time match date code run on , time 12:00:00pm) , if had finished (if so, task's status "ready" rather "running". the code store value of each of 3 checks (0 success, 1 failure) in variable called %maintenance completion%, use later decide whether continue next section of code, or whether should loop until conditions true. for /f "tokens=4" %%a in ('schtasks /query /v /fo list /tn "microsoft\windows\taskscheduler\regular maintenance" ^| findstr /c:"last run time:"') set last_maintenance_date=%%a /f "tokens=5" %%a in ('schtasks /query /v /fo list /tn "microsoft\windows\taskscheduler\regular maintenance" ^| findstr /c:"last run time:"') set last_maintenance_time=%%a /f "...

javascript - AngularJS increment value for id attributes -

i have html looks this: <tr ng-repeat="x in y"> <td> <div ng-attr-id="{{getid()}}"></div> </td> <td> <div ng-attr-id="{{getid()}}"></div> </td> <td> <div ng-attr-id="{{getid()}}"></div> </td> </tr> i want have id starts 1 first <td> element , increments 1 each <td> element. by doing in controller: $scope.getid = function () { counter++; return counter; } i 10 $digest() iterations reached. aborting! you can use $index this: <tr ng-repeat="x in y track $index"> <td> <div ng-attr-id="{{$index + 1}}"></div> </td> </tr> for nested loops can define new track value , combine $index or static 3 elements can write this: <tr ng-repeat="x in y track $index"> <td> <div ng-at...

css - How to re-size the <p:fileUpload ...> button in primefaces? -

Image
i added fileupload button in jsf , wanted re-size width using css non of following approaches working. not enough container behaves strange when inspecting rendered html code chrome-developer-tools . screenshot of jsf: the element container size 1891px , don't have idea set css file. my css file: ul { list-style: none; } body { font-family: arial; } #recordingslist audio { display: block; margin-bottom: 10px; } .btn_style1 { width: 100px; height: 50px; } .text_style1 { font-size: x-large; } .text_style2 { font-size: medium; width: 20%; } .text_style3 { font-size: large; font-weight: bold; color: #007e50; display: block; width: 600px; } .c_style1 { width: 150px; height: 50px; } .ui-widget { font-family: arial, sans-serif; font-size: 100% ! important; } .ui-button { width: 200px; height: 50px; } my jsf code: <h:form id="uploadform"> <p:growl id="m...

jquery - putting an image tag into html expandable tree -

i converting xml tree expandable html tree. code working. however, want replace - , + signs jpeg images such http://i1341.photobucket.com/albums/o747/mike_younes/bullet_zpsblghj3ip.gif i trying place link href @ place of <b>-</b> not working. use style of background: transparent url(http://i1341.photobucket.com/albums/o747/mike_younes/bullet_zpsblghj3ip.gif) no-repeat top left; but wont work here. do? working code: <!doctype html> <html> <head> <meta charset="utf-8" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"></script> <script type="text/javascript"> $(document).ready(function () { $.ajax({ url: "cd_catalog2.xml", success: function (tree) { traverse($('#treeview li'), tree.firstchild) ...

php - How to remove controller name in CakePHP Form -

my code: echo $this->form->create('usps', array( 'inputdefaults' => array( 'label' => false, 'div' => false ), 'id' => 'form-validate', 'class' => 'form-horizontal', 'novalidate' => 'novalidate', 'url' => array('controller'=>'frondends','action' => 'tariffplan') )); this produces www.example.com/frontends/tariffplan i want see : www.example.com/tariffplan changed url follows: 'url' => array('action' => 'tariffplan') but produces : www.example.com/usps/tariffplan i searched google no luck. appreciated try this: 'url' => array('controller' => '/', 'action' => 'tariffplan')

Nested foreach in NetLogo -

i trying calculate gini coefficient of set of numbers. gini coefficient half mean absolute difference. is, every possible pair of numbers in list, need take absolute difference , add these differences (and other stuff). code to-report calc-gini [list-values] let sumdiff 0 foreach list-values [ foreach list-values [ set sumdiff sumdiff + abs ( ?1 - ?2 ) ] ] report 0.5 * sumdiff / (mean list-values * (length list-values) ^ 2) end when test (eg show calc-gini (list 1 2 3) ) error "task expected 2 inputs, got 1" on second foreach . i think problem netlogo wants run through foreach loops simultaneously. if list length n, creates n pairs (that is, first item in list1 , first item in list2, second item in each list etc) requirement equal length lists comes from. need work n^2 pairs obtained crossing lists. how can make nested foreach want and/or other primitive more appropriate? netlogo doesn't have mechanism binding ?1 , ?2 outer , inne...

spring - SEVERE: StandardWrapper.Throwable -

why got error develop jax-rs web service jersey, maven, hibernate , spring. how solve error? aug 03, 2015 2:23:17 pm com.sun.jersey.api.core.packagesresourceconfig init info: scanning root resource , provider classes in packages: obl.funky aug 03, 2015 2:23:17 pm com.sun.jersey.server.impl.application.webapplicationimpl _initiate info: initiating jersey application, version 'jersey: 1.8 06/24/2011 12:17 pm' aug 03, 2015 2:23:17 pm com.sun.jersey.server.impl.application.rootresourceurirules <init> severe: resourceconfig instance not contain root resource classes. aug 03, 2015 2:23:17 pm org.apache.catalina.core.applicationcontext log severe: standardwrapper.throwable com.sun.jersey.api.container.containerexception: resourceconfig instance not contain root resource classes. @ com.sun.jersey.server.impl.application.rootresourceurirules.<init>(rootresourceurirules.java:99) @ com.sun.jersey.server.impl.application.webapplicationimpl._initiate(webapplicat...