Posts

Showing posts from May, 2012

asynchronous - Android background processing, handle result and Activity lifecycle -

Image
i have general problem android background processing, how deal it? imagine scenario: users starts activity fragment. fragments starts fetching data network using intenservice. intentservice provide result fragment via localbroadcast system. broadcastreciever in fragment registered/unregistered in onresume()/onpause(). looks good, when user press home button right after 2) result broadcast intentservice has been lost. happen becouse fragment unregistered broadcastreceiver in onpasue() callback. there general pattern avoid issue? using resultreceiver instead of broadcastreceiver better prupouse? i have tired resultreceiver, in case send resultreceiver service in bundle (it implements parcelable interface) after recreation activity due changing screen orientation resultreceiver has "dirty" reference previusly created activity can cause bugs. your intentservice can create notification on task completion, pending intent activity, in case activity goe

javascript - angularJs + firebase $createUser , new SDK erorr -

i try create user , angular myapp.controller('loginctrl',['$scope','$firebaseauth','config',function($scope,$firebaseauth,config){ console.info('[app-info] ~ loginctrl start') var ref = new firebase('https://myauth-tadmit.firebaseio.com/'); var auth = $firebaseauth(ref); $scope.register = function(){ auth.$createuser({ email: $scope.user.email, password: $scope.user.password }).then(function(reguser){ console.log('regcomplete user:' ) }).catch(function(error){ console.log(error.message) }); } }]); and when call register() function , console erorr: projects created @ console.firebase.google.com must use new firebase authentication sdks available firebase.google.com/docs/auth/ i use angular 1.5.8 + <script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js"></script> <script src="https://cdn.firebase.com/libs/angularfire/1.2.0

python - pyqt4: How to change button event without adding a new event? -

i have click button want change events when button pressed. minimal version of existing code looks this: # event happens first time def first_event(self): button.settext("second event") button.clicked.connect(second_event) # event happens second time def second_event(self): button.settext("first event") button.clicked.connect(first_event) button = qtgui.qpushbutton("first event") button.clicked.connect(first_event) unfortunately, instead of changing event happens, adds , event clicked signal, meaning following happens: first button press - calls first_event second button press - calls first_event , second_event third button press - calls first_event twice , second_event etc... my desired behavior have button change functions when pressed , resulting behavior be: first button press - calls first_event second button press - calls second_event third button press - calls first_event etc... is there way make chang

oracle11g - Oracle 11g - Format custom timezone to a oracle valid timezone -

i changing postgres db backend oracle 11.4.0.2 backend. in postgres, working joda datetime time zone offset , resulting in having 2 columns. 1 column timestamp , second column timezone offset column type varchar. the database schema automatically generated hibernate , when generate database record writes following entry timezone column 'europe/zurich{+02:00}' this results in wrong database query if following "where-sql-query" being executed: from_tz(to_timestamp('08/08/2016 00:00:00.000000', 'dd/mm/yyyy hh24:mi:ss.ff'), 'europe/zurich{+02:00}') however, following changed queries valid from_tz(to_timestamp('08/08/2016 00:00:00.000000', 'dd/mm/yyyy hh24:mi:ss.ff'), 'europe/zurich') and from_tz(to_timestamp('08/08/2016 00:00:00.000000', 'dd/mm/yyyy hh24:mi:ss.ff'), '+02:00') is there proper way convert timezone directly in query without doing workarounds such substringing timezo

node.js - Extends an NPM module class with no typings from TypeScript -

