Posts

Showing posts from February, 2012

ios - XMPP Room Creation Denied (403) -

i trying create chatroom in xmpp (cloned chatsecure not letting me create chatroom.this response while creating chat room. <presence xmlns="jabber:client" from="16d8ecb3-ce47-42cb-90aa-cbd9eade37ac@conference.myserver/92313456778@myserver" to="92313456778@myserver/phone" type="error"><x xmlns="http://jabber.org/protocol/muc"/><x xmlns="vcard-temp:x:update"><photo>f0858329475df2054ad8e8ac8674e7b4f25aedcd</photo></x><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://github.com/robbiehanson/xmppframework" ver="ye4evqderi5tsqrbmzg1547iiau="/><error code="403" type="auth"><forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">room creation denied service policy</text></error></presence> well,

osx - Running Calabash via SSH on Mac iOS Simulator Launch Fails -

i'm trying run calabash test cases on mac vis ssh mac. user ssh in not admin i've given permission described @ https://superuser.com/questions/166179/how-to-enable-remote-access-for-another-account-on-mac-remotely-via-ssh so after bundle exec cucumber test cases start run ios simulator doesn't launch , fails error: lsopenurlswithrole() failed application /applications/xcode.app/contents/developer/applications/simulator.app error -10810. anyone know why happens? after ssh ing in, try chmod +x /applications/xcode.app/contents/developer/applications/simulator.app

node.js - ValidationError: Visiteur validation failed at MongooseError -

i have problem post requests... want create new visiteur in database: app.js const express = require('express'); const app = express(); const bodyparser = require('body-parser'); const mongoose = require('mongoose'); app.use(express.static(__dirname+'/client')); app.use(bodyparser.json()); visiteur =require('./models/visiteurm'); mongoose.connect('mongodb://localhost/virtuordb'); var db = mongoose.connection; app.post('/api/visiteurs', (req, res) => { var visiteur = req.body; visiteur.addvisiteur(visiteur, (err, visiteur) => { if(err){ throw err; } res.json(visiteur); }); }); the model visiteurm.js: schema: const mongoose = require('mongoose'); // book schema const visiteurschema = mongoose.schema({ nom:{ ty

android - Network pushnotification -

i want make party next week , play game guests. found card game in challenge have , new challenge card if successful. i wonder if possible tell connect wifi (android , iphone) , pushnotifications challenge have , mark them successful. is somehow possible realize webapp? to send push notifications necessary have native apps installed on devices.

winapi - Loading bitmap image in c++ thread -

i attempting load in selected .bmp file , display in wm_paint. function being ran code visual studio see it. here code seems not working: case wm_paint: { _hwindowdc = beginpaint(_hwnd, &ps); if (g_bisfileloaded) { std::wstring wsfilename = g_vecimagefilenames.back(); g_vecimagefilenames.pop_back(); std::string file(wsfilename.length(), ' '); std::copy(wsfilename.begin(), wsfilename.end(), file.begin()); hbitmap h_bitmap = (hbitmap)loadimagea(g_hinstance, file.c_str(), image_bitmap, 0, 0, lr_loadfromfile); hdc h_homedc = createcompatibledc(_hwindowdc); bitmap bitmap; int i_final = getobject(reinterpret_cast<hgdiobj>(h_bitmap), sizeof(bitmap), reinterpret_cast<lpvoid>(&bitmap)); hbitmap h_oldbit = (hbitmap)::selectobject(h_homedc, h_bitmap); setstretchbltmode(_hwindowdc, halftone); bool paintbit = stretchblt(_hwindowdc, 1, 1, 50, 50, h_homedc, 0, 0

pyinstaller error: OSError: Python library not found: libpython3.4mu.so.1.0, libpython3.4m.so.1.0, libpython3.4.so.1.0 -

i'm using python 3.4.4 on centos7. i've created python program on local machine makes use of qt modules. program running fine on local machine. i'm trying create executable pyinstaller. i'm using command: pyinstaller main.py i'm getting following output: 40 info: pyinstaller: 3.2.1 40 info: python: 3.4.4 41 info: platform: linux-3.10.0-327.36.3.el7.x86_64-x86_64-with-centos-7.3.1611-core 41 info: wrote /home/neilharris/documents/python_projects/transcoder/main.spec 42 info: upx not available. 44 info: extending pythonpath paths ['/home/neilharris/documents/python_projects/transcoder', '/home/neilharris/documents/python_projects/transcoder'] 44 info: checking analysis 44 info: building analysis because out00-analysis.toc non existent 44 info: initializing module dependency graph... 45 info: initializing module graph hooks... 47 info: analyzing base_library.zip ... 1869 info: processing pre-find module path hook distutils 3030 info: runn

java - How to Play a Video file in javacv / javacpp -

does have example code play simple video file current javacpp/javacv version , ffmpegframegrabber? i tried this solution, apparently old , not work current javacv version because of incompatible framegrabber interface (returns "frame"-object instead of "iplimage"-object). if change code manually (using frame instead of iplimage), returns error message: java.lang.verifyerror: bad type on operand stack exception details: location: org/bytedeco/javacv/ffmpegframegrabber.startunsafe()v @1291: invokespecial reason: type 'org/bytedeco/javacpp/avutil$avframe' (current frame, stack[2]) not assignable 'org/bytedeco/javacpp/pointer' current frame: bci: @1291 flags: { } locals: { 'org/bytedeco/javacv/ffmpegframegrabber', integer, 'org/bytedeco/javacpp/avformat$avinputformat', 'org/bytedeco/javacpp/avutil$avdictionary', integer, 'org/bytedeco/javacpp/avcodec$avcodec', integer, integer, integer,

parsing - Get invisible web page info with BeautifulSoup -

i trying info site " https://www.estimize.com/jpm/fq3-2016#chart=table ", more precise individual estimates, @ bottom of page. shows first 30 , should manually press button "show all" 30 , on. here code far: from urllib import urlopen bs4 import beautifulsoup html = urlopen("https://www.estimize.com/jpm/fq3-2016#chart=table") soup = beautifulsoup(html.read(), "html.parser") print(soup) i see there part of printed code: "totalcount":142,"total_estimates_showing":30," is possible change printed estimates? looking in ajax request site made when clicked "show all" button should parse url: " https://www.estimize.com/jpm/fq3-2016?sort=rank&direction=asc&estimates_per_page=142&show_confirm=false&selected_user=&_=1490697888459 " to results directly

I cannot not use safari web inspector -

i enabled "show developer menu..." cannot open safari web inspector. how can fix it? enter image description here enter image description here

Adjust input width with bootstrap class -

i've created form using bootstrap classes. problem don't know how solve how adjust width of input elements on form? know can use inline styling or write custom css class, there way can adjust width of both inputs using bootstrap classes? i adjust width of both inputs approximately same buttons arrows / down. shrink both inputs. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <br/> <div class="btn-group"> <button type="button" class="btn btn-primary" >nazaj</button> </div> <div class="btn-group col-sm-offset-1"> <button type="button" clas

Rotating image like in standard feature ios objective c -

Image
how can rotate image similar how it's done in standard gallery feature? standard gallery has wheel user can tap 1 finger , swipe left right , turn image 45 degrees. here screenshot of mean: try code rotation. cgaffinetransform newtransform = cgaffinetransformmakerotation((cgfloat)(angel)); self.imageview.transform = newtransform;

scala - FluentWait prints a lot of warning stack traces for ignored exception in the console when I upgrade Selenium from 3.0.1 to 3.1.0 -

i have following method use intensively in tests , works ok selenium 3.0.1 def waituntilvisiblebyxpath(xpath:string, timeoutinmillis:int)(implicit driver:webdriver): try[webelement] ={ val wait:fluentwait[webdriver] = new fluentwait(driver) .withtimeout(timeoutinmillis, timeunit.milliseconds) .pollingevery(100, timeunit.milliseconds) .ignoring(classof[nosuchelementexception]) .withmessage(s"for element visible , enabled xpath: $xpath") val condition:expectedcondition[webelement] = expectedconditions.elementtobeclickable(by.xpath(xpath)) try{wait.until(condition)} } i've tried upgrade selenium 3.1.0 version , after noticed lot of stack traces similar 1 in console when running tests: mar 28, 2017 1:41:49 pm org.openqa.selenium.support.ui.expectedconditions findelement warning: webdriverexception thrown findelement(by.xpath: //a[text()='log out']) org.openqa.selenium.nosuchelementexception: cannot locate element using b

Making Perl's "specific declarations" as variable -

i looking sort of solution if following setup can interpreted formal declaration of variables , if possible. have : my $str_1 = "{cow}" ; $str_2 = "{cow}{black}{tasty_milk}"; what want : (based on above variable string possible initialize hash directly , :) my %hash=(); $hash."*some operator* on $str_i" = 'initialized' ; this "some operator" should make $hash recognize hash declared earlier. i.e input specific hash initialization. ps: don't want write function work on string , information initialize hash. say had following input instead: my @path = qw( cow black tasty_milk ); then can use following: use data::diver qw( diveval ); diveval(\%hash, map \$_, @path) = 'value'; so, data::diver , get: use data::diver qw( diveval ); $str =~ /^(?:\{\w+\})+\z/ or die("unrecognized format"); @path = $str =~ /(\w+)/g; diveval(\%hash, map \$_, @path) = 'value'; without modul

php - Running Symfony2.1 on PHP7 -

a customer contacted me site being slow , still run on php 5.3 instead of php 7. read somewhere, how faster php 7 , of course wants me upgrade server php 7. the problem see, website running on old symfony 2.1 installation. far, found out, symfony >= 2.3 run on php 7. know symfony 2.1 php 7 compatibility or has actual hands on knowledge? if ain't possible, i'll suggest update website symfony 2.3 shouldn't big pain in ass.

wordpress - is there any woocommerce API for add To cart -

is there woocommerce api add cart can add product cart via mobile app. please me. did not found "add cart" functionality in woocommerce api. what had been done "add cart" button save product id , quantity(and other properties) shared preferences object. firstly getting products json object shared preferences object , find out to-be-added product present on shared preferences object.if present execution returns.otherwise advance add product property shared preferences object. sharedpreferences pref = getsharedpreferences("cartpref", 0); string strjson = pref.getstring("productcartjson","[]"); jsonarray productssavedetailjsonarray = new jsonarray(strjson); //checking if product-to-be-added present in shared preferences object for(int i=0;i<productssavedetailjsonarray.length();i++){ if(productssavedetailjsonarray.

ajax - Page visibility in polymer -

does polymer support page visibility api? want fire iron-ajax call every minute when polymer app opened.when browser tab of web app not focused or minimized, don't want fire iron-ajax call. how achieve it? explored lot couldn't find solution. thanks in advance.

bitmap - c# cut image in specific size in memory without save file -

i have colde : bitmap bmp = new bitmap(width, height); i take capture of window. want resize captured bitmap (bmp). how can cut bmp example rect rt = new rect(); getwindowrect(hwnd1, out rt); int32 width = rt.right - rt.left; int32 height = rt.bottom - rt.top; int leftttt = rt.left + (width - 202); int width2 = rt.right - leftttt; // // want cut : // // in x=lefttt y = rt.top size ( width2,height) and later can easy save file check results by: (but won't check) bmp.save(@"d:\test.jpg", imageformat.jpeg); edit: want cut not resize . when code : var graph = graphics.fromimage(scren_kurwa.image); graph.drawimage(bmp.image, 10, 10, 200, 200); and save override bmp screen , take capture in smaller version. i want cut examaple want show 1/4 of width screen , save file. ( save 1/4 width not more). edit 2 : graph.copyfromscreen(leftttt, rt.top, 0, 0, new size(width2, height), c

python - How to reset time limit on Celery Task -

i have no experience celery i'm looking if use case solvable in celery. the client submit job celery, job executed in celerytask. client has send keepalive every 30 seconds keep job active. once job not refreshed keepalive message, job cancelled. i can think of 2 solutions: each job-task created have hard time limit of 30s. when client sends keepalive router send message relevant worker reset hard time limit. each job-task have no time limit. each job-task there special watchdog task launched. watchdog task launched delay of 30s. if new keepalive arrives client watchdog task cancelled , recreated. again delay of 30 seconds. if watchdog executed, kill job-task, eliminating system. the 1. simpler, i'm not sure how reset task timelimit. solution 2. seems more correct, i'm afraid there various race conditions. watchdog task should running in separate queue reserved watchdogs only. how possible? 1 of solution or other. in understanding, want have middle

pandas - Margin of Error for Complex Sample in Python -

i have weighted stata dataset of national survey (n=6342). data has been weighted, i.e. each respondent represents 4000 respondents on average. i reading dataset pandas.read_stata function. basically, need achieve extract data each question respected frequencies(%) along margin of error each frequency. i have written python code , works fine frequency itself, i.e. calculating sum of weighted value in each frequency , divide total weighted value sum. pseudo-code looks this: q_5 = dataset['q5'].unique()` frequencies = {} value in q_5: variable = dataset[dataset['q5'] == value] freq = ((variable['indwt'].sum()/weights_sum)*100) freq = round(freq,0) frequencies.update({value : freq}) however, cannot proper confidence intervals or margin of error since complex sample. advised use r instead, taking consideration syntax learning curve, rather stick python. is there statistical package python calculate me com

php - What's the proper way to add composer credentials for use in CircleCI? -

i've got project has private repositories installed composer. use auth.json include these credentials: { "http-basic": { "repo.magento.com": { "username": "1435d ... (some hash) ... a6d45b", "password": "b4bab ... (some hash) ... 2c1a85" } }, "github-oauth": { "github.com": "3b5dc ... (some hash) ... ae6dcb" } } i use circleci test repository automatically. needless say, don't want auth.json in repository, need credentials repositories. i know can set environment variables in circleci tackle this, can't seem find proper documentation on variables must use above credentials. can me this?

jquery - I'm trying to design custom HTML in legend - jqplot -

Image
i want return code legend can in tooltipcontenteditor like code var opts = { seriesdefaults: { renderer: jquery.jqplot.pierenderer, }, legend: { show:true, labels: mylabels, highlighter: { show: true, tooltipcontenteditor: function () { return 'gdfddfs'; }, }, }, }; plot1 = jquery.jqplot ('chart3', [data], opts); like image

javascript - AngularJS - add HTML element to dom in directive -

i have angularjs directive in add <div class="perc"></div> from happens? link: function (scope, elem, attrs) { console.log('scope', scope, elem, attrs); var t = elem[0]; var dataperc = attrs.perc, barperc = math.round(dataperc * 5.56), bar = elem.children()[0], label = elem.children()[2]; bar.animate({width: barperc}, dataperc * 25); label.append('<div class="perc"></div>'); $compile(elem)(scope); function perc() { var length = bar.css('width'), perc = math.round(parseint(length) / 5.56), labelpos = (parseint(length) - 2); label.css('left', labelpos); t.find('.perc').text(perc + '%'); console.lo

codenameone - Debugging App on phone -

since using cn1 calendar lib, not able debug app calendar functions within ide , codename 1 simulator. i wanted ask, how other developers handling situations this? you can debug apps using ddms in android studio or in eclipse neon android plugin. firstly, need enable developer mode on android device tapping repeatedly build number or build version under settings -> about, activate developer mode , can access developer section under settings , allow usb debugging mode . edit: for ios, it's better use codename 1 error logging catch exception , send through email (pro account required): try { //write code want debug here } catch (exception ex) { log.e(ex); log.sendlog(); //this send stacktrace (if any) through email }

wmi - Get List of Windows services with file version of the executable -

i trying use powershell 3.0 return list of services properties name, displayname, path, , version of executable. using following code: get-wmiobject win32_service | ? {$_.name -like '*sharepoint*'} | select name, displayname, state, @{name="path";expression={$_.pathname.split('"')[1]}}, @{name="version";expression={((($_.pathname.split('"')[1]) | get-item).versioninfo.fileversion)}} | format-list i back, except file version. know can break command, use custom object, etc. know doing wrong here. any suggestions?

r - How do I modify arguments inside a function? -

i have series of lines of code replace contents of existing column based on contents of column (i.e. creating categorical variable 'cut' function not applicable). new r , want write function perform task on data.frames without having insert , customize 50 lines of code each time. x data frame, y categorical variable, , z other (string) variable. code works: x$y <- "" x <- transform(x, y=ifelse(z=="alameda",20,"")) ... (many more lines) for example do: d.f$loc <- "" d.f <- transform(d.f, loc=ifelse(county=="alameda",20,"")) # ... , on now want several dataframes , different columns instead of loc , county . however, neither of these functions produces desired results: ab<-function(y,z,env=x) { env$y<-transform(env,y=ifelse(z=="alameda",20,"")) ... } abc<-function(x,y,z) { x<-transform(x,y=ifelse(z=="alameda",20,"")) ... } both of these

javascript - Lazy transition animations react -

hi using react render lists. receive data via xhr , display these. part of data displaying progress bar of kind. thats done div element, gets inline width style. in css changes width cause these changes animated. since that's rendered simultenously alongside rest of dom, thats not animated on first render. workaround use timeout. i wonder if better in matter, since consider timeouts not being practice. i'd rather prefer using kind of event triggered behavior. sth. "after render" or similar things. thoughts? class container extends react.component { componentdidmount() { let maxpts = 0; const persons = fetchpersons(); persons.foreach(function (person) { maxpts = math.max(maxpts, person.pts || 0); }); this.setstate({ data: athletes, dataaccepted: true }); // todo: practice? causes width set later on allow transition window.settimeout(() => { this.setstate({ max: maxpts

node.js - Certbot - How to create SSL certs and keys for IP:3030? -

i have expressjs app running on ip address @ port 3030. how can create ssl cert , key type of address? i tried with: $ certbot certonly --standalone --email test1@yahoo.co.uk -d 127.0.1.1:3030 i error: requested domain 127.0.1.1:3030 not fqdn any ideas? this package use - certbot. this www file in expressjs bin directory: #!/usr/bin/env node /** * module dependencies. */ var app = require('../app'); var debug = require('debug')('mongoose-iot:server'); var http = require('http'); // add https support. // https://www.hacksparrow.com/express-js-https.html // http://stackoverflow.com/questions/11744975/enabling-https-on-express-js // http://blog.mgechev.com/2014/02/19/create-https-tls-ssl-application-with-express-nodejs/ var https = require('https'); var fs = require('fs'); /** * port environment , store in express. */ var port = normalizeport(process.env.port || '3000'); app.set('port', port);

collation - SQL Server displaying query results as odd characters -

when attempt write data sql server db website: http://kgd.gov.kz/en/wanted?page=0 the fields display this: удоÑтоверение личноÑти â„–024806818 от 19.01.2010 МЮ РК my server's collation set `sql_latin1_general_cp1_ci_as. fields set nvarchar(max) how can display these characters correctly? pull data site appears in russian (i think these russian characters?) , display correctly. i'm on sql server 2012. have researched on s/o , 2 threads found did not offer valid solution. thanks.

python 3.x - Tensorflow Module Not Recognized in Windows CMD Line -

i have tensorflow installed, tensorflow module executes when using pycharm error when running , other scripts through windows cmd line. why windows not recognizing tensorflow module? c:\users\appdata\local\programs\python\python35\scripts>pip list deprecation: default format switch columns in future. can use --format=(legacy|columns) (or define format=(legacy|columns) in pip.conf under [list] section) disable warning. appdirs (1.4.3) cycler (0.10.0) gym (0.8.0) h5py (2.7.0rc3) keras (1.2.2) matplotlib (2.0.0) numpy (1.12.1) olefile (0.44) opencv-python (3.2.0.6) packaging (16.8) pillow (4.0.0) pip (9.0.1) protobuf (3.2.0) pyglet (1.2.4) pyparsing (2.2.0) python-dateutil (2.6.0) pytz (2016.10) pyyaml (3.12) requests (2.13.0) scikit-learn (0.18.1) scipy (0.19.0) setuptools (34.3.3) 6 (1.10.0) tensorflow (1.0.1) tflearn (0.3) theano (0.8.2) virtualenv (15.1.0) wheel (0.29.0) c:\users\appdata\local\programs\python\python35\scripts>cd models/tutorials/image/cifar10 c:\users\a

javascript - How to align the title in the middle? -

i'm working codepen.io , creating paragraph. graph has title. the problem want title center-aligned.it should automatically set title in middle, not editing value of "x". can't use css this, , believe javascript job. here 1 functions using draw title , link project goes bellow. var text = document.createelementns(svgns,"text"); text.setattributens(null, 'x', 100); text.setattributens(null, 'y', 15); text.textcontent = (titel); document.getelementbyid("bargraph").appendchild(text); full code: codepen.io/cleanwater/pen/lwqyjm?editors=0010 var text = document.createelementns(svgns,"text"); text.setattributens(null, 'y', 15); text.textcontent = (titel); document.getelementbyid("bargraph").appendchild(text); text.setattributens(null, 'x', 300 / 2 - text.getbbox().width /2);

c# - Passing data from one form to another in asp.net mvc -

i want pass data 1 form another. have form of products , after submitting form want add buttom add posts product, want pass product id other form. this product.cs: public partial class produits { public produits() { this.postes = new hashset<postes>(); } public int idproduit { get; set; } public int idpole { get; set; } public nullable<int> reference { get; set; } public string designationproduit { get; set; } public virtual pole pole { get; set; } public virtual icollection<postes> postes { get; set; } } this post.cs: public partial class postes { public int idposte { get; set; } public nullable<int> numero { get; set; } public int idproduit { get; set; } public int idatelier { get; set; } public string designationposte { get; set; } public virtual atelier atelier { get; set; } public virtual produits produits { get; set; } } this create.cshtml product: @using (html.beg

c# - RX: how to pass the latest value from observable into ReactiveCommand -

i want latest value of idstream , use in command execute action. public iobservable<option<guid>> idstream { get; } idstream = documentstream.oftype<documentopened().select(x => x.document.id.some()) .merge(documentstream.oftype<documentclosed().select(x => option<guid>.none())); var savecommand = reactivecommand.create(() => save(id), canexecute); i had tried use answer https://stackoverflow.com/a/31168822/7779560 , got this: var savecommand = reactivecommand.create(() => { }, canexecute); savecommand.withlatestfrom(idstream, (_, id) => id) .subscribe(id => save(id)); and works, can't use isexecuting , thrownexceptions command's functionality in case (they act empty action passed execute during command creation). upd: execution order: idstream creating command creating documentstream processes documentopened event (get id value - checked it) savecommand execution how can achieve it? upd 2

visual studio 2017 - UE4: Cannot create c++ project -

as mentioned i'm using unreal engine 4 (v4.15.1). now, when want create new c++ project (basic code) begins generate code fails compile it. i'm using visual studio 2017 supported (ue4 staff confirmed that). running c:/program files/epic games/ue_4.15/engine/binaries/dotnet/unrealbuildtool.exe test development win64 -project="d:/projects/unrealprojects/test/test.uproject" -editorrecompile -progress -nohotreloadfromide error: system.notsupportedexception: das angegebene pfadformat wird nicht unterst?tzt. //translates 'the given path format not supported' bei system.security.permissions.fileiopermission.emulatefileiopermissionchecks(string fullpath) bei system.security.permissions.fileiopermission.quickdemand(fileiopermissionaccess access, string fullpath, boolean checkforduplicates, boolean needfullpath) bei system.io.fileinfo.init(string filename, boolean checkhost) bei unrealbuildtool.unrealbuildtool.loadubtmakefile(filereference makefilepath, filerefere

When will an idle app be killed on Android -

does android os kill idle app after few hours. specific, 12 hours of inactivity of app warrants eviction? understand idle app evicted if phone needs more resources foreground process. if phone not used , app goes background, possibility of getting killed? check out "check how memory should use" section in android development guide: https://developer.android.com/topic/performance/memory.html each device has memory level. when device falls under level, system begin kill processes. so question... depends on number of factors (i.e. if phone not actively being used, has processes running in background).

bash - Python, run a shell script as soon as the previous iteration ends. -

i trying write simple program call shell script. need shell script executed continuously, however, not in given time interval, since can't know how long take process created shell script finish. have used threading run script every n seconds. need is, "test.sh" ends, run "test.sh" again. this current code. import subprocess import threading looptime = 7.0 def recognize(): threading.timer(looptime,recognize).start() filepath = "/home/user/downloads/image.jpg" output = subprocess.check_output(['dir/test.sh',str(filepath)]) print ("python print\n%s" % output) recognize() you don't need threading.timer . subprocess.check_output will block main process until child process finished. import subprocess def recognize(): filepath = "/home/user/downloads/image.jpg" output = subprocess.check_output(['dir/test.sh',str(filepath)]) print ("python print\n%s" % output

linux - Does AppArmor uses LXC? -

i'm trying use apparmor , generate profiles 'aa-genprof' script 'apparmor-utils' package. i have noticed times script includes lxc abstractions 'container-base' , 'start-container' new created profile, including them '/etc/apparmor.d/abstractions/lxc'. #include <abstractions/lxc/container-base> #include <abstractions/lxc/start-container> i have tried on several ubuntu distributions. have noticed when lxc not installed on system, not using it, , include files not exist. i have been searched lot on web , didn't find nothing.. someone can explain this? does apparmor uses lxc containers? if does, how system security influenced? if doesn't - apparmor doing it? how can control feature? example profile created on python script uses networking.. the created profile: # last modified: tue mar 28 17:00:29 2017 #include <tunables/global> /home/user/x.py { #include <abstractions/base> #include

osx - Connecting to localhost mysql server from inside docker container on macOS -

how can connect localhost mysql server docker container on macos ? 1 way using --add-host requires me pass name "myhost". there way in macos references localhost inside docker container refer docker host ? you should able connect mysql running on host machine using host machine actual ip address. in macos, try find ip command ifconfig . using ip assigned en0 i.e. ethernet interface should work. call ip within container. *localhost or 127.0.0.1 or 0.0.0.0 doesnt call host machine local container itself.

css3 - CSS keyframe-mobile starts at 100% before animating -

i have css class , keyframes below animate image fading in , sliding in left. the transition works fine on desktop on mobile device, transition acts complete displaying 100% keyframe first, transition begins @ 0% , performs animation expect. i tried adding 0% style original class start out @ correct position before animation begins didn't work. ideas? thanks! .slideleft { animation-duration: 1s; animation-fill-mode: both; animation-timing-function: ease-out; animation-name: slideinleft; transform: translate3d(-100%, 0, 0); opacity: 0; visibility: visible; } @keyframes slideinleft { 0% { transform: translate3d(-100%, 0, 0); opacity: 0; visibility: visible; } 100% { transform: translate3d(0, 0, 0); opacity: 1; visibility: visible; } } <img src="http://content.mycutegraphics.com/graphics/food/whole-pizza.png" class="slideleft"/>

Powershell modules and admin privileges -

i have written powershell module contains cmdlets utilize iis's webadministration powershell module. however, module requires loaded admin powershell session, otherwise exception thrown. might know or guess, custom module fails load when powershell not first run admin. this behavior acceptable , expected. question whether or not there way elevate shell's permissions (and obey uac settings) when module loaded? example: (assume in particular case, import-module webadministration found in powershell profile) i click powershell shortcut on task bar. a powershell shell standard user permissions opens, , attempts import module. encounters fact module needs elevated permissions. user prompted , powershell restarts. my question whether or not there way elevate shell's permissions when module loaded? no; security hole. can write this: #requires -runasadministrator (iirc, -runasadministrator first appeared in powershell 3.0, if need ps 2.0 compati

rdf - How to write SPARQL query that efficiently matches string literals while ignoring case -

i using jena arq write sparql query against large ontology being read jena tdb in order find types associated concepts based on rdfs label: select distinct ?type { ?x <http://www.w3.org/2000/01/rdf-schema#label> "aspirin" . ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type . } this works pretty , quite speedy (<1 second). unfortunately, terms, need perform query in case-insensitive way. instance, because label "tylenol" in ontology, not "tylenol" , following query comes empty: select distinct ?type { ?x <http://www.w3.org/2000/01/rdf-schema#label> "tylenol" . ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type . } i can write case-insensitive version of query using filter syntax so: select distinct ?type { ?x <http://www.w3.org/2000/01/rdf-schema#label> ?term . ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type . filter ( regex (str(?term), "tylenol",

c# - assembly attributes not being emitted by roslyn -

i'm generating assemblies using roslyn, signing them using sn.exe tool, called in generatesnk method, below. use snk keyfile desktopstrongnameprovider pass in compilation option. var snk = generatesnk($"{assemblyname}_key{revision}.snk", $@"{assemblyname}\{revision}\"); var snkpaths = immutablearray.create<string>(snk); var snprovider = new desktopstrongnameprovider(snkpaths); csharpcompilation compilation = csharpcompilation.create( assemblyname, syntaxtrees: new[] { syntaxtree}, references:references, options:new csharpcompilationoptions( outputkind.dynamicallylinkedlibrary ,strongnameprovider:snprovider ) ); when try load assembly using: assemblyloadcontext.default.loadfromassemblypath(assemblypath); it works first time, when edit source code , make second version compile (using new strong name key sign with), while compilation succeeds, loading assembly using above code gives error: system.i

windows - Python: fnmatchcase in virtualenv -

i'm trying install flask without success. i have virtualenv running in bash terminal on windows 10. $ pip install flask collecting flask using cached flask-0.12-py2.py3-none-any.whl collecting werkzeug>=0.7 (from flask) using cached werkzeug-0.12.1-py2.py3-none-any.whl collecting itsdangerous>=0.21 (from flask) using cached itsdangerous-0.24.tar.gz not import setuptools required install source distribution. traceback (most recent call last): file "c:\users\powlo\workspace\proj\.venv\lib\site-packages\pip\req\req_install.py", line 387, in setup_py import setuptools # noqa file "c:\users\powlo\workspace\proj\.venv\lib\site-packages\setuptools\__init__.py", line 8, in <module> fnmatch import fnmatchcase importerror: cannot import name 'fnmatchcase' now, if run $ winpty python python 3.5.1 (v3.5.1:37a07cee5969, dec 6 2015, 01:38:48) [msc v.1900 32 bit (in tel)] on win32 type "help", "copyright",

.net - Create virtual directory on same azure web app -

Image
i have application running on azure, need have application copied different users can access example site.com/s1 , site.com/s2 , use them separate. application same, database change. i tried create virtual directory app same error every time: "the physical path virtual path '/s1' invalid." i tried creating physical directory ftp , can see new directory, azure don't recognize physical one. i have wwwroot/s1 wwwroot/s2 , access apps way explained before. please have try config virtual directory site/test1 on azure portal following screenshot when push webapp azure, need include virtual directory path in site name , destination url sections on connection tab after can visit webapp sitename/site1 we can check uploaded file azure kudu tool ( https://sitename.scm.azurewebsites.net/debugconsole/?shell=powershell )

javascript - Convert a file to base64 using FileReader and Promises -

i wrote function use promises convert uploaded file base64 , trying return base64 string. getting http error 200 , i'm not sure if it's returning right string. function getbase64(file) { var deferred = $.deferred(); var reader = new filereader(); reader.onload = function (event) { let base64string = reader.result.split(',').pop(); deferred.resolve(base64string); }; reader.readasdataurl(file); return deferred.promise(); };

r - 'object not found' error when knitting to HTML in RMarkdown -

i testing rmarkdown first time , running issue when trying knit html. example: attempt knit following html # hello markdown markdown **easy use** format writing reports. resembles naturally write every time compose email. in fact, may have used markdown *without realizing it*. these websites rely on markdown formatting * [github](www.github.com) * [stackoverflow](www.stackoverflow.com) * [reddit](www.reddit.com) the above taken directly example on page: http://rmarkdown.rstudio.com/articles_intro.html however, when use knit html button receive error: error: object 'a' not found execution halted maybe simple question not seeing answer to, not know how interpret , correct error message, in markdown file calling sort of object 'a'. thank assistance!

go - $lookup and $match Mongodb golang -

Image
i want document foreign key using $lookup , $match on mongodb. there "jobs" collection stores job document. in job document there 2 field using foreing key "creatorparent" , "children". creatorparent foreign key "users" collection , children array contains id user's children. when list whole jobs, want retrieve detail "users" collection both creatorparent id , childrenid. want marshall "job" document parentdetail , childdetail. don't want write custom method that. possible handle mongodb query? by way i'm beginner on mongodb should store needed details on children , creatorparent instead of storing objectid? users document: { "_id" : objectid("58daf84877733645eaa9b44f"), "email" : "meto93@gmail.com", "password" : "vpgl+fjnef616crgnbckwafdpsi=", "passwordsalt" : "99397f4a9d3a499d96694547667e74595ce994d2e83345

SQL Trigger After Insert not Updating correctly -

i've inherited trigger use populate field based on related row. basically, sequence of 10, 20, 30 gets predecessor popluated 10, predecessor 0, 20, predecessor 10, etc. max(seq) seq < currentrowseq. pretty straightforward, except when our sequence inserted, predecessors populating 0s. if piece out code , separately, numbers expect. figure must wrong in trigger firing. note trigger firing on child table insert. predecessor field in child ud table sequence in parent table. wonder if order in writes happening problem. i'm not sure. here's trigger: alter trigger [erp].[trgrjoboperudinsert] on [erp].[joboper_ud] after insert set nocount on declare @jobnum varchar(100), @assemblyseq int, @oprseq int, @foreignsysrowid varchar(100), @pred varchar(100) set @pred = '' declare preds cursor local select isnull(predecessor_c, ''), foreignsysrowid inserted open preds fetch next preds @pred, @foreignsysrowid while @@fetch_status = 0 begin select @jobn

json - Efficient way of parsing Jax-ws Restful Response -

i need parse jax-ws rest response , tried following 2 ways of parsing response.both works good.but in need know best efficient way of implementation.please provide me view. first approach: use getentity object , response input stream. using jackson objectmapper readvalue() -covert inputstream java object. using getters , setters of nested java class response objects member values. second approach: use getentity object , response input stream , and convert input stream string. using google json api,convert string json object. using json parser , nested objects member values. i first approach better 2 reasons: you don't go through intermediate process of reading response payload string the setter methods called during jackson deserialization may perform validation on input , throw appropriate exceptions, validation during deserialization.

elixir - Ecto changeset add multiple errors -

i have config map want validate inside changeset. config has multiple keys , each of them has constraints. i run validator each of them when data received forces me write lot of code can done smarter i'm running loop , trying gather failed validations instead of running them 1 one. defp validate_config_flags(changeset) config = get_field(changeset, :config) {k, v} <- config if !map.has_key?(@config_flags, k) || !validate_config_flag(k, v) add_error(changeset, :"#{k}", "invalid value `#{k}`") end end changeset end obv problem return changeset though fields fail , question related that. how add more 1 error message/failed validation result instead of returning @ first add_error somehow? most of times when want repeatedly modify term in elixir, you're looking enum.reduce/3 : defp validate_config_flags(changeset) enum.reduce(get_field(changeset, :config), changeset, fn {k, v}, changeset

python - How do I create a variable number of variables? -

how accomplish variable variables in python? here elaborative manual entry, instance: variable variables i have heard bad idea in general though, , security hole in python. true? use dictionaries accomplish this. dictionaries stores of keys , values. >>> dct = {'x': 1, 'y': 2, 'z': 3} >>> dct {'y': 2, 'x': 1, 'z': 3} >>> dct["y"] 2 you can use variable key names achieve effect of variable variables without security risk. >>> x = "spam" >>> z = {x: "eggs"} >>> z["spam"] 'eggs' make sense?

image - Accurate Approximations of Fisheye lense distortion via non polynomial FET method? -

i'm trying approximate fisheye lense distortion. used polynomial method described in this paper , , worked fine forward transform, forgot need sort of interpolation backward transform needed, , need inverse function transformation, proved problematic (i used non alternating power sign version ie sum( polynomial_coefficients[i] * radius^i)) division model didn't appear appropriate (and spit out bad results if tried use non alternating power version because dividing radius). switched appears more accurate method (correct me if i'm wrong , provide more accurate method) via r_distorted = scalar * ln(1 + lambda * r_undistorted) and r_undistorted = (e^(r_distorted/scalar) - 1)/lambda which featured in same paper. i in source paper didn't understand how ever end no distortion lower values of lambda, or heck supposed scalar value. wanted test code in situatiations lense distortion zero, formula not seem provide way me set parameters value forward transform of

sencha touch - Failed to resolve dependency Ext.grid.Panel on ExtJS 6.0 -

i having following error when trying extend 'ext.grid.panel' shown in example on sencha official documentation. used both classic, modern, universal framework , still not working. failed resolve dependency ext.grid.panel file xmlgrid.view.main.main [err] [err] build failed [err] com.sencha.exceptions.exnotfound: unknown definition dependency : ext.grid.panel [err] @ o [err] rg.apache.tools.ant.unknownelement.execute(unknownelement.java:291) [err] [err] total time: 65 minutes 56 seconds [err] error during rebuild : following error occurred while executing line: c:\users\nandeesh\workspace\xmlgrid\.sencha\app\watch-impl.xml:4: following error occurred while executing line: c:\users\nandeesh\workspace\xmlgrid\.sencha\app\build-impl.xml:380: following error occurred while executing line: c:\users\nandeesh\workspace\xmlgrid\.sencha\app\init-impl.xml:403: com.sencha.exceptions.exnotfound: unknown definition dependency : ext.grid.p

Image slider indicators with angular 2 animations -

i trying create slider items have temporary service in angular 2 testing animation module. using code base of this example . s in items.component.ts have following code: my item model import { component, oninit, animate, changedetectorref, style, transition, trigger } '@angular/core'; interface item { id: number; title: string; description: string; } component type orientation = ( "prev" | "next" | "none" ); @component({ selector: 'app-item-01', animations: [ trigger( "itemanimation", [ transition( "void => prev", // ---> entering ---> [ style({ left: -100, opacity: 0.0, zindex: 2 }), animate( "200ms ease