Posts

Showing posts from February, 2011

android - Changing a business object in an Adapter -

i'm building android app similar facebook (gets newsfeed stored in db rest api), , implementing reddit-like voting system, in every feed item has vote state (none, up, down) stored in db. when retrieve newsfeed json, set votestate vote state in json, display through newsfeed adapter. but if set votestate in newsfeed adapter value (based on onclicklistener), changed value not reach actual newsfeed. because every time scroll newsfeed, newsfeed adapter gets new instance of newsfeed, , doesn't care value changed. thus, i'm looking best way modify permanently newsfeed vote state newsfeed adapter (this can generalized variable assigned arraylist , displayed through arraylistadapter). if have suggestions, please feel free respond. thank :) edit : public class newsfeedadapter extends recyclerview.adapter<newsfeedadapter.viewholder> { private newsfeed newsfeed; private feeditem item; public newsfeedadapter(..., newsfeed newsfeed) { ...; this.newsfee...

symfony - DomCrawler complex div nesting -

i'm having trouble trying data using dom crawler. want name 'avocado' , '£1.50' though i'd able $message = $crawler->filterxpath('h3')->text(); <div class="product"> <div class="productinner"> <div class="productinfowrapper"> <div class="productinfo"> <h3> <a href="http://website.com" > avocado <img src="pic.jpg" alt="" /> </a> </h3> </div> </div> <div class="pricingandtrolleyoptions"> <div class="pricing"> <p class="priceperunit"> £1.50<abbr title="per">/</abbr><abbr title="unit"><span class="priceperunitunit">unit</span></abbr> </p> <p class="pricepermeasure">£1.50<abbr title="per">/...

java - Assertions on many files with required pre-processing -

