Posts

uitableview - How to use a segmented control to switch or load different table view -

my goal make app similar iphone's app store app. problem have segmented control. want load different table view based on selection of segmented control. have tried had no luck yet. have tried use 1 table view , reloaddata load different data didn't work either. thank in advance. i have been looking answer similar question.... didn't mention data source, if you're using nsfetchedresultscontroller , this might you!

android - onResume() isn't triggering on TabHost items switching -

i have tabhost 2 tabs in it. first time switch second tab onresume() method of second's tab's activity invoked. have alertdialog shown , after disappears 'onresume()' method isn't called wait it. presume invocation of 'alertdialog' triggers 'onpause()' method , 'onresume()' should called before 'activity' shown , ready interaction user. in face 'onpause()' isn't called when switch first tab activity . can advice why 'onpause()' , 'onresume()' methods aren't called , methods called after showing 'alertdialog' or switching between tabs ? i presume invocation of 'alertdialog' triggers 'onpause()' method , 'onresume()' should called before 'activity' shown , ready interaction user alertdialog not affect activity's life cycle. check out activity's life cycle flow chart here. when switching between tabs, if want call method why do...

java - Apply 9-patch drawable to Button, keeping default padding -

Image
i'm attempting customise of button using 9-patch drawable no padding defined within in (no pixels on right or bottom inside 9-patch editor). is there simple way apply 9-patch drawable button , maintain button's default size. example, when apply 9-patch easy button shown below, different size other default styled buttons, share same layout, except 9-patch style. mdpi layout: hdpi layout: so basically, there way make easy button same size medium , hard, on both mdpi , hdpi screens, without making new 9-patch each density, , working out correct padding. thanks in advance help, can provide more information if required. well after more research seems isn't possible use 1 9-patch drawable screen densities. the link below states need different drawables each density: custom color buttons android 3.1. create images 9-patch images different colors need , put them drawable-hdpi , drawable-mdpi (yes, need 2 versions if want buttons on different device...

iphone - Changing an Image on TouchesBegan -

hey, trying change image when user touches imageview. @ moment imageview has image "heart1.png" when touch imageviewer on screen change "heart2.png" code, appreciated: -(void) touchesbegan:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [[event alltouches] anyobject]; cgpoint location = [touch locationinview:self.view]; if (location.x >= imageview.frame.origin.x && location.x <= imageview.frame.origin.x + imageview.frame.size.height && location.y >= imageview.frame.origin.y && location.y <= imageview.frame.origin.y + imageview.frame.size.height) { imageview.image = [uiimage imagenamed:@"heart2.png"]; } } that looks problem me: if (location.x >= imageview.frame.origin.x && location.x <= imageview.frame.origin.x + imageview.frame.size. --> height <-- should width there :)

ruby on rails - accepts_nested_attributes_for and second-order associations, nested forms -

i have following models associations: class order < activerecord::base has_many :guests has_many :customers, :through => :guests accepts_nested_attributes_for :customers end class customer < activerecord::base has_many :guests has_many :orders, :through => :guests has_many :slips accepts_nested_attributes_for :slips end class slip < activerecord::base belongs_to :order belongs_to :customer end class guest < activerecord::base belongs_to :order belongs_to :customer end my nested form looks this: <!-- general form --> <%= form_for(@order) |f| %> <% f.fields_for :customers |builder| %> <%= render "customer_fields", :f => builder %> <% end %> <%= f.submit %> <% end %> <!-- partial customer_fields --> <p> <%= f.label :name%><%= f.text_field :name %> <% f.fields_for :slips |builder| %> <%= render "slip_fie...

ruby - Nokogiri vs Goliath...or, can they get along? -

i have project needs parse literally hundreds of thousands of html , xml documents. i thought perfect opportunity learn ruby fibers , new goliath framework. but obviously, goliath falls flat if use blocking libraries. problem is, don't know how tell "thread safe" (if that's correct term goliath). so question is, nokogiri going cause issues goliath or multi-threading/fibers in general? if so, there safer use nokogiri? thanks goliath web framework, i'm assuming you're planning "ingest" these documents via http? each request gets mapped ruby fiber, effectively, server runs in single reactor thread. so, answer question: nokogiri thread safe best of knowledge, shouldn't matter here. thing have out for: while document being parsed, cpu pinned, , goliath wont accept new requests in meantime. so, you'll have implement correct logic handle specific case (ex: stream parse on chunks of data arriving socket, or load balance bet...

multithreading - Correct way to call XML-RPC service from an EJB -

i've got stateless ejb needs update website using xml-rpc. i've been using apache xml-rpc client (http://ws.apache.org/xmlrpc/). has been working fine, after method of called several times whole application server (glassfish v2.2) locks , need kill server respond again. after extensive reading, believe caused thread manipulating in xml-rpc client, since thread manipulation not recommended in ejb. i wondering, how 1 supposed call external services (such xml-rpc service) in ejb safe. the problem not related apache xml-rpc client, memory allocation / garbage collection misconfiguration.