Posts

Showing posts from March, 2011

http - How to call web service to achieve login system in Android? -

i have xml project. login sample code http://10.99.99.99:8087/item/services/itemservice <soapenv:header/> <soapenv:body> <ser:userlogin> <!--optional:--> <arg0>admin</arg0> <!--optional:--> <arg1>admin</arg1> </ser:userlogin> </soapenv:body> </soapenv:envelope> if succeed <soap:body> <ns2:userloginresponse xmlns:ns2="http://services.ws.item/"> <return> <result>1</result> <msg>login succeed</msg> </return> </ns2:userloginresponse> </soap:body> </soap:envelope> if not succeed <soap:body> <ns2:userloginresponse xmlns:ns2="http://services.ws.item/"> <return> <result>-1</result> <msg>login failed</msg> </return>...

schema - What is a better design for storing user preference in Google App Engine? -

i have object model in google app engine class userpref(ndb.model): user_id = ndb.keyproperty(kind='user') setting_a = ndb.booleanproperty(default=true) setting_b = ndb.booleanproperty(default=true) setting_c = ndb.booleanproperty(default=true) recently have rename attribute , prompts me thinking better design: a) use 3 rows capture 1 row of information in original design class userpref(ndb.model): user_id = ndb.keyproperty(kind='user') setting_name = ndb.stringproperty() setting_value = ndb.stringproperty() b) repeated property class userprefprop(ndb.model): setting_name = ndb.stringproperty() setting_value = ndb.stringproperty() class userpref(ndb.model): user_id = ndb.keyproperty(kind='user') prop = ndb.structuredproperty(userprefprop, repeated=true) what pro , cons these designs? search setting not important now, change in future in general, think way go unless have unholy number of preferences: class userp...

jquery - Django load model database values using ajax -

i working on side project using django framework. need direct page website when user clicks <div> area without refreshing page. searched around , found ajax should option. followed questions on stackoverflow didn't work. want is: user clicks div region, <div onclick=window.open("{{link}}");> link variable django/views; without refreshing page, if user clicks page again, direct link. link generated database , randomly selected after each click. my template using jquery/ajax: $(document).ready(function(){ $("#mydiv").on("click",function(){ $.ajax({ url:"http://127.0.0.1:8000/" success:function(){ window.open({{link}}); } } } } views.py def index(request): modellinks=model_link.objects.values_list('links',flat=true) link=random.choice(modellinks) return render(request,'myapp/index.ht...

How to run vagrant provision on every up? -

i need run vagrant provision on every vagrant up , possible? example, provision run on first vagrant up : config.vm.provision "shell", privileged: false, path: "provision.sh" what should specify run on vagrant up ? from vagrant 1.6, issue has been fixed/addressed can specify if want run specific provision on each can add :run => 'always' provisioning line as: config.vm.provision :shell, :run => 'always', :path => "provision.sh", :privileged => false the default value once

python - How to give custom name to images when downloading through scrapy -

