Posts

Showing posts from August, 2013

javascript - Root route component not connecting to redux -

i'm stuck on problem seems obvious: root component of router not being subscribed store changes , it's not receiving props though mapstatetoprops called. my routes defined plain objects: const createroutes = (store) => { path: '/', component: rootcomponent, indexroute: home, childroutes: [ subroute ] } export default createroutes then import object when creating app: let render = () => { const routes = require('./routes').default(store); reactdom.render( <appcontainer store={store} routes={routes} />, mount_node ) } my rootcomponent looks this: const rootcomponent = ({address, action}) => { <div> {console.log('addr: ' + address)} <button onclick={action}>test</button> </div> } const mapstatetoprops = (state) => { console.log('mapstatetoprops

Android Crashlytics Not Capturing All Crashes -

i using fabric.io crashlytics capturing crashes occurring in app. isn't capturing crashes on layout files. there anyway crashes well, or doing wrong? whenever crashed occurs on layout file, crashlytics not giving me logs that. or there might alternative achieving purpose?

c++ - What am i doing wrong with these random numbers? -

i've been told rand() mod n produces biased results, tried make code check it. generates s numbers 1 l , sorts occurrences. #include <iostream> #include <random> using namespace std; struct vec_struct{ int num; int count; double ratio; }; void num_sort(vec_struct v[], int n){ (int = 0; < n-1; i++){ (int k = 0; k < n-1-i; k++){ if (v[k].num > v[k+1].num) swap(v[k], v[k+1]); } } } void count_sort(vec_struct v[], int n){ (int = 0; < n-1; i++){ (int k = 0; k < n-1-i; k++){ if (v[k].count < v[k+1].count) swap(v[k], v[k+1]); } } } int main(){ srand(time(0)); random_device rnd; int s, l, b, c = 1; cout << "how many numbers generate? "; cin >> s; cout << "generate " << s << " numbers ranging 1 to? "; cin >> l; cout << "use rand or mt19937? [1/2] "

ubuntu - How to set python installed path? -

my pyhton2.7 installed in /usr/local/lib. if type which python2.7 , can have /usr/local/bin/python2.7 . set pythonpath in ~/.bashrc as export pythonpath="/usr/local/bin/python2.7:$pythonpath" i install pip , virtual environment. tried as sudo apt-get install python-pip python-dev python-virtualenv i had error , still looking python in /usr/lib . error is reading package lists... done building dependency tree reading state information... done python-dev newest version. python-pip newest version. python-virtualenv newest version. 0 upgraded, 0 newly installed, 0 remove , 362 not upgraded. 1 not installed or removed. after operation, 0 b of additional disk space used. want continue? [y/n] y setting python2.7 (2.7.6-8ubuntu0.2) ... python2.7: can't open file '/usr/lib/python2.7/py_compile.py': [errno 2] no such file or directory dpkg: error processing package python2.7 (--configure): subprocess installed post-installation script returned error e

java - Mysql query with In clause regex -

i have sql query this: "select f.filterid filtename, f.id filtertext " + "from filter f " + "where group_id = '" + id +"' " + "or groupids '%." + id + ".%' "; and want pass list of ids query make performance better. don't know whether regex works in in clause. , tried below 1 not working , not sure use in case of regex. "select f.filterid filtename, f.id filtertext filter f " + "where group_id in ("+stringutils.join(ids, "','")+")" + "or groupids in ("+stringutils.join(ids, "','")+")""; thanks. i recommend use query#setparameter achieve this, if using jpa can supply ids list in setparameter. but current resolution may try below changes. not sure if group_id column expects integer or string datatype, propose changes either of cases. if expects string - missing start

web - How to prepare a list of domain for Content-security-policy? -

going prepare list of domains content-security-policy, i'd if it's possible use scanner following features: the scanner should find , analyze existing pages either using sitemap or following links (found on pages) the scanner should find , list domains used load remote media such images, scripts, css, fonts, etc mime types of such media (which loaded domain list). anybody here knows such scanner? great if share link it. regards, alex.

configuration - WebSphere Liberty Profile blocking on Datasource lookup -

i'm trying configure datasource in ibm websphere liberty profile (16.0.0.3) , i've done far: server.xml <authdata id="dbuser" password="{xor}blablabla" user="my_user"/> <datasource id="oracle" isolationlevel="transaction_read_committed" jdbcdriverref="oracledriver" jndiname="epms_ds" recoveryauthdataref="dbuser" type="javax.sql.connectionpooldatasource"> <properties.oracle databasename="dbname" portnumber="1521" servername="servername"/> </datasource> <jdbcdriver id="oracledriver" javax.sql.connectionpooldatasource="oracle.jdbc.pool.oracleconnectionpooldatasource" libraryref="shared-library"/> web.xml <resource-env-ref> <description>the oracle ds</description> <resource-env-ref-name>jdbc/oracleds</resource-env-ref-name

writing output on file doesn't work in python -

i have code below write out list of n-grams in python. from nltk.util import ngrams def word_grams(words, min=1, max=6): s = [] n in range(min, max): ngram in ngrams(words, n): s.append(' '.join(str(i) in ngram)) return s email = open("output.txt", "r") line in email.readlines(): open('file.txt', 'w') f: line in email: prnt = word_grams(email.split(' ')) f.write("prnt") email.close() f.close() when print out word_grams prints out files correctly when comes writing output files.txt doesn't work. "file.txt" empty. so guess problem must within these lines of codes: for line in email.readlines(): open('file.txt', 'w') f: line in email: prnt = word_grams(email.split(' ')) f.write("prnt") email.close() f.close() 1) final f.close() e

netty - Is there a possibility that pipeline.fireChannelActive() is executed twice when executing ServerBootstrap.bind()? -

all following code netty4.0.31.final. serverbootstrap 's channel nioserversocketchannel . the main logic of serverbootstrap.bind(int) in abstractbootstrap.dobind(socketaddress) : private channelfuture dobind(final socketaddress localaddress) { final channelfuture regfuture = initandregister(); ... if (regfuture.isdone()) { ... dobind0(regfuture, channel, localaddress, promise); ... } else { regfuture.addlistener(new channelfuturelistener() { @override public void operationcomplete(channelfuture future) throws exception { ... dobind0(regfuture, channel, localaddress, promise); } }); } } the code in initandregister() goes abstractunsafe.register0(channelpromise promise) : private void register0(channelpromise promise) { try { ... boolean firstregistratio

signals - Interrupt a java application -

i have following problem: run iterative algorithm written in java on workstation. workstation uses sge under hood. each job have set soft , hard time limit. when soft time limit reached, running program receives sigusr1. when hard time limit reached, sigkill instead. i able handle sigusr1 stopping @ current iteration , writing current solution file. canonical way in c application trap signal in signal handler, set boolean flag checked periodically during iteration , triggers termination. the java program looks this: public class testinterrupt { public static volatile boolean shouldterminate = false; public static void main(final string[] args) throws interruptedexception { int = 0; while (++i < 100) { thread.sleep(1000); if(shouldterminate) { break; } } // write data file here. } } there no signal handlers in java (afaik). wrapped java application in bash scrip

utf 8 - How to set default-encoding in undertow subsystem as utf-8 with a CLI script? -

i'm running wildfly10 application server. noticed changed default encoding in standalone.xml configuration file utf-8, change got erased server rebooted. then read should use cli script. now, how can that? form of cli script add attribute default-encoding="utf-8" undertow subsystem follows: here's unmodified part of standalone.xml: <subsystem xmlns="urn:jboss:domain:undertow:3.0"> <buffer-cache name="default"/> <server name="default-server"> <http-listener name="default" socket-binding="http" redirect-socket="http"/> <host name="default-host" alias="localhost"> <location name="/" handler="welcome-content"/> <filter-ref name="server-header"/> <filter-ref name="x-powered-by-header"/> </host

php - Loading custom class in laravel without dump autoload -

i have directory /libraries/ under /app/ . libraries suppose hold custom files , classes. i'm putted new file there doesn't work because need dump-autoload .. problem can't this. no access terminal etc.. i have in composer.json "autoload": { "classmap": [ "app/commands", "app/controllers", "app/models", "app/database/migrations", "app/database/seeds", "app/libraries", // <<----- 1 "app/tests/testcase.php" ] }, another file in libraries beginning working fine. my question how can load new file? you can try tried , it's worked me. navigate vendor/composer/ . since you've said have 1 php file in libraries , it's working means have in followed files , can copy/paste lines , change files. first open file autoload_classmap.php , add @ bottom of array 'yourfile' =>

mysql - PDI Timestamp : Unable to get timestamp from resultset at index 5 -

i have transformation in pdi read data amazon s3 bucket , push data mysql database.but today facing below error in pdi in time of transformation execution. org.pentaho.di.core.exception.kettledatabaseexception: couldn't row result set timestamp : unable timestamp resultset @ index 5 value '37467412015-04-18 13:58:472015-04-18 13:58:4700000-00-00 00:00:001:138' can not represented java.sql.timestamp @ org.pentaho.di.core.database.database.getrow(database.java:2397) @ org.pentaho.di.core.database.database.getrow(database.java:2368) @ org.pentaho.di.trans.steps.tableinput.tableinput.processrow(tableinput.java:145) @ org.pentaho.di.trans.step.runthread.run(runthread.java:62) @ java.lang.thread.run(thread.java:745) caused by: org.pentaho.di.core.exception.kettledatabaseexception: i have used zerodatetimebehavior = converttonull option in pdi

angularjs - Getting an error trying to install ibm_db via npm -

i using windows os. have no admin rights in system working. following link https://www.ibm.com/developerworks/community/blogs/pd?lang=en . but got error npm err! ibm_db@0.0.18 install: node installer/driverinstall.js npm err! exit status 1 npm err! npm err! failed @ ibm_db@0.0.18 install script 'node installer/driverinstall.js'. npm err! make sure have latest version of node.js , npm installed. npm err! if do, problem ibm_db package, npm err! not npm itself. npm err! tell author fails on system: npm err! node installer/driverinstall.js npm err! can information on how open issue project with: npm err! npm bugs ibm_db npm err! or if isn't available, can info via: npm err! npm owner ls ibm_db npm err! there additional logging output above. i have installed it. have used nodejs v0.12.7 , npm 3.8.5 , installed without giving -g i.e. locally working fine me.

ios - Archive Validation failed Xcode 8 -

Image
i m trying ios app public release in xcode 8 error validation failed: try uploading application loader. goto xcode > open dveloper tool > application loader

javascript - Select2.js setting the default value to select box with array of input -

i wanted set default value select2 box here data using var countries = [ // africa "algeria", "angola", "benin", "botswana", "burkina faso", "burundi", "cabo verde", "cameroon", "cape verde", "central african republic", "chad", "comoros", "congo", "cote d'ivoire", "djibouti", "egypt", "equatorial guinea", "eritrea", "ethiopia", "gabon", "gambia", "ghana", "guinea", "guinea-bissau", "ivory coast", "kenya", "lesotho", "liberia", "libya", "madagascar", "malawi", "mali", "mauritania", "mauritius", "

windows - How to detect which screen is the OSVR headset? -

i have wpf+sharpdx windows application displays osvr hdk via fullscreen window on screen hdk. setup works well, requires users state screen hdk on. i have automatically detected, haven't seen in api on screen headset. currently render in window: var bounds = dxgidevice.adapter.outputs[_selectedoutput].description.desktopbounds; form.desktopbounds = new system.drawing.rectangle( bounds.x, bounds.y, bounds.width, bounds.height); and _selectedoutput is thing i'm looking for. i don't support direct mode @ time , i'm using managed-osvr. application run on windows 8/8.1/10. it's been while since coded osvr, here's remember: if you're running in extended mode, osvr treated regular display. can rearrange other screen. output location can configured in osvr config file. used following (java) retrieve position , size set window: osvrcontext.getrendermanagerconfig().getxposition() osvrcontext.getrendermanagerconfig().getyposition() osvrcont

lambda - Java 8 Optional how to deal with too many orElses -

let's take @ example without lambdas: credentials credentials = credentialservice.get(id); if (credentials != null && credentials.isactive()) { user user = userservice.get(credentials.getuserid()); if (user != null) return status.ok(user); } return status.bad(); as can see, status.ok() returned if user isn't null . otherwise, status.bad() returned. lambdas (service's methods returns optional<t> ): return credentialservice.get(id) .filter(credentials::isactive) .map(credentials -> userservice.get(credentials.getuserid()) .map(status::ok) .orelse(status.bad()) ).orelse(status.bad()); now have return status.bad() 2 times (in real code, 4-5). way return status.bad() once? i can guess userservice::get return optional in case better use flatmap: credentialservice.get(id) .filter(credentials::isactive) .flatmap(credentials -> userservice

Scala Breeze DenseMatrix to SparseMatrix conversion -

im struggeling find way convert densematrix sparsematrix. i tried flattening densematrix array, converting sparse matrix , reshaping not possible since there no reshape function.. val dm = densematrix((1,2,3),(0,0,0),(0,0,0)) val sm =cscmatrix(dm.toarray) sm.reshape(3,3) error: value reshape not member of breeze.linalg.cscmatrix[int] how this: val dm = densematrix((1,2,3),(0,0,0),(0,0,0)) val sm = cscmatrix.tabulate(dm.rows, dm.cols)(dm(_, _))

php - I can't get the page's number from the url -

i want current page's number url: localhost/mywebsite/prdc?page=2 if(isset($_get['page'])) { $index = $_get['page']; echo $index; } and error: undefined index: page and don't find id : print_r($_get); the output : array ( [controller] => prdc [action] => [id] => ) by using geturisegment() can specific uri segment or return segments available. <?php // if url http://www.timwickstrom.com/foo/bar/wow echo geturisegment(1); //returns foo echo geturisegment(2); //returns bar print_r(geturisegments()); //returns array(0=>'foo', 1=>'bar', 2=>'wow') ?> if using framework codeigniter then, $segment= $this->uri->segment(2); //2 returns bar

ruby on rails - Has_and_belongs_to_many with additional condition -

i have entities: processes , users. have many-to-many relations. user can assigned process different role: admin , owner (or both), , use boolean columns in link table. here structure: processes id name users id email processes_users id process_id: fk user_id: fk admin: boolean owner: boolean is there way make 2 different has_and_belongs_to_many association these models using condition in boolean flags? want use this: process = process.find(1) process.owners.size process.admins.size # maybe joins process.joins(:owners).includes(:owners) is there way this? use has_many :through association http://guides.rubyonrails.org/association_basics.html#choosing-between-has-many-through-and-has-and-belongs-to-many

javascript - in my form I checked input radio and image changes, but I fill input text and the image changes back -

okey, here goes big problem: i have form, has submit button enables when have checked , filled both inputs (there no problem that). if follow these steps, realize problem is: load jsfiddle https://jsfiddle.net/ozlmdx4o/ don't pay attention code now, @ form: there default profile image, empty input text, unchecked input radio, , disabled submit button. test form: fill input text , check input radio , observe how default profile image changes image. check , uncheck input radio observe how image linked input. key of this. but, if input text filled wrong? delete whatever entered in input text , start on again... but...what? image has returned default profile image! if linked input radio! why??? why happens? can check code, because there must somewhere have missed. can me keep image linked input radio button? input radio button unchecked = default profile image. input radio button checked = special image. //input radio on & off code var prv1; var markit1 = function(

javascript - time slider time stamps within period -

i have time slider widget , it's great being able move through different time stops within given period. however know time stamps items within sliders time extent, there way can query this? i using javascript 3.17 version. cheers.

java - Geting Exception Bad Message when rename file on SFTP server using JSch -

i trying move file 1 directory on sftp using jsch . have used rename method getting below exception(5: bad message): channeldes = session.openchannel("sftp"); channeldes.connect(); sftpchanneldes = (channelsftp) channeldes; string sourcepath = "./abc/" + filename; string destinationpath = "./xyz/" + filename; sftpchanneldes.rename(sourcepath, destinationpath); **exception :-** ================= 5: bad message @ com.jcraft.jsch.channelsftp.throwstatuserror(channelsftp.java:2846) @ com.jcraft.jsch.channelsftp.rename(channelsftp.java:1923) @ com.test.copyfile.movefile(copyfile.java:56) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.i

algorithm - Maximum sum in a torus -

Image
i trying solve following dynamic programming question on uva online judge: a grid wraps both horizontally , vertically called torus. given torus each cell contains integer, determine sub-rectangle largest sum. sum of sub-rectangle sum of elements in rectangle. grid below shows torus maximum sub-rectangle has been shaded. we know there exists similar , simpler problem: maximal sub-rectangle problem grid canot wrap. simpler variant, can first take cumulative of each row , apply kadane's algorithm in 2 for-loops solve problem. problem, impossible since grid can wrap around. i have headstart on problem mirroring matrix 4 times simulate rotation of matrix. however, dynamic programming related problems, have formulate recurrence relation. not know how formulate recurrence problem. please advise me? edit: i tried using modified kadane's algorithm search largest rectangle of @ least size 1. however, still not getting right answer. reference, code listed belo

ios - popToRootViewController not working when sending from add screen -

Image
i have simple app building. list of items in 1 view controller table view , embedded navigation controller. when select row brings details screen (no problem). push list view list item func tableview(_ tableview: uitableview, didselectrowat indexpath: indexpath) { performsegue(withidentifier: "listitemdetailsvc", sender: nil) } pop list item list view @ibaction func backtoinboxtapped(_ sender: any) { navigationcontroller?.poptorootviewcontroller(animated: true) } this works fine! my issue have view controller (add item) presents modally when add button clicked. idea when saves brings list detail vc. @ibaction func saveitem(_ sender: any) { performsegue(withidentifier: "detailsfromadd", sender: nil) } opening details view controller add new controller works fine once open details view want able go rootviewcontroller. button not work anymore in case should not need use segue. have clear concepts. you can't poptorootview

java - Sorting 2d string array with integer -

i created 2d string array (called data) contains on first position integer (as string) , on second position link file. examples: ["3", "test3.pdf"]; ["1", "test1.pdf"]; ["2", "test2.pdf"]; ["10", "test10.pdf"] so need sort array ascending integer. result of sorting should sorted array like: ["1", "test1.pdf"]; ["2", "test2.pdf"];["3", "test3.pdf"];["10", "test10.pdf"] i found sample code this: arrays.sort(data, new comparator<string[]>() { @override public int compare(final string[] entry1, final string[] entry2) { final string time1 = entry1[0]; final string time2 = entry2[0]; return time1.compareto(time2); } }); but problem is, in case compares string logic, result be-> 1,10,2,3. cannot archive result this. know can do? can have 2d array of 1 type? not mix of st

java - Why I must search explicitly relative elements in Selenium by xpath? -

i'm trying elements xpath selenium's webdriver: webelement element1 = driver.findelement(by.id("someid")); list<webelement> xpathelements = element1.findelements((by.xpath("//span[@class='someclass']"))); with code, i'm getting elements class='someclass' in dom. only when add "." @ beginning of xpath string elements class='someclass' under element1 element1.findelements((by.xpath(".//span[@class='someclass']"))); what's sense here? called findelements element1 default should search elements under element1 , why must add "."? it has got nothing selenium, way xpath works. if have //elem xpath located anywhere in document. if want search element relative element or rather descendant have use '.' or dot .//elem.

java - How to rotate images in circular path like this in blogger dynamic view template -

Image
how rotate images in circular path in blogger dynamic view template , when click image in circular path should open specified link i'm not 100% sure blogger dynamic view template is, if can write custom css3 + html tags, following code should suffice. screenshot first: what rotating image infinite times while make every circle icon of image clickable. : <html> <head> <style type="text/css"> @keyframes myfirst { {transform: rotate(0deg);} {transform: rotate(360deg);} } img { animation-name: myfirst; animation-duration: 5s; animation-timing-function: linear; animation-delay: 0s; animation-iteration-count: infinite; animation-direction: normal; animation-play-state: running; } </style> </head> <body> <img src="pic.png" usemap ="#planetmap

mysql - Getting Blank table after performing valid query in spark sql -

Image
i new in spark. facing weird problem after submitting valid query inside pyspark sql query is spark.sql(" select id , entityid , bldgid , leaseid , suiteid , txndate , incomecat , sourcecode , period , dept , actualprojected , ((tchargeamt1*tdays1)/(ttotaldays)+(tchargeamt2*tdays2)/(ttotaldays)) chargeamt , openamt , invoice , currencycode , glclosedstatus , glpostedstatus , paidstatus , frequency , retropd , fcworkbook , fcleaseno , fcsuitid , txndateint fact_cmcharges f join tt on tt.tid = f.id tt.tid <> null ").show() my result after which fine have save dataframe in registertemptable spark.sql(" select id, entityid,bldgid,leaseid,suiteid,txndate,incomecat,sourcecode,period,dept,actualprojected,((tchargeamt1*tdays1)/(ttotaldays)+(tchargeamt2*tdays2)/(ttotaldays)) chargeamt ,openamt,invoice,currencycode,glclosedstatus,g

How to show website and get content using PHP cURL? -

i need show website , content. purpose, tried php curl , run in localhost result not getting. currently, result getting bool(false) . index.php $url = "https://www.test-data.de/test/data?_ts=4664397-1478603498594&command=start"; //use curl html content function geturlcontent($url){ $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_cookiefile, '/cookies.txt'); curl_setopt($ch, curlopt_cookiejar, '/cookies.txt'); curl_setopt($ch, curlopt_useragent, 'mozilla/4.0 (compatible; msie 6.0; windows nt 5.1; .net clr 1.1.4322)'); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_header, 1); curl_setopt($ch, curlopt_followlocation, 1); $data = curl_exec($ch); $httpcode = curl_getinfo($ch, curlinfo_http_code); curl_close($ch); return ($httpcode>=200 && $httpcode<300) ? $data : false; } $results = geturlcontent($ur

scala - Manipulating Vectors and Lists in RDDs -

i'm new spark , scala , need following rdd transformation: input (macaddress,vector(list(ts1,ts2),list(ts2,ts3),list.....) (c8:3a:bv:b1:3a:e0,vector(list(1472820071, 1472821088), list(1472821088, 1472821429), list(1472821429, 1472824217))) desided output (macaddress,vector(intvalue,intvalue,...)) (c8:3a:bv:b1:3a:e0,vector(1472821088-1472820071, 1472821429-1472821088,1472824217-1472821429)) in short, have rdd grouped key (macaddress) containing paired lists of values. need transform vector of lists vector containing paired differences computed lists (secondelement-firstelement). number of paired lists in vector variable in rdd (depends macaddress considered) i don't know transformation have use in case. thanks make updates based on datatype def flattenrddelements(x:(macaddress,vector[list[int]]) ) : (macaddress,vector[string]) = { x match { case (s,y) => (s,y.map(switchlistelements)) } } def switchlistelements(x: list[int]):

java - the right syntax to use near '? WHERE Reg = ?' -

public static void updatedata(connection con, string make, string reg) { string selectstring = "update cars set make = ? reg = ?"; try { preparedstatement pstmt = con.preparestatement(selectstring); pstmt.setstring(1, make); pstmt.setstring(2, reg); pstmt.executeupdate(selectstring); pstmt.close(); }... i getting following error piece of code: sql exception: have error in sql syntax; check manual corresponds mariadb server version right syntax use near '? reg = ?' @ line 1 i'll appreciate if me out. i've searched around problem quite different solutions i've found. use overloaded executeupdate meant preparedstatements pstmt.executeupdate();

javascript - How to add/remove class using bullets and arrows -

i having trouble figuring out how add , remove class div when user clicks either on corresponding number or prev/next arrows. notice 'active' class on second item second nav. class removed , added first item , nav when user clicks "1" or "previous" arrow. .wrap { display: block; width: 200px; margin: 50px auto; text-align: center; } .nav { margin-bottom: 10px; } .nav { padding: 5px; } .nav a:hover { font-weight: 900; cursor: pointer; } .nav a.active { border-bottom: 1px solid black; font-weight: 900; } .prev, .next { display: inline-block; padding: 5px; } .prev:hover, .next:hover { font-weight: 900; cursor: pointer; } .items div { display: none; padding: 25px; } .items .one { background: red; } .items .two { background: green; } .items .three { background: blue; } .items .active { display: inline-block; } <div class="wrap"> <div class=

excel - VBA array: "Testarray(10)" – What are the initial values of this *without* assigning *any* value to *any* cell? -

when programming in vba, want initialise array as dim testarray(10) string now: what initial values of array without further ado? or asked in way: want use testarray in order find out values. these values changed "missing line" or whatsoever. that, able check array values later on in order find number of missing values going through respective array via, e.g., for -loop or that. ( bonus question: right now, learning how write vba code. array have have name beginning capital letter? or allowed begin small letter?) you use keyword vbnullstring check empty or uninitialized elements of newly created string array. dim testarray(10) string testarray(5) = "test" = 0 ubound(testarray) if testarray(i) = vbnullstring ' skip else cells(i + 1, 1).value = testarray(i) end if next will print "test" in row 6 column 1 (a), , skip uninitialized elements. others have mentioned, in vba testing blank string ("

node.js - connecting nodejs to oracle -

i installed node-oracle these instructions: https://github.com/oracle/node-oracledb however, i've been beating head against wall trying connect remote oracle database. i'm tapping community me out. have created different *.ora files (ldap.ora, sql.ora tns etc...) , set tns_admin directory files reside. bottom line have connection string: jdbc:oracle:thin:@ldap://{hostname-1}:{portnumber}/{dbname},cn=oraclecontext,dc=world ldap://{hostname-2}:{portnumber}/{dbname},cn=oraclecontext,dc=world i can access database fine using oracle sql developer. i've had no sucess using sqlplus or node. i've checked these (among many others): https://community.oracle.com/thread/3759037 how connect ldap server using node-oracledb? getting error while connecting oracle ora-12560: tns:protocol adaptor error has figured out yet , can post solution following: your jdbc connection string your sample *.ora files or whatever parameter you're passing oracledb.getcon

android - Capture frame in opencv camera and intent -

@suppresslint("simpledateformat") @override public boolean ontouch(view v, motionevent event) { log.i(tag, "ontouch event"); simpledateformat sdf = new simpledateformat("yyyy-mm-dd_hh-mm-ss"); string currentdateandtime = sdf.format(new date()); string savedir = environment.getexternalstoragedirectory().getpath() + "/dcim/ocv/touchsave"; file dircheck = new file(savedir); if(!dircheck.exists()) { dircheck.mkdirs(); } string filename = savedir + "/touch_picture_" + currentdateandtime + ".jpg"; try { mopencvcameraview.takepicture(filename); toast.maketext(this, filename + " saved", toast.length_short).show(); } catch(exception ex) { ex.printstacktrace(); } last_photo_name = filename; return false; } this current touchscreen capture function , opencv library camera.this works fine , can save image sdcard. however, hope intent

c# - Adjusting the console apliacation (trycatch and while loop) -

so in code i'm trying make if user inputs value out of range display message: enter valid input (between 1 , 2^53) what doing @ moment when input letter message appears, when input number lower 0, resets loop , continues if nothing happened. //variables double length, width, totalarea, totallength; const double feet = 3.75; //questions console.title = "double glazing window calculator"; console.writeline("double glazing calculator\n"); bool inputfalse = false; { try { { console.write("enter height of of window in meteres "); length = double.parse(console.readline()); console.write("enter width of of window in meteres "); width = double.parse(console.readline()); } while (length < 1 || width < 1); //maths totalarea = length * width * 2; totallength = (length * 2 + width * 2) * feet; console.writeline("the total area

Nightwatch / Selenium and Promises -

is possible wait webdriver/selenium input on javascript side? i've got following code nightwatch.js getprogrammlinks: function() { let self = this; // well. return new promise(function(resolve, reject) { var links = []; self.api.elements('css selector', 'a[role=button]', function(elements) { if (elements.state == 'success') { (itemid in elements.value) { self.api.elementidattribute(itemid, 'href', function(item) { if (item.state == 'success') { if (item.value.includes('programm')) { links.push(item.value); } } else { reject(item); } }) } resolve(links); // after items have been processed } else { reject(elements); } }); }); } anyhow never links when using getprogrammlinks().then(function(links) {}); , seems stop after first iteration of itemid (it pushes links once (or runs if statement)

mysql - "App\Model\Table\LikesTable" is aborting the transaction before the save process is done cakephp 3 -

in website needed notifications call me if user put smile or else. did using aftersave() method, work after save or smile. when pushed on server got error ""app\model\table\likestable" aborting transaction before save process done.". locally work. search infromation in google. think it's problems mysql can't resolve problem. can me it? //server// server version: 5.6.33-79.0 percona server (gpl), release 79.0, revision 2084bdb; php 5.6.25 (cli) (built: aug 19 2016 11:03:33); //locally mysql version: 5.6.33 php-version 5.6.23

javascript - Pie Chart not rendering React Chart.js -

i'm trying render simple pie chart in react component, using chart.js library. i've managed render line chart, reason pie chart rendering empty canvas. problem chartdata not being valid? i'm not getting kind of error. import react, { component, proptypes } 'react'; import * axios 'axios'; import s './test.css'; import withstyles 'isomorphic-style-loader/lib/withstyles'; import cx 'classnames'; var piechart = require("react-chartjs").pie; class test extends component { constructor(props) { super(props); this.chartdata = { datasets: [{ data: [100, 200, 300], backgroundcolor: ["#ff6384", "#36a2eb", "ffce56"] }] }; this.chartoptions = { scale: { reverse: true, ticks: { beginatzero: true } } }; }; render() { return(<div classname={s.graphic}><piechart data={this.chartdata} opti

c++ - OpenGL PBO update texture wrong width height data -

i have simple program trying use pbo update sub texture data dynamic generated. problem correct order of data in texture because gets inverted or not stored in correct order. here code initializing, data input , draw function ////////////////////////////////////////////////////////////////////////// //globals #define tex_width 512 #define tex_height 2048 gluint renderedtexture; gluint pbo_id; glubyte* pbo_memory = 0; initialization: void initialize() { int w = 1024; //screen width int h = 1024; //screen height glviewport( 0, 0, w, h ); glmatrixmode( gl_projection ); glloadidentity(); gluortho2d(0, w, h, 0); glmatrixmode( gl_modelview ); glloadidentity(); glgentextures(1, &renderedtexture); glbindtexture(gl_texture_2d, renderedtexture); //here internal format rgba , input format not sure. //idea put glushort red channel input only. glteximage2d(gl_texture_2d, 0, gl_rgba, tex_width , tex_height, 0, gl_red, gl_uns

ios - Swift roundf not working with float value -

Image
let amount:float = 2.235 print("\(roundf(self.amounttax * 100) / 100)") it returns 2.23 but should 2.24 the result 2.23 because amount * 100 223.5 , rounding of 223 (because 2.235 has no exact representation, 2.234999999999 ) , , divided 100 results in 2.23 . you may want use ceilf unction instead: print("(ceilf(amount * 100) / 100)") this playground result may give more understanding:

python - Why do these two command give different outputs? -

command 1: subprocess.call(["echo","\"hw\""]) output: "hw" command2 : subprocess.call(["echo","""hw"""]) output: hw your first command passes quotes echo system command, , equivalent doing on command line: $ echo "hw" your second command passes hw string (no quotes) echo , equivalent following: $ echo hw in second command, you're using docstring notation strings, equivalent "hw" 'hw' .

laravel - How to change Yarn default packages directory? -

when yarn used install dependencies, puts them in node-modules directory default. how can change i.e laravel resources folder? .bowerrc used bower set "directory": "resources/assets" yarn install --modules-folder ./resources update: keep eye on this github issue feature not quite stable.

rest - Postman : Required request part 'file' is not present -

Image
i wanted upload image rest api through postman. using spring boot framework. here screen shot : i have not set any headers found in other stack overflow answers gave multipart boundary error. now, below controller code : package com.practice.rest.assignment1.controller; import java.io.ioexception; import java.util.list; import org.springframework.beans.factory.annotation.autowired; import org.springframework.web.bind.annotation.pathvariable; import org.springframework.web.bind.annotation.requestbody; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; import org.springframework.web.bind.annotation.requestparam; import org.springframework.web.bind.annotation.restcontroller; import org.springframework.web.multipart.multipartfile; import com.practice.rest.assignment1.model.product; import com.practice.rest.assignment1.service.catalogueservice; import org.codehaus.jackson.jsonparseexception; import org.

python - Confusion about global and immutable -

i'm confused global , immutable variable. have code: class processobject: rr = 0 def b(self): self.rr=5 print("valor: ", self.rr) def c(self): print("final: ", self.rr) def d(self): global rr rr = 3 print("valor: ", rr) print(rr) proce = processobject() proce.b() proce.c() proce.d() proce.c() and have output: 0 value: 5 final: 5 value: 3 final: 5 but not understand why " c " value 5 if rr object immutable. , why " d " using global no mute value of rr . this has nothing immutability... anyway: class processobject: # "rr" lives in `class` statement namespace, # it's accessible 'rr' in namespace. after # `class` statement executed, becomes attribute # of `processobject` class, accessible `processobject.rr`, # , thru instances `processobject().rr`. # rr = 0 def b(self): #