Posts

Showing posts from September, 2014

boost - C++: thread sync -

i trying synchronize 2 thread (working on same c++ map) using boost library. must tell not expert in c++ , find boost documentation quite hard understand. what want achieve, this: #thread 1 access map put in release access #thread 2 wait until map empty when it's not empty anymore, wake , gain access perform operations on 1 entry of map leave access else i tried use mutex , condition_variables, code not working properly. in specific, when thread2 waking (after waiting cond. variable), not gaining directly access map, there else got access , emptied map. therefore, got segmentation fault, because expecting map full while empty when accessed it. in addition, understand difference between mymutex.lock() , invokations boost::mutex::scoped_lock scopedlock(mutex_) ; or unique_lock . thanks teaching :) edit: here tried extract relevant parts of code. since did not understand how sync works, may not make sense... //common part boost::mutex mutex1; boost::mutex mutex2;

html - Table beside a floating image -

i'm trying accomplish thought simple, seems when comes css, never know! i have image float left. beside it, have title , under title, still besides image, want display table taking remaining width. in ie , chrome, table ends under image while in ff, takes more 100% (an horizontal scroll bar displayed). ff gives result closer want, don't want scrollbar. here code tried make work using w3school "try it" editor (http://www.w3schools.com/css/tryit.asp?filename=trycss_float) <html> <head> <style type="text/css"> h1{ font-size:1em; } img { float:left; } .field{ width:100% } </style> </head> <body> <img src="logocss.gif" width="95" height="84" /> <div class="content"> <h1>

xcode - How To Add A Folder Of Images To IKImageBrowserView -

how add folder of images displayed in ikimagebrowserview? thanks check out ikimagebrowserview class reference , there find imagekitdemo . example shows how add photos ikimagebrowserview using directories

activerecord - Rails 3: how to write DRYer scopes -

i'm finding myself writing similar code in 2 places, once define (virtual) boolean attribute on model, , once define scope find records match condition. in essence, scope :something, where(some_complex_conditions) def something? some_complex_conditions end a simple example: i'm modelling club membership; member pays fee , valid in year . class member < activerecord::base has_many :payments has_many :fees, :through => :payments scope :current, joins(:fees).merge(fee.current) def current? fees.current.exists? end end class fee < activerecord::base has_many :payments has_many :members, :through => :payments scope :current, where(:year => time.now.year) def current? year == time.now.year end end is there dryer way write scopes make use of virtual attributes (or, alternatively, determine whether model matched conditions of scope)? i'm pretty new rails please point out if i'm doing stupid! no, there

c# - How can I generate Service Model Metadata without rebooting -

i have simple wcf service application (based on tutorial : getting started ). problem when add function application , want re-generate proxy.cs file using command below: c:\kod>svcutil.exe /language:cs /out:proxy.cs /config:app.config http://localhos t:8000/pbmb i following result. solution know re-generate files reboot computer. doing every time change frustrating. can help? result: microsoft (r) service model metadata tool [microsoft (r) windows (r) communication foundation, version 4.0.30319.1] copyright (c) microsoft corporation. rights reserved. attempting download metadata ' http://localhost:8000/pbmb ' using ws-metad ata exchange or disco. error: cannot import wsdl:porttype detail: exception thrown while running wsdl import extension: system.se rvicemodel.description.datacontractserializermessagecontractimporter error: schema target namespace ' http://pbmb ' not found. xpath error source: //wsdl:definitions[@t

Removing an element permanently in jQuery -

when append element , afterwards remove object still exists? bg = $('<div class="dialog_bg"></div>'); $('#'+elm).append(bg); bg.remove(); how that? isn't possible remove element permanently? so element removed dom completely. that's fine. question how ensure element removed. i'd use .parent() method that. because if element removed dom won't have parent anymore. may faster $("html").has(bg) because doesn't have traverse whole dom tree. bg = $('<div class="dialog_bg"></div>'); $('#'+elm).append(bg); bg.remove(); if(bg.parent().length == 0) { // removed succesfully } else { // still somewhere in dom } // tells garbage collector free memory because there's no way access element anymore bg = null;

javascript - Is there a JS equivalent to CSS text-transform: capitalize? -

i've got hidden <section /> comprised of divs contain content stuffed jquery ui dialog. on document.ready want loop through divs, take id of each respective div, replace dashes spaces, capitalize each word, , store in title variable. then, i'm going use in object literal gets put dialogs[] array. sounds simple, right? stripped down version of html: <section id="dialog-content" class="hidden"> <div id="some-dialog"> // awesome dialog content here </div> <div id="another-dialog"> // awesome dialog content here </div> <div id="modal-dialog"> // awesome dialog content here </div> </section> stripped down version of javascript: var dialogs = [], $container = $("#dialog-content"); $content = $container.find("> div"); $content.each(function (i) { var $this = $(this),

c# - How to get the list index of the nearest number? -

how list index can find closest number? list<int> list = new list<int> { 2, 5, 7, 10 }; int number = 9; int closest = list.aggregate((x,y) => math.abs(x-number) < math.abs(y-number) ? x : y); if want index of closest number trick: int index = list.indexof(closest);

php - Facebook Connect: Load New Page After Login -

i'm looking replicate flow of airbnb's login system, on website: 1) user logs in via facebook: https://www.airbnb.com/login 2) once user authenticated, new page loads: http://www.airbnb.com/home/dashboard i imagine has onload attribute of fb:login-button, i'm of noob it. can point me in right direction? thank in advance! once logged, in run following js: window.location = "http://www.airbnb.com/home/dashboard";

