Posts

java - Get application path with JAX-RS service -

i have jax-rs service want know application context path. before, using httpservletrequest application url, using these methods: public static string getapplicationbaseurl(httpservletrequest request) { return string.format("%s://%s:%s%s", request.getscheme(), request.getservername(), request.getserverport(), request.getcontextpath()); } i saw @context in jax-rs, returns paths beginning jax resource. can retrieve application path? i found answer. using @context javax.ws.rs.core.uriinfo class, but, can inject httpservletrequest too. so, can use getapplicationbaseurl method wrote.

Why does Automator show 1 result on "Set Value Of Variable" but 2 results in "Get Value Of Variable"? -

Image
see screenshot. why happening? want 1 result, not 2. you have value of variable @ end of "set value of variable". why trying again? try putting "view results" item in place of "get value of variable". think you'll find have need.

css - Stop a single table cell from determining table width -

a b b x b i've got table inside containing block has set width of 400px. when browser width less 421px containing block width switches 95%. cells of type "a" , "b" contain simple text. there single cell contains link white-space:nowrap applied. i need table self determine dimensions (so no table-layout:fixed-width ), not take in account cell "x" when determining width of second column. ok hide content of cell "x" doesn't fit. i have tried applying width:100% overflow hidden on manner of different elements, no avail. html <table> <tr> <th style="vertical-align:bottom;"> <figure> <div class="minical-mo">month</div> <div class="minical-da">date</div> </figure> </th> <td style="vertical-align:bottom;"><h2>summary</h2...

ios - Why does this NSArray in an NSNotification block (apparently) never get released in an ARC environment? -

i have view controller that's subscribing notifications broadcast elsewhere. part of large object graph has cleanup needs done when children dealloc'd. dealloc never being called in 1 of children (arc environment), (if understand) means somewhere still retained, causing arc never dealloc when vc dismissed. i've traced offending code following 2 lines. first version causes vc , children never dealloc'd. in second version, things work fine , gets dealloc'd when vc dismissed. my question why? arc can't understand why additional nsarray not released. hopefully enough code. can post more if need be. here's version leads vc (and children, etc) never being dealloc'd: // subscribe notifications number of trackables has changed [[nsnotificationcenter defaultcenter] addobserverforname:kupdatednumberoftrackables object:nil queue:[nsoperationqueue mainqueue] usingblock:^(nsnotification *note) { if ([note.object iskindofclass:[nsarray class]]) { ...

Django: Order AdminModel by Custom Property -

i have model property i'd have adminmodel ordered by. class storeadmin(admin.modeladmin): list_display = ('user', 'total',) admin.site.register(store, storeadmin) model: class store(models.model): user = models.foreignkey(user, related_name="store") @property def total(self): num = 0 x in coins.objects.all(): num += x.value return num how order modeladmin total since property? in advance help! give link shot, may have answer. https://stackoverflow.com/a/8478586/1011998 in short, since property you're trying order doesn't exist in sql, sql has return results , order them property in python instead. can imagine, slower. i'd suggest looking storing field "total" field in database denormalized field (int) , update whenever user object updated overriding save() method. way benefit both speed of not having , dynamically recalculate totals on fly (that'll bec...

How to extend a lightweight provider in Chef -

i creating bunch of different chef providers deploy different types of applications. chef's documentation extend lightweight provider suggests possible doesn't do. page suggests perhaps call mixin needed, don't know structure code should have in file under /libraries or how include code in under /providers . here examples of want do. in base class under /libraries : repository "http://my.svn.server/#{deployment[:project]}/branches/#{node[:chef_environment]}/" user "deploy" scm_provider chef::provider::subversion svn_username "svn_user" svn_password "password" in provider torquebox rails app deployments: deploy_revision "/my/deployment/directory/#{deployment[:project]}" # magically mixin code libraries environment "rails_env" => node[:chef_environment] restart_command "rake torquebox:deploy" end and of course other types of providers different types of applications. can point ...

xamarin.ios - struggling testing IOS in app purchase with xamarin -

for last couple of days have been struggling trying set enviroment test in app purchase in xamarin. docs page not clear on needs done, @ least me. for have researched, need sign contract apple, requires me give apple information bank account, taxes, etc. information going take little while, maybe week. without contract, can test in sandbox mode in app purchase? so far, have created development provisioning profile, app id , bundle id well, products going sell within app, , test users. tried getting product info device, did not work, no error, or app crash. missing here causes behavior. i read in page need install provisioning profile , configure xcode sign app profile. how do in xamarin studio? also, need tell xcode whats application bundle id, again, how do this? i read in-app purchase programming guide , gave me overall understanding architecture needed implement in app purchases, failing on little details. any appreciated. thank much. craigd's answer ...