Posts

PHP - Filter Non Numerals from a string -

i have variable: $number that contain values in these formats: 125.00 125.00 $125.00 i need insert number database, need remove/filter out isn't number whilst retaining decimals points. not sure how/best approach in php? use regex : <?php $num = "125.00"; $num = preg_replace("/([^0-9\.,])/","",$num); $num = (double) $num; // make double allow point , comma $num = (int) $num; // , convert integer echo $num; ?>

javascript - Data not binding properly in angular in list box -

i using below code data in list box. <div class="form-group"> <label class="control-label col-md-6">year built</label> <div class="col-md-6"> <select ng-model="property.yearbuilt" id="yearbuilt" rb-default-year="currentyear" ng-options="year.yearfourdigit year.yearfourdigit year in years"> <option value="">--select--</option> </select> </div> </div> but somoehow data not binding html. getting blank list box 50% of times. can please me in this? i wanted post picture showing seeing, don't have 10 in reputation able that.

sql - Entity Framework 6 with Azure DB secondary connection -

i'm facing problem ef against azure db secondary connection. here problem: i'm using ef 6 code first i setup primary azure db 2 active geo-replicated secondary database (have difference server , db name login account) i use ef6 manipulate primary azure db. case if primary db down (by reason) , want switch active secondary dbs select statements @ runtime. how can achieved that? notes: example, have code snippet below: using (appcontext context = new appcontext()) // appcontext derived dbcontext , using primary connection string { var users = await context.users.tolistasync(); // if line of code failed primary connection string } i want auto-switch dynamically secondary db if line var users... failed @ runtime. recommendation? thanks help!

javascript - AngularJs: Searching with ng-repeat with two different controllers -

i have angular app using 2 tables. top table supposed search data both tables, however, using 2 different controllers. how can top table using simple service or factory? div ng-controller="topctrl"> <tr ng-repeat="data in mydata | filter:search"> <td><input type="checkbox"/></td> <td>{{ data.number }}</td> <td>{{ data.street }}</td> </tr> </div> div ng-controller="botctrl"> <tr ng-repeat="data in mydata2 | filter:search2"> <td><input type="checkbox"/></td> <td>{{ data.number }}</td> <td>{{ data.street }}</td> </tr> </div> you can include service directly searchquery demo angular.module('myapp').controller('topctrl', function topctrl($scope, searchservice) { $scope.mydata = [...

ios - Change Position Of a UIView programatically -

Image
there arabic page in app , "date field" in arabic page must align right side of view(right now, left). have tried following code -(void)changedateposition{ if (!_isenglish) { cgrect currentdatepostion=_viewfordate.frame; [_viewfordate removefromsuperview]; currentdatepostion.origin.x+=currentdatepostion.size.width; _viewfordate.frame=currentdatepostion; [_baseview addsubview:_viewfordate]; } } but did not help. view positioned top of navigation bar(no change in x co-ordinate,either). have used autolayout align left leading space of "viewfordate"(the date field) leading space of "placesview"(the view on top of date field). set priority 250. how can solve problem? hook iboutlet leading constraint of date view , set value 0. , try code: -(void)changedateposition{ if (!_isenglish) { _dateviewleadconstraint.constant = x; } //x - amount view should move right, can calcul...

swift - unexpected nil window in _UIApplicationHandleEventFromQueueEvent, _windowServerHitTestWindow: -

i tried make facebook login function in login page. failed first time, (here code) when try make facebook login in app, "message = "(#100) graph api app id 1xxxxxxxxx called, token has app id 4xxxx851";" error then made again in same way, time, have different type of error. it can built, doesn't show ui. display black. when touch blacked display shows, 2015-09-21 01:42:34.419 nona_app[3327:624143] unexpected nil window in _uiapplicationhandleeventfromqueueevent, _windowserverhittestwindow: ; layer = > this. what wrong p.list or code? , how can solve error? here login page , p.list code. import uikit import parse class customloginviewcontroller: uiviewcontroller { @ibaction func facebooklogin(sender: anyobject) { pffacebookutils.logininbackgroundwithreadpermissions(["public_profile", "email"]) { (user: pfuser?, error: nserror?) -> void in if(fbsdkaccesstoken.currentaccesstoken() != ni...

c# - How can I replace text in RichTextBox form another form? -

so have richtextbox called richtextbox1 , in form named xmleditor want able rename chosen word in parts of rich text box want. (like find , replace in notepad). but want use form called find (it looks find & replace in notepad) have functions replace words in richtextbox1 in xmleditor . the form named find has 2 textboxes , 1 button. first textbox named textbox1 used choose text replace while textbox3 text replaced with. , button button3 replace text while clicked. how can replace text in richtextbox form? how can these forms? void button3_click(object sender, eventargs e) { xmleditor xmle = new xmleditor(); xmle.richtextbox1.text = xmle.richtextbox1.text.replace(textbox1.text, textbox3.text); } one thing can pass xmleditor form parameter when constructing find, , have public xmleditor method can used interaction. interface ifindandreplace { void replace(string s); } public class xmleditor : ifindandreplace { ... public void showf...