Posts

styles - Changing theme of entire Android application using RadioButtons -

hello have 4 custom defined styles in styles.xml , trying use radiogroup in order select overall style of entire application. <style name="bluetheme" parent="android:theme.light.notitlebar.fullscreen"> <item name="android:windowbackground">@color/blue_background</item> <item name="android:textcolorprimary">@color/blue_text</item> </style> <style name="redtheme" parent="android:theme.light.notitlebar.fullscreen"> <item name="android:windowbackground">@color/red_background</item> <item name="android:textcolorprimary">@color/red_text</item> </style> <style name="greentheme" parent="android:theme.light.notitlebar.fullscreen"> <item name="android:windowbackground">@color/green_background</item> <item name="android:textcolorprimary">@color/green_text...

salt stack - How do I make saltstack wait for 200 OK? -

i have following state: healthy: cmd.run: - name: echo 'true' - onlyif: "curl -i http://127.0.0.1:{{ port }} 2>/dev/null | head -n 1 | awk '$2 ~ /200/ { print \"true\" }" - require: - docker: running the problem checks once , exits, how make waits timeout until gets 200 otherwise exits? while $(curl -i http://localhost:8080/ 2> /dev/null | awk '/200 ok/ { exit 1 }'); count=$(expr $count + 1); sleep 1; [ "$count" -ge "60" ] && exit 1; done

mysql - How can I select columns return with joins method in Active Record without associations? -

i working on rails model, mapped on external (non default) database table. i need make join obtain data need instantiate object. i using active record's functions: self.joins("left outer join accounts on accounts.code = customers.code").select("customers.code, accounts.email, accounts.firstname, accounts.password_hash").where('accounts.code = ?', my_param)[0] the model class is: class user::customer < user self.establish_connection :external_db self.table_name = "customers" attr_accessor :password_hash attr_accessor :firstname attr_accessor :email end this query does: select customers.code, accounts.email, accounts.firstname, accounts.password_hash `customers` left outer join accounts on accounts.code = customers.code (accounts.code = '11111111') so query right, object: #<user::customer id: nil, code: "11111111"> has attributes of table. expected that, because set attr_accessor of ...

php - What if after getting paykey for website paypal api, transaction will complete by user with their paypal account? -

take example , have website have integrated paypal api shopping cart , if user proceed transaction , after received paykey paypal api call. , need redirect page paypal. in between or after redirect if user/customer go own account in paypal , complete transaction paypal admin panel. how i(my website) notified transaction completed initialized (originated website payment page) payment purchases. you can send return url in paypal form send paypal before user payment. input must have name=return , can assign return url if user cancel payment. <?php echo '<input type="hidden" name="return" value="'.$dir_ok.'"> '; echo '<input type="hidden" name="cancel_return" value="'.$dir_error.'"> '; ?>

mongodb - Finding number of inserted documents in a bulk insert with duplicate keys -

i'm doing bulk-insert mongodb database. know 99% of records inserted fail because of duplicate key error. print after insert how many new records inserted database. being done in python through tornado motor mongodb driver, doesn't matter much. try: bulk_write_result = yield db.collections.probe.insert(dataarray, continue_on_error=true) nr_inserts = bulk_write_result["ninserted"] except pymongo.errors.duplicatekeyerror e: nr_inserts = ???? <--- should put here? since exception thrown, bulk_write_result empty. can (except concurrency issues) count of full collection before , after insert, don't roundtrips database line in logfile. there way can discover how many records inserted? regular insert continue_on_error can't report info want. if you're on mongodb 2.6 or later, however, have high-performance solution error reporting. here's complete example using motor's bulkoperationbuilder: import pymongo.errors tornado...

java - WARNING: No mapping found for HTTP request with URI [/projectShaun/home] in DispatcherServlet with name 'DispatcherServlet' -

this question has answer here: why spring mvc respond 404 , report “no mapping found http request uri […] in dispatcherservlet”? 3 answers when start console no errors, when try access following url: http://localhost:8080/projectshaun/home following error: no mapping found http request uri [/projectshaun/] in dispatcherservlet name 'dispatcherservlet dispatcherservlet-servlet: <?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:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://ww...

jquery - Background image scroll smoothly to certain (x,y) point -

i built 'window' div , larger image (its map of world) behind it, user can "grab" , scroll direction. next goal let user choose country , map center around country. since custom map need input coordinates self, no problem here. right (for demo purposes) created point image centers. transition immediate, how can scroll smoothly x,y point using jquery animate property? right now, how scroll points: var country_1 = new position(-700,-800); $("button").click(function(){ country_1.apply(document.getelementbyid('draggableelement')); }); fiddle you can use animate method animate change: var anim = {}; if(!isnan(this.x)) anim.left = this.x; if(!isnan(this.y)) anim.top = this.y; $(element).animate(anim, 1000); demo: http://jsfiddle.net/3gskot27/3/