Posts

c# - XPath query not working -

hello making httpwebresponse , getting htmlpage data need example table date info need save them array list , save xml file example of html page <tbody> <tr class="odd"> <tr class="even"> <td class="padding5 sorting_1"> <span class="datehover" sort="14/03/18/22/56" title="18.03.14" ref="18.03.14">18.03.14</span> </td> <td class="cellstyledefaulttext"> <span class="transspan">info</span> </td> <td class="cellstyledefaulttext" title="usernumber123">usernumber123</td> <td class="cellstylesignednumber floatophomepage"> <span title="701,554.23 ">701,554.23 </span> </td> <td class="cellstyleamount cellstyleamountnew"> <div title="-3354999.71">-3354999.71</div> ...

xcode - IOS 7 - Update an UILabel with value computed in background using delegation -

i having problem trying update uilabel.text using value calculate in background using delegation (which seems slow). @interface btaviewcontroller : uiviewcontroller <exchangefetchermanagerdelegate> @property (weak, nonatomic) iboutlet uilabel *bidpricelabel; @property (strong, nonatomic) fetchermanager *fetchermanager; @end my btaviewcontroller.m - (void)viewdidload { [super viewdidload]; self.fetchermanager = [[fetchermanager alloc]init]; double calculatevalue = [self.fetchermanager fetchpricesfor]; self.bidpricelabel.contentmode = uiviewcontentmoderedraw; [self.bidpricelabel setneedsdisplay]; self.bidpricelabel.text = [[nsstring alloc] initwithformat:@"%f", calculatevalue]; }]; the label has been correctly initialised in method not shown here , shows correct default value @ startup. once execute code, label value 0.00000000, because calculatevalue has not been calculate yet. how can wait value calculated , display h...

How does the "this" keyword in Java inheritance work? -