this program download images through image pipeline. works , download images problem ** rename images in sha1 hash after unable identify them. can there solution can use **model_name of images download? import scrapy scrapy.contrib.spiders import crawlspider, rule scrapy.selector import selector scrapy.contrib.linkextractors.sgml import sgmllinkextractor selenium import webdriver urlparse import urljoin import time class compitem(scrapy.item): model_name = scrapy.field() images = scrapy.field() image_urls = scrapy.field() image_name = scrapy.field() class criticspider(crawlspider): name = "buysmaart_images" allowed_domains = ["http://buysmaart.com/"] start_urls = ["http://buysmaart.com/productdetails/550/samsung-galaxy-note-4", "http://buysmaart.com/productdetails/115/htc-one-m8-eye", "http://buysmaart.com/productdetails/506/oppo-n1", "http://buysmaart.com/productdetails/342/lg-g2-d802t...

sql - How can I join 2 different counts of the same table together? -

the table i'm working on records of answers amount of questions. want find out percentage of people said 'yes, definitely' provider 23 in question 470,477,479,481,483. tried count total number of answers , 'yes, definitely' answers. can them separately fail join them in 1 table. one query total counts of records in table surveyanswerfact. select surveyquestionkey, count(1) [warehouse].[dbo].[surveyanswerfact] ([providerkey] = 23) , ([surveyquestionkey] in (470,477,479,481,483)) , ([response] = 'yes, definitely') , ([responsedatekey] between 20140601 , 20150531) group surveyquestionkey results: 470 44 477 40 479 43 481 43 483 44 another query counts of answers 'yes, definitely' select surveyquestionkey, count(1) [warehouse].[dbo].[surveyanswerfact] (providerkey = 23) , (surveyquestionkey in (470,477,479,481,483)) , ([responsedatekey] between 20140601 , 20150531) group surveyquestionkey results: 470 43 477 ...

python - How to create multiple copies of rows by multiplication in pandas? -

i have file several columns, 1 of attribute called count. indicates there multiple counts of same score. i want multiply number of rows representative of number found in column count. i tried using dataframe.mul multiplied count values , returned nan string values. what function should call accomplish goal? e.g. "survey" list question description option count c3 2o15 survey rate hotel & accomodations fair 2 should transformed to: "survey" list question description option count c3 2o15 survey rate hotel & accomodations fair 2 c3 2o15 survey rate hotel & accomodations fair 2 this flawed previous attempt import pandas pd data = pd.read_excel('/users/dheepan.ramanan/documents/c3data/structureddata.xlsx') main = pd.dataframe(data) multiplier = pd.dataframe(data['count']) main.mul(multiplier) count description list option question "survey" 0 12...

c++ - How to use fftw library in Qt -

this question has answer here: adding external library qt creator project 7 answers i have simple question regarding use of external library in qt, , in particular fftw. working on project in whice need build gui. working qt creator first time , pretty novice porgrammer. i need preform fft in program , have found fftw library useful matter. how can make use of library in qt? know porbably have nothing program , more c++ language , compiling , linking, basicly in dark on subject. i failed find detailed enough answer , can make progress on project without use of library. please help. when want use external library in c/c++ first of have find 1 ore more *.h files should have been shipped library, .h files describe compiler found inside library. have #include correct .h file in code , tell compiler find (in folder). in case should have line @ top of prog...

javascript - Unable to add enable the scayt in toolbar in CKEditor -

my config.js follow ckeditor.editorconfig = function( config ) { // define changes default configuration here. // complete reference see: // http://docs.ckeditor.com/#!/api/ckeditor.config config.height='10em'; // toolbar groups arrangement, optimized single toolbar row. config.toolbargroups = [ { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }, { name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] }, { name: 'forms' }, { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] }, /*{ name: 'links' },*/ { name: 'insert' }, ...

Lua multiple assignment with tables -

this code: function foo() return 1, 2, 3 end bar = {} bar = {a, b, c = foo()} produces: bar.a = nil bar.b = nil bar.c = 1 how can written get: bar.a = 1 bar.b = 2 bar.c = 3 without having write this: function foo() return 1, 2, 3 end bar = {} a, b, c = foo() bar = {a = a, b = b, c = c} bar = {} bar.a, bar.b, bar.c = foo()

objective c - Converting image to NSData & back is nil -

when do uiimage *photo = [uiimage imagenamed:@"sample_thumbnail.png"]; self.thumbnail.image = photo; i see thumbnail, png , fine. when convert nsdata & doing: uiimage *photo = [uiimage imagenamed:@"sample_thumbnail.png"]; nsdata *data = uiimagepngrepresentation(photo); self.photodata = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; self.thumbnail.image = [uiimage imagewithdata:[self.photodata datausingencoding:nsutf8stringencoding]]; self.photodata nil. why happening? i think problem way create image nsdata instance. give try 1 instead: uiimage *photo = [uiimage imagenamed:@"sample_thumbnail.png"]; nsdata *data = uiimagepngrepresentation(photo); uiimage *image = [uiimage imagewithdata:data]; __update__ below excerpt this post - (nsstring *)imagetonsstring:(uiimage *)image { nsdata *imagedata = uiimagepngrepresentation(image); return [imagedata base64encodedstringwithoptions:nsdatabase64encod...

angularjs - Access local scope variable inside template as a variable instead of string -

i'm creating directive have scope(local) variable type , value should return appropriate template. choosetemplatebytype returns string appropriate template based on type text_field example. template: choosetemplatebytype(type) the question how access variable type of local scope can pass value function choosetemplatebytype the best way achieve pass type variable directive via attribute. html <my-directive type="foo"></my-directive> js myapp.directive('mydirective', function() { return { template: function(elem, attr){ return "<h1>" + attr.type + "</h1>"; // output <h1>foo</h1> } }; }); or myapp.directive('mydirective', function() { return { templateurl: function(elem, attr){ return attr.type + '.html'; // load foo.html } }; });

python - pandas: float_format and decimal sign not working properly -

i trying write pandas dataframe df csv-file using pandas' to_csv method following line: df.to_csv(f, index=false, header=false, decimal=',', sep=' ', float_format='%.3f') which gives csv-file following: 295.998 292.500 293.000 293.000 295.998 292.500 293.000 293.000 295.998 292.500 293.000 293.000 so float_format option works pretty well, numbers have 3 decimal digits. however, decimal option ( decimal = ',' ) not seem work, since decimal sign dot , not comma. what interested following: 295,998 292,500 293,000 293,000 295,998 292,500 293,000 293,000 295,998 292,500 293,000 293,000 how can convience pandas use 3 decimal digits , desired comma decimal sign? this behaviour bug in pandas version 0.15.2 since works fine after updating version 0.16.2 using following command: sudo pip3 install -u pandas which checked by import pandas pd pd.__version__ giving '0.16.2' by using commands provided in question r...

Using explicit RDF Property -

i'm not sure how interpret semantics of following rdf triples. interpreting them correctly? example a subject - predicate - object tom - age - 24 i read predicate age has value 24. seems unintuitive. however, can read 24 related tom predicate age makes better semantic sense me. example b subject - predicate - object tom - hasproperty - age age - hasvalue - 24 this conveys age property of tom. value of property 24. makes explicit how age relates tom. in 1 example, age predicate, in other example, object. in both cases information encoded more or less same addition of explicit property in example b. yes, interpreting them correctly. both examples encode same information (namely age of tom 24). in first example, done via direct binary relation. rewritten in first-order predicate logic reads: age(tom, 24) in second example, relation has been reified object, , reads hasproperty(tom, age) hasvalue(age, 24) ...

node.js - Node js Error in Openshift -

i have developed project using loopback. trying deploy openshift. using openshift-cartridge-strongloop. when creating application openshift. during installation shows remote: npm err! peerinvalid package chai not satisfy siblings' peerdependencies requirements! remote: npm err! peerinvalid peer chai-json-schema@1.0.10 wants chai@>= 1.6.1 < 2 remote: npm err! peerinvalid peer chai-fs@0.0.3 wants chai@>= 1.6.1 < 2 after deploying running at http://even3co-codisl.rhcloud.com/explorer/ but in rhc tail getting error bellow. wrong it? npm err! system linux 2.6.32-504.16.2.el6.x86_64 npm err! command "/var/lib/openshift/55bf03dc7628e1eadc000089/strongloop//bin/node/node" "/var/lib/openshift/55bf03dc7628e1eadc000089/strongloop/bin/node/npm" "start" "-d" npm err! cwd /var/lib/openshift/55bf03dc7628e1eadc000089/app-root/runtime/repo npm err! node -v v0.10.30 npm err! npm -v 1.4.21 npm err! code elifecy...

ruby on rails - Get specific item from object -

i'm attempting return specific hospital name associated patient keep getting errors. models: hospital has_many :patients patients belong_to :hospital when rendering page call controller: def list_patients @patients = patient.all end in view print out each patient , information: <% @patients.each |patient| %> <table> <tr> <td><%= patient.first_name + "," + patient.last_name %></td> <td><%= patient.ssn %></td> <td><%= patient.dob %></td> <td><%= patient.hospital.name%></td> </tr> </table> the above returns "undefined method name". if remove name can see object (<hospital:0x007fa1d9530138>) returned, i'm unable access specific attributes within object. i can return specific hospital id, if like: patient.hospital_id but stuck on how hospital name. is code equal pasted one? ...

php - Error with file upload as base64 encoded string -

i want receive image android device, sending image base64 encoded string. controller action code: public function upload() { if ($this->request->is('post')) { $dir= app.'outsidefiles'; //chane directory cloud $fill = $this->request->data['file'] ; $data = base64_decode($fill); $im = imagecreatefromstring($data); if ($im !== false) { $nam ='mypic.png'; move_uploaded_file($im['tmp_name'],$dir.ds.time().$nam); } //$dir= app . 'outsidefiles'; // $this->request->data['grade']['fila']= $file; $this->grade->create(); if ($this->grade->save($this->request->data)) { $return = array( 'response' =>'1', 'body' => 'data saved'); return new cakeresponse(array('body' =...

qt - QGLWidget renders text at incorrect depth -

i use render text in qglwidget qglwidget::rendertext(x, y, z, text, font) the string rendered @ depth of ~0.5 (obtained via glreadpixel()). however, in case should closer ~0.9. when convert x,y,z coords screen coords current matrices find result of ~0.9. why such difference? makes text appear in front. i created simple qt project in visual studio reproduce issue. draws green square text in front , behind square. both text in front of square. , depth of pixel can read hovering mouse. i use qt version 5.5 built 64bit platform. myglwidget.h #include <qglwidget> #include <qmouseevent> class myglwidget : public qglwidget { q_object private: float _depth; public: myglwidget(qwidget * parent = 0); virtual ~myglwidget(); virtual void initializegl(); virtual void paintgl(); void mousemoveevent(qmouseevent * event); signals: void depthread(float); }; myglwidget.cpp #include "myglwidget.h" #include <gl/glu.h> #i...

android - Two toolbars are visible in my fragment -

i have been working on navigation drawer using toolbar , while clicking on drawer items , respective fragments displayed,but here problem,when ever clicking drawer items , fragments 2 toolbars displayed.please help. fragment.xml <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="archerpenny.impdrawerfragment.blankfragment"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <include android:id="@+id/toolbar" layout="@layout/toolbar" /> <!-- todo: update blank fragment layout --> <textview android:layout_width="match_parent" android:layout_height...

ssl - Linphone Android: TLS Handshake Error with Self Signed Certificate -

i'm trying use self-signed certificate configure tls in linphone android able communicate freeswitch sip server. ssl handshake fails following errors: channel [0x9ec3c000]: ssl handshake failed : x509 - certificate verification failed, e.g. crl, ca or signature check failed cannot connect [tls://52.3.207.224:5061] can please suggest what's way forward debug issue? or how can configure self-signed certificate in linphone android. note: don't want disable tls server certificate verification suggested below [sip] verify_server_certs=0 it because self-signed cert can not recognized third-party cas official linphone app pre-configured. linphone uses it's own root ca store list server-cert going verified used linphone when received cert sip server. if don't want disable server cert verification (it's avoid man-in-the-middle attack), , since there no ca linphone pre-configured can verify cert, you must create own ca , add linphone's ca list...

DART fails in Chrome 44 -

i installed new chrome 44 , dart application stopped working (it worked in chrome 43). see in developer console: uncaught typeerror: this.shadowroot.getelementsbytagname not function mypage.html:5884 uncaught typeerror: this.shadowroot.getelementsbytagname not function mypage.html:6389 uncaught typeerror: this.shadowroot.getelementsbytagname not function mypage.html:7770 uncaught typeerror: this.shadowroot.getelementsbytagname not function mypage.html:11479 uncaught typeerror: this.shadowroot.getelementsbytagname not function mypage.html:11918 uncaught typeerror: this.shadowroot.getelementsbytagname not function mypage.html:12486 uncaught typeerror: this.shadowroot.getelementsbytagname not function mypage.html:12811 uncaught typeerror: this.shadowroot.getelementsbytagname not function mypage.html:13079 uncaught typeerror: this.shadowroot.getelementsbytagname not function mypage.html:13697 uncaught typeerror: this.shadowroot.getelementsbytagname not function my suspicion bug int...

Max-Length for multiple text areas using php and Javascript -

Image
i trying display number of characters left in multiple text areas. although have different id's text areas, max length prompted 2nd text area , not first. code shown below <textarea id="txtbox"></textarea> <input type="text" id="counterbox"/> <script> var txtboxref = document.queryselector("#txtbox"); var counterref = document.queryselector("#counterbox"); txtboxref.addeventlistener("keydown",function(){ var remlength = 0; remlength = 160 - parseint(txtboxref.value.length); if(remlength < 0) { txtboxref.value = txtboxref.value.substring(0, 160); return false; } counterref.value = remlength + " characters remaining..."; },true); </script> <textarea id="txtbox1"></textarea> <i...

java - Extract BLOB polygon from MySQL database? -

i developing web application stores polygons in database using jsf. able store polygon in field of row using polygon datatype in mysql , polygon appears blob in database. however unsure on how access polygon in each row using row-sets in jdbc. ideally convert data polygon blob latlng array . i aware can returned wkt using mysql (select * st_astext(markers) paddock) but i'm unsure how access in java. if has ideas, please feel free share, thank you. i have found answer question. used above mysql statement returns string value , used java regular expression in order extract coordinates polygon polygon = new polygon(); string value = rs.getstring(1); string valuereal = value.replaceall("[^0-9 .,]+", ""); arraylist<string> mylist = new arraylist<string>(arrays.aslist(valuereal.split(","))); the regular expression above allows numbers, dot...

hibernate - How to map one to many relationship with itself -

i have table called territory has id, name, id_parent_territory in it. in 1 many territory_with_subterritories. both columns in territory_with_subterritories self foreign key territory(self references). stores rows this: territory: id name id_parent_territory --- ------ --------------------- 1 india null 2 karnataka 1 3 bangalore 2 territory_with_subterritories: id_parent_territory id_subterritory --------------------- ------------------ 1 2 2 3 i'm not able save data territory_with_subterritories when data saved territory. the join table i've written is: @onetomany(fetch = fetchtype.lazy, targetentity = territorydataimpl.class) @jointable(name = "territory_with_subterritories", joincolumns = @joincolumn(name = "id_subterritory"), inversejoincolumns = @joincolumn(name = "id_parent_territory")) ...

cs50 - Expression result unused — what's wrong with my C code? -

i making program runs "greedy" algorithm — 1 asks input value of change owed , returns minimum amount of coins required return change while using few coins possible. coins can used quarter, dime, nickel , penny. please take @ code , tell me how fix error being displayed. #include <stdio.h> #include <cs50.h> #include <math.h> int main(void) { float change; int counter; counter = 0; { printf("please imput how change owed: "); change = getfloat(); } while (change<=0); int centv; { centv = round(change*100); } int quarter, dime, nickel, penny; quarter= 25; dime= 10; nickel= 5; penny= 1; { while( centv>=quarter ) { (centv-25); counter++; } while( centv>=dime ) { (centv-10); counter++; } ...

Pyspark integration into Pycharm -

i'm bit lost on how confiure pycharm can directly run scripts within pyspark. i'm using pyspark ontop of elasticsearch cluster , using following code run script. it's running default python interpreter tried configure pyspark shell interpreter, didn't work error it's not valid sdk: __author__ = 'lucas' pyspark import sparkcontext, sparkconf if __name__ == "__main__": conf = sparkconf().setappname("estest") sc = sparkcontext(conf=conf) es_read_conf = { "es.nodes" : "localhost", "es.port" : "9200", "es.resource" : "titanic/passenger" } es_rdd = sc.newapihadooprdd( inputformatclass="org.elasticsearch.hadoop.mr.esinputformat", keyclass="org.apache.hadoop.io.nullwritable", valueclass="org.elasticsearch.hadoop.mr.linkedmapwritable", conf=es_read_conf) es_write_conf ...

web - Unable to create URL with wampserver [Resolved] -

i trying create url site hosted through wampserver, no matter unable url work. site online because able connect through servers ip address, though. (i should mention site available on intranet) hosts file: # copyright (c) 1993-2009 microsoft corp. # # sample hosts file used microsoft tcp/ip windows. # # file contains mappings of ip addresses host names. each # entry should kept on individual line. ip address should # placed in first column followed corresponding host name. # ip address , host name should separated @ least 1 # space. # # additionally, comments (such these) may inserted on individual # lines or following machine name denoted '#' symbol. # # example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution handled within dns itself. # 127.0.0.1 localhost # ::1 localhost 127.0.0.1 localhost 127.0.0.1 www.socialclub.com #also trie...

c - why does the compiler give a warning for unused function? -

i have written sample program understand working of functions in c. declared function in c , call during programs execution. compiler gives me warning saying unused function. code looks : #include <stdlib.h> #include <stdio.h> int test_function(x); int main(){ int x; char letter[] ={"haaa"}; char cmpre[] = {"ahd"}; int value; for(int i=0; i<4;i++) { if(letter[i] == cmpre[i]) { x=0; } } int test_function(x) { if (x==0) { printf("the letters same"); } return value; } printf("to check if letters same go function"); test_function(x); return 0; } the program seems execute fine warning in fourth line declared function in start of program. warning : multiple markers @ line - parameter names (without types) in function declaration [enabled default] - unused decla...

How to reverse each word in a text file with linux commands without changing order of words -

there's lots of questions indicating how reverse each word in sentence, , readily in python or javascript example, how can linux commands? looks tac might option, seems reverse lines words, rather words? other tools can this? literally have no idea. know rev , tac , awk seem contenders... so i'd go from: cat dog sleep pillow green blue to: tac god peels wollip neerg eulb **slight followup from this reference looks use awk break each field array of single characters , write loop reverse manually each word in way. quite awkward. surely there's better/more succinct way this? try on size: sed -e 's/\s+/ /g' -e 's/ /\n/g' < file.txt | rev | tr '\n' ' ' ; echo it collapses space , counts punctuation part of "words", looks (at least mostly) works. hooray sh !

Data change in realm android -

Image
in android app, persist workout object realm. in 1 of activities, create object code: realm.begintransaction(); workout w = realm.createobject(workout.class); w.setmworkoutid(uuid.randomuuid().tostring()); realm.committransaction(); here workout class: public class workout extends realmobject { private string mworkoutid; private int restsecsleft; private boolean prevsetover = true; private boolean workoutover = false; public workout() { } public string getmworkoutid() { return mworkoutid; } public void setmworkoutid(string mworkoutid) { this.mworkoutid = mworkoutid; } public int getrestsecsleft() { return restsecsleft; } public void setrestsecsleft(int restsecsleft) { this.restsecsleft = restsecsleft; } public boolean getprevsetover() { return prevsetover; } public void setprevsetover(boolean prevsetover) { this.prevsetover = prevsetover; } public boolean...

ftp - Connect to Implicit SSL/TLS (port 990) using Paramiko? -

is there way use paramiko, connect sharefile.com sftp? for example using approach, can connect sftp (the 1 created myself in linux): from paramiko import sshconfig, sshclient, autoaddpolicy, authenticationexception def connect(self): rec in self: closing(sshclient()) ssh: ssh.set_missing_host_key_policy(autoaddpolicy()) try: login = rec.login_id ssh.connect(login.host, port=login.port, username=login.user, password=login.passwd) except socket.gaierror: raise validationerror(_("name or service '%s' not known") % (login.host)) except authenticationexception: raise warning(_("bad username or password")) closing(ssh.open_sftp()) sftp: #do but if try connect using login info fileshare.com, not work. in fileshare.com says can connect 2 ways: security: standard (port 21) or implicit...

Fuzzy unit testing in Python -

i'd write set of "fuzzy" unit tests in python. far i've been using testtools , switching different framework fine. my test suite aiming test performance of image-processing algorithms. i'd able have tests report fuzzy pass states. in other words, results "good enough" might useful investigate. i have this: suite = unittest.testloader().loadtestsfromtestcase(testmyalgorithm) result = testtools.testresult() result.starttestrun() try: suite.run(result) finally: result.stoptestrun() i'd use information in result object generate report, looks of information associated passed tests has been tossed. i'm wondering if i'm abusing notion of unit test fit sort of investigation. is there standard way perform sort of testing in python? assuming goal here reporting, tool can generate detailed report in xml format (e.g. nosetests ; py.test has similar support), , process report want in second step.

java - Sequential search does not work as expected -

i have written program takes words user have entered, button press, , puts them in arraylist. there text field user can enter letter or word, user can search in arraylist button press. i'm using sequential search algorithm accomplish this, not work expect to; if searched word found, search function should return, , print out in textarea word found , in array found. works, first search. if word not found, function should print out word not found. works want to. the problem after searched 1 word, , displays in arraylist can found, nothing happens when press button after that, whether entered letter/word in array or not. it's string text gets stored isn't changing. don't understand why... here below custom class of search function , main class: public class search { static private int i; static string index; static boolean found = false; public static string sequencial (arraylist<string> list, string user) { (int = 0; < list.size(); i++)...

java - What does it mean when I see "Re-entry is not allowed"? -

i'm trying this. class extends b { injector injector = guice.createinjector(this); // ......statements... } it throwing illegalstateexception : re-entry not allowed com.google.inject.internal.util.$preconditions.checkstate(preconditions.java:142) @ com.google.inject.abstractmodule.configure(abstractmodule.java:55) @ com.google.inject.spi.elements$recordingbinder.install(elements.java:223) @ com.google.inject.spi.elements.getelements(elements.java:101) @ com.google.inject.internal.injectorshell$builder.build(injectorshell.java:133) @ com.google.inject.internal.internalinjectorcreator.build(internalinjectorcreator.java:103) @ com.google.inject.guice.createinjector(guice.java:95) @ com.google.inject.guice.createinjector(guice.java:72) @ com.google.inject.guice.createinjector(guice.java:62) why happening? the way happen if call guice.createinjector() on same module instance inside configure method . won't happen if ca...

R: Uniques (or dplyr distinct) + most recent date -

i have dataframe consisting of rows of information include repeats based on name different dates. i'd filter df 1 includes unique names, choose recent occurrence if given chance. big fan of dplyr , have used combinations of distinct , select before, documentation makes seem cannot done alone: "variables use when determining uniqueness. if there multiple rows given combination of inputs, first row preserved." this seems problem occur commonly, wondering if had advice. example df below, reflects real data has names character class , date posixct generated using lubridate package. structure(list(name = c("john", "john", "mary", "john", "mary", "chad"), date = structure(c(1430438400, 1433116800, 1335830400, 1422748800, 1435708800, 1427846400), tzone = "utc", class = c("posixct", "posixt"))), .names = c("name", "date"), row.names = c(na, -6l ), class = ...

web - How to make python webcrawler infinite and record link once -

with of thenewboston able create nice little web crawler in python. after watching videos played around , added couple of things it. i've tried make infinite in every link on every link every recorded, have failed in doing so. have problem of recording same link more once? how go fixing problem? this code. import requests bs4 import beautifulsoup def spider(max_pages): page = 1 while page <= max_pages: url = '' source_code = requests.get(url) plain_text = source_code.text soup = beautifulsoup(plain_text, "html.parser") link in soup.findall("a"): href = link.get("href") title = link.get("title") links = [] #print(href) #print(title) try: get_single_user_data(href) except: pass page += 1 def get_single_user_data(user_url): source_code = requests.get(u...

html - How to resize divs into another Div -

Image
i'm struggeling following working css (width resizing): i've 4 divs inside div. 2 of 2 divs, 1st , 3d, have text , of fixed size (we don't know in advance). 2 other divs, , b, should take each of them 50% of remaining space. ideally min. width, make boxes 2 , 3 go new line. is possible pure css ? if use calc() function maybe can. if can't it, can try flexbox less compatibility older browsers. .content { font-size: 0; } .content > * { font-size: 16px; } .fixed { width: 50px; } .a, .b, .c, .d { display: inline-block; vertical-align:top; } .b, .d { width: calc(50px - 50px - 50%); } this means .b, .d sizes .a - .c - 50% good luck

java - Apache CXF Client proxy settings -

i trying develop consumer soap service using tutorial @ http://cxf.apache.org/docs/developing-a-consumer.html in section ,"setting connection properties contexts" looking @ code below // set request context property. java.util.map<string, object> requestcontext = ((javax.xml.ws.bindingprovider)port).getrequestcontext(); requestcontext.put(contextpropertyname, propertyvalue); // invoke operation. port.someoperation(); can tell me if can set proxy server settings using requestcontext properties , how ?. code running behind proxy , need outgoings soap calls use proxy server settings. proxy setting set using httpconduit object helloservice hello = new helloservice(); helloporttype helloport = cliente.gethelloport(); org.apache.cxf.endpoint.client client = clientproxy.getclient(helloport); httpconduit http = (httpconduit) client.getconduit(); http.getclient().setproxyserver("proxy"); http.getclient().setproxyserverport(8080); http.getproxya...

Android EspressoTest match navigationDrawer item with position -

i want open navigation drawer , click specific position item code below. private void clickmenu(int position) { onview(withid(r.id.drawer_layout)) .perform(actionopendrawer()); ondata(is(instanceof(navdraweritem.class))) .inadapterview(withid(r.id.navigation_list)) .atposition(position).perform(viewactions.click()); } current shows no matches. android.support.test.espresso.nomatchingviewexception: no views in hierarchy found matching: id: com.trumpia.android.loyaltea.debug:id/navigation_list if target view not part of view hierarchy, may need use espresso.ondata load 1 of following adapterviews:android.widget.listview{3bb66aad vfed.vc. .f...... 0,0-720,1533 #7f0f008c app:id/navigation_drawer} - android.widget.listview{22585c25 gfed.vc. ......i. 0,0-0,0 #102000a android:id/list} or other error below caused by: java.lang.runtimeexception: action not performed because target view not match 1 or more of following constraints: (is a...