Search Results

Search found 2069 results on 83 pages for 'anonymous delegates'.

Page 11/83 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Delegates does not work properly

    - by Warrior
    I am new to iPhone development. I am converting the date to the desired format and set it to the delegate and get its value in the another view. The session restarts when I tried to get the value from delegate. If I set the original date and not the formatted date in the set delegate, then i able to get the value in the another view. If I also give any static string value, then also I am able to the static string value back. Only the formatted date which is string is set then the session restarts. If i print and check the value of the formatted date it prints the correct formatted date only.Please help me out.Here is my code for date conversion NSString *dateval=[[stories objectAtIndex: storyIndex] objectForKey:@"date"]; NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init]; [inputFormatter setDateFormat:@"EEE, MMM dd, yyyy"]; NSDate *inputDate = [inputFormatter dateFromString:dateval]; NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init]; [outputFormatter setDateFormat:@"MMMM dd"]; NSString *outputDate = [outputFormatter stringFromDate:inputDate]; AppDelegate *delegate=(AppDelegate *)[[UIApplication sharedApplication]delegate]; [delegate setCurrentDates:outputDate]; EDIT: This is displayed in console inside view did load [Session started at 2010-04-21 19:12:53 +0530.] GNU gdb 6.3.50-20050815 (Apple version gdb-967) (Tue Jul 14 02:11:58 UTC 2009) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all Attaching to process 4216. (gdb) In another view - (void)viewDidLoad { NSLog(@"inside view did load"); AppDelegate *delegate=(AppDelegate *)[[UIApplication sharedApplication]delegate]; NSString *titleValue=[delegate getCurrentDates]; self.navigationItem.title =titleValue ; } The get does not work properly.It works fine if i give any static string or the "dateval". Thanks.

    Read the article

  • ThreadExceptionEventHandler and invoking delegates

    - by QmunkE
    If I assign a ThreadExceptionEventHandler to Application.ThreadException, why when I invoke a delegate method using a control on the main application thread are any exceptions thrown by that delegate not triggering the event handler? i.e. static void Main() { ... Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); Application.Run(new Form1()); } static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { Console.Error.Write("A thread exception occurred!"); } ... private void Form1_Load(object sender, EventArgs e) { Thread syncThread = new Thread(new ThreadStart(this.ThrowException)); syncThread.Start(); } private void ThrowException() { button1.Invoke(new MethodInvoker(delegate { // Not handled by ThreadExceptionEventHandler? throw new Exception(); })); } The context on this is that I have a background thread started from a form which is throwing an unhandled exception which terminates the application. I know this thread is going to be unreliable since it is network connectivity reliant and so subject to being terminated at any point, but I'm just interested as to why this scenario doesn't play out as I expect?

    Read the article

  • UITableViewController setting delegates and datasource

    - by the_great_monkey
    Hi iOS gurus, I'm a little bit confused about UITableViewController... As far as I concern they are typically the delegate and datasource of the UITableView (although it can be made such that they are different). However in some cases, like when embedding a UITableViewController in a UITabBarViewController in Interface Builder, we initiate our table view controller in IB. Therefore in my understanding, the default initialiser is being called. But in this case, I have this piece of code: @interface Settings : UITableViewController { } And in the IB I see that the delegate and datasource of the UITableView is hooked up to this class. My question is, why is it that we don't need to explicitly say that it is following: @interface Settings : UITableViewController <UITableViewDelegate, UITableViewDataSource> { } And in the .m file: - (void)viewDidLoad { [super viewDidLoad]; [tableView setDelegate:self]; [tableView setDataSource:self]; } I have indeed stumbled upon some cases where I have to explicitly code the above a few times to make something work. Although it is still a mystery for me as of why it is needed...

    Read the article

  • How do I change the background image of my iPhone app?

    - by alJaree
    Hello I have looked around and found some code which so called chooses an image from an array of image objects, but cant find an explanation. I would like to make my app have a background image and the user can select next and previous buttons to scroll through some full screen images, setting them as the background image as they scroll. I know how to do this in java, but cant seem to do it for this app. How or what code is linked to a next button to grab the next image in the array and reverse for the back button? Then that needs to be displayed obviously. I have used a layered architecture with a MVC style approach but cant seem to put it together with Objective-C. Would the buttons call the appropriate methods of the so called delegates, which the delegates handle fetching and returning the Images? Would the buttons use the returned images and actually handle the redrawing? I would really appreciate the help. Regards Jarryd

    Read the article

  • RoR model field without validators, has*, delegates, etc

    - by jackr
    How can I declare a field, in the Rails model, when it doesn't have any "has_" relations, or validations, or delegations? I just need to ensure its existence and column width in the schema. Currently, I have no mention of the field in the "schema section" of the model file, but it's referenced in various methods that use it, and this seems to work. However, depending on my exact creation workflow, the underlying database table may be created as t.binary "field_name", :limit => 32 or t.binary "field_name", :limit => 255 This is not a restriction on the value (any binary value is valid, even NULL), only on the table column declaration. As it happens, 32 is enough -- it never receives any larger value, it's only ever written to like this: self.field_name = SecureRandom.random_bytes(32)

    Read the article

  • Difference between two UIScrollView delegates

    - by Michael
    scrollViewDidEndScrollingAnimation and scrollViewDidEndDecelerating Looks like the last one is called when the bouncing effect is finished. But can't really understand what's the difference between first because they are called same time(well, decelerating called first).

    Read the article

  • How do I change the background image of my app?

    - by user356387
    Hello I have looked around and found some code which so called chooses an image from an array of image objects, but cant find an explanation. I would like to make my app have a background image and the user can select next and previous buttons to scroll through some full screen images, setting them as the background image as they scroll. I know how to do this in java, but cant seem to do it for this app. How or what code is linked to a next button to grab the next image in the array and reverse for the back button? Then that needs to be displayed obviously. I have used a layered architecture with a MVC style approach but cant seem to put it together with Objective-C. Would the buttons call the appropriate methods of the so called delegates, which the delegates handle fetching and returning the Images? Would the buttons use the returned images and actually handle the redrawing? I would really appreciate the help. Regards Jarryd

    Read the article

  • If I write a framework that gets information from the Internet, should I make a degelate or use blocks?

    - by Time Machine
    Say I'm writing a publicly available framework for the Vimeo API. This framework needs to get information from the Internet. Because this can take some time, I need to use threadin to prevent the UI from hanging. Foundation uses delegates for this, like NSURLConnectionDelegate. However, Game Kit uses blocks as callback functions. What is the recommended way of doing this? I know blocks aren't supported in standard GCC versions, but they require less, much less code for the one that uses my framework. Delegates, on the other hand, are real methods and when protocols are used, I'm sure the methods are implemented. Thanks.

    Read the article

  • Silverlight async calls and anonymous methods....

    - by JLewis
    I know there are a couple of debates on this kind of thing.... At any rate, I have several cases where I need to populate combobox items based on enumerations returned from the WCF service. In an effort to keep code clean, I started this approach. After looking into it more, I don't think the this works as well is initially thought... I am throwing this out to get recommendations/advice/code snippets on how you would do this or how you currently do this. I may be forced to have a seperate, non anonymous method, procedure. I hate doing this for something like this but at the moment, don't see it working another way... EventHandler<GetEnumerationsForTypeCompletedEventArgs> ev = null; ev = delegate(object eventSender, GetEnumerationsForTypeCompletedEventArgs eventArgs) { if (eventArgs.Error == null) { //comboBox.ItemsSource = eventArgs.Result; // populate combox for display purposes (for now) foreach (Enumeration e in eventArgs.Result) { ComboBoxItem cbi = new ComboBoxItem(); cbi.Content = e.EnumerationValueDisplayed; comboBox.Items.Add(cbi); } // remove event so we don't keep adding new events each time we need an enumeration proxy.GetEnumerationsForTypeCompleted -= ev; } }; proxy.GetEnumerationsForTypeCompleted += ev; proxy.GetEnumerationsForTypeAsync(sEnumerationType); Basically in this example we use ev to hold the anonymous method so we can then use ev from within the method to remove it from the events once called. This prevents this method from getting called more than one time. I suspect that the comboBox local var declared before this call, but within the same method, is not always the combobox originally intended but can't really verify that yet. I may add a tag to it to do some tests and populating to verify. Sorry if this is not clear. I can elaborate more if needed. Thanks Jeff

    Read the article

  • Sorting Anonymous Types

    - by strobaek
    I have a question of how to sort an anonymous type. Using Linq2SQL I have the following query, which returns a list of submissions: var submissions = EventSubmissions .Where(s => s.EventId.Equals(eventId)); Consider the following interface (somewhat simplyfied): public interface IQuerySorter { IOrderedQueryable Sort(IQueryable query); IOrderedQueryable<T> Sort<T, U>(IQueryable<T> query, Expression<Func<T,U>> selector); ... } Using this interface allows me to implement a number of 'sorters', e.g. on Date, Rating or whether or not a submission has been nominated (for voting). sortedQuery = sorter.Sort(submissions) So far so good. A submission can be made "votable". I get the number of votes a nominated submission may have using the following query: var withVoteCount = submissions .Select(s => new {NumberOfVotes = s.Votes.Count(), Submission = s}); I would like to sort this new query by NumberOfVotes using my "general" sorter class, but run into the problem that the anonymous type/member does not seem to live outside the repository-method, hence I am unable to sort on it. Any input would be greatly appreciated.

    Read the article

  • Perl - How to get the number of elements in an anonymous array, for concisely trimming pathnames

    - by NXT
    Hi Everyone, I'm trying to get a block of code down to one line. I need a way to get the number of items in a list. My code currently looks like this: # Include the lib directory several levels up from this directory my @ary = split('/', $Bin); my @ary = @ary[0 .. $#ary-4]; my $res = join '/',@ary; lib->import($res.'/lib'); That's great but I'd like to make that one line, something like this: lib->import( join('/', ((split('/', $Bin)) [0 .. $#ary-4])) ); But of course the syntax $#ary is meaningless in the above line. Is there equivalent way to get the number of elements in an anonymous list? Thanks! PS: The reason for consolidating this is that it will be in the header of a bunch of perl scripts that are ancillary to the main application, and I want this little incantation to be more cut & paste proof. Thanks everyone There doesn't seem to be a shorthand for the number of elements in an anonymous list. That seems like an oversight. However the suggested alternatives were all good. I'm going with: lib->import(join('/', splice( @{[split('/', $Bin)]}, 0, -4)).'/lib'); But Ether suggested the following, which is much more correct and portable: my $lib = File::Spec->catfile( realpath(File::Spec->catfile($FindBin::Bin, ('..') x 4)), 'lib'); lib->import($lib);

    Read the article

  • iPhone OS: Get a list of methods and variables from anonymous object

    - by ChrisOPeterson
    I am building my first iPhone/Obj-c app and I have a large amount of data-holding subclasses that I am passing into a cite function. To the cite function these objects are anonymous and I need to find a way to access all the variables of each passed object. I have been using a pre-built NSArray and Selectors to do this but with more than 30 entries (and growing) it is kind of silly to do manually. There has to be a way to dynamically look up all the variables of an anonymous object. The obj-c runtime run-time docs mention this problem but from what I can tell this is not available in iPhone OS. If it is then I don't understand the implementation and need some guidance. A similar question was asked before but again I think they were talking about OSX and not iPhone. Any thoughts? -(NSString*)cite:(id)source { NSString *sourceClass = NSStringFromClass([source class]); // Runs through all the variables in the manually built methodList for(id method in methodList) { SEL x = NSSelectorFromString(method); // further implementation // Should be something like NSArray *methodList = [[NSArray alloc] initWithObjects:[source getVariableList]] for(id method in methodList) { SEL x = NSSelectorFromString(method); // Further implementation }

    Read the article

  • Why LINQ to Entities won't let me initialize just some properties of an Entity?

    - by emzero
    So I've started to add Entity Framework 4 into a legacy web application (ASP.NET WebForms). As a start I have auto-generated some entities from the database. Also I want to apply Repository Pattern. There is an entity called Visitor and its repository VisitorRepository In VisitorRepository I have the following method: public IEnumerable<Visitor> GetActiveVisitors() { var visitors = from v in _context.Visitors where v.IsActive select new Visitor { VisitorID = v.VisitorID, EmailAddress = v.EmailAddress, RegisterDate = v.RegisterDate, Company = v.Company, Position = v.Position, FirstName = v.FirstName, LastName = v.LastName }; return visitors.ToList(); } That List is then bound to a repeater and when trying to do <%# Eval('EmailAddress') #%> it throws the following exception. The entity or complex type 'Model.Visitor' cannot be constructed in a LINQ to Entities query. A) Why is this happening? How I can workaround this? Do I need to select an anonymous type and then use that to initialize my entities??? B) Why every example I've seen makes use of 'select new' (anonymous object) instead of initializing a known type? Anonymous types are useless unless you are retrieving the data and showing it in the same layer. As far as I know anonymous types cannot be returned from methods? So what's the real point of them??? Thank you all

    Read the article

  • WCF - Windows authentication - Security settings require Anonymous...

    - by Rashack
    Hi, I am struggling hard with getting WCF service running on IIS on our server. After deployment I end up with an error message: Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service. I want to use Windows authentication and thus I have Anonymous access disabled. Also note that there is aspNetCompatibilityEnabled (if that makes any difference). Here's my web.config: <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> <bindings> <webHttpBinding> <binding name="default"> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows" proxyCredentialType="Windows"/> </security> </binding> </webHttpBinding> </bindings> <behaviors> <endpointBehaviors> <behavior name="AspNetAjaxBehavior"> <enableWebScript /> <webHttp /> </behavior> </endpointBehaviors> <serviceBehaviors> <behavior name="defaultServiceBehavior"> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" /> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceAuthorization principalPermissionMode="UseWindowsGroups" /> </behavior> </serviceBehaviors> </behaviors> <services> <service name="xxx.Web.Services.RequestService" behaviorConfiguration="defaultServiceBehavior"> <endpoint behaviorConfiguration="AspNetAjaxBehavior" binding="webHttpBinding" contract="xxx.Web.Services.IRequestService" bindingConfiguration="default"> </endpoint> <endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange"></endpoint> </service> </services> </system.serviceModel> I have searched all over the internet with no luck. Any clues are greatly appreciated.

    Read the article

  • List<object>.RemoveAll - How to create an appropriate Predicate

    - by CJM
    This is a bit of noob question - I'm still fairly new to C# and generics and completely new to predicates, delegates and lamda expressions... I have a class 'Enquiries' which contains a generic list of another class called 'Vehicles'. I'm building up the code to add/edit/delete Vehicles from the parent Enquiry. And at the moment, I'm specifically looking at deletions. From what I've read so far, it appears that I can use Vehicles.RemoveAll() to delete an item with a particular VehicleID or all items with a particular EnquiryID. My problem is understanding how to feed .RemoveAll the right predicate - the examples I have seen are too simplistic (or perhaps I am too simplistic given my lack of knowledge of predicates, delegates and lambda expressions). So if I had a List<Of Vehicle> Vehicles where each Vehicle had an EnquiryID, how would I use Vehicles.RemoveAll() to remove all vehicles for a given EnquiryID? I understand there are several approaches to this so I'd be keen to hear the differences between approaches - as much as I need to get something working, this is also a learning exercise. As an supplementary question, is a Generic list the best repository for these objects? My first inclination was towards a Collection, but it appears I am out of date. Certainly Generics seem to be preferred, but I'm curious as to other alternatives. Thanks

    Read the article

  • ASP.NET Writing to the Bin directory, access denied when anonymous user

    - by LeeW
    Hi all I have a program that creates a small file in the Bin directory for the purpose of tracking a license (that's the intention), all works fine when debugging but I've just realized that when I run it on a IIS server under the anonymous user account (IUSR) the file isn't created as IUSR only has read permission (I know this is correct but drat!). Can I write to another location under IUSR account or can I run my code under 'Local Service' account? Thanks

    Read the article

  • Attack from anonymous proxy

    - by mmgn
    We got attacked by some very-bored teenagers registering in our forums and posting very explicit material using anonymous proxy websites, like http://proxify.com/ Is there a way to check the registration IP against a black list database? Has anyone experienced this and had success?

    Read the article

  • anonymous ASP.net form with SSL

    - by user307852
    Hi I want to create contact form with SSL I have anonymous webapplication and won't be any login usecase, so whole webapplication must work via http:// but when user go to contact form, it must work via https:// I know how to do the redirect to https:// programatically, I've been searching how to configure SSL on IIS but it seems to not be the case?? I don't wont whole webappliation to work via https, only my contact form - how to do that and how o onfigure that? The data from my form will be passed to database, but it is not important here.

    Read the article

  • Generics and anonymous type

    - by nettguy
    I understood,normally generics is for compile time safe and allow us to keep strongly typed collection.Then how do generic allow us to store anonymous types like List<object> TestList = new List<object>(); TestList.Add(new { id = 7, Name = "JonSkeet" }); TestList.Add(new { id = 11, Name = "Marc Gravell" }); TestList.Add(new { id = 31, Name = "Jason" });

    Read the article

  • Display different content for anonymous and logged in users

    - by Jukebox
    What I need to accomplish is: If an anonymous user visits the site, show regular site content. If a user logs in to the site, then user-related content appears in place of the regular content. I would like to accomplish this using the Views module. I have looked at the Premium module, but it seems to be abandoned. I would like to avoid using the content-access module if at all possible, since I already have other access controls in place.

    Read the article

  • Annotate anonymous inner class

    - by Scobal
    Is there a way to annotate an anonymous inner class in Java? In this example could you add a class level annotation to Class2? public void method1() { add(new Class2() { public void method3() {} }); }

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >