Posts

Showing posts from June, 2014

usb - android UsbDeviceConnection.requestWait() with timeout -

i trying interface usb tuner card android device (version 19). currently using usbdeviceconnection.requestwait() read data followed usbrequest.queue of 16kb. things work fine. in case of no input tuner usb wont receive data. in case requestwait() blocking forever. tried use usbrequest.close , usbrequest.cancel not useful. i looked link " http://code.google.com/p/android/issues/detail?id=39522 ", mentions same problem, required write new jni interface. my requirement should able come out of wait , not attempt write new jni inteface (as per above post). please suggest.

java - How to handle button off status while working with selenium -

issue : i working selenium java web browser automation. problem when java code goes particular button click, button remains in off status result of button never clicked , throws exception @ every clickable link present on web. here code have written link click event. have enabled element.click(). it's not working too. public string click_on_link(string locatortype, string value) throws interruptedexception { string status = "pass"; try { final locator; locator = locatorvalue(locatortype, value); webelement element = driver.findelement(locator); element.sendkeys(keys.enter); //element.click(); /* * element.sendkeys(keys.chord(keys.enter, "a")); element.click(); */ } catch (nosuchelementexception e) { system.err.format("no element found click" + e); status = "fail" + "::" + e.getcause(); } return status; } here stat...

ruby on rails - How do I find all the relatives of a node in ancestry? -

i using ancestry gem, , want detected related posts current post. so post has_ancestry . in related posts section of view, have this: <% if @post.has_children? %> <p> <ul> <% @post.children.each |child| %> <li><%= link_to child.title, post_path(child)%></li> <% end %> </ul> </p> <% else %> <p> there no related posts. </p> <% end %> </div> while approach fine, checks 1 use case (i.e. if post has child). want happen though when person clicks through child, on show page should show post related post too. in effect parent, don't want have if post.has_parents? , if post.has_children? , if post.has_siblings? , etc. ideally, relatives detected, , if there relatives want loop through them , display them in homogenous way. how do that?

ajax - Status change by clicking image button in yii2 -

Image
i working on yii2 gridview , want change status clicking image. here gridview code:` ['header'=>'deleted', 'format' => 'image', 'value'=>function($data) { return $data->deleteimageurl; },], ['header'=>'reports status', 'format' => 'image', 'value'=>function($data) { return $data->statusimageurl; },],` and in model have created these functions in model view images using image path: public function getdeleteimageurl() { return \yii::$app->request->baseurl.'/images/'.$this->is_deleted.'.png'; } public function getstatusimageurl() { return \yii::$app->request->baseurl.'/images/'.$this->reports_status.'.png'; } now how can change status? how can add id in image column ? can use ajax if add id there.or if there other solutions please let me know. you should use format...

http - Logstash not connecting elasticsearch? -

i running elk setup on single machine. working fine untill switched off internet connection. my logstash console shows error when switch off internet connection: log4j, [2014-11-27t10:31:57.480] warn: org.elasticsearch.transport.netty: [logstash-hp-pro] exception caught on transport layer [[id: 0x7a124750]], closing connection java.net.socketexception: network unreachable @ sun.nio.ch.net.connect0(native method) @ sun.nio.ch.net.connect(net.java:465) @ sun.nio.ch.net.connect(net.java:457) @ sun.nio.ch.socketchannelimpl.connect(socketchannelimpl.java:670) @ org.elasticsearch.common.netty.channel.socket.nio.nioclientsocketpipelinesink.connect(nioclientsocketpipelinesink.java:108) @ org.elasticsearch.common.netty.channel.socket.nio.nioclientsocketpipelinesink.eventsunk(nioclientsocketpipelinesink.java:70) @ org.elasticsearch.common.netty.channel.defaultchannelpipeline.senddownstream(defaultchannelpipeline.java:574) @ org.elasticsearch.common.netty....

c# - The enableOutputCache parameter is not allowed -

i'm trying block ie caching webpage. after reading question here found there 2 solutions: adding [outputcache(duration = 0)] to each controller or add web.config <caching> <outputcache enableoutputcache="false" /> </caching> i decided go second way. after putting config file: <system.web> <compilation debug="true" targetframework="4.5" /> <httpruntime targetframework="4.5" /> <authentication mode="windows" /> <authorization> <deny users="?" /> </authorization> <customerrors mode="off" /> <caching> <outputcachesettings enableoutputcache="false" /> </caching> </system.web> the enableoutputcache paremeter underlined message: "the enableoutputcache parameter not allowed" wrong code? i think syntax error. this should be: <system.web> ...

c# - TPL and Monitor in PCL -

