Search Results

Search found 106 results on 5 pages for 'cheeso'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • XmlReader throws on an RSS feed, when the RSS document includes an embedded <script> block.

    - by Cheeso
    The code: using (XmlReader xmlr = XmlReader.Create(new StringReader(allXml))) { var items = from item in SyndicationFeed.Load(xmlr).Items select item; } The exception: Exception: System.Xml.XmlException: Unexpected node type Element. ReadElementString method can only be called on elements with simple or empty content. Line 11, position 25. at System.Xml.XmlReader.ReadElementString() at System.ServiceModel.Syndication.Rss20FeedFormatter.ReadXml(XmlReader reader, SyndicationFeed result) at System.ServiceModel.Syndication.Rss20FeedFormatter.ReadFeed(XmlReader reader) at System.ServiceModel.Syndication.Rss20FeedFormatter.ReadFrom(XmlReader reader) at System.ServiceModel.Syndication.SyndicationFeed.Load[TSyndicationFeed](XmlReader reader) at System.ServiceModel.Syndication.SyndicationFeed.Load(XmlReader reader) at Ionic.ToolsAndTests.ReadRss.Run() in c:\dev\dotnet\ReadRss.cs:line 90 The XML content: <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/roller-ui/styles/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" > <channel> <title>Software architecture, software engineering, and Renaissance Jazz</title> <link>https://www.ibm.com/developerworks/mydeveloperworks/blogs/gradybooch</link> <atom:link rel="self" type="application/rss+xml" href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/gradybooch/feed/entries/rss?lang=en" /> <description>Software architecture, software engineering, and Renaissance Jazz</description> <language>en-us</language> <copyright>Copyright <script type='text/javascript'> document.write(blogsDate.date.localize (1273534889181));</script></copyright> <lastBuildDate>Mon, 10 May 2010 19:41:29 -0400</lastBuildDate> As you can see, on line 11, at position 25, there's a script block inside the <copyright> element. Other people have reported similar errors with other XML documents. The way I worked around this was to do a StreamReader.ReadToEnd, then do Regex.Replace on the result of that to yank out the script block, before passing the modified string to XmlReader.Create(). Feels like a hack. Has anyone got a better approach? I don't like this because I have to read in a 125k string into memory. Is it valid rss to include "complex content" like that - a script block inside an element? Thanks.

    Read the article

  • jQuery: how can I clear content without getting the dreaded "stop running this script?" dialog?

    - by Cheeso
    I have a div, that holds a div. like this: <div id='reportHolder' class='column'> <div id='report'> </div> </div> Within the inner div, I add a bunch (7-12) of pairs of a and div elements, like this: <h4><a>Heading1</a></h4> <div> ...content here....</div> The total size of the content, is maybe 200k. Each div just contains a fragment of HTML. After I add all the content, I then create an accordion. like this: $('#report').accordion({collapsible:true, active:false}); This all works fine. The problem is, when I try to clear or remove the report div, it takes a looooooong time, and I get 3 or 4 popups asking "Do you want to stop running this script?" I have tried several ways: option 1: $('#report').accordion('destroy'); $('#report').remove(); $("#reportHolder").html("<div id='report'> </div>"); option 2: $('#report').accordion('destroy'); $('#report').html(''); $("#reportHolder").html("<div id='report'> </div>"); option 3: $('#report').accordion('destroy'); $("#reportHolder").html("<div id='report'> </div>"); No matter what, it hangs for a long while. The call to accordion('destroy') seems to not be the source of the delay. It's the erasure of the html content within the report div. EDIT - fixed typo. ps: this happens on FF3.5 as well as IE8 . Questions: What is taking so long? How can I remove content more quickly?

    Read the article

  • Does JSONP scale? How many JSONP requests can I send?

    - by Cheeso
    Based on Please explain JSONP, I understand that JSONP can be used to get around the same-origin policy. But in order to do that, the page must use a <script> tag. I know that pages can dynamically emit new script tags, such as with: <script type="text/javascript" language='javascript'> document.write('<script type="text/javascript" ' + 'id="contentloadtag" defer="defer" ' + 'src="javascript:void(0)"><\/script>'); var contentloadtag=document.getElementById("contentloadtag"); contentloadtag.onreadystatechange=function(){ if (this.readyState=="complete") { init(); } } </script> (the above works in IE, don't think it works in FF). ... but does this mean, effectively, that every JSONP call requires me to emit another <script> tag into the document? Can I remove the <script> tags that are done?

    Read the article

  • java: can I convert strings with String.getBytes() without the BOM?

    - by Cheeso
    Suppose I have this code: String encoding = "UTF-16"; String text = "[Hello StackOverflow]"; byte[] message= text.getBytes(encoding); If I display the byte array in message, the result is: 0000 FE FF 00 5B 00 48 00 65 00 6C 00 6C 00 6F 00 20 ...[.H.e.l.l.o. 0010 00 53 00 74 00 61 00 63 00 6B 00 4F 00 76 00 65 .S.t.a.c.k.O.v.e 0020 00 72 00 66 00 6C 00 6F 00 77 00 5D .r.f.l.o.w.] As you can see, there's a BOM in the beginning. How can I: generate a UTF-16 byte array that lacks a BOM ? convert from a byte array that contains UTF=16 chars but lacks a BOM, back to a string?

    Read the article

  • How can I send a GET request containing a colon, to an ASP.NET MVC2 controller?

    - by Cheeso
    This works fine: GET /mvc/Movies/TitleIncludes/Lara%20Croft When I submit a request that contains a colon, like this: GET /mvc/Movies/TitleIncludes/Lara%20Croft:%20Tomb ...it generates a 400 error. The error says ASP.NET detected invalid characters in the URL. If I try url-escaping, the request looks like this: GET /mvc/Movies/TitleIncludes/Lara%20Croft%3A%20Tomb ...and this also gives me a 400 error. If I replace the colon with a | : GET /mvc/Movies/TitleIncludes/Lara%20Croft|%20Tomb ..that was also rejeted as illegal, this time with a 500 error. The message: Illegal characters in path. URL-escaping that | results in the same error. I really, really don't want to use a querystring parameter. related: Sending URLs/paths to ASP.NET MVC controller actions

    Read the article

  • Why can I not install ASPNET MVC2 from the Web Platform Installer? (Error: "requires VS2008 SP1", bu

    - by Cheeso
    I went to http://www.asp.net/mvc/ to try to install ASP.NET MVC. I didn't know, but MVC is now at version 2. There's a nifty thing called the Microsoft "Web Platform Installer" (WPI) which basically is a small installer-driver tool that presents a menu of things I might want to install, to do web things on Windows. On the menu are things like ASPNET MVC2, but also Drupal, PHP, Joomla, and a bunch of other things. From http://www.asp.net/mvc/, when I click on the link that says "Install MVC", it resolves to http://go.microsoft.com/fwlink/?LinkID=185037, which then pops up the WPI. But Then! I get an error dialog that reads "Installing ASPNET MVC2 requires VS2008 SP1". But I know that I have VS2008 SP1. What gives?

    Read the article

  • Do overlays/tooltips work correctly in Emacs for Windows?

    - by Cheeso
    I'm using Flymake on C# code, emacs v22.2.1 on Windows. The Flymake stuff has been working well for me. For those who don't know, you can read an overview of flymake, but the quick story is that flymake repeatedly builds the source file you are currently working on in the background, for the purpose of doing syntax checking. It then highlights the compiler warnings and erros in the current buffer. Flymake didn't work for C# initially, but I "monkey-patched it" and it works nicely now. If you edit C# in emacs, I highly recommend using flymake. The only problem I have is with the UI. Flymake highlights the errors and warnings nicely, and then inserts "overlays" with the full error or warning text. IF I hover the mouse pointer over the highlighted line in code, the overlay pops up. But as you can see, the overlay (tooltip) is truncated, and it doesn't display correctly. Flymake seems to be doing the right thing, it's the overlay part that seems broken., and overlay seems to do the right thing. It's the tooltip that is displayed incorrectly. Do overlays tooltips work correctly in emacs for Windows? Where do I look to fix this?

    Read the article

  • Please explain JSONP

    - by Cheeso
    I don't understand jsonp. I understand JSON. I don't understand JSONP. Wikipedia is the top search result for JSONP. It says JSONP or "JSON with padding" is a JSON extension wherein a prefix is specified as an input argument of the call itself. Huh? What call? That doesn't make any sense to me. JSON is a data format. There's no call. The 2nd search result is from some guy named Remy, who writes JSONP is script tag injection, passing the response from the server in to a user specified function. I can sort of understand that, but it's still not making any sense. What is JSONP, why was it created (what problem does it solve), and why would I use it? Addendum: I've updated Wikipedia with a clearer and more thorough description of JSONP, based on jvenema's answer. Thanks, all.

    Read the article

  • Can HTTP URIs have non-ASCII characters?

    - by Cheeso
    I tried to find this in the relevant RFC, IETF RFC 3986, but couldn't figure it. Do URIs for HTTP allow Unicode, or non-ASCII of any kind? Can you please cite the section and the RFC that supports your answer. NB: For those who might think this is not programming related - it is. It's related to an ISAPI filter I'm building. Addendum I've read section 2.5 of RFC 3986. But RFC 2616, which I believe is the current HTTP protocol, predates 3986, and for that reason I'd suppose it cannot be compliant with 3986. Furthermore, even if or when the HTTP RFC is updated, there still will be the issue of rationalization - in other words, does an HTTP URI support ALL of the RFC3986 provisos, including whatever is appropriate to include non US-ASCII characters?

    Read the article

  • nmake.exe: is there a way to exclude a file from a set of files specified in a macro?

    - by Cheeso
    I'm looking for something like the Exclude filter for msbuild, but I Want it in a makefile processed by nmake. Is that possible? Suppose I have a makefile that defines this macro: SOURCES=xxx.c yyy.c zzz.c and I invoke it with nmake OLD=xxx.c NEW=bbb.c ...can I produce, within the makefile, a macro with a value like: yyy.c zzz.c bbb.c ...basically substituting bbb.c for xxx.c ? The files can appear in any order. This would be pretty easy if the string substitution that is possible in nmake macros, allowed for evaluation of macros. In other words, I can do sources=xxx.c yyy.c zzz.c objs=$(sources:.c=.o) and the value of $(objs) is xxx.o yyy.o zzz.o But nmake does not allow a macro for the value of either argument to that substitution. I cannot do this: new=.o sources=xxx.c yyy.c zzz.c objs=$(sources:.c=$(new))

    Read the article

  • DIY intellisense on XPath - design approach? (WinForms app)

    - by Cheeso
    I read the DIY Intellisense article on code project, which was referenced from the Mimic Intellisense? question here on SO. I wanna do something similar, DIY intellisense, but for XPath not C#. The design approach used there makes sense to me: maintain a tree of terms, and when the "completion character" is pressed, in the case of C#, a dot, pop up the list of possible completions in a textfield. Then allow the user to select a term from the textfield either through typing, arrow keys, or double-click. How would you apply this to XPath autocompletion? should there be an autocomplete key? In XPath there is no obvious separator key like "dot" in C#. should the popup be triggered explicitly in some other way, let's say ctrl-. ? or should the parser try to autocomplete continuously? If I do the autocomplete continuously, how to scale it properly? There are 93 xpath functions, not counting overloads. I certainly don't want to popup a list of 93 choices. How do I decide when I've narrowed it enough to offer a useful lsit of possible completions? How to populate the tree of possible completions? For C#, it's easy: walk the type space via reflection. At a first level, the "syntax tree" for C# seems like a single tree, and the list of completions at any point depends on the graph of nodes you've traversed to that point. Typing System.Console. traverses to a certain node in that tree, and the list of completions is the set of child nodes available at that node in the tree. On the other hand, the xpath syntax seems like it is a "flatter" tree - function names, axis names, literals. Does this make sense? what have I not considered?

    Read the article

  • WCF and streaming requests and responses

    - by Cheeso
    Is it correct that in WCF, I cannot have a service write to a stream that is received by the client? My understanding is that streaming is supported in WCF for requests, responses, or both. Is it true that in all cases, the receiver of the stream must invoke Read ? I would like to support a scenario where the receiver of the stream can Write on it. Is this supported? Let me show it this way. The simplest example of Streaming in WCF is the service returning a FileStream to a client. This is a streamed response. The server code is like this: [ServiceContract] public interface IStreamService { [OperationContract] Stream GetData(string fileName); } public class StreamService : IStreamService { public Stream GetData(string filename) { FileStream fs = new FileStream(filename, FileMode.Open) return fs; } } And the client code is like this: StreamDemo.StreamServiceClient client = new WcfStreamDemoClient.StreamDemo.StreamServiceClient(); Stream str = client.GetData(@"c:\path\to\myfile.dat"); do { b = str.ReadByte(); //read next byte from stream ... } while (b != -1); (example taken from http://blog.joachim.at/?p=33) Clear, right? The server returns the Stream to the client, and the client invokes Read on it. Is it possible for the client to provide a Stream, and the server to invoke Write on it? In other words, rather than a pull model - where the client pulls data from the server - it is a push model, where the client provides the "sink" stream and the server writes into it. Is this possible in WCF, and if so, how? What are the config settings required for the binding, interface, etc? The analogy is the Response.OutputStream from an ASP.NET request. In ASPNET, any page can invoke Write on the output stream, and the content is received by the client. Can I do something similar in WCF? Thanks.

    Read the article

  • emacs: x-popup-menu max size constraints?

    - by Cheeso
    I'm working on an intellisense or code-completion capability for C#. So far, so good. Right now I have basic completion working. There are 2 ways to request completion. The first cycles through all the potential matches. The second presents a popup menu of the matches. It works for types: And also for local variables: I'm confronting two problems with x-popup-menu: the popup menu can expand to consume all available screen space, when the number of choices is large. Literally it can obscure the entire screen. The silly thing is, it's scrollable. First it expands to consume all available space, then it also becomes scrollable. Is there a way I can limit the maximum size of x-popup-menu? To specify the position of the popup menu, I pass in a position, and x-popup-menu uses that as the *middle*, not the left, of the top line of the menu. Why middle? who knows. What this means is, if I specify (40 . 60) for the location of the menu, and the menu happens to be 100 pixels wide, the menu will extend beyond the left border of the emacs window. You can see this in the 2nd image above. If I knew how wide the popup would be before specifying the position, I could compensate. But I don't. Is there a workaround? Is there a way to get x-popup-menu to take its position as the LEFT rather than the middle.

    Read the article

  • Windows Live Messenger Activity SDK: Is it possible to use jQuery?

    - by Cheeso
    There's an SDK that lets developers build "activities" and games for use in Windows Live Messenger. The basic approach is to build a web app, that gets approved and hosted by Microsoft. questions Anyone done this? Can you use jQuery in that web app? how do you debug the thing, running within Windows Live Messenger? EDIT: I tried using jQuery, but couldn't get it to do much of anything. I also couldn't debug it at all, when running within the IM client. The IE8 F12 debug tools are not available in that context. I believe the embedded browser was silently not loading external script, and then silently throwing exceptions. So I backed off to use only script in the .HTM file. Since it is Windows Live Messenger, the embedded browser is IE, so the generality made possible in jQuery isn't strictly necessary. I was able to use old-skool DHTML interfaces to get done, what I needed. I'm still interested in seeing examples of what other people have produced in the way of WLM Activities or games, using the Messenger Activity SDK. I think Flash is possible, and I think XAML is also possible, but I haven't seen source code examples for any of those.

    Read the article

  • WinForms: How do I simulate button behavior on an image?

    - by Cheeso
    I have an extension of the winforms TabControl, it's draws an X on each tab to allow the user to close the tab. How can I similate button look&feel on that image? It's not a button, it's not even an image control. It's just been drawn there. Is there a way to draw an inset border on MouseDown and Raised on MouseUp? Would I be better off generating another image, for the "inset" phase? anyone done this before? Related: Simulate Winforms Button Click Animation But this question is different because he actually has a PictureBox control. I don't.

    Read the article

  • nmake: can a batch file run as a art of a command block, affect the environment of the nmake.exe pro

    - by Cheeso
    I think in nmake if I do this: example : set value=77 echo %%value%% The result will display 77 on the console. Is there a way for me to invoke a .cmd or .bat file that will affect the environment of the nmake.exe process? Suppose I put the statement set value=77 in a file called "setvalue.cmd". Then change the makefile to this: example : setvalue echo %%value%% I get: %value% Alternatively, if there's a way to set a macro within a command block, that would also work. Or, a way to set the value of a macro from a batch file, even outside a command block.

    Read the article

  • Is it just me? I find LINQ to XML to be sort of cumbersome, compared to XPath.

    - by Cheeso
    I am a C# programmer, so I don't get to take advantage of the cool XML syntax in VB. Dim itemList1 = From item In rss.<rss>.<channel>.<item> _ Where item.<description>.Value.Contains("LINQ") Or _ item.<title>.Value.Contains("LINQ") Using C#, I find XPath to be easier to think about, easier to code, easier to understand, than performing a multi-nested select using LINQ to XML. Look at this syntax, it looks like Greek swearing: var waypoints = from waypoint in gpxDoc.Descendants(gpx + "wpt") select new { Latitude = waypoint.Attribute("lat").Value, Longitude = waypoint.Attribute("lon").Value, Elevation = waypoint.Element(gpx + "ele") != null ? waypoint.Element(gpx + "ele").Value : null, Name = waypoint.Element(gpx + "name") != null ? waypoint.Element(gpx + "name").Value : null, Dt = waypoint.Element(gpx + "cmt") != null ? waypoint.Element(gpx + "cmt").Value : null }; All the casting, the heavy syntax, the possibility for NullPointerExceptions. None of this happens with XPath. I like LINQ in general, and I use it on object collections and databases, but my first go-round with querying XML led me right back to XPath. Is it just me? Am I missing something? EDIT: someone voted to close this as "not a real question". But it is a real question, stated clearly. The question is: Am I misunderstanding something with LINQ to XML?

    Read the article

  • CSS: Is it possible to get a div that is 100% height, less a top and bottom margin?

    - by Cheeso
    I can get a 100% height div, like this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <title>T5</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <style type="text/css"> * { padding: 0; margin: 0; } html, body { height: 100%; } body { font-family: "lucida sans", verdana, arial, helvetica, sans-serif; font-size: 75%; } h1 { font-size: 1.4em; padding: 10px 10px 0; } p { padding: 0 10px 1em; } #container { min-height: 100%; background-color: #DDD; border-left: 2px solid #666; border-right: 2px solid #666; width: 280px; margin: 0 auto; } * html #container { height: 100%; }</style> </head> <body> <div id="container"> <h1>100% Height Div</h1> <p>Lorem...</p> <p>Ut ...</p> </div> </body> </html> But is it possible to get a div with a height of "almost 100%" height? If I want margins at the top and bottom, can I do that? Margins as indicated here:

    Read the article

  • Do overlays work correctly in Emacs for Windows?

    - by Cheeso
    I'm using Flymake on C# code, emacs v22.2.1 on Windows. The Flymake stuff has been working well for me. For those who don't know, you can read an overview of flymake, but the quick story is that flymake repeatedly builds the source file you are currently working on in the background, for the purpose of doing syntax checking. It then highlights the compiler warnings and erros in the current buffer. Flymake didn't work for C# initially, but I "monkey-patched it" and it works nicely now. If you edit C# in emacs, I highly recommend using flymake. The only problem I have is with the UI. Flymake highlights the errors and warnings nicely, and then inserts "overlays" with the full error or warning text. IF I hover the mouse pointer over the highlighted line in code, the overlay pops up. But as you can see, the overlay is truncated, and it doesn't display correctly. Flymake seems to be doing the right thing, it's the overlay part that seems broken. Do overlays work correctly in emacs for Windows? Where do I look to fix this?

    Read the article

  • .NET: What is the purpose of the ProhibitDtd property in XmlReaderSettings? Why is DTD a security i

    - by Cheeso
    The documentation says: When set to true, the XmlReader throws an XmlException when any DTD content is encountered. Do not enable DTD processing if you are concerned about Denial of Service issues or if you are dealing with untrusted sources. If you have DTD processing enabled, you can use the XmlSecureResolver to restrict the resources that the XmlReader can access. You can also design your application so that the XML processing is memory and time constrained. For example, configure time-out limits in your ASP.NET application. Can someone please explain the issue? Why would a reader application want to prohibit the retrieval of a DTD? Where is the denial-of-service issue, if it is a reading application? What is the "trust" issue that is mentioned? Thanks

    Read the article

  • java: can I convert strings to byte arrays, without a BOM?

    - by Cheeso
    Suppose I have this code: String encoding = "UTF-16"; String text = "[Hello StackOverflow]"; byte[] message= text.getBytes(encoding); If I display the byte array in message, the result is: 0000 FE FF 00 5B 00 48 00 65 00 6C 00 6C 00 6F 00 20 ...[.H.e.l.l.o. 0010 00 53 00 74 00 61 00 63 00 6B 00 4F 00 76 00 65 .S.t.a.c.k.O.v.e 0020 00 72 00 66 00 6C 00 6F 00 77 00 5D .r.f.l.o.w.] As you can see, there's a BOM in the beginning. How can I: generate a UTF-16 byte array that lacks a BOM, from a string? convert from a byte array that contains UTF-16 chars but lacks a BOM, back to a string?

    Read the article

  • Linq-to-SQL: How to shape the data with group by?

    - by Cheeso
    I have an example database, it contains tables for Movies, People and Credits. The Movie table contains a Title and an Id. The People table contains a Name and an Id. The Credits table relates Movies to the People that worked on those Movies, in a particular role. The table looks like this: CREATE TABLE [dbo].[Credits] ( [Id] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY, [PersonId] [int] NOT NULL FOREIGN KEY REFERENCES People(Id), [MovieId] [int] NOT NULL FOREIGN KEY REFERENCES Movies(Id), [Role] [char] (1) NULL In this simple example, the [Role] column is a single character, by my convention either 'A' to indicate the person was an actor on that particular movie, or 'D' for director. I'd like to perform a query on a particular person that returns the person's name, plus a list of all the movies the person has worked on, and the roles in those movies. If I were to serialize it to json, it might look like this: { "name" : "Clint Eastwood", "movies" : [ { "title": "Unforgiven", "roles": ["actor", "director"] }, { "title": "Sands of Iwo Jima", "roles": ["director"] }, { "title": "Dirty Harry", "roles": ["actor"] }, ... ] } How can I write a LINQ-to-SQL query that shapes the output like that? I'm having trouble doing it efficiently. if I use this query: int personId = 10007; var persons = from p in db.People where p.Id == personId select new { name = p.Name, movies = (from m in db.Movies join c in db.Credits on m.Id equals c.MovieId where (c.PersonId == personId) select new { title = m.Title, role = (c.Role=="D"?"director":"actor") }) }; I get something like this: { "name" : "Clint Eastwood", "movies" : [ { "title": "Unforgiven", "role": "actor" }, { "title": "Unforgiven", "role": "director" }, { "title": "Sands of Iwo Jima", "role": "director" }, { "title": "Dirty Harry", "role": "actor" }, ... ] } ...but as you can see there's a duplicate of each movie for which Eastwood played multiple roles. How can I shape the output the way I want?

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >