Posts

Showing posts from June, 2015

postgresql - Postgres user sees all schemas/tables -

when create new user database without rights, new user can still see schemas/tables etc. can't access them, still sees them. revoke these privileges, not know how. this how created user: create user wouter_test password 'wouter_test' nosuperuser nocreatedb nocreaterole nocreateuser inherit; based on post thought may have rights users have public schema , information public schema contains: https://dba.stackexchange.com/questions/98892/minimal-grants-for-readonly-single-table-access-on-postgresql based on wikisite: https://wiki.postgresql.org/wiki/shared_database_hosting used command revoke on schema public wouter_test; it did not work. following did not seem work either (to prevent user seeing , accessing database called klm ) revoke connect on database klm wouter_test; but still user, in pgadmin, can see databases, schemas , tables (including klm ). what doing wrong? you can revoke ... public forbid users use object, cannot keep user se

java - Spark sql with hive table delta support -

as latest version of spark (2.1.0) lists unsupported major functionality of hive like: tables buckets: bucket hash partitioning within hive table partition. spark sql doesn’t support buckets yet. it means hive tables have bucketed column structure won't loaded dataframe processed properly. there workaround achieve such functionality via jdbc , temp tables , etc. main question how achieve full control using spark sql on tables materialized deltas ?

sap - Creating method in ABAP OData service -

i working on odata service sap fiori application. when try code bapi inserting notifications database, doesn't work & don't know why. colleague told me it's because of missing mandatory parameters filled them , no result. here's code : method avisset_create_entity. data: ls_data type zcl_zpm_avis_mpc=>ts_avis. data: l_notif type bapi2080_nothdre-notif_no, l_notif_type type bapi2080-notif_type, l_notif_hd_exp type bapi2080_nothdre, l_notif_header type bapi2080_nothdri, i_return type table of bapiret2. io_data_provider->read_entry_data( importing es_data = ls_data ). if ls_data not initial. l_notif_type = 's3'. l_notif_header-equipment = ls_data-equnr. l_notif_header-reportedby = sy-uname. l_notif_header-short_text = ls_data-qmtxt. * l_notif_header-notif_date = ls_data-qmdat. l_notif_header-code_group = 'maindiag'. l_notif_header-coding = 'desi'. * l_notif_header-cod

webpack - Unable to deploy rails 5.1.0.beta1 app on heroku -

i new webpacks. started working rails 5.1.0beta1 version comes webpack support. deploying on heroku fails following error during asset compilation remote: sh: 1: ./node_modules/webpack/bin/webpack.js: not found remote: rake aborted! remote: json::parsererror: 743: unexpected token @ '' can please suggest how fix it. have tried doing this: heroku buildpacks:set heroku/nodejs --index 1 heroku buildpacks:set heroku/ruby --index 2

java - Multiple cache implementations at method level in Spring Boot -