so i'm writing client api pcl (.net 4.5, sl 5, win8, wp8.1, wp sl 8) library , i've decided i'm going allow 1 http request @ time. use tpl them: task.factory.fromasync<stream>(httpreq.begingetrequeststream, httpreq.endgetrequeststream, null).continuewith<task<webresponse>>((requeststreamtask) => { return task<webresponse>.factory.fromasync(httpreq.begingetresponse, httpreq.endgetresponse, null); }).unwrap().continuewith<httpwebresponse>((getresponsetask) => { return (httpwebresponse)getresponsetask.result; }); so want add locking prevent more 1 request going @ once. know call monitor.enter before start , call monitor.exit in last continuewith . based on migrating lock tpl , can't use monitor because of threading issues possibly. have no issue using different blocking object post recommends far can tell in pcl lock have available monitor. so should do? edit: after talking yuval itzchakov below i'...

html - My bootstrap navigation pills aren't working -

i'm trying set bootstrap pill nav menu , reason pills aren't working , content shows on 1 page, though active pill change. <div class="navigation"> <ul class="nav nav-pills head-menu" id="navbar"> <li class="active"><a href="#abouttab" data-toggle="pill">about us</a></li> <li><a href="#sponsorstab" data-toggle="pill" >sponsors</a></li> <li><a href="#conferencetab" data-toggle="pill">conference</a></li> <li><a href="#execstab" data-toggle="pill">execs</a></li> <li><a href="#gallerytab" data-toggle="pill">gallery</a></li> <li><a href="#contacttab" data-toggle="pill">contact us</a></li> ...

How to close a PST file in Java? -

i using java-libpst.0.7.jar reading pst messages. using following code open pst file read messages. pstfile pstfile = new pstfile("path of pst file"); i have close pst file once after getting message details. there no option close pst file. how can this? by reading code, it's apparent libpst indeed not expose "close" method. finalize() method close underlying file when pstfile garbage-collected, i'd recommend use in smallest scope possible , dispose of asap, other there's not can (except reporting issue project - or better yet, sending patch yourself, of course). edit 1: pstfile has getfilehandle() method returns underlying file, close() that: pstfile pstfile = new pstfile("path of pst file"); // use file pstfile.getfilehandle().close(); edit 2: i've created pull request add pstfile.close() . let's see how fans out. edit 3: pull request has been merged (thanks richard johnson!). in next release (or if ...

How to configure and setup HTMLUNIT with Selenium while using it in C#? -

i setup selenium remote driver , run selenium server.the selenium server running correctly , while try run code using : var remoteserver = new uri("http://127.0.0.1:4444/wd/hub"); desiredcapabilities desiredcapabilities = desiredcapabilities.firefox(); desiredcapabilities.isjavascriptenabled = true; mydriver = new remotewebdriver(remoteserver, desiredcapabilities, new timespan(0,1, 30)); no error throws in cmd log , elements can find properly, headache comes while try run using below code : var remoteserver = new uri("http://127.0.0.1:4444/wd/hub"); desiredcapabilities desiredcapabilities = desiredcapabilities.htmlunit(); desiredcapabilities.isjavascriptenabled = true; mydriver = new remotewebdriver(remoteserver, desiredcapabilities, new timespan(0, 1, 30)); in log throws lots of error , while try find element, timeout exception showing in log. test code in below : mydriver.manage().window.max...

javascript - while loop in jQuery -

