Posts

Showing posts from April, 2012

how to reset file parse in Logstash? -

many questions have been seen here in stackoverflow on similar subject this question . none of them helped reset logstash. i've used: input { file { path => ["/var/log/nginx/access.log"] start_position => "beginning" } } i've read .sincedb can set. don't have these files think unnecessary set file path that. is there other place reset logstash? why such simple method hard do? edit1: i've tried sincedb_path /dev/null this question has been said. again read today not beginning of log file. you can hand modifying .sincedb file. according documentation : sincedb files text files 4 columns: 1. inode number (or equivalent). 2. major device number of file system (or equivalent). 3. minor device number of file system (or equivalent). 4. current byte offset within file. so if change last number 0 restart file @ beginning.

javascript - How to retrieve groupby sum field to show balloonText in Amchart -

Image
i newbie in amcharts, please tell me doing wrong. here javascript code. var chartdata1 = []; generatechartdata(); function generatechartdata() { var month = new array(); month[0] = "jan"; month[1] = "feb"; month[2] = "mar"; month[3] = "apr"; month[4] = "may"; month[5] = "jun"; month[6] = "jul"; month[7] = "aug"; month[8] = "sep"; month[9] = "oct"; month[10] = "nov"; month[11] = "dec"; (var = 0; < 12; i++) { var monthname = month[i]; var year = "2016"; var newdateformat = monthname + " " + year ; var numofdocuments = math.round(math.random() * (10)); var amount = math.round(math.random() * (1000 + i)) + 500 + * 2; chartdata1.push({ chartcol: newdateformat, v...

linux - Find X occurence of string in file and replace to static string -

i need again. need find 3 , 4 occurrence of comma (accross line) , replace specific string, let's assume: "text","text2","text3","text4","text5" "text6","text7","text8","text9","text10" now, replace text4,text9,text5,text10 eg. "static" "text","text2","text3","static","static" "text6","text7","text8","static","static" which function should use? know 'sed' proper that, how count commas? edit: (simpler version 3 occurence of comma) i need find 3 occurrence of comma (accross line) , replace specific string, let's assume: "text","text2","text3","text4","text5" "text6","text7","text8","text9","text10" now, replace text4,text9 eg. "static" ...

Applying joins conditionally in SQL Server -

i have set of records, have select records set have theeir id in either of 2 tables. suppose have table1 contains id name ---------- 1 name1 2 name2 now need select records table 1 have either id in table2 or in table3 i trying apply or operator witin inner join like: select * table1 inner join table2 on table2.id = table1.id or inner join table3 on table3.id = table1.id. is possible? best method approach this? not able use if exist(select 1 table2 id=table1.id) select table1 could me on this? i inclined use exists : select t1.* table1 t1 exists (select 1 table2 t2 t2.id = t1.id) or exists (select 1 table3 t3 t3.id = t1.id) ; the advantage using exists (or in ) on join involves duplicate rows. if table2 or table3 have multiple rows given id , version using join produce multiple rows in result set.

Create JavaRDD from list in Spark 2.0 -

the usual way of creating javardd list use javasparkcontext.parallelize(list) however, in spark 2.0 sparksession used entry point , don't know how create javardd list solution: spark-shell (spark 2.0) import org.apache.spark.api.java.javasparkcontext val jsc = new javasparkcontext(sc) val javardd:java.util.list[int]= java.util.arrays.aslist(1, 2, 3, 4, 5) jsc.parallelize(javardd) spark programming guide

How to filter out "_id" from mongodb C driver results -

i have been going through documentation , i'm still lost on how filter out _id results mongodb using c driver. want functionality i'm not sure db.collection.find({"test":"pass"},{_id: false}); how include projection in c? cursor = mongoc_collection_find (collection, mongoc_query_none, 0, 0, 0, query, null, null); after bit of trial , error able add flags search query. else here format appending no id flag mongoc search. bson_t *field = bson_new(); bson_append_int32(field,"_id", 0); to search pattern like cursor = mongoc_collection_find (collection, mongoc_query_none, 0, 0, 0, query, field, null);

sitecore - Error deploying solution using Octopus deploy -

i have web project written in sitecore 8/ucommerce. using teamcity compile , package project , octopus deploy push out. when commit svn teamcity picks changes, compiles , packages , octopus deploys dev environment. works well. when try promote test error... error running conventions; running failure conventions... fatal 10:24:19 deployment on tentacle failed. in project have post deploy script ( postdeploy.ps1 ) remove unwanted config files. there 1 line... .\deleteconfig.exe $octopusenvironmentname i changed from.. .\deleteconfig.exe $octopusparameters['octopus.environment.name'] due article read, hasn't changed error. have tried.. .\deleteconfig.exe $octopusparameters['octopusenvironmentname'] again no effect. if comment out line of code no longer error. i have been trying fix sometime now, read , followed articles , post can find on problem cannot find fix. a slight curveball second project deploy in way. first sitecore/ucom...

git-tf tells on linux me “Could not lock” when checking in; how can I fix it? -

i'm using git-tf push tfs project on lin. sometimes, when try check 1 or more commits tfs, message this: connecting tfs... checking in $/myproject: 0% git-tf: not lock $/myproject what mean? what's keeping me locking? , how can fix this? i found out workspace has locked project, don't know which, , don'w know how recover this. a search on internet hints me kind of windows dependent fixes, not me on linux system. so, although question appears duplicate , more meant on how fix issue on linux. the first thing need solved finding out locked files under $/myproject , unlock them. there several tools available on windows platform, tfs powertool , tfs sidekicks , have read on other cases. i can't find existing tools on linux locked files, tfs command lines 1 solution. can use status command list checked out files under $/myproject , command should similar to(i don't have linux system test, need verify on side): tf status $/mypro...

incomplete results by mongoDB aggregation query -

i have mongo collection sample structure { "_id" : objectid("57835fd76898868d7d110228"), "name" : "family vision clinic - doctors of optometry", "website" : "familyvisionclinic.ca", "phone" : null, "address" : { "street" : "650 portland st", "city" : "dartmouth", "state" : "nova scotia", "zip" : "b2w6a", "country" : "canada" }, "profile_url" : "https://www.haha.org", } i want group entries country here's have tried db.subset.aggregate([{ "$unwind": "$address" }, { "$group":{"_id": "$address.country","count":{"$sum":1}}}]) but giving me incomplete results. mean many entries have united states country can see through eyeballing data wh...

How to add text via chart.renderer.text in Highcharts? -

i have succeeded adding additional text charts, here . this, achieved through adding " function(chart) " " var chart = new highcharts.chart " $.get('xxx.csv', function(data) { var chart = new highcharts.chart({ ... plotoptions: { series: { .... } } }, function(chart) { chart.renderer.text('the dotted line represents ...', 100, 86) .css({ fontsize: '13px', color: '#666666' }) .add(); } )}; my current format different: $(function () { var options = { chart: { ... }, ... }; $.get('xxx.csv', function(data) { var series = { data: [] }; var temp = [] // split lines var lines = data.split('\n'); // e...

mysql - how to do delete of particular row from a table in laravel 5.2 -

i created 1 view page, there displaying data in table fetching database. , given action drop down . 2 options there in drop down. view/edit , delete. when select edit button, corresponding row should delete database. how can write code in laravel?. in normal php know. can 1 write code??. view page given below @extends('app') @section('content') <div class="templatemo-content-wrapper" xmlns="http://www.w3.org/1999/html"> <ol class="breadcrumb"> <li><a href="{{ url("/") }}"><font color="green">home</font></a></li> <li class="active">user information</li> </ol> <div class="templatemo-content"> <h1>view/edit user information</h1> <div> <div> <div> ...

java - Why XMLBeanDeclaration returning null object after passing xml file? -

isreportmain(xmlconfiguration config) { this.config = config; } public static void main(string[] args) { string configfile = args[0]; xmlconfiguration config = new xmlconfiguration(); try { config.load(configfile); isreportmain report = new isreportmain(config); report.run(); } catch (exception ex) { logger.error("report failed run", ex); } } private void run() throws exception { connection connection = null; resultset results = null; xmlbeandeclaration decl = new xmlbeandeclaration(config, "datasource"); datasource datasource = (datasource) beanhelper.createbean(decl); .... .... } in above code pass physical path of xml file in run configuration. xml file contains database connection details. but on 'xmlbeandeclaration decl' initialization returns null object, results in susequent intializations fail. edit: as argument i'm passing : c:\users\dev\workspace\...

C# - Download files from FTP which have higher last-modified date -

i have ftp server files. have same files in in local directory (in c:\ ). when i'll run program, i'd searches files in ftp server have last-modified timestamp later same file (equal name) in local directory , download files founded. can give me or tip, please? i'll appreciate answers! unfortunately, there's no reliable , efficient way retrieve timestamps using features offered .net framework not support ftp mlsd command. mlsd command provides listing of remote directory in standardized machine-readable format. command , format standardized rfc 3659 . alternatives can use supported .net framework: the listdirectorydetails method (the ftp list command) retrieve details of files in directory , deal ftp server specific format of details (*nix format similar ls *nix command common, drawback format may change on time, newer files "may 8 17:48" format used , older files "oct 18 2009" format used). examples: dos/windows forma...

deep learning - How to suppress verbose Tensorflow logging? -

i'm unittesting tensorflow code nosetests produces such amount of verbose output makes useless. the following test import unittest import tensorflow tf class mytest(unittest.testcase): def test_creation(self): self.assertequals(true, false) when run nosetests creates huge amount of useless logging: fail: test_creation (tests.test_tf.mytest) ---------------------------------------------------------------------- traceback (most recent call last): file "/home/cebrian/git/thesis-nilm/code/deepmodels/tests/test_tf.py", line 10, in test_creation self.assertequals(true, false) assertionerror: true != false -------------------- >> begin captured logging << -------------------- tensorflow: level 1: registering const (<function _constantshape @ 0x7f4379131c80>) in shape functions. tensorflow: level 1: registering assert (<function no_outputs @ 0x7f43791319b0>) in shape functions. tensorflow: level 1: registering print (<fu...

database - How to use an if...else statement in R? -

i'm trying create variable using if-statement. want check whether variable "st" exists in dataframes in list of dataframes "dflist", , if doesn't exist want create variable "st". tried this(however, doens't work): #making list of dataframes, , reading them r mylist = list.files(pattern="*.dta") dflist <- lapply(mylist, read.dta13) # if "st" exists in every dataframe in dflist, return "yes", else if doesn't exist in particular dataframe, create variable "st" in dataframes if(exists(st, dflist)){ "yes" } else{ st <- c("total") dflist$st <- st } we can use lapply loop on list , create column in 'data.frame' if 'st' not there. dflist1 <- lapply(dflist, function(x) if(!exists("st", x)) transform(x, st = "total") else x) data ...

c# - How can I display hierarchical-based objects in an UserControl and present Commands using MVVM? -

Image
[as question mvvm thoughts, i'm using pseudo-code , -xaml in question short , precise possible.] i've ran mvvm problem wasn't able solve yet using best practice recommendations. imagine you're trying create editor program something. we're going use library model (i couldn't come better one): a library contains 1 or many books a book contains 1 or more chapters a chapter contains 1 or more paragraphs the ui might this. might designed badly, example after all: now came mainwindow definition: <window datacontext="{pseudoresource editorvm}"> <dockpanel> <controls:allbookscontrol books="{binding books}" addcommand="{binding addbookcommand}" selectcommand="{binding selectbookcommand}" dockpanel.dock="left" /> <controls:editbookscontrol books="{bindin...

php - Symfony 2: The annotation @ORM\OneToMany declared on property AppBundle\Entity\Genre::$movie does not have a property named "onDelete" -

i've been trying use ondelete="set null" 1 of entities, returns error: [creation error] annotation @orm\onetomany declared on property appbundle\entity\genre::$movie not have property named "ondelete". available properties: mappedby, targetentity, cascade, fetch, orphanremoval, indexby entity looks this: /** * movie array * * @orm\onetomany( * targetentity="appbundle\entity\movie", * mappedby="genres", * ondelete="set null") * */ protected $movie; what doing wrong? you should use "ondelete" property on orm\joincolumn , not on relation. error saying not property of relation. try like: @orm\joincolumn(name="moviee_id", referencedcolumnname="id", nullable=true, ondelete="set null") replace field name per need

google analytics api v4 using PHP. Ordering output -

i have code on google analytics api v4 php. $ecpm_adsense = new google_service_analyticsreporting_metric(); $ecpm_adsense->setexpression("ga:adsenseecpm"); $ecpm_adsense->setalias("ecpm adsense"); // create ordering. $ordering = new google_service_analyticsreporting_orderby(); $ordering->setfieldname("ga:adsenseecpm"); $ordering->setordertype("value"); $ordering->setsortorder("descending"); the ordering not works me. can me? thanks i have created library integrate analytics api v4 using php easy. take at: https://github.com/panakour/google-analytics

c# - How to use "using static" directive for dynamically generated code? -

i want let users input mathematics expression in terms of x , y natural possible. example, instead of typing complex.sin(x) , prefer use sin(x) . the following code fails when sin(x) , example, defined user. using microsoft.codeanalysis.csharp.scripting; using system; using system.numerics; using static system.console; using static system.numerics.complex; namespace mathevaluator { public class globals { public complex x; public complex y; } class program { async static void jobasync(microsoft.codeanalysis.scripting.script<complex> script) { complex x = new complex(1, 0); complex y = new complex(0, 1); try { var result = await script.runasync(new globals { x = x, y = y }); writeline($"{x} * {y} = {result.returnvalue}\n"); } catch (exception e) { writeline(e.message); ...

c# - Automated alert notifications android xamarin -

i new android development.i using xamarin visual studio 2015. in project, want send automatic alerts notification (like in games or apps notification shows after time.) on basis of time table stored in mobile database using sqlite orm. dont know how implement feature.help me sort out problem. in advance i think should make service or intentservice , use notificationcompat.builder message. on examples in xamarin web

java - Write timestamp in logs (every line) and trigger a jar using a batch file -

i have jar file trigger using batch file , want shown on command line window logged along timestamp. need write timestamp in each line written inside logs. this: tue 06/28/2016,15:42:22.24 - logssssss tue 06/28/2016,15:42:22.24 - logssssss tue 06/28/2016,15:42:22.24 - logssssss ... i have following code: @echo off echo %date%,%time% - %~1 >>output.log call :sub >>output.txt echo %date%,%time% - %~1 >>output.log exit /b :sub command1 command2 ... commandn using able record start , end time of script. edit 1: want script display execution on screen along writing in file. edit 2: now, have following code not write logs along execution. please tell me improve. @echo off setlocal enabledelayedexpansion set logfile=d:\logs\logfile.out set logg=^> tmp.out^&^& type tmp.out^&^&type tmp.out^>^>%logfile% if /i "%~1"=="recursive" java test prompt $d,$t$s-$s >> %logg% echo !date!,!time! - %~1 >> %lo...

Setting default page in PowerBI Embedded -

Image
i have 5 pages in report , using same report in 2 different applications. possible set default page per application i.e.; application 1 should have page 1 default page application 2 should have page 5 default page. there's new query string parameter can pass call pagename=<reportsectionname> the report section name little confusing it's not name of page see in ui. instead it's @ end of url in browser's address bar. so log in www.powerbi.com , upload report see section names are. can use them in power bi embedded environment. you can see actual pagename value each report-page through share-url balloon:

ios - Audio Bug on 1 of 2 Client iPhones (Xcode + Swift) -

so i've finished building clients app , good. app worked seamlessly on both mine , clients phone. clients partner tried on iphone 5s , audio did not play. tried running app on alternative iphone 5s oppose client's partners (6s) , works fine. i think problem phone maybe i'm wrong - although audio in safari works fine them. i using standard web view don't know why it's phone. there reasons maybe specific device wouldn't allow sound in app? thanks.

java - ScalarFunctionMultiPageEditor cannot be found by Plug-in -

this weird situation. creating plug-in utilizes hana sql editor functions .hdbscalarfunction . uses dependency: com.sap.ndb.studio.sqlscript.function . now, when try accessing class scalarfunctionmultipageeditor not working due access restrictions. tried editing access restrictions allowing access specific package class. however, noclassdeffounderror . i noticed in plugin.xml of com.sap.ndb.studio.sqlscript.function package scalarfunctionmultipageeditor not exported, not visible anyone. any ideas? thanks! if plugin not export package cannot use in package. eclipse/osgi classloaders enforce , can't work around it.

php - How to display all blobs (images) form database -

ok uploaded images code below dont know how display it, want make gallery want display images on 1 page, if explain helpfull too! <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "phplogin"; $connect = mysqli_connect($servername,$username,$password,$dbname); $file = $_files['image']['tmp_name']; $ime = $_post['ime']; if(!isset($file)) { echo "izaberite sliku"; } else { $image = addslashes(file_get_contents($_files['image']['tmp_name'])); $image_name = addslashes($_files['image']['name']); $image_size = getimagesize($_files['image']['tmp_name']); if($image_size == false) { echo "niste izabrali dobru sliku"; } else { if(!$insert = mysqli_query($connect,"insert store values ('','$image_name','$image','$ime')")) { ...

Rails Devise Confirmable - redirect -

the rails docs devise instructions how redirect incorrect: https://github.com/plataformatec/devise/wiki/how-to:-add-:confirmable-to-users#redirecting-user does know how this? you need override devise confirmation controller. in routes.rb add line devise_for :users, controllers: { confirmations: 'confirmations' } create file in , paste code class confirmationscontroller < devise::confirmationscontroller private def after_confirmation_path_for(resource_name, resource) your_new_after_confirmation_path #your path want land end end you may need restart server. source : https://github.com/plataformatec/devise/wiki/how-to:-add-:confirmable-to-users#redirecting-user

r - How to calculate "terms" from predict-function manually when regression has an interaction term -

does know how predict-function calculates terms when there interaction term in regression model? know how solve terms when regression has no interaction terms in when add 1 cant solve manually anymore. here example data , see how calculate values manually. thanks! -aleksi set.seed(2) <- c(4,3,2,5,3) # first make data b <- c(2,1,4,3,5) e <- rnorm(5) y= 0.6*a+e data <- data.frame(a,b,y) model1 <- lm(y~a*b,data=data) # regression predict(model1,type='terms',data) # terms #this gives result: b a:b 1 0.04870807 -0.3649011 0.2049069 2 -0.03247205 -0.7298021 0.7740928 3 -0.11365216 0.3649011 0.2049069 4 0.12988818 0.0000000 -0.5919534 5 -0.03247205 0.7298021 -0.5919534 attr(,"constant") [1] 1.973031 your model technically y ~ b0 + b1*a + b2*a*b + e . calculating a done multiplying independent variable coefficient , centering result. example, terms a be cf <- coef(model1) scale(a * cf[2], s...

c# - Get default deployment storage in Azure -

i using cloud service classic in azure , when deploy new azure account, have create new cloud storage (which has same name default) using deployment wizard. there way connect storage (get connection string programmatically) service without deploying first, getting connection string azure portal , pasting connection string service configuration file? thank much. the storage account used temporarily hold deployment package during deployment. not believe configured part of cloud service , cannot set part of cloud service configuration. you can retrieve storage account via powershell get-azurestorageaccount , blob container in storage account via powershell get-azurestorageblob -container $containername

java - Trying to hit mongodb from rest api and trying to perform post opertaion is giving EOFException -

i have hosted tomcat , mongodb service in server. , have deployed war file in web app folder. when i'm trying hit database rest api , trying perform post operation using postman i'm getting eofexception . please me on this. i'm stuck entire day... basic code establishes connection mongodb: public class mongodbsingleton { private static mongodbsingleton mdbsingleton; private static mongoclient mongoclient; private static db db; private static final string dbhost ="192.168.1.xxx"; private static final int dbport = 27017; private static final string dbname = "petcaredb"; private mongodbsingleton() { }; public static mongodbsingleton getinstance() { if (mdbsingleton == null) { mdbsingleton = new mongodbsingleton(); } return mdbsingleton; } public db getdb() { if (mongoclient == null) { try { mongoclient = new mongoclient(dbhost, dbport); } catch (unknownhostexception e) { ret...

batch file - Difference between "@echo off" and "@echo %off"? -

Image
at beginning of batch script, saw command: @echo %off to surprise has same effect of: @echo off what effect of '%' prefix? i've never seen before. doesn't work in cmd console -- in .bat script. have guess. in cmd console window if @echo off , results in command prompts being hidden, in .bat script. reveal prompts again, have echo on . difference in .bat script, percent signs need doubled represent literal % string character, whereas in cmd console not. result @echo %off in cmd console results in string %off being echoed stdout. with in mind, i'm guessing author intended hack avoid problems encountered users copypaste script cmd console window, rather intended .bat script. % added, command neutered in console, still achieves intended effect when run .bat script. without % , console appear hang after instructions have completed.

intellij idea - How to auto indent in WebStorm -

Image
i need indent multiple files in webstorm. option "auto-indent" in code menu indents current line. how use on multiple files can use " reformat code "? select folder want reformat code in project tool window. select code | reformat code this page explains it. https://www.jetbrains.com/help/idea/2016.1/reformatting-source-code.html

ruby - Rails Error: "\xE4" followed by "l" on UTF-8 -

when load css or js files on rails 4.2.6 link tags javascript_include_tag , stylesheet_link_tag error: encoding::invalidbytesequenceerror @ /app "\xe4" followed "l" on utf-8 i never saw error before. , when load these same files html script like: <script src="/assets/app/functions.js"></script> then works. my app/assets/javascripts/application.js is: //= require jquery //= require jquery_ujs //= require turbolink__s edited //= require__tree . edited someone had problem before? thanks! ok, since not seem understand short explanation in comments, put answer. puts "\xe4".force_encoding('iso-8859-1').encode('utf-8') #⇒ ä that said, either 1 (or many) of stylesheets, or 1 (or many) of javascripts stored in iso-8859-1 encoding. ruby tries read in utf-8 default. should find file causes problems, open in editor , save in utf-8 encoding. you might bulk update smth like dir['*/**/*...

sql - SELECT DISTINCT Users in Table 1 which don't exist in Table 2 -

i have table 4 columns of user information. each table has following columns: username | full_name | job_name | current_job_allowed table 1 includes users , job_name have permissions view. means there multiple lines of same username in table 1 different job_name values. table 2 contains list of possible users. username |full_name --------------+----------------- amunoz |andrew munoz csmith |carl smith cwatkins |cat watkins ggriffiths |garmin griffiths jcarr |jason carr jhothi |jark hothi jphillips |jim phillips lbradfield |lisa bradfield ntaylor |noria taylor rfelipe |ralf felipe query 1 contains users specified query parameter specify, i.e. 'kml_20160531'. i select distinct list of users have different job_name parameter specify job_name. example table 1 contains: username|full_name |job_name |current_job_allowed --------+------------+------------+---------------------- amunoz |andrew munoz|km...

uitableview - Swift tableView with 3 Prototype Cells and auto-height -

Image
i have concept want realize in xcode. default tableviewcontroller 3 prototype cells. cell 1 = name (prototype pages) cell 2 = seperator (prototype seperator) cell 3 = imageview (prototype seperator-with-only-image) cell 1 , cell 2 ok. need set height of "prototype seperator-with-only-image" cells auto. height should calculated based on added image dimensions. here mockup addional info: "prototype seperator-with-only-image" can occur multiple times , dimensions of images can vary. any ideas how can achieve this? you can set tableview's rowheight equal uitableviewautomaticdimension in viewdidload method: self.yourtableview.rowheight = uitableviewautomaticdimension self.yourtableview.estimatedrowheight = 42.0 here telling tableview calculate dimension of row . saying estimate row have height of 42, setting minimum height. i think this great example using demo app.

Nginx, PHP-FPM, MySQL and Symfony using Docker : Nginx 502 Bad Gateway and Symfony No route found exception -

this post quite long, make sure have drink near you. basically, want use docker make nginx container, php-fpm container, mysql container , symfony container contain code of symfony app. i've been trying make things work whole week, been reading things, unfortunately nothing worked. i made docker-compose.yml, uses dockerfiles nginx, php-fpm , symfony. mysql based on image hosted on dockerhub. i installed , finally, after week of work still encounter 2 types of error : nginx gives me "502 bad getaway" randomly. it's because of port error if nginx fastcgi_pass parameter wasn't set @ right value, is, don't quite understand problem. then, symfony gives me "no route found /" don't understand why, since website works on production , colleagues. suspicious database since when it's empty give me error. took dump database didn't give concluent. here files want docker-compose.yml version:'2' services: symfony: ...

Javascript callback function and an argument in the callback. How must it be used based on the code snippet provided? -

i'm reading on legacy codebase , ran following code: andthenwe: function(callback) { var qunitassertasync = new window.assertasync(callback); return qunitassertasync; }, and here's call site: andthenwe(function(done) { ...(some code) done(); }); so in call site, we're passing in anonymous function === 'callback' right? however, callback has argument called done , seems called @ end of function. argument kind of block parameter in ruby right? somewhere in window.assertasync callback must called , passed kind of arugment === qunit's assert.async right? (most likely). details of window.assertasync complicated want understand @ high level must going on. making proper assumptions? this possible because callback in function signature anonymous function invoked @ later time right? done in callback function must function @ runtime right? i think attempt make qunit.async more "readable" (haha). qunit.a...

express - http proxy in Node.js -

i m trying create http proxy in node.js gets request , makes new request server. purpose getting rid of cross origin problem while , test application. m getting exception : _stream_readable.js:536 var ret = dest.write(chunk); dest.write not function i m totally newbie in node.js, on right path ? or there better way ? app.get('/tlq', (req, res) => { console.log('serve: ' + req.url); var options = { hostname: 'www.google.com', port: 80, path: req.url, method: 'get' }; var proxy = http.request(options, function (res) { res.pipe(res, { end: true }); }); req.pipe(proxy, { end: true }); }); to rid of cross origin error, have send access-control header (before data shipped client). purpose use next middleware: app.use(function(req, res, next) { res.header("access-control-allow-origin", "*"); res.header("access-control-allow-headers", "or...

android - ApplicationTestCase deprecated in API level 24 -

i created default empty project on android studio 2.1.2 api 24 . in sample project, google offers depreciated class applicationtestcase : this class deprecated in api level 24. use activitytestrule instead. new tests should written using android testing support library. sample: import android.app.application; import android.test.applicationtestcase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">testing fundamentals</a> */ public class applicationtest extends applicationtestcase<application> { public applicationtest() { super(application.class); } } my question: why android test case deprecated? how replace applicationtestcase activitytestrule? edit: i try expresso , on api 24 ( compilesdkversion 24 ) have error: error:conflict dependency 'com.android.support:appcompat-v7'. resolved versions app (24.0.0) , test app (23.1.1) differ. see http://g.co/androidstudio/app-test-app-c...

vsts - Remove workspace when no connection to tfs -

Image
i have local vm visual studio 2015 community edition. connected vsts tfs collection - no longer have access. i want connect vs new vsts collection each time load visual studio message "tf14061: workspace xxx not exist" how can prevent vs looking workspace? have trued tf workspace /delete commands pass collection url param prompts me login , credentials no longer valid. try use team foundation sidekicks remove old source control workspace binding. or can try delete tfvc , vs local cache , try again.

ios - Swift - programmatically click on point in screen -

tl;dr- how can programmatically perform native touch in specific point on screen? within web view there html contains iframe, web view code , elements not accessible , sanding massages js not possible either. there button in web view on specific coordinates. how can press programmatically? to simulate touch need write javascript function in web page can click button on behalf. let's assume button on website loaded in iframe coded following: <a href="#" id="magicbutton" onclick="targetfunction();">click me!</a> and iframe coded in webpage: <iframe id="myiframe" src="http://www.stackoverflow.com" width="200" height="200"></iframe> in web page add following javascript function call click event on embedded button: <script> function myjavascriptfunction(){ //get handle iframe element var iframe = document.getelementbyid('myiframe'); ...

nunit - TFS 2015 set label for "Visual Studio Test" step -

Image
i'm build und test solutions visual studio team foundation server 2015. each nunit-projekt created "visual studio test" step . if build completed see test result this: 1171:vstest test run release x64 (the number runid ) 1172:vstest test run release x64 build result: but don't have reference nunit-projekt these results belongs. build definition: (i tried field (1) doesn't affect result) question: is there way modify these test result labels? set "test run tile" of "visual studio test" step change this:

gradle - Android duplicate resources error -

Image
my project compiling fine until deleted png drawables , replaced them vector drawables navigating new > vector asset . getting duplicate resources error . here res folder: here error message in gradle console: execution failed task ':app:mergedebugresources'. > [drawable/ic_menu_manage] /users/tomfinet/androidstudioprojects/birthpay/app/src/main/res/drawable/ic_menu_manage.xml [drawable/ic_menu_manage] /users/tomfinet/androidstudioprojects/birthpay/app/src/main/res/values/drawables.xml: error: duplicate resources [drawable/ic_menu_share] /users/tomfinet/androidstudioprojects/birthpay/app/src/main/res/drawable/ic_menu_share.xml [drawable/ic_menu_share] /users/tomfinet/androidstudioprojects/birthpay/app/src/main/res/values/drawables.xml: error: duplicate resources [drawable/ic_menu_slideshow] /users/tomfinet/androidstudioprojects/birthpay/app/src/main/res/drawable/ic_menu_slideshow.xml [drawable/ic_menu_slideshow] /users/tomfinet/androidstudioprojects/bi...

mysql - Self joining doesn't help here. What other approach can I use? -

i stuck problem. consider following table. know value a(i.e. can use select * table user_one = a ). tried doing self join, didn't help. given table +----------+-----------+---------+ | user_one | user_two | status | +----------+-----------+---------+ | | | | | | b | 0 | | | | | | b | | 1 | | | | | | | c | 1 | | | | | | c | | 1 | | | | | | d | | 1 | | | | | | | e | 0 | +----------+-----------+---------+ my desired result needs following. imagine user_one following user_two if status 1.status 0 means, user_one following user_two , unfollowed user_two . need users following "a". notice don't want , rows both following each other (a -> b) , (b -> a) both has status 1...