Posts

Showing posts from September, 2014

sql - find the missing entries for the working days and fill the row with the values from the closest date -

the problem splits 2 parts. how check working days missing database, if missing add them , fill row values closest date. first part, check , find days. should use gap approach in example below? select t1.col1 startofgap, min(t2.col1) endofgap (select col1 = thedate + 1 sampledates tbl1 not exists(select * sampledates tbl2 tbl2.thedate = tbl1.thedate + 1) , thedate <> (select max(thedate) sampledates)) t1 inner join (select col1 = thedate - 1 sampledates tbl1 not exists(select * sampledates tbl2 tbl1.thedate = tbl2.thedate + 1) , thedate <> (select min(thedate) sampledates)) t2 on t1.col1 <= t2.col1 group t1.col1; then need see closest date 1 missing , fill new inserted date (the 1 missing) values closest. time ago, came closest value row, time need adapt check both down , upwards. select t,a, c,y, coalesce(y, (select top (1) y

php - How do I fix this error in Magento 1.9.2.0? -

i have error in model/entity/attribute/abstract.php line 389 happens on product view page. here's abstract.php line 389 has: public function getsource() { if (empty($this->_source)) { if (!$this->getsourcemodel()) { $this->setsourcemodel($this->_getdefaultsourcemodel()); } $source = mage::getmodel($this->getsourcemodel()); if (!$source) { throw mage::exception('mage_eav', mage::helper('eav')->__('source model "%s" not found attribute "%s"',$this->getsourcemodel(), $this->getattributecode()) ); } // 389--> $this->_source = $source->setattribute($this); } return $this->_source; } the error outputs this: fatal error: call undefined method mage_adminhtml_model_system_config_source_yesno::setattribute() in /home/angeecom/public_html/app/code/core/mage/eav/model/entity/attribute/ab

jsf - How to Set the background color for h:commandButton in backing bean -

i have command button, when click that, background colour of button should changed. should done in backing bean method. how set colour command button in java method? tried 1 if (dt.equals(getdate())) { system.out.println("date equal...."); button.setbackground(color.yellow); } else { system.out.println("date different"); } but shows error cannot find method set background(java.awt.colour). you're making conceptual mistakes. you're confusing jsf swing. you're trying manipulate view in controller. to learn jsf is, start here . learn swing is, start here . not same. stop thinking in swing or searching swing solutions when developing jsf. as mvc aspect, backing bean controller. should manipulate model (bean's properties), not view (xhtml file). view (xhtml file) should access model (bean's properties) via controller (the managed bean instance). below right way: private boolean dateequal; public void someacti

sql - Using sequence.nextval in subquery -

i want create template (via sql) can copied straight ms excel. generally went pretty well, however, i've run problem field supposed store excel formula. field supposed used create insert statements in excel file, based on user input in 1 of columns of excel sheet. here's code: select -- other fields here [...], (select '="insert mytable values(" &c' || create_inserts_temp_seq.nextval || '&",''this column filled user in excel'',''"&d' || create_inserts_temp_seq.currval || '&"'',14,sysdate);"' dual) sql_statement mytable; i getting error message ora-02287: sequence number not allowed here . why not allowed in subquery? idea how fix this? i must have access these values in order create functioning excel formula, these numbers reference respective excel rows... the documentation includes restrictions, including: currval , nextval cannot used in these

What is proper way to get javascript object by Selenium webdriver in c# -

i have javascript object following var jsobj = { x: ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], y: [[29.9, 71.5, 106.4, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], [24, 70, 19, 128, 148, 178, 131, 140, 211, 190, 91, 50]], yname: ["mon-data", "mon-data2"] } i object selenium webdriver in console application ijavascriptexecutor js = webbrowser1 ijavascriptexecutor; string scp = "return window.jsobj ;"; var obj = (object)js.executescript(scp); i got object , have tried put value of object array following string[] xaxis=obj.x; string[] name=obj.yname; double[][] yaxis = obj.y; i have tried looping through obj got error. proper way handle kind of object in c#? call object ienumerable. allow use loop\foreach etc. foreach (var o

javascript - Disabling proxies using Jquery -

how can disable proxy setting in browser reporting server using javascript or jquery ? because reporting runs on static pages. i new jquery. i getting read timeout error due proxy settings. you cannot access advanced browser or os settings using javascript or jquery. period. and according comment andrea corbellini , if possible, great security vulnerability. this not comment, answer. hope there's nothing necessary answer.

datetime - How to find the first business date of a week in MATLAB? -

we can use fbusdate first business day of month : date = fbusdate(year, month); however, how first business day of week ? as example, during week i'm posting this, monday 09/07/2017 holiday in us: isbusday(736942) % = 0 how determine first business day week next day 736943 ? i'm not aware of builtin function returns first working day of week, can obtain requesting the next working day after sunday: busdate(736941); % 736941 = sunday 09/03/2017

javascript - How do I pause everything running on a webpage? -

i have piece of javascript code running in browser , want pause see values in console. i have lot of logs going on need see whats logged @ point through running script. i running chrome, there button or shortcut ? this looking for. https://developer.chrome.com/devtools/docs/javascript-debugging you can pause scripts , hover mouse on see variable values @ point in script. enjoy.

VHDL: slice a various part of an array -

i have std_logic_vector (0 639) . on incoming signal have iterate through vector , next 2 bits of it. i'm trying make like, integer counter : counter := counter+1; myvar := data((counter*2) ((counter*2)+1)); i following: error (10394): vhdl error @ module.vhd(227): left bound of range must constant upd: following suggested @user1155120: writing every single bit of vector every single corresponding bit of myvar myvar(0) := data(counter * 2); myvar(1) := data(counter * 2 + 1); works fine long use 2bit myvar , if want use 16-32-80bit variable? problem avoided, not solved. googling shows error message quartus ii (see id: 10394 ). lrm reference provides isn't particularly helpful, it's limitation on synthesis can't define variable width word size multiplexer. not smart enough detect both bounds referenced counter. what happens if express multiplexer each bit of myvar separately? (indexed name instead of slice name, 2 variable assignments my

c# - Return ID if record exist, else Insert and return ID -

i have below c# code check if record not exist, insert , return id. need if record exists, return value. change should make c# , sql part happen? database sql server. still have use executescalar() this? con.open(); // insert clinreffiletypemaster string command1 = string.format( "if not exists (select * [clinreffiletypemaster] [clinreftypename] = '{0}') insert [clinreffiletypemaster] ([clinreftypename]) output inserted.[clinreftypeid] values('{0}')", datatoparse[i][0] ); sqlcommand clinreffiletypemaster = new sqlcommand(command1, con); // check if there value object checkvalue = clinreffiletypemaster.executescalar(); if (checkvalue != null) clinreffiletypeid = (int)checkvalue; there many ways achieve this. 1) can in inline sql 2) can in stored proc. 3) can in code split code code frankly doing much. in general avoid insert/query in same method. also try use sqlparameters instead of building query string concat. i pr

c# - How do I debug "System.DllNotFoundException: The specified procedure could not be found"? -

i've got pinvoke wrapper set native dll, time try invoke it, crashes, saying system.dllnotfoundexception: specified procedure not found . things i've checked: the dll in same folder exe. dependency walker shows dll has 1 non-system dll dependency, , it's loaded (successfully) process point. it gives same error no matter function try call into, including dummy function no body. (so points 1 , 3 answer here not apply.) i've used dependency walker ensure functions being exported, same names, including case sensitivity. by point, i'm @ wits' end. how can debug , figure out what's going wrong? error message i'm getting spectacular pile of fail when comes usefulness; doesn't tell me name of procedure can't find. i'd debug first in native application. reasons explain later. put simple console app in same directory c# executable. have console app call loadlibrary , getprocaddress on dll p/invoking. same error occur?

Python magic function, how does it work? -

how magic function work (below) i.e. hex = '%032x' % self.int reason turns following value... 265631021230191344138857284998518456 into.... 0033289ed88646a64b9fc63c808fd6b8 def __str__(self): hex = '%032x' % self.int return hex but should knowledge append 032x end of string 265631021230191344138857284998518456 , whats going on? how does? full code here %x format code hex. function representing decimal value in hex. >>> hex(265631021230191344138857284998518456) '0x33289ed88646a64b9fc63c808fd6b8' the full format code '%032x' means represent value in hex , pad zeros on left until 32 characters wide.

node.js - Dockerizing npm & bower install using the digitallyseamless/nodejs-bower-grunt docker image -

i trying use docker in order run npm & bower install . here configuration: ./package.json { "name": "bignibou-client", "version": "0.1.0", "engines": { "node": "0.10.x" }, "devdependencies": { "bower": "1.3.12", "grunt": "~0.4.5", "grunt-contrib-uglify": "~0.6.0", "grunt-contrib-concat": "~0.5.0", "karma": "~0.12.23", "grunt-karma": "~0.9.0", "karma-junit-reporter": "~0.2.2", "karma-jasmine": "~0.1.5", "karma-phantomjs-launcher": "~0.1.4", "phantomjs": "~1.9.11", "grunt-mkdir": "~0.1.2", "grunt-contrib-cssmin": "~0.10.0", "grunt-contrib-clean": "~0.6.0", "grunt-con

mysql - Duplicate entry key for key primary -

i have encountered error on codes. says error code 1062, sql state 23000: duplicate entry '88889' key 'primary' line 15, column 1 error code 1062, sql state 23000: duplicate entry '87990' key 'primary' line 20, column 1 error code 1062, sql state 23000: duplicate entry '79678' key 'primary' line 25, column 1 error code 1062, sql state 23000: duplicate entry '88799' key 'primary' line 30, column 1 error code 1062, sql state 23000: duplicate entry '78998' key 'primary' line 35, column 1 and here code: create table if not exists studentrecord ( student_id varchar(7), stud_first_name varchar(15) not null, stud_last_name varchar(15) not null, stud_date_of_birth date not null, stud_address varchar(50) not null, stud_program varchar(20) not null, stud_marital_status int(2) not null, stud_country varchar(20) not null, primary key (student_id) ) engine=innodb; -- insert sample data insert studentr

recursion - Sequence 1, 3, 8, 18, 38, 78 from a recursive function -

i'm trying write recursive function in java display n element in mathematical number sequence (1 3 8 18 38 78). this i've managed far: public static int recfunc(int i) { if(i==1) { return 1; } if(i==2) { return 2+recfunc(i-1); } if(i==3) { return 5+recfunc(i-1); } if(i>3) { return ((2^(i-3))*5)+recfunc(3); } return 0; } to calculate n(>3), add 2^(i-3) each step(i>3) , add 8 in end. so, 6th element, have calculation: 40 + 20 + 10 + 8 = 78. the problem above code calculates increase in number between 2 n(s) , ads 5 + 2 + 1 (8) it, doesn't apply previous steps (20 + 10). update: i'm getting somewhere, still doesn't should. public static int recfunc(int i, boolean param) { if(param==false) { if(i==1) { return 1; } if(i==2) { return 2+recfunc(i-1, false); } if(i==3) { return 5+recfunc(i-1, false); } if(i>3) { param = true; } } if(param==true) { if(i==4) { ret

c# - DateTime.Parse takes min date value if null -

i have asp.net application in have textbox enter datetime value , saved in database. now when trying retrieve date, shows 1/1/0001 12:00:00 if date null. this.firstreceiveddate = datetime.parse(dr["firstreceiveddate"].tostring()); apologies, requirement changed. want show blank ('') if firstreceiveddate null. how can that? you try below: datetime date = datetime.parse(dr["firstreceiveddate"].tostring()); this.firstreceiveddate = date != datetime.minvalue ? date : datetime.now; since parsing correctly, ought work. alternatively, if want value when date null, can try this: datetime date; if(datetime.tryparse(dr["firstreceiveddate"], out date)) this.firstreceiveddate = date != datetime.minvalue ? date : datetime.now; else this.firstreceiveddate = datetime.now; // or whatever want if "firstreceiveddate" not valid date.

python - CSS not working in some pages on Django -

i beginner in python , django , have been struggling following problem: on localhost:8000/ webiste beautiful , working fine on localhost:8000/invoice/ references not working. css example not work images , javascript do. i using relative links point out path is. <script src="{% static "js/jquery.min.js" %}"></script> <script src="{% static "js/skel.min.js" %}"></script> <script src="{% static "js/skel-layers.min.js" %}"></script> <script src="{% static "js/init.js" %}"></script> <noscript> <link rel="stylesheet" href="{% static "css/skel.css" %}"/> <link rel="stylesheet" href="{% static "css/style.css" %}"/> <link rel="stylesheet" href="{% static "css/style-xlarge.css" %}"/> </noscript>

recursion - How to define recursive list type in Scala? -

i want create flatten function, take list of various depth , transform flat list. for example, integers can take list(1, list(2, 3)) , return list(1, 2, 3) . how declare function correctly? def flatten(list: list[???]): list[t] looks have use any because depth of list unknown. def flatten(input: list[any]): list[any] = input match { case nil => nil case head :: tail => head match { case list: list[_] => flatten(list) ::: flatten(tail) case elem => elem :: flatten(tail) } } scala> flatten(list(1, list(2, 3))) res0: list[any] = list(1, 2, 3) if want see couple implementation options check here , , tests here .

javascript - jQuery - How to start a script when the scroll reaches the block? -

i'm using jquery " homemade " script (that found here) , i'de start 1 when scroll reaches tab block (the blue , grey block @ end of page) . here live version my html : <section id="block" class="container-fluid block"> <div class="row accordeon"> <div class="blue"> <ul class="nav nav-tabs" id="mytab"> <li class="active"><a href="#deposer">1 - déposez un projet appel d’offre et recevez en moyenne 10 devis</a></li> <li><a href="#comparer">2 - comparez les devis et négociez librement</a></li> <li><a href="#choisir">3 - choississez le prestataire que vous voulez, quand vous voulez</a></li> <li><a href="#payer">4 - payez le prestataire par le moyen de votre choix</a&g

c# - two queries in same method -

i trying execute 2 queries in same method gives me exception. can red of exception declaring new command there way use same command? string id="hi"; connection.open(); oledbcommand command1 = new oledbcommand(); command1.connection = connection; string query1 = "select * products category='" + combobox1.text + "' , subcategory = '" + combobox2.text + "' , sizes='" + combobox3.text + "'"; command1.commandtext = query1; oledbdatareader reader = command1.executereader(); while (reader.read()) { id = reader[0].tostring(); } textbox1.text = id; string query = "insert category_in (category_id,amount,amount_in) values ('"+ id+"' ,500,300)"; command1.commandtext = query; command1.executenonquery(); messagebox.show("saved"); connection.close();

Reverse polish notation C++ -

i've written code in c++ problem is valid one-digit number , i'd know can change or modify valid multi-digits numbers #include <iostream> #include <stack> #include <string> #include<vector> #include<sstream> using namespace std; bool op(char b) { return b=='+' || b=='-' || b=='*' || b=='/' ; } bool prio(char a, char b) { if(a=='(') { return true; } if(a=='+' || a=='-') { return true; } if(b=='+' || b=='-') { return false; } return true; } double posfix ( const std::string& expression ) { double l,r,ans; std::stringstream postfix(expression); std::vector<double> temp; std::string s; while ( postfix >> s ) { if( op(s[0]) ) { //pull out top 2 elements r = temp.back(); temp.pop_back();

Laravel unknown routing error -

i'm making authentication system laravel, there wrong. when i'm making page can viewed admin receive error: > notfoundhttpexception in routecollection.php line 143: in routecollection.php line 143 @ routecollection->match(object(request)) in router.php line 746 @ router->findroute(object(request)) in router.php line 655 @ router->dispatchtoroute(object(request)) in router.php line 631 @ router->dispatch(object(request)) in kernel.php line 236 @ kernel->illuminate\foundation\http\{closure}(object(request)) @ call_user_func(object(closure), object(request)) in pipeline.php line 139 @ pipeline->illuminate\pipeline\{closure}(object(request)) in verifycsrftoken.php line 50 @ verifycsrftoken->handle(object(request), object(closure)) @ call_user_func_array(array(object(verifycsrftoken), 'handle'), array(object(request), object(closure))) in pipeline.php line 124 @ pipeline->illuminate\pipeline\{closure}(object(request)) in shareerrorsfromsessio

java - Spring profile not properly applied to tests involving @Configurable -

i have weird situation, has happened in several systems already. using spring boot , aspectj ctw @autowired dependencies in entities (instanciated outside container). the class receives dependencies (an abstract entity) times receive dependency without applying profile (configured @activeprofile in test class). not deterministic, since changing how tests executed different outputs can happen. illustrate situation code: the entity @configurable public class abstractmongodocument<t> implements persistable<t> { @transient private transient mongotemplate mongotemplate; //entity stuff } one of failing tests @runwith(springjunit4classrunner.class) @springapplicationconfiguration(classes = lovapplication.class) @activeprofiles("local-test") public class mycrazyintegrationtest { @test public void filterbyfieldsfullmatchshouldreturnresult() throws exception { //given location l1 = new location("name","code&quo

AngularJS Custom Directive based on class expression -

i attempting utilize nested custom directives produce complete survey form. custom survey tag contains repeated group tags contain repeated question tags. different question types handled separate directives based on type id. question directives elements class matches question type id. <div ng-repeat='q in g.questions track $index' class='{{q.squt_id}}'>...</div> i believe problem expression being evaluated after directives applied. thoughts or ideas here? locked using type id unique way determine question types. app.directive('1',function() { return { restrict: 'c', ... } }); you can create base directive, use every type , pass type id parameter. in directive can create switch , use ng-if , dynamically add type directive name in base directive template or else. i don't think can dynamically add directive name in view.

soap - WSO2 ESB: Custom URL -

i have created proxy custom url, based on: http://wso2.com/library/knowledge-base/2011/01/custom-urls-wso2-esb-proxy-services/ calling custom url soap message results in error, can still use original url. custom: /services/wss/planningophaalserviceproxy_v1 original: /services/planningophaalserviceproxy_v1 the error: tid: [0] [esb] [2015-08-19 15:47:05,039] error {org.apache.axis2.engine.axisengine} - invalidsecurity {org.apache.axis2.engine.axisengine} org.apache.axis2.axisfault: invalidsecurity @ org.apache.rampart.handler.postdispatchverificationhandler.invoke(postdispatchverificationhandler.java:151) @ org.apache.axis2.engine.phase.invokehandler(phase.java:340) @ org.apache.axis2.engine.phase.invoke(phase.java:313) @ org.apache.axis2.engine.axisengine.invoke(axisengine.java:261) @ org.apache.axis2.engine.axisengine.receive(axisengine.java:167) @ org.apache.synapse.transport.passthru.serverworker.processentityenclosingr

ios - How can I create a piechart that looks like a pie using CorePlot? -

Image
the graph on left 1 coreplot gallery demo, 1 on right 1 created code below. think i missing in order make actual circular pie : -(void)configurechart { // 1 - reference graph piechartgraph = [[cptxygraph alloc] initwithframe:self.piechartgraphhostview.bounds]; self.piechartgraphhostview.hostedgraph = piechartgraph; // 2 - create chart piechart = [[cptpiechart alloc] init]; piechart.datasource = self; piechart.delegate = self; // piechart.pieradius = (self.piechartgraphhostview.bounds.size.height * 0.7) / 2; piechart.pieradius = (self.piechartgraphhostview.bounds.size.height * 0.7) / 2; piechart.identifier = piechartgraph.title; piechart.startangle = cptfloat(m_pi_4); piechart.slicedirection = cptpiedirectionclockwise; piechart.borderlinestyle = [cptlinestyle linestyle]; // 3 - create gradient cptgradient *overlaygradient = [[cptgradient alloc] init]; overlaygradient.gradienttype = cptgradienttyperadial; overl

where to deploy a web2py app that uses websockets? -

i asked question , seems pythonanywhere doesn't support websockets. pythonanywhere - how use websockets transmit messages per web2py messaging example? so question deploy app effortlessly possible? right when run locally easy as python web2py.py & python websocket_messaging.py -p 8888 -k mykey it's not going easy pythonanywhere, deploy vps, such digital ocean. make things easier, use 1 of web2py deployment scripts, such https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh . once have basic server set up, you'll still need install tornado , follow other instructions using websocket_messaging.py.

php - To clean/fill table after table in the correct order, can I simply sort all tables based on FKs? -

this more conceptual question. i have scheduled task many input tables (sqlite) table1 ... tablen , need perform series of delete/insert mysql, processing table after table. read sqlite table -> empty mysql table -> fill mysql table of course if (mysql) table1 has foreign key poiting table2 , table2 should deleted , filled before table1 . manually sort incoming tables, it's not idea 30+ table , can lead errors. set foreign_key_checks = 0 not option . so problem sorting mysql table based on number of incoming fks (high low), like: // doctrine dbal example it's understandable $schema = $this->connection->getschemamanager(); // init chart keys table names, values # of incoming fks $chart = array_fill_keys($schema->listtablenames(), 0); // build chart foreach ($schema->listtables() $table) { foreach ($table->getforeignkeys() $foreignkey) { $chart[$foreignkey->getforeigntablename()]++; } } // sort high low values arsort

mysql - PHP syntax error or access violation: 1064 - using variable in where clause -

pulling hair out on one, i've tried number of things in terms of changing escape characters variable , nothing working including changing '". $r."' etc. if hard code variable constant works. e.g $r = "word"; i've renamed variables random letters in case reserved words. i've gone far setting logging mysql , have compared statements , they're identical, difference being 1 submitted via text box , other has been set constant. model: public static function searchprofile() { $r = request::post('w'); $args = ""; if ($r) {$args = "`info_tradingstatus` = '$r'";} $database = databasefactory::getfactory()->getconnection(); $sql = "select profile_id, profile_name profile_seeker $args"; view: <input type="text" name="w" class="form-control" placeholder="enter keyword" aria-describedby="basic-addon1"> cont

php - Change select dropdown based on first select dropdown? -

i trying change second select dropdown based on whether first selected option contains (m) or (ft). my form html search follows: <form id="search" action="/property_search" method="get" class="clearfix"> <select name="sqsize" id="sqsize" class="sqsize"> <option value="">sq.ft/sq.m:</option> <option value="233.52m">233.52m</option> <option value="233.52m">233.52m</option> <option value="467.04m">467.04m</option> <option value="2,513ft">2,513ft</option> <option value="2,513ft">2,513ft</option> <option value="5,026ft">5,026ft</option> </select> <select name="sqsizemin" id="sqsizemin" class="sqsizemin">

html - Single page: set elements at bottom of page in any browser or device -

Image
i developing website have top menu , background image text on home page. covers whole screen. @ bottom of screen there have 3 blocks show @ bottom of screen or device. able to chrome firefox example blocks way far down @ ie same... want: i doing applying following code on div containing 3 blocks: position: relative; top: -150px; but mentioned above in browser div shows low user won't see until scrolls... any solutions here? simple change: position: fixed; bottom: 0; better idea wrap inside <div class="bottom-stuff"> , give rules .bottom-stuff .

scala - trait Enumeratee is invariant in type From when using ADT -

i trying compose enumeratee.grouped , enumeratee.filter make new enumeratee running variance issue. input , output types of enumeratee adts , following error. <console>:24: error: type mismatch; found : play.api.libs.iteratee.enumeratee[outputtype,outputtype] required: play.api.libs.iteratee.enumeratee[product serializable outputtype,outputtype] note: outputtype >: product serializable outputtype, trait enumeratee invariant in type from. may wish define -from instead. (sls 4.5) i have recreated issue smaller example here (i understand example rewritten enumeratee.collect however, unless there way combine enumeratee.grouped , enumeratee.filter not me.) import play.api.libs.iteratee.enumeratee import scala.concurrent.executioncontext.implicits.global sealed abstract class inputtype case class inputa(counter: int) extends inputtype case object inputb extends inputtype sealed abstract class outputtype case class outputa(msg: string) extends outputtype case obj

android - Google Vision barcode library not found -

i'm trying use new feature in google play services (vision) add qr code scanning application. when run app this: i/vision﹕ supported abis: [armeabi-v7a, armeabi] d/vision﹕ library not found: /data/data/com.google.android.gms/files/com.google.android.gms.vision/barcode/libs/armeabi-v7a/libbarhopper.so i/vision﹕ requesting barcode detector download. i have declared barcode dependency per tutorial: <meta-data android:name="com.google.android.gms.vision.dependencies" android:value="barcode" /> i tried reinstalling app , restarting phone, nothing helps. using google play services 7.8, version installed on device 7.8.11. compile 'com.google.android.gms:play-services-vision:7.8.0' code used creating barcode detector: boolean initbarcodedetector() { final barcodetrackerfactory barcodetrackerfactory = new barcodetrackerfactory(this); final multiprocessor<barcode> multiprocessor = new multiprocessor.builder<>(b

cassandra - best storage place for a temporary string? -

our application generates short-lived string, dozen chars, supposed consumed our clients later once. after consumption gone. or becomes invalid in 10 minutes without consumption. storage of string needs global requests consuming string stateless. we have been using global cache before storing string. works function-wise. however, not fit semantically. there have been incidents before when cache server down, our application cannot function correctly. searching alternatives global cache storing short temporary string. needs be global fast write fast read fast delete supports timeout update never concern. nosql sounds better place rdbms not totally sure. recommendations/suggestions/hints appreciated for cassandra: high availability - yes global - yes fast write - yes fast read - yes fast delete - yes, beware of creating tombstones. if looking global queue, anti-pattern in cassandra. if want each client latest string (i.e. overwrite last value on insert), you

python - Split check_output return value -

i trying run unix command using python, have got code return value want, not seem let me split value on delimiter have specified import subprocess subprocess import check_output def runfping(command): output = check_output(command.split(" ")) output = str(output).split(" : ") return output print runfping("fping -c 1 -q 192.168.1.25") the output is: 10.1.30.10 : 29.00 [''] it looks fping writing stderr. capture both stderr , stdout output using check_output , use output = check_output(command.split(" "),stderr=subprocess.stdout) see https://docs.python.org/2/library/subprocess.html#subprocess.check_output in code #!/usr/bin/env python import subprocess subprocess import check_output def runfping(command): output = check_output(command.split(" "),stderr=subprocess.stdout)) output = str(output).split(" : ") return output if __name__ == "__main__": print

centos - linux install command not working quite right -

trying create spec file install number of files (where number , layout of files may change) without having manually create target directory structure or specify individual files. i looked @ install command: # install --help usage: install [option]... source dest (1st format) or: install [option]... source... directory (2nd format) or: install -d [option]... directory... (3rd format) in first 2 formats, copy source dest or multiple source(s) existing directory, while setting permission modes , owner/group. in third format, create components of given directory(ies). ... -d, --directory treat arguments directory names; create components of specified directories -d create leading components of dest except last, copy source dest; useful in 1st format looks -d want - creates directory structure me! ran: install -v -d -m 644 /usr/src/redhat/build/samples/lib/* /var/tmp/samples-6.0.0-

sql server - test connection failed because of an error in initializing provider - SSIS -

Image
below machine information: windows server 2003, service pack 2, 32 bit. ssis package developed on sql server 2005. connection string : data source=source;user id=xxx;provider=msdaora.1;persist security info=true when i'm trying connect oracle db showing error (test connection failed because of error in initializing provider).how can know, oracle client need install this. checked here ( https://social.msdn.microsoft.com/forums/sqlserver/en-us/0819acf0-f53e-402a-8113-e8d87f8def5b/test-connection-failed-because-of-an-error-in-initializing-provider-oracle-client-and-networking?forum=sqlintegrationservices ). answer seems different versions. how know, install , install ? please suggest proper link. hope have explained correctly. screenshot attached the server registry shows this:

ios - Where should the true delegate of an adapted view be implemented? -

i going try , setup app can use either apple map or google map, think have this: class applemap: mkmapview, mymapprotocol { var delegate: mymapdelegateprotocol ... } class googlemap: gmsmapview, mymapprotocol { var delegate: mymapdelegateprotocol ... } both mkmapview , gmsmapview each have delegates. many of calls these delegates translated , passed apple/googlemap delegate, need handled uniquely (such viewforannotaion) the question should mkmapviewdelegate , gmsmapviewdelegate implemented? i thinking applemap , googlemap classes, figure common thing (wrapping class has delegate in adapter class), have not seen best practices documented. you implement them independent model classes code remains encapsulated rest of application. variables these objects can live in custom mapchildviewcontroller object manages logic between these maps you. allowing reuse logic across app. how sound?

javascript - How can I augment an isolate directive scope before a directive-controller is instantiated? -

i compiling , linking directive isolate scope (please note manual compiling , linking reasons outside scope of question): outerelement = angular.element(domelement); $injector = outerelement.injector(); $compile = $injector.get('$compile'); gettheisolatescopeformydirectiveinstance().myproperty = 'foo'; // pseudocode. want myproperty available on scope inside controller constructor function. link = $compile(angular.element('<my-directive></my-directive>')); // iiuc, following line instantiate // controller directive, injecting // isolate scope. want augment // isolate scope injected *before* // injected. // value augment scope resides in // *this* execution context. // how can so? renderedelement = link(outerelement.scope()); element.append(renderedelement); mydirective has isolate scope (the 1 want augment), , controller associated it. the controller mydirectivecontroller

c# - Can't find XML in httprequest -

i have existing asp page largely can't/won't change calls service, sending xml document. private function queryxyz(byval strstreet1 string, _ byval strstreet2 string, _ byval strcity string, _ byval strstate string, _ byval strzipmain string, _ byref objdomdoc domdocument, _ byref blnstreetmatch) boolean on error goto errorhandler dim intcount integer dim lngerrnum long dim objresult ixmldomnode dim objresultset ixmldomnodelist dim objxmlhttp new serverxmlhttp dim strerrdesc string dim strfault string dim strmessage string dim strresults string dim strsoap string 'co 11784 - start 'build soap xml request strsoap = _ "<soap:envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/xmlschema-instance/' xmlns:xsd='http://www.w3.org/2001/xmlschema/'>

How to structure falcor router to get all available IDs? -

i'm experimenting using falcor front guild wars 2 api , want use show game item details. i'm interested in building router can use multiple datasources combine results of different apis. the catch is, item ids in guild wars 2 aren't contiguous. here's example: [ 1, 2, 6, 11, 24, 56, ... ] so can't write paths on client items[100..120].name because there's going bunch of holes in list. i've tried adding route router can request items , sends infinite loop on client. can see attempt on github . any pointers on correct way structure this? think more maybe want item.id instead? you shouldn't find self asking ids falcor json graph object. it seems want build array of game ids: { games: [ { $type: "ref", value: ["gamesbyid", 352] }, { $type: "ref", value: ["gamesbyid", 428] } // ... ], gamesbyid: { 352: { ga

objective c - How to tell what UIViewController a custom UITableViewCell Xib is on? -

i want find out viewcontroller custom table view cell located on. i'm using ui hierarchy inspector , don't see name of view controller, says uitableview super view of cell. is there definitive way inspect cell , find out view appears on top of? if can't in uihierachy inspector, how can this? you can achieve using associative references. not pretty, , not easy use effective on being able associate object another. here link tutorial on how work. associative references after digesting can plan associate view controller / view tableview cell on iteration (cell row @ index path maybe) and delegate method did select row @ index path able obtain associative reference , know view controller needs manipulated.

JAVA Android: Darkening black letters/texts on a bitmap -

i want darken black text on bitmap filter the bitmap , after research found this: private static void setcontrast(colormatrix cm, float contrast) { float scale = contrast + 1.f; float translate = (-.5f * scale + .5f) * 255.f; cm.set(new float[] { scale, 0, 0, 0, translate, 0, scale, 0, 0, translate, 0, 0, scale, 0, translate, 0, 0, 0, 1, 0 }); } my present challenge applying on bitmap darken black texts. kindly assist me. i able find answer question using https://stackoverflow.com/a/17887577/5220210 , http://android.okhelp.cz/bitmap-set-contrast-and-brightness-android/ public static bitmap darkentext(bitmap bmp, float contrast) { colormatrix cm = new colormatrix(); float scale = contrast + 1.f; float translate = (-.5f * scale + .5f) * 255.f; cm.set(new float[] { scale, 0, 0, 0, translate,

focus - QML Keys weird / buggy behavior - event sent to the wrong object -

Image
i experiencing weird behavior when handling qml keyboard events. in example, object tree can created, selecting tree element, plus , minus keys should append , remove elements of selected branch, , spacebar should expand or contract selected branch. but doesn't work expected. while plus , minus work on active element, spacebar always expand/contract root element regardless of element selected. oddly enough, using mouse right button works on correct element expected, achieving desired behavior. both spacebar , right mouse button use practically same code, reason, using spacebar invokes function of root node, not on 1 in focus, should receiving keyboard events. here relevant part of code: ui { id: ui expanded: true uilist { model: ui.proxy.model() } rectangle { width: 50 height: 50 color: ui.activefocus ? "red" : "darkred" mousearea { anchors.fill: parent accepted

programming languages - Requirements for optimal time complexity for every algorithm? -

the time complexity of algorithms can differ programming language programming language in implemented, because of things not possible done in 1 language opposed other. turing-completeness doesn't time complexity possibilities of said languages. my question is, requirements programming language able solve every algorithm in best time complexity possible language? being turing-complete , added possibility inspect/edit datastructures in constant time enough? i think it's provably impossible build single programming language or model of computation can optimally solve every computational problem. there's result in theoretical computer science called time hierarchy theorem says many functions f(n), there many problems can solved in time o(f(n)) on turing machine not time o(f(n) / log n). proof of result works this: consider problem "does turing machine m reject input w within f(|w|) steps?" can show can solve deterministically in time o(f(n) k ) k sim

objective c - Return 2 variable in -(CGFloat) -

i want return 2 arguments in method -(cgfloat) . try many way can't. here code. want return both of them "heightspace" , "widthspace". -(cgfloat) spacebetweenledcenterwhennumberledisknown: (int) n andm: (int) m { cgfloat heightspace = (self.view.bounds.size.height - 2 * _heightmargin) / (n - 1); cgfloat widthspace = (self.view.bounds.size.width - 2 * _widthemargin) / (m - 1); return [self spacebetweenledcenterwhennumberledisknown:heightspace andm:widthspace]; } i have solve problems cgsize. here final code. thank zaph. -(cgsize) coutingspacebetweenledinheight: (int) height andwidth: (int) width { cgfloat heightspace = (self.view.bounds.size.height - 2 * _heightmargin) / (height - 1); cgfloat widthspace = (self.view.bounds.size.width - 2 * _widthmargin) / (width - 1); //typedef struct cgsize cgsize; return cgsizemake(heightspace, widthspace);} return cgsize , contains 2 cgfloats named width , height . the caller can obtain

html - Using ng-click in ng-repeat with $index -

i'm trying use ng-click on div ng-repeat element using $index shown below : html: <div class="elementcontainer" ng-repeat="element in elements" ng-click="elementurl($index)"> <h2>{{ element.name }}</h2> <p><strong>{{ element.description }}</strong></p> </div> js file: var app = angular.module('portfolioapp', []); app.controller('maincontroller', ['$scope', function($scope) { $scope.elements = [ { "name": "1", "description": "abcd" }, { "name":"2", "description": "lmno" }, { "name": "3",