Search Results

Search found 1642 results on 66 pages for 'dan morgan'.

Page 44/66 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • Programmatically downloaded file is larger than it should be

    - by Dan Revell
    I'm trying to download a file from SharePoint. The file itself is an InfoPath template although this is probably inconsequential. If I put the url into internet explorer and save the file to disk, it comes in at 4.47KB and works correctly. If I try to download from the same Url in code the it comes back as 21.9KB and is corrupt. Why it's coming down as corrupt I'm trying to work out. The following are two ways of downloading the file that both produce the corrupt file at 21.9KB: /// web client { WebClient wc = new WebClient(); wc.Credentials = CredentialCache.DefaultCredentials; wc.DownloadFile(templateUri, file); byte[] bytes = wc.DownloadData(templateUri); } /// web request { WebRequest request = WebRequest.Create(templateUri); request.Credentials = CredentialCache.DefaultCredentials; WebResponse responce = request.GetResponse(); StreamReader sr = new StreamReader(responce.GetResponseStream()); byte[] bytes = System.Text.Encoding.UTF8.GetBytes(sr.ReadToEnd()); } And this is how I write the data to disk using (FileStream fs = new FileStream(file, FileMode.Create, FileAccess.Write)) { fs.Write(bytes, 0, bytes.Length); }

    Read the article

  • Core Data: migrating entities with self-referential properties

    - by Dan
    My Core Data model contains an entity, Shape, that has two self-referential relationships, which means four properties. One pair is a one-to-many relationship (Shape.containedBy <- Shape.contains) and the another is a many-to-many relationship (Shape.nextShapes <<- Shape.previousShapes). It all works perfectly in the application, so I don't think self-referencing relationships is a problem in general. However, when it comes to migrating the model to a new version, then Xcode fails to compile the automatically generated mapping model, with this error message: 2009-10-30 17:10:09.387 mapc[18619:607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "FUNCTION($manager ,'destinationInstancesForSourceRelationshipNamed:sourceInstances:' , 'contains' , $source.contains) == 1"' *** Call stack at first throw: ( 0 CoreFoundation 0x00007fff80d735a4 __exceptionPreprocess + 180 1 libobjc.A.dylib 0x00007fff83f0a313 objc_exception_throw + 45 2 Foundation 0x00007fff819bc8d4 _qfqp2_performParsing + 8412 3 Foundation 0x00007fff819ba79d +[NSPredicate predicateWithFormat:arguments:] + 59 4 Foundation 0x00007fff81a482ef +[NSExpression expressionWithFormat:arguments:] + 68 5 Foundation 0x00007fff81a48843 +[NSExpression expressionWithFormat:] + 155 6 XDBase 0x0000000100038e94 -[XDDevRelationshipMapping valueExpressionAsString] + 260 7 XDBase 0x000000010003ae5c -[XDMappingCompilerSupport generateCompileResultForMappingModel:] + 2828 8 XDBase 0x000000010003b135 -[XDMappingCompilerSupport compileSourcePath:options:] + 309 9 mapc 0x0000000100001a1c 0x0 + 4294973980 10 mapc 0x0000000100001794 0x0 + 4294973332 ) terminate called after throwing an instance of 'NSException' Command /Developer/usr/bin/mapc failed with exit code 6 The 'contains' is the name of one of the self-referential properties. Anyway, the really big problem is that I can't even look at this Mapping Property as Xcode crashes as soon as I select the entity mapping when viewing the mapping model. So I'm a bit lost really where to go from here. I really can't remove the self-referential properties, so I'm thinking I've got manually create a mapping model that compiles? Any ideas? Cheers

    Read the article

  • Determine when using the VC90 compiler in VS2010 instead of VS2008?

    - by Dan
    Is there a (Microsoft-specific) CPP macro to determine when I'm using the VC9 compiler in Visual Studio 2010 as opposed to Visual Studio 2008? _MSC_VER returns the compiler version, so with VS2010 multi-targeting feature, I'll get the same result as with VS2008. The reason for wanting to know the difference is that I created a new VS2010 project which contains code removed from a larger project. I just left the VS2008 stuff "as is" since we're moving away from VS2008 "soon" anyway and I didn't want to go through the hassle of creating a vcproj file along with the new vcxproj. For now, I've just defined my own macro to indicate whether the code is compiled into its own DLL or not; it works just fine, but it would be nice if there were something slightly more elegant.

    Read the article

  • Installer/packager for a Java application for Ubuntu and SuSE

    - by Dan
    I have a Java application complied to a collection of jars that I want to make installable on Ubuntu and SuSE. I Want the installer to be able to check for the JRE, register a file association and be able to load a website on un-install. I understand Ubuntu and SuSE are based on different architectures, so is there a consistent way to do this? Does anyone have an advice on utilities to use or guides to read to help me achieve what I'm trying to do.

    Read the article

  • Enable debugging in Design mode in VS

    - by Dan Tao
    Is there any way to enable debugging from within the Windows Forms Designer in Visual Studio (any version, up to and including 2010)? What I mean is, say I have some custom user control, and this control has certain validation that it performs when I set a particular property. I'd like to be able to set a breakpoint somewhere within that code, and step through it to see what happens when I set the property from the designer.

    Read the article

  • For loop with a non-integer increment in VB.NET

    - by Dan Tao
    Can a VB.NET For loop be constructed that mimics this C# code? TimeSpan oneDay = TimeSpan.FromDays(1.0); for (DateTime d = startDate; d < endDate; d += oneDay) { // some code } Obviously you could do it without a For loop (i.e., with a While); I'm just curious if there's a certain syntax to construct a VB.NET For loop with a non-integer increment that I'm not aware of.

    Read the article

  • Download office document without the web server trying to render it

    - by Dan Revell
    I'm trying to download an InfoPath template that's hosted on SharePoint. If I hit the url in internet explorer it asks me where to save it and I get the correct file on my disk. If I try to do this programmatically with WebClient or HttpWebRequest then I get HTML back instead. How can I make my request so that the web server returns the actual xsn file and doesn't try to render it in html. If internet explorer can do this then it's logical to think that I can too. I've tried setting the Accept property of the request to application/x-microsoft-InfoPathFormTemplate but that hasn't helped. It was a shot in the dark.

    Read the article

  • Using Geo APIs to pick a random town from anywhere in the world

    - by Dan Forys
    Hi all, I'm trying to use Yahoo's excellent GeoPlanet API: http://developer.yahoo.com/geo/geoplanet/guide/api-reference.html I would like to pick a random town from anywhere in the world but can't see an easy way to do it. I have tried querying by country and asking for children of type 'town', but can't seem to do that directly. Can anyone think of a way to pluck out a random town WOEID without having to query the country, then the admin regions, then the admin 2, then the admin 3 etc. I have also experimented using YQL, but don't have enough of an understanding about the available APIs.

    Read the article

  • Java GUI libraries

    - by Dan
    I have been working with the Swing library for a long time, I'm working on a new project for school and due to the nature of the program it can't look like a generic/boring swing gui. So my question is does anyone know of an interesting java gui library that is not swing or awt?

    Read the article

  • Mapping Vectors

    - by Dan Snyder
    Is there a good way to map vectors? Here's an example of what I mean: vec0 = [0,0,0,0,0,0,0,0,0,0,0] vec1 = [1,4,2,7,3,2] vec2 = [0,0,0,0,0,0,0,0,0] vec2 = [7,2,7,9,9,6,1,0,4] vec4 = [0,0,0,0,0,0] mainvec = [0,0,0,0,0,0,0,0,0,0,0,1,4,2,7,3,2,0,0,0,0,0,0,0,0,0,7,2,7,9,9,6,1,0,4,0,0,0,0,0,0] Lets say mainvec doesn't exist (I'm just showing it to you so you can see the general data structure in mind. Now say I want mainvec(12) which would be 4. Is there a good way to map the call of these vectors without just stitching them together into a mainvec? I realize I could make a bunch of if statements that test the index of mainvec and I can then offset each call depending on where the call is within one of the vectors, so for instance: mainvec(12) = vec1(1) which I could do by: mainvec(index) if (index >=13) vect1(index-11); I wonder if there's a concise way of doing this without if statements. Any Ideas?

    Read the article

  • How to debug macruby?

    - by Dan
    Hi, I've encountered an inconsistent bug with MacRuby and have no idea how to go about debugging this. If anyone could help would be great. I don't know if this is due to my own code or is it a bug in the MacRuby framework. I have a feeling it's my own code, something about over-retaining a piece of memory and hence the garbage collection failed. This is the error from Xcode. Thanks. CSV Wizard(30245,0x7fff704f7ca0) malloc: resurrection error for object 0x20199da20 while assigning {conservative-block}[196608](0x302360060)[117616] = Array[64](0x20199da20) garbage pointer stored into reachable memory, break on auto_zone_resurrection_error to debug CSV Wizard(30245,0x103781000) malloc: garbage block 0x20199da20(Array[64]) was over-retained during finalization, refcount = 1 This could be an unbalanced CFRetain(), or CFRetain() balanced with -release. Break on auto_zone_resurrection_error() to debug. CSV Wizard(30245,0x103781000) malloc: fatal resurrection error for garbage block 0x20199da20(Array[64]): over-retained during finalization, refcount = 1

    Read the article

  • Is registering your app through iTunesConnect required to test GameKit integration?

    - by Dan K.
    I'd like to add GameKit integration to my app. I was hoping to be able to evaluate how it works. From the docs I found, it seems that I have to register my app through iTunes Connect first. I'm new to the iOS development front, so maybe I'm wrong here, but it seems like registering your app in iTunes Connect is a pretty final step, and I'd like to be able to test things before going through that step. So, I guess I have two questions: 1.) Do I have to register my app with iTunes Connect before being able to use GameKit? 2.) Am I being crazy about not wanting to register with iTunes Connect yet? Should I stop worrying and just do it?

    Read the article

  • Assign multiple Emacs keybindings to a single command?

    - by Dan
    I'm giving ErgoEmacs mode a try to see if I can use Emacs more comfortably. Some of its keybindings are fairly intuitive, but in many cases I don't want to outright replace the defaults. For example, in the context of ErgoEmacs' navigation shortcut structure, M-h makes sense as a replacement for C-a--but I want to be able to use both, not just M-h. I tried simply duplicating the commands: ;; Move to beginning/ending of line (defconst ergoemacs-move-beginning-of-line-key (kbd "C-a")) ; original (defconst ergoemacs-move-end-of-line-key (kbd "C-e")) ; original (defconst ergoemacs-move-beginning-of-line-key (kbd "M-h")) ; ergoemacs (defconst ergoemacs-move-end-of-line-key (kbd "M-H")) ; ergoemacs But Emacs simply overwrites the first keybinding with the second. What's the best way to address this?

    Read the article

  • Working with OAuth on Google with Python

    - by Dan Loewenherz
    I'm having a very frustrating time creating a valid signature for Google's OAuth implementation. I have narrowed it all down to the fact that my signature-generation code has an error of some sort; what it is I have no idea. This is the signature base string in its entirety: GET&https%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthGetAccessToken&oauth_consumer_key%3Ddlosplayground.appspot.com%26oauth_nonce%3D72815d55697cb24301fab03e1f7f1d66%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1274327867%26oauth_token%3D4%252FX2cZ54JuseQbgRwzTBzZ7lqIwqof%26oauth_verifier%3Dihf0F2Fx%252FpnCmwbVQnk2xMre%26oauth_version%3D1.0 The OAuth Playground returns an oauth_signature of gF8qAfWjpdKjKb4KR%2FvA2Gy0vhU%3D. My code gives me ikMpIKJQJ58jseg%2BKPBTecjmYPE%3D, so obviously I'm doing something wrong. Here's my signature generation code (equivalent to that of the standard oauth.py library): binascii.b2a_base64(hmac.new(CONSUMER_SECRET, BASE_STRING, hashlib.sha1).digest())[:-1] Any thoughts?

    Read the article

  • How to dynamically set validation messages on properties with a class validation attribute

    - by Dan
    I'm writing Validation attribute that sits on the class but inspects the properties of the class. I want it to set a validation message on each of the properties it finds to be invalid. How do I do this? This is what I have got so far: [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public class LinkedFieldValidationAttribute : ValidationAttribute { private readonly string[] _properiesToValidate; public LinkedFieldValidationAttribute(params string[] properiesToValidate) { _properiesToValidate = properiesToValidate; } public override bool IsValid(object value) { PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(value); foreach (var propertyName in _properiesToValidate) { var propertyValue = properties.Find(propertyName, false).GetValue(value); //if value is invalid add message from base } //return validity } }

    Read the article

  • Accessing contents of NativeWindow in a HTML AIR application?

    - by Dan Scotton
    I'm currently building a HTML/JS AIR application. The application needs to display to the user a different 'window' - dependant on whether this is the first time they've launched the application or not. This part is actually fine and I have the code below to do that: if(!startUp()) { // this simply returns a boolean from a local preferences database that gets shipped with the .air // do first time stuff var windowOptions = new air.NativeWindowInitOptions(); windowOptions.systemChrome = 'none'; windowOptions.type = 'lightweight'; windowOptions.transparent = 'true'; windowOptions.resizable = 'false'; var windowBounds = new air.Rectangle(300, 300, 596, 490); var newHtmlLoader = air.HTMLLoader.createRootWindow(true, windowOptions, true, windowBounds); newHtmlLoader.load(new air.URLRequest('cover.html')); } else { // display default window // just set nativeWindow.visible = true (loaded from application.xml) } However, what I want to be able to do is manipulate the html content from within cover.html after it has loaded up. There seems to be plenty of tutorials online of how to move, resize, etc. the NativeWindow, but I simply want access to the NativeWindow's HTML content. For example, how would I add a new paragraph to that page? I've tried the following: newHtmlLoader.window.opener = window; var doc = newHtmlLoader.window.opener.document.documentElement; Using AIR's Introspector console, ....log(doc) returns [object HTMLHtmlElement]. Hmm, seems promising right? I then go on to try: var p = document.createElement('p'); var t = document.createTextNode('Insert Me'); p.appendChild(t); doc.appendChild(p); ...but nothing gets inserted. I've also tried the following replacements for doc: var doc = newHtmlLoader.window.opener.document.body; // .log(doc) -> [object HTMLBodyElement] var doc = newHtmlLoader.window.opener.document; // .log(doc) -> Error: HIERARCHY_REQUEST_ERR: DOM Exception 3 ...as well as the following with jQuery: $(doc).append('<p>Insert Me</p>'); // again, nothing So, anyone had any experience in accessing a NativeWindow's inner content programmatically? Any help will be greatly appreciated.

    Read the article

  • Generating an Excel file in ASP.NET

    - by Dan Coates
    I am about to add a section to an ASP.NET app (VB.NET codebehind) that will allow a user to get data returned to them as an Excel file, which I will generate based on database data. While there are several ways of doing this, each has its own drawbacks. How would you return the data? I'm looking for something that's as clean and straightforward as possible.

    Read the article

  • How to put 1000 lightweight server applications in the cloud

    - by Dan Bird
    The company I work for sells a commercial desktop/server app that runs on any non dedicated Windows PC or server and uses Tomcat for all interactions with the application. Customers are asking that we host their instance of the application so they don't have to run it locally on their own servers. The app is lightweight and an average server, in theory, could handle 25-50 instances before users would notice a slowdown. However only 1 instance can run per Windows instance (because the application writes to a common registry branch) so we'd need something like VMWare to create 25-50 Windows instances. We know we eventually need to reprogram to make it truly cloud-worthy but what would you recommend for a server farm or whatever for this? We don't have the setup to purchase our own servers so we must use a 3rd party. We have budgeted $500 - $1000 per year per customer for this service. Thanks in advance for your suggestions, experiences and guidance.

    Read the article

  • Is there a non-blocking version of MessageBox.Show (or something like it)?

    - by Dan Tao
    Often you just want to notify the user that something has occurred, but there's really no need for any input from them. In this common scenario, I sometimes see code like this: MessageBox.Show("Something has occurred", "Something", MessageBoxButtons.OK); This code, as we all know, causes a little pop-up window to appear with only an OK button. Now here's the thing: this code blocks (the UI thread). But in the vast majority of cases, it seems to me, if you only have an OK button, there's very little need to block. (Isn't the purpose of blocking typically to receive some input from the user? And if the user's only choice is "OK," in this typical case, isn't blocking pretty pointless?) Obviously I could just write my own little form that does basically exactly what MessageBox.Show does, except that it returns nothing (no DialogResult) and doesn't block. But I was just wondering if something like this exists already that I didn't know about.

    Read the article

  • Business Object desgin

    - by Dan
    I have a question about how I setup my BO's. I setup the BO's to contain all of my properties of the object as well as the business logic to satisfy the business rules. I decided to make all of the methods static, but I'm not sure if that was the right decision. Someone told me to split my BO's into an Entity Object of just properties and then a BO of just methods that do business rules, and don't make the methods static. Does anyone have some experience with the way i've set this up? Any examples of how it might work better for future growth? Thanks!

    Read the article

  • Moving front page (cursebird or foursquare)

    - by Dan Samuels
    Ok so I'll be honest, I have a good amount of experience with php/mysql, I've just started learning jQuery and I've done very little, but some with ajax. So using the terms ajax/jquery interchangeably are a bit confusing to me. Anyway as the title suggest I have a website with 5 items, and I want them to move (meaning, if a more recent one is entered, remove the last item, and put the new one on top), they are 5 of the most recent items in the database table, now I've coded jquery as a test so it fades out the last one, the whole thing moves down, makes room at the top, and fades in a new one. However, it's a test and has 0 interaction with the database, the one that fades in is just in a hidden div. So the jQuery part is taken care of. So I'm unsure how to go about this, I was thinking maybe have ajax check a website off the page that has those 5 items in raw format, and if they change then to refresh? Not looking for a "plz code 4 me" answer, just the concept of how it would work, or some links to get off to the right start. edit - Also, the 5 items are ranked, so if I click item 3 I need it to move above item 2 refreshlessly, so this causes a whole other issue I assume.

    Read the article

  • How to approach parallel processing of messages?

    - by Dan
    I am redesigning the messaging system for my app to use intel threading building blocks and am stumped trying to decide between two possible approaches. Basically, I have a sequence of message objects and for each message type, a sequence of handlers. For each message object, I apply each handler registered for that message objects type. The sequential version would be something like this (pseudocode): for each message in message_sequence <- SEQUENTIAL for each handler in (handler_table for message.type) apply handler to message <- SEQUENTIAL The first approach which I am considering processes the message objects in turn (sequentially) and applies the handlers concurrently. Pros: predictable ordering of messages (ie, we are guaranteed a FIFO processing order) (potentially) lower latency of processing each message Cons: more processing resources available than handlers for a single message type (bad parallelization) bad use of processor cache since message objects need to be copied for each handler to use large overhead for small handlers The pseudocode of this approach would be as follows: for each message in message_sequence <- SEQUENTIAL parallel_for each handler in (handler_table for message.type) apply handler to message <- PARALLEL The second approach is to process the messages in parallel and apply the handlers to each message sequentially. Pros: better use of processor cache (keeps the message object local to all handlers which will use it) small handlers don't impose as much overhead (as long as there are other handlers also to be run) more messages are expected than there are handlers, so the potential for parallelism is greater Cons: Unpredictable ordering - if message A is sent before message B, they may both be processed at the same time, or B may finish processing before all of A's handlers are finished (order is non-deterministic) The pseudocode is as follows: parallel_for each message in message_sequence <- PARALLEL for each handler in (handler_table for message.type) apply handler to message <- SEQUENTIAL The second approach has more advantages than the first, but non-deterministic ordering is a big disadvantage.. Which approach would you choose and why? Are there any other approaches I should consider (besides the obvious third approach: parallel messages and parallel handlers, which has the disadvantages of both and no real redeeming factors as far as I can tell)? Thanks!

    Read the article

  • Why am I getting this warning about my app delegate and CLLocationManageDelegate?

    - by Dan Ray
    Observe this perfectly simple UIViewController subclass method: -(IBAction)launchSearch { OffersSearchController *search = [[OffersSearchController alloc] initWithNibName:@"OffersSearchView" bundle:nil]; EverWondrAppDelegate *del = [UIApplication sharedApplication].delegate; [del.navigationController pushViewController:search animated:YES]; [search release]; } On the line where I get *del, I am getting a compiler warning that reads, Type 'id <UIApplicationDelegate>' does not conform to the 'CLLocationManagerDelegate' protocol. In fact, my app delegate DOES conform to that protocol, AND what I'm doing here has nothing at all to do with that. So what's up with that message? Secondary question: sometimes I can get to my navigationController via self.navigationController, and sometimes I can't, and have to go to my app delegate's property to get it like I'm doing here. Any hint about why that is would be very useful.

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >