Posts

Showing posts from March, 2015

Slack bot cannot post message to private channel -

i follow slack bot post message documents it works when post public channel, error [error] => channel_not_found when post private channel, change channel_name channel id (ex: g1hcg4bq9 ) i authorized both chat:write:user , chat:write:bot permissions try setting explicitly as_user: false , using team access token instead of bot user's one.

postgresql - Issues with R packages install inside Postgres Docker Image -

i have postgres dockerfile works fine. managed install r-3.3.3 inside image via dockerfile , found containers work correctly. when tried install packages via following entries, image creation succeeds container exits right away normal status. here new entries added changed behavior. missing? run r -e "install.packages('devtools',repos='http://cran.us.r-project.org')" && r -e "install.packages('rpostgresql',repos='http://cran.us.r-project.org')" \ && r -e "install.packages('hash',repos='http://cran.us.r-project.org')" \ && r -e "install.packages('nloptr',repos='http://cran.us.r-project.org')" \ && r -e "install.packages('dbi',repos='http://cran.us.r-project.org')" \ && r -e "install.packages('rcpp',repos='http://cran.us.r-project.org')" \ &&

Rails Model with attribute that has different value on different day -

i have model called table, table has attributes called price. , price may change everyday whenever owner of table wants to. how can keep track of values of price can return price of table on 1st jan 2017 or other past dates. one way make price new model tablecalendarprice has 2 attributes date , price , reference table model.

ios - Filtering AWS-Cognito users by role -

i've been looking day how avail. let's have 2 users in user pool, john admin , jim user. have view controller want accessible john admin not jim user. problem don't know how distinguish john , jim in app. is there way know john admin in admin groups/role jim not? edit: asking user attributes gave me: {"userattributes": [ { "name": "sub", "value": "numbers"}, { "name": "email_verified", "value": "true"}, { "name": "phone_number_verified", "value": "false"}, { "name": "phone_number", "value": "numbers"}, { "name": "email", "value": "email"}], "username": "johnadmin"} your user model should contain property allow distinguish users roles. e.g struct user { var name = "" var role = "user" // c

Comparing String to int JAVA -

i trying figure out how make sure string variable not have number string. cannot import anything. i have tried namearray[i].equalsignorecase("")) || integer.parseint(namearray[i]) >= 48 && integer.parseint(namearray[i]) < 58 but did not work. in java 8+, might use intstream generate range ( [48, 58] ) , check if string equal namearray . like, if (intstream.rangeclosed(48, 58).anymatch(x -> string.valueof(x) .equals(namearray[i]))) { } you mention want make sure doesn't contain value - perhaps want nonematch like if (intstream.rangeclosed(48, 58).nonematch(x -> string.valueof(x) .equals(namearray[i]))) { }

javascript - JQuery set two imgs to same position as another -

