Posts

objective c - Checking for iOS Location Services -

i have view map , button (like maps app once) allows user center , zoom current location on map. if can not use locationservicesenabled method (always returns yes), should create bool attribute check if didfailwitherror method called , know if can call button method? thanks reading. edited: this code not work me. using simulator. getting yes when asking locationservicesenabled. // gets user present location. - (ibaction)locateuser:(id)sender { if([cllocationmanager locationservicesenabled]) { cllocationcoordinate2d coordinate; coordinate.latitude = self.mapview.userlocation.location.coordinate.latitude; coordinate.longitude = self.mapview.userlocation.location.coordinate.longitude; [self zoomcoordinate:coordinate]; } else { [[[[uialertview alloc] initwithtitle:@"warning." message:@"location services disabled." delegate:nil cancelbuttontitle:@"ok" otherbutto...

pointers - In C, what does a variable declaration with two asterisks (**) mean? -

i working c , i'm bit rusty. aware * has 3 uses: declaring pointer. dereferencing pointer. multiplication however, mean when there 2 asterisks ( ** ) before variable declaration: char **apointer = ... thanks, scott it declares pointer char pointer . the usage of such pointer such things like: void setcharpointertox(char ** character) { *character = "x"; //using dereference operator (*) value character points (in case char pointer } char *y; setcharpointertox(&y); //using address-of (&) operator here printf("%s", y); //x here's example: char *original = "awesomeness"; char **pointer_to_original = &original; (*pointer_to_original) = "is awesome"; printf("%s", original); //is awesome use of ** arrays: char** array = malloc(sizeof(*array) * 2); //2 elements (*array) = "hey"; //equivalent array[0] *(array + 1) = "there"; //array[1] printf("%s",...

javascript - calling e.stopImmediatePropagation() from onclick attribute -

how event object onclick attribute? i have tried: <a href="something.html" onclick="function(e){e.stopimmediatepropagation();}">click me</a> also, have tried this: <a href="something.html" onclick="console.log(this);">click me</a> but console shows <a> element. i think you'd have define function in <script/> tag elsewhere. would bad use like: <script type="text/javascript"> $('#something_link').click(function(e) { e.stopimmediatepropagation(); }); </script> <a href="something.html" id="something_link">click me</a>

wpf - Get Displayed Text from TextBlock -

Image
i have simple textblock defined this <stackpanel> <border width="106" height="25" margin="6" borderbrush="black" borderthickness="1" horizontalalignment="left"> <textblock name="mytextblock" texttrimming="characterellipsis" text="textblock: displayed text"/> </border> </stackpanel> which outputs this this me "textblock: displayed text" string text = mytextblock.text; but there way text that's displayed on screen? meaning "textblock: display..." thanks you can first retrieving drawing object represents appearance of textblock in visual tree, , walk looking glyphrundrawing items - contain actual rendered text on screen. here's rough , ready implementation: private void button1_click(object sender, ...

Where should I put global methods and variables in an Android app? -

when i'm writing method or using member variable, find need share them across app. should go? i can subclass activity, falls on use mapview , forced use mapactivity, not activities inherit subclass. there way around this? where inheritance isn't applicable, tending put generic methods , member variables subclass of application object, i'm finding it's creating mess of code every class needs either grab access application object through via context, or have pass down. i suspect better off creating myapplication.getinstance() , keeping in singleton, instead of passing application object down through app classes. before wanted see guys had say. if want access "global singleton" outside of activity , don't want pass context through involved objects obtain singleton, can define, described, static attribute in application class, holds reference itself. initialize attribute in oncreate() method. for example: public class applicationcontro...

vb.net - VB10, Auto-Implemented Properties and COM -

i finished class we're using tie access wcf services. of course means .net classes (and of properties) need visible com. given i'm using vb10 , contact class has 20 properties went ahead , used auto-implementing properties. much surprise, properties not accessible within vba in access. tried marking properties comvisible (which didn't have in past standard properties) , still didn't work. after changing auto properties standard properties worked. public property firstname string became public property firstname string return _strfirstname end set _strfirstname = value end set end property my understanding 2 should equivalent. according i've read on msdn, auto-implementing properties take care of creating backing field , getter / setter , intents , purposes should same. clearly they're not, else going on behind scenes? they are. sample code: <comvisible(true)> _ <classinterface(classinterfa...

c# - Updatepanel gives full postback instead of asyncpostback -

i have run seems famous problem: updatepanel fires full postback instead of async postback. normal solution give controls add dynamically id, have done, still full postback instead of async postback... here's code: html: <asp:updatepanel id="itemsupdatepanel" runat="server" updatemode="conditional" childrenastriggers="false"> <triggers> </triggers> <contenttemplate> <asp:listview id="playeritems" runat="server" groupitemcount="5" onitemdatabound="playeritems_itemdatabound"> <layouttemplate> ... listview stuff ... </asp:listview> </contenttemplate> </asp:updatepanel> the interesting part c# code behind (method playeritems_itemdatabound), following: imagebutton imgbtn = new imagebutton(); imgbtn.id = "itembtn"; imgbtn.width...