Posts

Showing posts from January, 2011

android - How to publish new version of app for specific devices on Google Play -

soon i'm going release new version of app. huge change , i'd prefer release if narrow list of devices. google play offers option manage excluded devices, far understand affect versions of app, , i'd avoid that. there way manage excluded devices 1 version? example: current production version 1.0 , supports 8000, want release 2.0 100, want 1.0 still available 7900 devices. i believe you're looking called staged roll-outs. google support has more information here , think want "set staged rollout on production".

pandas - How to assign a value to the variable based on the existing variables in python? -

i want assign value variable based on existing variable values. give brief explanation of data. mydata category original_wt predicted_wt categorized 1 xxxxx 2.5 3.0 original 2 yyyyy 3.5 4.0 predicted 3 zzzzz 3.0 5.0 predicted 4 aaaaa 4.0 2.5 original 5 bbbbb 3.2 5.5 original 6 ccccc 4.6 3.5 predicted from above data want assign value based on categorized type. if original categorized value should original_wt of same row. if predicted categorized value should predicted_wt of same row. expected output: mydata category original_wt predicted_wt categorized categorized_value 1 xxxxx 2.5 3.0 original 2.5 2 yyyyy 3.5 4.0 predicted 4.0 3 zzzzz 3.0 5.0 predicted 5.0 4 aaaaa 4.0 2.5 ...

javascript - How to use regex with can be empty? -

i'm doing easy web application practice skill. i'm using regex validate phone input this, var reg = /^[\s()+-]*([0-9][\s()+-]*){6,20}$/; if(!reg.test($('#input-phone').val())){ alert('error'); } it works can't empty. don't know how modify able reject empty field. check whether there value if use regex var reg = /^[\s()+-]*([0-9][\s()+-]*){6,20}$/; var phone = $('#input-phone').val(); if (phone.length && !reg.test(phone)) { alert('error'); }

ios - All notifications disappearing after opening one of them -

i have server sends me push notifications , let's have 5 notifications on phone. if open 1 of them other notifications disappears. want 1 clicked disappear. this how handle receiving notifications: func application(application: uiapplication, didreceiveremotenotification userinfo: [nsobject : anyobject], fetchcompletionhandler completionhandler: (uibackgroundfetchresult) -> void) { if ( application.applicationstate == uiapplicationstate.inactive || application.applicationstate == uiapplicationstate.background ) { // navigating user view controller } application.applicationiconbadgenumber = 0 } by setting applicationiconbadgenumber 0 , remove every notification notification center. this has been discussed here: ios application: how clear notifications? furthermore, not possible programmatically remove single notification, ios8 on, os handle when user taps single notification. has been discussed here: remove single remote notificatio...

How to Show correctly twitter blockquotes in Android Webview -

i have following code <blockquote class="twitter-tweet" lang="en"> <p dir="ltr" lang="en"><a href="https://twitter.com /michaelessien">@michaelessien</a> come panathinaikos,ask <a href="https://twitter.com/djibrilcisse">@djibrilcisse</a> references;) </p> christos kitsakis (@chriskitsakis) <a href="https://twitter.com /chriskitsakis/status/597031669544136704">may 9, 2015</a> </blockquote> <script async src="http://platform.twitter.com/widgets.js" charset="utf-8"></script> and put javascript interface in web view. doesn't show correctly in android web view. what should do?

javascript - Single Sign on for office 365 outlook -

hi there? can me apply single sign on office 365 outlook application using azure active directory idp. it goes when log on office 365 account outlook application automatically sign in too. badly need help. thank you. you need configure active directory federation services , once done, assuming both office 365 instance , outlook use same ad, should set. here step step guide configure adfs . in case need configure saml based sso office 365 instance, can use this other guide well . let me know if helps , works out.

android - button id is not getting in custom action bar -

i trying add custom action bar fragment public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // todo auto-generated method stub view view = inflater.inflate(r.layout.fragment_createblog, container,false); android.app.actionbar actionbar = getactivity().getactionbar(); actionbar.setcustomview(r.layout.actionbar_createblog); actionbar.setdisplayshowcustomenabled(true); actionbarblogcreation = (button) view.findviewbyid(r.id.button_actionbarblog); actionbarblogcreation.setonclicklistener(this); } }); my action bar changed, while trying take button id layout shows null. why happening ? i think should try next: actionbar.setcustomview(r.layout.actionbar_createblog); actionbar.setdisplayshowcustomenabled(true); actionbarblogcreation = (button) actionbar.getcustomview().findviewbyid(r.id.butto...