ruby on rails - Manually setting return_to with devise -

i using devise authenticate users on app. it's working great point, having trouble specific action: view: <p id="save"><%= link_to "save", new_save_path, :remote => true %></p> saves_controller.rb: def new if user_signed_in? @save = save.create(:user_id => current_user.id) render :update |page| page.replace_html "save", "saved!" end else redirect_to new_user_session_path, :notice => "you need sign in that." end end as can see, because action ajax one, can't use traditional before_filter :authenticate_user! method. instead redirecting user sign in page. the problem is, want automatically redirect user previous page when logged in. i understand can session[:"user.return_to"] i'm having trouble setting it. how can this? or going wrong? i believe session key :"#{scope}_return_to , :user_return_to user class.

java - big-o order of recursive and iterative fib functions? -

Image
i asked write fib function in efficient manner? this implementation provided: public static int fib(int n) { int prev1 = 1, prev2 = 1, ans = 1, = 3; while (i <= n) { ans = prev1 + prev2; prev1 = prev2; prev2 = ans; i++; } return ans; } is efficient? big-o order? i asked give big-o notation of recursive implementation: public static int recursivefib(int n) { if (n <= 2) return 1; else return recursivefib(n-1) + recursivefib(n - 2); } i think 1 exponential 2^n why it's inefficient. i best way find fib particular n using matrix calculation method given in link - page19 where f0 = 0 , f1 = 1. matrix relation can easlily used find fib value of n , n+1. best part is multiplying matrix need not mutliplied n times logn times find actual value of multiplier. overall compleixty of algorithm o(logn). the equation derived basic relation of f1 = 0*f0 + 1*f1 f1 = 1*f0 + 1*f2 i

php - Nested foreach statements are invalid. Help? -

Image
please forgive extreme-beginner style of coding. i'm working php , json strings api first time. what i'm trying here, doesn't work if through it, print out multiple movie results user searching for. search results page - movie poster , key details next each item. one of things want next each result list of first 5 actors listed in movie, "starring" , directors listed in movie "director". the problem no doubt fact i've nested foreach statements. don't know other way of doing this. please please simplest answer best me. don't mind if it's bad practice, whatever solves quickest perfect! here's code: // check if there results if ($films_result == '["nothing found."]' || $films_result == null) { } else { // loop through each film returned foreach ($films $film) { // set default poster image use if film doesn't have 1 $backdrop_url = 'images/placeholder-film.gi

ruby - Datamapper do_postgres gem error: "dyld: lazy symbol binding failed: Symbol not found: _PQsetdbLogin" -

i'm trying run sinatra application datamapper , postgres db locally. i'm on mac os x 10.6.7 , ruby 1.9.2 , each time launch application, following error: dyld: lazy symbol binding failed: symbol not found: _pqsetdblogin referenced from: /ruby-1.9.2-p136/gems/do_postgres-0.10.5/lib/do_postgres/do_postgres.bundle expected in: flat namespace does have idea why such error? thanks lot probably use different version of libpq library ruby driver expected. check version of libpq. pavel

caching - C# - Why does the first iteration of this loop run slower than the rest? -