i need use while loop, wonder if there syntax changes in jquery in javascript var text = ""; var = 0; while (i < 10) { text += "<br>the number " + i; i++; } document.getelementbyid("demo").innerhtml = text; how can perform loop in jquery this? there no difference between javascript , jquery in case of while loop $(function () { var text = ""; var = 0; while (i < 10) { text += "<br>the number " + i; i++; } $("#demo").html(text); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="demo"></div>

javascript - Why is the data unbind with modal window? /AngularJS -

can tell me. want let reflect input data in modal window , parent window text. it's not reflected making modal window. how reflected? html <p><img src="***.jpg" alt="" ng-click="cover.show()"></p> <p class="binding-field" id="title-box">{{titlebox}}</p> <script id="templates/input-cover.html" type="text/ng-template"> <ion-modal-view> .......... <ion-content class="input-area"> <form action=""> <label class="item item-input item-stacked-label"> <input type="text" placeholder="title" ng-model="titlebox"> </label> </form> </ion-content> </ion-modal-view> controllers.js function inputctrl($scope, $ionicmodal) { $ionicmodal.fromtemplateurl('templates/input-cover.html', { scope: $scope }).then(function(modal) ...

Bootstrap Datepicker is not Working .Using BootStrap 3.3.1 -

first have downloaded zip file bellow link http://www.eyecon.ro/bootstrap-datepicker/ , got following structure 1.css folder - datepicker.css 2.js folder-bootstrap-datepicker.js 3.less folder - datepicker.less then have added asp.net mvc 4 project structure , in index.cshtml have added references bellow code <script src="http://code.jquery.com/jquery.js"></script> <script src="~/contents/bootstrap/js/bootstrap.min.js"></script> <script src="~/contents/bootstrap/js/npm.js"></script> <script src="~/contents/bootstrap/js/bootstrap-datepicker.js"></script> <script type="text/javascript"> $(function () { $('#datetimepicker9').datepicker(); $('#datetimepicker10').datepicker(); $("#datetimepicker9").onclick ("dp.change", function (e) { $('#datetimepicker10').data(...

c# - Windows Phone 8 News Application -

i planning develop company internal news app in wp8. quiet beginner in wp , mine first app ever. concerning database i've question. wcf way consuming data sql. there other option? how can provide best data connection , transition such these apps. in advance. wcf not option. can use asp.net web api, helps create http services. here can find tutorial how call web api windows phone 8. what can use depends on points. wcf can develop restful services, focused on soap. asp.net web api more lightweight. because want develop internal app, should first decide how want expose service, before thinking of technology. like mentioned in comments, stackoverflow not place asking kind of questions. next time make sure pay attention rules.

Sending Refreshed Excel Sheet Every Workday using VBA Excel/Outlook -

every day @ 3pm have send out excel workbook colleague. macro in workbook copies cells in 1 sheet , paste special sheet , saves workbook. have written macro , send email address, struggle have sent automatically. have instructed scheduling tasks already, don't know how make link between opening excel, performing marco, saving workbook , sending specified person. code below - help. sub fixing() sheets("sheet2").select activewindow.smallscroll down:=-9 cells.select selection.copy sheets("sheet1").select range("a1").select selection.pastespecial paste:=xlpastevaluesandnumberformats, operation:= _ xlnone, skipblanks:=false, transpose:=false range("i7").select application.cutcopymode = false activeworkbook.save dim outapp object dim outmail object set outapp = createobject("outlook.application") set outmail = outapp.createitem(0) on error resume next outmail ...

Getting digits of number in c# -

i want able take digit number in c# , created function so. used maths digit. here code static int getdigit(int number, int k) { // k positiong of digit want number // want divide integer number 10....0 (number of 0s k) , % 10 // last digit of new number return (number / (int)math.pow(10, k-1)) % 10; } however, there error message - "error 1 cannot implicitly convert type 'double' 'int'. explicit conversion exists (are missing cast?)". think math.pow returns double tries convert type of number double. appreciated :) convert integer? static int getdigit(int number, int k) { // k positiong of digit want number // want divide integer number 10....0 (number of 0s k) , % 10 // last digit of new number return (int)(number / math.pow(10, k)) % 10; } }

c# - DhcpEnumFilterV4 (P/Invoke) always reports ERROR_NO_MORE_ITEMS -

i try programmatically enumerate dhcp filters on windows 2012 r2 dhcp server. using p/invoke, code looks like: public const uint error_success = 0; public const uint error_more_data = 234; public const uint error_no_more_items = 259; public const int max_pattern_length = 255; [structlayout(layoutkind.sequential, charset = charset.unicode)] public struct dhcp_addr_pattern { public bool matchhwtype; public byte hwtype; public bool iswildcard; public byte length; [marshalas(unmanagedtype.byvalarray, sizeconst = max_pattern_length)] public byte[] pattern; } [structlayout(layoutkind.sequential, charset = charset.unicode)] public struct dhcp_filter_enum_info { public uint numelements; public intptr penumrecords; } public enum dhcp_filter_list_type : uint { deny = 0x1, allow = 0x2 } [structlayout(layoutkind.sequential, charset = charset.unicode)] public struct dhcp_filter_record { public dhcp_addr_pattern addrpatt; public string comm...

How to place marker on point tapped in google maps api v2? -

how can declare latlng point in map activity, when users taps on specific point on map place marker. have done create map can add custom marker camera intent ond place on map. problem isn't fact works, fact have declare 'point' coordinates on map when the image taken place thumbnail of image @ point. example: static final latlng point = new latlng(xx.xxxx, xx.xxxx); and in onactivityresult camera intent: markeroptions markeroptions = new markeroptions() .position(point) .icon(bitmapdescriptorfactory .frombitmap(bitmap)); googlemap.addmarker(markeroptions); so want listen user has tapped , return image point tapped. could please help? if need more info please let me know , update question. thanks updated code @override public void onmapclick(latlng point) { root = environment.getexternalstoragedirectory().tostring() + "/your_folder"; imagefolderpath = root + "/saved_images"; ...

asp.net mvc - MVC 5 does a controller exist -

i coding mvc 5 internet application , wish know if possible check if controller exists have name of controller ? i have application_error function gets name of controller when error occurs, , wish redirect index method of controller . problem user can enter in controller name not exist, , redirecting controller results in endless loop. thanks in advance. var temprequestcontext = new requestcontext(request.requestcontext.httpcontext, new routedata()); temprequestcontext.routedata.datatokens["area"] = ""; temprequestcontext.routedata.datatokens["namespaces"] = "yourcompany.controllers"; var controller = controllerbuilder.current.getcontrollerfactory() .createcontroller(temprequestcontext, "controllername"); if(controller != null) { //todo: redirect }

c# - Unity How to make GameObject Speed gain velocity -

Image
i have torpedo in unity3d game i'm making in unity3d , have torpedo fire out of sub. how can make torpedo fire torpedo (start slow) , gain lots of momentum , speed up, in movies. below code how i'm doing this, doesn't work well. float torpedospeed = (0.00001f) * 155.2f; //move gameobject.transform.position += new vector3(velocity, 0, 0) * 15.5f; modern torpedo can speed because propelled. therefore trick accelerate torpedo. acceleration requires force in direction. must first determine mass of torpedo, allow apply force accelerates. so acceleration force applied divided mass of object. that being said, can add force object in unity using: gameobject.rigidbody.mass = 0.5; gameobject.rigidbody.addforce(100, 0, 0); or can add constant force keep torpedo accelerating. gameobject.constantforce.relativeforce = vector3(0, 0, 1);

opencv - How to aggregate CSV data with group by in Java? -

assume have following csv file of action log of application. csv may contain 3 - 4 million rows. company, actionstype, action abc, downloaded, tutorial 1 abc, watched, tutorial 2 pqr, subscribed, tutorial 1 abc, watched, tutorial 2 pqr, subscribed, tutorial 3 xyz, subscribed, tutorial 1 xyz, watched, tutorial 3 pqr, downloaded, tutorial 1 is there anyway way aggregate data grouping company name , show actiontype counters column shown below using java? company, downloaded, watched, subscribed abc, 1, 2, 0 pqr, 1, 0, 2 xyz, 0, 1, 1 i thought of loading csv file list using opencsv, efficient csv file of millions of data? it's inefficient if you're trying aggregate data. should check out mapreduce aggregating large data. here's solution w/o mapreduce: import java.io.bufferedreader; import java.io.stringreader; import java.util.hashmap; public class csvmapper { public string transformcsv (string csvfile) { return csvmaptostring(getcsvmap(cs...

java - apache tomcat and glassfish server not decoding utf-8 characters? -

this jsp page: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>jsp page</title> </head> <body> <% string msg="206_john_help m in trouble,delhi,อินเดีย_30.64741430_76.817313799"; string result = java.net.urlencoder.encode(msg, "utf-8"); system.out.println("the msg "+result); string result1=java.net.urldecoder.decode(result, "utf-8"); system.out.println("the decoded msg "+result1); %> </body> </html> the output 206_john_help m in trouble,delhi,???????_30.64741430_76.817313799 i getting ?????? instead of thai alphabets. how can thai alphabets while decoding? you can try adding @ top: <%@page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8"%> i think solve problem. if not, give more information? are using eclips...

dialog - Angularjs Add Data to templateCache -

i having problems showing data in templatecache... if "edit" button clicked, custom dialog showing , userdata supposed show in input fields edited. i used data sql select , worked fine , have saved data in $cookiestorage , wanted take information $cookiestorage , add dialoge. the function supposed be, dialog showing when function completly done! need loaded , put data fields. thats code: var listapp = angular.module('listpp', ['ui.bootstrap','dialogs','ngcookies']); listapp.controller('userctrl', function ($scope, $dialogs,$cookiestore) { .... $scope.u_edit = function (index) { dlg = $dialogs.create('/dialogs/edituser.html','edituserctrl',{},{key:false ,back:'static'}); $cookiestore.aktuser = $cookiestore.user[index-1]; -stuff user infos , react button clicks in dialog- }) .run(['$templatecache',function($templatecache,$scope,$cookiestore){ $templatecache.put('/dia...

cmake install: how to remove subdir prefix -

i have library liba. structure following: liba + cmakelists.txt + mysrc/headera.h + mysrc/headerb.h + mysrc/modulea/moda.h + mysrc/moduleb/modb.h my lib compiles fine , afterwards want install using cmake code: set(source_dir mysrc) set(lib_name liba) ... install(targets ${lib_name} destination /usr/local/lib) install(directory ${source_dir} destination /usr/local/include/liba files_matching pattern "*.h") result: liba.a ends in /usr/local/lib/liba.a (which fine) headers end in /usr/local/include/liba/mysrc/* /usr/local/include/liba/mysrc/modulea /usr/local/include/liba/mysrc/moduleb what not wanted. i want remove "mysrc": /usr/local/include/liba/* /usr/local/include/liba/modulea /usr/local/include/liba/moduleb how can remove mysrc path? as cmake documentation says, can prevent cmake appending directory name following trailing slash: install(directory ${source_dir}/ destination /usr/local/include/liba files_matching patter...

node.js - Connecting to socket.io 1.x manually using websockets, capacity testing -

i working nodejs express server uses socket.io communicate ios client, , having little trouble trying test how many clients can connect , exchange data @ 1 time. my goal able run script connects socket.io thousands of different sessions, send , receive data understand our system's scale. using single dyno on heroku considering other options on aws soon. i have found code should trying earlier versions of socket.io, such this , have had issues since seems v1.x has different handshake protocol. tried out using socket.io-client package, trying connect multiple times simulates use of 1 session, need simulate many in independent users. i have been picking apart socket.io-client code, have gotten far creating connection - stuck on sending data part. if has knowledge or point written resources on how data sent between client , socket.io server, me out lot. here's have far: var needle = require('needle'), websocket = require('ws'), base_url = ...

javascript - Remove elements from Drawing manager overlay array -

i working on map-based service. there user can select items on map drawing rectangles , polygons using drawingmanager. push these shapes global array after created keep control on them this: google.maps.event.addlistener(drawingmanager, 'overlaycomplete', function(e) { if (e.type != google.maps.drawing.overlaytype.marker) { // switch non-drawing mode after drawing shape. drawingmanager.setdrawingmode(null); var newshape = e.overlay; all_overlays.push(newshape); newshape.type = e.type; newshape.id = all_overlays.length-1; all_overlays[newshape.id].id = all_overlays.length-1; } the user has option delete single shape. implemented deletion this: function deleteselectedshape() { if (selectedshape) { all_overlays.splice(selectedshape.id,1); while(jquery.inarray(selectedshape.id, selected_shapes) != -1) { var shape_index = jquery.inarray(selectedshape.id, selected_shapes); selected_shapes....

Android : Service/Activity should start after some time, while the screen is off or user is not using his phone till 5 minutes -

i'm having problem want have service/activity running after time, after turned off screen , put phone pocket or user not using phone til 5 minutes. is there somewhere system timer, can call app wake , accquire wakelock then. (screen off time , in pocket)

unix - Search files and run a script on every result - Cont: -

i know how search pattern of files (gunzip files) in sub directories ( month wise / date wise - sub directories created). , then, execute script on found files. need populate filename along output tracking purpose , further analysis on particular files. step1: example: searching files on pattern tt_detail*.gz. find /cygdrive/c/test/ -name tt_detail*.gz output#1: /cygdrive/c/test/feb2014/tt_detail_20141115.csv.gz /cygdrive/c/test/jan2014/tt_detail_20141110.csv.gz /cygdrive/c//test/mar2014/tt_detail_20141120.csv.gz step2: zcat tt_detail*.gz | awk 'begin { fs=ofs=","} { if ($11=="10") print $2,$3,$6,$10,$11,$17}' >op_tt_detail.txt cat op_tt_detail.txt zzz,aaa,ech,1,10,xxx zzz,bbb,ech,1,10,xxx zzz,ccc,ech,1,10,xxx zzz,ddd,ech,1,10,xxx thanks fedorqui below script working fine without filename. while ifs= read -r file awk 'begin { fs=ofs=","} { if ($11=="10") print $2,$3,$6,$10,$11,$17}' <(zcat ...

java - How to architect my project by maven -

thanks of read question! months ago , had build nexus manage maven repository , build empty web project. my goal create architecture company. when new project comes, can configure pom.xml add frame dependency. well, project's frame springmvc + velocity + mybatis i separated java source code 4 models, groupid , artifectid has been named below: groupid __com.myproject.framework__ parent pom's artifactid com.myproject.framework-root . sub models's artifactid framework-core , framework-utils , on. this architecture can used when create empty java web project. configured pom.xml : <dependency> <groupid>com.myproject.framework</groupid> <artifactid>framework-core</artifactid> <version>1.0</version> </dependency> it's good, can reference jar package well! but framework-core's java code uses spring framework. source code of myproject-framework-core jar package, below: ac...

javascript - How to capture a click on a specific leaflet layer -

i think question says all. using leaflet. loading 3 layers onto map. however can't find way know on layer clicked after clicking on map. because there no event handler set on layers, onto map. i tried add layers feature group , add on click event feature group. clicking on map not result in event / response. this did in featuregroup: addwaternamelayers: function() { var knownwaters = l.tilelayer.wms(getgeoserver('wms', geoenviroment), { layers: this.wmslayers.known.name, format: 'image/png', opacity: 0, styles: 'cursor: pointer', transparent: true, attribution: "" });//.addto(this.mapinfo); var unknownwaters = l.tilelayer.wms(getgeoserver('wms', geoenviroment), { layers: this.wmslayers.unknown.name, format: 'image/png', opacity: 0.3, styles: '', transparent: true, attribution: "" }); ...

Why component from Xpages Extension lib doesn't support converter -

my xpage using xe:djdatetextbox (bellow): <xe:djdatetextbox id="djdatecreatedfrom" value="#{compositedata.archivedocument.entrydatefrom.time}" title="#{javascript:languagegetlabelname('_arch_from_date')}" style="width:49%;" showreadonlyasdisabled="true" readonly="#{javascript:!compositedata.editmode}"> <xe:this.converter> <xp:convertdatetime> <xp:this.pattern><![cdata[${javascript:"dd.mm.yyyy"}]]></xp:this.pattern> </xp:convertdatetime> </xe:this.converter> public class archivedocument extends param{ /** * */ private calendar entrydatefrom; public archivedocument() { super(); entrydatefrom = calendar.getinstance();} public calendar getentrydatefro...

swift - UIButton's textLabel not being clipped -

Image
i have uibutton,and set text this: let mybutton ... mybutton.textlabel?.text = "abcdefghijklmn" but when run ,the text clipped. how uibutton auto resize fit inner text. here screenshot. what want this: abcdefghijklmn option a: mybutton.sizetofit() option b: use layout constraints don't constrict label's width

Get all files with a revision greater than 1 in a perforce workspace -

i want files have revision greater 1 in specific workspace, how can in perforce? files revision greater 1 not modified in particular workspace. have been modified anywhere, got submitted , have new revision. if still want list of files in current workspace rev > 1 this: p4 have | grep -v "#1" if want list files open (e.g. opened modification) in current workspace this: p4 opened

java - Create log4j logfiles per process -

i'm using log4j2, , have configuration in log4j2.xml (in classpath s automatically configured) in particular case, want create separate log files per process. i have framework multiple packages , multiple classes. have statements like: logger logger = logmanager.getlogger(getclass()); lets have 3 processes a, b , c. how should configure log4j 3 output files a.log, b.log , c.log , include logging calls made in framework classes? i want able log individual packages/classes other log appenders if need debug etc, prefer keep getclass() argument mentioned above. all ideas welcome! give every process own configuration file. specify different paths in these configurations. you can specify full path of configuration file system property: -dlog4j.configurationfile=path/to/log4j2.xml

php - How to get array key by value from array in smarty template? -

how array key value array in smarty template? from below can last inserted key need particular key value in smarty. {$array|@array_keys|@array_pop} assuming have following array: $smarty->assign("array", [ '0' => 5, 'a' => 'abc', 'd' => 'xyz' ]); you can use in smarty: {assign var="key" value='xyz'|array_search:$array} {if $key !== false} key {$key} {/if} to find key given value in array. of course work described array_search function

javascript - Foundation Abide validation throws an error even if card number is valid -

i implementing foundation abide in following: http://alessandrosantese.com/abide/index3.html , if card number correct (tested visa) still throws error when click on submit. happens if type card number in first , click on submit. i have overwritten pattern card 1 of visa regex using project. <script> $(document) .foundation({ abide : { patterns: { dashes_only: /^[0-9-]*$/, ip_address: /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, card:/^4(?:[0-9]{12}|[0-9]{15})/ } } }); </script>

asp.net mvc - Why doesn't my action method time out? -

i have following controllers: [timeoutfilter] public abstract class basecontroller: controller { } public class integrationtestcontroller : basecontroller { [httpget] public actionresult timeoutseconds() { return content(httpcontext.server.scripttimeout.tostring(cultureinfo.invariantculture)); } [httpget] public actionresult forcetimeout() { var timeoutwindow = timeoutfilter.timeoutseconds; thread.sleep((timeoutwindow + 5) * 1000); return content("this should never returned, mwahahaaa!"); } } for test scenario use config setting of 5 seconds in timeoutfilter , , know working because when test calls timeoutseconds , correct value of 5, when test calls forcetimeout , http response of 200 , 'never returned' text. and filter: public class timeoutfilter : actionfilterattribute { internal const string timeoutsecondssettingskey = "mvcactiontimeoutseconds"; internal static int time...

c# - Speeding up Parallel.ForEach iterating through datatable and rendering crystal report as byte stream -

good day, i attempting speed processing of 5000 rows received database, render crystal report, export byte stream , save byte stream in database table. using parallel.foreach on datatable. uses 40 parallel processes sequentially iterates 125 (i.e 5000/40) records of 5000 rows. take approximately 5 minutes 5000 @ moment. please assist on suggestions on how speed up. datatable dtbills = new datatable("dtbills");//i used odbcdataadapter fill 5000 records private void parallelprocess() { int numbills = 5000; int numprocesses = 40; int numsequential = numbills / numprocesses; int p=0; if (numbills < numprocesses) p = numbills; else p = numprocesses; parallel.for(1, p+1, new paralleloptions { maxdegreeofparallelism = 40 }, => { sequentialprocess(numsequential,i); }); } private void s...

Execute JavaScript on web browser by Java -

is there way click on particular links on web browser or run javascripts after opening browser using java? i have used code launch browser. how can run js on web browser or click links on using java ? desktop desktop = desktop.isdesktopsupported() ? desktop.getdesktop() : null; if (desktop != null && desktop.issupported(desktop.action.browse)) { try { uri uri = new uri("http://stackoverflow.com/"); desktop.browse(uri); } catch (exception e) { e.printstacktrace(); } } } i think should use selenium !! used chromedriver + selenium web automation testing. you need : http://docs.seleniumhq.org/projects/webdriver/ this simple example open site , scroll, , remove dom : system.setproperty("webdriver.chrome.driver", "chromedriver.exe"); desiredcapabilities capabilities = desiredcapabilities.chrome(); capabilities.setcapability("ch...

Finding Extrema in an Image without dividing into Regions in Matlab -

i want find 8-point extrema of binary image. know 'extrema' property of regionprops function in matlab. however, function dividing image region first , trying find out extrema. there anyway find extrema in image without dividing region? please help. thanks in advance.

What is the difference between filetype= and syntax= in Vim? -

i noticed in order vim color highlight syntax of specific file, 1 can both set following in _vimrc file: au bufnewfile,bufread *.file_extension set filetype=program_highlighting au bufnewfile,bufread *.file_extension set syntax=program_highlighting what difference between using filetype= or syntax= ? the 'filetype' superset of 'syntax' . with 'filetype' (assuming have :filetype plugin on configured), load filetype plugins , corresponding settings (e.g. indent config, compiler, mappings) ftplugin configuration subdir, in addition setting syntax filetype name. that last part done automatically vim part of filetype processing, in $vimruntime/syntax/syntax.vim : au! filetype * exe "set syntax=" . expand("<amatch>")

c++ - How do I know where "C2280 - attempting to reference a deleted function" occurs? -

i'm having hard time figuring out piece in code causes error mentioned in title. error message in error list this: error c2280: 'foo::foo(const foo &)' : attempting reference deleted function file: vector, line: 1100 and compiler output looks this: d:\visual studio 2013\vc\include\vector(1100): error c2280: 'foo::foo(const foo &)' : attempting reference deleted function e:\testproject\src\foo.h(22) : see declaration of 'foo::foo' diagnostic occurred in compiler generated function 'luabridge::luabridge::typelistvalues<luabridge::typelist<p1,luabridge::none>> ::typelistvalues(const luabridge::typelistvalues<luabridge::typelist<p1,luabridge::none>> &)' [ p1=foo & ] to me, error message says absolutely nothing error occurs. know it's deleted copy constructor (line 22 in foo.h deleted copy ctor), that's it. i'd keep copy constructor deleted well. how can find out exact oc...

r - Error while using woe procedure in klaR package -

i have noticed reason procedure woe klar package produce error while trying execute on data.frame 1 column being one-level factor. here example: a<-factor(rep(c("bad", "good"), 5)) b<-factor(rep(c(1,2), 5)) c<-factor(rep(c(2,3), 5)) d<-factor(rep(1,10)) df<-data.frame(a=a, b=b, c=c, d=d) now execution of woe(a~., data = df[,-4]) won't produce errors, whereas woe(a~., data = df) will crash following: error in applywoes(object[[i]], x.fact[, which(names(x.fact) == names(object)[i])]) : factor levels not match! in addition: warning message: in is.na(e2) : is.na() applied non-(list or vector) of type 'null' seems me problem d has 1 level factor. nonetheless, definition of woe should give value of 0 such factor... is error in procedure implementation or (for strange reason) deliberate behavior? my guess not deliberate behaviour. read on git( https://github.com/cran/klar/blob/master/r/woe.r ), fonctions such ...

node.js - Get all documents of a type in mongoose but only with 1 specific item of each documents array -

i'm using express 4 , mongoose rest api. have multiple documents of type "shop". each shop holds (besides other information) array called "inventory" holds again multiple items. each item has properties name , price. now have api call can shops "cheapest" product item in json response. i'm totally stuck in creating query returns shops instead of including items of inventoryjust includes inventory item lowest price item in inventory array. i found hints on how exclude fields using following query there whole array excluded: shop.find({}, {inventory: 0},function(err, shops) { if (err) { res.send(err); } else { res.json(shops); } }); update 1: schemas // shop var shopschema = new schema({ name: { type: string, required: true}, address: { street: string, zipcode: number, city: string }, inventory: [inventoryitemschema] }); // inventoryitem var inventoryitemschema = new ...

Validating a data input javascript -

i have been looking validate data input check whether integer or string. looked around , saw suggestions , typeof suggestions nothing seems work. var nam = prompt("enter name:") person.push(nam); var mk1 = prompt("enter mark 1:"); var mk1 = parseint(mk1); mark1.push(mk1); if want check whether input string not number try this: if (isnan(parseint(name, 10)) { //name string } else { //name number }

PHP OOP - Passing object to function is not working -

i have problem here on php oop. try in .net - pass whole object function. unfortunately, script didn't appear work , when try debug (using netbeans) stopped here: $ud = new userdetails($fullname, $email, $contact, $username, $password, $password2); can tell me did wrongly? in advance! my script: <?php include 'class/registration.php'; $fullname = $_post['fullname']; $email = $_post['email']; $contact = $_post['contact']; $username = $_post['username']; $password = $_post['password']; $password2 = $_post['password2']; $ud = new userdetails($fullname, $email, $contact, $username, $password, $password2); if (registration::checkemptyfield($ud)==true){ $error = "please don't leave field empty"; } userdetail class: <?php class userdetails { protected $_fullname; protected $_email; protected $_contact; protected $_username; protected $_password; protected $_password2; publ...

hadoop - Block assignation using network topology -

if understood principles when applying network topology, blocks written: on client server if hosting datanode on second server defined on different rack on third server defined on same rack #2 is policy configurable or “hard-written” in class? of course, not want modify class myself… basically, to: take account datacenter (according read, hdfs not care datacenters if using network topology) force write in 3 distinct racks how do that? there capability override baseline block allocation algorithm involve writing quite bit of java code , there aren't real examples out there. here blog link jira ticket explaining enhancement: http://hadoopblog.blogspot.com/2009/09/hdfs-block-replica-placement-in-your.html https://issues.apache.org/jira/browse/hdfs-385

php - How to compress an array? -

Image
lets say, have array 1000 values (integers). , need array have array f.e. 400 values (the number can changed, f.e. 150, etc.). so need return each 2.5th array value, i.e. 1st, 3rd, 6th, 8th, 11th, etc. is somehow possible? i dont need code, need way, how it. edited: my array array of elevations (from array gps coordinates). , want draw 2d model of elevation. lets say, map have 400px width. 1px = 1 point of elevation. thats why need each 2.5th elevation value... like this: you don't want 2.5th one. want divide set blocks of 5 , first , third each set. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 you want first , third columns. this php, we've got 0-based arrays. we can divide groups of 5 using modulo operator % . can see if return value 0 (i.e. it's in first column) or 2 (i.e. it's in third column). i'm going presume array has numeric keys starting 0 . // php 5.6 $filtered = array_filter($array, function($value, ...

android - How to stop background process automatically if app not in touch -

now going on check whether app active or not. for had went onpause() , onresume() had used in baseactivity abstract class other activity. now need if app not view in screen other app running in screen in case how can check whether app active or not. for example using ontouch() if didn't touch app more 5min should stop background service. in facebook notification if logout or not in use here need should not show notification when app not in use 5 min. if have idea please me friends.

install4j - How to add Java sub directory to Resources directory of mac app bundle -

i use install4j make easier deploy java application windows, mac, , linux. evaluating install4j on windows development machine make sure can need before purchase it. so far, can work windows , linux not mac. mac app bundle cobbled (without install4j) has following structure java dir contains external jar files (such derby.jar ) required application. myapp.app contents macos resources java perhaps can use simpler structure have , works. unfortunately, structure install4j builds not work (it cannot find derby.jar ) , cannot figure out how install4j duplicate app bundle directory structure know work. any suggestions?

web services - The XML document is not well formed error in Paperless Document API -

i sending post request ups paperless document api upload user created form getting the xml document not formed my request message is . <?xml version=\"1.0\"?> <upssecurity> <usernametoken> <username>******</username> <password>******</password> </usernametoken> <serviceaccesstoken> <accesslicensenumber>*************</accesslicensenumber> </serviceaccesstoken> </upssecurity> <?xml version=\"1.0\"?> <uploadrequest> <request> <transactionreference> <customercontext></customercontext> </transactionreference> </request> <shippernumber>??????</shippernumber> <usercreatedform> <usercreatedformfilename>sample test file</usercreatedformfilename> <usercreatedformfile>sgvsbg8gqw5rdxi=</usercreatedformfile> <usercreatedformfileformat>txt</usercreatedformfileformat> ...

javascript - Websocket timeout -

i need handle websocket timeout when socket trying connect server available busy. more in deep have web application can connect several single-thread remote socket server in charge post-process data passed input. the goal collect data web gui , submit them first socket available , listening. in case server socket daemon processing data, cannot serve user request has instead addressed second socket of list. basically , practical example, have such socket ready accept call coming web brworser: ws://10.20.30.40:8080/ ws://10.20.30.40:8081/ ws://10.20.30.40:8082/ ws://10.20.30.40:8083/ ws://192.192.192.192:9001/ when first socket receive call , perform handshake, starts process data (and process may took minutes). when client same request on different set of data, that request served 2nd socket available , on. so question is... how can contact socket (the first of list), wait 250 milliseconds , (in case of timeout) skip next one? i've started following approach: ...