i have large set of files (>1000) on want running same set of assertions. assertions organized in logical groups, have broken them down more 30 @test methods in single class. in order run assertions want, need run before each file expensive pre-processing, , assertions run on results of pre-processing. as pre-processing required each @test method, want running executing once each file. i used @dataprovider following way: @contextconfiguration({ "classpath:/meta-inf/spring/ev-xml-test-context.xml" }) public class fantastictest extends abstracttestngspringcontexttests { private string[][] files = new string[][] { { "file1.xml" }, { "file2.xml" }, { "..." }, { "file1000.xml" } }; private map<string, object> preprocessingresults = new hashmap<>(); @beforeclass public void setup() throws exception { for(int i=0; i<files.length; i++...

html - Alignment in form-horizontal using bootstrap -

actually m new on bootstrap,i using form-horizontal creating layout responsive. code: <div class="panel-body"> <form class="form-horizontal" role="form"> <div class="form-group"> <div class="col-md-2"> <label for="" class="control-label">from:</label> <div id="date_dropdown" ></div> <div> <div class="col-md-2"> <label for="" class="control-label">to:</label> <div id="date_dropdown1" ></div> </div> <div class="col-md-2"> <label for="" class="control-label">dept:</label> <div id="dept_dropdown" ></div> </div> <div class="col-md-2"> <label fo...

How to call Oracle procedure have Userdefined "Type" IN parameters using jdbc in java -

this question has answer here: how call oracle stored procedure include user-defined type in java? 4 answers i have created below user defined type in oracle. using type in procedure in parameter. how call procedure using jdbc callablestatement. create or replace type "varchar_tab" table of varchar2(500); my procedure is: procedure delete_album_metadata ( p_catalog_tab in varchar_tab ); please me. you need use setplsqlindextable binder method defined in oracle.jdbc.oraclepreparedstatement. here pointer javadoc: https://docs.oracle.com/database/121/jajdb/oracle/jdbc/oraclepreparedstatement.html#setplsqlindextable_int__java_lang_object__int__int__int__int_

In Rails how to set two sets of routes to one resource? (Example Category for Photos and Albums) -

i have categories model shared both albums , photos. need use photo categories under /photos/categories , album categories under /albums/categories . how can this? i tried failed. first set routes : namespace :albums resources :categories end namespace :photos resources :categories, controller: 'photos/categories' end then in view printed category links : link_to category.name.titleize, photos_category_path(category) the links fine when visit them error : uninitialized constant photos what doing wrong here? thanks i think both categories controllers need defined in own namespace: # controllers/albums/categories_controller.rb module albums class categoriescontroller < applicationcontroller ... end end # controllers/photos/categories_controller.rb module photos class categoriescontroller < applicationcontroller ... end end

ruby - Error trying to start Rails Server -

i have issue rying start server on ruby on rails. c:\users\ogautier\ror\holamundo>rails server c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32/lib/nokogiri.rb:29:in `require': cannot load such file -- nokogiri/nokogiri (loaderror) c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32/lib/nokogiri.rb:29:in `rescue in <top (required)>' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32/lib/nokogiri.rb:25:in `<top (required)>' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.2/lib/loofah.rb:3 :in `require' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/loofah-2.0.2/lib/loofah.rb:3 :in `<top (required)>' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/lib/rails-html-sanitizer.rb:2:in `require' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/rails-html-sanitizer-1.0.2/lib/rails-html-sanitizer.rb:2:in `<top (required)>' c:/r...

How to manipulate a running software with python? -

Image
how can manipulate software while running using python? e.g: i open notepad on windows 7 without write word on it then make program in python receive string , when user click on send button write string notepad. if write "abc" python software , click on send button should result: is possible make python script manipulate memory , add string notepad? you can use windows scripting host send keys. works on python 2.7 import win32com.client shell = win32com.client.dispatch("wscript.shell") shell.run("notepad") shell.appactivate("notepad") shell.sendkeys("a") shell.sendkeys("b") shell.sendkeys("c") win32api.sleep(500) shell.sendkeys("d") you can fine more on this blog .

rdf - getting all dbpedia predicate list -

this question has answer here: sparql query class label namespace prefix defined 2 answers i trying dbpedia predicate (labels of property). check link http://dbpedia.org/page/akshay_kumar i wan get, dbpedia-owl:abstract dbpedia-owl:birthdate dcterms:subject dc:description rdfs:label owl:sameas foaf:givenname in short, properties on left column. not entity entire list. please see, properties can retrived using: select distinct ?property { ?instance <http://dbpedia.org/ontology/person> . ?instance ?property ?obj . } or select * { ?x rdf:property } but want prefix dbpedia-owl , dc , foaf , rdfs etc this based on modification of my answer sparql query class label namespace prefix defined . select distinct ?prettyname ?property { #-- distinct properties used on persons { select distinct ?property { [ dbpe...

c# - How can I save definitely the new location of a TableLayoutPanel after a drag and drop in a panel? -

i'm trying drag , drop tablelayoutpanel in panel using winforms/c#, drag , drop of tablelayoutpanel works how can save new location of tablelayoutpanel using button action ? solution please ? private void registration_load(object sender, eventargs e) { panel2.allowdrop = true; tablelayoutpanel1.allowdrop = true; panel2.dragenter += panel2_dragenter; panel2.dragdrop += panel2_dragdrop; tablelayoutpanel1.mousedown += tablelayoutpanel1_mousedown; } private void panel2_dragenter(object sender, drageventargs e) { if (e.data.getdatapresent(typeof(tablelayoutpanel))) e.effect = dragdropeffects.move; } private void panel2_dragdrop(object sender, drageventargs e) { var tlp = (tablelayoutpanel)e.data.getdata(typeof(tablelayoutpanel)); tlp.location = panel2.pointtoclient(new point(e.x, e.y)); tlp.parent = panel2; tlp.bringtofront(); } private void tablelayoutpanel1_mousedown(object sender, mouseeventargs e) { ta...

php - Validation for Add screen not working but it working in edit screen with same code -

i learning zend framework , have created add, update , delete functionality country name , continent name , working perfectly. have set validation by $name->setrequired('true'); and $continent->setrequired('true'); in form.php. validation working in edit form return error 'an error occurred' , 'application error' in add form. below controller code: for add: /*add record database*/ public function addaction() { $form =new application_form_add(); $form->submit->setlabel('add country'); $this->view->form = $form; if($this->getrequest()->ispost()) { $formdata = $this->getrequest()->getpost(); if($form->isvalid($formdata)) { $file = new application_model_country(); $name = $form->getvalue('name'); $continent = $form->g...

Spring Batch: JOIN Query in SqlPagingQueryProviderFactoryBean not working -

i using 2.2.7.release version of spring batch in project. have batch using jdbcpagingitemreader read records db2. in have join on 2 tables , have conditions. @ last providing column want sort records. because using table aliases, giving me error. when skipping alias name, give problem while fetching next set of result. searched , found issue got resolved in 2.1.9 release couldn't find fix in later releases. has idea issue , solution too. you can find code snippet of query configuration below. <bean id="releasesqlpagingqueryprovider" class="org.springframework.batch.item.database.support.sqlpagingqueryproviderfactorybean"> <property name="datasource" ref="datasource" /> <property name="selectclause" value="select m.* " /> <property name="fromclause" value="from master m join release r on m.employee_id = r.employee_id " /> <property name="whereclause" > ...

android - How to create circular marks/buttons and circular window -

let me try explain doing... i creating map marks on map, want change these marks circular buttons. when click, should open circular window on map options (map in background). is possible? if explanation not clear can paste code. appreciated! u can use outline object android l or u can set oval background image (f.e. define oval drawable file) here sample code: //outline int size = getresources().getdimensionpixelsize(r.dimen.fab_size); outline outline = new outline(); outline.setoval(0, 0, size, size); and code example oval drawable: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="#79bfea"/>

java - Message from Android to Android without Accesspoint -

i have 2 android-devices, have no ip-addresses mac-addresses d0:e7:82:fa:90:33 (a) 8c:bf:a6:a8:77:8f (b) how send byte a b ? possible? edit: droped datagramsocket-sources because packed-based. by way: wifi-direct or bluetooth not supported devices. you can use udp broadcast message. broadcast message , every device on networks gets it, sender. however, message delivery in udp not guaranteed, may drop. need handle on client side.

java - How to get the requested contenttype of a REST-Request? -

using jaxb implementing rest-webservice, have several methods producing output. the class contains of these methods annotated @produces({ mediatype.application_xml, mediatype.application_json }) . if request goes happy-path (no errors occur), return pojo's in our methods , jaxb dynamically marshalls these objects application/xml or application/json , client requested via accept: application/xxx; in request header. my question how requested content type, because if error occurs, throwing webapplicationexception response should contain custom error message formatted requested content type. you could... inject @headerparam("accept") public response dosomething(@headerparam("accept") string accept) { // may need parse value not // simple application/json } you could... inject httpheaders , have couple options public response dosomething(@context httpheaders headers) { string accept = headers.getheaderstring(httpheaders.accep...

javascript - ControllerProvider in UI-router results in error -

i have ui-router stateprovider , need pick between controllers & views based on external data, used templateprovider , controllerprovider . if had templateprovider works fine, when add controllerprovider error: error: [ng:areq] argument 'fn' not function, got object http://errors.angularjs.org/1.3.1/ng/areq?p0=fn&p1=not%20ananunction%2c%20got%object @ regex_string_regexp (http://localhost:48510/scripts/vendor/angular/1-angular.js:80:12) @ assertarg (http://localhost:48510/scripts/vendor/angular/1-angular.js:1577:11) @ assertargfn (http://localhost:48510/scripts/vendor/angular/1-angular.js:1587:3) @ annotate (http://localhost:48510/scripts/vendor/angular/1-angular.js:3417:5) @ invoke (http://localhost:48510/scripts/vendor/angular/1-angular.js:4096:21) @ object.instantiate (http://localhost:48510/scripts/vendor/angular/1-angular.js:4129:23) @ http://localhost:48510/scripts/vendor/angular/1-angular.js:8320:28 @ compile (http://l...

ruby - Uninitialized constant Version (NameError) when starting Rails server -

so had app working fine , had migrate on new development server. copied files over, ran bundle install no errors , when run rails server i error. => ctrl-c shutdown server exiting c:/sites/mysite/app/admin/version.rb:1:in <top (required)>': uninitialized con stant version (nameerror) c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 5.1/lib/active_admin/application.rb:190:inblock in load!' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 5.1/lib/active_admin/application.rb:190:in each' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 5.1/lib/active_admin/application.rb:190:inload!' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/activeadmin-0. 5.1/lib/active_admin/application.rb:213:in routes' c:inroutes' c:/sites/mysite/config/routes.rb:13:in `block in ' c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 .11/lib/action_dispatch/routing/route_set.rb:282:in instanc...

jquery - SmoothScroll not working with Table nav -

i have being trying anchor points smoothly scroll isn't working. have used script smoothscroll.js, failing work on site? have tried using many other script action work nothing working. ideas on getting smoothscroll work? thanks <head> <body> <main> <div class="main"> <div class="p1" id="p1"> <div id="p1a"> <a name="p1a"></a> </div> <div id="p1heading" <h1>uponauto</h1> </div> </div> <div class="p2" id="p2"> <div id="p2a"> <a name="p2a"></a> </div> <div id="p2holding"></div> ...

ios - HeaderFooterView of UITableView not stretching according to size class width -

Image
i have tableview custom header make nib file. the size class of nib file x any, width of header not stretch fit on iphone 6 & iphone 6plus. here's how make headerfooterview let headercell = uinib(nibname: "teamcheckheadertableviewcell", bundle: nil) tblteamcheck.registernib(headercell, forheaderfooterviewreuseidentifier: teamcheckheadertableviewcell.description()) in viewforheaderinsection func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview? { let headercell = tblteamcheck.dequeuereusableheaderfooterviewwithidentifier(teamcheckheadertableviewcell.description()) as! teamcheckheadertableviewcell return headercell } here's how looks on iphone 5 here's how looks on iphone 6 the same 6plus, seems width of headerfooterview constant 320 . try add headercell.layoutifneeded() func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview?

c# - WPF custom context menu (resource dictionary) -

i've created custom style context menu. have put 3 lines of code under each widget(textbox): <textbox.contextmenu> <contextmenu/> </textbox.contextmenu> why have ? tooltip style works without code. my context menu code: <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <color x:key="backgroundcolor" a="255" r="19" g="19" b="19"/> <bitmapimage x:key="bicut" urisource="images/cut.tif"/> <bitmapimage x:key="bicopy" urisource="images/copy.tif"/> <bitmapimage x:key="bipaste" urisource="images/paste.tif"/> <solidcolorbrush x:key="borderbrush" color="#ececec"/> <style targettype="contextmenu"> <setter propert...

Integrate MyBB with codeigniter -

i integrating mybb forum website developed in codeigniter. check model provided here https://github.com/bcit-ci/codeigniter-website/blob/master/application/models/mybb.php not getting how can start it. if download , installing mybb in our project , have script register user , other things if want register user mybb automatically when register website need write separate code?

ios - How do I retrieve an array of a custom subclass of PFObjects stored under the PFUser.currentUser() -

i'm struggling retrieving array of pfobjects stored on pfuser.currentuser() i have custom subclass of pfobject: unuser here's how save array of [unuser] called favoritedrivers: if let currentuser = pfuser.currentuser() { currentuser["favoritedrivers"] = favoritedrivers currentuser.saveinbackgroundwithblock({ (succes: bool, error: nserror?) -> void in if succes { } }) } if retrieve entry this: if let currentuser = pfuser.currentuser() { var objects = currentuser["favoritedrivers"] println(objects) shows in console (the array in trial has 1 entry): optional(("<unuser: 0x174138920, objectid: megjallla9, localid: (null)> {\n}")) what best way fetch referred pfobjects , store them in array of unuser? this tried: var relation = currentuser.relationforkey("favoritedrivers") relation.query()!.findobjectsinbackgroundwithblock{ ( objects: [anyobject]?, error: nserror?) -> void in if ...

parsing - Is This LL(1) grammar -

it's important me, please me. grammar ll(1)? s -> lab l -> d | ε -> da | ba b -> bb | ε can me ll(1) parsing table? right this? first(s) = {a,b,d} first(l) = {d} first(a) = {b,d} first(b) = {b} follow(s) = {$} follow(l) = {a,b,d} follow(a) = {b,$} follow(b) = {$} i used jflap tool on grammar. jflap not think grammar ll(1), can try , build parse table it. you experiment grammar in jflap make ll(1) conformant.

json - Store struct as string in redis -

as redis stores strings know how can equivalent of javascript's json.stringify using go convert struct string. i have tried typecasting: string(the_struct) but results in error. the encoding/json package can used convert struct json string , vice versa (parse json string struct ). simple example (try on go playground ): type person struct { name string age int } func main() { p := person{"bob", 23} // struct -> json data, err := json.marshal(&p) if err != nil { panic(err) } fmt.println(string(data)) // json -> json var p2 person err = json.unmarshal(data, &p2) if err != nil { panic(err) } fmt.printf("%+v", p2) } output: {"name":"bob","age":23} {name:bob age:23} notes: the fields of struct must exported (start them capital letter), else json package (which uses reflection) not able read/write them. you can sp...

What responsibilities are to comply C\C++ standard? -

little bit stupid question. example i've read, in c11 added support of threads. then, example gcc compiler stm32f4 said, supports c11 standard. so, mean now, without os i'll achieve threading support??? how can be? another example - g++ stm32 supports std::vectors, , works,even without os's memory management. mean memory manager inside compiler? or not? so, mean now, without os i'll achieve threading support??? it means language specified multi-threaded programs can written correctly, well-defined synchronisation when accessing shared data; , full hosted implementation should provide thread library. doesn't mean implementations allow multiple threads: depend on support underlying system. this mean memory manager inside compiler? yes, typically language run-time includes heap manager. assigned memory (either obtained os, or allocated in other system-dependent manner, perhaps static block when program starts), splits smaller lumps suppor...

c# - partially deploy Dacpack -

i have dacpac file, generated db or db project. dacpac contains of course tables, stored procedures, views, etc. i want create new db objects dacpac, not of them. have list of objects, tables in case. i want know of ignore dacpac objects, or create dacpac sub-group of objects, or maybe extract corresponding sql script of target objects. any advice on ? thanks you use the agilesqlclub sqlpackage deployment filter . here related blog post: https://the.agilesql.club/blogs/ed-elliott/howto-filter-dacpac-deployments

java - dependency (for sun.security.util) of SBT build -

i using sbt build scala project. have java code in project. when run build following error: error: package sun.security.util not exist [error] import sun.security.util.objectidentifier; i understand need declare dependency sun.security.util , don't know dependency should depend on? my build.sbt contains: librarydependencies ++= seq("org.springframework" % "spring-dao" % 2.0.8",) my jdk version "1.7.0_25". need use sun.security.util package. link said not guaranteed in jdk. how can declare dependency make work? mean, name of dependency should add? packages in sun.* not guaranteed work everywhere. thus, not recommended use these packages, unless jvm running code under control. check out http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html more information.

Ghost(node.js) app - 503 err after git push in OpenShift hosting -

i created ghost blog in openshift host. worked fine. i wanted make changes in css file(change margin of page title), did git pull resources, made changes in css file locally, , git push command git push -f(force) openshift master, because without -f, couldn't push. after "git push" command, app got broke, , now, http outputs 503 error... i tried restart app, doesn't help. don't know why crashed. not sure happened new change.check app logs. first ssh app ssh 1234567890abcdef1234567890abcdef@your-app-domain.rhcloud.com and cd logs directory cd app-root/logs tail contents of nodejs.log file this may not resolve issue logs can you.

html - How to create CSS menu like Tooltip -

Image
i want create css menu tool-tip. please see attached image exact want. thanks in advance. .tooltip-block:hover:after{ border: 1px solid #fc0; padding: 3px 6px; background: #fffea1; content: attr(data-title); position: absolute; right: -40px; top: -26px; } try on hover might helpful

javascript / jquery cookies -

did knows how create cookie , value? have list hyperlink , dont know use cookie javascript or jquery. this example hyperlink <ul> <li><a href="home">home</a></li> <li><a href="about_me">about me</a></li> <li><a href="reference">reference</a></li> <li><a href="contact">contact</a></li> </ul> if user click on about_me or reference cookies chould remembered. thank kind of help. if want via jquery need add 1 library of jquery jquery.cookie.js and put code below: $(document).ready(function(){ $("ul > a").click(function(){ // set cookie. $.cookie('hrefatt', $(this).attr(href)); }); }) if need via javascript : create function below function setcookie(cookiename,cookieval,expires) { document.cookie = cookiename+ "=" + cook...

perl - Why does this program use return with various different exit codes? -

what meaning of return different values in exit_code below: sub exit_code { $testresult = shift; if ( $testresult eq "pass" ) { return 0; } elsif ( $testresult eq "fail" ) { return 1; } elsif ( $testresult eq "abort" ) { return 40; } else { print "invalid testresult argument passed..\n"; print "valid testresults are: pass, fail or abort\n"; } } in *nix, programs have return values, can evaluated (e.g., using $? environment variable). 0 means program completed without error. values larger 0 mean error occurred, , documentation should state each unique value means. while perl functions not share semantics of returning 0 upon successful execution, function presumably used return exit code for program .

asp.net mvc 5 - Dynamic Naming of DropDownListFor -

i have address view users enter addresses both billing , shipping. on address model have: public string addresstype { get; set; } then on create account view have: <div class="pure-control-group"> @html.action("init", "address", new {addresstype="billing"}) </div> <div class="pure-control-group"> @html.action("init", "address", new {addresstype="shipping"}) </div> in address view have number of input controls render expected have country dropdown list want dynamically name (the control using html helper for): @html.dropdownlistfor(m => m.selectedcountryid, new selectlist(model.validcountries, "countryid", "countryname", model.selectedcountryid), null, new {name=model.addresstype + "_selectedcountryid", id=model.addresstype + "_selectedcountryid"}) however when renders end with: <select id="billing_select...

objective c - iOS useCredential: forAuthenticationChallenge is not using given credentials -

i have unusual use case , apple's usecredential:forauthenticationchallenge can't cope (or maybe it's me?). the issue is, making 2 consecutive connections (the second called after first 1 has been completed) each different credentials (different client certificate): [[nsurlconnection alloc] initwithrequest:request delegate:self startimmediately:yes]; urls of requests are: https://my.url.com/ws/service1 https://my.url.com/ws/service2 then implement delegate's method: - (void)connection:(nsurlconnection *)connection willsendrequestforauthenticationchallenge:(nsurlauthenticationchallenge *)challenge { if ([challenge previousfailurecount] != 0) { [[challenge sender] cancelauthenticationchallenge:challenge]; } nsurlcredential *newcredential = nil; nsurlprotectionspace *protectionspace = [challenge protectionspace]; if ([protectionspace.authenticationmethod isequaltostring:nsurlauthenticationmethodclientcertificate]) { if (...

javascript - d3.max doesn't return highest value from csv file -

i have small csv file, containing data: organisational unit,service division label,category internal name,purpose,detailed expenditure code,date,amount,capital or revenue,benificiary name central & corporate,commercial services trading services,supplies , services,operational materials,205,02/01/2015,35.20,r,a & electrical distributors ltd central & corporate,commercial services trading services,supplies , services,operational materials,205,12/01/2015,72.67,r,a & electrical distributors ltd environment & housing,environmental health,capital,construction,3,12/01/2015,72.00,c,a & p crontractors ltd childrens services,safeguarding targeted & specialist,third party payments,section 17,551,02/01/2015,550.00,r,a ahmadi central & corporate,commercial services trading services,supplies , services,operational materials,205,21/01/2015,26.35,r,a andrews & sons (marbles & tiles) central & corporate,commercial services trading services,supplies , ...

node.js - how to extract html content using xpath using nodejs module -

i looking html content extractor using xpath, have seen various nodejs module jsdom, htmlparser2, xpath, cheerio i found cheerio better getting data using class, id, tags etc not able data specifying xpath , , using xpath nodejs module able data using xpath smaller html, longer html gives different type of error entity not found:  @#[line:120,col:9], unclosed xml attribute @#[line:1,col:877] note: have no permission change html in way e.g. if html <html> <body> <div> <ul id="fruits"> <li class="apple">apple</li> <li class="orange">orange</li> <li class="pear">pear</li> </ul> </div> </body> </html> if using , giving xpath //*[@id="fruits"]/li[2] find element using xpath nodejs module, not getting error , got result orange using xpath nodejs module, if using html of page http://www.infota...

MySQL regex - Get text in one query -

assume have table in mysql tbl_test ----------------------------------------------------- | id | text | ----------------------------------------------------- | 1 | lorem ipsum \n teacher: mr. brown \n age: 43 | | 2 | dolor \n teacher: mrs. morgan \n age: 35 | ----------------------------------------------------- is possible name of teachers one single sql query . expected result should be: mr. brown mrs. morgan i thought of regex sql query. have tried like whole text , not teacher's name. select text tbl_test text '%teacher%'; output lorem ipsum \n teacher: mr. brown \n age: 43 dolor \n teacher: mrs. morgan \n age: 35 if pattern same can use substring_index mysql> select substring_index(substring_index('lorem ipsum \n teacher: mr. brown \n age: 43','teacher:',-1),'\n',1) teacher; +-------------+ | teacher | +-------------+ | mr. brown | +-------------+ 1 ro...

java - how to add a library to the dependencies gradle of LIBGDX project -

all in question , i've tried answers found in , others sites no luck , i've tried far : adding compile filetree(dir: 'lib', include: '*.jar') build.gradle adding compile files('lib/tween-engine-api-sources.jar') build.gradle the library want add tween engine . build.gradle file : buildscript { repositories { mavencentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { } } allprojects { apply plugin: "eclipse" apply plugin: "idea" version = '1.0' ext { appname = 'my-gdx-game' gdxversion = '1.5.4' robovmversion = '1.0.0-snapshot' box2dlightsversion = '1.3' ashleyversion = '1.3.1' aiversion = '1.5.0' } repositories { mavencentral() maven { url "https://oss.sonatype.org/content/repositori...

apache spark - Why does dropna() not work? -

system: spark 1.3.0 (anaconda python dist.) on cloudera quickstart vm 5.4 here's spark dataframe: from pyspark.sql import sqlcontext pyspark.sql.types import * sqlcontext = sqlcontext(sc) data = sc.parallelize([('foo',41,'us',3), ('foo',39,'uk',1), ('bar',57,'ca',2), ('bar',72,'ca',3), ('baz',22,'us',6), (none,75,none,7)]) schema = structtype([structfield('name', stringtype(), true), structfield('age', integertype(), true), structfield('country', stringtype(), true), structfield('score', integertype(), true)]) df = sqlcontext.createdataframe(data,schema) data.show() name age country score foo 41 3 foo 39 uk 1 bar 57 ca 2 bar 72 ca 3 baz 2...

angularjs - how to set only required properties to angular select object using ng-option? -

i have object array contains objects along many properties. binding select tag using angular ng-options demolink once user selects value in combobox, controller property updated(here $scope.selectediem={"selected":""}). selected propriety contains property list name. eg: {"description":"bank", "shortdescription":"dd", "value":"xx", "enable":null, "name":"jhon" }, but want { "shortdescription":"dd", "value":"xx", }, kindly, me how can pass required properties "select object" using ng-options you can using ng-change , when selecting object need call function using ng-change , in function need deleted unwa...

javascript - How to create an error function that can terminate in Google app script -

in google sheets, i'm trying create checking function google apps script ensure cells correctly filled up, , if they're correctly filled rest of script run update separate table. in code i've written, updater function calls checking function. checking function correctly throws alert when error detected, after alert closed, returns updater function wrongly run update. i'd code stop after error alert acknowledged. doing wrong? my code (vastly simplified; check many errors): function updater() { var sheet = spreadsheetapp.getactivespreadsheet().getsheetbyname('update'); var lower = sheet.getrange(1, 1).getvalue; var higher = sheet.getrange(2, 1).getvalue; verify(lower, higher) //check values correctly input /* run below if no errors */ sheet.getrange(5, 1).setvalue(lower); sheet.getrange(5, 2).setvalue((lower + higher) / 2); sheet.getrange(5, 3).setvalue(higher); } function verify(inlow, inhigh) { var ui = spreadsheetapp.getui(); var er...

php - How to execute Join queries between multiple Databases that are on different server with Laravel Eloquent? -

this how handle multiple db connections laravel, php framework not python (for whom thinks duplicate post) <?php return array( 'default' => 'mysql', 'connections' => array( # our primary database connection 'mysql' => array( 'driver' => 'mysql', 'host' => 'host1', 'database' => 'database1', 'username' => 'user1', 'password' => 'pass1' 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ), # our secondary database connection 'mysql2' => array( 'driver' => 'mysql', 'host' => 'host2', 'database' => 'da...

python - How to Check for Unique Data in Django Form? -

i'm following examples posted on django formset documents regarding custom formset validation slight modification. found flaw in example unsure how fix it. there way check uniqueness in data if 1 of 3 input field not filled out? apparently, empty form recorded "none" forces me @ least fill out 2/3 sets of input field (firstname/lastname); otherwise, register duplicates. illustrate mean: forms.py class userinfo (forms.form): first_name = forms.charfield (max_length = 20, required = false) last_name = forms.charfield (max_length = 20, required = false) class baseuserinfoformset (baseformset): def clean (self): if (self.errors): return firstnames = [] lastnames = [] errors = [] form in self.forms: firstname = form.cleaned_data.get ('first_name') lastname = form.cleaned_data.get ('last_name') if ((firstname in firstnames) or (lastname in last...

c++ - When is the "typename" keyword necessary? -

possible duplicate: officially, typename for? where , why have put template , typename keywords? consider code below: template<class k> class c { struct p {}; vector<p> vec; void f(); }; template<class k> void c<k>::f() { typename vector<p>::iterator p = vec.begin(); } why "typename" keyword necessary in example? there other cases "typename" must specified? short answer: whenever referring nested name dependent name , i.e. nested inside template instance unknown parameter. long answer: there 3 tiers of entities in c++: values, types, , templates. of can have names, , name alone doesn't tell tier of entity is. rather, information nature of name's entity must inferred context. whenever inference impossible, have specify it: template <typename> struct magic; // defined somewhere else template <typename t> struct { static const int value = magic<t>::gnarl; //...