Posts

Showing posts from July, 2010

How can I call uiautomator api directly in Android project? -

i directly call uiautomator api in android application achieve automated testing. to able uidevice reference (which guess want) need // initialize uidevice instance mdevice = uidevice.getinstance(getinstrumentation()); and instrumentation have running tests adb won't able activity.

javascript - How to render d3 graph ticks above shaded region or graph itself? -

i want ticks come above shaded region in graph, have tried transparency not work. due constraint cannot change way coloring green region, this-> shade area below above line green, area below bottom line white(same chart background color) now due this, ticks hiding behind, there way can place them above? or redraw new ticks in shaded region? click here image of graph rendergraph: function(){ // data notice structure //************************************************************ var data = [ [{'x':1,'y':7},{'x':2,'y':7},{'x':3,'y':7},{'x':4,'y':7},{'x':4.5,'y':8.1},{'x':6.3,'y':8.1},{'x':6.8,'y':7},{'x':8,'y':7},{'x':9,'y':8},{'x':10,'y':8}], [{'x':1,'y':9},{'x':2,'y':8},{'x':3,'y':11},{'x':4,'y':10},{'x':5,'y':10},...

Logging issue in apache spark streaming -

getting below exception while creating kafkautils.createstream(); below spark dependency.same thing working in spark streaming older version 1.5.2 <dependency> <groupid>org.apache.spark</groupid> <artifactid>spark-streaming_2.11</artifactid> <version>2.0.0</version> </dependency> <dependency> <groupid>org.apache.spark</groupid> <artifactid>spark-streaming-kafka_2.11</artifactid> <version>1.6.2</version> </dependency> exception in thread "main" java.lang.noclassdeffounderror: org/apache/spark/logging @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:763) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclassloader.java:467) @ java.net.urlclassloader.access$100(urlclassloader.java:73) @ java.net.urlclassloader$1.run(urlcla...

libgit2 - Decoding git log complex pretty format -

i'm trying porting git -depending stuff libgit2 open source project. 1 of git calls weird: git log --topo-order --no-color --parents --boundary -z --pretty=format:%m%hx%px%n%cn<%ce>%n%an<%ae>%n%at%n%s%n%b head --all first of all, i'm interesting in format string. means x after h ? unable find x specifier on official git site :/ , second question - can libgit2 complex formatting, or should process myself? p.s. however, i'm pretty sure cannot :) the x not format specifier. the argument --pretty=format: or --pretty=tformat: (most users need tformat , code using -z adds nul character after each commit) contains both directives %m , %h , , literal text transcribed: $ git log -n 3 --pretty=tformat:hello%x25world hello%world hello%world hello%world here, hello , world strings copied through, while %x25 interpreted. since means "print character hex code 25" percent sign % , , -n 3 told git log stop after logging 3 co...

Display default image and replace that image with the uploaded image in android -

i want upload image particular id in server app , display getting toast message "uploaded".if there no image exists particular id want display default image , later want replace uploaded image.how can this? @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_student_details); { string image_url = "http://xxx.xxx.xx.x/mobile_app/" + img_path + "/" + img_name; new downloadimagetask((imageview) findviewbyid(r.id.profilepiciv)) .execute(image_url); } public void onresume() { // after pause or @ startup super.onresume(); getintent(); string auid_num = auid_s.gettext().tostring(); string imei_num = imei_s.gettext().tostring(); string img_name = getintent().getstringextra("img_name"); ...

oop - What is the significance of the `Object.length` property on JavaScript's `Object` constructor? -

this question has answer here: why `object.length === 1` in javascript part of browsers? 1 answer the documentation javascript language's built-in global object object states that object.length has value of 1. what significance of property and, additionally, why isn't object.length available in same manner array.length ? at first glance, seem me reason latter question has possible confusion in interpreter of length property on object dot notation method of property access/initialization. the length property specifies number of arguments expected function . as object belongs type function , length property of function determines number of arguments, object.length returns length of arguments being expected. consider following example: function test(a, b, c) {} console.log(test.length); and objec...

python - scikit learn logistic regression precision calculation weird warning -

using scikit-learn python 2.7 on windows. here code , code has no warning if change precision precision_weighted scoring parameter. not know warning mean , reason behind scene explicitly specify average 1 of (none, 'micro', 'macro', 'weighted', 'samples')? in case, want treat samples of equal weight, seems there no such option in 5 choices? from sklearn import linear_model, datasets sklearn.cross_validation import cross_val_score # import data play iris = datasets.load_iris() x = iris.data[:, :2] # take first 2 features. y = iris.target h = .02 # step size in mesh logreg = linear_model.logisticregression(c=1e5) # create instance of neighbours classifier , fit data. logreg.fit(x, y) print cross_val_score(logreg, x, y, cv=10, scoring="precision") #print cross_val_score(logreg, x, y, cv=10, scoring="precision_weighted") warning message, c:\python27\lib\site-packages\sklearn\metrics\classification.py:1203: deprecationw...

For Loop on Plotly Python -

i trying replace fig.append_trace(trace1, 1, 1) fig.append_trace(trace2, 2, 1) with loop code totalplot = 2 x = ['trace%s'%(item + 1) item in range(totalplot)] y = [(item + 1) item in range(totalplot)] z = totalplot * [1] i, j, k in zip(x, y, z): fig.append_trace(i, j, k) so more scalable add more figures. however, loop code keeps returning 'typeerror: 'str' object not support item assignment'. did wrong? here code similar 1 plotly : from plotly import tools import plotly.plotly py import plotly.graph_objs go trace1 = go.scatter( x=[1, 2, 3], y=[4, 5, 6] ) trace2 = go.scatter( x=[20, 30, 40], y=[50, 60, 70], ) fig = tools.make_subplots(rows=2, cols=1) # ----- loop here ------- start fig.append_trace(trace1, 1, 1) fig.append_trace(trace2, 2, 1) # ----- loop here ------- end fig['layout'].update(height=600, width=600, title='i <3 subplots') py.iplot(fig, filename='make-subplots') in code...

SQL Server exec command works wrong -

i have stored procedure spresultflagupd gets 2 parameters @p_code_sazman , @p_code_marhale . stored procedure must update column true , false values alter procedure [dbo].[spresultflagupd] @p_code_sazman nchar(6) = null, @p_code_marhale nchar(6)=null if exists(select * tblresult code_marhale = @p_code_marhale , code_sazman = @p_code_sazman , confirmed = 1 , sendfile = 1 , makefileflag = 1) begin update tblresult set makefileflag = 0 code_marhale = @p_code_marhale , code_sazman = @p_code_sazman end when run exec spresultflagupd @p_code_marhale='000060', @p_code_sazman='000021' it not update table. but when run update code sql query, works correctly. when write code pure update tblresult set makefileflag=0 code_marhale=@p_code_marhale , code_sazman=@p_code_sazman it works correctly the exists statement working. problem up...

html - Uploading Multiple files or directories -

i give user option upload either single file, multiple files or directory. 1 file chooser. able working 2 using following tags: <p>directory: <input type="file" webkitdirectory mozdirectory /></p> <p>multiple: <input type="file" multiple /></p> however requires user click on different button depending on whether uploading files or directory. is possible functionality 1 file chooser? edit: https://jsfiddle.net/26szvfgk/3/

javascript - NodeJS proper practice for route structure -

over past few days have been researching best practice using controllers , routes in nodejs. wanted split controllers, models, middlewares , routes instead of having cluttered routes page. finally have came working solution, wanted input more efficient method? feel seems bit basic now, please ask questions. directory structure macbook-pro:v1 macplusaday$ tree . ├── app.js ├── bin │   └── www ├── controllers │   ├── index.js │   └── user.js ├── middlewares ├── models ├── npm-debug.log ├── package.json ├── public │   ├── images │   ├── javascripts │   └── stylesheets │   └── style.css ├── routes │   ├── index.js │   └── users.js └── views ├── error.jade ├── index.jade └── layout.jade app.js using method include of route files app.js file, feel easier having separately include each individual routes file. var normalizedpath = require("path").join(__dirname, "routes"); require("fs").readdirsync(normalizedpath).foreach(function(f...

java - Emoji not encoding -

i retrieving twitter tweets , attempting save them flat file. have following code: string jsonstring = new gson().tojson(tweets); byte[] utf8jsonstring = jsonstring.getbytes("utf-8"); string utf8json = new string(utf8jsonstring, "utf-8"); system.out.println( utf8json); output: ..."id":768260789744443392,"text":"#emojicity5 ?","source"... the emoji (just after #emojicity5) appearing ?. have attempted endode using utf-8, utf-16be, utf-16le, utf-32be, , utf-32le no avail. system using jdk 1.6 , 3.0.3 of twitter4j . missing here? string contains unicode, no need convert same string. when or byte[] 1 needs indicate encoding of bytes. however problem console has no unicode encoding utf-8 , might not have emoji in fonts. problem of system.out.println . in case system.out in other encoding not represent emoji , instead printed question mark. what can check whether emoji arrived, dump unicode code poi...

javascript - IFRAME Height Property Difference Between Safari and Chrome -

i've been tearing out hair on one... maybe can help? height of embedded web app on site looks expected on safari (calculated height 992px), in chrome, iframe containing webapp calculates height 150px, "incorrect". the height iframe should computed using simple code using javascript, referenced elsewhere on stackexchange : <script language="javascript" type="text/javascript"> function resizeiframe(obj) { obj.style.height = obj.contentwindow.document.body.scrollheight + 'px'; } </script> <iframe class="embed-blast" src="http://example.com/mywebapp" scrolling="no" onload="resizeiframe(this)" ></iframe> i've tried using jquery, , variety of other scripts, none of seem fix underlying issue. what i'd size iframe full content size (as occurs in safari already) in chrome. i've tried looking description of behavior, haven't been able find it. not sure...

html - Why is #shadow-root in my document and why is it overriding my CSS -

Image
first, i've seen duplicates what #shadow-root, , why put display none on font awesome classes? and html / css - div element hidden when shouldn't be? however both of these suggest issue adblock , have totally disabled adblock. i more concerned #shadow-root coming from, since did not put there. i have read there option in chrome disable (and interestingly enough have disabled...), means using website need same, , i'd rather away entirely provides 0 usefulness in application. i have googled , read many of articles shadow dom , none of them give insight on why appear seemingly no reason. from have seen in inspector/view page source, entire contents of app being rendered shadow dom , thereby not receiving of styles. i using rails, react, redux, react-redux, react-router chrome developer tool screen page source screen notice source has nothing in div react should rendering to. additional info: displays unstyled page on chrome in normal , incognito...

Excel VBA select new usedrange portion of a column -

Image
hi all. i need please. i want apply formula new rows i've added. have line of code use full set of data, i'm not sure how modify it, or if there better way it. i'm bit out of league line of code, understand it's doing didn't write it. sheets("closed loop").range(varpastepos).offset(0, 2).resize(activesheet.usedrange.rows.count - 1, columnsize:=1).formular1c1 = "my formula" varpastepos position new data pasted, in case $f$28 any ideas? use range().filldown extend pre-existing formula. dim lastrow long lastrow = range("f" & rows.count).end(xlup).row range("a2", "a" & lastrow).filldown you can filldown multiple columns @ once this: range("a2", "d" & lastrow).filldown you can in 1 line this: range("a2", range("f" & rows.count).end(xlup)).filldown

javascript - Inelastic collision only moving object to the right -

my rocket hitting inertia object, defined in handlecollision . i'm passing in rocket has .r value theta , .power magnitude. i'm wanting update .rotation & .magnitude according inelastic collision defined wikipedia when colliding left, inertia moves right. but when colliding right errors , moves 180 degrees off. if rocket , right @ 45 degree angle inertia object, object move , right @ 45 degree angle. what missing here? thought might issue atan function converted y component & x component of vector radians first, same issue. handlecollision(rocket) { var angle = rocket.r * math.pi / 180.0; var rr = this.rotation * math.pi / 180; var rocketvector = {'x' : r.power * math.cos(angle), 'y' : r.power * math.sin(angle)}; var inertiavector = {'x' : this.magnitude * math.cos(rr), 'y' : this.magnitude * math.sin(rr)}; var rmass = 10; var shipmass = 10; var x = (rmass * rocketvector.x) + (shipmass * in...

html - How to add new flaticons to my website? -

i have website template uses flaticons. has folder files flaticon.css, flaticon.eot, flaticon.ttf, flaticon.svg, flaticon.woff , others. can use icons importing css page , doing <i class="flaticon-world-grid"> . now want download new flaticons , use them on site. found on flaticon.com , gives me option download in multiple formats. how "install" these files , edit css can use new icons ones there? the css file has content this: .flaticon-wand2:before { content: "\e0fb"; } .flaticon-wealth:before { content: "\e0fc"; } .flaticon-website34:before { content: "\e0fd"; } .flaticon-world-grid:before { content: "\e0fe"; } which format should download, put new files, , add css file able use them? as mentioned here can use 2 or more font-face, different font-family name. like this: @font-face { font-family: "flaticon"; src: url("../fonts/flaticon.eot"); src...

Editable List in Angularjs -

i create list user can not edit individual steps, edit number of steps well. how can in angularjs? the problem i'm having if use ng-model in "ol" don't think can create list of individual elements, if use ng-repeat in "li" don't think can add new elements list. what's best way solve this? you can this: js: $scope.range = function(min, max, step) { step = step || 1; var input = []; (var = min; <= max; += step) { input.push(i); } return input; } $scope.list = []; $scope.printlist = function(){ console.log($scope.list); } html: <input type="number" ng-click="printlist()" ng-model="len"> <ol> <li ng-repeat="n in range(0,len-1)"><input type="text" ng-model="list[n]"></li> </ol>

ruby - Detect specific format of version number using regex -

i'm looking extract elements of array containing version number, version number either @ start or end of string or padded spaces, , series of digits , periods not start or end period. example "10.10 thingy" , "thingy 10.10.5" valid, "whatever 4" not. haystack = ["10.10 thingy", "thingy 10.10.5", "whatever 4", "whatever 4.x"] haystack.select{ |i| i[/(?<=^| )(\d+)(\.\d+)*(?=$| )/] } => ["10.10 thingy", "thingy 10.10.5", "whatever 4"] i'm not sure how modify regex require @ least 1 period "whatever 4" not in results. this slight variant of archonic's answer. r = / (?<=\a|\s) # match beginning of string or space in positive lookbehind (?:\d+\.)+ # match >= 1 digits followed period in non-capture group, >= 1 times \d+ # match >= 1 digits (?=\s|\z) # match space or end of string in positive lookahead /x ...

oop - is this an elegant way to implement this association scenario in a custom orm? -

i'm building custom orm using dapper. have following tables: user role permission rolepermission my sproc has 2 selects: 1 basic user info, 1 user-role info. basic user info gets deserialized user object. rolepermission info gets deserialized custom rolepermission object , programatically associated user object. how complex make object graph implementation in custom orm? example, ef takes nice , easy oo approach role name this: user.userroles.role.name. however, accomplished through use of complex , sophisticated f/w automatically maps entity joins based on db fk associations. comes performance overhead. thought create entity classes follows: mycompany.entities.entity.user.user mycompany.entities.entity.user.rolepermission therefore, rolepermission object tailored user entity no external dependencies. keep rolepermission object lightweight possible in context of user object. not need additional properties support other entities/domains/usages. seems elegant (...

Deploy a Qt C++ shared library's dll in subfolder of the main executable -

i have qt5 c++ project main app , (created me) shared library. compiles , executes , able deploy it. issue is, deployment need put compiled dll of shared library in same directory main executable. however, preffer keep top level folder relatively clean , put necessary files in appropriate sub-tree of folders. so, question is, should put in *.pro file in order change path of dll myapp/mylib, myapp folder main app's executable resides. since windows search of dll's program, , not program itself, can't tell makefile search libraries. you can, however: add desired folder dll's go path. make startup script, sets path libraries are, , start program. compile statically, if comply lpgl or qt comercial license, depending case. as side note: qt plugins want, core dependencies aren't qt plugins themselves.

database - Maximum limit of data that can be stored in MySQL -

we're creating enrollment system using php our final thesis. , allows attachment of documents. using mysql , wondering if store data in future? how know maximum limit of data can stored in database? unsigned int largest value 4,294,967,295 unsigned bigint largest value 18,446,744,073,709,551,615 reference: http://dev.mysql.com/doc/refman/5.7/en/numeric-types.html

ASP.net make Buttons set GridView Visible property to True or False -

i have asp.net web page has 2 gridviews. have 2 buttons want able click 1 make 1 gridview visible , other hidden, , other button make first gridview hidden , 2nd gridview visible. when click either of them nothing happens. i've played around gridview visible settings w/ no luck.i'm sure simple. looking! code below: the 2 gridviews: <asp:gridview id="gridshowusers" runat="server" autogeneratecolumns="false" datakeynames="user_id" datasourceid="sqldatasource1" allowpaging="true"> <columns> <asp:commandfield showdeletebutton="true" showeditbutton="true" /> <asp:boundfield datafield="user_id" headertext="user id" insertvisible="false" readonly="true" sortexpression="user_id" /> <asp:boundfield datafield="user_name" headertext="username" sortexpression=...

Parse out a URL with regex operation in python -

i have data follows, data url http://hostname.com/part1/part2/part3/a+b+c+d http://m.hostname.com/part3.html?nk!e+f+g+h&_junk http://hostname.com/as/ck$st=f+g+h+k+i/ http://www.hostname.com/p-l-k?wod=q+w+e+r+t africa i want check first + symbol in url , move backward until find special character such / or ? or = or other special character , start , go on until find space or end of line or & or /.my output should be, parsed abcd efgh fghki qwert my aim find first + in url , go until find special character , go front until find end of line or space or & symbol. i new regex , still learning , since bit complex, finding difficult write. can me in writing regex in python, parse out these? thanks here expression works sample use cases: >>> import re >>> >>> l = [ ... "http://hostname.com/part1/part2/part3/a+b+c+d", ... "http://m.hostname.com/part3.html?nk!e+f+g+h&_junk", ... "http://h...

java - Unmarshall JSON to subtypes with different field type jackson -

i receive json array of objects have field content , type of field may differ: [ { "id": "primarybodyheader", "type": "richtext", "content": "<h1>alice's adventures in wonderland</h1>" }, { "id": "1027", "type": "richtext", "content": { "value": "rvmtmtk=", "contenttype": "dynamiccontent" } } ] and have bean: public abstract class landingpagecontentitem { private string id; private string type; private string content; } at least want map content text field when text (null non-text content) at most, want map different kinds of items different subclasses according type of field content - textcontentitem, complexcontentitem or so. @jsonsubtypes can't this is there way without custom deserializer? ...

Using structures to find the GCD of a fraction (Simple C program) -

as title says, i'm making program find gcd of fraction. program has function find it, had run problems. i want function accept 2 structure variables (denominator , numerator) , returns gcd (integer) here's code: #include <stdio.h> struct fraction{ int numerator,denominator; }; int find_gcd(struct fraction s1, struct fraction s1); int main(void) { struct fraction d1; int gcd; d1.numerator= 20; d1.denominator= 100; printf("fraction: %d/%d\n",d1.numerator,d1.denominator); gcd= find_gcd(d1.numerator, d1.denominator); printf("in lowest terms: %d/%d",d1.numerator/gcd,d1.denominator/gcd); } int find_gcd(struct fraction s1, struct fraction s1) { int remainder=0; while (s1.denominator !=0) { remainder = s1.numerator/s1.denominator; s1.numerator= s1.denominator; s1.denominator= remainder; } return s1.numerator; //this gcd } i following errors: gcd_structure...

R - calculating the average value of a dataframe column from the top row to bottom row -

the title may not clear, since difficult summarize problem in few words, although don't think problem difficult solve. explain problem, let me share dataframe reference: head(df, n = 10) team score 1 10 2 4 3 10 4 16 5 20 6 b 5 7 b 11 8 b 8 9 b 16 10 b 5 i'd add third column, calculates average score each team, average score updating go down rows each team, , resetting @ new team. example, output column hoping this: head(df, n = 10) team score avg_score 1 10 10 2 4 7 3 10 8 4 16 10 5 20 12 6 b 5 5 7 b 11 8 8 b 8 8 9 b 16 10 10 b 5...

Reading multiple files and extracting 1st column using scala -

i starting learn scala , got simple problem. used doing using unix command line bash , awk decided use scala learning. i want parse multiple text file tab separated , want extract 1 or arbitrary column. i want remove lines start "#" able do. the code below print first row specific column each file. how print rows? import scala.io.source if (args.length > 0){ (arg<-args){ val file= source.fromfile(arg).getlines.filter(s => !(s contains "#")).mkstring("\n").split("\t") println(file(2)) } } else console.err.println("please enter filename") thank you calling mkstring("\n") on getlines result in single string of entire file , reason seeing output first row alone. the following code snippet should working: if (args.length > 0) { (arg <- args) { println(source.fromfile(arg).getlines().filternot(_.trim.startswith("#")).map(_.split("\t...

ASP.NET Core Environment variables not being used when debugging through a Service Fabric project -

when creating asp.net core app environment variable called aspnetcore_environment=development set , when debugging see ihostingenvironment set development . the problem when use same project in solution set service fabric environment variables don't seem injected , ihostingenvironment returns "production". how can resolve this? note: i've set breakpoint in startup class observe ihostingenvironment variable. reference answer: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-manage-multiple-environment-app-configuration i ran same issue default template. following similar duncan's answer 2 important differences: 1) not have change template code within service, , 2) ihostingenvironment set. first, add aspnetcore_environment variable <codepackage> element of packageroot\servicemanifest.xml file of application service: <codepackage name="code" version="1.0.0"> <entrypoint> ...

javascript - JQgrid FreezeColumn not freezing headers? -

i new jqgrid , have been attempting freeze first column in grid horizontal scrolling not effect column. i have frozen: true in colmodel , calling jquery("#grid").jqgrid('setfrozencolumns'); . this correctly freezes column data, scroll right, column headers scroll me. how can freeze headers too? thank much! sample code: jquery("#taskgrid").jqgrid({ datatype: "jsonstring", colnames:['task id','task name', 'role info'], colmodel:[ {name:'taskid',index:'taskid', width:100, frozen: true}, {name:'taskname',index:'taskname', width:200}, {name: 'roleinfo.1', index: 'roleinfo.1', width:100, formatter: 'checkbox' } ], jsonreader: {repeatitems: false}, datastr: json.parse(document.form.taskdata.value), rownum:50, pager: '#pager2', sortname: 'taskid', viewrecords: true, sortorder: "desc", caption:"json example", height...

C++11 equivalent to Python's all() function -

is there equivalent function python's all() built-in function? in other words: c++11 function exist returns true when of elements of iterable meet condition , false otherwise? check out std::all_of in <algorithm> header. can pass custom predicate evaluates true or false on each element.

angular - TypeError: undefined is not a constructor (evaluating 'new viewClass()') -

Image
i using nativescript-intro-slides library, followed angular example mentioned facing error: class listcomponent - inline template:1:8 original exception: typeerror: undefined not constructor (evaluating 'new viewclass()') original stacktrace: createandattach@file:///app/tns_modules/nativescript-angular/view-util.js:90:33 my code: import {component,elementref, oninit, viewchild} "@angular/core"; import {registerelement} "nativescript-angular/element-registry"; registerelement("slide", () => require("nativescript-intro-slides").slide); registerelement("slidecontainer", () => require("nativescript-intro-slides").slidecontainer); @component({ moduleid: module.id, selector: "list-page", template: ` <slidecontainer angular="true" #slides> <slide *ngfor="let img of images"> <label [text]="img.title"...

UNC Path for calendar .gif jquery date picker -

i need able put unc path calendar picture here have , it's not work have used http path , works fine not unc? please? $('.datefield').datepicker({ showon: "button" buttonimage: "\\10.1.93.95\symforms\moprogramming\mo_css\images\calendar.gif", buttonimageonly: true });

ruby on rails - How to DRY up this RSpec controller spec? -

how can dry spec up? describe api::taskscontroller, type: :controller 'allows creator of task destroy it' set_request_auth_header @user delete :destroy, id: @task.id expect(response).to be_success expect(task.count).to eq 0 end 'does not allow assignee of task destroy it' set_request_auth_header @assignee delete :destroy, id: @task.id expect(response).to be_forbidden expect(task.count).to eq 1 end 'does not allow unrelated task destroy it' set_request_auth_header @spy delete :destroy, id: @task.id expect(response).to be_forbidden expect(task.count).to eq 1 end end you extract methods: describe api::taskscontroller, type: :controller 'allows creator of task destroy it' expect_delete_to_succeed @user end 'does not allow assignee of task destroy it' expect_delete_to_be_forbidden @assignee end 'does not allow unrelated task destroy it' expec...

c# - Financial Charting Toolkit with support for WPF? -

i working on stockchartx component produced modulus global, it's great tool unfortunately still quite complicated enhance, add , modify of component custom behavior. have been looking while now, couldn't find powerful enough. can 1 please tell me best financial charting tool support wpf? try use oxyplot... has lot of different modes

sql - Why does my LIKE filter only match on one value? -

Image
i have this excel file giving me unexpected results on sql query join on like criteria. here sql statement: select co.materials, co.sizes, co.tools, ir.pn, ir.bodyjaw `crossjoin$` co left join `inserts$` ir on co.tools=ir.tool , ((ir.material '%'+co.materials+'%')) , ((ir.size '%'+co.sizes+'%')) and issue is, criteria ir.material only match on 1 value "333". can't figure out. here's visual explanation of what's happening (in case don't want download file): the other 2 filters work fine, separately or in combination, , matches come expected. it's material field giving me heartburn. if delete other 2 filters out of sql statement, still matches on records material "333" , if delete material left table, no matches @ all. does know cause behavior? sanity check, tried vlookup in excel on these tables , matched material without problem, data right , match. it's interes...

javascript - How do I retrieve text from an embedded script using casperjs? -

the html element is <script> window.sawxmlislandidclientstatexml="<nqw xmlns:saw=\x22com.siebel.analytics.web/report/v1.1\x22 xmlns:xsi=\x22http://www.w3.org/2001/xmlschema-instance\x22 xmlns:sawst=\x22com.siebel.analytics.web/state/v1\x22>\u003csawst:clientstate>\u003csawst:stateref>\u003csawst:envstate xmlns:sawst=\"com.siebel.analytics.web/state/v1\" xmlns:xsi=\"http://www.w3.org/2001/xmlschema-instance\" xmlversion=\"200811100\">\u003csawst:container cid=\"d:dashboard\" xsi:type=\"sawst:toplevelstatecontainer\">\u003csawst:container cid=\"p:mco0pb0nob7sqjvg\" xsi:type=\"sawst:page\">\u003csawst:container cid=\"s:42263r43nih80fd1\" xsi:type=\"sawst:section\" rendered=\"true\">\u003csawst:container cid=\"g:c452lvndqssjqa45\" xsi:type=\"sawst:dashprompt\" links=\"-\" promptautocompletestate=\"off\"/>\u00...

Curl only works in terminal not in php -

just simple script curl website take data hobby project. in terminal works php doesnt work @ all. think has cookies $ch = curl_init(); curl_setopt($ch, curlopt_url, "http://www.pokemongomap.info/includes/mapdata.php"); curl_setopt($ch,curlopt_post, true); curl_setopt($ch,curlopt_returntransfer, true); curl_setopt($ch,curlopt_postfields, 'fromlat=52.352772543694165&tolat=52.353516320168715&fromlng=6.672205448722025&tolng=6.6761080628386935&fpoke=1&fgym=1'); curl_setopt($ch,curlopt_httpheader, array( 'pragma: no-cache', 'origin: http://www.pokemongomap.info', 'accept-encoding: gzip, deflate', 'accept-language: nl-nl,nl;q=0.8,en-us;q=0.6,en;q=0.4', 'user-agent: mozilla/5.0 (macintosh; intel mac os x 10_11_4) applewebkit/537.36 (khtml, gecko) chrome/52.0.2743.116 safari/537.36', 'content-typ...

if statement - How to write an IF formular or multiple conditions in an Excel -

Image
how use if have cell j188:j655 has either yes or no want formular return yes on ''no"just after each yes not ''no". thank you. 3157802 sp n 3157801 sp n 3157800 sp n 3157799 sp n 3157798 sp n 3157796 sp n 3157797 sp n 3157795 sp n 3157794 sp n 3157791 sp n 3157790 sp y 3157789 sp n 3157787 sp n 3157788 sp y 3157786 sp n 3157784 sp n 3157785 sp n 3157783 sp n 3157779 cb y 3157782 d1 n in k188 put: =if(and(j187="y",j188="n"),"y","n") and copy down.

Using 'self' in class extension functions in Swift -

i'm looking able pull out instance of uiview subclass nib. i'd able call mycustomview.instantiatefromnib() , have instance of mycustomview. i'm ready port working objective-c code have via bridging header, figured i'd try idiomatic approach first. 2 hours ago. extension uiview { class func instantiatefromnib() -> self? { let toplevelobjects = nsbundle.mainbundle().loadnibnamed("customviews", owner: nil, options: nil) toplevelobject in toplevelobjects { if (toplevelobject self) { return toplevelobject } } return nil } } now if (toplevelobject self) { wrong because "expected type after 'is'". i've tried after shows lot don't understand swift type system. if (toplevelobject self) { if (toplevelobject self.dynamictype) { if (toplevelobject self.self) { a million other variations not wrong . any insight appreciated. using appr...

ssl - How can a java proxy handle "https" requests to multiple hosts? -

i trying make proxy server in java , able make working proxy handles http requests properly. after searching lot able extend program https requests following answer similar question: https://stackoverflow.com/a/9389125/5309299 here's code after tcp connection established between client , proxy: string request = ""; byte[] requestbytearr; //read complete request while(true){ string requestline = bufferedreaderfromclient.readline() + "\r\n"; if (requestline.trim().length()==0 && !request.equals("")){ request+=requestline; requestbytearr = request.getbytes(); system.out.println(request); break; } else { request+=requestline; } } string hostname = gethostfromrequest(request); int remoteport = getremoteportfromrequest(request); if (request.startswith("connect")){ //establish connection between host , proxy final socket hostsocket = new socket(hostname, remoteport); ...

elasticsearch - elastic search select only distinct with max field value -

i have documents contain version number: { "original_id" : "1234", "version" : 1 } { "original_id" : "1234", "version" : 2 } { "original_id" : "4567", "version" : 1 } i need select documents distinct id's , max version number. final result should be: [ { "original_id": 1234, "version" : 2 }, { "original_id" : 4567, "version" : 1 } ] i confused documentation -- should using aggs? did, still of them. want top version in sql: select distinct(original_id) id, max(version) version docs grouping id; here current query: { "from" : 0, "size" : 25, "sort": [{ "version": { "order": "desc", "mode": "max" } }], "query": { ...

Modify Virtual disk size using VI Java API -

i'm trying clone vm, , want change disk capacity. int virtualdiskscount = 0; virtualdisk virtualdisk = null; (virtualdevice virtualdevice : virtualhardware.getdevice()) { if (virtualdevice instanceof virtualdisk) { virtualdiskscount++; virtualdisk = (virtualdisk) virtualdevice; } } if (virtualdiskscount == 1) { virtualdeviceconfigspec discspec = new virtualdeviceconfigspec(); discspec.setoperation(virtualdeviceconfigspecoperation.edit); virtualdisk.setcapacityinbytes(155500000000l); virtualdisk.setcapacityinkb(155500000000000000l); discspec.setdevice(virtualdisk); return discspec; } the code throws exception : invalid operation device '0'. passed these parameters in clonevm_task , in reconfigurevm_task, same errors happens how can change virtual disk capacity? using vsphere 5.5 i don't code in java, it's close enough c# me help. fir...