i wanted experiment mobx-firebase-store in typescript code. has no typings uses javascript classes. i tried convert chatstore.js code imports mobxfirebasestore class: import mobxfirebasestore 'mobx-firebase-store'; and later extends it: export default class messagestore extends mobxfirebasestore { since there no types, tried using trick make library declared any typings install mobx-firebase-store=common~any --save then: import * mobxfirebasestore 'mobx-firebase-store'; but line: export default class messagestore extends mobxfirebasestore { has following errors: ts2507:type 'any' not constructor function type. ts4020:extends clause of exported class 'messagestore' has or using private name 'mobxfirebasestore'. what quickest , easiest way get past these errors , able extend class in similar way being done here babel?

html - how to make div with one line of text and div with two the same height? -

Image
how can make boxes (box class) same height status in same line? text inside boxes need vertically aligned. need (don't worry arrows): i need support ie10. have html , css this: ul { list-style: none; padding: 0; margin: 0; } ul li { float: left; } .box { white-space: pre; text-align: center; display: block; border: 1px solid black; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; width: 200px; padding: 10px 0; } <ul> <li> <span class="box">get parent folder owner</span> <span class="status">passed</span> </li> <li> <span class="box">some text</span> <span class="status">passed</span> </li> <li> <span class="box">some text</span> <span class="status">running</span> </li> </ul&g

javascript - Load a different jQuery library from Layout in View for DataTables in MVC -

i need load specific jquery library version in view use datatables library. the problem use jquery 3.1 project , include reference in _layout view, datatables allow: bootstrap's javascript requires jquery version 1.9.1 or higher, lower version 3 how can i, if possible, load different version of jquery in specific view? edit: regarding davidg comment, seems message based on bootstrap jquery supported library not support jquery v3. i going update bootstrap 3.3.7 avoid problem ("added support jquery 3") , use jquery 3.1.0, datatables problem remains case. edit2 (solution): i decided follow shyju's suggestion keep simple , based in single stable jquery version, have downgraded jquery 2.2.4 (last v2 stable version) , have keeped bootstrap last version (v3.3.7). datatables version remains same (1.10.12). if absolutely need load different version of library specific page, can this. in specific action method returns view has data table, set v

Convert Python to Java 8 -

i’m working in project use java 8, project geographic information , work this. have done part of work in python, , i’m translating part did in python java 8, in python use lines bellow convert coordinates in google format postgis format: s1 = tuple(value.split(" ")) s2 = zip(s1[1::2], s1[::2]) for example: i have entrance like: value = " 11.12345679 12.987655 11.3434454 12.1223323 " , on python code above changes de entrance to: s2 = " 12.987655 11.12345679 12.1223323 " , on. changing position of each coordinate pair, each entrance have thousands of coordinates. same effect java (before java 8): using knowledge of java (acquired before java 8) need that: try { string result = "", right = "", left = ""; string[] txt = str.split(" "); (int = 0; < txt.length; += 2) { right = txt[i]; left = txt[i + 1]; result += "," + left + " " + right; }

python - Remove cancelling rows from Pandas Dataframe -

Image
i have list of invoices sent out customers. however, bad invoice sent, later cancelled. pandas dataframe looks this, except larger (~3 million rows) index | customer | invoice_nr | amount | date --------------------------------------------------- 0 | 1 | 1 | 10 | 01-01-2016 1 | 1 | 1 | -10 | 01-01-2016 2 | 1 | 1 | 11 | 01-01-2016 3 | 1 | 2 | 10 | 02-01-2016 4 | 2 | 3 | 7 | 01-01-2016 5 | 2 | 4 | 12 | 02-01-2016 6 | 2 | 4 | 8 | 02-01-2016 7 | 2 | 4 | -12 | 02-01-2016 8 | 2 | 4 | 4 | 02-01-2016 ... | ... | ... | ... | ... ... | ... | ... | ... | ... now, want drop rows customer , invoice_nr , date identical, amount has opposite values. corrections of invoices take place on same day identical invoice number. invoice number uniquel

validation - Javascript checking telephone number - IF Statement -

my if statement isn't working 100%; want checking length , if digits, if left blank green text , style errtelno1 - can me understand why? i'm new @ this...its 11 digit number if (document.getelementbyid("telno").value.length != 11 ) { document.getelementbyid("errtelno").style.display = "inline"; document.getelementbyid("errtelno").style.visibility = "visible"; document.getelementbyid("telno").style.border ='4px solid red'; document.getelementbyid("errtelno").style.color = "green"; document.getelementbyid("errtelno").style.fontweight = "light"; document.getelementbyid("errtelno").style.fontsize = "12px"; isvalid = false; } else { document.getelementbyid("telno").style.border ='2px solid green'; document.getelementbyid("errtelno").style.color = "green"; } if (docume

vectorization - Is vectorised data manipulation sequential (e.g R and MATLAB)? -

everybody told exploit vectorised programmes such matlab , use indexing instead of loop. for e.g, in matlab, rather setting element of matrix 0 in double loop, use m[1:n,1:n]=0; . my question relates whether works sequentially? i.e, if have row vector v of size n , , execute following line v[1:n-1]=v[2:n] then updated values used throughout, or take "snapshot" of vector, , paste vector again in shifted index? i'd sequentialy values updated bottom first , used again values above etc it works though on right hand side happens before on left hand side, doing "snapshot" thing better memory efficiency. in reality, may loop through or may take "snapshot", due abstraction don't need know or care that. so result follows: v=[1 2 3 4 5 6]; v[1:5]=v[2:6]; disp(v) v = [2 3 4 5 6 6] is want?

How precise is tracking movement using accelerometer-Android? -

i need implement kind of movement tracking in app , need precise, precise 1% precision. example if user moves 5 m, possible app calculate user moved (5+-0.05) m using accelerometer? rephrase question, accelerometer give such precise data? know after comes implementing sensor , optimising code. if possible, great if link sort of tutorial or example impementing kind of tracking. note: not want app measure steps, exact distance user has moved. no, such precision not possible out of devices, because move in such complicated patterns. what want perform double integration of sampled acceleration signal - position. acceleration signals nature quite... spasmic, meaning sampling rate have high, so, contain errors. these errors magnified in integration process, , hard reconstruct position accuracy. known "drift". the problem common , quite known. https://www.google.com/search?q=double+integration+of+sampled+signal the solution want use gps.

javascript - Can I use grunt to set a property value in a json file? -

still learning ropes of grunt , can't find solution this. have config file, config.json data. when run specific grunt task want increment value in config.json file. i've been able find lot of information on how read file nothing far on changing value. thanks. you can use https://github.com/eruizdechavez/grunt-string-replace replace string , save file 'string-replace': { dist: { files: { 'dest/': 'src/**', 'prod/': ['src/*.js', 'src/*.css'], }, options: { replacements: [{ pattern: /\/(asdf|qwer)\//ig, replacement: '"$1"' }, { pattern: ',', replacement: ';' }] } } } with grunt plugin u can substitute regex pattern (or simple string) replacement the steps make final json are: load json file >> http://gruntjs.com/api/grunt.file apply replace task >> on top save json file >>

regex - blank in regular expression in flex -

i have following regular expression in flex file. (.l file) doctype [[:blank:] \r\n]*<!doctype[^\[]*\[[[:blank:] \r\n]* from flex tutorial, in pattern chapiter, saw flex defines ‘[:blank:]’ blank or tab. in expression above, why need blank after [:blank:] ? the [:blank:] posix character class matches space or tab (even in flex patterns manual ). thus, [[:blank:] \r\n] character class equals [[:blank:]\r\n] . same [rr] = [r] .

c# - Creating a prefab from a gameobject in scene by using Prefabutiliy.CreatePrefab -

i have gameobject in scene has children , components. want save prefab , later delete gameobject using c# scripting. have basic script handles situation : gameobject gobject = gameobject.find(name); if (gobject != null) { prefabutility.createprefab("assets/models/" + data + ".prefab", gobject, replaceprefaboptions.default); destroy(gobject); } this code works well. saves transform components while creating prefab. mesh info of gameobject lost after createprefab operation.is there way create prefab includes components of gameobject? you need save mesh inside prefab. object prefab = prefabutility.createprefab(... assetdatabase.addobjecttoasset(yourmesh, prefab); destroy(gobject); if have multiple meshes, need addobjecttoasset each of them individually. re: comment: there no need have functionality in build. can create gameobject @ runtime components , meshes want, clone using instantiate prefab.

visual studio 2015 - VS Emulator for Android error with Hyper-V -

when try run visual studio emulator android following error. "unable add user hyper-v administrators group. exit code 2220" i able run windows phone emulator without problem, administrators group present. have tried run administrator same result. running visual studio enterprise 2015 on windows 10 anniversary update (14393.10). the problem may related version of windows have or started with. have start pro install. upgrading home pro incomplete. i discovered if start msdn windows 10 (multiple editions), version 1607 , install it, defaults home edition. once put in pro key upgrade it, becomes " pro "; not really. " users , group " snap-in not work, stuck security model in " home ". once have upgraded, need reset installation -- not delete/format partition or " home " edition again. the msdn version not allow select home/pro , there no pro version download. frustrating. ms has known year. some have postulate

python 2.7 - Pyinstaller networkx module issue -

i have 1 python file networkx examples: from networkx import graph g=graph() g.add_node("spam") g.add_edge(1,2) print(list(g.nodes())) print(list(g.edges())) now want use pyinstaller build bin file pyinstaller --debug --onedir nx.py after building , running nx.exe error in cmd: pyinstaller bootloader 3.x loader: executable c:\users\xrp836\desktop\meshsim\ex\dist\nx\nx.exe loader: homepath c:\users\xrp836\desktop\meshsim\ex\dist\nx loader: _meipass2 null loader: archivename c:\users\xrp836\desktop\meshsim\ex\dist\nx\nx.exe loader: no need extract files run; setting extractionpath homepath loader: setdlldirectory(c:\users\xrp836\desktop\meshsim\ex\dist\nx) loader: in child - running user's code. loader: python library: c:\users\xrp836\desktop\meshsim\ex\dist\nx\python27.dll loader: loaded functions python library. loader: manipulating environment (sys.path, sys.prefix) loader: sys.prefix c:\users\xrp836\desktop\meshsim\ex\dist\nx loader: setting runtime optio

vba - How to sort an excel sheet according to sort order of my original excel sheet? -

Image
using chrome extension 'webscraper.io', regularly scraping government website track updated project expenses. although efficient in operation, it's failing return data in same order providing input url's. , more weirdly every time run task picking different order though source same. suppose, if run task of 5 url's twice, output (no specific random order): (day 1) output (day 2) output url 2 $500 url 3 $478 url 4 $867 url 1 $637 url 1 $928 url 4 $102 url 3 $109 url 5 $942 url 5 $208 url 2 $296 it makes side side comparison of different days of data extremely tedious task me. so, there way sort columns of sheet 2 according sort order of sheet 1? alphabetical sorting of both sheets 1 option, breaks original order (which department wise). ideally want paste column b of days original sheet & compare changes. you may want use sort method of range object ordercustom parameter sub sortbyurls() dim rngt

java - Spring aliasFor for Annotations with Target(PARAMETER) -

i trying use meta-annotation of spring using aliasfor annotation create custom annotation springs requestparam simply 'extend/replace' @target(elementtype.parameter) @retention(retentionpolicy.runtime) @documented public @interface requestparam { @aliasfor("name") string value() default ""; ---- } with annotation @target(elementtype.parameter) @retention(retentionpolicy.runtime) @inherited public @interface queryparam { @aliasfor(annotation = requestparam.class, attribute = "name") string name() default ""; @aliasfor(annotation = requestparam.class, attribute = "required") boolean required() default false; @aliasfor(annotation = requestparam.class, attribute = "defaultvalue") string defaultvalue() default valueconstants.default_none; } this way throws exception org.springframework.core.annotation.annotationconfigurationexception: @aliasfor declaration on attribu

spring boot - JpaRepository method having constructor expression and Optional return type cause ConverterNotFoundException -

i have jparepository method having constructor expression , java.util.optional return type. @repository public interface testdatarepository extends jparepository<testdata, integer> { @query("select new com.example.testdatasummary(d.id, d.col1) " + "from testdata d d.id = ?1") optional<testdatasummary> findoptionalandnewbyid(integer id); } this method makes org.springframework.core.convert.converternotfoundexception after updating spring-data-jpa 1.9.4.release 1.10.2.release . stacktrace below. no converter found capable of converting type [java.util.optional<?>] type [com.example.testdatasummary] org.springframework.core.convert.converternotfoundexception: no converter found capable of converting type [java.util.optional<?>] type [com.example.testdatasummary] @ org.springframework.core.convert.support.genericconversionservice.handleconverternotfound(genericconversionservice.java:313) @ org.springframework.

testing - How to use scrollTop in behat? -

i have page, when enter page show below part only, want scroll click 1 of element present in top of page.how can achieve that,i tried below not working. $this->getsession()->wait(5000, "jquery('#page').animate({scrolltop: '-500px'}, 300)"); thanks in advance. you can use action this: $this->getsession()->executescript('window.scrollto(0,0);');

c# - Fill column in DataTable with output from SQL query -

i have datatable structure: number amount destroyed 1 19 3 22 2 20 3 23 3 11 0 11 the value in destroyed column manually inserted user. however, i've created table in sql user can add value destroyed , want take value table. have proper sql query this. the following example demonstrate. here output query : number destroyed type 1 3 papper 2 1 papper according structure of datatable should insert value destroyed sql query datatable when query.number = datatable.number so according example should like: number amount destroyed 1 19 3 22 2 20 1 21 3 11 0 11 how accomplish this? you haven't posted how you're connecting , executing sql statement. using sqlconnection , friends execute statement:

node.js - .Net AMQP client for IBM MQ -

i trying connect ibm mq 9.0 using amqp 1.0 channel .net application. the mq light portal supports nodejs, ruby, java , python clients only. have mq light amqp client .net? i have tried connecting ibm mq 9 amqpnetlite client namespace amqpnetlitesample { class program { static void main(string[] args) { console.writeline("start"); //address addr = new address("10.58.139.97", 1234, "username","password", "/", "amqp"); address addr = new address("amqp://10.58.139.97:1234"); connection con = new connection(addr); con.closed += con_closed; console.writeline("created connection"); session session = new amqp.session(con); session.closed += session_closed; console.writeline("created session"); senderlink link = new senderlink(session, "sender_12

http - Requiring the ID token too to access an API endpoint -

let's take example have spa accessing api using oidc implicit flow. since oauth scopes coarse-grained, necessary perform additional authorization on resource servers. can case example when accessing dynamic resources (e.g filesystem) via endpoint - access restricted permissions tied userid, not practical use oauth scopes because of dynamic nature of resources. in these cases endpoint can protected oauth scope, while access resources endpoint operates on (e.g files) granted based on userid. hence user's identity must securely sent in api request. an obivious choice can send id token obtained when authenticating, access token obtained @ same time. there standard way sending access token in http request (the authorization header), there 1 id token? or should make header name 'x-identity'? to answer question: there no standard passing id token in http request. but arguably there doesn't need one: in case may not need openid connect since scopes n

javascript - jquery validation according database field size -

for example in database column1 having data type varchar , size 200,how check size(200) validation in java script. you need read simple java script validation tutorial http://www.w3resource.com/javascript/form/javascript-sample-registration-form-validation.php , http://www.tutorialspoint.com/javascript/javascript_form_validations.htm var col1 = $(document).getelementbyid('#yourinputfieldid').value; if(col1.length > 200) { alert("invalid value"); }

How to call a parent msg from component in Elm? -

i have modal window can display different components inside it. each component has it's own updater , messages, want share close button between them. thus can't call "closemodal" directly children — elm doesn't allow me call else messages. options? i thought call "modal.update.update modal.messages.closemodal", inside components have chunks of state. it's not option. then found way pass messages parent child, doesn't me pass messages other way around. or siblings. in short, can not pass messages directly child parent or sibling. elm architecture implements uni-directional message passing, in other words, parent component aware of messages child components before child component receive message. i have made simple example of parent-child communication , way big embed answer note key points here. child child component defines set of messages : type msg = update model | focus | blur in it's update fu

javascript - How to save annotations in pdftron in Nodejs? -

i need upload pdf , highlight text, add annotation note highlighted text , save edited pdf along highlighted text & annotation notes in nodejs. i'm using pdftron in regard , doing fine till uploading, highlighting , writing note highlighted part unable save data. what pdftron guide clicking save button of note container (to i'm considering annotation if i'm not wrong) send 'post request' server url saving note. hits server url on page reload loading saved annotations don't send post request on same server url saving annotations on clicking save button. here's webviewer initialization code: var mywebviewer = new pdftron.webviewer({ type: "html5", path: "/lib", initialdoc: "/gettingstarted.pdf", serverurl: "/annotations", //server url save & load annotation documenttype: doctype, config: "/lib/config.js", documentid: "gettingstarted", enableannotatio

html - How to get TagName of Control if exists? -

i have written code: if (alohaenabled) dim head control = nothing each control in master.controls dim field = control.gettype.getfield("tagname") if ((field isnot nothing) andalso (field.getvalue(control).equals("head"))) 'add aloha scripts end if next end if if alohaenabled true , intend add links , scripts head tag. not know in advance kind of master used, therefore iterate controls , field called tagname through reflection. if field has value, compare "head" , if match, intend add aloha script s (the question more general though, need different scripts or somewhere else). tagname field of system.web.ui.htmlcontrols.htmlcontrol . 0'th control in test case returns {name = "htmlhead" fullname = "system.web.ui.htmlcontrols.htmlhead"} on control.gettype . if @ system.web.ui.htmlcontrols.htmlhead , see inherits system.web.ui.htm

java - Logback - dynamic configuration -

is possible configure logback in such way custom logback property : <configuration scan="true" scanperiod="60 seconds"> <property name="logfullmessage" value="false" /> <!-- project appenders defitions --> <!-- project loggers defititions --> </configuration> will influence pattern or appender used ? have web services application operates large requests/responses, default not wish log request/response body, when problem occurs have option switch on (logfullmessage=true) , store full response body log file. to switch used appender (only relevant lines shown): <property name="use_appender" value="file1" /> <appender name="file1" class="ch.qos.logback.core.fileappender"> .... </appender> <appender name="file2" class="ch.qos.logback.core.fileappender"> .... </appender> <root level="warn&quo

javascript - JS/TS/Angular2 - Replace characters while writing in Textbox -

i using ts/angular2 app. have textbox text of certain(important) length, , able control length, want replace next character 1 typed. so, if i've got text "test" , courser position "t | est". if user types new character, want "e" replaced character. so if type "a" @ position, result should "tast" instead of "test", if know mean. i couldn't find (which might due disability find correct expression this). there way set "writingmode" or whatever it's called directly in code or have code manually? thanks!

Where to get the latest jrockit version -

tls 1.1 support added in 28.3.9 (which urgently need) - http://docs.oracle.com/cd/e15289_01/doc.40/e15066/toc.htm official page servers 28.2.7 - http://www.oracle.com/technetwork/middleware/jrockit/overview/index.html as far know, 28.3.11 latest , last version. looking windows x86-64 version, unable find anywhere. doc id 1948210.1 (where download latest jrockit?) on http://support.oracle.com has details. it says: the current version on otn remain r28.2.7 , can downloaded following url: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-jrockit-2192437.html customer needs extended support or fmw support newer jrockit versions (beyond r28.2.7) , can downloaded oracle support. to download latest jrockit patch set: log oracle support click on "patches & updates" tab click on product of family (advanced search) for "product is" choose oracle jrockit for "release is" choose jrockit patch set rele

c++ - Misleading performance warning for auto_ptr type passed by value -

i'm checking 1 of projects cppcheck 1.75, , code (reduced clarity): class tjob { public: tjob(std::auto_ptr<itask> task); // ... private: std::auto_ptr<itask> m_task; }; tjob::tjob( std::auto_ptr<itask> task // <-- here performance warning ): m_task(task) { trace("tjob ctr"); } i'm getting new performance warning: id: passedbyvalue summary: function parameter 'task' should passed reference. message: parameter 'task' passed value. passed (const) reference faster , recommended in c++. which false positive. in opinion it's bug, because following suggestion leads serious bug [1] , maybe there switch missed set, or template can provide declare ownership passed auto_ptr ? i searched web , found far cppcheck incorporates checks check invalid usage of stl , example - using auto pointer (auto_ptr) i'm aware, auto_ptr isn't best choice wouldn't same unique_ptr ? 2

c# - Display Returned List In Code Behind In My Dropdown List In My View -

i have list generated in code behind need pass list dropdown list in view have no idea on how new development please can me. code behind list<ajbg.servicecontracts.messages.thirdpartyapis.origo.getstaticcedingschemes.cedingscheme> origocedingschemes = target.getstaticcedingschemes(request).cedingschemes; list<selectlistitem> listitems = new list<selectlistitem>(); foreach (ajbg.servicecontracts.messages.thirdpartyapis.origo.getstaticcedingschemes.cedingscheme origocedingscheme in origocedingschemes) { listitems.add(new selectlistitem() { text = origocedingscheme.schemename, value = origocedingscheme.counterpartyschemeorigoid.tostring(), selected = false }); } var selectitemlist = listitems list<selectlistitem>; return selectitemlist; view <%=html.dropdownlist("scheme_textbox", "", new { style = "width:98%;", placeholder= "type search...", onblur="selectedscheme(this);" })%> i have tried u

hadoop - org.apache.thrift.transport.TTransportException: Cannot open without port? -

there i quite new hive , , java app accesses hive kerberos authentication, below: try { system.setproperty("java.security.krb5.conf", "/hamanage/krb5.conf"); stringbuilder sbuilder = new stringbuilder(); sbuilder.append("jdbc:hive2://ha-cluster/default"); sbuilder.append(";zk.quorum=").append("x.x.x.x,x.x.x.x");//ip list sbuilder.append(";zk.port=").append("24002"); if (issecurever) { sbuilder.append(";user.principal=") .append("hadoop@hadoop.com") .append(";user.keytab=") .append("/home/hdclient/gyj/user.keytab") .append(";sasl.qop=auth-conf;auth=kerberos;principal=hive/" + "hadoop.hadoop.com@hadoop.com;zk.principal=zookeeper/hadoop.h

How can I export the trained SVM model from MatLab to use in Android(Java) -

i trained svm model on matlab , saved .mat file. how can save in format can use java? or there other ways use matlab model on java(like using models parameters create new predictor on java)? thanks:) try this or can make self loading file , reading file structure fields here

atg - how many characters can be put in "Data"text field of media-internal-text item descriptor -

i creating repository item of media-internal-text item descriptor type.i have put text in "data" field in bcc. want know how many characters can put in "data"field of media-internal-text item descriptor in atg bcc? if characters not sufficient how increase character size limit? the dcs_media_txt table holds data field refer to. definition of column clob (for oracle database) of size limit documented here should indicate it, nature, can store large number of characters.

unicode - How can I inject invalid XML chars in an Exchange appointment for testing? -

Image
i'm synchronizing exchange (either 2013 or 365) through ews. (delphi) code process soap xml requests , responses. we have seen invalid xml characters #xb in returned soap <body> elements of our clients ( don't ask me how got there - , no longer have access 'corrupt' messages ) our subsequent xml processing code can't handle. i have built filter routine , need test that, have failed create appointment invalid unicode character either through outlook or ie. does know of way so? if use mapi (either via oom,redemption or mfcmapi easiest allows edit property directly) should able write mapi property body directly (or msg export of message problem environment , import mailbox via outlook should bring issue test environment). appointments should have rtf body corruption maybe happening because there editor writing these props in wrong format or there issue in conversion. mfcmapi let edit body property directly drop in hex value invalid data

hadoop - Load data into Hive with custom delimiter -

i'm trying create internal (managed) table in hive can store incremental log data. table goes this: create table logs (foo int, bar string, created_date timestamp) row format delimited fields terminated '<=>' stored textfile; i need load data table periodically. load data inpath '/user/foo/data/logs' table logs; but data not getting inserted table properly. there might problem delimiter.can't find why. example log line: 120<=>abcdefg<=>2016-01-01 12:14:11 on select * logs; get, 120 =>abcdefg null first attribute fine, second contains part of delimiter since it's string getting inserted , third null since expects date time. can please on how provide custom delimiters , load data successfully. by default, hive allows user use single character field delimiter. although there's regexserde specify multiple-character delimiter, can daunting use, amateurs. the patch ( hive-5871 ) adds new serde named m

laravel - my WebSocket php Does not work when 2 or more person send request -

i have centos 6.8 when 2 or more concurrent users submit multiple entries socket not work console write : "websocket in closing or closed state" when person uses .not there no problem where problem ? updaete--------> working on project, in every second want take data specific url “server a”, , won’t late in time second, don’t have access server. used websocket, problem when few users connect website @ moment, multi requests sent “server a”, , because requests @ same time, 1 of them answered, solve problem decided use “cache” has high risk. is there way when websocket progress have break less second? if have suggestion problem please tell us. project information , server - laravel 5.2 https://github.com/brainboxlabs/brain-socket https://github.com/brainboxlabs/brain-socket-js apache version 2.4 centos 6.8

html - How to push the middle div on top in small screen in Bootstrap -

i trying implement page in bigger screen have 3 divs present , in smaller screen want middle div on top , take full column width ie col-xs-12 i have written following code:- <div class="row" style="margin:100px"> <div class="col-sm-4 push-col-xs-6" style="border: 1px solid;min-height: 300px;"> default carousel </div> <div class="col-sm-4 pull-col-xs-12" style="border: 1px solid;min-height: 300px;"> <img src='https://files.abc.com/uploads/fanbook/thumbs/1450524216-9.jpg' class="img img-responsive" style="position:relative"> <h3 style="position:absolute" class="home_mer">official<br>merchandise<br>partner</h3> </div> <div class="col-sm-4 col-xs-6" style="border: 1px solid;min-height: 300px;"> <img src='https://files.abc.com/uploads/fanboo

c# - Highlight dynamic calls in code -

i writing program in .net visual studio 2015. have problem our obfuscating tool not work when there dynamic calls anywhere in code, need rid of them. is possible make visual studio highlight code uses dynamic ? maybe give out warning or such? edit: i not have word dynamic anywhere in code, there still dynamic calls. come third party api use. example excerpt api: public class thirdpartyclass { public dynamic foo { { ... // returns instance of class fooclass } } ... } the class fooclass has method bar() . now let's @ point in code have instance of thirdpartyclass called tpc . following line of code var barvar = tpc.foo.bar(); does dynamic call, because tpc.foo dynamic. remove dynamic call write instead var barvar = ((fooclass)tpc.foo).bar(); this need in order make obfuscation tool work again. how find dynamic calls without going through code manually? a way find dynamic usages in code temporary remove microsoft.csharp dep

javascript - Defining syles in video shadow DOM(s) -

any suggestions on how append style of input "range" element when shadow of html 5 video element. understanding normal method in example 1. if styling track. what hope achieve color 1. left of thumb showing complete, color 2 right show pending video. example 1. input[type=range]::-webkit-slider-runnable-track { width: 300px; height: 5px; background: #ddd; border: none; border-radius: 3px; } the method target video shadow dom a prefix of video:: however, following dosen't work pointers appreciated. video::input[type=range]::-webkit-slider-runnable-track { width: 300px; height: 5px; background: #ddd; border: none; border-radius: 3px; } any solutions either css, html, or pure javascript appreciated... building off vitorino's fiddle, closest workaround come 1) add timeupdate event listener calculated percentage of video played, 2) set percentage background multiple gradients updating css in <style> element, so: html: <style id="

Check whether input field is empty in Controller - AngularJS -

i started learning angularjs. in testing program wrote, need check whether input field empty or not inside controller(script). following code wrote <div ng-controller="examplecontroller"> <input type="text" ng-model="userfirstname" required/><br> <p ng-bind="msg"></p> </div> <script> var mainapp = angular.module("mainapp", []); mainapp.controller('examplecontroller', function ($scope) { if($scope.userfirstname.length === 0){ $scope.msg = "pls enter something"; }else{ $scope.msg = "something entered"; } }); </script> here, output, expected see pls enter something . cannot see anything. but if change script in following small changes, shows me something entered expected. <script> var mainapp = angular.module("mainapp", []); mainapp.controller('examplecontroller&

android - Cities Daylight saving time database -

i trying database cities , it's corresponding timezone including daylight saving time cannot find it. i making ios , android application user can choose city or , represents time need data calculate right time. my current solution use timezone.getavailableids() (id's same android ) discovered there lot of cities missing such beijing , abu dhabi. solution? here can 1 thing. set button in app , add below code in button's action. u can present date , time of location.and u can save information hitting api(webservice of app). -----------------------------------code---------------------------------- nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; nstimezone *gmt = [nstimezone timezonewithabbreviation:@"gmt"]; [dateformatter settimezone:gmt]; [dateformatter setdateformat:@"yyyy-mm-dd't'hh:mm:ss.000'z'"]; nsstring *iso8601string = [dateformatter stringfromdate:self]; (nj)

How can I add an image to all pages of my PDF? -

i have been trying add image pages using itextsharp. image needs on content of every page. have used following code below other doc.add() document doc = new document(itextsharp.text.pagesize.a4, 10, 10, 30, 1); pdfwriter writer = pdfwriter.getinstance(doc, new filestream(server.mappath("~/pdf/" + fname), filemode.create)); doc.open(); image image = image.getinstance(server.mappath("~/images/draft.png")); image.setabsoluteposition(12, 300); writer.directcontent.addimage(image, false); doc.close(); the above code inserts image in last page. there way insert image in same way in pages? it's normal image added once; after all: you're adding once. (or you've left away essential steps in code snippet: see edit made.) in case: can solve problem using page event. there examples in java here: http://itextpdf.com/sandbox/events or can consult chapter 5 of book. examples available in java in c# . you should create document in 5 steps , add e

javascript - Why Dialog is not opened when button is clicked? -

i have 3 dialogs opened clicking button... i have linked both jquery-ui , jquery.min.js file , jquery-ui.css file... but when click button redirects index page instead of opening dialog.... this jquery code.... $(function(){ $("#recipientdialogue").dialog({ autoopen:false, }); $("#exclusiondialogue").dialog({ autoopen:false, }); $("#suppressiondialogue").dialog({ autoopen:false, }); $("openrecipient").click(function(){ $("#recipientdialogue").dialog("open"); }); }); this html code... <td colspan="3"><button id="openrecipient">choose recipients</div></td> <td colspan="3"><button id="opensuppression">choose recipients</button></td> <td colspan="3"><button id="openexclusio

javascript - is Updating reducer initial state with localStorage data a good practice? -

i have reducer initial state , working fine. const initialstate = [items:{ id: 1, text: 'monday', }, { id: 1, text: 'tuesday', }]; function daychaged(state = initialstate, change) { .. } my app working fine. however, added support local storage. want store new item in storage whenever user add one. , when page refresh/reload, want set initialstate value of initialstate plus localstorage values. @ moment added in state/reducer class , however, feel not best practice. const storageitems = json.parse(localstorage.getitem('items')); if(storageitems) { initialstate = { todos: initialstate.items.concat(storageitems) }; } function daychaged(state = initialstate, change) { .. } its working fine , doing want. however, complicate reducer understanding. please should add such feature anc considering intention, how integrate without affecting testability of state? first off consider if need change initialstate of reducer o

netty - HexDumpProxyFrontendHandler volatile field -

as far understood methods within channelhandler classes executed same thread. correct me if i'm wrong. what point declare field volatile in example? private volatile channel outboundchannel; http://netty.io/4.1/xref/io/netty/example/proxy/hexdumpproxyfrontendhandler.html this bug in examples. not needed. let me fix it.

c# - In my booking page how to prevent many users to select same truck at same time? -

Image
in booking page how prevent many users select same truck @ same time ? in scenario when 2 user selecting truck imediately available have allow first user few milliseconds before second customer.. system.web.ui.webcontrols.button lnkreport1 = (system.web.ui.webcontrols.button)e.commandsource; string[] commandargs = e.commandargument.tostring().split(new char[] { ';' }); truckid.text = commandargs[0]; temp_memory_id.text = commandargs[1]; string status=string.empty; sqlconnection con12 = new sqlconnection(configurationmanager.connectionstrings["bum"].connectionstring); sqlcommand cmd12 = new sqlcommand(" select tr_status truckregistration id='" + truckid.text + "' ", con12); con12.open(); sqldatareader dr = cmd12.executereader(); while(dr.read()) { status = dr["tr_status"].tostring(); } con12.close(); if (temp_memory_id.text == "immediate") {

javascript - How to load local text information into <div> section -

i trying draw diagram using below codes. works well. can see, should put text information in div . if there sample.txt includes information in local drive, can load div section dynamically instead of putting manually? <!doctype html> <html > <head> <meta charset="utf-8"> <title>sample diagram</title> </head> <body> <div class="diagram"> title: diagram <!-- participant first participant second participant d participant f participant g //--> e->f: 2 second->first: 1 first->second: 1 c-->second: request token c->e: 2 second->first: forward request first->>c: send token </div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src='http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.2/raphael-min.j