Posts

Showing posts from February, 2012

swift - iOS tableview how can I check if it is scrolling up or down -

i learning how work tableviews , wondering how can figure out if tableview scrolling or down ? been trying various things such hasn't worked granted below scrollview , have tableview . suggestions great new @ ... func scrollviewwillbegindragging(_ scrollview: uiscrollview) { if scrollview.pangesturerecognizer.translation(in: scrollview).y < 0 { print("down") } else { print("up") } } this have in tableview code func tableview(_ tableview:uitableview, numberofrowsinsection section:int) -> int { return locations.count } func tableview(tableview: uitableview, willdisplaycell cell: uitableviewcell, forrowatindexpath indexpath: nsindexpath) { if indexpath.row == self.posts.count - 4 { reloadtable(latmin: self.latmin,latmax: self.latmax,lonmin: self.lonmin,lonmax: self.lonmax,my_id: myid) print("load more") } } func tableview(_ tableview: uitable

Swaping elements in 3d numpy array -

this question has answer here: numpy reverse multidimensional array 2 answers given 3d numpy array how swap first , last element of each 'pixel' for example: a = [[[15 3 61] [56 27 22] [48 32 29] [38 21 50] [28 54 37]] [[47 27 35] [52 34 12] [18 56 48] [ 8 34 1] [37 27 38]]] i want array be: a = [[[61 3 15] [22 27 56] [29 32 48] [50 21 38] [37 54 28]] and on is there way without using loops? you can reverse array along third axis a[..., ::-1] : a = np.array([[[15, 3, 61], [56, 27, 22], [48, 32, 29], [38, 21, 50], [28, 54, 37]], [[47, 27, 35], [52, 34, 12], [18, 56, 48], [ 8, 34, 1], [37, 27, 38]]]) a[..., ::-1] #array([[[61, 3, 15], # [22, 27, 56], # [29, 32, 48], # [50, 21, 38], # [37, 54, 28]], # [[35, 27,

python - how do I use my machine learning model as an api? -

suppose created machine learning prediction model on data set, trained it, got results , want use make prediction on new data take user. every 1 says deploy aws, microsoft azure etc, want use research purpose, how can create simple api of machine learning model? i think question bit broad want share experience on building first api in python. i installed flask , framework on top of flask called flask-restful . flask_restful super easy use , official guide helped me out lot. my suggestion build api first figure out platform want use deployment.

Redux - I don't understand "Task-Based Updates" example -

in link: task-based updates don't understand below code: import posts "./postsreducer"; // missing code?? import comments "./commentsreducer"; // missing code?? and why should that? const combinedreducer = combinereducers({ posts, comments }); const rootreducer = reducereducers( combinedreducer, featurereducers ); only featurereducers okie? not need combindedreducer? anh postsreducer code, commentsreducer code? thanks helps! unfortunately example little confusing (one of few places in solid redux docs). if go here , check out 'third approach', you'll see concept explained little better. essentially, postreducer , commentreducer there handle actions modify posts or comments --that is, things not require changes multiple tables (e.g posts , comments ). featurereducer task-based reducer handles actions require updates multiple tables. a simplified example: const postreducer = (state = {}, action) =>

python - What's the difference between getAffineTransform(), getPerspectiveTransform() and findHomography() -

i'm investigating ways of transforming image , overlaying within contour of image. as best can tell there 3 ways opencv in python: getaffinetransform() getperspectivetransform() findhomography() i found 3 different methods via blog , posts , produce same results, i.e. taking source image , warping/overlaying on contour of different shape on destination image. this demonstrates getaffinetransform() https://stackoverflow.com/a/38323528/1887261 this demonstrates getperspectivetransform() http://uberhip.com/python/image-processing/opencv/2014/10/26/warping-brien/ this demonstrates findhomography() http://www.learnopencv.com/homography-examples-using-opencv-python-c/#download i'm wondering best method use , why use 1 on other?

javascript - Protractor persistent variables -

i'm trying set similar environment / global variables in postman. postman stores these variables in json , when modify them within test, changed new values permanently. example: postman.setenvironmentvariable("variable1", parseint(postman.getenvironmentvariable) +1); this function increment environment variable 1 @ start of request. in real postman tests use custom function calculate valid ean13 barcode based on used barcode must unique. is there can achieved in protractor? use 'params' object storing data. can set in config file. config params: { login: { user: 'jane', password: '1234' } } accessed browser object browser.params.login . can change value of object can retrieved in test.

project reactor - ParallelFlux vs flatMap() for a Blocking I/O task -

i have project reactor chain includes blocking task (a network call, need wait response). i'd run multiple blocking tasks concurrently. it seems either parallelflux or flatmap() used, bare-bone examples: flux.just(1) .repeat(10) .parallel(3) .runon(schedulers.elastic()) .doonnext(i -> blockingtask()) .sequential() .subscribe() or flux.just(1) .repeat(10) .flatmap(i -> mono.fromcallable(() -> {blockingtask(); return i;}).subscribeon(schedulers.elastic()), 3) .subscribe(); what merits of 2 techniques? 1 preferred on other? there alternatives? parallel tailored parallelization of tasks performance purposes, , dispatching of work between "rails" or "groups", each of own execution context scheduler pass runon . in short, put cpu cores work if cpu intensive work. you're doing i/o bound work... so in case, flatmap better candidate. use of flatmap parallelization more orchestration. thes

I cannot enable Youtube Analytics API at Google Developers Console -

i following guidelines google use youtube analytics api. i have created credentials written , tried enable youtube analytics api, keep getting following error message: the api "youtubeanalytics.googleapis.com" doesn't exist or don't have permission access it i thought odd because can enable every other apis except one, can help? thank you! edit: deleted screenshot. i can reproduce this, i've created open issue #37115473 , , having same issue can star issue there further updates youtube team, thanks!

swift - ObjectMapper how to map different object based on JSON -

Image
i'm using objectmapper ( https://github.com/hearst-dd/objectmapper ) map json swift objects. say have json structure: { animals: [ { "type": "cat", "weight": 23, "catchmice": true }, { "type": "fish", "weight": 1, "swim": true } ] } i have following swift objects: class foo: mappable { var animals: [animal] = [] func mapping(map: map) { animals <- map["animals"] //but want able distinguish between cat , fish objects here } } class animal: mappable { var type: string? var weight: double? required init?(map: map) {} func mapping(map: map) { type <- map["type"] weight <- map["weight"] } } class cat: animal { // how make use of class var catchmice: bool? } class fish: animal { // how make use of class var swim: bool? } how can distinguish between cat , fish in

storage - How to check if SD card inserted in Android? -

this question has answer here: how tell if sdcard mounted in android? 8 answers i want check if phone has sd card inserted or not. want provide user select storage location. this question has several duplicates, however, can check sd card this: boolean issdpresent = android.os.environment.getexternalstoragestate().equals(android.os.environment.media_mounted);

python - Pandas: How to remove rows from a dataframe based on a list? -

i have dataframe customers "bad" rows, key in dataframe customerid. know should drop these rows. have list called badcu says [23770, 24572, 28773, ...] each value corresponds different "bad" customer. then have dataframe, lets call sales , want drop records bad customers, ones in badcu list. if following sales[sales.customerid.isin(badcu)] i got dataframe precisely records want drop, if sales.drop(sales.customerid.isin(badcu)) it returns dataframe first row dropped (which legitimate order), , rest of rows intact (it doesn't delete bad ones), think know why happens, still don't know how drop incorrect customer id rows. you need new_df = sales[~sales.customerid.isin(badcu)]

Angularjs Laravel-Excel file download -

hi facing file download problem laravel excel , angularjs. file store working. getting response headers this. supposed download file cache-control:cache, must-revalidate connection:keep-alive content-disposition:attachment; filename="regular_computer science 2017 sem 1.xls" content-length:5632 content-type:application/vnd.ms-excel; charset=utf-8 date:fri, 07 apr 2017 04:02:31 gmt expires:mon, 26 jul 1997 05:00:00 gmt keep-alive:timeout=5, max=100 last-modified:fri, 07 apr 2017 04:02:31 pragma:public server:apache/2.4.23 (win64) php/5.6.25 x-powered-by:php/5.6.25 my js getreport : function(report_data) { return $http({ method: 'post', url: '../get_report', headers: { 'content-type' : 'application/x-www-form-urlencoded'}, data: $.param(report_data) }); } report.getreport($scope.examreportdata) .then(function(data, status, headers, config) {

c - Incrementing an argument and recursion -

void base_aux(unsigned int n, unsigned int base, unsigned int x) { if (n > (base - 1)) { printf("%u", n % base); base_aux(n / base, base, x++); } else { printf("%u", n); zero_int(32 - x); printf("\n %d \n", x); } } so, i'm trying see why x isn't incrementing. stays @ 0 when call zero_int . reason why? how fix this? when do foo(x++); it equivalent to temp = x; x = x + 1; foo(temp); so can x++ returns x , increments x . called postfix increment. so in code keep call function same value of x if do foo(++x); it equivalent to x = x + 1; temp = x; foo(temp); so can ++x increments x , returns x . called prefix increment.

javascript - Can I use conditioned alert in php which is encoded in .html -

i developing page in on adding field data on page want alert putting alert msg in php code .i want alert in html page. have put alert message in php tag not working. <!doctype html> <html> <body> <? if(isset($_get['succ'])) { $message1 = "name correct"; echo "<script type='text/javascript'>alert('$message');</script>"; } if(isset($_get['err'])) { $message2 = "name not saurabh"; echo "<script type='text/javascript'>alert('$message');</script>"; } <form action="action.php" method="post"> first name:<br> <input type="text" name="firstname"> <br> last name:<br> <input type="text" name="lastname"> <br><br> <input type="submit" va

extension may not contain stored properties and no member problems in swift -

i not able understand why getting these errors. please me. here source code import uikit import avfoundation // mark: - playsoundsviewcontroller: avaudioplayerdelegate extension playsoundsviewcontroller: avaudioplayerdelegate { var audioengine = avaudioengine() // mark: alerts struct alerts { static let dismissalert = "dismiss" static let recordingdisabledtitle = "recording disabled" static let recordgindisabledmessage = "youve disabled app recording microphone. check settings" static let recodingfailedtitle = "recording failed" static let recordingfailedmessage = "something went wrong recording" static let audiorecordederror = "audio recorder error" static let audiosessionerror = "audio session error" static let audiorecordingerror = "audio recording error" static let audiofileerror = "audio file error" static let audioengineerror =

' Run Time Error 424 'Object Required Error in excel VBA -

i'am trying run below code in explorer 11. running fine in explorer 9/8 getting error when trying run in explorer 11. run time error '424' object required i think there missing unable it. please see below part of code. sub extract_statusus_test() dim sheetname dim internetexplorer dim onlypatnum dim ieelement object onlypatnum = "7989466" set = new internetexplorer a.navigate "http://portal.uspto.gov/external/portal/pair" a.visible = true loop until a.readystate = readystate_complete msgbox ("click ok after entering re-captcha") application.wait + timevalue("00:00:05") loop until a.readystate = readystate_complete application.wait + timevalue("00:00:04") dim inp if len(onlypatnum) > 7 each inp in a.document.getelementsbytagname("input") if ucase(inp.title) = ucase("publication number")

Is move semantics in C++ something C is missing? -

i have been searching matter on , other sources couldn't wrap head around issue. using resouces of rvalues , xvalues new c++ (with c++11). now, - c programmers - miss here? or there corresponding technique in c benefit these resource efficiency? edit: quesiton not opinion based whatsoever. couldn't describe question. asking whether or not there corresponding technique in c. of course, there similar technique in c. have been doing "move semantics" in c ages. firstly, "move semantics" in c++ based on bunch of overload resolution rules describe how functions rvalue reference parameters behave during overload resolution. since c not support function overloading, specific matter not applicable c. can still implement move semantics in c manually, writing dedicated data-moving functions dedicated names , explicitly calling them when want move data instead of copying it. e.g, own data type struct heavystruct can write both copy_heavy_struct(dst,

php - what makes Lumen faster than Laravel 5 -

my question makes lumen faster laravel 5 when uses same modules ? and differences in routing speed. most because removed many functions , libraries laravel. lumen light version of laravel makes framework faster , smaller.

PowerShell Extract from zip file 17 folders deep -

i have zip file automatically created , can't change number of folders within it. i trying extract contents folder 17 folders deep within zip file. issue name of folders can change. i started use 7zip extract zip folder , works fine: $zipexe = join-path ${env:programfiles(x86)} '7-zip\7z.exe' if (-not (test-path $zipexe)) { $zipexe = join-path ${env:programw6432} '7-zip\7z.exe' if (-not (test-path $zipexe)) { '7-zip not exist on system.' } } set-alias zip "c:\program files\7-zip\7z.exe" zip x $webdeployfolder -o \$webdeploytempfolder is there way extract content in folder 17 folders deep within zip file? you can use 7zip's listing function contents of file. can parse output, looking folder 17 levels , use path extract contents. below chunk of code that. $7zip = "${env:programfiles(x86)}\7-zip\7z.exe" $archivefile = "c:\temp\archive.zip" $extractpath = "c:\temp" $archiv

bash - Can somebody explain me this script line -

can explain me script line aix bash script: #!/bin/bash touch /tmp/</.d2d i suppose lines (items) in file /.d2d read files touched under tmp dir: when content of /.d2d file is file1 file2 then following executed: touch /tmp/file1 touch /tmp/file2 or one: #!/bin/bash pm=text filelist=/tmp/$pm.</.filelist here filelist array line of /.filelist concatenated /tmp/text.line1offilelistfile , /tmp/text.line2offilelistfile , on ... is understanding right? thanks touch doesn't read stdin, input redirection has no other effect bash checking existence of file redirected. hence code equivalent to if [[ -f /.dsd ]] touch /tmp else echo bash: /.dsd: no such file or directory 1>&2 fi so far theory. in practice, guess there typo in line.

matplotlib - How to plot multiple graphs with ax.plot_date() in Python -

Image
i trying plot multiple graphs of excel data using plot_date() function. there column in excel file contains dates in "2016-10-05 00:00:00" format. using following code: import pandas pd df = pd.read_excel('file.xlsx') import matplotlib.pyplot plt fig, axes = plt.subplots(nrows=4, ncols=4, figsize=(12,12)) data_cols = df.columns[8:19] data_col, ax in zip(data_cols, axes.ravel()[:11]): ax.plot_date(df[data_col], df['date']) but when use that, graph occurs. also, here subset of excel file obviously not want. how can fix this?

python 3.x - Need guide to coding CSV File -

now, have code parse xml website def value2(): station in tree.findall('./stations/'): if station.tag == 'station': item1 in station: if item1.tag == 'stationid': print(item1.tag, item1.text) wf.writerow([item1.text]) ###need guide item2 in station: if item2.tag == 'nameth': print(item2.tag, item2.text) wf.writerow([item2.text]) ###need guide item3 in station: if item3.tag == 'nameen': print(item3.tag, item3.text) item4 in station: if item4.tag == 'areath': print(item4.tag, item4.text) item5 in station: if item5.tag == 'areaen': print(item5.tag, item5.text) item6 in station: if item6.tag == 'stationtype': print(item6.tag, item6.text)

android - How to attach fragment to Navigationview -

i using naivgationview in app, when select item drawer,the view of fragment set not displaying. added toast shows while select item can 1 me ? public class mainactivity extends appcompatactivity { private drawerlayout drawerlayout; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); navigationview navigationview = (navigationview) findviewbyid(r.id.nav_view); //setting navigation view item selected listener handle item click of navigation menu navigationview.setnavigationitemselectedlistener(new navigationview.onnavigationitemselectedlistener() { // method trigger on item click of navigation menu @override public boolean onnavigationitemselected(menuitem menuitem) { fragmentmanag

video.js - How to play rtmp live stream using videojs? -

i'm using obs push live stream local rtmp server(node-rtsp-rtmp-server), , works vlc media player. want put webpage , found videojs. didnt work , returns specified “type”-attribute “rtmp/mp4” not supported. seems rtmp server didnt reveive requests webpage. missed? here code: <head> <meta charset="utf-8"> <link href="./video-js-6.0.0/video-js.css" rel="stylesheet"> <script src="./video-js-6.0.0/video.js"></script> <script src="./video-js-6.0.0/videojs-flash.min.js"></script> <script> videojs.options.flash.swf = "./video-js-6.0.0/video-js.swf" </script> </head> <body> <video id='vid' class='video-js' controls height=300 width=600> <source src="rtmp://127.0.0.1:1935/live/pokemon" type="rtmp/mp4"/> </video> <script> var player = videojs(&#

android - Local crash at /system/lib/libwebcore.so file -

i have problem android 4.3. app contains webview , crashes @ android 4.3 .i don't understand problem , how solve it. here crash report: *** *** *** *** *** *** *** *** *** *** build fingerprint: 'samsung/m0xx/m0:4.3/jss15j/i9300xxugng3:user/release-keys' revision: '12' pid: 21590, tid: 21692, name: webviewcorethre >>> org.uusoftware.burclar <<< signal 11 (sigsegv), code 1 (segv_maperr), fault addr 00000000 r0 61a8187c r1 00000000 r2 00000000 r3 5fc94118 r4 61a8187c r5 5f834a85 r6 00000000 r7 61a818b4 r8 00000000 r9 5b68f3d8 sl 00000000 fp 00000000 ip 00000001 sp 61a81848 lr 5f870aa5 pc 5f5e2a56 cpsr 08000030 d0 0000000000000418 d1 0000000000000000 d2 0000000000000000 d3 41d639a123dd2dba d4 3f947ae147ae147b d5 3fa9bbd000000000 d6 3ff0000000000000 d7 4090600000000000 d8 41d639a123dd0cfe d9 41d639a123e04031 d10 0000000000000000 d11 0000000000000000 d12 0000000000000000

ios - CATransition fading black during the transition -

Image
i'm performing simple right-to-left transition on 2 view controllers. animation works perfect, , desired result. however, due presenting / presented view controllers fading in / out, black flash in background. my transition: let transition = catransition() transition.duration = 2.25 // slow duration see black. transition.type = kcatransitionpush transition.subtype = kcatransitionfromright view.window!.layer.add(transition, forkey: kcatransition) present(vc, animated: false, completion: nil) i read setting window color in appdelegate didfinishlaunchingwithoptions can fix this, however, doesn't appear doing anything. (the black still visible during transition.) self.window!.backgroundcolor = uicolor.white any advise on getting 2 vc's transition without black flicker during duration? thanks. i used have same problem when doing custom transitions did above inside prepare(for:sender:) . managed solve after reading a beginner’s guide animated custom segues

python - how to export column with relationship in flask-admin -

i have problem in export csv tables relationship others, while in 'simple' work well. have add basis export? example, db.model: class categoria(db.model): __tablename__ = 'categorie' id = db.column(db.integer, primary_key=true, autoincrement=true) categoria = db.column(db.string(30), primary_key=true) tipo_id = db.column(db.integer, db.foreignkey('tipi.id'), primary_key=true) tipo = db.relationship('tipo', backref='categorie') and modelview class categorieadmin(sqla.modelview): column_display_pk = true can_export = true export_types = ['xls'] list_columns = ['categoria', 'tipo'] the error generate is: exception: unexpected data type <class '__main__.tipo'> thanks help the question quite old had same problem , resolved column_formatters_export . column_formatters_export attribute can assigned dictionary keys name of columns of model, , values assign

javascript - check one button click on another button click -

i have 2 buttons next , add. want user click next after clicking add button. if user don't click on add button , click on next button should alert, click on add button. conside example <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <body> <button id="next">next</button> <button id="add">add</button> <script> $(function(){ var addclicked = false; $('#next').on('click', function(){ // code execute addclicked = true; alert('add clicked'); }); $('#add').on('click', function(){ if(addclicked == true){ addclicked = false; // code execute }else{ alert('please click next'); } }); }); </script> </body> add button proceed after next button clicked

android - Exception : No resource found that matches the given name (at 'layout_behavior' with value '@string/appbar_scrolling_view_behavior') -

i developing library. developing making new library module in application project works fine(even if remove design library app gradle file.). when tried use in different application taking .aar file "library -> build -> outputs -> aar" folder , adding new java/.aar module doesn't build , shows below exception : error:(36, 30) no resource found matches given name (at 'layout_behavior' value '@string/appbar_scrolling_view_behavior'). the exception in layout files of library. related stackoverflow posts tell error occurs if have not included "com.android.support:design" in gradle. library gradle file has library. below layout file library error : <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/lib/lib-package-here" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent&q

r - Selecting rows using grep vs using == -

i brand new r i tried select rows dataset using following: 1. completeresults <- results[ results$final_status=="tsicompleted"] it returned full dataset though (seemingly) logical equivalent works: 2. timestrimmed<-times[times$totaltimemins<60,] then after doing research, tried following work: 3. completeresults <- results[grep("tsicompleted", results$final_status), ] why 2 work 1 doesn't work? thanks missing comma completeresults <- results[ results$final_status=="tsicompleted",]

c++ - Realloc char* inside structure -

i'm new c programming, have structure char , int pointer, used modify pointer frequently, found reference in online realloc char* , working fine, same thing when used inside structure mean problem arise, typedef struct mystruct { int* intptr; char* strptr; } mystruct; inside main() mystruct *mystructptr; mystructptr = new mystruct(); mystructptr->intptr = new int(); *mystructptr->intptr = 10; mystructptr->strptr = (char *)malloc(sizeof("original")); mystructptr->strptr = "original"; printf("string = %s, address = %u\n", mystructptr->strptr, mystructptr->strptr); mystructptr->strptr = (char *)realloc(mystructptr->strptr, sizeof("modified original")); mystructptr->strptr = "modified original"; printf("string = %s, address = %u\n", mystructptr->strptr, mystructptr->strptr); i found following error while reallocating char* inside pointer this may due corruption of

html - How to play sound when a value is changed in a dynamic javascript table? -

Image
i have dynamic table auto-refreshes every 5 seconds, created using javascript. want play notification sound when value in 'failed column' increases. can't frame strategy go it. can me this? in advance. this ajaxcall ajaxcall = function () { $.get('/c/web/jas/getdetails', function (data) { var jsondata=json.parse(data); generatetable(data); settimeout('ajaxcall()', 5000); }); }; this table function generatetable = function (json) { var ar = json.parse(json); var col = new array(); (var = 0; < ar.length; i++) { (var key in ar[i]) { if (col.indexof(key) === -1) { col.push(key); } } } var table = document.createelement("table"); table.border = "1"; var tr = table.insertrow(-1); (var = 0; < col.length; i++) { var th = document.createelement("th"); th.innerhtml = col[i];

node.js - Angular 2 - Import html2canvas -

i have installed html2canvas on angular 2 project using npm install html2canvas --save . if go file , write import * html2canvas 'html2canvas' gives error: cannot find module 'html2canvas' my package file looks this: { ... "scripts": { ... }, "dependencies": { ... "html2canvas": "^0.5.0-beta4", ... }, "devdependencies": { ... } } the file on i'm trying import html2canvas is: import { injectable } '@angular/core'; import * jspdf 'jspdf'; import * html2canvas 'html2canvas'; @injectable () export class pdfgeneratorservice { ... } since angular2 uses typescript, need install typescript definition files module. it can installed @types (if exists). if doesn't can create own definition file , include in project.

In C#, What is different between local struct instance and member struct instance? -

it simple c# struct example below. public struct mystruct { public int a; public void foo() { //do } } public class test { mystruct st; void dosomething() { st.foo(); } } i had known if use struct instance without new, member field must initialized before use. example above don't have error. why? this has nothing struct . in c#, every (local) variable has initialized (assigned value) before can use it. fields of classes initialized default value when instance of class created, don't have assign value explicitly in constructor.

hp uft - How to make web pages and dialog boxes invisible in UFT while navigating to a url for downloading a file? -

i trying download report using uft navigating multiple web pages interacting download dialog box save file on particular location. want happen in background want make web pages , dialog box invisible while running uft. there browser , dialog property can make make them invisible in terms of gui download report. this code using. please in advance. browser("welcome. microstrategy").page("welcome. microstrategy").link("link").click browser("welcome. microstrategy").page("welcome. microstrategy").link("shared reportsrun reports").click browser("welcome. microstrategy").page("welcome. microstrategy").link("link_2").click browser("welcome. microstrategy").page("welcome. microstrategy").link("link_3").click browser("welcome. microstrategy").page("welcome. microstrategy").webelement("tbexport").click while dialog("internet explorer&q

common lisp - Trying to get a binary file -

i automate torrent downloading, attempts drakma failed. can please me out? the code goes follows: (with-open-file (file "/tmp/test.torrent" :direction :output :if-exists :supersede :if-does-not-exist :create) (write-string (flexi-stream:octets-to-string (drakma:http-request "https://sukebei.nyaa.se/?page=download&tid=2265388")) file)) aside typo in package name flexi-streams (plural), “works me.” however, returns primary value sea of binary junk; personally, i'd return filename or something. nb. useful files small enough fit memory @ go; you're reading entire remote stream, converting string, writing disc.

Windows batch file start another batch with elevated rights -

i want batch file start batch file elevated (admin) rights without having accept prompt. have user (called "user") admin rights, if try: runas /savecred /user:user "program.bat" the rights won't elevated. if try: runas /savecred /user:administrator "program.bat" and enter password of "user" says: unknown user or wrong passphrase. so: have elevate rights "user"-account? this might bit overkill if second batch file supposed always run administrator paste following code @ start of it: @echo off & setlocal enabledelayedexpansion if "%processor_architecture%" equ "amd64" ( >nul 2>&1 "%systemroot%\syswow64\cacls.exe" "%systemroot%\syswow64\config\system" ) else ( >nul 2>&1 "%systemroot%\system32\cacls.exe" "%systemroot%\system32\config\system" ) if '%errorlevel%' neq '0' ( echo asking administrative rig

jquery - Wanting to check for a css class and if it's active change the image src value -

here have far, isn't working right , not sure why. thoughts? jquery(document).ready(function( $ ) { if ( $('#masthead').hasclass('is-fixed') ) { $('.site-logo-div').attr('src','second.jpg'); } })( jquery ); edits: html <header id="masthead" class="site-header header-fixed" role="banner" style="top: 32px;"> <div class="site-logo-div"><a href="https://danzerpress.com/" class="custom-logo-link"> <imgsrc="https://example.com" class="custom-logo" alt="" itemprop="logo" "></a> </div> wordpress themes js $( document ).scroll( function(){ var header_parent = header_fixed.parent(); var p_to_top = header_parent.offset().top; var st = $( document ).scrolltop(); if( st > p_to_top && st > 0 ) { $wrap.addclass( 'is-fix

javascript - How do i pass image to a function Ionic 2 -

i image service class via code this.cameraservice.getimage(this.width, this.height, this.quality).subscribe(data => this.image = data, error => i want pass code 1 of getvision() function able use google api.may know how do it? tried declaring string variable , try put above code inside variable not work.below codes camera.ts class export class camerapage { width: number; height: number; cropper: cropper;*/ image:string; width:number = 500; height:number = 500; quality:number = 90; picture:string; labels: array<any> = []; //translation scanning: array<any> = []; choselang: boolean = false; loading: boolean = false; constructor(public navctrl: navcontroller, public navparams: navparams,public testservice: testservice,public cameraservice: cameraservice,public toastctrl: toastcontroller) { } addphoto(){ //take picture & return image *** this.cameraservice.getimage(this.width, this.height, this.quality).sub

javascript - "Violation readystatechange handler took 760ms" after update to latest Chrome -

after updating latest google chrome release getting errors when open colorbox on our website: synchronous xmlhttprequest on main thread deprecated because of detrimental effects end user's experience. more help, check https://xhr.spec.whatwg.org/. [violation] 'readystatechange' handler took 760ms [violation] forced reflow while executing javascript took 51ms [violation] forced reflow while executing javascript took 43ms [violation] forced reflow while executing javascript took 38ms this happens , when errors colorbox isn't working properly, there maybe bug on google chrome? edit: magento merging javascript causing error, it's not working right, if don't merge them don't these errors , it's loading correctly vm23586:4 uncaught typeerror: cannot set property 'value' of null @ choose (eval @ <anonymous> (0a9e2e3….js:11743), <anonymous>:4:73) @ htmlimageelement.onclick (letto-moderno-imbottito-prisma.html:1) uncaught type

java - How do you stop search in a loop once you meet the condition -

how stop each loop proceeding when condition false? because can let x = newx when object in collection true condition. thank help. break won't help, tried. for (char h : collection){ if ( condition == false ) { } else{ x = newx; } } simplest way use break statement. want set new x value when elements of list passing condition. boolean allmatch = true; (char h : collection) { if (!condition) { allmatch = false; break; } } if (allmatch) { x = newx; } if want check if element sof loop matching condition can use java 8 feature: boolean allmatch = list.stream().allmatch(element -> condition); if (allmatch) { x = newx; }

ios - UIImage overlaps with UITextField within a UIAlertController -

my code this: let alert = uialertcontroller(title: "title", message: "alert", preferredstyle: uialertcontrollerstyle.alert) let image_view = uiimageview(frame: cgrectmake(70, 10, 200, 200)) image_view.image = uiimage(named: "logo") alert.view.addsubview(image_view) alert.addtextfieldwithconfigurationhandler { textfield in textfield.placeholder = "a textfield" alert.addtextfieldwithconfigurationhandler { textfield in textfield.placeholder = "another textfield" } yet results in logo overlapping uitextfields. how can make sure neatly stacked 1 below other?? from point of view if create uialertcontroller custom ui try create you're own. or if use bit hacky solution this: let image = uiimage(named: "logo") alert.setvalue(image, forkey: "image")

osx - Check network for available NAS and mount to /Volume on macOS 10.12.4 -

i searching solution checks if @ home , nas reachable. repeated every 4 hours. if available mount /volumes , start backup restic. after backup done, unmount , check again after next 4 hours. i found older scripts seems none of them work /volumes path. link 1 link 2 tried add startup items that's not im searching for. i can mount nas folder in finder using connect server : afp://username@nasname.local/restic the password saved in keychain.

perl passing parameters on windows -

i have following code : $op = shift or die "usage: rename expr [files]\n"; chomp(@argv = <stdin>) unless @argv; print "$op"; ( @argv ) { print "$_"; $was = $_; eval $op; die $@ if $@; rename ( $was, $_ ) unless $was eq $_; } it produces expected result on linux machine, i.e. when run perl massrenamer.pl 's/\.txt/\.txtla/' *.txt i proper results. try execute same thing on windows machine, strawberry perl installed like perl massrenamer.pl 's/\.txt/\.txtla/' *.txt and perl massrenamer.pl "s/\.txt/\.txtla/" *.txt and perl massrenamer.pl 's/\.txt/\.txtla/' "*.txt" but no result. help? wilcard expansion done shell, not when parameter enclosed between quotes, on windows port perl scripts there module win32::autoglob see question a quick fix: replace ( @argv ) ( glob "@argv" ) $op = shift or die "usage: rename expr [files]\n"; chomp(@arg

lotus domino - Javascript Timer for online exam -

i have built online exam portal, allows student take exam online using web browser. now in have developed timer function wherein user has complete exam within stipulated time frame. getting trouble when refresh page timer again start fresh example 40 minutes. problem want when user refresh page should not reinstate timer or same case when click on next question button. the context here lotus domino want achieve things using javascriot, there anyway can store timer value before page refreshed or page submitted , when post refreshing / next question should start past value.. thanks hdc you can store values either in cookies or better use html5 feature of localstorage. https://developer.mozilla.org/en-us/docs/web/api/window/localstorage

set - GAMS Definition of a Subset with k and k+1 -

so have following set: i 1,2,3,...,i j 1,2,3,...,j k 1,2,3,...,k k´2,3,4,...,k i defining set , parameters via gdx-import through excel sheet can change set , parameters dynamically in order calculation study linear-programming model. how define kind of set k´ works parameters d_kk´(distance k k´) , t_jkk´? keep in mind solution has work on large scale @ least 1,...,100 every indice. thanks lot. cheers, sam sounds whant calculate distance between different points in set k. use alias set , multidimentional set: set /1*i/ j /1*j/ k /1*k/ kk(k,k); alias(ka,k); kk(k,ka)$(ord(k)<ord(ka))=yes; parameter x(k) 'x-koordinate' y(k) 'y-koordinate' d(k,k) 'distance k ka'; x(k)=uniform(0,1); y(k)=uniform(0,1); d(k,ka)$kk(k,ka)=sqrt((x(k)-x(ka))^2+(y(k)-y(ka))^2);

wordpress - In my android e-commerce app which uses my woocommerce inventory how can I create resources eg. customers, orders etc using the woocommerce rest api -

i have e-commerce store uses woocommerce -a wordpress plugin. need develop android app performs crud operations woocommerce resources eg customers, orders etc. doing using woocommerce rest api : ref : http://woocommerce.github.io/woocommerce-rest-api-docs/ . for client side authentication need pass consumer key , consumer secret. suggested using oauth1 authentication using scribe library. ref: woocommerce rest api oauth authentication in android . my problem while able list resources customers, products etc. unable create them. please suggest me other alternative can use post request woocommerce store. note : tried rest clients postman , arc testing unable create resources.

amazon ec2 - Salt states using tags from salt-cloud in AWS -

i have salt states applied specific minions using minion id. moving cloud provider, , need apply states based on tags salt-cloud can set. ie. have instance runnning in aws (not provision salt-stack), can saltify salt-cloud , saltify module, , can recognize minion: root@instance1:~# salt instance1 test.ping instance1: true root@instance:~# salt-cloud -f get_tags my-ec2-eu-west-private-ips resource_id=instance1_awsid my-ips: ---------- ec2: |_ ---------- key: tagname1 resourceid: instance1_awsid resourcetype: instance value: value1 |_ ---------- key: tagname1 resourceid: instance1_awsid resourcetype: instance value: value2 i wish apply states based on values: ie: instead of clasic: salt instance1 state.highstate or salt instance1 st

c# - Create Object and its Properties at Run-time from List -

i need create dynamic object , properties @ run-time create instance of object store values. why want above logic! i reading excel file in c# , first line of code header properties , followed each rows record instance of dynamic object. list<string> exceldataheader = new list<string>(); (int y = 2; y <= colcount; y++) { exceldataheader.add(xlrange.cells[headerrow, y].value2.tostring()); } dynamic mydynamic = new system.dynamic.expandoobject(); ?????????? i need return excel read data in object you could use expandoobject here - it'll work, need use dictionary api: idictionary<string, object> obj = new expandoobject(); obj["id"] = 123; obj["name"] = "fred"; // "dynamic" bit: dynamic dyn = obj; int id = dyn.id; // 123 string name = dyn.name; // "fred" however, fail see point. since won't referring object in c# code things obj.prop

html - How to make use of correct Responsive Table with rowspan in Mobile using jQuery? -

Image
i facing problem in making responsive table. want result like: i not know how make responsive using jquery. simple tables single rows in thead, js code responsive. here there 2 rows in thead. please give me views , me out. $('.demo').addclass('responsivetable').find('tr td').each(function() { $(this).find('td').each(function(index, value) { var $thistd = $(this); var $closesttable = $thistd.closest('table'); if ($closesttable.find('th').length) { $thistd.addclass('col' + index).attr('data-head', $.trim($closesttable.find('th:eq(' + index + ')').text() + '')); } else { $thistd.addclass('col' + index).attr('data-head', $.trim($closesttable.find('td:eq(' + index + ')').text() + '')); } }).last().addclass('tdlast'); }); .demo{ background-color: #fff;border: 1px solid #888;border-collapse: collapse;bor