Posts

Showing posts from April, 2010

c# 4.0 - Does the C# compiler hoist variable declarations out of methods called within loops? -

i have method calls helper method within for loop. helper method contains relatively expensive variable declaration , definition involves reflection (see below.) i'm wondering if compiler can counted on inline method call , hoist declaration , definition out of loop, or if need refactor method in order guarantee definition statement isn't executed each iteration. private class1[] buildclass1arrayfromtestdata() { var class1count = int.parse(testcontextinstance.datarow["class1[]"].tostring()); var class1s = new list<class1>(class1count); (var c = 0; c < class1count; c++) { class1s.add(buildclass1fromtestdata(string.format("class1[{0}]", c))); } return class1s.toarray(); } private class1 buildclass1fromtestdata(string testcontextname) { datacolumncollection columns = testcontextinstance.datarow.table.columns; var class1fields = typeof(class1).getfields(); var class1object = new class1(); forea

javascript - Parenthesis and Quotes - is it really this simple? -

if (url) { var parsedurl = new url(url); s.evar17 = parsedurl.href; s.evar19 = parsedurl.host; s.linktrackvars = 'prop6,evar6,prop4,evar5,evar17,evar19'; var ppvarray = s.getpercentpageviewed(s.pagename); s.evar6 = s.prop6 = ppvarray[1] + "|" + ppvarray[2] + "|" + ppvarray[3]; } as feel enough javascript, encounter stumps me. can't figure out why piece of code not firing. supposed track visitors website exit site , visit first page of new website. websites specific , linked on site. code pulls url can keep track of how many visits new site gets. i believe should have parenthesis around defined of s.linktrackvars. , double quotes. can give me clues lead me in right direction? here's think should be: s.linktrackvars=("prop6, evar6, prop4, evar5, evar17, evar19"); thanks! misty sounds dealing serilization , deserilization of array of objects; , code should read like; var linktrackvars = { ev

asp.net - Remove .aspx extension visual studio 2012 -

i'm trying edit web.config roadsunknown's code (from post remove html or aspx extension ): <rewrite> <rules> <rule name="rewriteaspx"> <match url="(.*)" /> <conditions logicalgrouping="matchall"> <add input="{request_filename}" matchtype="isfile" negate="true" /> <add input="{request_filename}" matchtype="isdirectory" negate="true" /> </conditions> <action type="rewrite" url="{r:1}.aspx" /> </rule> </rules> </rewrite> when add code following error: warning 1 element 'system.web' has invalid child element 'rewrite'. i have iis url rewrite 2.0 installed , have executed script on blog ( http://blog.vanmeeuwen-online.nl/2013/04/visual-studio-2012-xml-intellisense-for.html )

jboss - Is Redhat moving away from HornetQ to ActiveMQ? -

hornetq, open source message implementation created redhat promoted part of redhat's jboss application server. hornetq strong contender apachemq when launched. i going through jboss fuse documentation , realized "active mq" used messaging technology. (i know jboss fuse developed on apache camel) my question is, "is redhat moving away hornetq? or use both implementations in products?". have not seen official announcement replacing "hornetq" "activemq", wanted find out steps. i have been using "horntq" native jboss, because of arrival of many new components project, looking adopt jboss fuse esb. , observed major difference in messaging systems. as used jms, hope there not major changes required queue/factory/messaging related config. new applications developed using jboss, recommended use activemq hornetq?

enable 'sudo' to rm wild repo (gitolite) -

i need delete wild repo, don't have enough privileges so, though gitolite admin user, , have no public key of creator of repo (as it's on physical machine, have no access to). read 'sudo' command, don't know supposed enable it, , how. suppose should in .gitolite.rc file?! does know how this? thanks. regarding sudo command (introduced in gitolite v3.04, 2012-06-27 ): sudo -- allows admin (i.e., has push rights ' gitolite-admin ' repo) run remote command other user. this useful, example, when user claims unable access repo, , need check 'info' output him, etc. however, not work other way, sorry! the source includes way command activated, using gitolite query-rc command : # figure out if command allowed remote user gitolite query-rc -q commands $cmd || die "command '$cmd' not allowed" gitolite $cmd "$@" you need add ' sudo ' list of enabled command in .gitolite.rc on gitolite se

c# - Html Agility Pack get contents from table -

i need location, address, , phone number " http://anytimefitness.com/find-gym/list/al " far have this... htmldocument htmldoc = new htmldocument(); htmldoc.optionfixnestedtags = true; htmldoc.loadhtml(stateurls[0].tostring()); var blanknode = htmldoc.documentnode.selectnodes("/div[@class='segmentwhite']/table[@style='width: 100%;']//tr[@class='']"); var graynode = htmldoc.documentnode.selectnodes("/div[@class='segmentwhite']/table[@style='width: 100%;']//tr[@class='gray_bk']"); i have looked around stackoverflow while none of present post regarding htmlagilitypack has helped. have have been using http://www.w3schools.com/xpath/xpath_syntax.asp since <div> you're after not direct child of root node, need use // instead of / . can combine xpath blanknode , graynode using or operator, example : var htmlweb = new htmlweb(); htmldocument ht

mongodb - Bug on line 52 of my javascript code and i can't figure it out -

i'm using below javascript code in appery.io app. keep getting error states following: 6/25/2014 9:37:35 pm: script all_users_data: typeerror: cannot read property '_id' of undefined ( @ 52 : 33 ) -> if (all_photo[i].the_user._id == id) { please me identify bug. i'm attempting pull data 3 collections, sync them _id 'users' collection , output user profile type information. var all_users = eval(databaseuser.query('52895ecce4b056c5e94f34f9')); var all_profiles = eval(collection.query('52895ecce4b056c5e94f34f9', 'profile')); var all_status = eval(collection.query('52895ecce4b056c5e94f34f9', 'status')); var all_photo = eval(collection.query('52895ecce4b056c5e94f34f9', 'photo')); // loop on users (var i=0;i<all_users.length;i++) { // call function search user profile , add first name current user item getprofile(all_users[i]._id, all_users[i]); // call function se

playframework - Where to find appDependencies in Play 2.0 application? It's already been set? if not how should I set it -

i tried in build.sbt : val main = play.project("hello-play-java", "1.0-snapshot", seq("com.wordnik" %% "swagger-play2-utils" % "2.2.3")).settings( // force compilation in java 1.7 javacoptions in compile ++= seq("-source", "1.7", "-target", "1.7") ) but compilation 'com.wordnik' %% 'swagger-play2-utils' % '2.2.3' not find error, randomly put since don't know it.. what version of play 2 using? mention build.sbt suggest play 2.2+, code snippet suggests play 2.0.x - 2.1.x (upgrading legacy project)? when "not find error", if referring sbt not being able resolve 'swagger-play2-utils' % '2.2.3' because latest swagger dependency version available maven central 1.3.6. for reference, here build configurations relevant play versions. for play 2.2+: build.sbt import sbt.keys._ name := "hello-play-java"

asynchronous - F# closures on mailbox processor threading failure -

so doing batch computation cpu intensive on books. , built tracker track computation of tasks. close on mailboxprocesser runs fine without parallelizaton when put array.parallel.map or , async workflow mailboxprocesser fails. want know why? type timermessage = | start of int | tick of bool let timer = mailboxprocessor.start(fun mbox -> let inputloop() = async { let progress = ref 0 let amount = ref 0 let start = ref system.datetime.utcnow while true let! msg = mbox.receive() match msg | start(i) -> amount := progress := 0 start := system.datetime.utcnow | tick(b) -> if !amount = 0 () else progress := !progress + 1 let el = system.datetime.utcnow - !start let eta = int ((el.totalseconds/float !progress)*(float (!amount - !progress))) l

ruby - How to pack multiple parameter into one -

i use prawn generate pdf. make table , do: table test_rows(test), :column_widths => [100, 200, 360] , &table_style is there way can let me put proc table_style ? don't want repeat column_widths , table_style in code. def table_style return proc.new{ row(0).font_style = :bold columns(1..3).align = :center self.row_colors = ["dddddd", "ffffff"] self.header = true } end this method appears take 3 arguments: data, options , block. see https://github.com/prawnpdf/prawn/blob/master/lib/prawn/table.rb if trying store arguments temporary variables re-use in other calls table, can use like: options = { :column_widths => [100, 200, 360] } table_style = proc.new { ... } table(data1, options, &table_style) table(data2, options, &table_style)

Java (ArrayList check with object's int) -

i have make arraylist contains object, object has 1 int year lets 1 , don't object same year 1. if 1 object has int = 1 , dont want object int(1) in list. want deny it. should try using equal? something @override public boolean equals(object o){ object object = (object)o; return this.getint.equals(object.getint()); } either use set ...which explicitly disallows duplicates, or check if list contains element on insertion. @override public boolean add(t element) { if(contains(element)) { return false; } else { return super.add(element); } } overriding equals wouldn't far, you'd overriding list (i.e. you'd checking if 2 lists equal).

osx - Firefox MAC v30 with proxy needs authenticate"Cache Access Denied" -

firefox working before we've updated version 30.0. seems new version not our proxy setting needs users auth ad accounts. in past version, firefox pop-up box allow type in username , password, works perfect. however, not pop-up anymore , gives me error message. the following error encountered: cache access denied. sorry, not allowed request: http://www.google.com.au/url ? cache until have authenticated yourself. i try manually set username in key chain , allow firefox access firefox seems not access key chain @ all. is have issue proxy needs authenticate in firefox30.0? know possible solutions? many thanks! shuopan trouble shoot update----------------------------------------- quite interestingly, firefox work 1 minute after using safari auth proxy. however, if not touching safari 1 or 2 minutes, firefox stop working , pop similar error message. tried network.http.use-cache = false not work thanks we find philipp's solution helpful. this mig

loopbackjs - How to integrate VoltDB with Strongloop -

i trying use voltdb loopback in application. cannot find proper way integrate since there aren't suppported connectors. voltdb has nodejs library ( https://github.com/voltdb/voltdb-client-nodejs ). suggestios use effectively. raymond has answered here. https://groups.google.com/forum/#!topic/loopbackjs/cs6ist-c2gu we don’t have built-in support voltdb. supports sql crud operations. node.js driver seems allow stored procedures. there few options integrate loopback. write custom methods model , call driver directly interact voltdb. develop connector voltdb implements crud mappings. can find source code mysql, postgresql, mssql, or oracle. see https://github.com/strongloop/loopback-connector-mysql/blob/master/lib/mysql.js .

hadoop - R Reducer is not working properly in Amazon EMR -

i have done map reduce code in r run in amazon emr. my input file format: url1 word1 word2 word3 url2 word4 word2 word3 url3 word1 word7 word2 i'm expecting output as: urls concat spaces word1 url1 url3 word2 url1 url2 url3 word3 url1 url2 .. ... .. but emr using 3 reducers , creating 3 output files. file wise output correct, combining values, no duplicate keys. if see 3 files together, there duplicate keys. output file 1: word1 url1 url3 word2 url1 .. .. output file 2: word2 url2 url3 word3 url1 .. .. see, word2 distributed 2 files. need 1 key in 1 file. i'm using, hadoop streaming in emr. please suggest me correct settings remove duplicate keys in different files. i assume mapper working fine. reducer: process <- function(mat){ rows = nrow(mat) cols = ncol(mat) for(i in 1:rows) { for(j in i+1:rows) { if(j<=rows) { if(tostring(mat[i,1])==tostring(mat[j,1])) { x<-paste(mat[i,2],ma

java - Calling custom method of a class compiled at runtime -

i have java source code compiled @ runtime. i'm compiling source code (present string) , loading class below : javacompiler compiler = toolprovider.getsystemjavacompiler(); compiler.run(null, null, null, sourcefile.getpath()); // load , instantiate compiled class. urlclassloader classloader = urlclassloader.newinstance(new url[] { root.touri().tourl() }); class<?> cls = class.forname("takeadvantageoftmapcomponents", true, classloader); this class contains method need call named runjob . i'd like: takeadvantageoftmapcomponents c = new takeadvantageoftmapcomponents(); c.runjob(new string[]); now same method present in class compile @ runtime. how call ? better using reflection call method want, might want declare interface class extend, such as: package ccjmne; public interface jobrunner { public void runjob(final string[] args); } ... , make class implement interface : file: /home/eric/stacko

logging - how to change log4cplus log file to utf8 -

i have been handed code uses log4cplus logger application. how can generate utf8 logging file it?. logfile being created log4cplus in ascii format @ moment. i have tried follow setting file encoding of log file following instructions @ change file encoding utf-8 via vim in script vi datalog.txt :set bomb :set fileencoding=utf-8 :wq i have tried changing .properties file log4cplus.logger.dl=trace,data log4cplus.appender.data=log4cplus::rollingfileappender log4cplus.appender.data.locale=en-us log4cplus.appender.data.file=/usr/vm/log/data/datalog.txt log4cplus.appender.data.maxfilesize=5000kb log4cplus.appender.data.maxbackupindex=5 log4cplus.appender.data.layout=log4cplus::patternlayout log4cplus.appender.data.layout.conversionpattern=%d{%d/%b/%y %h:%m:%s.%q} %-9c %-5p %m%n i not sure on exact version of log4cplus locate resulted in following /usr/lib/liblog4cplus-1.0.so.4 /usr/lib/liblog4cplus-1.0.so.4.0.0 /usr/lib/liblog4cplus-1.0.so.4.0.0_load /usr/lib/liblog4cplus.

php - How to pass out of scope variables to anonymous function -

i new in php. i want create function link this. public static function cat_post($category, $limit, $top) { $posts = post::wherehas('categories', function($q) { $q->where('name', 'like', $name); $q->where('top', 'like', $top); })->take($limit)->get(); } but got undefined variable "name" please me. how create function.... use below: public static function cat_post($category, $limit, $top) { $posts = post::wherehas('categories', function($q) use ($name, $top) { $q->where('name', 'like', $name); $q->where('top', 'like', $top); })->take($limit)->get(); } have here

jquery - Passing Object in javascript function - Object is undefined -

i passing object function getting `"obj undefined error". have referred http://jsfiddle.net/f6fxb/2/ html: <div class="panel accordion clearfix" id="dispdir"> <script type="text/javascript"> window.onload = function () { showfolders([{ "foldername": "eod-balance-summary", "objects": [{ "keyname": "eod-balance-formatted-2014-06-01.csv", "keyvalue": "eod-balance-summary/eod-balance-formatted-2014-06-01.csv" }], "childdirs": [] }, { "foldername": "reconciliation-activity-summary", "objects": [{ "keyname": "recon-summary-2014-04-01-2014-04-02.csv", "keyvalue": "reconciliation-acti

html - javascript and css popup fade out annimation -

i making popup message when set style.display = "block"; (by pressing button), fade invisible. have button on popup hides popup setting style.display = "none"; how can make fade out? here css #note { position: absolute; z-index: 101; top: 0; left: 0; right: 0; background: #fde073; text-align: center; line-height: 2.5; overflow: hidden; -webkit-box-shadow: 0 0 5px black; -moz-box-shadow: 0 0 5px black; box-shadow: 0 0 5px black; } @-webkit-keyframes slidedown { 0%, 100% { -webkit-transform: translatey(-50px); } 10%, 90% { -webkit-transform: translatey(0px); } } @-moz-keyframes slidedown { 0%, 100% { -moz-transform: translatey(-50px); } 10%, 90% { -moz-transform: translatey(0px); } } .cssanimations.csstransforms #note { -webkit-transform: translatey(-50px); -webkit-animation: slidedown 2.5s 1.0s 1 ease forwards; -moz-transform: translatey(-50px); -moz-animation:

java - How to create a custom domain specific assert/matcher in spock or hamcrest -

i trying write custom domain related assert/matcher in spock or hamcrest, not sure how proceed. i tried writing custom matcher in hamcrest far has led me partial solution. i looking guidance proper course in scenario be. domain objects: resultmap has object map < iline, iresult > - there 1 inoderesult associated each iline. iresult has 4 (google guava) multimap objects need verified. what in spock test like: expect: actualresultmap, matchesinanyorder(expectedresultmap) or actualresultmap, matches(expectedresultmap) // match if in same order. the internal code evaluate each entry , appropriate tests on inner objects well. so far managed write part of code evaluates 1 set of multimap, not sure how chain tests. custom matcher: package com.ps.de.test.custommatcher import org.hamcrest.basematcher class multimapmatcher { /** * checks entries in multimap * @param expected * @return shows failure if entries not match or not in same o

multithreading - Thread interrupt() not interrupting the thread in java (UDP Socket) -

this question has been asked before here.i tried figure out problem learning them still can't find solution it.i posting minimal code interrupt problem.i missing silly guys might able with. import java.io.ioexception; import java.net.datagrampacket; import java.net.inetaddress; import java.net.multicastsocket; import java.net.unknownhostexception; public class optitrack implements runnable { private multicastsocket s; public optitrack(multicastsocket socket) { // socket acquired parent this.s = socket; } public void start_track() { inetaddress group; try { group = inetaddress.getbyname("xx.xx.xx.xx"); s = new multicastsocket(1511); s.joingroup(group); } catch (unknownhostexception e1) { // todo auto-generated catch block e1.printstacktrace(); } catch (ioexception e1) { // todo auto-generated catch block e1.printstacktrace(); } system.out.println("have joined multicast gro

c# - Getting exception while saving a .pptx file -

Image
i have presentation object follows, using presentation = microsoft.office.interop.powerpoint.presentation; presentation pptpresentation = pptapplication.presentations.add(msotristate.msofalse); after processing, @ time of saving, pptpresentation.saveas(@"c:\temp\myppt.pptx", microsoft.office.interop.powerpoint.ppsaveasfiletype.ppsaveasdefault, msotristate.msotrue); it's throwing exception. i appreciate this, it's got me stumped. environment details:- windows 2008 server(x64), .net 3.5, iis7 finally got magical solution. i created 2 folders in windows 2008 server c:\windows\syswow64\config\systemprofile\desktop , c:\windows\system32\config\systemprofile\desktop and after applying read permission folders, ppt getting save in local directory of server. source

c# - Replace specific capture group values if its value equals zero -

is possible replace specific capture group values value if value equals 0 (zero) in c#? match match = regex.match(input, "\b([1-9])([0-9])([0-9]).([0-9])([0-9])([0-9])\b"); if (match.success) { if(match.groups[5].value == "0" || match.groups[6].value == "0") { } } basically have input mhz frequency, accepts values form 100.000-199.999. want if last 2 digits zeros, want remove them. example, if input 197.900, want replace 197.9. if it's 197.990 => 197.99. if 197.090 => 197.09...so on forth. additionally, after removing digits, want rewrite string xxx point xxx... regex.replace(input, "\b([1-9])([0-9])([0-9]).([0-9])([0-9])([0-9])\b", "$1 $2 $3 point $4 $5 $6"); i'm not sure how go doing this. to truncate zeroes: string text = "frequencies 193.200 , 194.220 mhz. 3 digits used: 195.123"; string output = regex.replace(text, @"\b[1-9]\d{2}\.\d{3}\b", m => m.value.trim

PHP, generate string with format, check against SQL db? -

i'm trying use php way process in webpage, typical language java unfamiliar how done product keys. this process: 1. generate random string format xx-xxxx-xxxx-xxx mix of numbers , letters. 2. check if exists in sql database 3. if exists, generate 1 , repeat? so how using php? please explain need , best way of going it. generate random string following function. <?php function randomstring() { $alphabet = "abcdefghijklmnopqrstuwxyzabcdefghijklmnopqrstuwxyz0123456789"; $pass = array(); //remember declare $pass array $alphalength = strlen($alphabet) - 1; //put length -1 in cache $array_lengths = array(2,4,4,3); foreach($array_lengths $v){ ($i = 0; $i < $v; $i++) { $n = rand(0, $alphalength); $pass[] = $alphabet[$n]; } $pass[] = '-'; } return rtrim(implode($pass),'-'); //turn array string } echo randomstring(); ?> sql please create unique key field , use on dupli

iphone - Unique Identifier Changing on 64 bit iOS Device -

reviewed lots of questions there number of questions same topic not find same issue posting. issue looking generate unique identifier ios device if user install app , reinstall generate same identifier. resolved not working 64 bit devices i used code fetching unique identifier ios device , works fine when run on 64 bit ios device gives different result on every install. please review if know possible solution. - (nsstring *)getuuid { @try { uidevice *device = [uidevice currentdevice]; return [[device identifierforvendor]uuidstring]; } @catch (nsexception *exception) { return @"00000-00000-0000-00000"; } } the identifierforvendor stay same long app same developer(vendor) installed on device. thus if user uninstalls app , there no other app on user device identifierforvendor different when user re-installs app. apple has made clear don't want developers track devices or installs per device. can no lo

How to add another table and insert values in existing SQLite Database in Android? -

i want add table in existing sqlite database android application. have created 1 table "dailytips" , want add table "healthytips". have tried different ways didn't succeed , done google search every code different mine. please 1 me in this. here code: package com.example.health; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.database.sqlite.sqlitedatabase.cursorfactory; public class sqliteadapter { public static final int database_version = 2; public static final string database_name = "healthdb"; public static final string table_daily = "dailytips"; public static final string column_id = "_id"; public static final string column_tips = "tips"; public static final string table_health="healthytips"; public static final strin

firefox - Change temporary file location in python webdriver -

i execute selenium tests on ff16, selenium 2.33, python on linux. have created separate firefox profiles corresponding devices. i observed directory 'webdriver-py-profilecopy' created in tmp directory. , see directory deleted after completion of tests. these directories not cleared. size of directory around 28mb. want change tmp directory location. there way change temp file location? in java webdriver provides way define our own temp directory. there way in python webdriver temporaryfilesystem.settemporarydirectory i used tempdir = tempfile.mkdtemp(suffix='foo',prefix='bar',dir=mytemp) , worked. thanks

android - How to find available bluetooth devices in range? -

i trying find available bluetooth devices in range. getting 1 device using in thread in run method. checked many links problem on not resolve issue. here code public void run() { if(service != null) { intentfilter filter = new intentfilter(bluetoothdevice.action_found); filter.addaction(bluetoothadapter.action_discovery_finished); service.registerreceiver(this.breceiver, filter); bluetooth.startdiscovery(); } } class bluetoothreceiver extends broadcastreceiver { public void onreceive(context context, intent intent) { set<bluetoothdevice> paireddevices = bluetooth.getbondeddevices(); string action = intent.getaction(); if (paireddevices.size() > 0) { (bluetoothdevice device : paireddevices) { int rssi = intent.getshortextra(bluetoothdevice.extra_rssi,short.min_value); log.d(tag, device.getname()); } } if(bluetoothdevice.action_found.equals(action)) { bluetoothdevice device = intent

javascript - Jquery ajax 'patch' doesn't seem to be sending data -

i have following javascript code... function editshipment(){ var method = "patch"; var serializeddata = $form.serialize(); $.ajax({ type: "patch", url: routing.generate('api_1_shipment_patch_shipment', {api_key: api_key, id:$('#caddress-shipmentid').val()}, true), data: serializeddata, success: newshipmentsuccess, error: newshipmenterror }); } when run code chrome developer tools "network" tab shows patch method data being sent correct url. however application never receives data. is possible network tab somehow wrong , browser isn't sending data. i'm using latest jquery , receiving application symfony2 web app. thanks in advance, m edit: worth noting have test case passing patch method within symfony codebase. thats why i'm looking @ javascript culprit.

javascript - How to write value of a checkbox to a span when checked? -

using knockoutjs, when either 1 of checkboxes checked, want output value <span> text, so -webkit-transition: <span data-bind="text: menueffect"></span> 0.2s ease-in-out; -moz-transition: <span data-bind="text: menueffect"></span> 0.2s ease-in-out; transition: <span data-bind="text: menueffect"></span> 0.2s ease-in-out; my checkboxes: <div> <input type="checkbox" value="max-height" data-bind="checked: menueffect" />slide in/out </div> <div> <input type="checkbox" value="opacity" data-bind="checked: menueffect" />fade in/out </div> i'm trying output value of checkboxes in span tag, cant quite work? my viewmodel: self.menueffect: ko.observablearray(["max-height", "opacity"]); any ideas helpful ? i think trying achieve: jsfiddle.net/7zc4v/3 the thing different cha

java - Jboss AS 7 Maximum number of threads (64) created for connector with address /0.0.0.0 and port 8009 -

i experiencing issue jboss 7.1.1. scenario is, have apache httpd server in front, connected jboss using ajp running spring application. error: maximum number of threads (64) created connector address /0.0.0.0 , port 8009 i have changed configuration include max-connections flag in ajp connector: <connector name="ajp" protocol="ajp/1.3" scheme="http" socket-binding="ajp" max-connections="1000"/> this, unfortunately hasn't fixed issue. can point me in right direction regarding issue? i think looking maxthreads instead? maxthreads the maximum number of request processing threads created connector, therefore determines maximum number of simultaneous requests can handled. if not specified, attribute set 200. http://tomcat.apache.org/tomcat-5.5-doc/config/ajp.html

c# - Remote WMI query slow -

i'm working on program queries 3 different servers in order cpu , logicaldisk information. each server query returns me values in 6 15 seconds (depending on server). takes total of 31 seconds values (15 sec first server, 6 second , 10 third). i tried multi thread each query, reduced execution time of 1 second each server, don't think it's solution. i tried run queries directly powershell in servers: first server : took 10 seconds (instead of 15) retrieve informations second server : took 10 seconds (like when remotely) retrieve informations third server ) took ~1 second (instead of 6) here queries: select loadpercentage win32_processor select size, freespace win32_logicaldisk my question is: there on servers make queries easier ? tried desactivate firewall , antivirus. ps: i'm querying windows 2003 r2 server, win xp pro , win 7 server, each in same domain local computer. perhaps might speed whole thing using cim instead of wmi. here c

javascript - How to get element in Leap Motion frame? -

this how i'm trying specific element frame of leap motion device though websocket. var websocket = require('ws'); ws = new websocket('ws://127.0.0.1:6437'); ws.on('message', function(data, flags) { var frame = json.parse(data); var id = frame.hands; var pos = id[0]; console.log(pos); }); the json object looks : leap motion sample frame i'm getting error. sanjeet-suhags-macbook-pro:leapjs sanjeetsuhag$ node index.js /users/sanjeetsuhag/developer/node/leapjs/index.js:7 var pos = id[0]; ^ typeerror: cannot read property '0' of undefined @ websocket.<anonymous> (/users/sanjeetsuhag/developer/node/leapjs/index.js:7:14) @ websocket.emit (events.js:98:17) @ receiver.self._receiver.ontext (/users/sanjeetsuhag/developer/node/leapjs/node_modules/ws/lib/websocket.js:697:10) @ receiver.opcodes.1.finish (/users/sanjeetsuhag/developer/node/leapjs/node_modules/ws/lib/receiver.js:397:14)

jquery - Simple javascript if statement but can't find where is wrong -

simple if can't find problem. why form return alert if values correct? if ( (($("#tip1").val()) > (value + tolerance)) || (($("#tip1").val()) < (value + tolerance)) || (($("#tip2").val()) < (value + tolerance)) || (($("#tip2").val() ) > (value + tolerance)) ){ alert('stop'); } if values correct or not correct return alert time; updated answer based on comments , updated question: based on names "value" , "tolerance" , comments below, think problem in need value - tolerance when doing < checks. e.g.: var tip1value = $("#tip1").val(); var tip2value = $("#tip2").val(); if ( tip1value > (value + tolerance) || tip1value < (value - tolerance) || // <== - not + tip2value < (value - tolerance) || // <== - not + tip2value > (value + tolerance) ){ alert('stop'); } so instance, suppose

javascript - Style dynamic content for printing -

Image
i have app @ 1 point creates contracts. the problem my content dynamic , , contract official formatting maters lot,. furthermore i have footnotes , again dynamic depending on content. here example: this image ready formatted in word. so right i'm using jquery plugin named columnizer still not ok, if give fix height content, either footnotes fail or content brake when shouldn't. any idea how make somehow dynamic? you might want try converting word document format such html (word2cleanhtml.com or something) , format html way want (or convert pdf using wkhtmltopdf or princexml).

c++ generic programming with templates and nullptr -

let's have generic function: template<typename t> void foo(t data) { if(data == nullptr) return; //... } the problem can not write that. if t primitive type or object passed value, can not compare nullptr. on other hand, if t pointer int? able compare nullptr. is there way? as @j_random_hacker suggested, overload foo() function. way have 2 differents behaviour depending of type pass foo() template<typename t> void foo(t *data) { if(data == nullptr) return; //... } template<typename t> void foo(t data) { //... }

embedded linux - How to set USB serial as debug port / console? -

i'm working on imx23 cpu linux-2.6.35.3 , wondering if possible implement. can build g_serial , g_multi , use serial port function, uses /dev/ttygs0. have change [console=ttys0] [console=ttygs0] on kernel command line? thanks yes, should simple. change kernel command line "console=ttygs0,115200" or similar. you'll find works usb ports ie "console=ttyusb0" example.

c# - WebService to return data in a certain format -

i trying replicate webservice provided company trying use testing environment. the original webservice returns data like: <?xml version="1.0" encoding="utf-8"?> <arrayofdoaccountmasters xmlns="http://tempuri.org/"> <doaccountmasters> <masternum>int</masternum> <mastername>string</mastername> <errorcode>int</errorcode> <errordescription>string</errordescription> </doaccountmasters> <doaccountmasters> <masternum>int</masternum> <mastername>string</mastername> <errorcode>int</errorcode> <errordescription>string</errordescription> </doaccountmasters> </arrayofdoaccountmasters> at moment have following function: <webmethod(description:="returns array 5 ids < x", enablesession:=true)> _ public function getcustomerids(id string) list(of string) dim outpu

spring - explanation about SqlSessionFactory -

i'm new in mybatis , spring. i'm trying understand puzzle between these frameworks. i haven't found real documentation on sqlsessionfactory. my question is: sqlsessionfactory , within flow between db , logic @ point it? thank you. the primary java interface working mybatis sqlsession. through interface can execute commands, mappers , manage transactions. sqlsessions created sqlsessionfactory instance. sqlsessionfactory contains methods creating instances of sqlsessions different ways. sqlsessionfactory created sqlsessionfactorybuilder can create sqlsessonfactory xml, annotations or hand coded java configuration. you can check documentation more info sqlsessionfactory sqlsessionfactorybean check these 2 links explain spring-mybatis integration. spring&mybatis spring&mybatis2 the db-logic connection takes place in mybatis xml files. sqlmapper

javascript - Highlight all characters that are not in regular expression -

i need write function in javascript - angularjs gets string , highlights characters not in [ a-za-z0-9_\-\(\)\+#!@$%,."<>^=\\] . how find characters not regular expression? (pay attention string comes users convert html may not good.) you can use str.split(/([ a-za-z0-9_\-\(\)\+#!@$%,."<>^=\\]+)/) should return array every second entry being correct parts, , odd parts being incorrect parts. see http://blog.getify.com/to-capture-or-not/#stumble

sql - Varchar to Int Conversion Error In Cursor Example -

first time trying cursor getting error varchar data type only. error "conversion failed when converting varchar value 'sgs' data type int" in table stationid int , station varchar. i have written code show able print int, when try varchar unable print. declare @vstationid int, @vstation varchar(50) declare mycursor cursor select stationid, station tblstation stationid='2' open mycursor fetch next mycursor @vstationid,@vstation print @vstationid+' '+convert(varchar,@vstation) close mycursor deallocate mycursor please tell me error in code? try this declare @vstationid int, @vstation varchar(50) declare mycursor cursor select stationid, station tblstation stationid='2' open mycursor fetch next mycursor @vstationid,@vstation print convert(varchar,@vstationid)+' '+@vstation close mycursor deallocate mycursor

Spring messages are not getting logged using log4j? -

i using log4j in spring mvc web application. log messages other frameworks hibernate getting logged not spring etc. below log4j.properties. log4j.rootlogger = info, file log4j.appender.file=org.apache.log4j.rollingfileappender log4j.appender.file.file=e\:\\logs\\pe.log log4j.appender.file.maxfilesize=10240kb log4j.appender.file.maxbackupindex=10 log4j.appender.file.threshold=debug log4j.appender.file.layout=org.apache.log4j.patternlayout log4j.appender.file.layout.conversionpattern=%-7p %d [%t] %c %x - %m%n log4j.logger.org.springframework=info log4j.logger.org.springframework.rules.values=info log4j.logger.org.springframework.context.support=info log4j.logger.org.springframework.transaction=info log4j.logger.org.springframework.aop.interceptor=info log4j.logger.org.springframework.security=info log4j.logger.org.springframework.security.event.authentication.loggerlistener=info

java - jvm throwing NoSuchElementException when using Scanner -

i'm facing problem don't understand. designed program read info files , generate reports it. at first time, open files need: clientesarq = new file(args[1]); fornecedoresarq = new file(args[3]); produtosarq = new file(args[5]); then use java.util.scanner loop through them: leitor = new scanner(clientesarq); leitor.nextline(); /* leitura e armazenamento dos clientes em mapa */ while(leitor.hasnextline()) { cliente c = pd.novocliente(leitor); clientes.addcliente(c); } leitor = new scanner(fornecedoresarq); leitor.nextline(); /* leitura e arazenaento dos fornecedores em mapa */ while(leitor.hasnextline()) { fornecedor f = pd.novofornecedor(leitor); fornecedores.addfornecedor(f); } when program reaches part of code, jvm throws me nosuchelementexception. leitor = new scanner(produtosarq); leitor.nextline(); /* exception here */ /* leitura e armazenamento dos produtos em mapa */ while(leitor.hasn

twilio - STOP for a single campaign -

i not understand how handle stop messages if have 1 campaign. should respond "... text 1" when receive stop or can opt out user without asking them send '1'? edit: i trying implement message handling sms short code compliant carrier requirements. https://www.twilio.com/help/faq/short-codes . basically, compliant requirements, have handle specific sms messages receive, in particular, stop message should opt out number sent "campaign". "campaign" intuitively series of sms messages sent users. here twilio entry explains stop messages. i not understand whether have ask user text me 1 page suggests if have no other choices. can handle stop stopall ? here response received twilio support, in case else wants ask "non programming related" question: "if have 1 campaign, can opt them out same way stopall ."

html5 - CSS 3 selector for parent tag? -

this question has answer here: is there css parent selector? 25 answers on <a> :hover, need apply styles on div parent tag of <a> . please note don't want use jquery/ java script, rather need using css/ css3. jsfiddler: http://jsfiddle.net/yawer/2p6fl/ here code: a:hover{ background-color:gray; a:hover:parent{ border:none !important; } html: <div style="width:200px; height:200px;border:solid 1px;"> <span style="width:180px; height:180px;border:double 1px red;"> <a style="border:dashed 1px green;" href="#">it test link</a> </span> </div> <br> <br> <div style="width:200px; height:200px;border:solid 1px;"> <a style="border:dashed 1px green;" href="#">it test link</a> &

problems in installing mylyn mantis connector to eclipse luna -

i having problems on installing mantis-mylyn connector eclipse luna. getting following error. missing requirement: mylyn mantis connector core 3.10.0.201311082300 (com.itsolut.mantis.core 3.10.0.201311082300) requires 'bundle org.eclipse.mylyn.commons.soap [3.7.0,4.0.0)' not found in previous versions of eclipse (kepler ...) plugin working without problems. don't want return kepler, because luna better. in kepler, had problem of freezing of editors, slowing me down. mylyn removed soap bundle update site, see eclipse bug#421379: remove soap transport mylyn . until official update out, suggest following: add following update site eclipse: http://archive.eclipse.org/mylyn/drops/3.10.0/v20131025-2037 , without installing it try install mantisbt connector again, , make sure enable 'contact update sites during install find required software'

c# - Checking if a certain value is in a subkey, then do something -

here trying read currentuser\software\microsoft\visualstudio\12.0 folder. in there subkey called "upgradecheckscheduledtimestamp". if has value of true, want something. seen many examples, showing if value empty or not. want specific value. here have been fiddling around far registrykey regkey = registry.currentuser.opensubkey("software\\microsoft\\visualstudio\\12.0, upgradecheckscheduledtimestamp"); if (regkey != null) { regkey.getvalue("upgradecheckscheduledtimestamp"); } console.writeline(regkey); you there. remove "upgradecheckscheduledtimestamp" first line of code. then have either assign value inside if statement variable, or write console when value. if subkey not found, it'll write empty line. registrykey regkey = registry.currentuser.opensubkey("software\\microsoft\\visualstudio\\12.0"); if (regkey != null) { console.writeline(regkey.getvalue("upgradecheckscheduledtimestamp"

java - EclipseLink SQLServerException when returning stored procedure without result set -

i using eclipselink 2.4.2 call stored procedure in sql server database. stored procedure legacy code have no insight. storedprocedurecall call = new storedprocedurecall(); call.setprocedurename("p_get_sales"); call.addnamedargument("p_part", "part") call.addnamedargument("p_product_nr", "productnr") call.addnamedargument("p_lang", "lang") datareadquery query = new datareadquery(call); query.addargument("part") query.addargument("productnr") query.addargument("lang"); jpaentitymanager jpaem = em.unwrap(jpaentitymanager.class); list<arrayrecord> records = (list<arrayrecord>) jpaem.getactivesession().executequery(query, arrays.aslist(part, productnr, lang)); all fine if data available result set returned procedure. there not exist data in database returned. in case following exception: exception [eclipselink-4002] (eclipse persistence services - 2.4.2.v20130514-59564

php - ValidFormBuilder outputs strange javascript code -

i'm trying small proof of concept working validformbuilder. created form text area. simple, html validformbuilder generates not valid. there's javascript-code @ strange places, looks rubbish , there's lot of duplicate code in generated html. can tell me i'm doing wrong? you can see strange behavior on here: http://zorginformatiegroep.nl/form/test.php this code: <?php require_once 'vendor/autoload.php'; use validformbuilder\validform; $objform = new validform("hello", "required fields printed in bold.", "/test.php"); $objform->addfield( "message", "your message", validform::vform_text, array( // make field required "required" => true ), array( // error message when required state isn't met "required" => "this required field" ), array( "cols" => 20, "rows" => 10 ) ); //*** generate form output if ($objform