java - Hibernate Exception - could not locate named parameter [:laboratoryId] -

i have following query in hibernate.i got hibernate exception , don't understand why hibernate throws exception. me? session session = this.sessionfactory.opensession(); session.createquery("delete laboratory l l.id=:laboratoryid") .setparameter("laboratoryid", laboratoryid).executeupdate(); session.close(); try add spaces between = sign , bind name :laboratoryid , remove alias: session session = this.sessionfactory.opensession(); session.createquery("delete laboratory id = :laboratoryid") .setparameter("laboratoryid", laboratoryid) .executeupdate(); session.close();

Grails DWR Plugin Service Not Injected In Controller -

i new dwr. have tried implementing dwr plugin in grails. integrated plugin in grails , able call service method also. but when try call controller method internally calls service method, throws error saying "not able call method on null object" i think controller method when called dwr not able service method reference. please refer dwr configuration mentioned below, , let me know how inject service in controller in grails dwr plugin code in bootstrap.broovy : def dwrconfig = { service(name:'hotelservice', javascript:'hotelservice') { param (name:'class') { 'com.tutorial.hotelservice' } } create(creator:'new', javascript:'hotelcontroller') { param (name:'class') { 'com.tutorial.hotelcontroller' } } }

jquery - How to change color of hyperlink after click on it and stayed colored after reloading page? -

