Posts

Showing posts from January, 2012

amazon s3 - S3 static hosting AccessDenied -

i have problem. created s3 bucket hosting. in properties settings, used static website hosting , index.html index document. in bucket policy use : { "version": "2012-10-17", "statement": [ { "sid": "publicreadforgetbucketobjects", "effect": "allow", "principal": "*", "action": "s3:getobject", "resource": "arn:aws:s3:::mybucket.com/*" } ] } when try open website browser url mybucket.com error accessdenied. when use mybucket.com/index.html works. what need change automatically uses index.html index file? thanks, syd

python - CSV module issue with csv files containing extra commas -

Image
i following along book foundation analytics python clinton w. brownley (o'reilly media inc.) for chapter 2 - read , write csv file (part 2) base python, csv module the script following: #!/usr/bin/env python3 import sys import csv input_file = sys.argv[1] output_file = sys.argv[2] open(input_file, 'r', newline='') csv_input_file: open(output_file, 'w', newline='') csv_output_file: filereader = csv.reader(csv_input_file, delimiter=',') filewriter = csv.writer(csv_output_file, delimiter=',') row_list in filereader: print(row_list) filewriter.writerow(row_list) the input file has fields containing commas (the dollar amounts in last 2 lines): supplier name,invoice number,part number,cost,purchase date supplier x,001-1001,2341,$500.00,1/20/14 supplier x,001-1001,2341,$500.00,1/20/14 supplier x,001-1001,5467,$750.00,1/20/14 supplier x,001-1001,5467,$750.00,1/20/14 suppli...

my computer can't find my csv file in r -

when try run csv file in rstudio, says "cannot open file 'bit121gbp.csv': no such file or directory error in file(file, "rt") : cannot open connection" mydata <- read.csv("bit121gbp.csv", header =true) should download different place, because right it's on desktop, or should change code? there 3 ways can read file. for example, have downloaded in desktop (example mac) then first: provide full path mydata <- read.csv("/users/test/desktop/bit121gbp.csv", header =true) second: provide relative path mydata <- read.csv("~/desktop/bit121gbp.csv", header =true) third: set path setwd("~/desktop") mydata <- read.csv("bit121gbp.csv", header =true)

c# - Run time Error while uploading images for ASP.Net MVC APP (AWS-EBS) -

Image
my end goal save file remote content directory in aws-ec2 windows instance. destination folder "c:\inetpub\wwwroot\content" in remote server.for using string serveradd=server.mappath("/"); i assuming above command automatically remote server root address. assumption wrong one. post building project below code still runtime error [httppost] public actionresult addimage(int? id, image im, httppostedfilebase imagepath) { string filename = path.getfilenamewithoutextension(imagepath.filename); string extension = path.getextension(imagepath.filename); filename = filename + datetime.now.tostring("yymmssff") +extension; string serveradd=server.mappath("/"); string remotepath = path.combine(serveradd,filename); imagepath.saveas(remotepath); } here link using temporarily

python - Trying to use TkInter with Socat in Docker - Mac -

here's steps.. installing socat , xquartz brew install socat brew cask install xquartz opening xquartz setting socat listener open -a xquartz socat tcp-listen:6000,reuseaddr,fork unix-client:\"$display\" running docker container display environmental variable docker run -e display=192.168.0.13:0 tkinter sh here's error i'm receiving. // container _tkinter.tclerror: couldn't connect display "192.168.0.13:0" // socat socat[37688] e connect(8, len=2 af=1 "", 2): invalid argument any other ip address gives me similar error doesn't show in socat can assume ip correct. any suggestion appreciated. are trying run gui app within docker? have seen this method? after open xquartz have allow connections network clients. know on linux have share .x11 volume , enable xhost , looks on mac have same: ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}') xhost + $ip docker run...

python/R string concatenation in recursion -

the data looks this a, b, yymm 1, 1, 1707 1, 2, 1707 1, 3, 1707 2, 3, 1706 2, 1, 1706 2, 2, 1706 2, 4, 1706 3, 3, 1705 3, 2, 1705 3, 1, 1704 3, 4, 1704 i output source , target concatenate a,b follows: source, target (1,1), (1,2) (1,1), (1,3) (1,2), (1,3) (2,3), (2,1) (2,3), (2,2) (2,3), (2,4) (2,1), (2,2) (2,1), (2,4) (2,2), (2,4) (3,3), (3,2) (3,1), (3,4) basically, calculate possible number of cases concatenation yymm view relations between 2 columns. at first, thought concatenating them through range : max-i , i+1 max, despite values being integer, feel should use them string since order matters. is there function available manipulate dataset want? appreciate suggestions. here 1 option. can use combn function , tidyverse package. library(tidyverse) dt2 <- dt %>% unite(value, a, b, sep = ",") %>% split(f = .$yymm) %>% map(function(x){ as_data_frame(t(combn(x$value, m = 2))) }) %>% bind_rows(.id = "yymm") ...

Matlab: Execute the loop until the specified conditions are met -

recently came across simple issues not solve on own. have simulink model uses matlab function calculations inside model. idea @ specified moment of time need change voltage of electric drive. , need change until rotor’s position reaches specified value. instance: if control_signal == 1; (command start execution); while angle ~= 180 \\ desired angle 180; control voltage = 5 - 0.1 (5v initial value, while increment of voltage change 0.1) end end so technically thinking happen, cycle executed until angle of 180 reached, @ value of control voltage (for instance 4.6). when running code, simulink can’t execute model. without warning or errors, simulation freezes @ stage (when main condition kicks in). looks can’t process further when cycle’s execution starts. can me code? because described behaviour of model during simulation caused above mentioned code. thank in advance. my guess convert value of angle expressed in radians degrees, , calculate angle...

arrays - yii activerecord return object -

i using using yii2 in basic template mysql database why code returns object instead of array of selected records database when use var_damp($rooms) output seems object , not array of selected record in array format; body can help public function actionindexfiltered() { $query = room::find(); $searchfilter = [ 'floor' => ['operator' => '', 'value' => ''], 'room_number' => ['operator' => '', 'value' => ''], 'price_per_day' => ['operator' => '', 'value' => ''], ]; if(isset($_post['searchfilter'])) { $fieldslist = ['floor', 'room_number', 'price_per_day']; foreach($fieldslist $field) { $fieldoperator = $_post['searchfilter'][$field]['operator']; ...

php - How to remove last comma from each array in foreach? -

i have multidimensional array , trying put comma delimiter , remove last comma each array far try this. $cars=array("volvo","bmw","toyota","honda","mercedes"); $chunks =(array_chunk($cars,2)); foreach ($chunks $key) { echo "<ul>"; $data = array(); foreach ($key $value) { $data[] ="<li>".$value."</li>".","; } rtrim($data, ","); echo "</ul>"; } foreach ($data $key ) { echo $key; } expected output: <ul> <li>volvo,</li><li>bmw</li> </ul> <ul> <li>toyota,</li><li>honda</li> </ul> <ul> <li>mercedes</li> </ul> notice there no comma after bmw , honda , or mercedes . here less-loopy method uses array_splice() instead of array_chunk() . no count() calls, no incrementing counters, 1 loop. code: ( de...

javascript - CSS link in laravel -

my css in following folder : assets/css/theme.css i add : layout/admin_header.blade.html but not work . looking forward . resource/assets storing assets can use toolkit gulpjs compress, minify or move pubic directory. /resources/assets not accessible via url. simply ensure assets/css/theme.css inside laravel public directory i.e public/assets/css/theme.css

Connection to mysql in BeaconControl Ruby system -

Image
i have problem in installing system: beaconcontrol.io this script in ruby lang. when install not connect tu mysql! can not understand why !

python - django blog archive, index and pagination comprehensive application -

background: i building blog research group. on publication archive page going display publications of mentor. here there side column show archive index allowing users view publications year. , @ bottom of page there django paginator separate publications in several pages 7 publications per page. problem: when pagination used, publications divided list, {{publication.published_time}} contain data in current page rather whole dataset. thus, wrote hard code of year information in front end , add url corresponding year. apparently, wish can distinct year information publications on basis of existence of paginator. besides, transfer year value directly in url. code: url.py : url(r'^publications/(?p<year>[0-9]{4})/$', publicationyeararchiveview.as_view(), name="publication_year_archive"), views.py : class publicationyeararchiveview(yeararchiveview): queryset = publication.objects.all() date_field = "published_time" make_ob...

calling a function inside a function inside a function and so on... for n times in python -

i working on mandelbrot set in python. want make function calls function inside function(and on) n times. like, 1st loop: f(x) 2nd loop: f(f(x)) 3rd loop: f(f(f(x))) and on... now made code. def f(x): return x**2 def g(x,n): if n == 0: return f(x) else: f(g(x,n-1)) g(2,5) now i'm expecting result f(f(f(f(f(2))))). , has error,"pow: 'nonetype' , 'int'". how can fix it? , proper method of doing it? for in range(n): x = f(x) print x

c++ - Can we pass data to DLLMain before it gets hooked? -

when process abc.cpp hooks dllmain , executes dll_process_attach . can pass data or parameter dllmain, can used inside dll_process_attach . as of using setprop , getprop of window api share data, while considering desktop window parent window. not sure pros , cons of approach. thanks in advance as far know can not pass parameter when attaching. can set environment variable, use registry...an ini file if want old-fashioned :-) or, can have function in dll called after loaded, , pass information parameter. if none of these solutions address problem, please explain trying accomplish, can better.

Ajax GET parameters not populated on Nginx -

i on laravel project works locally (get, post requests on forms ajax). hard part when deploy on nginx, works except ajax calls. don't have parameters passed controllers. have like $.ajax({ type: 'get', url: '{{route(' test.route ') }}', data: { valuepassed: 5 }, success: function(data) { alert(data); } }) with controller returning value passed return input::get('valuepassed') or return $request->valuepassed . value when running locally when on nginx param empty. here config : server { listen 80; listen [::]:80; root /var/www/html/mydomain/public; index index.php index.html index.htm index.nginx-debian.html; server_name mydomain.com www.mydomain.com; location / { try_files $uri $uri/ /index.php?query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.1-fpm.sock; } ps: i'...

python - Scapy generating a server request and response -

Image
i still new stack overflow if made mistake please forgive. here trying do. trying generate pcap resemble actual conversation when 1 ask url. here how doing it. from scapy.all import * syn = ip(dst='www.google.com') / tcp(dport=80, flags='s') syn syn_ack = sr1(syn) syn_ack getstr = 'get / http/1.1\r\nhost: www.google.com\r\n\r\n' request = ip(dst='www.google.com') / tcp(dport=80, sport=syn_ack[tcp].dport, seq=syn_ack[tcp].ack, ack=syn_ack[tcp].seq + 1, flags='a') / getstr request reply = sr1(request) reply pktdump = pcapwriter("banana.pcap", append=true, sync=true) pktdump.write(syn) pktdump.write(syn_ack) pktdump.write(request) pktdump.write(reply) r in reply: r[0].show2() print "---------------------second---------------------------" but generated pcap has problem red color on last packet when open wireshark please me, questions is, pcap capture entire conversation between server , client, if so, why get...

Make my MySQL query less verbose -

the following query real challenge me build wordpress site using wordpress wp_post table , wp_postmeta table , wp_user table. works contains lot of repeated statements. not sure how simplify (or if can be). tips simplifying , ridding repetition appreciated. the tables contain data this: wp_posts id | post_author | post_parent | post_type | post_title | post_date 2258 163 0 fep_message 2262 1 2258 fep_message re:a 2264 163 2258 fep_message re:a 1698 1 0 fep_message b 1692 1 0 fep_message c wp_postmeta meta_id | post_id | meta_key | meta_value 14696 2258 _fep_participants 1 14697 2258 _fep_participants 163 9819 1698 _fep_participants 163 9820 1698 _fep_participants 1 9759 1692 _fep_participants 163 9760 1692 _fep_participants 1 9815 1692 _fep_delete_by_1 14...

sql - How to simulate join concept using Micro service architecture -

i'm new @ micro service architecture, instance have 2 separate services in isolate machines , 2 sql databases, location.service has db below locations: [ {id: key, name: string} ] product.service has db below products: [ {id: key, name: string, locationid: key} ] these 2 services can work beside using event based message protocol amqp , sound nice. have problem listing products in ui this productid(ok), productname(ok), productlocationid(ok), productlocationname(???) how have solution listing products location name ? in simple monolith application, have join between these tables problem raises on multiple databases ? solution1: query should has nested having locationname example in orm tools var products = productservice.select(p => new productdto{ productid= p.id, productname= p.name, locationid= p.locationid, locationname= locationservice.getnamebyid(p.locationid) }).tolist(); may way not reasonable solution2: changing db design productservice this ...

How to Configure PHP executable in Visual Studio Code where my setup is Vagrant Ubuntu 16.06 in Windows 10 Host machine -

i have vagrant setup in machine , using homestead 7 laravel box php development. host computer running windows 10. i using visual studio code 1.15.1. my php executable not set in visual studio setting. how can configure php executable in current development environment? thanks. to set in visual studio code, following go file -> preferences -> settings. look the setting php.validate.executablepath = null, . point location of php.exe . (e.g. c:\php\php.exe). finally, copy onto user settings pane on right side save. output should this: php.validate.executablepath = "c:\php\php.exe",

java - Allure reporting does not generate with mvn test -Darguments -

problem: using allure reporting generate reports after running tests, when run tests manually within eclipse allure-results directory created inside /target/allure-results directory. however, when pass in arguments after calling maven command line, this: call mvn clean call mvn test -dbrowser=chrome -dseleniumenvironment=local -dreporttogenerate=censoredconfigsetting -dcucumber.options="--tags @censoredtag note: mvn clean test does generate allure-reports command line, why arguments breaking this? this instead, creating /cucumber/results/ directory in /target, confused why differs, doesn't seem these tags should have problems there, suspect possibly pom.xml causing issues. <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> ...

firebase - Angularfire - Get email by uid? #askfirebase -

i have ionic application using firebase opted use angularfire. running angularfire4. in application store uid , want email related uid. use email/password login provided firebase. how can translate uid email? the method found when using nodejs. the data exposed in client-side authentication sdks profile of authenticated user. there no way user data uid firebase authentication client-side sdks. while admittedly convenient, make leaking user-data way easy. the way look user data uid using admin sdk found. idea run in trusted environment (e.g. server control, or cloud functions) , selectively expose user data app needs.

Jenkins job hangs while pushing commits to Git repo -

Image
i'm using jenkins 2.74. i'm trying push commits git repo after doing changes. this pipeline code: stage('push git') { steps{ bat returnstdout: true, script: '"c:\\program files\\git\\bin\\git.exe" add -a' bat returnstdout: true, script: '"c:\\program files\\git\\bin\\git.exe" commit -m "upadte yaml"' bat returnstdout: true, script: '"c:\\program files\\git\\bin\\git.exe" push -u origin master' } } but, reason, job cannot completed , it's stuck this: i tried on machine, using windows cmd, , works. not on jenkins. what doing wrong?

c# - Edge intersection control -

im trying implement voronoi diagram generation. currently working this: when site event happens find intersection point between x = const , parabol. point draw through bisecting line between parabols focus , current site. line consists of 2 rays initally. both start @ intersection point, 1 goes left , other right. additionally bisecting lien have know f , g y = f*x +g. during circle event(getting vertex joins 2 edges) need find intersection point of 2 edges. following code works fine if midpoint(start of 2 rays) lies between 2 edge intersections. seems me quite happens mid point beyond 1 of intersection points, , intersection not happen. can find issue code? followed instruction(read c++ code in: http://blog.ivank.net/fortunes-algorithm-and-implementation.html ) sweepline moved top bottom , (0,0) top left. sweepline moves top bottom , (0,0) bottom left. math somewhere off. full code: https://codeshare.io/glwrqb public vector3 rayintersection(voronoiedge a, voronoiedge b) ...

Function to calculate Euclidean distance in R -

i trying implement knn classifier in r scratch on iris data set , part of have written function calculate euclidean distance. here code. known_data <- iris[1:15,c("sepal.length", "petal.length", "class")] unknown_data <- iris[16,c("sepal.length", "petal.length")] # euclidean distance euclidean_dist <- function(k,unk) { distance <- 0 for(i in 1:nrow(k)) distance[i] <- sqrt((k[,1][i] - unk[,1][i])^2 + (k[,2][i] - unk[,2][i])^2) return(distance) } euclidean_dist(known_data, unknown_data) however, when call function it's returning first value correctly , rest na. show have gone wrong code? in advance. the aim calculate distance between ith row of known_data, , single unknown_data point. how fix code when calculate distance[i] , you're trying access ith row of unknown data point, doesn't exits, , hence na . believe code should run fine if make following edits: known_data <- iris[...

php - Wordpress- A plugin that displays HTML content (Database) with a shortcode -

i run project has database in google sheets. need display information in interactive tables. i used sheetrock.js , handlebar.js (i wrote code , works want to). have wordpress website , want make plugin type shortcode , table coded appears on page. i have separate html file embedded styling (under <style></style> tags, no external css file). file has html boiler plate, , in <head></head> there links sheetrock.js, handlebar.js, , bootstrap. as far understand, php can't display html tags? tried doing following... <?php function showico() { ?> <!doctype html> <head> <!-- cdn links --> </head> <style> <!-- styling here, , know, it's not dry --> </style> <body> <!-- content want display (it has <script> tags, , variables) --> </body> </html> <?php return showico(); } add_shortcode ('add_ico','showico'); ?> perhaps doing wrong shortcode doesn...

angularjs - "Firebase Storage: User does not have permission to access 'user/image/1503219533621'." -

Image
i have upload image firebse, got above error. have update code, what's wrong in code? //our controller code image uplaod call after click on upload button /* * @summary: uploaduserimage , uplaod image * @param: event * @return: na * @descritipn:na */ $scope.uploaduserimage = function(event) { var userimagefile = $("#uploaduserimage")[0].files[0]; var product_storage_ref = firebase.storage().ref('user/image'); var rn = new date().gettime().tostring(); var task = product_storage_ref.child(rn).put(userimagefile).then(function(snapshot){ console.log(snapshot); }) } <span> <input type="file" id="uploaduserimage"> </span> <input type="button" class="btn btn-raised diruplbtn" value="submit" ng- click="uploaduserimage($event)">

android - Use Shared Preferences inside a fragment -

i want use shared preferences inside fragment. 1 check if fragment run first time , if yes stores value shared preference. don't know why doesn't work. here code. string user_name; @nullable @override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) { view view = inflater.inflate(r.layout.item_list_fragment, container, false); sharedpreferences sp = getactivity().getpreferences(context.mode_private); sharedpreferences.editor edit = sp.edit(); if(sp.getboolean("isfirst",true)) { edit.putboolean("isfirst", false); edit.putstring("first_name", firstrunactivity.username).apply(); } user_name = sp.getstring("first_name","not workking"); textview test = (textview) view.findviewbyid(r.id.test); test.settext(user_name); } from code, if did not set value of isfirst true return false if(sp.getbool...

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

i running os ububtu 16.04. ultimate goal able run php script cron job every minute. here php script located @ /var/www/html/tests/test/index.php : <?php $directorypath = $_server['document_root']."/tests/test/data/"; echo "directorypath: $directorypath<br><br>";//check $imagefilepathsarray = glob($directorypath . "*.{png,gif}", glob_brace); echo "<br><br>imagefilepathsarray: "; print_r($imagefilepathsarray);//check ?> when open php script in browser visiting url my-ip-address/tests/test/index.php , get: directorypath: /var/www/html/tests/test/data/ imagefilepathsarray:array( [0] => /var/www/html/tests/test/data/pic.png [1] => /var/www/html/tests/test/data/pic.gif ) before writing cron job in crontab file, need check if can run anywhere using terminal . opened ubuntu terminal @ /home/ location, , executed in terminal: sudo php /var/www/html/tests/test/index.php i got following out...

javascript - Import always undefined when installing self-authored library through npm -

i authoring small js library first time , have problems getting imports work when using library. the library structure this: . ├── src │ ├── element.js └── index.js element.js function element() { console.log('i element'); } export default element; index.js export { element } './src/element'; now when installing library through npm , importing it, import undefined . this: import { element } 'my-lib'; console.log(element); // undefined i guess there error somewhere, can't find it! can spot error? your error can solved 1 of 2 ways; changing element.js or changing other 2 scripts: element.js : ... export element; in case, named imports correctly reference function. index.js : export element './src/element'; ... import element 'my-lib'; in case, you're exporting/importing default namespace of element.js rather named one. the relevant documentation syntax can found @ mdn import , mdn ...

responsive - Custom 3 columns template [Bootstrap] -

Image
in site have bootstrap grid template 2 columns, this: i add box/column under under col-sm-4, respecting responsive bootstrap, in image: is possible? thank in advance. in grid system of bootstrap column used division row, create 2 rows in 1 column following ways .block { background: gray; min-height: 100px; height: 100%; } <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet" /> <div class="container" style="width:100%"> <div class="row"> <div class="col-sm-4"> <div class="row"> <div class="col-sm-12"> <div class="block"> </div> </div> </div> <div class="row"> <div class="col-sm-12"> <div class="block" style=...

php - Undefined variable if variable get result from array -

i have defined array. if 1 column (e.g. bayern 'by') empty, not receive variable $row_wohn_by , after in result is: notice: undefined variable: row_wohn_by simply erase not solution operate. expected defined $row_wohn_by 0 (zero) number. here code: $states = array( 'baden-württemberg' => 'bw', 'bayern' => 'by', 'berlin' => 'be', 'thüringen' => 'th' ); $numb_rows = mysqli_query($conn, 'select count(*) members priv_staat = "deutschland" '); $numb_row = mysqli_fetch_array($numb_rows); $total_wohn = $numb_row[0]; $query_wohn = mysqli_query($conn, "select `priv_land`, count(*) `count` `members` `priv_land` !=0 group `priv_land`"); while ($item_wohn = $query_wohn->fetch_assoc()) { ${...

php - why some project use fetch_assoc instead of fetch_all in mysqli -

why project use fetch_assoc in while loop instead of fetch_all in php:mysqli? they're identical when used in example, fetch_all wasn't available until php5.3. older code, using fetch_assoc option. there bit of tradition here, since fetch_assoc mirrors how you'd write code using old mysql_ extension. remember you'll have give fetch_all mysqli_assoc if want behave fetch_assoc .

php - Which controller should laravel packages extend from -

building package laravel 5, containing models, views & controllers. controller should packages extend avoid problems, if consumer of package, might have changed application default namespace different. i come across tutorials , blog-posts people use app\http\controllers\controller explaining how build package laravel. namespace devdojo\calculator; use illuminate\http\request; use app\http\requests; use app\http\controllers\controller; //<--- class calculatorcontroller extends controller { public function add($a, $b){ return $a + $b; } public function subtract($a, $b){ return $a - $b; } } i can see benefits of using applications controller, developer may have made adjustments, using class packagecontroller extends app\http\controllers\controller in package might not correct solution, it?! the same might apply app\http\requests , app\user (for user/auth found solution here ) .

php - Symfony error : Cannot connect to DB after DB update -

i had symfony 2 website connected mysql db, find, after changing contract host provider, needed tu update datas on new db, new names. created new db, php myadmin shows me fine on side. i updated paramaters.yml file follow in symfony project: parameters: database_host: newdbhostname.db.1and1.com database_port: 3306 database_name: newdbname database_user: newdbusername database_password: ********** mailer_transport: mail mailer_host: null mailer_user: null mailer_password: null secret: *sameasbefore* but since then, cannot connect db, , have weird error: warning: pdo::__construct(): php_network_getaddresses: getaddrinfo failed: name or service not known in /homepages/37/d627732413/htdocs/billetterielouvre/vendor/doctrine/dbal/lib/doctrine/dbal/driver/pdoconnection.php on line 43 this part corresponds to: public function __construct($dsn, $user = null, $password = null, array $options = null) { try { line 43 --> parent::__construct($dsn, $user, $password...

Trying to open and Read PDF file in c# in uwp -

in uwp, file opening file picker , stored storage file. , can turned pdfdocument. it's going if pdf file normal. it's not password protected pdf document. how ask user, password of pdf , open safely. thank you. pdfdocument contains ispasswordprotected property: true if portable document format (pdf) document password-protected; otherwise, false. so property if true, password required open pdf safely. if (pdfdocument.ispasswordprotected) { rootpage.notifyuser("document password protected.", notifytype.statusmessage); } else { rootpage.notifyuser("document not password protected.", notifytype.statusmessage); } more details please reference official sample .

Passing value from Groovy script to DataSync in SoapUI -

i have script loops through dataset x , each record in dataset x loops in dataset y , retrieves results. how can pass results datasink? a number of suggestions around have been use properties in groovy script have loop within receive results , if populate property every result guess able see last result in property, , datasink find last result. my code below: def goodweather = context.expand( '${#testcase#goodweather}' ) string if (goodweather.equals("false")) { def response = context.expand( '${cityweatherrequest#response#declare namespace ns1=\'http://tempuri.org/\'; //ns1:getcityweatherresponse[1]/ns1:getcityweatherresult[1]/ns1:weather[1]}' ) def cityinfo_city = context.expand( '${getcitiesds#cityinfo_city}' ) def cityinfo_country = context.expand( '${getcitiesds#cityinfo_country}' ) //keep count restrict number of returns. countsuggestedcities property. def count = context.expand( '${#testcase#countsugge...

talend - how to use the functions of tmap :sum and count -

Image
i use tmap component create measurements of fact table! how create measurements using sum total amount , count of account count example. i try doesn 't work: tmap component doesn't work aggregate function. please use tarregaterow such requirements

java - only the first file gets downloaded -

i have string array , want both files downloaded, reason it's first element of array gets downloaded. first element downloaded dropbox correctly need second 1 later. better if call preworks() function oncreate twice? can problem? thanks public void preworks() { asynctask = new asynctask<void, void, void>() { @override protected void doinbackground(void... params) { int count = 0; string[] txt_files = {"/l12.txt", "/l13.txt"}; (string filename : txt_files) { file file = new file(environment.getexternalstoragedirectory() .getabsolutepath() + "/do" + filename); string response = ""; if (!(file.exists())) { //file doesn't exist!! androidauthsession session = null; try { session = buildsession(); ...

How facebook team uses "custom parameters sent" in the facebook pixels? -

Image
i checked airbnb , once applied filters on website, fired facebook pixel information in custom parameters. how done i.e. how can facebook show specific ads people have viewed page on our website? after fired started getting, relevant suggestions when accessed facebook through same browser. work when user logged facebook same browser? is facebook associate pixel fired logged in facebook user on browser? , if same user comes facebook other device, he/she shown ads based on pixel?

php - Symfony - Multiple Fields for one Entity Attribute -

Image
i have 3 three select fields 1 entity attribute. picture below shows. is there way detect of select fields used; value , map corresponding attribute? and possible send parameters form type (in example testtype , please see below). trying make generic , re-usable other attributes. here have now. myform.php <?php namespace mybundle\form; use mybundle\form\type\testtype; use ..etc class myform extends abstracttype { public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('title', texttype::class) ->add('d1', testtype::class); } public function configureoptions(optionsresolver $resolver) { $resolver->setdefaults(array( 'data_class' => 'mybundle\entity\project' )); } public function getblockprefix() { return 'mybundle_project'; } } testtype.php <?php name...

android - ConstraintLayout TextView is not shown -

i got following problem in constraintlayout layout file: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorprimary" android:minheight="?android:attr/actionbarsize" android:orientation="horizontal" android:paddingend="8dp"> <android.support.constraint.constraintlayout android:id="@+id/layout_titlemode" android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:id=...

javascript - Why is getRandimInt returning undefined? -

i have array name winarr . let winarr = [[[1,2],[3,6],[4,8]], [[0,2],[4,7]], [[0,1],[4,6],[5,8]], [[0,6],[4,5]], [[0,8],[1,7],[2,6],[3,5]], [[2,8],[3,4]], [[0,3],[2,4],[7,8]], [[1,4],[6,8]], [[0,4],[2,5],[6,7]] ] ; now generating random integer 0 8. don't want got. function getrandomint(min, max) { min = math.ceil(min); max = math.floor(max); let ranint = math.floor(math.random() * (max - min)) + min; if(winarr[ranint] === null) { getrandomint(min,max) ; } else { winarr[ranint] = null ; return ranint ; } } i call function 9 times want different 9 integers getrandomint(0,8) ; each time. function returning undefined . change getrandomint(min,max) ; to return getrandomint(min, max);

Roslyn Setup - Powershell Scripts -

i've been trying install rosyln source code github , following build setup instructions . the first instruction run restore.cmd - produces following error message: file c:\code\roslyn-master\build\scripts\build.ps1 cannot loaded. file c:\code\roslyn-master\build\scripts\build.ps1 not digitally signed. cannot run script on current system. more information running scripts , setting execution policy, see about_execution_policies @ http://go.microsoft.com/fwlink/?linkid=135170. + categoryinfo : securityerror: (:) [], parentcontainserrorrecordexception + fullyqualifiederrorid : unauthorizedaccess i have used set-executionpolicy disable checking: ps c:\code\roslyn-master> get-executionpolicy -list scope executionpolicy ----- --------------- machinepolicy undefined userpolicy undefined process undefined currentuser undefined localmachine undefined however, still receiving same error. i'm running visual studio ...

Can Terraform be used to provision on-premises servers? -

i'm new terraform, how run on regular server? possible? talking - regular on premises machine terraform operates calling apis of various service providers , systems. in principle terraform can manage has api, , in practice has existing support few different on-premises-capable systems, including: openstack vmware vsphere cloudstack if compute resources in existing datacenter infrastructure managed 1 of these systems, or if willing install them, terraform can used manage @ least parts of these systems. (for full details, see documentation each provider linked above.) terraform's plugin architecture allows support other systems developed, other api-driven datacenter management systems such the foreman could supported terraform, , indeed third parties have developed integrations others distributed outside of "official set" hashicorp hosts.

Python: Scipy: brute optimization -

i getting error typeerror: objfunc() missing 1 required positional argument: 'q' when try brute optimize objective function. what doing wrong? def objfunc(p,q): return p**3-2**q; scipy.optimize import brute grid = (slice(1, 300, 1),slice(1, 300, 1)) solution = brute(objfunc, grid, finish=none,full_output = true) `enter code here`*typeerror: objfunc() missing 1 required positional argument: 'q'*''' thank you! you need correct objfunc. range q high , may change prevent overflows def objfunc(grid): p, q = grid return p**3-2**q; grid = (slice(1, 300, 1),slice(1, 30, 1))

linux - How do I use a text file as input in Python? -

Image
this may seem simple question first time have touched python bear me. i created simple bash script smtp enumeration , have been trying convert python script. bash script was: and far python script have this: but right now, have type in each username individually once , script closes. have created simple text file bunch of possible usernames , want able use usernames in file instead of typing them in individually 1 one not sure on how that. with open('users.txt') users: user in users: s.send(...)

php - How to store dynamically generated form input field and its data in database -

this how html field stor in database using ajax.the problem when print these form fields database, don't know how print value of these fields because form fields stor html in database.i need print value of dynamically generated form input field update. $("#save_field").on('submit',function (e) { var field = {}; var options = []; $.each($(this).serializearray(), function (i, f) { field[f.name] = f.value; if("options" == f.name.slice(0,7)){ options.push(f.value); } }); switch(field['type']){ case 'text': element = '<div class="form-group">'+ '<label class="col-md-3 control-label">'+field['label']+'</label>'+ ...