Posts

Showing posts from June, 2015

c# - Accessing the properties from a known view his viewmodel -

i have view contains usercontrol it's own view & viewmodel. the usercontrol it's views looks this: <usercontrol.datacontext> <viewmodel:timepickerviewmodel x:name="timepickerviewmodel"/> </usercontrol.datacontext> in viewmodel of usercontrol have property validtime: public datetime? validtime { { return validtime; } set { validtime = value; onpropertychanged("validtime"); } } in view contains usercontrol need acces property validtime: <timepicker:timepickerview grid.row="0" x:name="timepicker"/> <button grid.row="1" content="plan" command="{binding plancommand}" commandparameter=" {binding elementname=timepicker, path=validtime}"/> in viewmodel of last view have this: public icommand plancommand { { return plancommand ?? new relaycommand<datetime?>(plan); } } void plan(datetime? date) { if(pic

Override PHP class to non readonly -

this question has answer here: php domelement immutable. = 'no modification allowed error' 1 answer i working dom in php , context in need recursion , mess codes working fine. i want keep codes clean abut readonly thing php not able proceed. i trying like: $test = new domelement('div'); $test->setattribute('class','blue'); but getting error fatal error: uncaught exception 'domexception' message 'no modification allowed error' i can setattribute element until append domdocument. there way it? i thinking of like class elem extends domelement { //and here maybe override readonly } is possible? i dont want create domdocument first use createelement() method , append them (i doing this), want create element , append them @ later time. you can modify domelement after adding domdocument .

Passing php session variables to multiple pages -

i having problems passing session variables on website. can echo session variables on advertiser/page2.php when go 3rd page sessions gone. can please me fix issue? login.php session_start(); $_session['account_id']= $account_id; $_session['user_email']= $user_email; advertiser/page2.php session_start(); advertiser/page3.php session_start(); here settings on phpinfo() directive local value master value session.auto_start off off session.bug_compat_42 off off session.bug_compat_warn on on session.cache_expire 180 180 session.cache_limiter nocache nocache session.cookie_domain no value no value session.cookie_httponly off off session.cookie_lifetime 0 0 session.cookie_path / / session.cookie_secure off off session.entropy_file no value no value session.entropy_length 0 0 session.gc_divisor 100 100 session.gc_maxlifetime 1440 1440 session.gc_probability 1 1 session.hash_bits_per_character 5 5 s

php - Unsure if I need SSL or alternative -

i have website not have ssl (due cost reasons). has login form, why believe need ssl. however, don't store passwords, usernames; login form grabs posted username/password , sends via curl https-secured login form, returns yes or no, speak, server. given this, ssl certificate absolutely necessary, or there lower-cost alternative securing form? without using tls, username , password exposed listening in on traffic. this problem, because if website "low value", , doesn't matter if attackers able steal other people's credentials, people reuse passwords. so not protecting website, exposing users unnecessary risk. attackers can learn usernames , passwords, , try , re-use credentials {email,bank,work,etc} accounts. as others have pointed out, ssl/tls protects data in motion, not data @ rest. fact don't have sensitive stored data isn't relevant decision of whether protect traffic. as elon points out, can low assurance free tls certs better

string - In C#, how can I detect if a character is a non-ASCII character? -

i check, in c#, if char contains non-ascii character. best way check special characters such 志 or Ω ? ascii ranges 0 - 127, check range: char c = 'a';//or whatever char have bool isascii = c < 128;

Ordering a list SQL or Excel -

Image
i have simple task @ work daily , think can done help. there table single column "pc name". have divide list of pc's waves. wave 1 : 2% wave 2: 3% wave 3: 25% wave 4: 45% wave 5: 25% so copy list of pc's excel , add column named "wave assign". example if list 100 pc's first 2 pc's assign wave 1 , 3 pcs to wave 2 , 25 pcs wave 3 , on. i need way automate since takes me long manually. doesn't matter if there small change in % in order round number of pcs in each wave. assuming list in columna starting in row1: =vlookup(rows(a$1:a1)/counta(a:a),warray,2) in row1 , copied down should work, provided lookup array of following kind created: and named warray . in case list shorter 100 have added .002 'logical' breakpoints (cumulative proportions) not minority waves rounded down such that, @ 50 items, wave 1 not feature (and hence stand out rather more approximation in larger group).

ios - Core Plot and Xcode 5 Compile Error: "Implicit conversion from enumeration type 'enum UILineBreakMode' -

i using xcode 5 , following error when trying compile ios app uses core plot: implicit conversion enumeration type 'enum uilinebreakmode' different enumeration type 'nslinebreakmode' (aka 'enum nslinebreakmode') the error in cpttextstyleplatformspecific.m : -(void)drawinrect:(cgrect)rect withtextstyle:(cpttextstyle *)style incontext:(cgcontextref)context { if ( style.color == nil ) { return; } cgcontextsavegstate(context); cgcolorref textcolor = style.color.cgcolor; cgcontextsetstrokecolorwithcolor(context, textcolor); cgcontextsetfillcolorwithcolor(context, textcolor); cptpushcgcontext(context); uifont *thefont = [uifont fontwithname:style.fontname size:style.fontsize]; [self drawinrect:rect withfont:thefont linebreakmode:**uilinebreakmodewordwrap** // error!! alignment:(nstextalignment)style.textalignment]; cgcontextrestoregstate(context); cptpopcgcontext(); } h

How to prevent automatic unit test execution in Visual Studio 2012? -

Image
every time compile solution unit-tests start run in background see in test explorer. is there configuration prevent vs doing that? disable " run tests after build " setting: source: http://tfs.visualstudio.com/en-us/learn/run-a-unit-test-after-build-in-vs.aspx

groovy - Grails Domain Object hasMany irregular behaviour using contains -

i'm having issue calling .contains() on 1 of domain classes' hasmany relationships not doing same when running normally, or when debugging. situation follows: i have 2 domain objects, a , b . a has hasmany relationship b . class { ... static hasmany = [bees: b] ... } now, during execution of 1 of filters, grab current user spring security service. user contains single instance of b . filter should check if instance of b in user contained in instance of a . assume instances of b referring same object (since are). now, issue arises. calling: if (instanceofa.bees.contains(user.instanceofb)) { println 'success' } else { println 'failure' } prints failure during normal (or debugging without stepping through code) execution. however, if put break-point there, , step through code, correctly executes contains() , prints success . i have implemented equals , hashcode , compareto in attempt resolve this, same behaviour.

javascript - Is it safe to use # and . characters in html attributes? -

i'm wondering if can set value of html object's attribute string contains # character ? the reason want page have lot of items should scroll page specified elements, , want store data ' item should scroll to? ' data-scrollto attribute. so javascript code -will- this: function scrolltoelement(lm) { var thetop = lm.offset().top; $("html,body").animate({ scrolltop: thetop/*, scrollleft: 1000*/ }); } // .. , add click event such objects : $('.scroller').click(function(){ var theselector = $(this).attr('data-scrollto'); scrolltoelement($(theselector)); }); so html elements : <a class='scroller' data-scrollto='p#p-to-scroll'>click scroll p</a> is safe ? and side question, why $(element).data('scrollto'); does not work but $(element).attr('data-scrollto'); works ? according w3c specs, yes, is safe use u+0023 number sign

ruby - Problems with 'gem install rails' -

i'm having problems installing rails on mac via homebrew. installed ruby , when use 'sudo gem install rails' return successful, rails isn't installed. tried running 'gem install rails' (without sudo) after reading post cannot install rails gem , returns error: error: while executing gem ... (gem::filepermissionerror) don't have write permissions /library/ruby/gems/1.8 directory. how can rails installed? don't use super user install gems. instead can try rvm it's easy install ruby , gems through rvm.

java - Deserializing a field named "class" into a POJO using Jackson -

this may dumb question, deserialize json object pojo myobject field named class , reserved keyword in java... if possible, i'd keep myobject jackson/json/whatever-dependency free. do need add (standard or jackson-specific) java annotation class field member handle this? or there work-around have "pure" java object? can configure jackson object mapper if needed. public class myobject { public string field1; public string class; // fail } since class reserved java keyword, cannot use directly. if want generated json have it, use @jsonproperty , set value attribute. public class myobject { public string field1; @jsonproperty(value = "class") public string clazz; }

Clearing css floats with foundation 4 framework -

i'm developing website i'm having hard time clearing floats. i'm using foundation 4 framework. when .columns class applied element float elements left. when browser re-sized of elements become larger in height , forces element below push down next row. i've tried adding clear:left elements pushes of elements left of page. here's screenshot of what's happening, http://www.webpagescreenshot.info/img/522621c34826e6-18306724 here's url page, http://theinfluence.iamchrisbarnard.com/news/ am missing something? you have multiple large-6 overflowing row , wrapping. you need surround each pair of large-6 in row below jsbin. if issue resolved. http://jsbin.com/ecojohe/1/

excel - CountIf of values from cells in rows between two designated dates into different worksheet with VBA -

i have userform allows user enter "from" , "to" dates search through data corresponds date range user selects. in spreadsheet, date in column a, , there series of data corresponds date in following columns each row through column w. i'm trying develop code can take 2 dates , @ rows have date falls entered date range in column a, , count responses in each of columns within rows have dates within specified range. i'd put count values specific cell each response's count in separate worksheet within same workbook. there 6 defined responses each possible response column, countif function seems me logical. this sounds rather complicated, best way summarize it. i'm open using autofilters or else, must done using vba, , if uses autofilter, must returned pre-autofilter screen @ end of sub. edit: ok, guess wasn't clear. first question, reason why goes w because there couple other items associated each row not relevant analysis. columns relevant d

sql - Insert distinct values from one table into another table -

so each distinct value in column of 1 table want insert unique value row of table. list = select distinct(id) table0 distinct_id in list insert table1 (id) values (distinct_id) end any ideas how go this? whenever think doing in loop, step back, , think again. sql optimized work sets. can using set-based query without need loop: insert dbo.table1(id) select distinct id dbo.table0; there edge cases looping can make more sense, sql server matures , more functionality added, edge cases narrower , narrower...

web crawler - How to extract data from a website and display on google maps? -

i trying create website similar this one user enters criteria properties , website grabs data matches criteria websites such rightmove , zoopla etc. data grabbed these websites displayed on google maps, shown on website. could point me in right direction on started please? many thanks! many of these property listing sites have apis retrieving parseable sets of data, can format please map. http://developer.zoopla.com/ for example, can make http request following api endpoint url (via ajax or webserver), , receive xml formatted list of properties , attributes. http://api.zoopla.co.uk/api/v1/property_listings.xml?area=oxford&api_key=xxxxxx then can use google maps api inject formatted data overlay. there lot of tutorials kind of thing floating around web

java - How to get the value of a textview in a listview? -

i need value of textview in position of listview. how it? myjava code: protected void onlistitemclick(listview l, view v, int position, long id) { super.onlistitemclick(l, v, position, id); textview txttechcharacteristic = (textview) findviewbyid(r.id.techcharacteristic); textview txttechcharacteristicname = (textview) findviewbyid(r.id.techcharacteristicname); } here textview ->. layout listview: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <relativelayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <include layout="@layout/simple_back_action_bar" /> </relativelayout> <listview android:id=

cordova - Phonegap Android Application not adjusting pan on keyboardshow -

i'm developing phonegap application version 2.9.0; the layout tested in desktop browser using rwd bookmarklet( http://responsive.victorcoulon.fr/ ) , worked fine. however, when tested in mobile devices or emulator, layout broke. after little bit testing, found out problem status bar height. changed application fullscreen, problem solved. but now, when focus on input field, screen not being adjusted, so, keyboard covers input field! after looking questions , related problems, found this one, makes sense me, wanted know if there way make adjust pan work fullscreen, don't need adjust components height, calculate different status bar heights based on devices, etc. codes form.html <form id="login-form"> <div class="form-group"> <input type="text" name="login" class="form-control" id="login" placeholder="xxxxxxx@example.com"> </div>

c# - How can I access winForm Common control inside helper class? -

i have windows form , want use below code inside helper class. made richtextbox , tabcontrol modifier public, still cant access richtextbox. gives error @ richtextbox1 saying the name richtextbox1 doesnt exist in current context what doing wrong? helper class list<string> commentlines = richtextbox1.lines.tolist(); you're code sample pretty incomplete. however... you'll need pass reference richtextbox method or class constructor (depending on code): // helperclass method public static void updatecommentlines(richtextbox richtextbox) { list<string> commentlines = richtextbox.lines.tolist(); } // winform code public void dosomething() { helperclass.updatecommentlines(this.richtextbox1); }

java - Why keyStore.aliases() is empty for pkcs12 -

i'm trying load privatekey .p12 file using code: security.addprovider(new org.bouncycastle.jce.provider.bouncycastleprovider()); java.security.keystore keystore = keystore.getinstance("pkcs12", "bc"); keystore.load(new fileinputstream(new file("my_domain_com.p12")), password); keystore.aliases().hasmoreelements(); //this false java.security.privatekey privatekey = (privatekey) keystore.getkey("somealias", password); i'm trying find reason why there no aliases. i'm not able find. can reason empty alias? want private key , ecrypt text using key. there other apporach? i have .cer file i'm not sure should use together. is possible keystore has nothing in @ all? use java keytool command verify. >keytool -list -v -keystore test.p12 -storetype pkcs12 enter keystore password: keystore type: pkcs12 keystore provider: sunjsse keystore contains 1 entry alias name: test_alias creation date:

linux - Java Socket Bind Local Interface (ppp0) -

i've tryied release java socket connection using ppp0 endpoint way: socket socket = new socket(inetaddress.getbyname("200.147.67.142"), 80, inetaddress.getbyname("189.116.7.204"), 4447); where 189.116.7.204 ip address ppp0 interface , 200.147.67.142 target. the problem is: timeoutexception my network configuration: ifconfig -a eth0 link encap:ethernet endereço de hw b8:27:eb:fb:45:a6 broadcastmulticast mtu:1500 métrica:1 rx packets:0 errors:0 dropped:0 overruns:0 frame:0 tx packets:0 errors:0 dropped:0 overruns:0 carrier:0 colisões:0 txqueuelen:1000 rx bytes:0 (0.0 b) tx bytes:0 (0.0 b) lo link encap:loopback local inet end.: 127.0.0.1 masc:255.0.0.0 loopbackrunning mtu:16436 métrica:1 rx packets:0 errors:0 dropped:0 overruns:0 frame:0 tx packets:0 errors:0 dropped:0 overruns:0 carrier:0 colisões:0 txqueuelen:0 rx bytes:

javascript - jbimages plugin for TinyMCE not working on godaddy -

i'm using tinymce , jbimages plugin upload images directly of tinymce. works on localhost when test @ godaddy, receive following error message: upload in progress… taking longer usual. error may have occurred. view script's output no input file specified. any highly appreciated! do have proper directory permissions on server? make sure have upload directory permissions set 777 allow read/write directory edit: try replacing action with action=”ci/index.php?/upload/{#jbimages_dlg.lang_id}” notice ?

c# - Is creating tasks via a for loop different to creating them individually? -

the problem having seems related task creation. after using loop populate task array, , starting them within separate loop, results, although consistent, wrong. however, if populate array individually, start each task within loop, fine. can 1 offer me advice? for example, problematic: int c = 1; (int = 1; <= 4; i++) { taskarray[i-1] = new task(() => calculaterows(c, true)); c = c + 2; } foreach (task t in taskarray) t.start(); but works fine: taskarray[0] = new task(() => calculaterows(1, true)); taskarray[1] = new task(() => calculaterows(3, true)); taskarray[2] = new task(() => calculaterows(5, true)); taskarray[3] = new task(() => calculaterows(7, true)); foreach (task t in taskarray) t.start(); the problem lambda expression captures c - variable c , not value @ time of task creation. time start tasks, c 9. if started them within loop, there's still no guarantee code in lambda expression start execute before chan

selenium webdriver - clicking background-image from css -

is there way click on background image defined in css not part of html tag? need click on div tag has @class=hitlocation. <ul id="uxfoldertree_uxfoldertree_template_treerootelement" class="ui-tree-root"> <li class="-ui-tree-branch -ui-tree-folder -ui-tree-type-root collapsible" data--selectionmode="none" data-level="0" data-path="0" data-rootid="0" data-parentid="0" data-id="0"> <div class="hitlocation"> the css is .ui-tree .ui-tree-branch.collapsible > .hitlocation { background-image: url("/workarea/frameworkui/images/icons/plus.png"); background-position: 0 center; cursor: pointer; not directly, no. you can either: simply click hitlocation element. webdriver implicitly clicks center of element, might enough. use advanced interactions api , specify @ location in element want click. for example, clicks @ position [1,1] countin

java - Android Activity/View Visibility Binding -- is this possible? -

in android, there way bind screen element's visibility boolean property within activity? i've done lot of work backbone , ember doable. i'm following standard methodology of toggling button states based on applicable responses server, code feels overly verbose , clumsy compared able achieve web frameworks. is there nice way view watch property, , have update visibility based on value of property? basically have api calls update property in activity (or associated data model), , have visibility logic flow automatically, without manually toggling visibility of elements myself. so looks want use android binding library. here's github project .

javascript - Angular+Jquery - Programmatic form submit causes redirect -

i'm trying write form has ngssubmit. pressing enter , clicking submit button works expected (calling method provided ng-submit , that's that). however, want in cases preprocessing before submitting, tried using jquery's submit() programmatically trigger submit. this causes ng-submit handler fire, , sends form refreshing whole page. any ideas how around or why happens??? example here ("click me" shows bad behavior) http://jsfiddle.net/yf5tf/ <form ng-app="myapp" ng-submit="submitme()" ng-controller="myctrl"> <input type="text" ng-model="value"></input> <input type="submit" value="go!"></input> <div ng-click="progsubmit()">click me</div> </form> angular.module('myapp', []) .controller('myctrl', function($scope, $element, $timeout) { $scope.submitme = function() { alert ("hi"); };

git - when working on a branch (new feat), do I pull in updates or merge them? -

let's there's origin/develop branch. i've branched off feat-whatever locally (doesn't exist on server yet) , working on branch. if want update branch team has done, do (while on feat-whatever branch): git pull origin develop or git checkout develop git pull git checkout feat-whatever git merge develop they're both equivalent, since pull fetch followed merge . well, there 1 difference...the second method updates local develop branch, while first 1 won't. you have option of rebasing feature branch synchronize upstream changes: git fetch origin git checkout feat-whatever git rebase origin/develop

ios - Can't Resolve Type in Protocol -

#import "mpocontactauthorizationmanager.h" @protocol mpocontactauthorizationmanagerdelegate <nsobject> - (void)authorizationmanger:(mpocontactauthorizationmanager *)manager didupdatecontactstate:(contactsstate)contactstate; @end mpocontactauthorizationmanager , contactstate not resolving types though declared in mpocontactauthorizationmanager: #import "mpocontactauthorizationmanagerdelegate.h" typedef enum _contactsstate { kcontactsstateunknown, kcontactsstateallowed, kcontactsstatedisallowed } contactsstate; @interface mpocontactauthorizationmanager : nsobject <uialertviewdelegate> { contactsstate _contactsauthorizationstate;; } @property (strong, nonatomic) nsobject<mpocontactauthorizationmanagerdelegate> *delegate; @property (nonatomic) contactsstate contactsauthorizationstate; any ideas why these not resolving? both getting error "expected type" thanks mike you have circular dependenc

sockets - Active FTP Client for Node.js -

i'm trying hand @ writing ftp client against filezilla supports active mode using node.js. i'm new ftp , node.js. thought understanding of tcp socket communication , ftp protocol doing exercise. also, node-ftp jsftp don't seem support active mode, think nice (though used) addition npm. i've got proof of concept code works @ least sometimes, not time. in case works, client uploads file called file.txt text 'hi'. when works, this: 220-filezilla server version 0.9.41 beta 220-written tim kosse (tim.kosse@gmx.de) 220 please visit http://sourceforge.net/projects/filezilla/ 331 password required testuser 230 logged on listening 200 port command successful 150 opening data channel file transfer. server close 226 transfer ok half closed closed process finished exit code 0 when doesn't work, this: 220-filezilla server version 0.9.41 beta 220-written tim kosse (tim.kosse@gmx.de) 220 please visit http://sourceforge.net/projects/filezilla/ 331 pa

php - loading a class from a parent namespace -

i'm working on application in modular way, is, have interface , want make unit test classes implement interface made abstract class have logic implemented(testing if class implementing interface, testing return values , on) when try inherit abstract class class not found exception i'm working namespaces directory structure this namespacea |->abstract.php |->namespaceb |->plugintest.php so plugintest.php class definition this namespace namespacea\namespaceb; use namespacea\abstract; class plugintest extends abstract and in abstract class there namespacea definition, have tried manually include file ( include("../abstract.php") ) failed, since have used autoloading while maybe don't remember how manually import, have tried alias of class ( using namespacea\abstract x ) , putting \ before namespacea nothing work, im doing wrong, or im missing ==edit== i managed load class using include __dir__ ."/../abstract.php"; bu

php - Check if a field in a certain row and column is empty -

i have database table consisting of columns player1 , player2 , player3 ... player12 i need check if column player1 empty in row. here's have in join.php : <?php require 'connect.inc.php'; $playername = $_get['name']; $tour_name = $_get['tourname']; if (isset($playername)&& isset($tour_name)) { $query = "select `tour_name` `tournies` `tour_name` = '$tour_name'"; $query_run = mysql_query($query); echo mysql_error(); //mysql_query("update `tournies` set player1='".$playername."' tour_name='".$tour_name."'"); if ($query_run = mysql_query($query)) { header('location: s.php'); } else { echo 'not win.'; echo mysql_error(); } } else { echo 'invalid username or tournament id, please return <a href="index.php">home</a> , try again. sorry.'; } ?> if need find if row empty, need use statement &l

pdf - How to create a threadsafe c# exe wrapper -

i attempting convert html pdf. i have checked out pdfsharp , itextsharp both don't complicated, there executable out there wkhtmltopdf seems far have best reviews. i use wkhtmltopdf console application library. i can imagine situation has occurred in different formats can't find solutions specific enough use. there existing c# wkhtmltopdf wrapper library, has problems in deploying , application hanging. there 1 call need pass .exe file like: wkhtmltopdf.exe "www.adsf.com" convertedpdfofasdf.pdf i create library spins off thread that: copies instance of wkhtmltopdf.exe temp location calls wkhtmltopdf.exe via reflection deletes temp location containing copies wkhtmltopdf.exe i haven't attempted before not sure if best way of solving problem, surely there reproducable solution out there. ps. solution must thread safe. running web application. it sounds you're headed towards dll hell. while proposed solution provide separation

javascript - Marionette.js CollectionView, only render specific models -

i refactoring backbone.js application use marionette.js, , trying wrap head around collectionview . suppose have several itemview s model cow : // declare models. var cow = backbone.model.extend({}); var cows = backbone.collection.extend({ model: cow }); // make views var grasspatch = marionette.itemview.extend({ tagname: 'div', template: "<section class='grass'>{{name}}</section>", }) var pasture = marionette.collectionview.extend({}); // instantiate collectionview, var blissland = new pasture({ itemview: grasspatch; }); // now, add models collection. cows.add({ name: 'bessie', hasspots: true }); cows.add({ name: 'frank', hasspots: false }); now here's trick. want cows spots in pasture. how, in defining collectionview (pasture), tell pay attention models hasspots === true ? ideally have collectionview filter in events, minimally, how render itemviews based on model properties? update i use

c# - How do I minimize repeated xml attributes when dealing with multiple levels of inheritance? -

i have ui framework xna engine written makes easy define user interfaces via code. looking @ making easier utilize allowing defining of user interfaces via xml. what i'm stuck on creating deserialization classes. issue root contains collection of items, , items may contain 1 or more child items. right have similar to: [xmlroot] public class rootclass { [xmlarray] [xmlarrayitem("classa", typeof(classa)] [xmlarrayitem("classb", typeof(classb)] public list<baseclass> classes { get; set; } } public class baseclass { [xmlattribute] public string name { get; set; } public class classa : baseclass { [xmlattribute] public string avalue { get; set; [xmlarray] [xmlarrayitem("classa", typeof(classa)] [xmlarrayitem("classb", typeof(classb)] public list<baseclass> children { get; set; } } public class classb : baseclass { [xmlattribute] public string bvalue { get; set;

ruby on rails - XML Tags using Builder -

i building xml export real estate app. using builder gem in rails. , looking way following: <commercialrent> "commercialrent figure" <range> ... </range> </commercialrent> i can't seem find way implement "text goes here" part my code: b.commercialrent(period: "annual", plusoutgoings: self.plus_outgoings) { self.rent_price; b.range { b.min(self.rent_psm_pa_min); b.max(self.rent_psm_pa_max) }; }; returns: <commercialrent period="annual" plusoutgoings="no"> <rentpersquaremeter> <range> <min>1000</min> <max>10000</max> </range> </rentpersquaremeter> </commercialrent> everything prints fine, except self.rent_price missing. can't figure out. you use text! method produce text node: - (object) text!(text) append text output target. es

java - When to use Collections vs when to add extra function to a concrete subclass of a list? -

consider following code detect if linkedlist has loop public boolean hasloop() { node<e> fast = first; node<e> slow = first; while (fast != null && fast.next != null) { fast = fast.next.next; slow = slow.next; if (slow == fast) { return true; } } return false; } if sun microsystems add functionalities (like: detectloop, reverselinkedlist, findif2linkedlist intersect etc) linkedlist.java , how ? note, sun uses node class internal detail (ie private). a few options can think of ( listed disadvantages of each) static function 'hasloop' in linkedlist.java ? ( weird, because if want hasloop existing instance , call linkedlist.mergesort(instance) rather instance.mergesort() ) non-static function 'hasloop' in linkedlist.java? ( weird because functions sort belong collections ) subclass linkedlist.java , add new function 'hasloop' ? ( weird because if need

actionscript 3 - AS3 error 1061 trying to get collision -

" player.as, line 59 1061: call possibly undefined method hittestobject through reference static type class." i new flash , trying make game, trying make player class in game can collide things, using square @ bottom of feet (not yet referenced in code) , movieclip called collisiontest package { import flash.display.stage; import flash.display.movieclip; import flash.events.event; import keyobject; public class player extends movieclip { public var stageref:stage; public var key:keyobject; //add these 4 variables: public var leftpressed:boolean = false; //keeps track of whether left arrow key pressed public var rightpressed:boolean = false; //same, right key pressed public var uppressed:boolean = false; //...up key pressed public var downpressed:boolean = false; //...down key pressed private var gravity:number = 2; private var runspeed:number = 5; pr

javascript - Retaining "this" inside callback function -

i'm not sure if question specific backbone.js. have model following render function: render: function() { var self = this; this.$el.empty(); this.model.fetch({ success: function() { self.$el.append(self.template(self.model.attributes)); } }); return this; } as can see, inside success callback function, use variable called self . because inside callback, this set window when want set view. there way can retain original reference of this without storing in variable? is there way can retain original reference of without storing in variable? yes, reasonable use case proxy method this.model.fetch({ success: $.proxy(function() { this.$el.append(this.template(this.model.attributes)); }, this) }); alternatively can use underscore's bind method: this.model.fetch({ success: _.bind(function() { this.$el.append(this.template(this.model.attributes)); },

php - Create a blank array from a model in cakephp -

hi, i have working model , want able create array key names , have them empty. to illustrate, model client comes clients table, , example when this: $this->client->find( 'first' ); i following array (json encoded): { client: { id: "39", name: "andrux", phone: "1234567890", email: "me@andrux.com", city_id: "2" }, city: { id: "2", city_name: "andruxville" } } as can see, set model have relationship city model, both client , city arrays result of find method. now need same array without values, , can't find answer this, have tried solutions none have worked way want, example tried using array_map function , schema method of model gives me column names of clients table, can set null if want city model? the end result want following: { client: { id: "", name: "",

python - UnicodeDecodeError: while writing into a file -

i error while writing file. how can handle this. traceback (most recent call last): file "c:\python27\aureusbaxprojectfb.py", line 278, in <module> rows = [[unicode(x) x in row] row in outlist] unicodedecodeerror: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128) >>> code writing file class unicodewriter: """ csv writer write rows csv file "f", encoded in given encoding. """ def __init__(self, f, dialect=csv.excel, encoding="utf-8", **kwds): # redirect output queue self.queue = cstringio.stringio() self.writer = csv.writer(self.queue, dialect=dialect, **kwds) self.stream = f self.encoder = codecs.getincrementalencoder(encoding)() def writerow(self, row): self.writer.writerow([s.encode("utf-8") s in row]) # fetch utf-8 output queue ... data = self.queue.getva

web services - Use WSDL dynamically in Delphi -

how can use dynamic wsdl, it's operations , parameters, given in program config file? for example, have config file: [section] wsdl=http://example.com/somepub/ws/someservice?wsdl username=myuser password=mypass operationname=myoperation parametername=myparameter i.e. have use web-service, unknown, given (by ini-file) in run-time. so, cannot use wsdl import wizard in delphi. can write in delphi such program, load these settings configuration, , pass data specified operation in specified parameter on web-service, specified given wsdl? using soapui, import service , perform sample call. copy raw request , raw response notepad. modify real data 'tags' , include each raw template value in ini. when need make call, open ini, grab raw response template , replace tags real values. manually send soap request , parse response in same way using raw template.

How to kill Processes running under different users using c++ code -

the following code works fine in displaying process id of processes (eg: notepad.exe) running under different users. process under current user alone getting killed. need kill processes running under different users. #define sampleapp "notepad.exe" void main() { killprocessbyname(sampleapp); system("pause"); } void killprocessbyname(const char *filename) { // taking snapshot of processes handle hsnapshot = createtoolhelp32snapshot(th32cs_snapall, null); //structure capture each entry in snapshot processentry32 pentry; pentry.dwsize = sizeof (pentry); //capture first process in list bool hres = process32first(hsnapshot, &pentry); while (hres) { char tempprocess[process_size];// = pentry.szexefile; wcstombs(tempprocess, pentry.szexefile, process_size); //if process name equal process passed argument killed if (strcmp(tempprocess, filename) == 0) { handle hprocess

c++ - How to assign specific row and column range in a matrix -

i want assign specific row , column range in matrix 1 , multipication of matrix original image multiplying image mask. in matlab used following code texture_mask= zeros(size(d_mask, 1), size(d_mask,2)); texture_mask(troi(1)-troi(3):troi(1)+troi(3),troi(2)-troi(3):troi(2)+troi(3))=1; im= im2double(im).*repmat(texture_mask, [1 1 3]); im= im(troi(1)-troi(3):troi(1)+troi(3),troi(2)-troi(3):troi(2)+troi(3),:); when try in opencv following code error in multiplication may beacause texture_mask not assigned properly. mat texture_mask= mat::zeros((dress_mask.rows),(dress_mask.cols),cv_64fc3); texture_mask.rowrange(troi[0]-troi[2],troi[0]+troi[2]).colrange(troi[1]-troi[2],troi[1]+troi[2])=1; img.convertto(img,cv_64fc3); img= img*texture_mask;//getting error here img=img.rowrange(troi[0]-troi[2],troi[0]+troi[2]).colrange(troi[1]-troi[2],troi[1]+troi[2]); after doing multiplication have crop image.as shown above.what wrong code??

mysql - PHP Best Practices for querying a group of class objects with summarized data -

this pretty broad question i'm hoping bit of guidance. i'm building reporting system company. have classes customer, order, invoice, , item. work great individual objects. however, reporting system , need query , summarize these objects in variety of ways. for example, single order object have total dollar value 1 order. if i'm generating report month, want summarize group of orders match whatever parameters pass query (such date range and/or customer number). this typically involves additional work such accumulating running totals month date or year date comparisons. things little fuzzy me. logic belong in order class? if not, where? note have same invoice class. here's simplified version of i'm doing order class. use 1 function (getorders) returns array of order objects, , function (getordergroup) returns array of grouped results (not objects). it's getordersgroup() function i'm unclear about. if there better practice reporting on grouped res

c# - How to show property descriptions in Windows Store App User Control? -

i use description attribute custom properties in wpf user control below. [category("features"), description("you can setup image width ratio in double type")] public double imagewidthratio { { return (double)getvalue(imagewidthratioproperty); } set { setvalue(imagewidthratioproperty, value); } } // using dependencyproperty backing store imagewidthratioproperty. enables animation, styling, binding, etc... public static readonly dependencyproperty imagewidthratioproperty = dependencyproperty.register("imagewidthratio", typeof(double), typeof(thecontrol), new uipropertymetadata(1.0)); the line [category("features"), description("you can setup image width ratio")] gives descriptions groups in properties window. but, windows store app user control. says no system.componentmodel.desriptionattribute . how show property descriptions in properties window in winrt? add he

iphone - playing a song on another device using bluetooth -

Image
i have playlist of songs in app.i want play song playlist on anther device (iphone) using bluetooth. this have done #import "browsestationsviewcontroller.h" @interface browsestationsviewcontroller (){ gksession *gksession; } @end @implementation browsestationsviewcontroller - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization } return self; } #pragma mark - - (void)viewdidload { [super viewdidload]; // additional setup after loading view [self setupsession]; nsnotificationcenter *defaultcenter = [nsnotificationcenter defaultcenter]; // register notifications when application leaves background state // on way becoming active application. [defaultcenter addobserver:self selector:@selector(setupsession) name:uiapplicationwillenterforegroundnotification objec