Search Results

Search found 238 results on 10 pages for 'apples'.

Page 7/10 | < Previous Page | 3 4 5 6 7 8 9 10  | Next Page >

  • polymorphism pass instantiated base to deriver

    - by Eric
    I was wondering how to do this, consider the following classes public class Fruit { public string Name { get; set; } public Color Color { get; set; } } public class Apple : Fruit { public Apple() { } } How can I instantiate a new fruit but upcast to Apple, is there a way to instantiate a bunch of Fruit and make them apples with the name & color set. Do I need to manually deep copy? Of course this fails Fruit a = new Fruit(); a.Name = "FirstApple"; a.Color = Color.Red; Apple wa = a as Apple; System.Diagnostics.Debug.Print("Apple name: " + wa.Name); Do I need to pass in a Fruit to the AppleCTor and manually set the name and color( or 1-n properties) Is there an better design to do this?

    Read the article

  • Apple Magic Trackpad Gestures carried out as personalized Commands in Windows

    - by Adele
    I want to have the Apple Magic Trackpad to work on Windows, but NOT as a regular Mouse! I will need the normal Trackpad Gestures to work with a c# Application (i.e. when carring out a 2 finger swipe to the left, it will start playing a song...). I guess I´ll have to write my own driver? Is there a way to use Apples MAgic Trackpad Driver for Windows and re-write that one? OR is there any way (API, self-written driver), so that I could just hook the gestures to my Commands? Or any RAW Input examples? Does anybody know how to do that, or where to start? Thank you so much, I´m really lost.

    Read the article

  • PHP math gets crazy, need explanation, my brain is melting

    - by derei
    I know that playing with php float can give strange results if you try to add "goats + apples", but please take a look to the following case: $val = 1232.81; $p1 = 1217.16; $p2 = 15.65; $sum = $p1 + $p2; $dif = $val - $sum; echo $dif; It will give you -2.2737367544323E-13 ... yeah, ALMOST zero, but then why it doesn't say 0 ? This freaks me out big time. Please, I need some valid explanation.

    Read the article

  • How do I save a transient object that already exists in an NHibernate session?

    - by Daniel T.
    I have a Store that contains a list of Products: var store = new Store(); store.Products.Add(new Product{ Id = 1, Name = "Apples" }; store.Products.Add(new Product{ Id = 2, Name = "Oranges" }; Database.Save(store); Now, I want to edit one of the Products, but with a transient entity. This will be, for example, data from a web browser: // this is what I get from the web browser, this product should // edit the one that's already in the database that has the same Id var product = new Product{ Id = 2, Name = "Mandarin Oranges" }; store.Products.Add(product); Database.Save(store); However, trying to do it this way gives me an error: a different object with the same identifier value was already associated with the session How do I get around this problem?

    Read the article

  • Python: Find X to Y in a list of strings.

    - by TheLizardKing
    I have a list of maybe a 100 or so elements that is actually an email with each line as an element. The list is slightly variable because lines that have a \n in them are put in a separate element so I can't simply slice using fixed values. I essentially need a variable start and stop phrase (needs to be a partial search as well because one of my start phrases might actually be Total Cost: $13.43 so I would just use Total Cost:.) Same thing with the end phrase. I also do not wish to include the start/stop phrases in the returned list. In summary: email = ['apples','bananas','cats','dogs','elephants','fish','gee'] start = 'ban' stop = 'ele' the magic here new_email = ['cats','dogs'] NOTES While not perfect formatting of the email, it is fairly consistent so there is a slim chance a start/stop phrase will occur more than once. There are also no blank elements.

    Read the article

  • Is it bad practice to change state inside of an if statement?

    - by Benjamin
    I wrote some code that looks similar to the following: String SKIP_FIRST = "foo"; String SKIP_SECOND = "foo/bar"; int skipFooBarIndex(String[] list){ int index; if (list.length >= (index = 1) && list[0].equals(SKIP_FIRST) || list.length >= (index = 2) && (list[0] + "/" + list[1]).equals(SKIP_SECOND)){ return index; } return 0; } String[] myArray = "foo/bar/apples/peaches/cherries".split("/"); print(skipFooBarIndex(myArray); This changes state inside of the if statement by assigning index. However, my coworkers disliked this very much. Is this a harmful practice? Is there any reason to do it?

    Read the article

  • Searching algorithmics: Parsing and processing a request

    - by James P.
    Say you were to create a search engine that can accept a query statement under the form of a String. The statement can be used to retrieve different types of objects with a given set of characteristics and possibly linked to other objects. In plain english or pseudo-code using an OOP approach, how would you go about parsing and processing statements as follows to get the series of desired objects ? get fruit with colour green get variety of apples, pears from Andy get strawberry with colour "deep red" and origin not Spain get total of sales of melons between 2010-10-10 and 2010-12-30 get last deliverydate of bananas from "Pete" and state not sold Hope the question is clear. If not I'll be more than happy to reformulate. P.S: This isn't homework ;)

    Read the article

  • Python editor/IDE for OS X

    - by TheJuice
    As a (reasonably) new Python programmer, what IDEs or editors would you recommend for Python programming on OS X and why (i.e. what features/capabilities/workflow techniques really help)? I've used Xcode and played a bit with TextMate but I can't really say that either have really hit the spot for me (although TextMate's code completion is pretty neat, I think i've been spoilt with code-completion facilities provided by editors for statically-typed languages so maybe i'm subconsciously comparing apples and oranges) I'm looking to increase my efficacy with Python and any tips would be appreciated. I know people have asked similar questions for Python IDEs in general but I am specifically concentrating on OS X and the 'Mac way'. If Xcode or TextMate are thought highly of, perhaps some suggestions as to how I could get the most benefit from the tools would help.

    Read the article

  • MySQL, join one item to multiple items in a single query

    - by bschaeffer
    Say I've got two tables. One contains a list of items, and one contains pictures of the items. Something like this: Items +----+---------+ | id | name | +----+---------+ | 1 | oranges | | 2 | apples | +----+---------+ Pictures +----+---------+ | id | item_id | +----+---------+ | 1 | 1 | | 2 | 2 | | 3 | 2 | +----+---------+ My question is this: is it possible in a single query to select item 2 from Items and join all the rows in the Pictures table whose item_id references that same id? I am sure I've tried almost everything I can think of, but nothing is coming to mind. I apologize if the answer to this is simple, but It's just escaping me right now.

    Read the article

  • how to add markup to text using JavaScript regex

    - by Richard
    I need to add markup to some text using JavaScript regular expressions. In Python I could do this with: >>> import re >>> re.sub('(banana|apple)', r'<b>{\1}</b>', 'I have 1 banana and 2 apples!') 'I have 1 <b>{banana}</b> and 2 <b>{apple}</b>s!' What is the equivalent in JavaScript? string.replace(regex, newstring) seems to only take a raw string for replacing.

    Read the article

  • Create an Edit view similar to Contacts App

    - by Daniel Granger
    I have an edit view in my app which is a instance of UITableViewController and contains one cell with a textfield in a grouped table. At the moment this cell is at the top of the screen and is firstResponder so they keyboard is visible as well. But in all the Apples apps like the Contacts App when you edit a piece of information like an Email it buts both of its rows in the middle between the Nav Bar and the Keyboard not at the top of the screen. How do I achieve this effect? Many Thanks

    Read the article

  • How can I send email from my application ?

    - by srikanth rongali
    I want to attach a video and send email from my application. I downloaded apples example code MailComposer. I compiled it. I did not get any errors or warnings. I sent the mail to my mail id. But, I could not see any mail in my inbox. I am working on simulator. I did not set any senders email id in simulator. How can I know whether the code is working or not ? Thank You.

    Read the article

  • iPhone Developer account with someone elses credit card

    - by HappYCrappY
    Hi I wanted to enroll in Apples iPhone developer program the problem is I myself don't own a credit card is it Ok if I use some one else's credit card to sign up... I mean will Apple pay the guy whose credit card I have used or can I specify my Account details for any future transactions & just use this credit card for paying Apple. (& yes I cannot get a credit card, I am currently jobless never ever had a credit card before in my life & credit card companies are very skeptical to give me one.) Thank you

    Read the article

  • Excel - Counting unique values that meet multiple criteria

    - by wotaskd
    I'm trying to use a function to count the number of unique cells in a spreadsheet that, at the same time, meet multiple criteria. Given the following example: A B C QUANT STORE# PRODUCT 1 75012 banana 5 orange 6 56089 orange 3 89247 orange 7 45321 orange 2 apple 4 45321 apple In the example above, I need to know how many unique stores with a valid STORE# have received oranges OR apples. In the case above, the result should be 3 (stores 56089, 89247 and 45321). This is how I started to try solving the problem: =SUM(IF(FREQUENCY(B2:B9,B2:B9)>0,1)) The above formula will yield the number of unique stores with a valid store#, but not just the ones that have received oranges or bananas. How can I add that extra criteria?

    Read the article

  • Convert php to java/android arrays

    - by lacas
    $tagArray = array( "apples" => 12, "oranges" => 38, "pears" => 10, "mangos" => 24, "grapes" => 18, "bananas" => 56, "watermelons" => 80, "lemons" => 12, "limes" => 12, "pineapples" => 15, "strawberries" => 20, "coconuts" => 43, "cherries" => 20, "raspberries" => 8, "peaches" => 25 ); and how i can do this in java, and how to calling for the first and second params?

    Read the article

  • replacing variables in output in php

    - by Thorpe Obazee
    Right now I have this code. <?php error_reporting(E_ALL); require_once('content_config.php'); function callback($buffer) { // replace all the apples with oranges foreach ($config as $key => $value) { $buffer = str_replace($key, $value, $buffer); } return $buffer; } ob_start("callback"); ?> some content <?php ob_end_flush(); ?> in the content_config.php file: $config['SiteName'] = 'MySiteName'; $config['SiteAuthor'] = 'thatGuy'; What I want to do is that I want to replace the placeholders that with the key of the config array with its value. Right now, it doesn't work :(

    Read the article

  • store in a variable only the first or only the second class of an element

    - by shecky
    I'm using this bit of jQ to add a class to two different elements based on the class of another (parent/grandparent, etc) element: $(document).ready(function(){ var containerClass = $('#main-content').attr('class'); $('#nav-primary li#'+containerClass).addClass('active'); $('#aux-left div[id$='+containerClass+']').addClass('active'); }); Brilliant, but I have two problems with it: First, when there's no class at all in <div id="main-content">, the 'active' class is added to all the #nav-primary LIs, and also to all the #aux-left DIVs; how can I modify this so that in the absence of any class on #main-content, do nothing? Second, how can I target only the first or second of multiple classes to store in the 'containerClass' variable, e.g., <div id="main-content" class="apples bananas">? Very much appreciated! svs

    Read the article

  • Twitter Streaming API - tracking exact multiple keywords in exact order

    - by Gublooo
    Hey Guys, I'm just beginning to play with the Twitter Streaming API. If I specify $sc-setTrack(array('just bought from')); This will correctly pull only tweets that have all 3 keywords - but doesn't maintain the order. 1) I want the keywords to appear in the same order like "I just bought apple from itunes" but the above also returns tweets like "I bought some apples and just removed them from the bag" 2) Is there a way to specify the exact words say "NBA basketball" with nothing in between - in the sense I dont want tweets like this to be returned Watching basketball on NBA tv I just want tweets which contain the exact phrase to be returned like I love watching NBA basketball 3) Also is there a way to specify negative keywords Any tips if this is possible. Thanks

    Read the article

  • Compare a DateTime to the current date

    - by looloobs
    Hi I am trying to use a condition on events when the start_at DateTime is equal to or greater than Today's date. I want to list upcoming events, but clearly they are not upcoming if they have already passed. I have: @appointments = Event.find(:all, :conditions => ['move_id = ? AND start_at = ?', @move.id, Date.today]) I think I may be comparing apples and oranges here. It doesn't throw and error, just doesn't do what it is supposed to. Help! Thanks in advance.

    Read the article

  • what are the differences in the WebKit nightly build binary and in the Safari binary?

    - by Albert
    I know what the projects are about: Safari is Apples browser. WebKit is the engine used in Safari (and in many other browsers) which is open source. The WebKit source code contains also code to compile it as a standalone application. You can download the nightly build of WebKit here: http://nightly.webkit.org/ I have compared some of those nightly builds of WebKit to the official Safari application. And besides the slightly different logo and the different name, I haven't really seen any difference. Are there any? Or is it just the branding? Edit: I just tried again with the current nightly build of today and it even names itself "Safari" now.

    Read the article

  • iPhone app getting XML then refreshing it at intervals...

    - by user157733
    I have an app which gets some data from the web via an XML document. I have this working fine and have followed apples SeismicXML example (uses NSURLRequest etc). I am very new to this so I have to admit that I do not totally understand all the code that gets the XML - but it is working. My problem is that my app may be running for some time so I want to be able to refresh the XML every now and again and check to see if it is different. If it is different I need to update my contents. Basically this means my questions are.... Is there a standard way of doing this? I was thinking of creating a timer to call the function which parses the XML but I can't figure out which function to call. If anyone can give me any pointers or even better examples of this it would be fab. Thanks

    Read the article

  • String loops in Python

    - by Steve Hunter
    I have two pools of strings and I would like to do a loop over both. For example, if I want to put two labeled apples in one plate I'll write: basket1 = ['apple#1', 'apple#2', 'apple#3', 'apple#4'] for fruit1 in basket1: basket2 = ['apple#1', 'apple#2', 'apple#3', 'apple#4'] for fruit2 in basket2: if fruit1 == fruit2: print 'Oops!' else: print "New Plate = %s and %s" % (fruit1, fruit2) However, I don't want order to matter -- for example I am considering apple#1-apple#2 equivalent to apple#2-apple#1. What's the easiest way to code this? I'm thinking about making a counter in the second loop to track the second basket and not starting from the point-zero in the second loop every time.

    Read the article

  • How to set Main Inerface in xCode programatically

    - by Tom Tallak Solbu
    I am using Apples MultipleDetailViews http://developer.apple.com/library/ios/#samplecode/MultipleDetailViews/Introduction/Intro.html for template as a source for my iPad app. The template is using a splitviewController in the interface builder (MainWindow). In the iPhone/iPad Deployment info of the target, MainWindow is set as the "Main Interface". I want my app to also run on iPhone. This means I need to load a different xib when the app is run on an iPhone. I must then remove "MainWindow" from "Main Interface" because the app will crash when I load on an iPhone due to the splitViewController. The AppDeleagte of the template look like this: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.rootViewController = self.splitViewController; [self.window makeKeyAndVisible]; } If I remove "Main Window" from "Main Interface", how do I then need to change the APpDelegate, or maybe I need to change the MainWindow.xib to also work for iPhone?

    Read the article

  • Polymorphic associations in Rails

    - by Newy
    Say I have two models, Apples and Oranges, and they are both associated with a description in a Text model. Text is a separate class as I'd like to keep track of the different revisions. Is the following correct? Is there a better way to do this? [Apple] has_one :text, :as => :targit, :order => 'id DESC' has_many :revisions, :class_name => 'Text', :as => :targit, :order => 'id', :dependent => :destroy [Text] belongs_to :targit, :polymorphic => true

    Read the article

  • Iphone 3d games using Open Gl Es

    - by Dave
    Hi, I want to make 3d games for the iphone and with all this doubt about Unity and Apples new sdk agreement I'm wondering what the best way forward is? A lot of people recommend opengl es and point me in the direction of the open gl es bible and likewise, the problem is none of this actually talk about setting a game up i.e loading a character, scene , AI etc. Yet a lot of people are using Open GL es please could someone help me out, I really feel like I'm missing out on something. Are there any good tutorials/books that cover this? Thanks,

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10  | Next Page >