Posts

Showing posts from June, 2015

java - "JNDI name is already in use" in Weblogic 12c with EJB3 -

i have following code i'm trying deploy ejb weblogic 12c, i'm getting error: "error deploying ejb geopoliticalservicebean(application: campaigner-ejb, ejbcomponent: campaigner-service.jar), jndi name java:global/campaigner-ejb/campaigner-service/geopoliticalservicebean!com.dr_dee_sw.campaigner.service.geopoliticalservicelocal in use. must set different jndi name in weblogic-ejb-jar.xml deployment descriptor or corresponding annotation ejb before can deployed." public interface geopoliticalservice { ... } @local public interface geopoliticalservicelocal extends geopoliticalservice { } @remote public interface geopoliticalserviceremote extends geopoliticalservice { } @transactionmanagement(value = transactionmanagementtype.container) @transactionattribute(value = transactionattributetype.required) @stateless public class geopoliticalservicebean implements geopoliticalservicelocal,geopoliticalserviceremote { ... } more information: i've red...

java - What is RIWO (Read Indirectly Write Out) state -

i reading static flow control , came across riwo concept. can explain simple terminology , perhaps code sample? this related error "illegal forward reference". relevant link . after going through material , discussing couple of guys offline found out following information. when java class getting executed there few steps jvm performs few steps sequentially. identify static members top bottom. executes static variables assignments , static blocks top bottom. executes main method. during these phases there 1 such state called riwo(read indirectly write only) static variable. during riwo variable cannot accessed directly reference. instead need use indirect way call variables. for example: class riwo { static int = 10; static { system.out.println(i); } } in above case output 10. class riwo { static int = 10; static { m1(); system.out.println("block1"); } public static void main(string... args) { m1(); system....

c# - Issue with reading multiple xml nodes instead of one -

the xml bills have 1 node returned , parsed. have come across issue xml bill had multiple nodes. since code not set handle that, customer ended incorrect bill. this code have goes through bill list. if comes node parses information xml. var response = new list<customerbill>(); try { foreach (getbillforcaresponse ebillresponse in ebillresponselist) { var statementdetailsresponse = getstatementdetails( new getstatementdetailsrequest { batchid = ebillresponse.batchid, customeraccountid = ebillresponse.ca.tostring("000000000"), statementid = ebillresponse.cas_num.tostring("0000") }); string xmlbill = statementdetailsresponse.statementasxml.tostring(); var document = new xmldocument(); document.loadxml(xmlbill); var sadetailedpagenode = xmlbillparser.getdetailpag...

java - update mysql table with hibernate showing error -

in spring project want update mysql table field according url : i have url below: localhost:9191/access/name/article?key=xyz i want fetch article url , update status , article field of corrsponding mysql table in database have table name "user". user(stu_id,name,email,article,status) mysql query is: update user set article='null', status=true article='xyz'; here xyz=user.getarticle() to achieve have done below user.java is: public user(string article, string status) { super(); this.article = article; this.status = status; } userdao.java public interface userdao { public void updateuser(user user); } userdaoimpl.java is: @transactional @repository("userdao") public class userdaoimpl implements userdao { @autowired private sessionfactory sessionfactory; public void updateuser(user user) { string hql = "update user set article = null,status=true" ...

ios - How to jump to any Cell in a UICollectionView by using a custom layout? -

Image
i have 40 cells in horizontal uicollectionview , button. i can jump cell number 5 cell number 10 when click on button. but want go further cell ( example 5 25 ), it doesn't work, , instead goes 0. code: func setvalue(value: int, animated: bool) { self.value = value if let row = find(values, value) { let indexpath = nsindexpath(forrow: row, insection: 0) selectedcell = collectionview.cellforitematindexpath(indexpath) as? steppercell collectionview.scrolltoitematindexpath(indexpath, atscrollposition: .centeredhorizontally, animated: animated) } } override func preparelayout() { let start = int(collectionview!.bounds.size.width * 0.5) - statics.width / 2 let length = collectionview!.numberofitemsinsection(0) if cache.isempty && length > 0 { item in 0..<length { let indexpath = nsindexpath(foritem: item, insection: 0) let attributes = uicollectionviewlayoutattributes(forcellwithindexpath: indexpath) attributes.fram...

How can I migrate from a Microsoft Symbol Server to Google Breakpad? -

our product generates minidump files in case goes wrong. run symbol server storing , accessing debug symbols of our builds such proper stack traces out of dump files. since our product runs on other operating systems (in particular linux , os x), started @ google breakpad . appears use minidumps, , pdb files storage. however, wonder: (how) can migrate existing symbol server google breakpad don't lose existing symbols? imagine other people did same move already, maybe there's common approach this? you have few options: run dump_syms (this tool processed pdbs text-based breakpad's .sym format, comes breakpad) on pdbs in server , upload them breakpad server (there couple options, use socorro). need keep running on new symbols builds care about. request symbols server needed stack_walker when processing incoming crash (we haven't done that) periodically missing symbols in last number of crashes, see if on symbol server, run them through dump_syms, up...

constructor - OCaml - creating custom types of custom types -

if have data types identification , person, how use them? type identification = name of string | ss of int * int;; type person = personal_info of identification;; how make person type has identification? how construct variable these types in it..? something this: person1 = personal_info (name = "cody") (ss = (231,4534));; val person1 : person = ..... your identification type specifies either name or social security number. looks me want have both of them. should use record type: type ident = { name: string; ss: int * int } since person type has 1 variant, redundant (not couldn't useful in cases). here value of type ident : { name = "cody"; ss = (231, 4534) } if want use person type, this: type person = pi of ident a value of type this: pi { name = "cody"; ss = (231, 4534) }

python - Can I filter users to require a matching entry on every date in a given range? -

Image
is possible filter queryset in such way retrieve users don't have matching object every date in range? for example, have shift model includes foreignkey field pointing employee object , date_requested datefield indicating date of shift. i've created following query grabbing user doesn't have shift between, say, 2015-07-19 , 2015-07-25 : employee.objects.all().exclude( shift__date_requested__gte=datetime.date(2015, 7, 19), shift__date_requested__lte=datetime.date(2015, 7, 25)) unfortunately queryset doesn't catch user has specified shifts 07/19 through 07/24, not 1 07/25. possible further refine query say, "the number of shifts associated user between 2015-07-19 , 2015-07-25 (inclusive) must equal number of days within time frame? edit: here's code ran according 1 of answers below: first, dataset showing employee #10 has shift on every day between 7/19 7/25. should lead them being filtered out: and filtering code e = employe...

windows - Make Jenkins invisible to remote users -

i have jenkins server on local windows device, want make invisible outside world (office rules regarding servers). obvious , unsubtle way, works satisfactorily, set firewall rule block incoming access port, feel there must jenkins setting stop advertising services localhost. can tell me if there is? note setting user credentials not valid solution, server being visible inaccessible without login still violates office rules. from starting , accessing jenkins need --httplistenaddress=127.0.0.1 command line parameter: --httplistenaddress=$http_host - binds jenkins ip address represented $http_host. default 0.0.0.0 — i.e. listening on available interfaces. example, listen requests localhost, use: --httplistenaddress=127.0.0.1 if run jenkins windows service, can extend command line arguments in jenkins.xml file in jenkins home directory. similar answer (for linux-oriented platforms) on serverfault.

Node.js request return Error: connect ECONNREFUSED when set options parameter -

request works fine if send url required attributes first parameter failed each time when trying send options object parameter contains request attributes: "use strict" var https = require('https'), request = require('request'); var obj = { translate: function(texttotranslate) { var options = { url: "https://translate.yandex.net/api/v1.5/tr.json/translate", qs: { key: process.env.translation_app_token, lang: "en-ru", text: texttotranslate } }, translationrequest = https.request(options, function(response) { response.on('data', function (chunk) { console.log(json.parse(chunk).text[0]); }); }); console.log(options); translationrequest.on('error', function (response) { console.log(response); }); translationrequest.end(); ...

php - RedisException when installing SilverStripe -

i've installed silverstripe using composer when try , access site get: fatal error: uncaught exception 'redisexception' message 'connection closed' in /var/www/silverstripe_test/framework/dev/install/install.php5 on line 31 redisexception: connection closed in /var/www/silverstripe_test/framework/dev/install/install.php5 on line 31 the error seems occur when session_start() called i'm not sure why? it sounds instance of php set use redis sessions. have in php.ini and, if present, change "session.save_handler = redis" "session.save_handler = files". if you're using apache can add "php_value session.save_handler redis" .htaccess.

Is there whoami analog for Docker? -

it useful me user logged in previous docker login . didn't find in docker help maybe there's don't know. is there whoami in docker command line client? example, docker whoami . maybe there's not official utility? check out dockercfg file, located @ ~/.dockercfg , should contain login information , authentication tokens (while logged in).

algorithm - How to find best fit of convex polygon into other convex polygon -

i'm looking algorithm calculate translation, rotation , scaling required position convex polygon (p1) inside convex polygon (p2). need return "best fit", meaning p1 contained within p2 , has maximum area possible. consider following diagram: http://i.imgur.com/ckaiiv7.png the black polygon on right (p1) needs placed optimally inside blue polygon on left (p2). i have found lots of written papers online polygon containment algorithms algorithms determine whether or not polygons can fit inside polygon given ability translate , rotate them. the algorithm i'm looking should produce result because includes ability scale polygon p1. understand type of algorithm produce multiple optimal answers , that's okay. any help? ok, if nobody has better idea, give not-so-good algorithm. let's have p1 p vertices , p2 q vertices, , want fit p1 inside p2 . you found articles describing how determine whether p1 can fit inside p2. example this artic...

objective c - How can I get all supported screen resolutions on mac OSX Swift -

Image
i want code that 1)grabs current screen resolution, (solved). for example : current screen display code : system_profiler spdisplaysdatatype |grep resolution 2)grabs supported resolution shown in picture below (unsolved). or objective c code useful swift code var displayconfig: cgdisplayconfigref = nil let maindisplayid = cgmaindisplayid() var displaymode = cgdisplaycopydisplaymode(maindisplayid).takeretainedvalue() var width = cgdisplaymodegetwidth(displaymode) var height = cgdisplaymodegetheight(displaymode) print("current size: \(width)x\(height)\n") print("available sizes:\n") var modes = cgdisplaycopyalldisplaymodes(maindisplayid, nil).takeretainedvalue() let modescount = cfarraygetcount(modes) - 1 in 0...modescount { var mode: cgdisplaymoderef = unsafebitcast(cfarraygetvalueatindex(modes, i), cgdisplaymoderef.self) var width = cgdisplaymodegetwidth(mode) var heig...

javascript - Alertify Prompt - Allow user to input values and submit form -

Image
using alertify - version 0.3.11 , able fetch user input details , able show in prompt dialogue. have multiple values viz. user input, dropdown values, date selection, etc var totalresources = jquery('#grid').jqgrid('getgridparam', 'selarrrow'); //set custom button title form submit alertify.set({ labels: { ok : "submit data", cancel : "cancel" } }); //fetch user input comment alertify.prompt("please enter note/remarks form :<br/>total resource(s): <strong>"+totalresources.length+"</strong>", function (e,value) { if (e) { alertify.success("data has been submitted"); //encodes special characters remarks var sow = encodeuricomponent(value); $.post(site_url+"somecontroller/someaction",$("#frm_submit").serialize()+ "&resource_ids="+resource_ids+"&sow="+sow, function...

mysql - How to use the value of a variable as the name of an array in R -

i starting rscript commandargs(true , variable <- args[1] . in variable name of column of mysql database. select column dynamically , query rohdaten <- dbgetquery(con, sql) the result array. want this: rohdaten$xxx[rohdaten$xxx==null]<-na xxx value of variable how can set xxx value of variable? tried many things variations of rohdaten$get(variable) instead of calling rohdaten$xxx try rohdaten[variable] this translate whatever variable is, e.g. rohdaten["columnname"]

javascript - Angular datatables Fixed Columns undefined is not a function -

Image
i used angular datatables fixed column , html code view following: <div class="row" ng-controller="performancectrl"> <table id="example" datatable="" class="stripe row-border order-column" dt-options="dtoptions"> <thead> <tr> <th>first name</th> <th>last name</th> </tr> </thead> <tbody> <tr> <td>tiger</td> <td>nixon</td> </tr> </tbody> </table> and controller code following: 'use strict'; app.controller('performancectrl', ['$scope', 'dtoptionsbuilder', 'dtcolumndefbuilder', function ($scope, dtoptionsbuilder, dtcolumndefbuilder) { $scope.dtoptions = dtoptionsbuilder.newoptions() .withoption('scrolly', ...

Bundler::MarshalError TypeError: incompatible marshal file format + Ruby CAS Server -

i have clone rubycas-server project , followed steps mentioned in documentation. when doing bundle install getting following error: fetching gem metadata http://rubygems.org/....retrying dependency api due error (2/4): bundler::marshalerror typeerror: incompatible marshal file format (can't read) format version 4.8 required; 60.72 given retrying dependency api due error (3/4): bundler::marshalerror typeerror: incompatible marshal file format (can't read) format version 4.8 required; 60.72 given retrying dependency api due error (4/4): bundler::marshalerror typeerror: incompatible marshal file format (can't read) format version 4.8 required; 60.72 given i don't know why message coming , using ruby 1.8.7. step missed or ruby version appropriate running ruby cas server? you can try bundle install --full-index which forces fresh download of index

iphone - Anonymous response during service consumption iOS -

i facing anonymous behavior of service response. sometime service fetched , gives error message "a server specified host name can't found" . using afnetworking . same service worked in android platform. there better way fetch them accurately in iphone. here piece of code: dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_high, 0), ^{ nsdictionary *params = @{@"email" : txtemail.text, @"password" : txtpassword.text, }; afhttprequestoperationmanager *operationmanager = [afhttprequestoperationmanager manager]; operationmanager.requestserializer = [afjsonrequestserializer serializer]; operationmanager.responseserializer = [afjsonresponseserializer serializer]; [operationmanager post:@"http://somelink/someuser.svc/login" parameters:params success:^(afhttpreq...

language agnostic - What is a fast n-dimensional Z-order curve algorithm? -

Image
space filling curves way fill grid line preserves locality - is, 2 close points @ line 2 close points on space. is there fast ( o(1) ) algorithm map between n-dimensional coordinate , index on corresponding n-dimensional space-filling curve? you need map n-d point interleaved binary format, going o(n), if have you're 1d sorted array have binary search o(logm) m number of points; use *hashmap < binary, index > * , change logm binary search lookup constant o(1) lookup.

vim - vimscript detect piped input -

it easy use vimscript determine if filename specified vim using argc() . there way determine if - flag given specify piped input given vim? doesn't count piped input filename , argc() empty. edit thanks wonderful accepted answer below, have way open nerdtree if there no filenames and stndin not being used. let wmuse_nt = 0 autocmd stdinreadpost * let wmuse_nt = 1 autocmd vimenter * if !argc() && wmuse_nt == 0 | nerdtree | endif you use autocmd run before or after vim reads stdin stdinreadpre or stdinreadpost events. copied below. stdinreadpost stdinreadpost after reading stdin buffer, before executing modelines. used when "-" argument used when vim started --. stdinreadpre stdinreadpre before rea...

sql - SSRS Bar chart expot to csv issue -

in bar chart bar-name shown in exported csv seperate column,and every column name contains '_label' in end.any ideas remove/change things? the csv headers derived names of textboxes make cells of grid. make sure change these appropriately. check , update, if needed, 'name' property within properties box.

java - View on New Activity Not Updating On UI Thread -

sadly, code complicated post interstices. however, i'll best give sparse amount of code may contribute problem. so have things running under surface pushing out broadcasts whenever things updated on database (it's interface monitor server (one not connected internet) on android.). have broadcast receivers listening these broadcasts , run runnable on handler whenever broadcast looking for. i'm using fragment activity being called main activity. activity has variable number of fragments have variable number of "widgets". these widgets have own broadcast receivers, listening , responding mentioned above. so, each broadcast registered when view created , unregistered upon deletion, each broadcast receiver contains reference item. the problem using same exact, working logic on main activity not work when open second activity. reason, view not update when request (such textview.settext("blah") display "blah" on main activity, display nothin...

javascript - How to parse iframe on a website with CasperJS -

i want obtain informations on website iframe. when parse website casperjs command : casper.then(function() { casper.waitfor(function() { return this.withframe('mainframe', function() {}); }, function() { this.withframe('mainframe', function() { console.log(this.echo(this.gethtml())); }); }); }); my problem result, have content of 1 iframe only. how can obtain result of iframe present on website? casperjs doesn't provide function wait iframe load. however, can use waitforresource() step function wait iframe resource , act on it. casper.waitforresource(function check(res){ var iframesrc = this.getelementattribute("iframe[name='mainframe']", "src"); return res.url.indexof(iframesrc) > -1; }, function(){ // success }); when resource received, can wait inside of iframe specific selector in order continue script iframe loaded: casper.waitforresource(func...

ruby - gem install bson_ext issues -

i running genghisapp - gem mongo management. when run it gives me warning native bson extension not loaded , suggest run gem install bson_ext . i have installed rbenv , have gems such genghisapp installed in ~/.gem on path , loads fine. my first attempt run gem install bson_ext after restarting mongo/shell had no effect - message still there. i suspected not genghisapp message mongo 1 thought might need install sudo. resulted in breaking rbenv install due permissions being set root/whatever because still using local rbenv gem. what proper way solve this? should find osx gem , call full path install or need specify else? the issue because a) version of mongo , bson_ext must match , b) there must not other bson_ext version installed. the comments on issue helped me solved issue. run: gem list | grep -w 'bson\|bson_ext\|mongo' print out versions. should like: bson (1.9.2) bson_ext (1.9.2) mongo (1.9.2) and not like: bson (2.3.0, 1.10.2, 1.9.2) ...

javascript - ajax request to the server side script (controller) to get the status of the server -

Image
i want server side response button in twig page. example - there 2 button in page --- on/off when page load should check server (check elasticsearch database) whether returns true or false, both button. so instanse on button return "true" should change color green, ---- $(this).addclass('btn-success'); $(this).removeclass('btn-primary'); the main purpose check what's current status, when page load. so not on-click function, because show show status when page loaded. this client side code --- $(document).ready(function(){ //send request empty data server check status $.post('/url/to/action', {}, function(msg){ // return response {status: 'on'} client if search on if (msg.status == 'on'){ $('#my-button').addclass('success'); } // else disabled else $('#my-button').addclass('primary'); }); }); this integration symfony application --- ...

c# - Regex match one digit or two -

if (°[0-5]) matches °4 and ((°[0-5][0-9])) matches °44 why this ((°[0-5])|(°[0-5][0-9])) match °4 not °44? because when use logical or in regex regex engine returns first match when find match first part of regex (here °[0-5] ), , in case since °[0-5] match °4 in °44 returns °4 , doesn't continue match other case (here °[0-5][0-9] ): ((°[0-5])|(°[0-5][0-9])) a|b, , b can arbitrary res, creates regular expression match either or b. arbitrary number of res can separated '|' in way. can used inside groups (see below) well. as target string scanned, res separated '|' tried left right. when 1 pattern matches, branch accepted. means once matches, b not tested further, if produce longer overall match. in other words, '|' operator never greedy. match literal '|', use \|, or enclose inside character class, in [|].

How to get this value on xml file using python? (See the xml code) -

this xml file. settings.xml , inside have... <settings> <setting id="ipkey" value="1252473100" /> </settings> how ipkey value using python? think understandable... you can use following code particular attribute. import xml.etree.elementtree et xml = et.parse('yourfile.xml') root = xml.getroot() value = root.find('./setting').attrib['id']

pascal - Generating Position Set Points for Trapezoidal Motion Profile -

i'm working on prototype motion controller accelerate motor maximum velocity, coast @ maximum velocity , commence deceleration @ correct position motor stop @ target position. the theoretical position each timestep compared feedback quadrature encoder , resulting error subjected pid loop, result of represented using pwm. i have following code determine theoretical position each timestep: pos:=0; vel:=0; acc:=3; demand:=300; max_vel:=19; accdist := (max_vel/acc * max_vel) / 2; decelpoint := demand - accdist; writeln(accdist:5:2); writeln(decelpoint:5:2); writeln('accel'); while vel <> max_vel begin pos := pos + vel + acc/2; vel := vel + acc; if vel >= max_vel begin vel := max_vel; pos := accdist end; writeln('position:',pos:5:2); end; writeln('flat'); while pos < decelpoint begin pos := pos + vel; writeln('position:',pos:5:2); end; error := pos - decelpoint; writeln('decel'); while vel > 0 begin i...

jquery - 415 Unsupported Media Type Cowboy REST Ajax -

i having problem cowboy rest request method post. works fine if post done submitting form content, response when use ajax send post content server. the error response : 415 unsupported media type here code content_types_provided , content_types_accepted content_types_accepted(req, state) -> handler = [ {<<"text/html">>, handle_post_html}, {{<<"application">>,<<"json">>, []}, handle_post_html}, {{<<"text">>, <<"plain">>, []}, handle_post_html}], {handler, req, state}. content_types_provided(req, state)-> handler = [ {<<"text/html">>, parse_html}, {<<"application/json">>, parse_json}, {<<"text/plain">>, parse_plain_text}], {handler, req, state}. any body has idea on case? why separate ? try it: content_types_accepted(req...

android - Unable to get the resource-id when running uiautomator events in an adb shell -

we running uiautomator events in adb shell.it should dump accessibility events not giving resource-id 08-03 12:22:13.520 eventtype: type_view_clicked; eventtime: 185419; packagename: com.nimbuzz; movementgranularity: 0; action: 0 [ classname: android.widget.button; text: [i´m new nimbuzz]; contentdescription: null; itemcount: -1; currentitemindex: -1; isenabled: true; ispassword: false; ischecked: false; isfullscreen: false; scrollable: false; beforetext: null; fromindex: -1; toindex: -1; scrollx: -1; scrolly: -1; maxscrollx: -1; maxscrolly: -1; addedcount: -1; removedcount: -1; parcelabledata: null ]; recordcount: 0removedcount: -1; parcelabledata: null ]; recordcount: 0 i need resource-id property. resource used: android version 4.4 any highly appreciated.

java - Junit test case for a restful client using mockito -

i have no idea before how write test cases, when saw online tutorials understand how write simple method success , failure scenario. have method http calls restful api , returns json response. have 6 parameters include in url , json response back. now, understanding far success scenario here should hard code input parameters , test if getting json , failure not getting json response back. correct or have else? i mean have code like public list getstorelocations(storedata storedata) { list storelist = null; try { httpclient httpclient = httpclientbuilder.create().build(); stringbuilder urlstrngbuildr = new stringbuilder( https://<hostname>/xyz/abc); utility.addparametertourl(urlstrngbuildr, utility.app_name, constants.app_value); utility.addparametertourl(urlstrngbuildr, constants.version_param_name, constants.version_param_value); if (storedata.getcity() != null && storedata.getst...

javascript - Angular js does not get json response from node js -

i trying establish rest connection between node (middleware) , angular (ui). however, json displayed on browser rather being routed via angular controller/html node/express router.js router.get('/members', function(request, response){ response.header("access-control-allow-origin", "*"); response.header("access-control-allow-methods", "get, post"); response.setheader('content-type', 'application/json'); var dbdata = []; var str; db.get('_design/views555/_view/app_walltime', function (err, body) { if (!err) { body.rows.foreach(function(doc) { dbdata.push({name: doc.key, walltime:doc.value}); }); console.log(dbdata); response.json(dbdata); angular controllers.js 'use strict'; var phonecatapp = angular.module('phonecatapp', []); phonecatapp.config(['$httpprovider', function($httpprovider, $routeprovider, $locationprovider) { ...

java - Handling association with JNI -

i have question regarding how correctly handle association (or depedency) in jni. lets assume in shared library have 2 classes, nativeclass1 , nativeclass2 . nativeclass1 has method void foonative(nativeclass2* nativeobj) allows perform operation object of type nativeclass2 . for each of these classes, java class defined wrap corresponding native object ( javaclass1 , javaclass2 , each 1 having long private member pointing dynamically allocated native object of type nativeclass1 and nativeclass2 , respectively). i javaclass1 have method public void foojava(javaclass2 obj) (and corresponding native method private native void call_foonative(long nativeobject1ptr, long nativeobject2ptr) call nativeclass1::void foonative(nativeclass2* nativeobj) after casting pointers). how underlying long pointer (to nativeclass2 ) member javaclass2 in order call void javaclass1::call_foonative(long nativeobject1ptr, long nativeobject2ptr) ( assuming pass pointer of nativeclass1 fi...

sockets - advantage WebSockets over TCP/IP -

we have application connects server , sends position every 15 seconds. our client has asked "upgrade" our current tcp/ip connection websocket. reason heard used less bandwidth , wants diminish 15 seconds 1 second. (not public application battery drain not problem) i have done research , many websockets vs http comparisons 2 or 3 comparisons of websocket vs tcp/ip. i've found out : websockets same tcp/ip tcp/ip works on lower layer websockets. websockets might use less bandwidth because protocol might more efficient our current protocol. websockets use more resources on server side. my question is: worth change our existing code , make use of websockets instead of ol' tcp/ip sockets? as appear know already, websocket built on top of tcp/ip connection. it's specific protocol built on top of tcp. my question is: worth change our existing code , make use of websockets instead of ol' tcp/ip sockets? if code works tcp socket , don...

plone - Why is the ploneCustom.css Stylesheet not loaded? -

i new plone , i'm learning how change stylesheets. changed plonecustom.css in /plone/portal_skins/custom/ , saved it. when tried take @ site, realised plonecustom.css stylesheet isn't loaded. according research template broken... do information? fix , how? thanks in advance! 50 ways of styling plone, 4 of them explained: 1.) customize plonecustom.css a relict of skin-folder-times, recommended use browser-based resources, instead. reason is, when have lot of resources registered, it's hard keep correct order of skin-layers , can lead unwanted overrides. nevertheless, if don't have complex setup, or quick testing, feasible use skin-layers , plonecustom.css, exact steps are: go " http://yourhost.net:8080/yourplonesiteid/portal_skins/sunburst_styles/plonecustom.css/manage_main ". click on "customize". enter style testing, e.g. "body { background: red }", save. make sure, css-debug-mode on @ " http://yourhost.net:80...

javascript - Execute your own JSONP function -

i using jsonp , , url(action) returning me function called processtemplates. there way can execute own function instead of processtemplates. something _processjsoncallback function _processoveridecallback(actionname) { $.ajax({ type: 'get', url: actionname, async: false, contenttype: "application/javascript", jsonpcallback: '_processjsoncallback', datatype: "jsonp", error: function(jqxhr, exception) { if (jqxhr.status === 0) { alert('not connect.\n verify network.'); } else if (jqxhr.status == 404) { alert('requested page not found. [404]'); } else if (jqxhr.status == 500) { alert('internal server error [500].'); } else if (exception === 'parsererror') { ...

regex - Split binary number into groups of zeros and ones -

i have binary number, example 10000111000011 , , want split groups of consecutive 1s , 0s, 1 0000 111 0000 11 . i thought that's great opportunity use look-arounds: regex uses positive look-behind digit (which captures later backreferencing), negative look-ahead same digit (using backreference), should split whenever digit followed digit not same. use strict; use warnings; use feature 'say'; $bin_string = '10000111000011'; @groups = split /(?<=(\d))(?!\g1)/, $bin_string; "@groups"; however, results in 1 1 0000 0 111 1 0000 0 11 1 somehow, captured digit inserted @ every split. did go wrong? here small fix code: my @groups = split /(?<=0(?!0)|1(?!1))/, $bin_string; the problem experience when using split captured texts output in resulting array. so, solution rid of capturing group. since have 0 or 1 in input, pretty easy alternation , lookahead making sure digits changed. see demo

c# - How to speech recognition from video playback? -

i have application can detect speech based on tutorial @ https://www.youtube.com/watch?v=ab9lfhdoe5u in load event of form have following //global variable speechrecognitionengine recengine = new speechrecognitionengine(); private void frmmain_load(object sender, eventargs e) { //hide border prevent screen burnout this.formborderstyle = formborderstyle.none; choices commands = new choices(); commands.add(new string[] { "stock", "news", "percent", "down" }); //need read company list db grammarbuilder gbuilder = new grammarbuilder(); gbuilder.append(commands); grammar grammar = new grammar(gbuilder); recengine.loadgrammarasync(grammar); //this need help----------- recengine.setinputtodefaultaudiodevice(); recengine.speechrecognized += rec...

libgdx - Showing as much of a TiledMap as screen allows -

Image
i have simple 20 x 20 tile world ( tiledmap ) want display using orthogonaltiledmaprenderer . however, i'd show of world screen allow. means if screen bigger, more of world shown , if screen smaller, less of world shown. is possible? the physical size of tiles 16 pixels x 16 pixels. thought creating 16 * 20 x 16 * 20 (320 x 320 unit?) fillviewport trick, show entire world on screen (zooming in or out depending on screen size). instead want zoom stay @ 1 , cut off world wide or tall screen. how can achieve effect? update i tried using screenviewport , ends looking this: . i've tried setting camera's position so: camera.position.set(viewport.getworldwidth() / 2, viewport.getworldheight() / 2, 0); in create method, camera's position 0, 0, 0. here source code using far.

Rails - nested model input data not appearing in "show" page -

i having trouble figuring out how make data collected through nested model appear on "show" page. have rails app 3 models, user model, project model, , team model. model associations follows: project:- class project < activerecord::base has_many :users, :through => :team has_one :team, :dependent => :destroy accepts_nested_attributes_for :team, allow_destroy: true end team:- class team < activerecord::base belongs_to :project has_many :users end user:- class user < activerecord::base # include default devise modules. others available are: # :confirmable, :lockable, :timeoutable , :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable has_and_belongs_to_many :teams end every project has 1 team, , every team consists of many users saved in database. make possible select multiple existing users within project form (through nested form) , save t...

javascript - How to check in jQuery if a Bootstrap tab isn't clicked? -

i have tabs in bootstrap: <ul class="nav nav-tabs" role="tablist"> <li>tab1</li> <li>tab2</li> <li>tab3</li> <li>tab4</li> <li>tab5</li> </ul> <p id="message"></p> how can make when no tab clicked message 'please select tab' shown? i have made <p id="message"></p> underneath tabs, need insert message when no tab clicked , remove message when tab clicked i'm not sure how check. for bootstrap tabs need content containers. in case put message div tab-content div: <!-- tab panes --> <div class="tab-content"> <div role="tabpanel" class="tab-pane" id="home">...</div> <div role="tabpanel" class="tab-pane" id="profile">...</div> <div role="tabpanel" class="tab-pane" id="m...

java - Scanner skipping over user input -

i trying chess game , @ point user inputs number relating piece want move. had simplified version of code below earlier, decided put 'try' , 'catch' statement catch inputmismatchexception. code: int inputexception = 0; { inputexception = 0; try { system.out.println("what piece move?"); pieceselectioninput = scan.nextint(); } catch ( inputmismatchexception e ){ inputexception = 1; } } while ( inputexception == 1 ); so once run program, if input non-int value, repeats on , on forever "what piece move?" being displayed on screen continuously until manually terminate program. what doing wrong? wasn't until added 'try' , 'catch' phrases. there 2 solutions problem: keep nextint int inputexception = 0; { inputexception = 0; try { system.out.println("what piece move?"); pieceselectioninput = scan.nextint(); } ...

jquery - How to search for name from local storage using typeahead? -

var a=[{ "name":"harsha", "age":"18" }, { "name":"havisha", "age":"19" } ]; localstorage.setitem("list",json.stringify(a)); $("#namm").autocomplete({ source:[ b=localstorage.getitem("list") ] }); i have stored names in local storage name.then when search name in textbox names must searched localstorage.how can possible .i have tried above>but not able it if list string array try this: var list = localstorage.getitem("list"); $("#namm").autocomplete({ source: list }); p.s. check variable returned localstorage not null.

How can I remove the default phpmyadmin limit on MySQL queries? -

this question has answer here: phpmyadmin: change default number of rows displayed? 7 answers phpmyadmin implements default limit 0, 30 . aware of show all button can use prefer option have code executed entered. is there config option can set change or remove 30 limit @ session or system level? here answer post: in phpmyadmin directory, there file called "config.inc.php". find line sets maxrows value: $cfg['maxrows'] = 1000; and change value whatever want.

c# - Linq group by and select -

i have *.cs model public class timesheetlistmodel { public string projectname { get; set; } public datetime taskdate { get; set; } public string task { get; set; } public decimal timeworked { get; set; } public string note { get; set; } } and have service, selects model database. now need include model list<> new model: public class timesheetmodel { public datetime taskdate { get; set; } public list<timesheetlistmodel> timesheetlist { get; set; } public timesheetmodel() { timesheetlist = new list<timesheetlistmodel>(); } } and need select data db new model, , group taskdate in new model. have service realize query, wrote old model: public ienumerable<timesheetlistmodel> getticketsinprogressbyuserid(int id) { var query = (from workloglist in datacontext.tblworklogs join tickets in datacontext.tbltickets on workloglist.ticketid equals tickets.tic...