in below code snippet, result confusing. public class testinheritance { public static void main(string[] args) { new son(); /* father father = new son(); system.out.println(father); //[1]i know result "i'm son" here */ } } class father { public string x = "father"; @override public string tostring() { return "i'm father"; } public father() { system.out.println(this);//[2]it called in father constructor system.out.println(this.x); } } class son extends father { public string x = "son"; @override public string tostring() { return "i'm son"; } } the result is i'm son father why "this" pointing son in father constructor, "this.x" pointing "x" field in father. how "this" keyword working? i know polymorphic concept, won't there different between [...

Rooted tree impossible constructs -

for uva problem, working on constructing rooted tree following constraints. a tree of depth d means tree should contain @ least 1 node d distance away root , there no node of more d distance root. the degree of node of tree cannot greater v . degree of node measured number of nodes directly connected to, via single edge. the goal determine maximum possible number of nodes. find that, looking sum on v^i , ranges 0 d. summation appears give maximum number of nodes correctly in many cases, i'm assuming it's correct. however, question states 'if not possible construct tree, print -1'. can think of no possible case might occur. think supposed be printed when user enters v , d outside range given in problem. maximum number of nodes = 1 + ( v * ((v-1)^(d-1)) ) , v>=2, d>=1 . explanation: 1 root node, 1st level can have v nodes, 2nd level on wards can have v-1 nodes, restrict maximum degree v. it not possible construct tree if: case 1: d=1 ,...

c# - Where to store information about point in console application? -

Image
i need create struct storing 4 points. wanted create point variable, looks can't use system.drawing in console application. should use? you should add reference system.drawing.dll , add using system.drawing; using system; using system.collections.generic; using system.linq; using system.text; using system.drawing; namespace consoleapplication5 { class program { static void main(string[] args) { point point = new point(); } } }

c# - Incorrect number of type parameters in reference class MyClass<F,T> - Generic entity framework -

i've got following generic abstract class: public abstract class myclass<f, t> tcurrencyfrom : book tcurrencyto : book { public int id { get; set; } public virtual f first{ get; set; } public virtual t second { get; set; } } and got 3 classes implement class like: public class implementation1 : myclass<booktype1, booktype2> { } public class implementation2 : myclass<booktype2, booktype1> { } now got "entitytypeconfiguration" looks like: public class myclassconfiguration<tmyclass> : entitytypeconfiguration<tmyclass> tmyclass: myclass { public myclassconfiguration() { ... } } and try use like: public class implementation1map : myclassconfiguration<implementation1> { public implementation1map () { ... } } but following error: incorrect number of type parameters in reference class myclass how can solve problem , make sure have generic approach on entit...

javascript - Wordpress post slideToggle with each() issue -

i feel i've been trying work, problem i'm not familiar javascript nor jquery. guess it's simple adding 1 line, because i've got work. i have wordpress blog loops out numerous of posts, i've added unique id's of them, i'm able grab problem doesn't work slidetoggle show content. <script type="text/javascript">//<![cdata[ $(window).load(function(){ $(document).ready(function() { $(".togglecontainer").hide(); $('.show_hide').click(function() { event.preventdefault(); var pid = $(this).data('id'); var cid = $(this).data('container'); $(pid).add(cid).each(function() { $(cid).slidetoggle(1000); }); }); }); });//]]> </script> then there's container: <div class="togglecontainer" data-container="<?php th...

Does python make a copy of opened files in memory? -

so search filenames os.walk() , write resulting list of names file. know more efficient : opening file , writing each result find them or storing in list , writing whole list. list big wonder if second solution work. see example: import os fil = open('/tmp/stuff', 'w') fil.write('aaa') os.system('cat /tmp/stuff') you may expect see aaa , instead nothing. because python has internal buffer. writing disk expensive, has to: tell os write it. actually transfer data disk (on hard disk may involve spinning up, waiting io time, etc.). wait os report success on writing. if want write small things, can add quite time. instead, python keep buffer , actually write time time. don't have worry memory growth, kept @ low value. docs : "0 means unbuffered, 1 means line buffered, other positive value means use buffer of (approximately) size (in bytes). negative buffering means use system default, line buffered tty devices , buffered o...

loops - How do i nest div elements in HTML? -

is there possibility code loop in html nest div elements in way(the child elements interesting ones): <div class="parent"> <div class="child"> <div class="child"> <div class="child">... i don't know main language of project, simple solution comes mi mind , think works doing this: <div class="parent"> <% simple statement in main languaje %> <div class="child"> <% end %> <% same simple statement in main languaje %> </div> <% end %> </div>

Mobile geolocation precision - cordova / phonegap -

i want develop app detects how far user/device points on map. calculating distance easy, when close 30meters need precise possible. basically want lights on ui brighter closer target/point. how achieve if gps position bounces around 5-10 meters or more? ideas on how approach this? thanks! in general there inaccuracy position, , indeed meters, bouncing there , rather impossible rid of it, anyways, 1 suggestion collect last few (3-10 , logic really) locations , calculate average them. fast movements position lagging of course, when doing slow movements position shown should more stable.. of course have additional logic on determining movement direction, , accepting location change towards faster etc.

xampp - How to run a codeigniter controller function using exec command in php -

i using xampp local window system. day working codeigniter, trying run mycontroller function background job. like class admin extends mx_controller{ function __construct(){ parent::__construct(); } function index(){ echo "working"; $command = "d:\xampp\php\php d:\xampp\htdocs\client\newslatter\index.php admin preget"; echo $out = exec( $command); echo "here"; } function preget(){ echo "<br/>done!!!!!!"; } } i not able run function using exec command can 1 out problem?. codeigniter has page in it´s manual this: http://ellislab.com/codeigniter/user-guide/general/cli.html note that, in command, put path file, didn´t add "php" $command = "php d:\xampp\php\php d:\xampp\htdocs\client\newslatter\index.php admin preget"; maybe solve problem. is php.exe in "path" enviroment variable of windows? the process should pre...

plugins - Eclipse Subclipse shows in the bottom of eclipse -

i create views in eclipse , after subclipse plugin on action synchronize repository shows panel @ bottom of eclipse (not clickabel or dragable). tried reset perespective doesn't help. i try oper view windows view same result panel . posiible return plugin on working state?

java - Datatables Plugin 'ColumnFiltering()' -

i have 2 codes. why no filtering options code below? want regular filtering each column $(function(){ otable = $('#escapetbale).datatable().columnfilter({ "aocolumns": [ { type: "text", bregex: true, bsmart: true }, { type: "text", bregex: true, bsmart: true }, { type: "text", bregex: true, bsmart: true } ], "sdom": 'tc<"clear">lfrtip', "bjqueryui":true, "spaginationtype": "full_numbers", "processing": true, }); my html code: </tbody> <tfoot> <tr> <th>name</th> <th>address</th...

forms - Send part paid cart to PayPal -

i need send cart paypal payment using form integration method cart value has had part payment made against it, means, 'on account' or gift card example. is there accepted way this? the thing can find sending paid amount discount amount that's not 100% ideal isn't in reality discount. the other option came send single line cart item of 'balance of order xxxx' not ideal customer wouldn't see actual items listed when on paypal. many thank. i can think of 3 paypal features might possibly use this: authorization , capture authorization & capture, or auth/capture, allows authorize availability of funds transaction delay capture of funds until later time. useful merchants have delayed order fulfillment process. authorize & capture enables merchants modify original authorization amount due order changes occurring after initial order placed, such taxes, shipping or gratuity. recurring payments paypal recurring payments allows bill...

mysql - Rails 4 migration not adding fields to an existing database -

i have order database trying add 2 new fields it 1) seller_id 2) buyer_id when run command rails generate migration addfieldstoorders buyer_id:integer seller_id:integer it shows invoke active_record create db/migrate/20140414094632_add_fieldsto_orders.rb after running rake dd:migrate , rails s shows == 20140414094632 addfieldstoorders: migrating ================================ == 20140414094632 addfieldstoorders: migrated (0.0000s) ======================= it should give me seller_id table , buyer_id table. have double checked orders database model via sqlite database model viewer , both fields have not appeared both fields have been added user.rb , order.rb models user.rb class user < activerecord::base # include default devise modules. others available are: # :confirmable, :lockable, :timeoutable , :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable validates ...

java - matrix multiplication on hadoop -

i'm looking best , easy way of matrix multiplication on hadoop java. meanwhile looked @ link http://www.norstad.org/matrix-multiply/index.html felt tough understand it. overall: i've 2 files matrixa(m x n) , matrixb(n x m). want matrixc(m x m) multiplying , b. i'll pass above 2 files mapreduce program. please me.. could reprocess matrix 2 files as: system.out.println( column + " , " + row + "\t" + value ); i thinking can map on both outputting: context.write( new text( column + " , " + row ), new intwritable( value ) ); then reduce iterator , multiply values. for( int val: value ) { int result *= val; } context.write( key, new intwritable( result ));

javascript - JQuery - Adding class onto element, and then interacting with that class doesn't work -

when click ( ".toggle-button a" ) , adds .close class itself. , fades in .info-overlay this works fine, when click again, want info-overlay fade out again, , close class removed. doesn't work. am missing here? http://jsfiddle.net/bazzle/xps9p/1/ html <div class="toggle-button"> <a>click</a> </div> <div class="info-overlay"> content </div> css .info-overlay{ display:block; width:100px; height:100px; background-color:green; display:none; }; js $( ".toggle-button a" ).click(function() { $( ".info-overlay" ).fadein("500"); $(this).addclass('close'); }); $( ".toggle-button a.close" ).click(function(){ $( ".info-overlay").fadeout("500"); $(this).removeclass('close'); }); use event delegation: change $( ".toggle-button a.close" ).click(function(){ $( ".info-overlay").f...

unix command to copy multiple files from different directories to one new directory -

i newbie unix command usage. ask if there way copy multiple files multiple directories 1 new directory? example: in /tmp/dira --> contains file a.run.log , a.skip.log in /tmp/dirb--> contains file b.run.log , b.skip.log in /tmp/dirc --> contains file c.run.log , c.skip.log and have a.run.log a.skip.log b.run.log b.skip.log c.run.log c.skip.log into new folder called /tmp/dirnew is there unix command able it? appreciate it. thank you. js use : cp /tmp/dir?/* /tmp/dirnew

java - MyBatis - JUnit test shows 'out of memory' -

i doing junit test spring 3.1.1 , mybatis. made resultmap , put customized typehandler handling null value. my map looks below : <resultmap type="map" id="program"> <result property="serviceid" column="id_svc" typehandler="stringhandler"/> <result property="programid" column="id_event" typehandler="stringhandler"/> <result property="programname" column="nm_title" typehandler="stringhandler"/> <result property="directorname" column="nm_director" typehandler="stringhandler"/> <result property="actorname" column="nm_act" typehandler="stringhandler"/> <result property="ratingcd" column="cd_rating" typehandler=...

c - How to terminate an ncurses program with the `raw()` setting turned on? -

in order save time, i'd know if there's professional way terminate unresponsive ncurses program (from terminal) raw() setting turned on. here, ctrl+c won't help. example progam: #include <ncurses.h> int main() { initscr(); raw(); while(1) { printw("yello\n"); } refresh(); endwin(); return 0; } whenever hit control-c ( c-c ) combination, terminal parses , sends signal (sigint) whatever application running in foreground. control-c has no special meaning operating system, terminal. when call ncurses' raw() or cbreak() function, instructs terminal ignore these special characters , pass them on directly whatever's running in foreground, instructing terminal application "knows it's doing". so yes, have "manually" (i.e. terminal) kill running application: ps aux | grep your_executable_name kill the_pid yes, can while in tty. , yes, can jam whole system if lock...