Daily Archives

Articles indexed Wednesday May 5 2010

Page 1/119 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • iPhone Foundation - performance implications of mutable and xxxWithCapacity:0

    - by Adam Eberbach
    All of the collection classes have two versions - mutable and immutable, such as NSArray and NSMutableArray. Is the distinction merely to promote careful programming by providing a const collection or is there some performance hit when using a mutable object as opposed to immutable? Similarly each of the collection classes has a method xxxxWithCapacity, like [NSMutableArray arrayWithCapacity:0]. I often use zero as the argument because it seems a better choice than guessing wrongly how many objects might be added. Is there some performance advantage to creating a collection with capacity for enough objects in advance? If not why isn't the function something like + (id)emptyArray?

    Read the article

  • Building a list of favorites from Core Data

    - by Jim
    I'm building an app with two tabs. The first tab has a main tableview that connects to a detail view of the row. The second tab will display a tableView based on the user adding content to it by tapping a button on the detail view. My question is this. What is the correct design pattern to do this? Do I create a second ManagedObjectContext/ManagedObjectContextID then save that context to a new persistent store or can the MOC be saved to the existing store without affecting the original tableview? I've looked at CoreData Recipes and CoreData Books and neither deal with multiple stores although books does deal with multiple MOC's. Any reference would be great.

    Read the article

  • W3Schools tutorial example not working with Coda on Mac

    - by Mark Szymanski
    I am following a JavaScript tutorial on the W3Schools website and I have the following code: <html> <head> <title>Hello!</title> </head> <body> <script type="text/javascript"> function confirmShow { var r = confirm("Press one...") if (r == true) { alert("Button pressed == OK") } if (r == false) { alert("Button pressed == Cancel") } } </script> <input type="button" onclick="confirmShow()" value="Show Confirm Box" /> </body> </html> and whenever I preview it in Coda or in Safari the alert never shows up. Thanks in advance!

    Read the article

  • Moving from WCF RIA Beta to RC: best practices?

    - by Duncan Bayne
    I have an existing WCF RIA project built on the Release Candidate; I'm now moving to the Release version & have discovered many changes. David Scruggs made the following comment on his (MSDN) blog: "If you’ve written anything in SIlverlight 4 RIA Services, you’ll need to rewrite it. There has been a lot of refactoring and namespace moves." Having made a brief attempt to compile the old solution with the new RIA framework I'm inclined to agree. My current plan is to: remove the Silverlight Business Application projects from the Solution rebuild the EF4 items from the database create a new Silverlight Business Application project re-add the files (XAML, CS) from the old Silverlight Business Application project Does this sound like a reasonable approach? I think it's cleaner than trying to manually alter the existing project.

    Read the article

  • How do I get 3 lines of text from a paragraph

    - by Keltex
    I'm trying to create an "snippet" from a paragraph. I have a long paragraph of text with a word hilighted in the middle. I want to get the line containing the word before that line and the line after that line. I have the following piece of information: The text (in a string) The lines are deliminated by a NEWLINE character \n I have the index into the string of the text I want to hilight A couple other criteria: If my word falls on first line of the paragraph, it should show the 1st 3 lines If my word falls on the last line of the paragraph, it should show the last 3 lines Should show the entire paragraph in the degenative cases (the paragraph only has 1 or 2 lines) Here's an example: This is the 1st line of CAT text in the paragraph This is the 2nd line of BIRD text in the paragraph This is the 3rd line of MOUSE text in the paragraph This is the 4th line of DOG text in the paragraph This is the 5th line of RABBIT text in the paragraph Example, if my index points to BIRD, it should show lines 1, 2, & 3 as one complete string like this: This is the 1st line of CAT text in the paragraph This is the 2nd line of BIRD text in the paragraph This is the 3rd line of MOUSE text in the paragraph If my index points to DOG, it should show lines 3, 4, & 5 as one complete string like this: This is the 3rd line of MOUSE text in the paragraph This is the 4th line of DOG text in the paragraph This is the 5th line of RABBIT text in the paragraph etc. Anybody want to help tackle this?

    Read the article

  • Is there any difference between null and 0 when assigning to pointers in unsafe code?

    - by Eloff
    This may seem odd, but in C (size_t)(void*)0 == 0 is not guaranteed by the language spec. Compilers are allowed to use any value they want for null (although they almost always use 0.) In C#, you can assign null or (T*)0 to a pointer in unsafe code. Is there any difference? (long)(void*)0 == 0 (guaranteed or not? put another way: IntPtr.Zero.ToInt64() == 0) MSDN has this to say about IntPtr.Zero: "The value of this field is not equivalent to null." Well if you want to be compatible with C code, that makes a lot of sense - it'd be worthless for interop if it didn't convert to a C null pointer. But I want to know if IntPtr.Zero.ToInt64() == 0 which may be possible, even if internally IntPtr.Zero is some other value (the CLR may or may not convert null to 0 in the cast operation) Not a duplicate of this question

    Read the article

  • SSIS IsNumeric expression Error

    - by rmdussa
    Hi am using following exression in ssis package !ISNULL((DT_I4)Route) ? (DT_WSTR,50)("SB" + SUBSTRING(RIGHT(Route,2),1,1)) : (DT_WSTR,50)Route when the Route value is Numeric it is sucess, when it is Non-numeric failing with following description. Any help,how to resolve this issue [Derived Column [111]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "component "Derived Column" (111)" failed because error code 0xC0049067 occurred, and the error row disposition on "output column "column_New" (679)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure. [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Derived Column" (111) failed with error code 0xC0209029 while processing input "Derived Column Input" (112). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.

    Read the article

  • How to order by a known id value in mysql

    - by markj
    Hi, is it possible to order a select from mysql by using a known id first. Example: $sql = "SELECT id, name, date FROM TABLE ORDER BY "id(10)", id DESC Not sure if the above makes sense but what I would like to do is first start ordering by the known id which is 10 which I placed in quotes "id(10)". I know that cannot work as is in the query but it's just to point out what I am trying to do. If something similar can work I would appreciate it. Thanks.

    Read the article

  • Calling CONTENT_SCRIPT JS From BROWSER_ACTION Popup HTML

    - by Aristotle
    I'm working on a Google Chrome Extension and would like to get an HTML from within my popup HTML to call functions within my loaded javascript file. My manifest follows: { "name": "Extension", "version": "1.0", "description": "Extension", "browser_action": { "default_icon": "icon.png", "default_title": "Ext", "popup": "popup.html" }, "content_scripts": [{ "matches": ["http://*/*"], "css": ["ext.css"], "js": ["jquery.js","scripts.js"] }], "permissions": [ "http://*/*" ] } As you can see I'm loading in a local copy of jQuery, along with another javascript file for my own personal logic. My popup document looks like this: <select id="values"> <option>Foo</option> <option>Bar</option> </select> And the contents of my scripts.js file follow: $(function(){ $("#values").change(function(){ alert("Foo"); }); }); This isn't doing what I expect though - alerting "Foo" anytime I change a value in my popup HTML. How can I get these two files to communicate with eachother? Or can they at all?

    Read the article

  • Get list of authenticated users in glassfish

    - by KevMo
    Is it possible to get a list of all the currently logged in users in an application running on glassfish? I'm user container managed authentication, so I know the information is somewhere. I would like to display this information on my own JSP page as opposed to finding it in the admin console, but either will work fine.

    Read the article

  • How does Visual Studio decide the order in which stack variables should be allocated?

    - by Jason
    I'm trying to turn some of the programs in gera's Insecure Programming by example into client/server applications that could be used in capture the flag scenarios to teach exploit development. The problem I'm having is that I'm not sure how Visual Studio (I'm using 2005 Professional Edition) decides where to allocate variables on the stack. When I compile and run example 1: int main() { int cookie; char buf[80]; printf("buf: %08x cookie: %08x\n", &buf, &cookie); gets(buf); if (cookie == 0x41424344) printf("you win!\n"); } I get the following result: buf: 0012ff14 cookie: 0012ff64 buf starts at an address eighty bytes lower than cookie, and any four bytes that are copied in buf after the first eighty will appear in cookie. The problem I'm having is when I place this code in some other function. When I compile and run the following code, I get a different result: buf appears at an address greater than cookie's. void ClientSocketHandler(SOCKET cs){ int cookie; char buf[80]; char stringToSend[160]; int numBytesRecved; int totalNumBytes; sprintf(stringToSend,"buf: %08x cookie: %08x\n",&buf,&cookie); send(cs,stringToSend,strlen(stringToSend),NULL); The result is: buf: 0012fd00 cookie: 0012fcfc Now there is no way to set cookie to arbitrary data via overwriting buf. Is there any way to tell Visual Studio to allocate cookie before buf? Is there any way to tell beforehand how the variables will be allocated? Thanks, Jason

    Read the article

  • How to cache method results in .Net

    - by SP
    Using webmethods, caching the results is pretty straight forward using "CacheDuration" attribute. Is there a similar "easy" way to cache non-webmethod outputs (or static methods) based on the parameters? I would appreciate any help. Thanks in advance!

    Read the article

  • How do I use try...catch to catch floating point errors?

    - by Peter Stewart
    I'm using c++ in visual studio express to generate random expression trees for use in a genetic algorithm type of program. Because they are random, the trees often generate: divide by zero, overflow, underflow as well as returning "inf" and other strings. I can write handlers for the strings, but the literature left me baffled about the others. If I understand it correctly, I have to set some flags first? Advice and/or a pointer to some literature would be appreciated.

    Read the article

  • What is your favorite way to read XML files using C#?

    - by stacker
    Let's take this xml structure as example: <?xml version="1.0" encoding="utf-8"?> <Configuration-content> <XFile Name="file name 1" /> <XFile Name="name2" /> <XFile Name="name3" /> <XFile Name="name4" /> </Configuration-content> public class Configuration { public XFile[] Files { get; set; } } public interface IConfigurationRipository { Configuration Get(); void Save(Configuration entity); } I wonder what's the best way to do that. The task is to implement IConfigurationRipository using your favorite approach.

    Read the article

  • overridden three20 TTDefaultStyleSheet style not working

    - by funkadelic
    hi, i recently got three20 integrated into my app and am trying to override the default toolbar color in TTWebController. In TTWebController.m:118 I see that this is setting the toolbar's tintColor: _toolbar.tintColor = TTSTYLEVAR(toolbarTintColor); So I created my own stylesheet that subclasses TTDefaultStyleSheet and overrides toolbarTintColor FooStyleSheet.h: #import <Three20Style/Three20Style.h> #import <Three20Style/TTStyleSheet.h> #import <Three20Style/TTDefaultStyleSheet.h> @interface FooStyleSheet : TTDefaultStyleSheet @property (nonatomic, readonly) UIColor* toolbarTintColor; @end FooStyleSheet.m: #import "FooStyleSheet.h" @implementation RaptrStyleSheet - (UIColor*)toolbarTintColor { return RGBCOLOR(0, 0, 0); // should override TTDefaultStyleSheet } @end and in my application:didFinishLaunchingWithOptions: i set my default stylesheet [TTStyleSheet setGlobalStyleSheet:[[[FooStyleSheet alloc] init] autorelease]]; but when I view the TTWebController, it doesn't inherit my tintColor. If I edit TTDefaultStyleSheet.m directly: - (UIColor*)toolbarTintColor { return [UIColor blackColor]; } it works as expected. Is there something I am overlooking that is preventing my style to be picked up? thanks, -norm

    Read the article

  • How do I access the popup page DOM from bg page in Chrome extension?

    - by Fletcher Moore
    In Google Chrome's extension developer section, it says The HTML pages inside an extension have complete access to each other's DOMs, and they can invoke functions on each other. ... The popup's contents are a web page defined by an HTML file (popup.html). The popup doesn't need to duplicate code that's in the background page (background.html) because the popup can invoke functions on the background page I've loaded and tested jQuery, and can access DOM elements in background.html with jQuery, but I cannot figure out how to get access to DOM elements in popup.html from background.html.

    Read the article

  • Upcoming Script# Release and LIDNUG presentation

    A quick heads up on a Script# presentation for the Linked.NET user group on LinkedIn, and some words (ummm... teasers) on the upcoming script# release...[Full post continued here...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • MVC 2 Client Side Model Validation with ExtJS

    One of the most exciting new features in MVC 2 is "Enhanced Model Validation support across both server and client"; this new enhanced support allows for client side validation to be dynamically generated into a view from DataAnnotations attributes on models. One minor complaint: Out of the box, it only supports the Microsoft AJAX libraries. Good news: It can use other frameworks, and we have done just that! Ext.ux.MvcFormValidator The MvcFormValidator is an alternative form validation...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Launching a URL from an OOB Silverlight Application

    So I'm working on this code browser mostly to help me with my fading memory. In the app I want to be able to launch a url. So I do my normal thing and put a line of code that looks like this:System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(ThisURI), "_blank");I was agast when I realized that this didn't work, for that matter it didn't even blow... grr... but with a bit of research I found that the hyper link button worked so a ended up making a little class like this:public class MyHyperLink...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • An Hour With Bill Buxton MIX10

    After spending a couple of hours with Rowan Simpson yesterday afternoon I found myself continually coming back to some of the things that Bill Buxton talked about in his hour Q&A at MIX10 in Las Vegas. Dont have Silverlight? Download the video in WMV, WMV (High) or MP4 format. At the more theoretical level, Bill discusses technology as a human prosthesis, but he favours metaphors that are as far away from technology as possible. The Seattle Public Library and software building....Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >