Search Results

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

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

  • Why did the web win the space of remote applications and X not?

    - by Martin Josefsson
    The X Window System is 25 years old, it had it's birthday yesterday (on the 15'th). As you probably are aware of, one of it's most important features is the separation of the server side and the client side in a way that neither Microsoft's, Apples or Wayland's windowing systems have. Back in the days (sorry for the ambiguous phrasing) many believed X would dominate over other ways to make windows because of this separation of server and client, allowing the application to be ran on a server somewhere else while the user clicks and types on her own computer at home. This use obviously still exists, but is marginalized at best. When we write and use programs that run on a server we almost always use the web with it's html/css/js. Why did the web win, and X not? The technologies used for the web (said html/css/js) are a mess. Combined with all the back-end-frameworks (Rails, Django and all) it really is a jungle to navigate thru. Still the web thrives with creativity and progress, while remote X apps do not.

    Read the article

  • How do I recursively define a Hash in Ruby from supplied arguments?

    - by Sarah Beckham
    This snippet of code populates an @options hash. values is an Array which contains zero or more heterogeneous items. If you invoke populate with arguments that are Hash entries, it uses the value you specify for each entry to assume a default value. def populate(*args) args.each do |a| values = nil if (a.kind_of? Hash) # Converts {:k => "v"} to `a = :k, values = "v"` a, values = a.to_a.first end @options[:"#{a}"] ||= values ||= {} end end What I'd like to do is change populate such that it recursively populates @options. There is a special case: if the values it's about to populate a key with are an Array consisting entirely of (1) Symbols or (2) Hashes whose keys are Symbols (or some combination of the two), then they should be treated as subkeys rather than the values associated with that key, and the same logic used to evaluate the original populate arguments should be recursively re-applied. That was a little hard to put into words, so I've written some test cases. Here are some test cases and the expected value of @options afterwards: populate :a => @options is {:a => {}} populate :a => 42 => @options is {:a => 42} populate :a, :b, :c => @options is {:a => {}, :b => {}, :c => {}} populate :a, :b => "apples", :c => @options is {:a => {}, :b => "apples", :c => {}} populate :a => :b => @options is {:a => :b} # Because [:b] is an Array consisting entirely of Symbols or # Hashes whose keys are Symbols, we assume that :b is a subkey # of @options[:a], rather than the value for @options[:a]. populate :a => [:b] => @options is {:a => {:b => {}}} populate :a => [:b, :c => :d] => @options is {:a => {:b => {}, :c => :d}} populate :a => [:a, :b, :c] => @options is {:a => {:a => {}, :b => {}, :c => {}}} populate :a => [:a, :b, "c"] => @options is {:a => [:a, :b, "c"]} populate :a => [:one], :b => [:two, :three => "four"] => @options is {:a => :one, :b => {:two => {}, :three => "four"}} populate :a => [:one], :b => [:two => {:four => :five}, :three => "four"] => @options is {:a => :one, :b => { :two => { :four => :five } }, :three => "four" } } It is acceptable if the signature of populate needs to change to accommodate some kind of recursive version. There is no limit to the amount of nesting that could theoretically happen. Any thoughts on how I might pull this off?

    Read the article

  • x264 IDR access unit with a SPS and a PPS

    - by Gcoop
    Hi All, I am trying to encode video in h.264 that when split with Apples HTTP Live Streaming tools media file segmenter will pass the media file validator I am getting two errors on the split MPEG-TS file WARNING: Media segment contains a video track but does not contain any IDR access unit with a SPS and a PPS. WARNING: 7 samples (17.073 %) do not have timestamps in track 257 (avc1). After hours of research I think the "IDR" warning relates to not having keyframes in the right place on the segmented MPEG-TS file so in my ffmpeg command I set -keyint_min 1 to ensure keyframes where at every frame, but this didn't work. Although it would be great to get an answer, if anyone can shed any light on what a "IDR access unit with a SPS and a PPS" is or what the timestamps warning means I would be very grateful, thanks.

    Read the article

  • Growing UITextView and UITableViewCell

    - by Arie Pieter
    I'd like to emulate the compose mail screen of Apples iPhone app. At this moment I have a UITableView with some cells. The last cell contains a UITextView. I managed to get the scrolling the way I like, but one problem remains: how to let the UITextView and the UITableViewCell automatically grow in height when the user enters a new line of text? There has been written a lot about this, I know. But I couldn't find any solution. Can anybody help me or just give a hint? Thanks APC

    Read the article

  • What way to use the CGContext to draw is suitable?

    - by Tattat
    I know that the CGContext cannot call it to draw directly, and it needs to fill the drawing logic in the drawInContext, and call the CGContext to draw using "setNeedsDisplay", so, I designed a cmd to execute, but it cause some problems... like this : http://stackoverflow.com/questions/2617827/why-i-cant-draw-in-a-loop-using-uiview-in-iphone I think the CGContext is very different from my previous programming experience....(I used HTML5 canvas, that allow me add more details, after I draw, so do the Java Swing) Actually, I want to know what is the suitable to implement these kind of thing in Apples' programmer mind. Thz.

    Read the article

  • iPhone: CALayer + rotate in 3D + antialias?

    - by Colin
    Hi all, An iPhone SDK question: I'm drawing a UIImageView on the screen. I've rotated it in 3D and provided a bit of perspective, so the image looks like it's pointing into the screen at an angle. That all works fine. Now the problem is the edges of the resulting picture don't seem to be antialiased at all. Anybody know how to make it so? Essentially, I'm implementing my own version of CoverFlow (yeah yeah, design patent blah blah) using quartz 3d transformations to do everything. It works fine, except that each cover isn't antialiased, and Apples version is. I've tried messing around with the edgeAntialisingMask of the CALayer, but that didn't help - the defaults are that every edge should be antialiased... thanks!

    Read the article

  • Python hashable dicts

    - by TokenMacGuy
    As an exercise, and mostly for my own amusement, I'm implementing a backtracking packrat parser. The inspiration for this is i'd like to have a better idea about how hygenic macros would work in an algol-like language (as apposed to the syntax free lisp dialects you normally find them in). Because of this, different passes through the input might see different grammars, so cached parse results are invalid, unless I also store the current version of the grammar along with the cached parse results. (EDIT: a consequence of this use of key-value collections is that they should be immutable, but I don't intend to expose the interface to allow them to be changed, so either mutable or immutable collections are fine) The problem is that python dicts cannot appear as keys to other dicts. Even using a tuple (as I'd be doing anyways) doesn't help. >>> cache = {} >>> rule = {"foo":"bar"} >>> cache[(rule, "baz")] = "quux" Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: 'dict' >>> I guess it has to be tuples all the way down. Now the python standard library provides approximately what i'd need, collections.namedtuple has a very different syntax, but can be used as a key. continuing from above session: >>> from collections import namedtuple >>> Rule = namedtuple("Rule",rule.keys()) >>> cache[(Rule(**rule), "baz")] = "quux" >>> cache {(Rule(foo='bar'), 'baz'): 'quux'} Ok. But I have to make a class for each possible combination of keys in the rule I would want to use, which isn't so bad, because each parse rule knows exactly what parameters it uses, so that class can be defined at the same time as the function that parses the rule. But combining the rules together is much more dynamic. In particular, I'd like a simple way to have rules override other rules, but collections.namedtuple has no analogue to dict.update(). Edit: An additional problem with namedtuples is that they are strictly positional. Two tuples that look like they should be different can in fact be the same: >>> you = namedtuple("foo",["bar","baz"]) >>> me = namedtuple("foo",["bar","quux"]) >>> you(bar=1,baz=2) == me(bar=1,quux=2) True >>> bob = namedtuple("foo",["baz","bar"]) >>> you(bar=1,baz=2) == bob(bar=1,baz=2) False tl'dr: How do I get dicts that can be used as keys to other dicts? Having hacked a bit on the answers, here's the more complete solution I'm using. Note that this does a bit extra work to make the resulting dicts vaguely immutable for practical purposes. Of course it's still quite easy to hack around it by calling dict.__setitem__(instance, key, value) but we're all adults here. class hashdict(dict): """ hashable dict implementation, suitable for use as a key into other dicts. >>> h1 = hashdict({"apples": 1, "bananas":2}) >>> h2 = hashdict({"bananas": 3, "mangoes": 5}) >>> h1+h2 hashdict(apples=1, bananas=3, mangoes=5) >>> d1 = {} >>> d1[h1] = "salad" >>> d1[h1] 'salad' >>> d1[h2] Traceback (most recent call last): ... KeyError: hashdict(bananas=3, mangoes=5) based on answers from http://stackoverflow.com/questions/1151658/python-hashable-dicts """ def __key(self): return tuple(sorted(self.items())) def __repr__(self): return "{0}({1})".format(self.__class__.__name__, ", ".join("{0}={1}".format( str(i[0]),repr(i[1])) for i in self.__key())) def __hash__(self): return hash(self.__key()) def __setitem__(self, key, value): raise TypeError("{0} does not support item assignment" .format(self.__class__.__name__)) def __delitem__(self, key): raise TypeError("{0} does not support item assignment" .format(self.__class__.__name__)) def clear(self): raise TypeError("{0} does not support item assignment" .format(self.__class__.__name__)) def pop(self, *args, **kwargs): raise TypeError("{0} does not support item assignment" .format(self.__class__.__name__)) def popitem(self, *args, **kwargs): raise TypeError("{0} does not support item assignment" .format(self.__class__.__name__)) def setdefault(self, *args, **kwargs): raise TypeError("{0} does not support item assignment" .format(self.__class__.__name__)) def update(self, *args, **kwargs): raise TypeError("{0} does not support item assignment" .format(self.__class__.__name__)) def __add__(self, right): result = hashdict(self) dict.update(result, right) return result if __name__ == "__main__": import doctest doctest.testmod()

    Read the article

  • Memory leak using (void) alloc

    - by Rudiger
    I have seen a similar line of code floating about in Apples code: (void)[[URLRequest alloc] initializeRequestWithValues:postBody url:verifySession httpHeader:nil delegate:self]; URLRequest is my own custom class. I didn't write this and I think the guy that did just grabbed it from Apple's example. To me this should leak and when I test it I'm pretty sure it leaks 16 bytes. Would it? I know how to fix it if it does but wasn't sure as it was taken from Apple's code.

    Read the article

  • Objective-C : Trouble with file download

    - by Holli
    I ran in a bit of trouble downloading files with Objective-C. I use the download decideDestinationWithSuggestedFilename from Apples documentation page. http://developer.apple.com/mac/library/documentation/cocoa/conceptual/URLLoadingSystem/Tasks/UsingNSURLDownload.html As long as I want to download just one file it works fine but I want to download an array for files one by one. The problem starts with the second file. Right now my code will trigger the next download itself from the downloadDidFinish Method. Then I will get an unrecognized selector sent to instance error. For me it looks like the NSURLDownload that just finished the download is still in use somehow. Release is called but the must be a problem. If I just put an NSBeep in the downloadDidFinished Method and trigger the next file download manually it works fine. Looks like I have to wait a while till I can start the next download. I know this question is a bit vague but maybe someone got an idea.

    Read the article

  • Using malloc/free in Objective-C object

    - by Itamar Katz
    I have a class AudioManager with a member of type AudioBufferList *. (This is a struct declared in the CoreAudio framework). Since AudioBufferList is not a NSObject, I cannot retain it, so I have to alloc/free it (correct me if I'm wrong). My question is, where is the 'right' place to free it? Currently I am doing it in the dealloc method of AudioManager. If I understand correctly, this method is invoked automatically once the release message is sent to the instance of AudioManager --- is that true? Is there any other recommended practice regarding using alloc/free on non-objects members of Objective-C objects? Edit: From Apples documentation: Subclasses must implement their own versions of dealloc to allow the release of any additional memory consumed by the object—such as dynamically allocated storage for data or object instance variables owned by the deallocated object. After performing the class-specific deallocation, the subclass method should incorporate superclass versions of dealloc through a message to super: Which makes things a little bit clearer - but more insights are appreciated.

    Read the article

  • Equivalents of Java and .NET technologies/frameworks

    - by Paul Sasik
    I work in a shop that is a mix of mostly Java and .NET technologists. When discussing new solutions and architectures we often encounter impedance in trying to compare the various technologies, frameworks, APIs etc. in use between the two camps. It seems that each camp knows little about the other and we end up comparing apples to oranges and forgetting about the bushels. While researching the topic I found this: Java -- .Net rough equivalents It's a nice list but it's not quite exhaustive and is missing the key .NET 3.0 technologies and a few other tidbits. To complete that list: what are the near/rough equivalents (or a combination of technologies) in Java to the following in .NET? WCF WPF Silverlight WF Generics Lambda expressions Linq (not Linq-to-SQL) TPL F# IronPython IronRuby ...have i missed anything else? Note that I omitted technologies that are already covered in the linked article. I would also like to hear feedback on whether the linked article is accurate. Thanks.

    Read the article

  • Rough/near equivalents of Java and .NET technologies/frameworks

    - by Paul Sasik
    I work in a shop that is a mix of mostly Java and .NET technologists. When discussing new solutions and architectures we often encounter impedance in trying to compare the various technologies, frameworks, APIs etc. in use between the two camps. It seems that each camp knows little about the other and we end up comparing apples to oranges and forgetting about the bushels. While researching the topic I found this: Java -- .Net rough equivalents It's a nice list but it's not quite exhaustive and is missing the key .NET 3.0 technologies and a few other tidbits. To complete that list: what are the near/rough equivalents (or a combination of technologies) in Java to the following in .NET? WCF WPF Silverlight WF Generics Lambda expressions Linq (not Linq-to-SQL) ...have i missed anything else? Note that I omitted technologies that are already covered in the linked article. I would also like to hear feedback on whether the linked article is accurate. Thanks. (Will CW if requested.)

    Read the article

  • What is the bit size of long on 64-bit Windows?

    - by acidzombie24
    Not to long ago someone told me that long are not 64 bits on 64 bit machines and i should always use int. This did not make sense to me. I seen docs (such as the one on apples official site) say that long are indeed 64 bits when compiling for a 64bit CPU. I looked up what it was on windows and found Windows: long and int remain 32-bit in length, and special new data types are defined for 64-bit integers. from http://www.intel.com/cd/ids/developer/asmo-na/eng/197664.htm?page=2 What should i use? should i define something like uw, sw ((un)signed width) as a long if not on windows. Otherwise do a check on the target CPU bitsize?

    Read the article

  • Ipad, closed environment and threat to privacy

    - by Akshay Bhat
    I had an unusual question about ipad, Since ipad environment is closed and does not allows installation of diagnostic and security related programs. How can then we be sure that any of the software installed on ipad is not infringing upon our privacy by doing stuff such as homing back information, etc. We cant install a packet tracer or any other software to check for attacks on privacy. Also given Apples poor track record (the safari browser was broken in one day), I don't think trusting apple solely would be a good idea. This might not seem to be a big issue but for business users it would be a significant concern.

    Read the article

  • Group keywords by site

    - by Skudd
    I am finding a lot of useful help here today, and I really appreciate it. This should be the last one for the day: I have a list of the top 10 keywords per site, sorted by visits, by date. The records need to be sorted as follows (excuse the formatting): 2010-05 2010-04 site1.com keyword1 apples wine keyword1 visits 100 12 keyword2 oranges water keyword2 visits 99 10 site2.com keyword1 blueberry cornbread keyword1 visits 90 100 keyword2 squares biscuits keyword2 visits 80 99 Basically what I need to accomplish involves grouping, but I can't seem to figure it out. Am I heading down the right path, or is there another way to achieve this, or is it just impossible?

    Read the article

  • Limit to area that receives touch events

    - by Typeoneerror
    Is there's a bounding box on an application that receives touch events? I created a few sample round rect buttons and placed them in different places in my view. The ones in the center of the view receive touch events (and show the highlighted blue color) but if I place a button near the edges of the view, only parts of them are clickable in the simulator. Is this because of Apples style guidelines? I placed a button exactly where a UITabNavigationItem would appear and only the bottom half of it is clickable.

    Read the article

  • Honor Whitespace padding to display columns in fixed width <select>

    - by Laramie
    I am trying to create the effect of columns in a dropdown by padding text with whitespace as in this example: <select style="font-family: courier;"> <option value="1">[Aux1+1] [*] [Aux1+1] [@Tn=PP] </option> <option value="2">[Main] [*] [Main Apples Oranges] [@Fu=$p] </option> <option value="3">[Main] [*] [Next NP] [@Fu=n] </option> <option value="4">[Main] [Dr] [Main] [@Ty=$p] </option> </select> According to this blog, it's possible. The problem is the whitespace is contracted so that the columsn don't line up. SAme results in FF, IE6 and Chrome. What am I missing?

    Read the article

  • How can I instantiate a base class and then convert it to a derived class?

    - 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

  • Looking for a .NET 3.5 / J2EE architecture concept comparison article/chart

    - by Edward Tanguay
    We are thinking about combining .NET technology with Java technology (WCF, JBoss/ESB, MOM, WPF, WF) and I need to have a high-level idea of what are the apples and oranges in the .NET 3.5 and Java worlds. Does anyone know of a good, clear article or better yet a simple chart which answers questions such as: WCF in the Java world is __ the equivalent of WPF in the Java world is _ the closes thing to JBoss in the .NET world is _ the JVM and CLR are essentially the same except for these differences: .... in the Java world you don't have the concept of WF/WCF/WPF, instead you have .... there is no "LINQ" in the Java world yet, but you can use ___ the closest you get to ADO.NET Data Services in the Java world is .... I'm not looking to debate this so I'm not looking for "fighting points", I just need a neutral what-is-what chart comparing the two worlds.

    Read the article

  • iPhone+Quartz+OpenGL. What is the correct way for Quartz and OpenGL to play nice together regarding

    - by dugla
    So we know the CoreGraphics/Quartz imaging model is based on pre-multiplied alpha. We also know that OpenGL blending is based on un-premultiplied alpha. What is the best practice to avoid head explosion when doing blending with textures that are derived from pre-multiplied alpha imagery (PNG files generated in Photoshop with pre-multiplied alpha). Given the apples/oranges mish mash of Quartz and OpenGL, what is the correct glBlendFunc for doing the fundamental Porter/Duff "over" operation? Typical example: A simple paint program. Brush shapes are texture-map patterns created from pre-multiplied alpha rgba images. Paint color is specified via glColor4(...) with the alpha channel used to control paint transparency. GL_MODULATE is used so the brush texture multiplies the (translucent) paint color to blend the color into the canvas. Problem: The texture is premult. The color is not. What is the correct way to handle this fundamental inconsistency? Thanks, Doug

    Read the article

  • Prevent status bar from receiving touch events

    - by Typeoneerror
    Edit After further testing, it appears that the part of my button that are not clickable are where the status bar used to be. I'm hiding the status bar with : // -- Override point for customization after app launch [[UIApplication sharedApplication] setStatusBarHidden:YES]; But it's still receiving touches. Any idea on how to disable this? Is there's a bounding box on an application that receives touch events? I created a few sample round rect buttons and placed them in different places in my view. The ones in the center of the view receive touch events (and show the highlighted blue color) but if I place a button near the edges of the view, only parts of them are clickable in the simulator. Is this because of Apples style guidelines? I placed a button exactly where a UITabNavigationItem would appear and only the bottom half of it is clickable.

    Read the article

  • How can I populate highchart jQuery plugin dynamically from MVC action?

    - by Anders Svensson
    I'm trying out the Highcharts jQuery plugin for creating charts of data in an MVC application. But I need to get the data for the function dynamically from an Action Method. How can I do that? Taking the example from the Highcharts site (http://highcharts.com/documentation/how-to-use): var chart1; // globally available $(document).ready(function() { chart1 = new Highcharts.Chart({ chart: { renderTo: 'chart-container-1', defaultSeriesType: 'bar' }, title: { text: 'Fruit Consumption' }, xAxis: { categories: ['Apples', 'Bananas', 'Oranges'] }, yAxis: { title: { text: 'Fruit eaten' } }, series: [{ name: 'Jane', data: [1, 0, 4] }, { name: 'John', data: [5, 7, 3] }] }); }); How can I get the data in there dynamically from the action method? Someone suggested I might use JSon, but couldn't specify how. If this is the case, I would really appreciate a simple and specific example, because I don't know much about JSon. Any help appreciated!

    Read the article

  • Regex pattern for searches with include and exclude

    - by alex-kravchenko-zmeyp
    I am working on a Regex pattern for searches that should allow optional '+' sign to include in the search and '-' sign to exclude from the search. For example: +apple orange -peach should search for apples and oranges and not for peaches. Also the pattern should allow for phrases in double quotes mixed with single words, for example: "red apple" -"black grape" +orange - you get the idea, same as most of the internet searches. So I am running 2 regular expressions, first to pick all the negatives, which is simple because '-' is required: (?<=[\-]"?)((?<=")(?<exclude>[^"]+)|(?<exclude>[^\s,\+\-"]+)) And second to pick positives, and it is a little more complex because '+' is optional: ((?<=[\+\s]")(?<include>[^\s"\+\-][^"]+))|(?<include>(?<![\-\w]"?)([\w][^,\s\-\+]+))(?<!") Positive search is where I am having a problem, it works fine when I run it in RegexBuddy but when I try in .Net the pattern picks up second word from negative criteria, for example in -"black grape" it picks up word 'grape' even though it ends with double quote. Any suggestions?

    Read the article

  • Problem with double quotes and Input

    - by Axel
    Hi, i have the following code : <input type="text" value="<?php echo $_GET['msg']; ?>"> This input is automatically filled with the name that is writen in the previous page. So, if the user wrote : i like "apples" and banana The input will be broken because it will close the tag after the double quotes. I know i can avoid that by html entiting the value, but i don't want this, is there another solution or is there an <<< EOD in html ? Thanks

    Read the article

  • Compile Error Using singleton - iPhone SDK

    - by mrburns05
    Since someone here is a bit hot-headed and deleted my last question ill post a new one with a title to better please his ego...Hows this Michael? Anyways, im getting this error when i compile: Undefined symbols: "_OBJC_CLASS_$_SortedItems", referenced from: __objc_classrefs__DATA@0 in SortedByNameTableDataSource.o ld: symbol(s) not found collect2: ld returned 1 exit status Basically i followed apples "TheElements" sample app to create the singleton, tableview datasource and just changed some stuff around to suit my needs - ive triple checked all my code and cannot figure out why im getting this.. If anyone can help please do, it would be much appreciated. if more of my code is needed ill post.. let me know

    Read the article

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