i'm doing bit of benchmarking test something. i've got large array of 100 million 64 bit ints, randomly choose 10 million of , few operations. indexes randomly chosen because i'm trying keep cpu caching as can, while still getting accurate benchmark. first iteration of loop takes .3 seconds, of others taking .2 seconds. guess parts of cone[] still in cache, think array of size wouldn't able store much. other thoughts? perhaps jit issue? static void main(string[] args) { int64[] cone = new int64[100000001]; (int m = 0; m < 20; ++m) { int[] num2 = new int[10000001]; random rand = new random(); (int = 0; < 10000000; ++i) { num2[i] = rand.next(100000000); } datetime start = datetime.now; (int = 0; < 10000000; ++i) { cone[num2[i]] = i; if (cone[i] > 0) ++cone[i]; }

c++ - Why isn't my pointer NULL? -

i have linked list of families. delete 1 of childs siblings so. p->mywife->mychildren=p->mywife->mychildren->mysibling; //makes sibling child list not broken when deleting delete p->mywife->mychildren->mysibling; and later print child/siblings attributes based upon this if(p->mywife->mychildren->mysibling!=null){ print childs attributes } whenever print though, prints weird number sibling (im assuming memory address) need make pointer null? deleting pointer doesn't set zero. deallocates memory being pointed pointer. set null have set null yourself. p->mywife->mychildren->mysibling = null /*defined 0 */;

ruby - ROR + Error For nil:NilClass In Rake Task -

in rake command calling xml retrieve data. if person_id valid, saved. getting error. if !@case.person_id.nil? @project.team_members << @person end error :: rake aborted! undefined method `team_members' nil:nilclass please suggest thing !!! @project nil variable , why cannot invoke team_members. check how define it. moreover, may want follow ruby way of doing things. 'if not' occasions better write : unless @case.person_id.nil? ...

live wallpaper - LiveWallPaper Change notifications in Android -

just wondering whether possible detect livewallpaper changes in android. looked action_wallpaper_changed already. works wallpapers not livewallpapers. thanks it isn't perfect, if put wallpaper check method in onresume should work because wallpaper have been changed separate activity means activity has been paused. won't work if wallpaper changed background code, doesn't happen live wallpapers. how done in adwlauncher.

perl - Archiving text log files in postgresql -

we writing testing framework scratch using perl. each test case writes log file , planning archive resulting log files created each test case reporting purposes. now using postgresql database storing results. how archive text log file in postgresql database? googled , found out bytea datatype can used store files in binary format. if how retrieve text?. any ideas appreciated. if log files text files, should use text datatype store them. if log files binary (or, perhaps, compressed text files), you'd want use bytea . in either case, can insert , select them other column type when using dbi. if they're large might want play longreadlen dbi parameter , read dbi manual section on blobs .

android - How to return value from helper class with AsyncTask -

i trying design helper class implements methods using asynctask. public interface resultcallback { public string processresult(); } public class serveradapter { // required processresult call method. kind of lousy not know // how throw exception onpostexcecute in asynctask. public string getresult() throws airplanemodeexception, nonetworkexception { // code return value dowork throw exceptions on errors } public void getlicense(resultcallback licensecallback) { ...// set url, outmessage new dowork(url, outmessage, licensecallback).execute(); } public void queryserver(int queryid, arraylist<string> args, resultcallback querycallback) { ...// set url, outmessage new dowork(url, outmessage, querycallback); } private class dowork extends asynctask<void, void, string> { ... private resultcallback rc; public dowork(string url, string outmessage, resul

richfaces - rich:editor formatting -

i using rich:editor create content in application. storing content data in string property in backend bean , persisting database using hibernate. problem whenever applying formatting style alos coming content , stored database. want save data in html formate , view again in rich:modalpanel. please help. eg. can use h:outputtext value="#{question.qtext}" escape="false" the value="#{question.qtext}" text stored html :). , escape="false" rest.

cocoa - Mind boggling QTMovie export crash -

hey guys... i'm @ wits end here. i've been focusing on issue last 3 days seems, , i'm still no closer solving it. i've got queue of videos i'm converting 1 after other in background thread. of time works expected, every often, weird crash, @ same point. can't life of me figure out why it's happening. i've got garbage collection enabled. here conversion code. here stack trace. edit: after bit more debugging, conclusion maybe garbage collector related. if place following line before line converts video, drastic increase in amount of these errors see... [[nsgarbagecollector defaultcollector] collectexhaustively]; nsinvalidargumentexception -[nspathstore2 objectforkey:]: unrecognized selector sent instance 0x1073570 ( 0 corefoundation 0x92fc16ba __raiseerror + 410 1 libobjc.a.dylib 0x901b4509 objc_exception_throw + 56 2 corefoundation 0x9300e90b -[nsobject(nsobject

.net - how to get all selected checkboxes node name in TreeView using c# 4.0? -

i have treeview checkbox in c# windows form based application.the user select item clicking checkboxes in nodes. want selected checkboxes node name whenever clicking getselectedlist button pressed user.how it?. please guide me out of issue... you can use simple recursive function: list<string> checkednames( system.windows.forms.treenodecollection thenodes) { list<string> aresult = new list<string>(); if ( thenodes != null ) { foreach ( system.windows.forms.treenode anode in thenodes ) { if ( anode.checked ) { aresult.add( anode.text ); } aresult.addrange( checkednames( anode.nodes ) ); } } return aresult; } just use on yourtreeview.nodes

python - TemplateSyntaxError at / Caught IOError while rendering: (13, 'Permission denied') -

this error shown on page tracebackfile "/usr/local/lib64/python2.6/site-packages/django/core/handlers/base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) file "/usr/local/lib64/python2.6/site-packages/django/views/generic/simple.py" in direct_to_template 28. return httpresponse(t.render(c), mimetype=mimetype) file "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render 123. return self._render(context) file "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in _render 117. return self.nodelist.render(context) file "/usr/local/lib64/python2.6/site-packages/django/template/base.py" in render 744. bits.append(self.render_node(node, context)) file "/usr/local/lib64/python2.6/site-packages/django/template/debug.py" in render_node 73. result = node.render(c

android - Convert bitmap array to YUV (YCbCr NV21) -

how convert bitmap returned bitmapfactory.decodefile() yuv format (simillar camera's onpreviewframe() returns in byte array)? here code works: // untested function byte [] getnv21(int inputwidth, int inputheight, bitmap scaled) { int [] argb = new int[inputwidth * inputheight]; scaled.getpixels(argb, 0, inputwidth, 0, 0, inputwidth, inputheight); byte [] yuv = new byte[inputwidth*inputheight*3/2]; encodeyuv420sp(yuv, argb, inputwidth, inputheight); scaled.recycle(); return yuv; } void encodeyuv420sp(byte[] yuv420sp, int[] argb, int width, int height) { final int framesize = width * height; int yindex = 0; int uvindex = framesize; int a, r, g, b, y, u, v; int index = 0; (int j = 0; j < height; j++) { (int = 0; < width; i++) { = (argb[index] & 0xff000000) >> 24; // not used r = (argb[index]

Adding consecutive integers from an input (Translated from Python to C++) -

i'd request on hw. think i'm close figuring out. our compsci class shifting learning python (introductory) c++. since 2 vaguely similar, we've been advised, since we're beginners, code problem in python (which we're familiar with) , translate c++ using basics learned. problem solve simple "add consecutive integers 1 number, given positive integer input." example be: >>enter positive integer: 10 >>1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55 the python code (this successful) i'm attempting translate c++ is: num = int(raw_input("enter positive integer: ")) sum = 0 in range(1, num): sum += print i, "+", print num, "=", sum+num and unsuccessful c++ code: #include <iostream> using namespace std; int main() { int num; int sum; int i; sum = 0; cout << "please enter positive integer: " << endl; cin >> num; (i=0; 1 <= num; i++)

c# - The process cannot access the file 'C:Project\App_Data\Database.mdf' because it is being used by another process -

i'm getting following error: the process cannot access file 'c:project\app_data\database.mdf' because being used process. how can solve it? it's used process, maybe sql server service. use unlocker find process , take appropriate action. careful: if'you re using vs, have opened db connection during development.

oracle - one-to-many relationshipt with database constrain and inverse=true -

there 2 classes , b , hibernate mappings <hibernate-mapping default-lazy="false"> <class name="a" table="a"> <id name="id" type="long"> <generator class="sequence"><param name="sequence">a_sequence</param></generator></id> <set name="a" cascade="all" inverse="false" > <key><column name="a_fk" not-null="true" /></key> <one-to-many class="b" /></set> </class> </hibernate-mapping> <hibernate-mapping default-lazy="false"> <class name="b" table="b"> <id name="id" type="long"> <column name="id"/> <generator class="sequence"><param name="sequence">b_seque

python - Correct way to use the signal closeEditor in QStyledItemDelegate? -

i overriding qstyleditemdelegate class , reimplementing eventfilter function can customize editor behavior when tab press detected. however, following not working. correct way invoke closeeditor signal? class customdelegate(qstyleditemdelegate): def __init__(self, parent=none): super(customdelegate, self).__init__(parent) def eventfilter(self, editor, event): if (event.type() == qevent.keypress , event.key() == qt.key_tab): print "tab captured in editor" self.commitdata.emit(editor) #this working self.closeeditor.emit(editor) #this not seem anything?? return true return qstyleditemdelegate.eventfilter(self,editor,event) this old question, ran same issue , found question. i solved changing the self.closeeditor.emit(editor) line to self.closeeditor.emit(editor, qabstractitemdelegate.nohint) . the commitdata call setmodeldata . if don't call closeeditor , se

How to create a custom color picker dialog or popup screen in BlackBerry -

how create custom color picker dialog or popup screen in blackberry (i.e selecting color form color picker dialog set control or other mnger) just idea of possible implementation: it should popupscreen holds gridfieldmanager containing set of small custom fields (e.g. 8x8 matrix). each small custom field painted in color , "listens" clicks in navigationclick() . when click caught small custom field notifies screen selected color. screen closes , notifies client/caller via callback passed screen on creation.

jdbc - How to edit database table in JSF -

i'm having bean class id,firstname,lastname attributes having public getters , setters, , updateemployee method. i'm using following jsf page database table values. when click on update button success page shown values not changing in database. can 1 tell me reason why vales not getting change in database? thanks in advance. jsf page: <h:datatable value="#{tablebean.employeelist}" var="employee" border="1"> <h:column> <f:facet name="header">first name</f:facet> <h:inputtext value="#{employee.firstname}" /> </h:column> <h:column> <f:facet name="header">last name</f:facet> <h:inputtext value="#{employee.lastname}" /> </h:column> </h:datatable> <h:commandbutton value = "update" action="#{employee.updateemployee}"/> employee.java: public string up

ios - About HTML5 offline storage & cache for iPad app -

why html5 rocks ? if use 1 word answer, think "cross-platform". you can build products using html5 1 time , distribute different platform such web , ipad etc. but after research, found several problems html5 family tech not robust : there lot of randomness , , not easy control storgage limited : no clear answer max size (?) , , sure there limitation of storage not best user interaction : compared native ios app any other problems think ? and if html5 guru,maybe correct wrong understanding of mine. the biggest problem me right html5 not standard . it's not complete specification. but has been problem building web applications; implements them different degrees of completeness, , have vigilant of implementation variations. if end having maintain multiple versions of same code each browser anyway, start question whether "it works everywhere" argument sound anymore.

android - How to detect whether screen is on or off if API level is 4? -

i wondering know how detect screen dim or brightness on android 1.6. i've found solution on api level 7. easy develop : powermanager pm = (powermanager) getsystemservice(context.power_service); boolean isscreenon = pm.isscreenon(); but need solution android 1.x. can suggest me ? thanks. for screen on-off state, can try action_screen_on , action_screen_off intent s, shown in blog post: http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/

rails activerecord metasearch undefined method -

i'm new rails , need should simple problem. when run code: @search = user.search(params[:search]) @foundusers = @search.all.paginate :page => params[:page], :per_page => 20 @user = @search.where("users.id = ?", params[:id]) if @user.nil? @user = @foundusers.first end unless @user.company_id.nil? @company = company.find(@user.company_id) end i following error statement: undefined method `company_id' # i dont understand because query on database correct (select users.* users left outer join companies on companies.id = users.company_id (((users.firstname '%s%' or users.lastname '%s%') or companies.name '%s%')) , (users.id = '11')) and company_id user not empty. when type puts @user.name, instead of giving me user name, gives me 'user' many help. although database 'users' table has column called 'company_id' user model has property called 'company'. try unless @us

syntax - C++ linked error ld returned 1 exit status -

i trying compile keep getting error, see mistake is? c:\users\brian'~1\appdata\local\temp\cc2feaaa.o(.text+0x368) in function `main': [linker error] undefined reference `secant(double, double, double, double, double, double, double, double, double&, int&, double) c:\users\brian'~1\appdata\local\temp\cc2feaaa.o(.text+0x368) ld returned 1 exit status using namespace std; #include<iostream> #include<cmath> #include<iomanip> #include<fstream> // declaration of functions used void writetable (double, double, double, double); void secant(double, double, double, double, double, double, double, double, double&, int&, double); void writedata (double, double, double); double fx( double, double, double, double, double, double, double); const double tol=0.0001; // tolerance convergence const int max_iter=50; // maximum iterations allowed // main program int main() { int iteration; // number of iterations dou

android - Mysql to json.....how to find out the right query -

i'm implementing alternative android market, have mysql , i'm implementing android client. android interact mysql tnx o php translate mysql query result in json, layer @ moment doesn't exist. i'm making query manually through phpmyadmin, exporting query result in xml (cause can't export straight o json) converting xml json online xml json converter ex. http://extjs.org.cn/xml2json/xml2json_online.php now did first activity of android client shows list of apps available. easy caue data need in table applicazione. when click on app should open detail of application in android market. problem new page requires more info cause shows details of developper, preview images of app, ratings of app , user wrote , on.........so have query not 1 table 5 different tables in join: this query tried: select `applicazione_id` , `applicazione_prezzo` , `applicazione_icona_path` , `applicazione_nome` , `applicazione_descrizione` , `applicazione_download_num` , `applicazione_

regex - Exclude thumb folder from url RewriteRule with regular expression -

rewriteengine on rewriterule ^(.+)\.jpg$ watermark.php?image=$1\.jpg [l] rewriterule ^(.+)\.gif$ watermark.php?image=$1\.gif [l] rewriterule ^(.+)\.png$ watermark.php?image=$1\.png [l] rewriterule ^(.+)\.bmp$ watermark.php?image=$1\.bmp [l] i want exclude thumbnails applying watermark: http:// ... /gallery/photos/4db83e206ae00/4db83e559209e.jpg yes! http:// ... /gallery/photos/4db83e206ae00/thumb/4db83e559209e.jpg no! you can this: rewritecond $1 !/thumb/ rewriterule ^(.+)\.(jpg|gif|png|bmp)$ watermark.php?image=$0 [l]

java - help with hangman sorting -

i need sort my letters guessed alphabetically. know need use array.sort cant figure out how. need make program asks if want play again after game on , i've tried make work cant seem right. please help. thank you import java.io.bufferedreader; import java.util.arrays; import java.io.ioexception; import java.io.inputstreamreader; import java.util.random; public class drmproject2 { public static void main( string[] args ) { hangmansession hangmansession = new hangmansession(); hangmansession.play(); } } class hangmansession { private player player; private words secretword; private letterbox letterbox; private int wrongguesscount = 6; public hangmansession() { player = new player(); player.askname(); secretword = new words(); letterbox = new letterbox(); } private void printstate() { letterbox.print(); system.out.print( "hidden word : " );

c# - Datatable group by issue r.Field<T> -

i searching datatable group option , found solution in stackoverflow. datatable t = // var groups = t.asenumerable() .groupby(r => r.field<t>("columnname")) what mean... r.field<t> . why field<t> ? can't here specify r.field<customer> . read http://blogs.msdn.com/b/adonet/archive/2007/02/05/type-safety-linq-to-datasets-part-2.aspx edited : 1) why field? field<t> method : datatable not typed one,the values saved object. field method returns value of column generic type parameter, enable type checking. if typed datatable can field<customer.id> -

c# - Custom Validation is only run once -

i creating mvvm silverlight application , trying add validation model. in particular instance have multiple phone number boxes , have requirement @ least 1 phone number must entered. facilitate have properties (homephone, workphone, mobilephone , otherphone) on model decorated customvalidation attribute. example property: private string _otherphone; [customvalidation(typeof(mymodel), "validatephonenumbers")] public string otherphone { { return _otherphone; } set { if (_otherphone == value) return; _otherphone = value; validator.validateproperty(value, new validationcontext(this, null, null) { membername = "otherphone" }); raisepropertychanged(() => homephone); raisepropertychanged(() => workphone); raisepropertychanged(() => mobilephone); raisepropertychanged(() => otherphone); } } along custom validator its