i have been tring set img @ same position using jquery .position() , .css() here code: function setimgstosameposition() { var position = $('#img1').position(); $('#img2').css({ 'left': position.left + 'px', 'top': position.top + 'px' }); $('#img3').css({ 'left': position.left + 'px', 'top': position.top + 'px' }); } $(document).ready(function () { // set imgs pos equal img1 pos setimgstosameposition(); }) any thoughts? you can overlap images way. set position fixed set left , top values both other images. i'm not entirely sure why'd want this; so, if it's not desired result, comment. function setimgstosameposition() { var position = $('#img1').position(); $('#img2, #img3').css({ 'left': position.left + 'px', 'top': position.top + 'px' }); } $(document).ready(function () {

ios - How to save the Swift Enum that contains Associated Values to the NSUserDefault? -

what's issue i trying save instance of customized swift enum contains associated values each enum cases nsuserdefault . reason s because associated values referencing objects need reused when app relaunched, means objects referenced custom objects need aware of app when got launched. example class abcmodecontroller { static var sharedinstance = abcmodecontroller() enum abcmode { case on([abcmachine], int?, uicolor?) case off([abcmachine]) case toggle([abcmachine], int?, uicolor?) } var custommode1:abcmode? var custommode2:abcmode? var custommode3:abcmode? } what's expected behavior from above example, swift enum gets wrapped in a singleton class expected each instance of abcmode, custommode1, custommode2, custommode3, can saved userdefault when gets "didset" value. , when app gets relaunched, userdefault restore each instance of abcmode in singleton class. what's tried & potential solutions the swift enum can set rawva

javascript - Could this be considered a security vulnerability? -

i discovered javascript in site didn't sanitize external data ( sitename ), it's used in such way think not represent problem. certainly, best thing filter expected values interact code , there no worry unexpected input. but, how damage inflicted in current setup? var branding = { 'website1.com' : { color: 'red' }, 'website2.com' : { color: 'blue' } }; var sitename = document.referrer.split('/')[2]; var myelements = document.queryselectorall(".some-class-name"); (var = 0; < myelements.length; i++) { myelements[i].style.color = branding[sitename]['color']; } this code poorly conceived, don't think it's exploitable. document.referrer.split('/')[2] extracts hostname of referrer. attacker might have control on hostname, limited degree; can't put field can't register or set domain name. branding[sitename] made interesting things if site

html - Is it possible to distort SVG text dynamically? -

is possible distort svg text dynamically? for example, apply filters shifting parameters based on temporal data? thanks. yes, it's possible: let step = () => { let blur = document.queryselector('svg > #blur > fegaussianblur'); let value = parsefloat(blur.getattribute('stddeviation')); blur.setattribute('stddeviation', value * 1.05); requestanimationframe(step); }; requestanimationframe(step); <svg width="250" height="100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <filter id="blur"> <fegaussianblur in="sourcegraphic" stddeviation="1"/> </filter> <text x="15" y="50" font-size="35" filter="url(#blur)">hello world!</text> </svg> probably better use css or smil animation though (smil snippet

javascript - Running JS-File in php -

i’ve questionnaire analyze php. data supposed displayed in java-based polar-graph , table. can see how looks static data here . however, graph doesn’t show when use data database. table works fine. few days ago asked how integrate php-data java via json_encode because thought might problem, learned (thanks again) correct approach. my web-hoster says doesn’t support php in html, modified index.html index.php. have no idea modify make work. database-connection works, php-values in table correct, js-graph works fine static data. here php-arrays: $arr1 = array(axis => "gesundheitszustand", value => $x1p); $arr2 = array(axis => "bmi", value => $x3); $arr3 = array(axis => "stress", value => $x10p); $arr4 = array(axis => "körperliche aktivität", value => $x4p); $arr5 = array(axis => "nahrung: gemüse/obst", value => $x8d); $arr6 = array(axis => "nahrung: fisch", value => $x8f); $arr7 =

Numpy ImportError when deploying Flask App using mod_wsgi/Apache2 -

i'm trying flask app running on aws ec2 (standard ubuntu ami) through apache2 webserver. app internally uses numpy. have tested following: without numpy, app runs through apache2. numpy, trips on import numpy , throws 500 server error (see logs below). with numpy, app runs fine when invoked directly command line ( i.e. python app.py ). numpy bits work expected , can query app endpoints externally. i printed system path ( print sys.path ) before import numpy np , made sure appropriate site-packages directory in path. manually specified wsgipythonpath include site-packages directory. tried setting number of threads 1 , editing apache2.conf file. none of these efforts have been successful. below directory structure , contents of relevant files. root folder /var/www/html/webserver_mockup root folder contents /var/www/html/webserver_mockup/app.wsgi /var/www/html/webserver_mockup/mockup/__init__.py /var/www/html/webserver_mockup/mockup/app.py app.wsgi (edited

jupyter - Communicating with Ipython kernel from a python script -

i want run commands sent python script ipython. read can done kernelmanager. so, tried below code found in site. if try addition in execute command, output in format: {u'text/plain': u'4'}. other command, print 'hi', empty data. can me understand doing wrong or there better way setup client script , execute python commands in ipython. from subprocess import pipe jupyter_client import kernelmanager import time try: queue import empty # py 3 except importerror: queue import empty # py 2 km = kernelmanager(kernel_name = 'python2') km.start_kernel() print km.is_alive() try: c = km.client() msg_id=c.execute('print "hi"') state='busy' data={} while state!='idle' , c.is_alive(): try: msg=c.get_iopub_msg(timeout=1) if not 'cont

java - What hibernate do with unmapped column? -

suppose there class that: public class entity { private long id; private string name; } and table 3 columns: id, name , address. create table entity ( id number(9,0), name varchar2(255), address varchar2(1000), then en insert performed: insert entity (id, name, address) values (1, "a", "b") then load , update hibernate entity: session session = ... entity entity = session.get(entity.class, 1); then update name , save again: entity.setname("newname"); session.save(entity); so address column value - null or b ? hibernate provide stgrategies such situations or have add address field entity , mark @column(updatable=false, insertable = false) ? if put following properties in persistence.xml(or have defined hibernate properties) <property name="hibernate.show_sql" value="false"/> <property name="hibernate.format_sql" value="false"/> then see queries exec

ruby on rails - ActiveRecord::RecordNotFound in CommentsController#create, Couldn't find Post with 'id'= -

Image
after clicking on create comment, got error this coment controller: ` used friendlyid instead of post id. error: activerecord::recordnotfound in commentscontroller#create couldn't find post 'id'= class commentscontroller < applicationcontroller def create @post = post.find(params[:post_id]) @comment = @post.comments.create(params[:comment].permit(:name, :body)) redirect_to post_path(@post) end comments form: _comments.html.erb `<%= form_for([@post,@post.comments.build]) |f| %> <p> <%= f.label :name %> <%= f.text_field :name %> </p> <p> <%= f.label :body %><br> <%= f.text_area :body %> </p> <p> <%= f.submit %> </p> <% end %>` posts controller: post_controller.rb `class postscontroller < applicationcontroller before_action :set_post, only: [:show, :e

Issue to connect mySQL using Spring boot and Hibernate -

Image
i follow link ( http://blog.netgloo.com/2014/10/27/using-mysql-in-spring-boot-via-spring-data-jpa-and-hibernate/ ) configure application.properties in intellij. however, spring.datasource.testwhileidle, spring.datasource.validationquery , spring.jpa.properties.hibernate.dialect cannot resolved [as shown in below image]. my pom.xml shown below: <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.bookstore</groupid> <artifactid>bookstore</artifactid> <version>0.0.1-snapshot</version> <packaging>jar</packaging> <name>bookstore</name> <description>frontend of bookstore

php - How to add menu field in opencart 2.1.0.2 -

in localhost how us, contact , home add field. try <div class="collapse navbar-collapse navbar-ex1-collapse"> <ul class="nav navbar-nav"> <?php foreach ($categories $category) { ?> <?php if ($category['children']) { ?> <li class="dropdown"><a href="<?php echo $category['href']; ?>" class="dropdown-toggle" data-toggle="dropdown"><?php echo $category['name']; ?></a> <div class="dropdown-menu"> <div class="dropdown-inner"> <?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) $children) { ?> <ul class="list-unstyled"> <?php foreach ($children $child) { ?> <li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li> <

sql - How to add where clause condition of type varchar in dbms_xmlgen.getxml? -

Image
this query trying select dbms_xmlgen.getxml('select * city city_name="rome"') xml dual but giving error. when tried select dbms_xmlgen.getxml('select * city city_id=10446') xml dual worked fine. please can 1 tell me how add condition varchar type? try using pair of single quote eg: select dbms_xmlgen.getxml('select * city city_name=''rome'' ') xml dual

sql server - Reading values from database and updating an existing xml -

using sql server 2008 , table has values this: empn ename job hiredate ---- ---------- --------- ----------- 7341 smith clerk 17-dec-1980 7482 allen salesman 20-feb-1981 my xml in sharefolder <employees> <employee> <empno>7369</empno> <ename>smith</ename> <job>clerk</job> <hiredate>17-dec-1980</hiredate> </employee> <employee> <empno>7499</empno> <ename>allen</ename> <job>salesman</job> <hiredate>20-feb-1981</hiredate> </employee> </employees> now need change existing xml based on database values (empn) how that? your question not clear... some hints @ first: avoid culture specific or (even worse!) language specific date/time formats 17-dec-1980 . within xml should use iso8601. please read how ask sql question , how

scala - How does RDD.aggregate action work (i.e. how to understand the parameters)? -

can give detailed explanation of how below agrregate action in spark produces result of (9,4) val rdd = sc.parallelize(list(1,2,3,3)) rdd.aggregate((0, 0)) ((x, y) => (x._1 + y, x._2 + 1), (x, y) => (x._1 + y._1, x._2 + y._2)) res : (9,4) this spark 2.1.0 here (which should not matter much, but...) go the official documentation of aggregate (aka scaladoc ) , read: aggregate elements of each partition, , results partitions, using given combine functions , neutral "zero value". function can return different result type, u, type of rdd, t. thus, need 1 operation merging t u , 1 operation merging 2 u's, in scala.traversableonce. both of these functions allowed modify , return first argument instead of creating new u avoid memory allocation. the signature follows (removed implicit parameter not particularly interesting): aggregate[u](zerovalue: u)(seqop: (u, t) ⇒ u, combop: (u, u) ⇒ u): u the scaladoc says: zerovalue initial value a

group by follow by order by in mysql -

i want find out query in group followed order by. my table resource_monitor id | server_ip | rdp_connection 1 | 192.168.1.45 | 9 2 | 192.168.1.46 | 12 3 | 192.168.1.45 | 8 4 | 192.168.1.45 | 4 5 | 192.168.1.46 | 3 i have user query select * resource_monitor group server_ip order id desc this gives me result id | server_ip | rdp_connection 2 | 192.168.1.46 | 12 1 | 192.168.1.45 | 9 but want unique server_ip's last record id | server_ip | rdp_connection 4 | 192.168.1.45 | 4 5 | 192.168.1.46 | 3 you can subquery following select * (select * resource_monitor order id desc) test group test.server_ip

android - Json object multiple array Parse, retrofit -

i have json string. couldn't onresponse retrofit 2 list(categories , product). how call, callback? should use what? not normaly list, right? { "categories": [{"name":"x products", "products":[{}{}{}]} {"name":"y products", "products":[{}{}{}]} {"name":"z products", "products":[{}{}{}]} ], "coverpageurl":"xx.png", "location": "canada", "adress":"opposite of hospital" "productitems": [ {"large":"xx" "mall":"tt"} {"large":"yy" "mall":"gg"}] "status": { "errorcode": 0, "error": null, "haserror": false } in call<merchant> ca

c# - Reader for a MySqLConnection without database parameter in Connection String -

i'm trying run following query via datareader on mysql instance. reader returns null , understand due missing database parameter in connection string. how query work. need username, database name , hostname database i'm not sure database query same. select current_user(), database(), @@hostname hostname; the call made in following function , connection not specific database: public databasedetails getdetailsdetails(connectiondetails details) { using (var dbcommand = details.connection.createcommand()) { dbcommand.commandtext = "select current_user(), database(), @@hostname hostname;"; using (var dr = dbcommand.executereader(commandbehavior.singlerow)) { return dr.read() ? new databasedetails { username = dbfunction.getstring(dr, 0), database = dbfunction.getstring(dr, 1), serve

excel - Changing Wide Data back to Long Format - VBA. How to Select Sheet? -

i have been looking wide long format code while , found on here useful. have took , made modifications apply data... works perfectly. my question though is, add in sheet selection? i.e. want able run macro button on different page. @ moment code works if executed orignal source sheet. sub wide_to_long() dim rng range, dn range, dta, col integer dim c integer, lastdt integer, lastvis integer lastdt = cells("1", columns.count).end(xltoleft).column set rng = range(range("a2"), range("a" & rows.count).end(xlup)) redim ray(1 rng.count * lastdt, 1 lastdt) each dn in rng lastvis = cells(dn.row, columns.count).end(xltoleft).column col = 8 lastvis c = c + 1 dta = 0 8 select case dta case = 7 ray(c, dta + 1) = cells(1, col) case = 8 ray(c, dta + 1) = dn.offset(, col - 1) case else ray(c, dta

gRPC C# Server authentication -

i'm attempting perform server authentication using grpc i'm unsure of how proceed. current setup have server running on 1 machine , client on (both windows machines). testing purposes i've generated certificate authority , private certificate (from certificate authority) using windows makecert.exe. generates .cer file. the documentation sslservercredentials not have provisions .cer file. keycertificatepair in case ? documentation unclear on this. http://www.grpc.io/grpc/csharp/html/t_grpc_core_sslservercredentials.htm also, want server authenticate itself, need special provision on client grpc call? you'll need both private key , cert file. can see how grpc testing code here .

sql - Issues with JSON_EXTRACT in Presto for keys containing ' ' character -

i'm using presto(0.163) query data , trying extract fields json. i have json 1 given below, present in column 'style_attributes': "attributes": { "brand fit name": "regular fit", "fabric": "cotton", "fit": "regular", "neck or collar": "round neck", "occasion": "casual", "pattern": "striped", "sleeve length": "short sleeves", "tshirt type": "t-shirt" } i'm unable extract field 'short sleeves'. below query i'm using: select json_extract(style_attributes,'$.attributes.sleeve length') length table; the query fails following error- invalid json path: '$.attributes.sleeve length' for fields without ' '(space), query running fine. i tried find resolution in presto documentation, no success. presto:default> select

rust - How do I decode a URL and get the query string as a HashMap? -

i have url this: http%3a%2f%2fexample.com%3fa%3d1%26b%3d2%26c%3d3 i parsed hyper::url::parse , fetch query string: let parsed_url = hyper::url::parse(&u).unwrap(); let query_string = parsed_url.query(); but gives me query string. want query string hashmap . this: // code convert query string hashmap hash_query.get(&"a"); // eq 1 hash_query.get(&"b"); // eq 2 there few steps involved: the .query_pairs() method give iterator on pairs of cow<str> . calling .into_owned() on give iterator on string pairs instead. this iterator of (string, string) , right shape .collect() hashmap<string, string> . putting together: let parsed_url = url::parse("http://example.com/?a=1&b=2&c=3").unwrap(); let hash_query: hashmap<_, _> = parsed_url.query_pairs().into_owned().collect(); assert_eq!(hash_query.get("a"), "1"); note need type annotation on hash_query —since .collect() over

css3 - responsiv css, element flows in to each other -

i'm trying build responsiv webpage , works on small screen 640px , on bigger screens. there 2 elements next each other. problem between breakpoint 640 px , bigger screens. until you've stretched out bigger screen 2 elements floats in each other. between maybe 640 px , 800 px.. here's css 2 elemets placed next each other. @media screen , (min-width: 640px) { article { max-width: 75%; position: absolute; margin-right: 2em; } aside { float: right; display: inline; max-width: 20%; } how can them not float in each other? your position: absolute creating problem. not sure why need it. are looking below html: <div class="left"></div> <div class="right"></div> css: .left, .right { float: left; border: 1px solid red; height: 200px; box-sizing: border-box; } .left { width: 70%; } .right { width: 30%; }

gmm - Can we use a mixing proportions probeties of in matlab as the weight matrix of the Gaussian component -

can use mixing proportions properties of gmdistribution class in matlab weight matrix of gaussian component? in work, need use gmm represent color distribution of object's pixels of image. did find weight, mean , covariance matrix of kth gaussian component. question can use gmm_obj.pcomponents gmm weight? options = statset('display','final','maxiter',500); gmm_obj = fitgmdist(uvobj,c,'regularize',1e-4,'replicates',1,'options',options); objmeans = gmm_obj.mu; objcovariances = gmm_obj.sigma; objproportions = gmm_obj.pcomponents;

webkit - How does packages become available on client in an angular project -

i started angular project , had different things make packages available on client. give examples different types of packages: @angular : listed in package.json . moment : listed in package.json , had import in angular-cli.json in scripts section "../node_modules/moment/min/moment.min.js" , simpl-schema : listed in package.json , had add types via dts-gen. @angular neithe included in angular-cli.json nor in index.html . whats difference between moment , other 2 packages? why have include moment.js separately?

c# - the type name text does not exist in the type xmlnodetype -

i trying read section xml file in c#. tried using code here compiler error under text in xmlnodetype.text weird thing comes intellisense , gives same error else element , comment etc.. missing? xmltextreader reader = new xmltextreader(xmldoc); list<string> paths = new list<string>(); while (reader.read()) { if (reader.nodetype == xmlnodetype.element && reader.name == "paths") foreach(xmlnodetype.text aa in reader.readinnerxml()) paths.add(aa); } reader.close(); xml file <config> <paths> <input>c:\</input> <output>c:\</output> <log>\logs</log> </paths> <systemownerroles> <supplier>supplier</supplier> <mop>mop</mop> </systemownerroles> </config> xmlnodetype enum. xmlnodetype.text value, not type, you're trying use type of aa variable. furthermore readerinnerxml()

?: doesn't work correctly in javascript -

i written following code change numbers persian: function farsi(x) { x = x.tostring().replace(/\b(?=(\d{3})+(?!\d))/g, ","); var = '۰۱۲۳۴۵۶۷۸۹'; var b = ''; (var = 0; < x.length; i++) { var c = x.charcodeat(i); b += (c >= 48 || c <= 57 ? a.charat(c - 48) : x.charat(i)); } return b; } i have used regex thousand seprator how print number commas thousands separators in javascript works correctly. separator character not being added in line of code: b += (c >= 48 || c <= 57 ? a.charat(c - 48) : x.charat(i)); here fiddle you put || instead of && b += (c >= 48 && c <= 57 ) ? a.charat(c - 48) : x.charat(i); see working code https://jsfiddle.net/4qvwzs5e/2/

How to convert string to integer in a shell script? -

i have file of 4gb in /var/tmp/test/dsk/file.1 in path. can see through solaris linux command follows: -bash-4.4# du -h /var/tmp/test/dsk/file.1 4.0g /var/tmp/test/dsk/file.1 i want disk size did following. disk=`du -h /var/tmp/test/dsk/file.1| awk '{print $1}'|tr -d '.g'` which gives me output follows: -bash-4.4# echo $disk 4.0 but want compare disk size value 50 , first need convert above output integer, i'm failing that, can in this, have searched not getting exact solution. sorry don't see probem here :) tool bc accepts whatever format may give: [ $(bc <<< "$disk>=50") -eq 1 ] btw, might want convert human readable size output simple numeric byte size function like: # converts human readable sizes integer kilobyte sizes # usage numericsize="$(humantonumeric $humansize)" function humantonumeric { local value="${1}" local notation local suffix local suffixpresent lo

ruby on rails - No route matches {:action=>"show".... :controller = " posts" } -

i following article test sitemap generation. article didn't mention writing show action. since started error, wrote simple show action. following posts controller: def index @posts= post.all end def show @posts = post.all end routes.rb rails.application.routes.draw resources :categories resources :posts end root to: 'pages#index' end sitemap.rb category.find_each |category| add category_posts_path(category), :changefreq => 'weekly', :lastmod => category.updated_at category.posts.each |post| add category_post_path(category), :changefreq => 'yearly', :lastmod => post.updated_at end end and when run rake sitemap:refresh , it's giving following: in '/home/mypc/projects/sitemaptest/public/': rake aborted! actioncontroller::urlgenerationerror: no route matches {:action=>"show", :category_id=>#<category id: 1, title: "surprised joy", created_at: &

How To Validate Text Field not accept 0 as First digit and Whole digit using Javascript -

how validate text field not accept 0 first digit , whole digit using javascript. example, should not accept 0,00,000,01,02,001 , on it accept 10,100,10000 , on any appreciated get first character of entered string/value, , check 0, on event want check, modify accordingly. <input id="myid" value="0123" /> $('#myid').blur(function(e){ var first_char = $("#myid").val().substring(0, 1); if (first_char == 0){ return false; } }); hope helps $( document ).ready(function() { $('#myid').blur(function(e){ var first_char = $("#myid").val().substring(0, 1); if (first_char == 0){ alert('first character 0'); }else{ alert('first character not 0'); } }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input id="myid" value="0123" />

JMeter groovy pre-processor results in "invalid attachment" when trying to configure “Custom SOAP Sampler” -

i'm trying create groovy-based pre-processor ( jsr223preprocessor ) **custom soap sampler* plugin, intended cover following tasks: read list of file attachments csv input file; empty list of attachments registered custom soap sampler ; register attachments read csv file custom soap sampler . after quite extensive research on net--i'm new whole groovy, java, jmeter topic--, managed assemble groovy script shown below. // read data csv input file arraylist reclst = new arraylist(); string fldsep = vars.get("fldsep"); string fldhd = vars.get("fldhd"); integer = 0; // todo: test/debugging new file(vars.get("indat")).eachline('utf-8') { if ((it != null) && (fldhd != null) && (!it.trim().equals(fldhd.trim()))) { reclst.add(it.trim()); } // if } // file.eachline // extract relevant parts , feed custom soap sampler (registered attachments) // csv format: tmstmp;prodid;tenid;fnam;mdat if (reclst.size

javascript - jquery check if img is inside div -

// w s d $(document).ready(function(e){ var keys = {}; $(document).keydown(function(event){ keys[event.which] = true; }).keyup(function(event){ delete keys[event.which]; }); var $d = $("img"); function gameloop() { if (keys[68]) { $d.css("left", function(i,oldval) { return parseint(oldval) + 5 + "px"; }); } else if (keys[65]) { $d.css("left", function(i,oldval) { return parseint(oldval) - 5 + "px"; }); } if (keys[83]) { $d.css("top", function(i,oldval) { return parseint(oldval) + 5 + "px"; }); } else if (keys[87]) { $d.css("top", function(i,oldval) { return parseint(oldval) - 5 + "px"; }); } settimeout(gameloop, 20); } gameloop(); $(document).focus(); }); // arrows $(document).ready(function(e){ var keys = {}; $(document).keyd

vb.net - Run function each day at set time -

so have app need run email function each day @ time set. in case set 6pm. left running , went home work. @ 6pm received email function ran. come midnight ran again, , because ran @ midnight , that's technically today, won't run again until 6pm next day instead of 6pm tonight since ran @ midnight. can't figure out what's wrong , why ran @ midnight. private target datetime private state maintenancestate = maintenancestate.waitingtostart public maintenancetime new timespan(hour, min, 0) private waitinginterval new timespan(0, 5, 0) ' 5 minutes private enum maintenancestate waitingtostart started end enum private sub tmr_maintenance_tick(sender object, e eventargs) handles tmr_maintenance.tick dim ts timespan = target.subtract(datetime.now) lblstatus.text = ts.tostring("hh\:mm\:ss") if datetime.now >= target tmr_maintenance.stop() select case state case maintenancestate.waitingtostart

html - How can I put DIV in P? -

how can put div in paragraph? changed display inline, browser divide base paragraph 2 element, , div not member of paragraph. form w3 site: the p element represents paragraph. cannot contain block-level elements (including p itself).

WebStorm editor tab background colour -

Image
i want use light theme in webstorm 2017.1 reason editor tabs dark. i can change font colour changes in project tree view has white background. the theme under appearance set intellij , editor theme set default have tried many combinations. is bug or there setting haven't found yet? the issue caused material theme plugin, disabled , looks fine. thanks @lazyone pointing me in right direction.

javascript - Why new Promise.all().then() worked? -

let iconsloaded = new promise((resolve, reject) => { new promise.all( object.keys(icons).map(iconname => { const provider = icons[iconname][2] || defaulticonprovider; // ionicons return provider.getimagesource( iconname.replace(replacesuffixpattern, ''), icons[iconname][0], icons[iconname][1] ) }) ).then(sources => { object.keys(icons) .foreach((iconname, idx) => iconsmap[iconname] = sources[idx]) // call resolve (and done) resolve(true); }) }); please me understand above code promise.all() i know promise object has call() method,but know it's static method, should not used above,eg: new promise.all(),but give me no error. why-why-why... here source code: the code above has no error but, code following wrong..give me error 😭 let p2 = new promise(function(resolve, reject){ console.log('p2 body') resolve('p2 resolve') }) let p1 = new promise(function(

html - How are tabs interpreted in CommonMark? -

see description before example 6 in commonmark spec at: http://spec.commonmark.org/0.27/#example-5 i trying understand how following code leads code-block starting 2 spaces. >→→foo example 6 shows translate following. <blockquote> <pre><code> foo </code></pre> </blockquote> but section 2.2 states: however, in contexts whitespace helps define block structure, tabs behave if replaced spaces tab stop of 4 characters. so per understanding, above markdown behaves following (i denote space dot). >........foo since, 1 optional space allowed after > , , 4 spaces used indent code block, left with, >...foo that's code-block starting 3 spaces. how commonmark claim should lead code-block starting 2 spaces? missing? the key in first paragraph of tabs section (emphasis added): tabs in lines not expanded spaces. however, in contexts whitespace helps define block structure, tabs behave if replaced spaces

How to get data from google spread sheets in c# -

i want read data in google spread using c#.i able authenticate google drive unable read data in google spread sheet.i have used following code spreadsheetsservice myservice = new spreadsheetsservice("sample projectsheets"); myservice.setusercredentials(my emailid, password); spreadsheetquery query = new spreadsheetquery(); spreadsheetfeed feed = myservice.query(query); in above code , getting exception @ myservice.query(query) an unhandled exception of type 'google.gdata.client.gdatarequestexception' occurred in google.gdata.client.dll , build above code refering following link: accessing google spreadsheets c# using google data api . have 1 more doubt mention application name in spreadsheetsservice object.

java - SnappyData(Table is not showing in cluster) -

i've created 1 program snappy data in java. i'm not able table name in cluster. i'm can't understand log file. hints? public static void main( string[] args ) { sparksession spark = sparksession .builder() .appname("sparkapp") .master("local[*]") .getorcreate(); javasparkcontext jsc = new javasparkcontext(spark.sparkcontext()); snappysession snappy = new snappysession(spark.sparkcontext()); snappy.droptable("customer",true); snappy.sql("create table customer ( " + "c_custkey integer not null," + "c_name varchar(25) not null," + "c_address varchar(40) not null," + "c_nationkey integer not null," + "c_phone varchar(15) not null," + "c_acctbal decimal(15,2) not null," + "c_mktsegment varchar(10) not nul

android - Error in react-native-i18n while generate apk from react-native in Jenkins -

i have error: :react-native-i18n:processreleaseresources failed failure: build failed exception. * went wrong: execution failed task ':react-native-i18n:processreleaseresources'. > com.android.ide.common.process.processexception: failed execute aapt when want generate application react-native use jenkinsfile script. dir('src/mobile/android'){ sh 'chmod +x ./gradlew' sh 'android_home=/home/user/android ./gradlew assembledefault' archive '*/build/outputs/apk/*.apk' i can run application in local environment server jenkins can't build app. idea how solve problem?

checking if given vector contains already elements of pair in c++ -

let suppose have following pairs 0 -1 0 -2 0 -3 1- 2 2 -3 3- 4 2 -4 4- 5 5 -6 i insert pairs vector , should have each element 1 times , instance start empty vector : 0-1 inserted checking 0-2 , there exist 0, not 2, 0-2 inserted, have 0-1 0-2 now 0-3 , 3 not in list, can insert 0-1 0-2 0-3 now lets consider 1-2 , of course have both of them , skip, let consider 2-3, again can skip, 3-4 , 3 exist not 4, can insert 3-4 , after inserting of 4 , 4 exist,so reject 2-4 comes 4-5 , 5-6, have following list 0-1 0-2 0-3 3-4 4-5 5-6 i have following code #include<iostream> #include<vector> #include<set> #include<algorithm> using namespace std; struct edge { int a, c; float weight;//edge a-c has weight bool operator() (edge x, edge y) { x.weight < y.weight; } }; int noncyclical_sum(vector<edge>s) { int total = 0; std::vector<std::pair<int, int>> b; auto m = make_

windows - Is there any alternative available of the "C:\Users\Public\Documents" folder? -

i wants read/write file in window os has default rights read , write user. curerunly writing in "c:\users\public\documents" has read/write file. due security reason not preferable . is there other alternative available of "c:\users\public\documents"? other %temp%. thanks,

python - Different Representation of Full file access paths by malware -

i using dynamic analysis malware detection. have list of files accessed malware , benign executable. aim build classifiers on information extracted through analysis reports. as of using file path string c:\hvtqk\modules\packages\reboot.py separate dimension in classifier. want know if there other innovative techniques can used featurize path strings ? you can use hash of lower case of path, , can consider directory not file name, since many malware write random file name, write common directories.

Angular 4 AOT with webpack -

i using angular 4 webpack 2 & trying use aot, giving me error: 10% building modules 4/5 modules 1 active ..._modules/intl/locale-data/jsonp/en.jsmodulenotfounderror: module not found: error: can't resolve './../$$_gendir/src/app/app.module.ngfactory' in '/users/xyz/angular-upgrade/backend/myapp/angular/src' . this webpack.config : new aotplugin({ tsconfigpath: './tsconfig.json', entrymodule: './src/app/app.module#appmodule' }), and script using make build is: "build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail" below tsconfig.json : { "compileroptions": { "target": "es5", "module": "commonjs", "moduleresolution": "node", "sourcemap": true, "emitdecoratormetadata": true, "experimentaldecorators": true, "lib": ["es2015&q

javascript - The Chrome extension popup is not working, click events are not handled -

Image
i have created javascript variable , when click on button should increment 1, not happening. here's manifest.json . { "name":"facebook", "version":"1.0", "description":"my facebook profile", "manifest_version":2, "browser_action":{ "default_icon":"google-plus-red-128.png", "default_popup":"hello.html" } } here code html page <!doctype html> <html> <head> <script> var a=0; function count() { a++; document.getelementbyid("demo").innerhtml=a; return a; } </script> </head> <body> <p id="demo">=a</p> <button type="button" onclick="count()">count</button> </body> </html> i want extension show me value of , increment 1 each time click on extension or button your code not working because violates default c