i have hyperlinks in drop-down-menu , want change color of hyperlink when click on that. code works, when link point page (= reloading page), color-changes disappear, doesn't work. example: 1. <a href="#">this works</a> 2. <a href="/contact">doesn't work</a> my code enter link description here html <div id="menu"> <li><a href="#">item1</a> <div class="submenu"> <a href="#">subitem1</a> <a href="#">subitem2</a> </div> </li> <li><a href="#">item2</a></li> <li><a href="#">item3</a></li> <li><a href="#">item4</a></li> <li><a href="#">item5</a></li> </div> jquery $(function(){ $("#menu a...

web services - URL in webservice with drupal -

i'm new working web service , drupal, , don't understand things. problem have service retrieve user data http://miweb.es/endpoint/app_user/ {email} need pass email retrieve data, can't put dot (.) because error 406 406 not acceptable : unknown or unsupported response format. advance thanks. you can not have period in url because drupal services uses determine response format have few options pass email in header, in body, variable. if nee keep url format replace period rewrite rule in .htaccess

Stationary test error in Time Series using R -

i have half hourly data 5 years measuring electricity load. checked stationary acf , shows non stationary. when used adf.test check stationary, showed opposite result: adf.test(tsr1$load.mw.,alternative="stationary") # augmented dickey-fuller test # data: tsr1$load.mw. # dickey-fuller = -9.7371, lag order = 11, p-value = 0.01 # alternative hypothesis: stationary warning message: in adf.test(tsr1$load.mw., alternative = "stationary") : p-value smaller printed p-value what should consider? though have feeling non stationary. if is, how make stationary using r? tried using command decompose(tsr) . showed error: error : time series has no or less 2 periods what issue? the first step should visually examine time series see if stationary, , thereafter use adf-test "formally" test stationarity. more or less standard procedure, @ least in finance literature. (you of course use test kpss or pp) when plotting acf or pacf...

php - Two sub select query inside a where condition in laravel5? -

i want compare 2 select query inside condition of query in laravel5, the where condition of query in laravel given below,but not wokring. ie, select invoice (select query1) == (select query2) . $invoice->orwhere(function($query) { $query->where('invoices.status', '=', invoicestatusconstant::sent) ->where('invoices.due_date', '<', carbon::today()->todatestring()) ->where(db::raw('(select round(sum(invoice_items.quantity*invoice_items.rate), 2) invoice_items'), '=', db::raw("(select sum(payments.amount) payments ")); }); how can solve issue? db::raw won't give value. it's way create expression. if wanna way, should use: db::select(db::raw("(select sum(payments.amount) payments")) but give array. so, i'd following: db::select(db::raw("(select sum(paymen...

java - Casting the string column as int in hql query or criteria -

can guide me going wrong? giving 0 result in db values existing condition appear in below query. str = queryimpl(from arczipcoderange cast(fromzip int) >='12345' , cast(tozip int)<='12345') arczipcoderangelist = 0 are sure conditions correct? cast(fromzip int) >='12345' , cast(tozip int)<='12345') would give results from > 12345 , to < 12345. should other way around: from < 12345 , to > 12345?

django - Sending A post request from ajax to a python function but receiving a GET request? -

i new django.i sending ajax post request python function in turn stores data in variables ajax , return httpresponse .so checked request.method in python coming get. $.ajax({ url:"create_post/", type:"post", data : {f_name: first_name ,l_name: last_name,eadd: email , password: pass}, success:function(){ window.location.href="create_post/"; console.log ("success") }, cache:false, failure: function(errmsg) { alert(errmsg); } }); this ajax request. its sending data function . def create_post(request): if request.method == 'get': first_name=request.get['f_name']; last_name=request.get["l_name"]; email_address=request.get["eadd"]; pass=request.get["password"]; return httpresponse("<html><body>hi me .</body></html>"); when checked return(request.method) giving me get . can 1 explain behavi...

mysql - Using Timestamp in java sql prepared statement -

i trying execute select query using prepared statement in java. in clause im checking condition on timestamp type column shown below. string selectsql = "select * db.keycontacts createddatetime>?"; preparedstatement preparedstatement = connect.preparestatement(selectsql); preparedstatement.settimestamp(1, convertstrtotimestamp(lastsynctimestamp)); resultset = preparedstatement.executequery(selectsql ); //function convert timestampstring java.sql.timestamp private java.sql.timestamp convertstrtotimestamp(string datetimestr){ java.sql.timestamp timestampdate = null; try { dateformat formatter = new simpledateformat("yyyy-mm-dd hh:mm:ss");//2015-05-11 18:26:55 java.util.date dateobj = (java.util.date)formatter.parse(datetimestr); timestampdate = new timestamp(dateobj.gettime()); } catch (parseexception e) { // todo auto-generated catch block e.printstacktrace(); } ...

security - How to deal with an attack on registration-form? -

question on registration process i thinking email verification, , playing app. if -) attacker write script register millions account different random email address(all existing, people's email)then when people register, prompt email exists in db? -) or simpler, if user register else's email address? registration ajax triggers creation of userid , info user table in db, verification not done. but then, when "real" user email register, email taken...?as there can not 2 email address exist in db @ same time(as script won't able distinguish between users.... first, should try detect if same ip sends multiple registration requests during short period of time , blacklist (at least while). second, when verification-email sent - can many things avoid "duplicate registration" problem, here few examples: run cleanup job once day - deleting entries of users didn't verify account (via email) more 24 hours do not create user account un...

oracle - Updating multiple (100+) table column value having same data structure -

i new oracle. have query if can solve thankful you. details given below, database name:paul schema: ddpaul table: table_12_101, table_12_102, table_12_199,.......... these tables have same data structure. column names: id, number, comp, module, etc.. now, have update/alter column "comp" in table using sql/procedure. any method select "comp" tables @ once in 1 column? after saving excel change required values. main thing now, i want update "comp" per new excel data respect old one. table_12_101,...... id | comp | module 56623114 | fa-5920-01 | fa1 56623110 | fa-5921-01 | fa1 e.g. comp changed ca-5920-01 or need remove fa- etc. please 1 above. thankful you. you can find table name such column query: select table_name user_tab_cols column_name = 'comp'; and use name in procedure execute updates.

datetime - Deletion based on date of insertion of entry into table in Oracle -

i want know if oracle allows delete records table inserted before particular time , date if table not contain insertion_date column. the answer no . oracle not keep track of when row inserted. have create column , add data/time when row inserted delete row based on date. in short have keep track of yourself.

jquery - Select all items in Multiple SelectManyCheckBox with dynamic ids -

i want select check box in groups of checkboxes using primefaces component on top of jsf. my code this: <h:panelgrid columns="2" style="margin-bottom:10px" cellpadding="5"> <p:outputlabel value="confere:" style="font-weight:bold!important" /> <p:selectmanycheckbox value="#{funcionariobean.funcionario.permissaoconfere.stringarray}"> <f:selectitem itemlabel="consulta" itemvalue="c" /> <f:selectitem itemlabel="edição" itemvalue="e" /> <f:selectitem itemlabel="deleção" itemvalue="d" /> <f:selectitem itemlabel="inclusão" itemvalue="i" /> <f:selectitem itemlabel="relatório" itemvalue="r" /> <f:selectitem itemlabel="check all"/> </p:selectmanycheckbox> </h:panelgrid> <h:panelgrid col...

java - Openstack juno with Jclouds API generating URISyntaxException because of an extra space in response -

openstack juno orchestration endpoint having space in response, giving me exception while using jclouds api use openstack, there can do? { "endpoints": [{ "adminurl": "http://115.249.4.66:8004/v1/38bc976fd99d4ef4b6d48be6729b8576", "region": "iptc", "internalurl": "http://115.249.4.66:8004/v1/38bc976fd99d4ef4b6d48be6729b8576 ", "id": "64667a399bb446d0bf0f6537e113ec52", "publicurl": "http://115.249.4.66:8004/v1/38bc976fd99d4ef4b6d48be6729b8576" }], "endpoints_links": [], "type": "orchestration", "name": "heat" }, as shown above line "htttp://115.249.4.66:8004/v1/38bc976fd99d4ef4b6d48be6729b8576 ", has space before double quotes closing url (i manually added 't' http) but in other endpoints there no space, the same response trystack.or...

pdf - Find a string in scanned images in C#.net -

i want c# program searches string in pdf file contains scanned images. also, code should display particular page in searched string present. for example, consider pdf file contains scanned images(.png) of receipts. want search receipt_number. page in particular receipt_number present, should open in pdf reader. i use modi this. well, that's pretty complicated task. have tried similar before , results not great; however, program created, , have, need enough. reason worked me due fact focused on specific area of page, knew find specifically-formatted text. mind you, worked printed text... stamped or hand-written text pain deal with. enough ocr training, i'm sure fixed, didn't have have additional time devote project. your results heavily depend on ocr method choose, scan quality, whether it's typed or written hand, whether scan aligned or skewed, etc., etc., etc. i'm not going give code, won't learn if do, i'll give few tips of how sta...

Exploration Constant in UCB1 algorithm -

i'm writing ucb1 algorithm game. algorithm i'm using is: average(i) + sqrt( (2 * ln(totalcount)) / count(i) ) where averagei average score of arm i, count(i) count arm i, , totalcount total samples of arms. equation score given arm i. arm highest score, max(i), chosen sampled. algorithm repeats equation new data got sample, ad infinitum, or until runs out of thinking time. i have assignment tells me "modify exploration constant" algorithm. notice exploits rather explores time -- hardly ever tries arms has visited once. however, don't see exploration constant. missing part of algorithm? the 2 exploration constant. larger is, more algorithm favors exploration on exploitation. also beware formula makes sense when payoffs in [0,1] range, otherwise large payoff (say 1000) nullify influence of "exploration" part of formula, making exploitation-only.

c++ - Is it recommended to give variable names in a function declaration? -

as understand it, in function declaration there no need give variable names, still recommended. for example: setcur() function accepts 2 parameters : row number , , column number.hence can declared follows: void setcur(int, int); void setcur(int row, int col); why recommended give variable names in function declaration? it more readability sake. need variable type in function declaration; however, reading code understand these inputs are, assuming name them appropriate. it make life lot easier if working on large file , don't remember function in .h file takes in input.

algorithm - Is it indexing Or tagging? -

i have 2 classes claim , index. have field in claim class called topic string. m trying index topic column not using database index column features. should coding following method. suppose have claim 1, claim 1 topic field ("i love muffins muffins") ll folowing treatment #1. create empty dictionary "word"=>occurrences #2. create list of stopwords exemple stopwords = ("for","this".....etc ) #3. create list of delimiters exemple delimiter_chars = ",.;:!?" #4. split text(topic field) words delimited whitespace. #5. remove unwanted delimiter characters adjoining words. #6. remove stopwords. #7. remove duplicate #8. create multiple index object (word="love",occurences = 1,looked = 0,reference on claim 1),(word="muffins",occurences = 2,looked = 0,reference on claim 1), now whenever word muffins exemple looked increase 1 , move record in database. question following method ? better database index features ? th...

c# - Trying to receive JSON with JSON.net -

i've started building app tide info, weather info, mapping capabilities, etc world weather online, can't json response. i've installed json.net via nuget, running windows 8.1. i've been able view data pasting json url actual browser. using output @ json2sharp create bottom part of code below. tried http://www.codeproject.com/tips/397574/use-csharp-to-get-json-data-from-the-web-and-map-i , how json string url? . using system; using system.net; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using gmap.net.windowsforms; using gmap.net; using gmap.net.mapproviders; using system.xml.linq; using system.xml; using system.io; using system.web; using newtonsoft.json.linq; using newtonsoft.json; using restsharp; using newtonsoft.json.utilities; namespace eod_assistant { public partial class form1 : form ...

c++ - equivalence to decltype(*this) from a static method? -

i have macros need access type of current class , away via dry-violating pattern: struct thisscruct{ int a; double b; //example static method using - purely example - not full usecase static size_t sum_offsets(){ typedef thisstruct selft; return offsetof(selft, a) + offsetof(selft, b); } }; this comes lot use of offsetof keyword, @ least in own work. now before lock onto this not being accessible via static method - realize want know how type thisstruct in generic/macro friendly way static method context. don't need/want instance , looking way works above without typedeffing selft . edit: similar asked in can implement autonomous self member type in c++? - worried diamond problem forming classes both inheriting accepted answer's self class.

linux - start file manager in terminal window wheezy -

is there easy way start file manager in gui root? want temporarily create/update files , want through gui. i using raspberry pi running wheezy. depends on file manager. example: sudo pcmanfm &>/dev/null &

linux - convert a simple temperature bash script to javascript -

i have bash script spit out cpu temperature in beaglebon black. need convert these javascript. @ linux command , javascript have idea how ? i thinking of using fs.readfile command not sure. here code in bash script , link of got from: bash script link # cpu temp monitor # ctrl-c stop # written brian heckathorne - me@godfear.org # modified richard st-pierre - inspire.logicsupply.com # simple script monitoring cpu temp on beaglebone black running debian #!/bin/bash (( ; ; )) echo -n "cpu temp [celsius]: " cat /sys/class/hwmon/hwmon0/device/temp1_input | sed 's/...$//' sleep 2 done here more-or-less literal port. a few caveats: i infer file has 1 line in it. if that's not correct, code may need tweak. this more-or-less literal port, meaning make no judgments whether cat (and, therefore, fs.readfilesync() ), regexp replacement, etc., best choices here. i'm mapping bash code node.js code...

php - No symbol and number in form validation -

i surname.than error checking. if (preg_match("/[\d]/",$surname)) { $surnameerr = true; } the error shown when number input. symbols not validated. ask how validate symbols? moveover, how validate types of country character name checking no digit , symbols. thanks. try following code . $pattern = '/[^a-za-z]/'; $surnameerr = preg_match($pattern,$surname); if($surnameerr==""){ $surnameerr =true; }else{ $surnameerr =falsee; }

multithreading - Race condition of buffered C++ streams when calling fork -- force flush? -

i have program spawns writer thread unix fork() . works fine, when buffered c++ stream has not been flushed yet, race condition 2 threads output same data. following example shows mean: extern "c" { #include <sys/stat.h> #include <unistd.h> #include <sys/wait.h> } #define w 10 #include <iostream> int main(void) { pid_t pid; int status; (int = 0; < (1 << w); i++) { // spawn child after adding std::cout buffer if (i == (1 << (w - 1))) { // std::cout.flush(); // (1) pid = fork(); if (!pid) break; } // join child thread after while if (i == 3 * (1 << (w - 2))) waitpid(pid, &status, 0); // print stuff stream std::cout << << '\n'; // std::cout << << std::endl; // (2) } return exit_success; } so workaround tried (1) flush std::cout hand right before calling fork() (preferred sol...

php - Podio item.update webhook to open a new link -

i have setup webhook in podio item.update in hook_update_item.php file. want if item has been updated, want open link preferably in new tab, here code have: <?php require ("../podio/podioapi.php"); podio::setup(client id, client secret); podio::authenticate_with_app(app id, app token); switch ($_post['type']) { case 'hook.verify': // validate webhook podiohook::validate($_post['hook_id'], array('code' => $_post['code'])); case 'item.update': // something. item_id available in $_post['item_id'] if ($_post['item_id'] == '238777597'){ //open new link here $ch = curl_init('http://www.google.com.ph'); curl_exec($ch); } } ?> podio webhook has been validated assuming when webhook firing goes 'item.update'. far no luck on bringing new tab of google page. appreciate tips , suggestions! i...

reactive programming - Delay items emission until item is emitted from another observable -

playing rxjava , stumbled upon following problem: i have 2 different streams: stream items stream (with 1 item) emits transformation information first stream. so have stream of items , want items combined single item 2nd stream: ----a1----a2----a3----a4----a5----|---------------> -------------b1--|-----------------------------------> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------a1b1-a2b1-a3b1-a4b1-a5b1--------> it looks similar combilelatest operator, combinelatest ignore items first stream except closest item second stream. means not receive a1b1 - first resulting item emitted gonna a2b1 . i looked @ delay operator, doesn't allow me specify close stream done buffer operatior is there fancy operator solves problem above? afaik, there no built-in operator achieve behavior you've described. can implement custom operator or build on top of existing operators. think second option easier implement , here code: public static ...

AngularJs connection with a restful api with basic authentication -

i want use restful api of montastic implement functionality on angularjs website. unfortunately can't connect montastic. montastic api here https://github.com/montastic/montastic-api-doc i have use curl in angularjs curl -h 'accept: application/json' -h 'content-type: application/json' -u daniel@metadot.com:123456 https:// montastic /checkpoints/index own user password have encoded in base64 have tested curl , works on hurl.it to connect me montastic in angularjs use script: var app = angular.module('myapp', []); enter code here app.controller('mainctrl', function($scope, $http) { $http.defaults.headers.common['authorization']= 'basic '; $http.defaults.headers.common['authorization']= 'basic c3rlcghhbmuuy2f5c3npywxzqgdtywlslmnvbtptzxrhzg90njk='; $http.defaults.headers.common['accept']= "application/json"; $http.defaults.headers.common['content-type']= "application/json...

multidimensional array - C# trouble passing inline code -

hey know there lot of questions contain answer need, i'm having hard time sifting between func/action/delegate/lambda, , javascript guy feels needlessly complex. i'm working 2d arrays , write method accepts int width, int height, , form of inline code called every x/y pair. point avoid bugs , time writing nested loop on , over. i'm unsure proper type of inline code use, or looks like. i've tried bunch of combos can't make work out. what signature should use on method, , how call that? i use action type parameter, , lambda when calling: foreachpair(5, 5, (x, y) => { console.write(x + "," + y); }); public void foreachpair(int width, int height, action<int, int> callback) { (int = 0; < width; i++) { (int j = 0; j < height; j++) { callback(i, j); } } }

angularjs - Get encompassing model on ng-change -

i apologize confusing title, problem quite simple. i have $scope.users variable. ng-repeat them , create input every user's respective valid until property. on ng-change on input want send update request on user service. how can proper user on ng-change? <div class="row" ng-repeat="user in users"> <input type="date" ng-change="setvaliduntil" value="{{user.validuntil}}"/> //...other user properties </div> //in appropriate controller $scope.setvaliduntil = function () { user.update({ 'studentnumber': $scope.user.studentnumber, // missing this!! 'validuntil':validuntil }); } pass user function <div class="row" ng-repeat="user in users" style="margin-bottom:0.5em"> <input type="date" ng-change="setvaliduntil(user)" value="{{user.validuntil}}"/> //...other user properties </div> //in approp...

How to use join to fill missing values of a column - Python Pandas? -

to concrete, have 2 dataframes: df1: date 12/1/14 3 12/2/14 nan 12/3/14 2 12/2/14 nan 12/4/14 nan 12/6/14 5 df2: b 12/2/14 20 12/4/14 30 i want kind of left outer join fill missing values in df1, , generate df3: date 12/1/14 3 12/2/14 20 12/3/14 2 12/2/14 20 12/4/14 30 12/6/14 5 any efficient way make it? you can use combine_first (only columns names should match, therefore first rename column b in df2): in [8]: df2 = df2.rename(columns={'b':'a'}) in [9]: df1.combine_first(df2) out[9]: 12/1/14 3 12/2/14 20 12/2/14 20 12/3/14 2 12/4/14 30 12/6/14 5

angularjs - angular.js: Set own variable in state? -

this how route 2 different url: .state('cars', { url: "/cars/:title", templateurl: 'templates/cars.html', controller: 'article', }) .state('vegetables', { url: "/vegetables/:titel", templateurl: 'templates/vegetables.html', controller: 'article', }) the controller 'article' looks this: .controller('article', function($scope, $http, $stateparams) { $http({ method: 'post', url: "script.php", data: {'type': type, 'title': $stateparams.title}, }); }); my question how set variable type in data of controller? in example type 'cars' or 'vegetables'. can set variable in state part? .controller('article', function($scope, $http, $stateparams,$state) { $http({ method: 'post', url: "script.php", data: {'type': $state.current.name, 'title...

objective c - Remove dot/double dot from path in iOS -

all single dot components of path must removed. for example, "abi/./bune" should normalized "abi/bune". all double dot components of path must removed, along parent directory. example, "abi/ba/../bune" should normalized "abi/bune". without using regular expressions. idea how achieve? @daniel's answer correct one. since there discussion in comments question, decided provide code example @ rey gonzales's idea of tokenizing string , using stack. warning: code here purely educational purposes (because asked in comments question). in real life stick @daniel's solution. the code might this: -(nsstring *)normalizepath:(nsstring *)path { nsarray *pathcomponents = [path componentsseparatedbystring:@"/"]; nsmutablearray *stack = [[nsmutablearray alloc] initwithcapacity:pathcomponents.count]; (nsstring *pathcomponent in pathcomponents) { if ([pathcomponent isequaltostring:@".."...

How do I enable BPG decoding in ownCloud? -

owncloud not display bpg images default, offering download them instead. how add bpg support owncloud using decoding javascript ? the slideshow component of files app contained in 3rd party app , needs support format able view files. gallery has issue track implementation of format https://github.com/owncloud/galleryplus/issues/185 you won't able see thumbnails in files app, you'll able view files when clicking on them.

amazon web services - chef provisioning recipe to make AWS security groups, how to run from server vs chef client -

i need keep track of aws security groups better. the recipes use chef/provisioning/aws_driver let me make recipes per sg , track ips added/etc. i can run them fine locally chef-client -z -r what want upload cookbook chef server , run time need change sg. chef seems require recipes apply nodes, not aws cloudiness. basically want run chef-client workstation , have execute cookbook doesn't impact running servers, or create them, rather hits aws , converges resources specified. if create client.rb workstation chef server url , keys: chef_server_url "http://servername/organizations/myorg" validation_key "path/to/validation/key" client_key "path/to/client/key" you should able run provisioning recipes have been uploaded server. e.g. if they're in 'provisioning' cookbook: chef-client -c client.rb -o provisioning::myrecipe

c++ - How to store symmetries of a Polyomino using pointers-to-pointers? -

okay i'm working on coding discrete tiling problem. storing object called polyomino so: pointer = new int*[h]; p_0 = new int*[h]; p_1 = new int*[h]; p_2 = new int*[w]; p_3 = new int*[w]; p_4 = new int*[w]; p_5 = new int*[h]; p_6 = new int*[w]; (i=0 ; < h ; i++) pointer[i] = new int[w]; p_0[i] = new int[w]; p_1[i] = new int[w]; p_5[i]=new int[w]; } for(i=0 ; < w ; i++){ p_2[i]=new int[h]; p_3[i]=new int[h]; p_4[i]=new int[h]; p_6[i]=new int[h]; } (i=0; i<h ; i++){ for(j=0; j<w ; j++){ cout << "what " << i+1; cout << ", " << j+1; cout << endl; cin >> k; if(k != 0) pointer[i][j]=1; else pointer[i][j]=0; } } then generating 8 possible orientations (the group of symmetries of square) , storing them 7 other double p...

c# - Unable to delete created and streamed file -

i'm using magick.net convert pdf png , stream page via ajax. everything works until pdf uploaded twice. when trying overwrite or delete existing file, debugger tells me file in use process. here's function returns image controller: //path qualified path file ending in .pdf private image convertpdftoneimage(string path) { magickreadsettings settings = new magickreadsettings(); settings.density = new pointd(300, 300); using (magickimagecollection images = new magickimagecollection()) { fileinfo file = new fileinfo(path); images.read(file); file = null; using (magickimage horizontal = images.appendhorizontally()) { string pngname = path.changeextension(path, ".png"); horizontal.write(pngname); } return image.fromfile(path.replace("pdf", "png")); } } and controller st...

sql server - How to insert rowguid and ModifiedDate in EntityFrameworkDataService -

i'm using entityframeworkdataservice in wcf service , setup rowguid , modifieddata column in db table. these values generated newid() , getdate() in db. problem when add new object client application below: addresstype @ = new addresstype(); at.name = "home"; ccn.addtoaddresstypes(at); ccn.savechanges(); it has error. if add rowguid , modifieddate, at.rowguid = guid.newguid(); at.modifieddate = datetime.now; it can add object table. don't want use rowguid , modified value generated client side. i'd know how have handle rowguid , modified value in entityframeworkdataservice. in model diagram (.edmx), have change storegeneratedpattern property "none" "computed". solve problem. please see more details @ http://www.ladislavmrnka.com/2011/03/the-bug-in-storegeneratedpattern-fixed-in-vs-2010-sp1/

ios - Remove all iAds app wide? -

i've added in app purchases remove iads ios app. i've put in logic once removeads product bought (which triggers): func removeads() { defaults.setobject("true", forkey: "remove_adverts") self.candisplaybannerads = false self.removeadbutton.enabled = false println("removed") } and i've put @ top of each controller handle it. if let showads = defaults.dataforkey("remove_adverts") { self.candisplaybannerads = false self.removeadbutton.enabled = false println("ads shouldn't show") } else { self.candisplaybannerads = true } but ads still show. is there better way this? when you're checking see if user has purchased iap remove ads in line if let showads = defaults.dataforkey("remove_adverts") you're checking dataforkey when should checking objectforkey because used setobject when setting default value. alternatively, use setbool code this: func ...

java - Android setImageResource causing application to crash -

to start off i'm pretty new android programming error may extremely simple didn't notice. whenever open simple app on starts image. when swipe it's supposed change different image instead app crashes. ideas why is? here java code package example.course.bananapeeler; import android.gesture.gesture; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.view; import android.view.menuitem; import android.widget.button; import android.widget.textview; import android.widget.imageview; import android.view.motionevent; import android.view.gesturedetector; import android.support.v4.view.gesturedetectorcompat; public class mainactivity extends actionbaractivity implements gesturedetector.ongesturelistener, gesturedetector.ondoubletaplistener{ private imageview mainpic; private gesturedetectorcompat gesturedetector; private int moneypersecond; @override protected void oncreate(bun...

api - Long running PHP script using up server memory -

bit of odd one. i've got laravel 5 project pulls data api , stores in local database. third party api uses xml - pull data using guzzle , parse using simplexml objects. i trying track down appears memory leak in project. if script left running long enough (and have - first sync of data take day or two) consumes memory on, , crashes, server. this confusing bit - i've run app in debug mode , made output memory_get_usage() periodically , stop after given number of requests. php not report sharp increase. start finish total memory usage reported way increases 10kb. if watch process in activity monitor on dev machine (a mac), goes 20mb 30mb. left copy of full script running overnight other day , when checked in morning claimed have used 750mb. the same thing happens on amazon ec2 instance script it's thing live. memory_get_usage() doesn't report unusual - leave script running and, in top, sit @ top of process list , mem% gradually increase until... bang. i've g...

c# - ASP.NET DropDownList in ListView's OnItemUpdating method always has a SelectedIndex of 0 -

in listview's edittemplate , have dropdownlist control. dropdownlist populated in itemdatabound method of listview (only way found list populate in edittemplate....the dropdownlist exists in edittemplate; must label in itemtemplate ). the list populates, , works. issue have when update button clicked , itemupdating method called, selectedindex of dropdownlist always zero, no matter value selected @ time. the aspx code, minus templates looks this: <asp:listview id="listview1" runat="server" onitemdatabound="listview1_itemdatabound" onitemupdating="listview1_itemupdating" onitemediting="listview1_itemediting"> <edititemtemplate> <tr style=""> <td><asp:dropdownlist cssclass="vaultdropdownlist" id="editstafflist" runat="server" autopostback="false" causesvalidation="true"></asp:dropdownlist></td> <td> ...