what want is, 2 different cache implementations (let's redis , ehcache) on 1 method. meaning @cacheable method should cache both redis , ehcache. is possible? option 1: stack caches. configure local cache in spring. wire in distributed cache via cacheloader/cachewriter. consistency needs evaluated. e.g. if update goes distributed cache, how invalidate local caches? not trivial. maybe easy , not needed data, maybe near impossible. option 2: go distributed cache provides called near cache . combination want yourself, combined in product. know hazelcast , infinispan offer near cache. however, mileage may vary regarding consistency , resilience. know hazelcast enhanced near cache, consistent. interesting use case , common problem. further thoughts , discussion highly appreciated.

c# - SQLite-net Table<>() method call performance -

i using sqlite-net library xamain , have question. call better or faster? var item = sqliteconnection.table<user>().firstordefault(e => e.id == myobject.id); or var item = sqliteconnection.table<user>().where(e => e.id == myobject.id).firstordefault(); either fine. they both run lazily - if source list has million items, tenth item matches both iterate 10 items source. performance should identical , difference totally insignificant. but i started getting "the wait operation timed out." using where(query).firstordefault() on large dataset. when changed firstordefault(query) stopped seeing it the difference when compare 2 approaches working out 1ms on 150,000 items (not 1ms each item, it's 1ms 150,000). based on 500 x 1,000 items query that's 0.003ms per day. it's not significant but prefer firstordefault(query)

c# - Xamarin.Droid - Get device phone number -

i'm working on xamarin forms project in need able user's phone number device. figured out not possible on ios , windows phone, still want android, that's why i've found on internet piece of code should working on android. i'm using mvvm pattern. in viewmodel, try phone number way : string phonenumber = dependencyservice.get<iphonenumber>().getphonenumber(); which calls method class : public class phonenumber : iphonenumber { public string getphonenumber() { telephonymanager mtelephonymgr; mtelephonymgr = (telephonymanager)application.context.getsystemservice(context.telephonyservice); return mtelephonymgr.line1number; } } when run app on android emulator visual studio, works, phone number made of 11 digits. when i'm on real device, method returns empty string (""). i've put read_phone_state permission in androidmanifest.xml file. oh also, of course,

php - Facebook graph api - returns pages in random order -

i'm trying retrieve pages user admin via graph api. i've given manage_pages permission application however, making call: <user-id>/accounts returns set of pages doesn't return pages user can access admin user pages seem in random messed order. not alphabetically ordered nor ordered id. there way pages in pages user has access , ordered alphabetically atleast.

stored procedures - How to use row as a column in SQL Server 2014? -

Image
this result want first check in , last check out result want output this ------------------------------------------------------------------------------- attedate | staffname | staffid | shiftname|firmid| checkin |checkout | total duration -------------------------------------------------------------------------------- 2017-03-20|swapnil r gupta |5036 |general | 1 |09:09:41 |21:33:01 |12:24:01 using conditonal aggregation query, grouping date of attenddate . select attenddate = convert(date,t.attenddate) , t.staffname , t.staffid , t.shiftname , t.firmid , checkin = min(case when inoutmode = 'checkin' convert(time(0),t.attenddate) end) , checkout = max(case when inoutmode = 'checkout' convert(time(0),t.attenddate) end) t group t.staffname , t.staffid , t.shiftname , t.firmid , convert(date,t.attenddate)

javascript - Convert JSON to java script -

can provide java script below json. tried in many way, not add field "set" { "student":[ "set", [ { "name":"abcd", "id":"1234" } ] ] } so javascript variable object having property/key name student of array type. student has 2 elements set string , object , other element array , has element of object type. element has 2 properties/keys name , id . var required = {}; required.student = []; required.student.push("set"); var innerarray = []; var innerobj = {}; innerobj.name = "abcd"; innerobj.id = "1234"; innerarray.push(innerobj); required.student.push(innerarray); document.write('<pre> ' + json.stringify(required,0, 3) + '</pre>');

Speed up nested for-loops in python / going through numpy array -

say have 4 numpy arrays a,b,c,d , each size of (256,256,1792). want go through each element of arrays , it, but need in chunks of 256x256x256-cubes. my code looks this: for l in range(7): x, y, z, t = 0,0,0,0 m in range(a.shape[0]): n in range(a.shape[1]): o in range(256*l,256*(l+1)): t += d[m,n,o] * constant x += a[m,n,o] * d[m,n,o] * constant y += b[m,n,o] * d[m,n,o] * constant z += c[m,n,o] * d[m,n,o] * constant final = (x+y+z)/t dooutput(final) the code works , outputs want, awfully slow. i've read online kind of nested loops should avoided in python. cleanest solution it? (right i'm trying part of code in c , somehow import via cython or other tools, i'd love pure python solution) thanks add on willem van onsem 's solution first part seems work fine , think comprehend it. want modify values before summing them. looks like (within outer l loop)

ionic2 - Ionic 2 is not working in local machine -

i tried run ionic 2 basic application ubuntu 16.04.2 lts machine. after ionic serve command. it's showing message ,nothing building after message > ionic-app-base@ ionic:serve /home/user_name/desktop/training/ionicproject/testproject > ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729" following info based on ionic cordova cli: 6.5.0 ionic framework version: 2.3.0 ionic cli version: 2.2.1 ionic app lib version: 2.2.0 ionic app scripts version: 1.2.2 ios-deploy version: not installed ios-sim version: not installed os: linux 4.4 node version: v6.10.1 xcode version: not installed can check app-scripts version in package.json file. make "@ionic/app-scripts": "1.1.4" if not already. try running npm install again inside app folder. run ionic serve again.

ssh in shell script, then execute commands after password -

i'm trying write simple shell script execute commands on server box via ssh. i'm not trying pass password within shell script, i'm wondering how can run commands on box after password entered. so far, when execute script, nothing happens after enter password. or, executes when kill ssh process. i'm sure it's easy, i've been searching hours , nothing has come on net, because nobody else needs ask that. is there way natively within shell? thanks! look if want ssh without prompting password need key authentication rather password authentication. else try; sudo apt-get install sshpass sshpass -p your_password ssh user@hostname and execute command @ remote; ssh user@host 'command'

asp.net - Accent insensitive searching in RadComboBox -

i'm relatively new using asp webforms , telerik, i'm looking way allows me type special characters (é, ù, à, ...) in radcombobox . lets have name in objectdatasource called "rené somebody". need able find him searching "rene" , "rené", far no luck. in application managed on radgrid filters, same solution doesn't work radcombobox far know. the solution used in radgrid : http://www.telerik.com/forums/accent-insensitive-filtering-filtering-on-a-different-column#ys1qt8p1u0-crpfnfjvdza i have no access backend components demo linked contains frontend code , looks can hack in there. looks control may both client-server , client-side only. client-side hacks looks kind of complicated , invloves non-public api ( _oninputchange ) client-server case (which case) doc on client side of radcombobox object mentions requestitems method hacking reasonably future safe: var hackradcomboboxfilter = function (combobox, filterprocessingf

Python - Append particular numpy arrays based on value -

i trying find shorter way write code. i have 20 folders, each different value in name (1 - 20). in each folder there text files list of numbers in them. apply function each of these lists , append numpy list, 1 of 20, corresponding number in folder name. i trying find way append correct numpy array without having have 20 'if...else if' statements checking folder number. this code feels unnecessarily long , hoping more concise way it. -------- current psudocode ------ array_one = [] array_two = [] ... if folder_number == 1: array_one.append(list_from_folder) elif folder_number == 2: array_two.append(list_from_folder) ... any recommendations? (using python) use dictionary: folder_lists = {num: [] num in range(1, 21)} this give key: value mapping data structure in keys (e.g. 1, 2, 3, etc.) correspond folder numbers , values lists map keys (those folders): {1: [], 2: [], 3: [], ..., 20: []} then this: for f in folders: folder_num

html - While printing a div using window.print(), the margins in @page{ } are not getting applied -

html: <input type="button" onclick="printdiv('invoice')" value="print div!"/> <div id="invoice"> <!-- content--> </div> css: <head><style type="text/css" media="print"> @page{ margin-right : 0; margin-left : 0; margin-top : 1in; margin-bottom :1in; } </style> </head> when click on button print preview opens margin not applied.

php - Retrieve product custom field values in checkout custom fields -

i have form in single product page user insert informations (name, phone, country ,age ...) need display information in billing details . so, did added 2 fields form in single product , here code : <div class="col-md-6"> <div class="form-group"> <input class="form-control alt" name="billing_vol" type="text" placeholder="<?php esc_html_e( 'n° vol : *', 'rentcar' ); ?>" > </div> </div> <div class="form-group"> <input class="form-control alt" type="text" name="billing_cli_age" placeholder="<?php esc_html_e( 'age *', 'rentcar' ); ?>" " > </div><div class="col-md-6">

hadoop - How to kill a TEZ job started by hive? -

below can find. problem if reuse jdbc hive session hive queries go same application-id. there way can kill dag? tez jobs can listed using: yarn application -list tez jobs can killed using: yarn application -kill application-id

javascript - underscore filter array of nested objects -

i have following array of objects: [{key: "test", values: [{key: "2015-05", values: [{1:2}, {3:4}]}, {}], ...] i want filter key value left values after date. i have this, resulting structure wrong _.map(temp1, function(value, key) { return _.filter(value.values, function(v) { return v.key > "2015-05"; }); }); slight improvement on frank's answer : var data = [ { key: "1", values: [ {key: "2014-05", values: [{1:2}, {3:4}]}, {key: "2015-05", values: [{1:2}, {3:4}]}, {key: "2013-05", values: [{1:2}, {3:4}]} ] }, { key: "2", values: [ {key: "2014-05", values: [{1:2}, {3:4}]}, {key: "2015-05", values: [{1:2}, {3:4}]}, {key: "2013-05", values: [{1:2}, {3:4}]} ] } ]; var = _.map(data, (d) => { d.values = _.filter(d.values, (v) => v.key > "2014&

json - How to set templated key name in ansible also on second level? -

assuming have following variable definition in ansible: users: - username: root password: "changeme" services: - mariadbroot - username: mediawikiadmin password: "changeme" services: - mediawikiadmin - username: hanshuber password: "changeme" services: - mediawikiuser this data not perfect accessing specific user. want rewrite data different format. rewriting users list, dictionary access user directly. illustrate this, example set only! root password above format: - name: set root passwd shell: echo "root:{{ item.password }}" | chpasswd with_items: - "{{ users }}" when: "{{ item.username }} == 'root'" this not nice , gets more complicated when handling services list. purpose want rewrite users list dictionary, access root user directly follows: - name: set root passwd shell: echo "root:{{ users_byusername['root'] }}" | chpasswd

angular - Gulp - Generate Output CSS files in Same Direcotry as of SCSS file -

i using gulp compile scss, uglify , concat , doing when try output in 1 specific file. but want achieve gulp shall output css files in same directory of scss file. eg. src | app | folder1 | style1.scss style1.css folder2 | style2.scss style2.css what doing right below gulp file var gulp = require("gulp"); var uglify = require("gulp-uglify"); var concat = require("gulp-concat"); var sass = require("gulp-sass"); var debug = require("gulp-debug"); gulp.task('css', function () { gulp.src( "/*.scss" ).pipe(concat('styles.css')) pipe(sass().on('error', sass.logerror)) .pipe(debug({ title: 'unicorn:' })) .pipe(gulp.dest("./src")); }) gulp.task('minify', ['css', 'default']); gulp.task('default', function () { console.log("default task"); }) this genera

Ruby on rails Unknow attribute when importing csv file to database -

i'm trying import csv file ruby on rails app database. got error unknown attribute '2191' landslide. when running bundle exec rake db:import_csv . 2191 first item on first row of csv file. import_csv.rake require 'csv' namespace :db task :import_csv => :environment csv.foreach("sample_landslides.csv", :headers => true) |row| landslide.create!(row.to_hash) end end end schema create_table "landslides", force: :cascade |t| t.integer "total_id" t.integer "year_id" t.date "start_date" t.date "end_date" t.integer "day_number" t.string "continent" t.string "country" t.string "location" t.string "type" t.integer "admin_level" t.float "lat" t.float "lng" t.boolean "mapped" t.float "spatial_area"

android - ActiveAndroid duplicate column name -

in app i'm using `activeandroid'. during app version i'm using migration files , increasing db version in documentation. assume: 1. there device app version 1 (user doesn't update). 2. in app version 2 add new table "mynewtable". 3. in app version 3 add new column "mynewcolumn" "mynewtable". 4. in app version 4 change in db. migration script: alter table mynewtable add column mynewcolumn text; the user app version 1 upgrade version 4 , getting following exception: android.database.sqlite.sqliteexception: duplicate column name: mynewcolumn (code 1): , while compiling: alter table mynewtable add column mynewcolumn text similar problem . does know resolve issue?

postgresql - Declaring a variable in postgres from python -

i have variable value set user each time person runs query. running script in python makes call postgres database. hoping first assigning value variable in 1 piece of sql code , hoping call variable in second piece of sql code. here current code: first code set postgres variable: sql_statevar=(""" tempstate varchar:= %s """ ,(statevar,)) cur.execute(*sql_statevar) then variable set in postgres, going call stored variable: sqlquery=(""" select upper(b.state) state, opentable_full b upper(b.state)=upper(tempstate) group upper(b.state) """) then have following code: outputquery = "copy({0}) stdout csv header".format(sqlquery) open('resultsfile', 'w') f: cur.copy_expert(outputquery, file=f) i have seen several answers regarding limitations of setting variables in postgres, new postgres, not sure if these

tfs - Run single PS script from Release definition without pulling down entire project -

in release definition, want run single ps script lives in source control (tfvc in case). don't see way without tfs pulling down entire source tree containing 1 script on agent machine. have unversioned copy of script out on agent machine, , reference absolute path release definition. works, i'm not guaranteed latest version of script run @ release time. you have @ least 2 way it: define mapping picks need -- can define mapping single file, e.g. cloak $/ , map $/path_to_my_file use dummy build collects file need , save them artifacts, explained technique in http://blog.casavian.eu/2017/03/04/mixing-tfvc-and-git/

serialization - Spark Task not Serializable Hadoop-MongoDB-Connector Enron -

i trying run enronmail example of hadoop-mongodb connector spark. therefore using java code example github: https://github.com/mongodb/mongo-hadoop/blob/master/examples/enron/spark/src/main/java/com/mongodb/spark/examples/enron/enron.java adjusted server name , added username , password according needs. the error message got following: exception in thread "main" org.apache.spark.sparkexception: task not serializable @ org.apache.spark.util.closurecleaner$.ensureserializable(closurecleaner.scala:304) @ org.apache.spark.util.closurecleaner$.org$apache$spark$util$closurecleaner$$clean(closurecleaner.scala:294) @ org.apache.spark.util.closurecleaner$.clean(closurecleaner.scala:122) @ org.apache.spark.sparkcontext.clean(sparkcontext.scala:2066) @ org.apache.spark.rdd.rdd$$anonfun$flatmap$1.apply(rdd.scala:333) @ org.apache.spark.rdd.rdd$$anonfun$flatmap$1.apply(rdd.scala:332) @ org.apache.spark.rdd.rddoperationscope$.withscope(rddoperationscope

Vim using Syntastic plugin 'mpi.h' not found -

i'm using vim 7.4 on ubuntu 16.04. have syntastic plugin installed via pathogen. i'm doing coding in c using mpi library. when write code using vim, syntastic seems believe there error , tells me "'mpi.h' file not found" (this #include <mpi.h> ). know program compiles i'm able run mpicc successfully. when run locate mpi.h back: /usr/lib/openmpi/include/mpi.h /usr/lib/openmpi/include/openmpi/ompi/mpi/fortran/mpif-h/prototypes_mpi.h /usr/src/linux-headers-4.4.0-62/include/linux/mpi.h /usr/src/linux-headers-4.4.0-66/include/linux/mpi.h how can vim stop giving me these errors? create file .syntastic_cpp_config in project home folder. have include folders listed in it. in case, -i/usr/lib/openmpi/include or other folder mpi.h, whichever use in build.

How properly bundle scss/sass files with angular-cli? -

trying migrate gulp angular-cli. in gulp have separate plugin scss bundling -- run task , result index.html... when installing project using angular-cli, makes use of css default. in order use scss need following: install node-sass using npm install node-sass --save-dev (this used compile scss css) rename css files .scss update references css files use correct url that's should required in order use scss. see: https://www.dropbox.com/s/7i8k7578pr1klsl/angular-cli-test.zip?dl=0 running example note: scss not belong components should go styles.scss (which names styles.css , you've renamed it).

c# - Change font encoding in itextsharp -

my main purpose displaying chinese font in pdf. the code have modify backgroundcolor = fonthelper.getpdfcolor(0, 0, 255), fontcolor = fonthelper.getpdfcolor(0, 255, 0), fontstyle = fontstyle.normal, fontencoding = fontencodings.cp1252, fontname = fontnames.times_roman it seems issue fontencodings.cp1252 or/and fontnames.times_roman, , read related post think, can't find simple solution. i don't know enough code i'm working on, modify less possible. saw solution fontselector or else , it's different have in code, , hos integrate code. pretty solution old, , potentially not date. so, exist simple way modify font ? this minimal viable code-sample think of shows how change font piece of text. static void main(string[] args) { // setup pdfwriter writer = new pdfwriter(@"c:\users\joris schellekens\downloads\output.pdf"); pdfdocument pdfdocument = new pdfdocument(writer); document doc = new document(pdfdocument); // font p

magento - Stripe payment : Can I manage subscription from diffrent Application for next billing -

my client's customers placed subscription/recurring order clickfunnels , want manage these recurring orders magento next billing. cryozonic stripe subscriptions module installed in magento store. can guide me possible custom code or alternate way? looking forward positive response.

python - Pycharm is not making changes to the file system -

Image
i'm working on django project pycharm. can see screenshot, have html file named base_generic.html , directory called blog/ @ ~/pycharmprojects/diyblog/templates/ . however, executing ls ~/pycharmprojects/diyblog/templates/ in terminal prints nothing, means file not exist in actual file system. i've noticed file name in green, presumably because it's newly-created file. i'm using git vcs, matter? have git add -a and/or git commit -m 'ignore me -- making change file system' changes applied file system? this content of version control: console 12:13:27.760: [diyblog] git -c core.quotepath=false rm --ignore-unmatch --cached -- .idea/inspectionprofiles/profiles_settings.xml 12:13:35.439: [diyblog] git -c core.quotepath=false add --ignore-errors -- .idea/vcs.xml 20:27:02.649: [diyblog] git -c core.quotepath=false add --ignore-errors -- .idea/datasources.xml 21:09:40.354: [diyblog] git -c core.quotepath=false add --ignore-errors -- templates/base_gen

MS Access currentdb.excute has different result than Docmd.RunSQL -

i use vba run insert ... select... sql query currentdb.execute command. however, have trouble result. there rows missing data. the result correct when using docmd.runsql same sql, don't want warning message inserting data table. i tried using select... currentdb.execute , print result on debug window. result correct, no missing data. here's code: strsql = strsql & "insert templineitems (orderno, positionno, partno, [description], planneddeliverydate, qty, unit, price, curr, txta, lineitemtext, discount, tax) " strsql = strsql & "select dbo_ttdsls041600.t_orno, dbo_ttdsls041600.t_pono, dbo_ttdsls041600.t_item, iif(dbo_ttipcs021600.t_dsca null,dbo_ttiitm001600.t_dsca,dbo_ttipcs021600.t_dsca) t_dsca, dbo_ttdsls041600.t_ddta, dbo_ttdsls041600.t_oqua, dbo_ttdsls041600.t_cups, dbo_ttdsls041600.t_pric, dbo_ttdsls040600.t_ccur, dbo_ttdsls041600.t_txta, null lineitemtext, dbo_ttdsls041600.t_disc_1, dbo_ttdsls041600.t_cvat " strsql = strsql & &

vapor toolbox broken after upgrading swift -

vapor toolbox crashing when trying use after upgrading swift 3.1. dyld: lazy symbol binding failed: symbol not found: __ttsfq4n_s___tfvss13characterview38_measureextendedgraphemeclusterforwardft4fromvvss17unicodescalarview5index_si referenced from: /usr/local/bin/vapor expected in: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/lib/swift/macosx/libswiftcore.dylib dyld: symbol not found: __ttsfq4n_s___tfvss13characterview38_measureextendedgraphemeclusterforwardft4fromvvss17unicodescalarview5index_si referenced from: /usr/local/bin/vapor expected in: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/lib/swift/macosx/libswiftcore.dylib swift abi not yet stable. thus, swift programs (like vapor toolbox) must recompiled work new versions of language. reinstall brew simply re-installing toolbox should fix issue. brew reinstall vapor/tap/vapor replace old installation brew you may need delet

javascript - Google map markers not removing upon checkbox action -

i having problem trying filter list fetched database upon checkbox action , plot/clear markers onto map. here checkbox declaration in html: <div class=""> <label> <input type="checkbox" class="js-switch" name="tags" value="3" onchange="filterlist()" unchecked/> mrt incidents </label> </div> when checkbox onchange, filtering list fetched database: function filterlist(){ var tags = document.getelementsbyname('tags'); var = 0; {% crisis in data %} // code store fields in database local var for( ; < tags.length; i++ ) { if( tags[i].checked ) { value = tags[i].value; // got 4 category 1-fire, 2-flood, 3-mrt, 4-dengue // doing here check if checkbox value equal category id database, if equal, push them filteredlist

Using Python multiprocessing in Slurm, and which combination of ntasks or ncpus I need -

i'm trying run python script on slurm cluster, , i'm using python's built-in multiprocessing module. i'm using quite simple set up, testing purpose, example is: len(arg_list) out[2]: 5 threads = multiprocessing.pool(5) output = threads.map(func, arg_list) so func applied 5 times in parallel on 5 arguments in arg_list . want know how allocate correct amount of cpu's/tasks in slurm work expected. relevant part of slurm batch script looks like: #!/bin/bash # runtime , memory #sbatch --time=90:00:00 #sbatch --mem-per-cpu=2g # parallel jobs #sbatch --cpus-per-task=10 ##sbatch --nodes=2 #sbatch --ntasks=1 ##sbatch --ntasks-per-node=4 #### shell commands below line #### srun ./script_wrapper.py 'test' as can see, @ moment have ntasks=1 , cpus-per-task=10 . note main bulk of func contains scipy routine tends run on 2 cores (i.e uses 200% cpu usage, why want 10 cpus , not 5). is correct way allocate resources purposes, because @ moment job t

Sublime text - View in Browser not working -

i installed view in browser plugin package control in sublime text 3. when run it, happens: traceback (most recent call last): file "c:\program files\sublime text 3\sublime_plugin.py", line 818, in run_ return self.run(edit) file "viewinbrowsercommand in c:\users****\appdata\roaming\sublime text 3\installed packages\view in browser.sublime-package", line 238, in run file "viewinbrowsercommand in c:\users****\appdata\roaming\sublime text 3\installed packages\view in browser.sublime-package", line 191, in openbrowser file "./python3.3/subprocess.py", line 819, in init file "./python3.3/subprocess.py", line 1110, in _execute_child filenotfounderror: [winerror 2] system cannot find file specified what going wrong?

android java lang abstractstringbuilder enlargebuffer out of memory error -

in application try implement cache data in device present in offline mode. works fine before crash. fatal exception: java.lang.outofmemoryerror @ java.lang.abstractstringbuilder.enlargebuffer(abstractstringbuilder.java:94) @ java.lang.abstractstringbuilder.append0(abstractstringbuilder.java:132) @ java.lang.stringbuilder.append(stringbuilder.java:124) @ org.json.jsonstringer.string(jsonstringer.java:344) @ org.json.jsonstringer.value(jsonstringer.java:252) @ org.json.jsonobject.writeto(jsonobject.java:672) @ org.json.jsonstringer.value(jsonstringer.java:237) @ org.json.jsonobject.writeto(jsonobject.java:672) @ org.json.jsonstringer.value(jsonstringer.java:237) @ org.json.jsonobject.writeto(jsonobject.java:672) @ org.json.jsonstringer.value(jsonstringer.java:237) @ org.json.jsonobject.writeto(jsonobject.java:672) @ org.json.jsonstringer.value(jsonstringer.java:237) @ org.json.jsonarray.writeto(jsonarray.java:602) @ org.json.jsonstringer

visual studio 2013 - VSTO Click-Once Certificate breaks TFS 2015 build -

i develop excel 2010 addin. therefor have click-once installer corresponding certificate. works fine on machine have build on tfs 2015. when ever signing switch on, messages telling me: [error]c:\program files (x86)\msbuild\12.0\bin\microsoft.common.currentversion.targets(2718,5): error msb3326: cannot import following key file: . key file may password protected. correct this, try import certificate again or import certificate manually current user's personal certificate store. c:\program files (x86)\msbuild\12.0\bin\microsoft.common.currentversion.targets(2718,5): error msb3326: cannot import following key file: . key file may password protected. correct this, try import certificate again or import certificate manually current user's personal certificate store. [error]c:\program files (x86)\msbuild\12.0\bin\microsoft.common.currentversion.targets(2718,5): error msb3321: importing key file "my cert.pfx" canceled. if

datetime format - JAVA OffsetDateTime custom hundredth of second -

i looking custom format of date , can't obtain it. i want obtain "1997-07-16t19:20:30.45+01:00" using following code : offsetdatetime o = offsetdatetime.now(); string l = o.format(datetimeformatter.iso_date_time); the result is: 2017-03-28t16:23:57.489+02:00 very close, need have hh:mm:ss.xx , , not hh:mm:ss.xxx . do know how customize offsetdatetime ? can't find examples. your answer almost correct. if take @ datetimeformatter javadoc , you'll see lowercase s corresponds seconds , , uppercase s , fraction of seconds : symbol meaning presentation examples ------ ------- ------------ ------- s second-of-minute number 55 s fraction-of-second fraction 978 so, in pattern, s , s inverted. correct pattern is: datetimeformatter formatter = datetimeformatter.ofpattern("yyyy-mm-dd't'hh:mm:ss.ssxxx"); offsetdatet

How to access sql server database, which is using windows authentication, using android -

i have access sql server database using windows authentication log in.the exception says user can't authenticated, because server using windows login instead of sql login? also, user account has no password, default admin account, have specify differently when trying connect database? know not new question , problem has been solved please assist me working solution. have following code: import android.os.asynctask; import android.os.strictmode; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.textview; import java.sql.connection; import java.sql.driver; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import java.util.properties; public class mainactivity extends appcompatactivity { textview tvtest; connection connection; string un,password,db,ip; @override protected void oncre

amazon web services - How come I can't access AWS instance using Private DNS Address -

i set aws instance in vpc private ip address -- no public ip address. going mongodb instance , accessed other servers within vpc. established successful vpn connection , can ssh using putty instance using private ip address - "10.0.0.95". far, good. noticed private ip address has private dns - "ip-10-0-0-95.internal". tried using private dns access instance through vpn got putty error "unable open connection ip-10-0-0-95.ec2.internal. host not exist". clearly, can use 10.0.0.95 ip address surprised private dns name did not work. how come? you should enable dns resolution vpc, or won't able resolve internal dns names. to use private hosted zones, must set following amazon vpc settings true: enablednshostnames enablednssupport steps enable dns resolution: open amazon vpc console @ https://console.aws.amazon.com/vpc/ . in navigation pane, choose vpc. select vpc list, choose actions , either edit dns resolution or edit d

javascript - js fullscreen toggle button goes to fullscreen but won't exit it -

i have function tied onclick event of button. should check see if documentelement should toggle full screen mode , swap button image. function togglefs() { var fsmode = (document.fullscreenelement && document.fullscreenelement !== null) || // alternative standard method (document.mozfullscreen || document.webkitisfullscreen); var page = document.documentelement; if(!fsmode) { if(page.requestfullscreen) { page.requestfullscreen(); } else if (page.mozrequestfullscreen) { page.mozrequestfullscreen(); } else if (page.webkitrequestfullscreen) { page.webkitrequestfullscreen(); } document.getelementbyid("toggle-fs").innerhtml = '<img src="/images/nofs.png">'; } else { if (page.exitfullscreen) { page.exitfullscreen(); } else if (page.msexitfullscreen) { page.msexitfullscreen(); } else if (page.

regex - Is there any need to escape the slash('/') character for regular expressions in Java -

i have following code snippet: pattern patternofslashcontainingbackslash=pattern.compile("\\/"); pattern patternofslashnotcontainingbackslash=pattern.compile("/"); string slash = "/"; matcher matcherofslashcontainingbackslash = patternofslashcontainingbackslash.matcher(slash); matcher matcherofslashnotcontainingbackslash = patternofslashnotcontainingbackslash.matcher(slash); //both patterns match slash system.out.println(matcherofslashcontainingbackslash.matches()); system.out.println(matcherofslashnotcontainingbackslash.matches()); my questions: what difference (from java perspective) between 2 patterns, or there difference? is '/' character plain character regex(not special character ']' is) ,from java perspective? the java version on run 1.8 this question different others, since makes clear patterns "\\/" , "/" same java programming language. thank much! / not special in java regex, i

google app engine - AppEngine's urlfetch, how to force timeout to be respected -

i'm using urlfetch google appengine, , add deadline parameter force deadline short (3 seconds), following : try: urlfetch.set_default_fetch_deadline(3) return urlfetch.fetch(url='http://www.example.com', method=urlfetch.get, deadline=3) except google.appengine.runtime.apiproxy_errors.deadlineexceedederror: pass except google.appengine.api.urlfetch_errors.deadlineexceedederror: pass return none but no matter what, thread goes on , on 60 seconds (the max execution time http request on appengine) , fail miserably on deadlineexception ("thread running after request."). is there way ensure upper query strictly stopped in 3 seconds? i can share code have running in 1 of production projects. use deadline of 0.5 seconds in example. last checked, it's still working: t_rpc = urlfetch.create_rpc(deadline=0.5) urlfetch.make_fetch_call(t_rpc, url) # , later... try: result = t_rpc.get_result() except: # handle errors... pass

pdf - Set Table Column width problems in iText7 -

when want create table in pdf, can use following 2 ways : first 1 failed. method 1: float[] columnwidths = {20, 30, 50}; table table = new table(columnwidths); it's failed control columnwidths method 2: unitvalue[] unitvalue = new unitvalue[]{ unitvalue.createpercentvalue((float) 20), unitvalue.createpercentvalue((float) 30), unitvalue.createpercentvalue((float) 50)}; table table = new table(columnwidths); it's success! why happen? yes, there no way scale column widths in itext 7.0.2, vernon said. if want use directly 20, 30, , 50 points columns despite min widths shall use construction: table table = new table(new float[] {20, 30, 50}) // in points .setwidth(100) //100 pt .setfixedlayout(); if set fixed layout must set width well, required fixed layout.

dynamic - Removing Points From the Start of a Chart When Past a Certain Size in C# -

i writing data chart com port during run time. such, chart dynamically updating gets increasingly bigger, scale changes making line smaller , smaller. wish stop deleting points off front of chart after it's big. if (chartmain.series.points.count() >= 120) { chartmain.series[0].points.removeat(0); } i need deletes first point after size scale remains same. however, not work in it's current form , unsure in how approach problem. can point me in right direction? thank in advance.

How do I compare strings in Java? -

i've been using == operator in program compare strings far. however, ran bug, changed 1 of them .equals() instead, , fixed bug. is == bad? when should , should not used? what's difference? == tests reference equality (whether same object). .equals() tests value equality (whether logically "equal"). objects.equals() checks nulls before calling .equals() don't have (available of jdk7, available in guava ). consequently, if want test whether 2 strings have same value want use objects.equals() . // these 2 have same value new string("test").equals("test") // --> true // ... not same object new string("test") == "test" // --> false // ... neither these new string("test") == new string("test") // --> false // ... these because literals interned // compiler , refer same object "test" == "test" // --> true // ... should call objects.equals() o

How to develop multi-touch applications in ubuntu 16.04 through javafx? -

the javafx application: import javafx.application.application; import javafx.event.eventhandler; import javafx.scene.group; import javafx.scene.scene; import javafx.scene.input.mouseevent; import javafx.scene.input.rotateevent; import javafx.scene.input.scrollevent; import javafx.scene.input.swipeevent; import javafx.scene.input.touchevent; import javafx.scene.input.zoomevent; import javafx.scene.shape.rectangle; import javafx.stage.stage; public class main extends application { public static void main(string[] args) { application.launch(args); } @override public void start(stage primarystage) { group root = new group(); scene scene = new scene(root, 300, 250); rectangle rect = new rectangle(); rect.setwidth(100); rect.setheight(100); root.getchildren().add(rect); rect.setonscroll(new eventhandler<scrollevent>() { @override public void handle(scrollevent event) { if (!event.isinertia()) { rect.settranslatex(rect.gettranslatex() + event.getde

ios - Make an object orbit another in SceneKit -

say have 2 nodes in scenekit scene. want 1 rotate around or orbit (like planet orbiting star), other node once in time interval. know can set animations so: let anim = cabasicanimation(keypath: "rotation") anim.fromvalue = nsvalue(scnvector4: scnvector4(x: 0, y: 1, z: 0, w: 0)) anim.tovalue = nsvalue(scnvector4: scnvector4(x: 0, y: 1, z: 0, w: float(2 * double.pi))) anim.duration = 60 anim.repeatcount = .infinity parentnode.addanimation(aim, forkey: "spin around") is there animation "orbiting", , way specify target node? the way using additional (helper) scnnode. you'll use fact adds own coordinate system , of child nodes move (helper) coordinate system. child nodes off-centre orbiting if view them world coordinate system. you add helpernode @ centre of fixedplanetnode (orbited planet), perhaps child, @ same position you add orbitingplanetnode child helpernode , offset on 1 of axes, e.g. 10 points on x axis you start he

java - Spark 1.6-Failed to locate the winutils binary in the hadoop binary path -

Image
i know there similar post one( failed locate winutils binary in hadoop binary path ), however, have tried every step suggested , same error still appears. i'm trying use apache spark version 1.6.0 on windows 7 perform tutorial on page http://spark.apache.org/docs/latest/streaming-programming-guide.html , using code: ./bin/run-example streaming.javanetworkwordcount localhost 9999 however, error keeps appearing: after reading post failed locate winutils binary in hadoop binary path i realized needed winutils.exe file, have downloaded hadoop binary 2.6.0 it, defined environment variable called hadoop_home: value c:\users\geral\desktop\hadoop-2.6.0\bin and placed on path this: %hadoop_home% yet same error still appears when try code. know how solve this? if running spark on windows hadoop, need ensure windows hadoop installation installed. run spark need have winutils.exe , winutils.dll in hadoop home directory bin folder. i ask try first: 1) can do

java - Can not connect to elasticsearch container in docker -

i'm trying use official elasticsearch image docker , followed this guide when i'm trying connect elasticsearch cluster had exception nonodeavailableexception[none of configured nodes available my code transportclient client = new prebuilttransportclient(settings.builder().put("cluster.name", "docker-cluster") .build()) .addtransportaddress(new inetsockettransportaddress(inetaddress.getbyname("127.0.0.1"), 9300)); to run elasticsearch container used command docker run -p 9200:9200 -p 9300:9300 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" docker.elastic.co/elasticsearch/elasticsearch:5.2.2 and when open browser on localhost:9200 browser shows text { "name" : "j5oojco", "cluster_name" : "docker-cluster", "cluster_uuid" : "sfkgajmat_sb3erfyul7sq", "version" : { "number" : "5.2.2&