Posts

Showing posts from August, 2012

ruby on rails - ActiveRecord::NoDatabaseError: FATAL: database "gvpmahesh" does not exist -

i trying run rake test getting error rake aborted! activerecord::nodatabaseerror: fatal: database "gvpmahesh" not exist /home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `rescue in connect' /home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect' /home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize' /home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new' /home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection' /home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/connection_

javascript - AngularJS ng-include in direcive link doesnt work -

i have created directive link function contains element ng-include . element ng-include doesn't work. know why doesn't work? app.directive('helloworld', function () { return { link: function (scope, elem, attrs) { var div = document.createelement('div'); div.setattribute('ng-include', "page2.html'"); elem.append(div); } }; }); you added didn't compiled it, after compile working. app.directive('helloworld',['$compile', function ($compile) { return { link: function (scope, elem, attrs) { var div = document.createelement('div'); div.setattribute('ng-include', "'page2.html'"); elem.append(div); $compile(div)(scope); } }; }]) here link

angular - "selected" tag on option doesn't work when select has formControlName -

<div class="form-inline"> <label class="text-color">lokalizacja:</label> <select class="form-control dropdown" formcontrolname="localization"> <option value="gdańsk" selected>gdańsk</option> <option value="rzeszów">rzeszów</option> <option value="wrocław">wrocław</option> </select> </div> don't know happened in case there no selected option , have choose list. when delete formcontrolname="localization select, gdańsk selected @ start. lokalization control looks localizationctrl = new formcontrol("", validators.required); there no difference when replace on: localizationctrl = new formcontrol(""); of course next step add control offerform doing: ... localization: this.localizationctrl ... but please don't try problem here because have 7 other validators inside offerform , of them w

php - WooCommerce product - Displaying post_content value of product object -

when use: print_r($product); it returns following: wc_product_simple object ( [id] => 156 [post] => wp_post object ( [id] => 156 [post_author] => 1 [post_date] => 2016-07-01 08:59:05 [post_date_gmt] => 2016-07-01 06:59:05 [post_content] => single product picture ..... how echo out value [post_content] ? i using wordpress woocommerce plugin. thanks. as can see $product object contains post object (and not arrays). try 1 of this: $product_content = $product->post->post_content; echo $product_content; // or directly // echo $product->post->post_content; or 1 should work too: $_product = $product->post; echo $_product->post_content;

Does the community edition of VoltDB support Passive Database Replication? -

i tried experiments want know differences between community of voltdb , enterprise.and did this: 1. wrote words deployment.xml of master cluster: <dr id="1" /> 2. started master cluster successd. [the master cluster started successfully.][http://i.stack.imgur.com/bo5e9.png] 3. wrote words deployment.xml of replica cluster: <dr id="2"> <connection source="voltsvr1" /> </dr> 4. created table master cluster: create table store ( keyspace varbinary(128) not null, key varchar(128) not null, value varbinary(2056) not null, primary key (keyspace, key) ); partition table store on column key; dr table store; 5. started replica cluster --replica option: [the replica cluster started successfully.][http://i.stack.imgur.com/5zbxj.png] 6. used same statements create same table store table in master cluster

sh - How to send files from Linux (informatica Server) to File Server(windows) -

i need create shell script send files linux windows. possible? can use informatica, i'm newbie on application. thanks helping me in advance. you can use ssh protocol , -scp command via terminal. https://support.suso.com/supki/ssh_tutorial_for_linux

Powershell Standard Verbose to a variable -

i've written script this, use $output1 in order redirect output of standard verbose . $output1 = $( cmdlet1 [some parameters] -verbose | % { cmdlet2 [other parameters] -verbose } ) 4>&1 when not store standard verbose in variable, prints in powershell in way, newline. when capture standard verbose in $output1 and save in file, prints in 1 long single line. how can store in variable standard verbose in way? as far know there no easy syntax this. why? because pipeline output otherwise interfere verbose, warning , error messages. there still workaround, little more complex. redirect verbose output temporary file, content, remove file. take look: $resultfile = [system.io.path]::gettempfilename(); 1| % { $x = [system.io.path]::gettempfilename(); rm $x -verbose } 4>$resultfile $result = cat $resultfile rm $resultfile in example: $resultfile = [system.io.path]::gettempfilename(); $( cmdlet1 [some parameters] -verbose | % { c

Counting and showing Duplicates in DataTable vb.net -

i having issues trying count / show duplicate records in datatable. for example have datatable multiple columns. eg item (colum1) | 111 112 113 111 112 112 112 114 i want try , create datatable form outputs following item (colum1) | counter (colum2) 111 2 112 4 113 1 114 1 so query selects results in first column , groups them 1 row per unique item number. second column number of occurrences of item number. select colum1 item, count(colum1) counter tablename group colum1;

css - Browser Doesn't Recognize Icons Of FontAwesome -

there problem me icons not showing in browser. can not able find out browser doesn't have fontawesome font not showing when internet connected please can me this. .checkbox { padding-left: 20px; } .checkbox label { display: inline-block; position: relative; padding-left: 5px; } .checkbox label::before { content: ""; display: inline-block; position: absolute; width: 17px; height: 17px; left: 0; margin-left: -20px; border: 1px solid #cccccc; border-radius: 0px; background-color: #fff; -webkit-transition: border 0.15s ease-in-out, color 0.15s ease-in-out; -o-transition: border 0.15s ease-in-out, color 0.15s ease-in-out; transition: border 0.15s ease-in-out, color 0.15s ease-in-out; } .checkbox label::after { display: inline-block; position: absolute; width: 16px; height: 16px; left: 0; top: 0; mar

Unable to retrieve job history beyond 2 months in BigQuery Web UI -

i want repeat load job table created 3 months ago, able see 2 months of job history in bigquery browser ui. table schema used in specific load job. is there way view it? use jobs.list in bigquery api : lists jobs started in specified project. job information is available 6 month period after creation you use cli tool: bq ls --jobs --all or, use audit logs too.

php - Form Sending Email but Showing blank Page -

i have homepage on testing server. when submit form, page shows blank page, sending email. the second problem is, checkbox values not shown in email, don't think read php-file... my button has proper type (submit), don't have spelling mistakes in names...and not php, therefore don't know, wrong. appreciated. html-code <form action="contact.php" id="form" method="post" name="send"> <span class="input input--kuro"> <div class="row"> <h3 class="big-blue">kontaktformular</h3> <h2 class="small-grey">bitte füllen sie das formular aus, damit wir ihnen ein individuelles angebot zukommen lassen können.</h2> </div> <div class="row"> <div class="row"> <div class="input-wrapper col-md-4 col-centered"> <input class="requiredfield name subscribe-requiredfield input__field input__field--kuro&q

c++ - Tiles not rendering in SFML despite basically being a dressed up rectangle class -

class tile : public sf::rectangleshape { public: tile(); tile(float); ~tile(); void highlighttile(); bool istilehighlighted() const; void turnoffhighlight(); private: sf::rectangleshape m_tile; bool m_ishighlighted; }; tile::tile() { } tile::tile(float squaredim) : m_tile(sf::vector2f(squaredim, squaredim)), m_ishighlighted(false) { } bool tile::istilehighlighted() const { return (m_tile.getoutlinecolor() == sf::color::yellow); } void tile::turnoffhighlight(){ m_tile.setoutlinethickness(0); } void tile::highlighttile() { m_tile.setoutlinethickness(5); m_tile.setoutlinecolor(sf::color::yellow); } tile::~tile(){ } grid::grid(float squaredim) { tile tilepiece(squaredim); sf::vector2f position(0, 0); int counter = 0; //counter whether column or odd int counter1 = 0; //counter whether on or odd row (int row = 0; row < 8; row++) { (int column = 0; column < 8; column++) { if (coun

angular - how to update parent component from child component in angular2 -

i looking angularjs isolated(= operation) scope similar feature in angular2. change parent component value in child component, don't need use eventemitters. following code snippet. <component-1> <div *ngfor="let row of listarray" > <component-2 [inputdata]="row.inputdata" (outputevent)= "oncomponentchange($event)"> </component-2> </div> <component-2 [inputdata]="inputdata2" (outputevent)= "oncomponentchange($event)"> </component-2> <component-2 [inputdata]="inputdata3" (outputevent)= "oncomponentchange($event)"> </component-2> <component-2 [inputdata]="inputdata4" (outputevent)= "oncomponentchange($event)"> </component-2> @component component-1{ oncomponentchange(newvalue){ //where keep new value //this.inputdata2/inputdata3/inputdata4/listarray[i].inputdata ??????????? } } @component c

r - shiny app + Google Auth + roles -

i have shiny app per restrict access using googleauth . i'm wondering whether there's way can attach roles google accounts according differentiate access features of app. some parts of google apps api docs sound should possible in principle have no idea how make work in practice.

c# - How to Call Controller Method in File Upload Using Angularjs Webapi -

i trying upload multiple file using angularjs , webapi.. html table: <body ng-app="fupapp"> <div ng-controller="fupcontroller"> <input type="file" id="file" name="file" multiple onchange="angular.element(this).scope().getfiledetails(this)" /> <input type="button" ng-click="uploadfiles()" value="upload" /> <!--add progress bar element.--> <p><progress id="pro" value="0"></progress></p> </div> </body> here angularjs code multiple file upload(fileupload.js): var myapp = angular.module('fupapp', []); myapp.controller('fupcontroller', function ($scope) { // file information. $scope.getfiledetails = function (e) { debugger; $scope.files = []; $scope.$apply(function () { debugger;

ios - MKMapView how to change the User Nearest location pin image? -

i want change user nearest location pin image in map view. "in project show of shop locations in map view. locations (lat,long) api. here changed given location pin image. works fine. need change user nearest location pin image in map view. distance details user current location given api locations in locations below 5 miles location pin images need change. " here annotation code: // view annotation delegate code changing pin image. -(mkannotationview *)mapview:(mkmapview *)mapview viewforannotation: (id<mkannotation>)annotation { [self.annotationcustom_view removefromsuperview]; [self.annotationcurrentloc_view removefromsuperview]; static nsstring *identifier = @"myannotation"; custommapviewannotation * annotationview = (custommapviewannotation *)[self.locationsmap_view dequeuereusableannotationviewwithidentifier:identifier]; if (!annotationview) { annotationview = [[custommapviewannotation alloc] initwithannotation:annotation reu

java - How can I get the IP of the client that is sending request? -

Image
well new , don't know how it, senior fellows please help!!!! there situation described below: an http client sending request (request can of type, not concerned regarding request type) directly hits loadbalancer. loadbalancer redirects traffic, based on load of traffic, towards "gateway" system running in 2 v440 server, gw logic written in java, logically routs request towards 2 server nodes process request. now scene that: there several parallel connections established gateway several http clients. 1 connection per client. has been observed that, while making connections gw, in case of clients cpu utilization going 98-99%. client creating 1 connection gw on particular port. opens socket connection: serversocket _ss = new serversocket(_port); socket s = _ss.accept(); and gw waits input come client. now question is: why kind of situation happening, seems fine rest of clients , there connections. few clients creating connections gw making situation?

amazon ec2 - How to stop old instance from ELB in ansible? -

i have playbook creates , add instance load balancer, way can remove/stop old instance assigned elb, want make sure stop old instance first , new 1s added or vice verse. using aws elb , ec2 instance i hope might you. once have instance id can whatever want, removing elb can use ec2 module remove it. --- - hosts: localhost connection: local gather_facts: no tasks: - name: facts elb ec2_elb_facts: names: rbgeek-dev-web-elb region: "eu-west-1" register: elb_facts - name: instance(s) id register elb debug: msg: "{{ elb_facts.elbs.0.instances }}" - name: tag old instances zombie ec2_tag: resource: "{{ item }}" region: "eu-west-1" state: present tags: instance_status: "zombie" with_items: "{{ elb_facts.elbs.0.instances }}" - name: refresh ec2.py cache shell: ./inventory/ec2.py --refresh-cache changed_whe

java - Configure custom server for handling oauth 2.0 in spring -

i totally new spring , oath 2.0. want know /oauth/token works. in examples shown /oauth/token in configuration file. suppose have external api handle functionality, example http://mydemo.com/api/oauth/token . how can able configure in configuration file. below current configuration file. <?xml version="1.0" encoding="utf-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:oauth="http://www.springframework.org/schema/security/oauth2" xmlns:sec="http://www.springframework.org/schema/security" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-1.0.xsd http://www.springframework.org/schema/mvc http://www.spri

Android mnifest file merging error tool:allowBackup=true -

i facing merging issue in android manifest file can tell me how can solve issue. manifest code <application tools:replace="android:allowbackup=true" android:allowbackup="true"> error /users/desktop/iosgit/app/src/main/androidmanifest.xml:27:5-46:19 error: tools:replace specified @ line:27 attribute android:allowbackup=true, no new value specified /users/desktop/iosgit/app/src/main/androidmanifest.xml error: validation failed, exiting <application android:allowbackup="true" tools:replace="android:allowbackup"/>

Is it possible to open an iOS app from certain links in the website? -

i have managed ios 9 universal links work, if user sent email link http://www.exampledomain.com/payment can open in app. but have not been able working if user in safari , on site ( http://www.exampledomain.com ), , clicks on payment link direct them http://www.exampledomain.com/payment , not open in app. possible app open in way? i had same scenerio , found solution via deeplink , need make urlscehme mobile site , can of our server . for instance : share url of http://www.exampledomain.com/payment if user tap on redirect our server , server detect device type mobile redirect urlscheme yourappurlschme://payment if app installed open other ways redirect itune download or webapge. pasting link helpfull. http://www.brianjcoleman.com/tutorial-deep-linking-in-swift/ how open native ios app web app

powershell - search for images in a .xml file and extract and create them (dummys) -

can me out please? sls '\d*\s*.jpg' .\test.xml -ca).matches | select -exp value as mathias pointed out in comments, select-string not available prior powershell v3. can replaced where-object filter: get-content 'c:\path\to\file.txt' | where-object { $_ -match 'expression' }

PHP MYSQL date range missed days -

in db, there 26th , 31st days not changing ok. getting 3rd day , change ok. where wrong in code? code: *$from = date("y-m-01"); $to = date("y-m-t"); // last day current month $query = "select date tbl_data date between '$from' , '$to' order date desc"; $result = mysqli_query($mysqli,$query); while ($row = mysqli_fetch_array($result, mysql_assoc)) { $date = date_create_from_format('y-m-d', $row['date']); } $cursor = date_create_from_format('y-m-d', $from); $finish = date_create_from_format('y-m-d', $to); while ($cursor != $date) { echo date_format($cursor,'y-m-d') . "--- missed <br>"; date_modify($cursor, '+1 day'); while($cursor == $date) { echo date_format($date,'y-m-d') . "--- ok <br>"; date_modify($cursor, '+1 day');

ios - Go to new view on change of search bar swift -

Image
i need go new table view on beginning editing of search bar in current view shown in picture below. so far have created segue per this answer, , used following code in current controller search bar. declarations: lazy var searchbar:uisearchbar = uisearchbar(frame: cgrectmake(0, 40, 140, 40)) in viewdidload: searchbar.delegate = self; and following function ( showsearchresults id of segue): func searchbartextdidbeginediting(searchbar: uisearchbar){ self.performseguewithidentifier("showsearchresults", sender: self) } what want happen new controller appear when click onthe search box, error: 2016-07-28 15:42:25.750 abcapp[7745:3279712] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'receiver (<abcapp.homepageviewcontroller: 0x7b08e910>) has no segue identifier 'showsearchresults'' *** first throw call stack: ----- libc++abi.dylib: terminating uncaught exception of type nsex

Disable SPACE key in EditText android -

i'd created edittext following. <edittext android:id="@+id/et_regis_num" android:maxlines="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:digits="1234567890abcdefghijklmnopqrstuvwxyz" android:hint="@string/txt_reg_num" android:inputtype="textcapcharacters" android:maxlength="10" /> in edittext don't want press space key when i'm pressing space key it's working backspace key. means it's deleting 1 character in each twice press. set inputfilter on edittext . please check below answer it's worked me. inputfilter filter = new inputfilter() { public charsequence filter(charsequence source, int start, int end, spanned dest, int dstart, int dend) { (int = start; < end; i++) { if (character.iswhitespace(source.charat(i))) {

iOS Swift function with type () -> () -

im unable create function of type () -> () in swift xcode... far im @ func successblock() -> void { //code return () } but () not () -> () want function fit type () -> () because of function: func logintofacebookwithsuccess(callingviewcontroller: uiviewcontroller, successblock: () -> (), andfailure failureblock: (nserror?) -> ()) { gonna pass successblock() func variable in there. i have same problem failureblock or on wrong way? thank you, spinhaxo successblock function. need closures. let successblock: () -> () = { // here... } let failureblock: (nserror?) -> () = { error in // error... } if don't want store them, can define them while calling method this: logintofacebookwithsuccess( callingcontroller, successblock: { // here... }, andfailure: { error in // error... } )

java - Examples of use thread safe singleton in multiple threads -

there thread safe singleton, when use singleton in multiple threads? when may helpful? i use stateless singletons implementations of strategy. being stateless, thread safe , there no problem testing them. where problems stateful singletons. leads more interactions, in multi-thread context, unit testing stateful singleton in 1 thread pain (i.e. have reset state between tests). reason, many see singletons anti-pattern avoided. a better approach stateful singletons use dependency injection. way code building components create 1 object, , passed components need it.

create dropdown example in laravel from existnig dropdown list -

i want try dependent dropdown in laravel 5. in main dropdown having several lists like(electronics,automobiles) , 1 of them click or change event. want create whole dropdown . if clicked on electronics 1 dropdown automatic generated electronics. enter image description here if clicked on electronics first dropdown list @ time dropdown automatically generated electornics. , if clicked automobiles first dropdown list should replace last automatically created dropdown electronics. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>dependent drop-down demo</title> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> </head> <body> <h1>dependent drop-down demo</h1> <div class="container"> {!! form::open(['url'=>'demo'] ) !!} <div class="dropdown"> <select

Duplicate name Viewport in React Native -

the terminal simulator executed shows following error: failed build dependencygraph: @providesmodule naming collision: duplicate module name: viewportmetrics paths: /users/fcojriosbello/documents/development/netbeast/node_modules/react/lib/viewportmetrics.js collides /users/fcojriosbello/documents/development/netbeast/node_modules/react-native-router-flux/node_modules/react-native-experimental-navigation/node_modules/react/lib/viewportmetrics.js what version of npm have? have pairdependencies problem try npm v3. anyway if do: rm -rf /users/fcojriosbello/documents/development/netbeast/node_modules/react-native-router-flux/node_modules/react-native-experimental-navigation/node_modules/react/ should work

c# - How to get leaderboard rank using SteamWork.Net? -

i have unity project , have added steamwork.net wrapper project , , in project leaderboard upload / setting statistics etc i have no clue how rank in leaderboard ? let's have leaderboard called "highscore" , how rank in leaderboard ? there method getting scores specific steam users. can send csteamid of local user , details shown below. csteamid[] users = { steamuser.getsteamid() }; // local user steam id steamapicall_t handle = steamuserstats.downloadleaderboardentriesforusers(m_steamleaderboard, users, users.length); . .

android - i want to slide images ,images are coming through json -

Image
i want slide images ,images coming through json . using of code coming in list view . want ten images should come slider .how van this? i want slide image 1 one in horizontal. i getting image see in image . mainactivity public class mainactivity extends activity { // log tag private static final string tag = mainactivity.class.getsimplename(); private static final string url = "http://20dde605.ngrok.io/api/v1/restaurants/get_featured_restaurants"; // movies json url //private static final string url = "http://api.androidhive.info/json/movies.json"; private progressdialog pdialog; private list<movie> movielist = new arraylist<movie>(); private listview listview; private customlistadapter adapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); listview = (listview) findviewbyid(r.id.

Java RS232 communication using Swing and RXTX -

i'm trying communicate between pc (windows 7 using netbeans , rxtx) using serial port. have prolem serial event(public void serialevent(serialportevent arg0)). event should recive data , write them in label (jlabel1.settext("sfazds")). unfortunately event don't change label text , don't why. below code: import gnu.io.commport; import gnu.io.commportidentifier; import gnu.io.serialport; import gnu.io.serialportevent; import gnu.io.serialporteventlistener; import java.io.ioexception; import java.io.inputstream; import java.io.outputstream; import javax.swing.jlabel; import javax.swing.joptionpane; import javax.swing.jpanel; public class rs extends javax.swing.jframe implements serialporteventlistener{ static outputstream out; static inputstream in; public rs() { initcomponents(); } /** * method called within constructor initialize form. * warning: not modify code. content of method * regenerated form editor.

python - Why I output csv file with a blank row -

this code: with open("testoffset.csv") handler: f = open('output_file2.csv', 'w+') f.write('x,y,value\n') r,l in enumerate(handler): col, e in enumerate(l.split(',')): f.write('{0},{1},{2}\n'.format(r+1,col+1,e)) this outputs x y value 1 1 1 1 2 2 1 3 3 ---------- blank row ---------- 2 1 2 2 2 2 2 3 2 ---------- blank row ---------- 3 1 1 3 2 2 3 3 3 ---------- blank row ---------- how can output csv file without blank rows? your lines handler file have newline @ end, write output file. remove newline stripping before split line: for col, e in enumerate(l.rstrip('\n').split(',')): you may want avoid re-inventing csv reading , writing wheels; python comes excellent csv module can work you, including removing newline , splitting lines: import csv open("testoffset.csv", 'rb') handler, open('outpu

how to get the nested array count with key values seperated in php -

this array array ( [2] => array ( [0] => array ( [id] => 2 [res_id] => 1 [grand_total] => 303.42 [time] => 2016-07-28 11:04:38 [status] => 0 ) [1] => array ( [id] => 2 [res_id] => 1 [grand_total] => 303.42 [time] => 2016-07-28 11:04:38 [status] => 0 ) ) [1] => array ( [0] => array ( [id] => 1 [res_id] => 1 [grand_total] => 303.42 [time] => 2016-07-28 11:04:17 [status] => 0 ) ) ) from need sub array count i.e., array having 2 indexes such 2 & 1 2

nginx redirect twice from https to http -

i have 2 servers, 1 has ssl , config this, in server ssl certification(which https:// www.example.com): location ~^/abc/.* { proxy_pass http://www.example.com:8214/ } in server(which http:// www.anotherexample.com): server { listen 8214; server_name www.anotherexample.com; rewrite ^/(.*)$ http://www.anotherexample.com:8080/$1 permanent; } and after access https:// www.example.com/abc/api/getgroup it can't redirect http:// www.anotherexample.com:8080/api/getgroup anything wrong??? there couple of things improve configuration. location ^~ /abc/ { proxy_pass http://www.example.com:8214$uri; #you should have other directives set here well. } also, consider setting upstream . then, server block: server{ listen 8124; server_name www.anotherexample.com; rewrite ^/abc/(.*)$ http://www.anotherexample.com:8080/$1 permanent; } server{ listen 8080; server_name www.anotherexample.com; location ^~ /api/ {

c# - Datepicker between two ages 21 and 25 wpf -

i have made application user selects there date of birth using datepicker . user must on 21 , under 26. if user on 21 , under 26 message box appears saying "success". when select date of birth between 21 , 25 nothing happens. not sure i'm doing wrong here think minusing 21 , 26 selected date in datepicker my code fallows xaml <datepicker horizontalalignment="center" name="dpkdob" grid.column="1" verticalalignment="top" grid.row="10" /> xaml.cs datepicker dp = new datepicker(); datetime dateminimum = dpkdob.selecteddate.value.addyears(-21); datetime datemaximum = dpkdob.selecteddate.value.addyears(-26); // 26, include below 26 years old datetime birthdate = convert.todatetime(dp.selecteddate); if (birthdate > dateminimum && birthdate < datemaximum) { messagebox.show("success"); } y