Search Results

Search found 23262 results on 931 pages for 'content analysis'.

Page 133/931 | < Previous Page | 129 130 131 132 133 134 135 136 137 138 139 140  | Next Page >

  • pound sign is not working in mail content using java.mail package?

    - by kumar kasimala
    HI all, I am using javax.mail packaage MINEMESSAGE,MimeMultipart class to send a mail, but even though I mention type utf-8, unicode characters are not working in body text. like pound sign is not working. please help what to do. here is my message headers To: [email protected] Message-ID: <875158456.1.1294898905049.JavaMail.root@nextrelease> Subject: My Site Free Trial - 5 days left MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_0_1733237863.1294898905008" MyHeaderName: myHeaderValue Date: Thu, 13 Jan 2011 06:08:25 +0000 (UTC) ------=_Part_0_1733237863.1294898905008 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

    Read the article

  • Why does my UIScrollView change it's original content offset when I scroll?

    - by Tony
    Before I scroll, my UIScrollView is laid out perfectly. See here However if I scroll up, the view bounces as I go out of bounds and then resets too high. See here I am going to guess this has to do with a hack that I did earlier to get the view to originally show like in the first screen shot. For some reason, to get my view to look like the second screen shot, I do: [scrollView setContentOffset:CGPointMake(0,-50) animated:YES]; in viewDidLoad But if I set the content offset to 0,0 in viewDidLoad, I get something that looks like the second screen shot when the view loads. This doesn't make much sense to me because if the content offset is 0,0 I would think the content should begin in the upper right corner of the screen. Does anyone know what could be going on here? Thanks!

    Read the article

  • How to get flash player to display under content on a PC?

    - by bschaeffer
    Long story short, I'm developing a theme template for a blog that enables you to view the posts in blocks. The main part of the post is displayed at first, then the secondary content is displayed over that when you hover over the post block. Everything works fine on a Mac Versions of all major browsers, but start browsing on a PC, and all hell breaks loose when you start trying to display content over Flash Video embeds. The flash element remains visible over the content. It's completely unusable. From a PC, you can view an example of the problem here: http://photorific.tumblr.com I'm almost certain this is a bug in the Flash Plugin for Windows, but I was wondering if anyone else had come across this problem before, and if there were any solutions. This problem has presented itself for a while now and any help would be really, really, really appreciated!

    Read the article

  • How to pass content in response from Exception filter in Asp.net WebAPI?

    - by jaffa
    Consider following code: My problem is: 1) I can't seem to cast the errors to HttpContent 2) I can't use the CreateContent extension method as this doesn't exist on the context.Response.Content.CreateContent public class ServiceLayerExceptionFilter : ExceptionFilterAttribute { public override void OnException(HttpActionExecutedContext context) { if (context.Response == null) { var exception = context.Exception as ModelValidationException; if ( exception != null ) { var modelState = new ModelStateDictionary(); modelState.AddModelError(exception.Key, exception.Description); var errors = modelState.SelectMany(x => x.Value.Errors).Select(x => x.ErrorMessage); // Cannot cast errors to HttpContent?? // var resp = new HttpResponseMessage(HttpStatusCode.BadRequest) {Content = errors}; // throw new HttpResponseException(resp); // Cannot create response from extension method?? //context.Response.Content.CreateContent } else { context.Response = new HttpResponseMessage(context.Exception.ConvertToHttpStatus()); } } base.OnException(context); } }

    Read the article

  • PHP Included files writing their own content from Importer values ...

    - by Adrian
    Hello, I have a index.php file that will include several external files: "content/templates/id1/template.php" "content/templates/id2/template.php" "content/templates/id3/template.php" etc. All these files are loaded dynamically into index.php (it reads all folders inside "templates" directory and then includes every "template.php" file). I want to make "template.php" to have the same code in all the "id1,id2,id3" folders, BUT to load values from index.php depending in which folder it stays.. How can I do that? Thank You!

    Read the article

  • How to configure IIS to serve my 404 response with my custom content?

    - by Marek
    This question is related to this, hopefully better phrased. I would like to serve a custom 404 page from ASP.NET MVC. I have the route handler and all the infrastructure set up to ensure that nonexistent routes are handled by a single action: public ActionResult Handle404() { Response.StatusCode = 404; return View("NotFound"); } Problem: IIS serves back its own content (some predefined message) when I set Response.StatusCode to 404 before returning the content. On the VS development web server, this works as intended - the status code of the HTTP response is 404 while my content (the NotFound view) is served. I believe that when the IIS processing pipeline sees that the application returns 404, it simply replaces the whole response with its own. What setting in IIS affects this behavior? I do not have access to the IIS installation so I can not investigate this - however, I can ask the hosting provider to tweak the configuration for me if I know what exactly needs to be changed.

    Read the article

  • given the html content, find out the height of the page for the given width,before rending the page.

    - by ganapati hegde
    Hi, i am interested in finding out the height for a given width,taken by the webpage for the given HTML content. Ex.say given html content is, < html < body < h6My First Heading< /h6 < pMy first paragraph.... ... ....< /p < /body < /html ======================================== How can i find out the height the webpage(corresponding to the given content), for a given width ? i want to calculate the height before loading the webpage... i.e i dont render the page, but using the "contents" only,i want to calculate the height...

    Read the article

  • How to save a the content into the file with neat alignment?

    - by praveenjayapal
    Hi Friends, I am having a textbox, in that i have loaded a xml file. After editing and saving the xml content into the xml file, the content is not in the right formate. While loading again, its not in the xml format How to save a the content into the file with neat alignment? Please help me For ExampleI need to save like the following <section> <value>a</value> <value>b</value> </section> But after saving its looks like <section><value>a</value><value>b</value></section> Thanks,Praveen J

    Read the article

  • How to scroll the content without scrolling the image in the background using UIScrollView ?

    - by Raymond Choong
    I am trying to scroll the content without scrolling the image in the background using UIScrollView. I am using IB and setting the FileOwner View to point to the Scroll View (Image View is a child of the Scroll view). I have made the image height to be 960 pixels. I have also set scrolling content size in the vierController that owns this UIView (void)viewDidLoad { UIScrollView *tempScrollView = (UIScrollView *)self.view; tempScrollView.contentSize=CGSizeMake(320, 960); } My problem is that the Image only appears moves along with the content. I have tried taking out the settings in viewDidLoad, but the scrolling cease to function. I have also tried changing the location of the image and have it placed under VIEW instead of Scoll View (by the way Scroll View is a child of VIEW), but that resulted in the app breaking (termination error). Any advice would be appreciated.

    Read the article

  • How to write an editor that shows the content of a folder in eclipse?

    - by tangens
    Motivation I have written an eclipse plugin that shows me a list of all files and folders with unreviewed content. When selecting a folder, I want an editor to open showing all files and subfolders that this folder contains. It has to work for versioned items, too. So I have to create the content of the editor within my plugin (no backing IResource). What I currently have Right now I'm opening a RemoteFileEditorInput for a versioned file (subclipse) or I'm using IWorkbenchPage.openEditor() for a FileEditorInput. Question What's an easy way to visualize dynamic content (directory listing) inside of an text editor?

    Read the article

  • How to load the whole content of a page into another window?

    - by Cristian Castiblanco
    I'm building a Dashboard and for some stupid reasons my boss wants to load it in a frame on the homepage (yes a frame, he still lives in the 1990s). Anyway, sometimes the dashboard needs some room so that it can show all charts correctly, so I want to add a feature to load the content of the dashboard into a new window. The problem is that, if the user has had some interaction with the dashboard, it will contain modal dialogs, new images, etc... so I want to load all the dashboard content into a new window without reloading its content. Of course, the user should be able to continue browsing the dashboard without problems. How can I do that? I'm using jQuery as my JavaScript framework.

    Read the article

  • Polygonal Divs -- Making content overflow in a specific shape?

    - by Will
    Here is the site I'm currently working on: http://willcrichton.net/ If you click on the arrows on each side of the hexagon in the middle, you can see that it transitions left and right using jQuery + jQuery Cycle + jQuery Easing. However, you can also see that it is rather ugly -- because I'm using hexagons and not squares and because divs are square shaped, the content hexagon overlaps with with the background in an unpleasant way. So, my question is: how would I essentially hack a div into a hexagon? That hexagon should be the same size/shape of the content div, and when content is outside the area of the hexagon it should be invisible.

    Read the article

  • How to load the content of a page into another window?

    - by Cristian Castiblanco
    I'm building a Dashboard and for some stupid reasons my boss wants to load it in a frame on the homepage (yes a frame, he still lives in the 1990s). Anyway, sometimes the dashboard needs some room so that it can show all charts correctly, so I want to add a feature to load the content of the dashboard into a new window. The problem is that, if the user has had some interaction with the dashboard, it will contain modal dialogs, new images, etc... so I want to load all the dashboard content into a new window without reloading its content. Of course, the user should be able to continue browsing the dashboard without problems. How can I do that? I'm using jQuery as my JavaScript framework.

    Read the article

  • Is this the correct why of speaking to a "Content Manager" Class?

    - by DeanMc
    I am creating a silverlight site. I am currently breaking out my ideas into pieces of functionality. One of the idea's I have is the concept of a content manager. This is essentially a UI control with 4 regions. Top, Bottom, Right & Left. I also have a collection of objects that are considered "Menu Items". These are controls that function as a way to navigate around, similar to links. The idea I have is to implement an IMenuItem interface. Among the standard pieces of information (Text, PageReference, etc) I was also going to hold a reference to the content manager. My idea behind this thinking is that I can pass the PageReference to a property on the ContentManager and then call a method which knows how to update the content manager accordingly. Is this the best way of implementing this or is their some sort of pattern for it?

    Read the article

  • How to load the whole content of a page into another window?

    - by Cristian Castiblanco
    I'm building a Dashboard and for some stupid reasons my boss wants to load it in a frame on the homepage (yes a frame, he still lives in the 1990s). Anyway, sometimes the dashboard needs some room so that it can show all charts correctly, so I want to add a feature to load the content of the dashboard into a new window. The problem is that, if the user has had some interaction with the dashboard, it will contain modal dialogs, new images, etc... so I want to load all the dashboard content into a new window without reloading its content. Of course, the user should be able to continue browsing the dashboard without problems. How can I do that? I'm using jQuery as my JavaScript framework.

    Read the article

  • How to generate a PDF of dynamic HTML content?

    - by chris Frisina
    I am trying to be able to allow users to generate content dynamically, and have that information be in a , and then allow that specific to be exportable to a pdf. I have got Joomla up and running (with the appropriate mySQL and ANT) locally with the Web2PDF extension, but how would I get those running on my domain (hosted by Dreamhost). Are there any other approaches you might recommend. The content is generated by JS and JQuery, and formatted with CSS and HTML. Other considerations: Web2PDF generates a PDF on the entire content, (pulling the entire page's HTML, not just the specific <div>.

    Read the article

  • what's the best (most effecient) way in asp .net to return a whole page into tabbed content?

    - by ijjo
    what i want to do is every time i click on a tab, the content area is replaced by pretty much a whole new page. i don't want a full page load so i want to do it in ajax, but i'm used to sending back small jason data via page methods. i'm not sure how i would construct a whole new page and return that via ajax and i would like to simply assign the whole content returned to a div and be done with it. what's the best way to do this with the least amount of overhead (i know there are some inefficient ways the scriptmanager does ajax)? or is it better to load the tabbed content in an iframe? fyi i'm already using jquery to call lightweight pagemethods on my asp net page and that works great.

    Read the article

  • jQuery does not execute on dynamically loaded content,, even on a click events.

    - by sxv
    I have two document.ready functions. The first loads content into div#header. The second one performs a hide function and then a toggle function on the newly loaded content. I am not sure if this is a queueing issue or something, but not even the alert() below is executed when I click the loaded content. Thanks. <script type="text/javascript"> $(document).ready(function() { $("#header").load("/documents/collegeradioheader.txt"); }); </script> <script type="text/javascript"> $(document).ready(function() { $(".hideme").hide(); $(".slick-toggle").click(function() { alert('hi'); $(this).parent().next('div').slideToggle('fast'); .siblings('div:visible').slideUp('fast'); }); }); </script>

    Read the article

  • How to fix Index out of range exception on idatareader

    - by Phil
    Good morning stack overflow, I have been forced into using the idatareader as opposed to the sqldatareader which has .hasrows available. In my code I am attempting to handle nulls like this: reader = GetContent(pageid) While reader.Read If reader("content") IsNot DBNull.Value Then content = Replace(reader("content"), Chr(38) + Chr(97) + Chr(109) + Chr(112) + Chr(59) + Chr(98) + Chr(104) + Chr(99) + Chr(112) + Chr(61) + Chr(49), "") If reader("id") IsNot DBNull.Value Then contentid = reader("id") End If Else contentid = -1 content = String.Empty End If End While Outputcontent.Text = content I am getting an 'Index Out of Range Exception' here: If reader("content") IsNot DBNull.Value Then The database does 100% contain 'content'

    Read the article

  • Tridion Installation

    - by Kevin Brydon
    I am currently upgrading an installation of Tridion from 5.3 to 2011 starting almost from scratch (aside from migrating the database), brand new virtual servers. I just want to ask for some advice on my current server setup... a sanity check. All servers are running Windows Server 2008. The pages on our website are all classic ASP. Database SQL Server cluster. The 5.3 database has been migrated using the DatabaseManager. This is pretty standard and works well (in test anyway). Content Manager A single server to run the Content Manager and the Publisher. There are around 10 people using it at any one time so not under a particularly heavy load. Content Data Store Filesystem located somewhere on the network. One directory for live and one for staging. Content Delivery Two servers (cd1 and cd2) each with the the following server roles installed. cd1 writes to a filesystem content data store for the live website, cd2 writes to the content data store for the staging website. Presentation Two public facing web servers (web1 and web2) serving both the live and staging websites. The web servers read directly from the content data store as its a filesystem. Each of the web servers have the Content Delivery Server installed so that I can use dynamic linking (and other features?). I've so far set up everything but the web servers. Any thoughts? edit Thanks to Ram S who linked me to a decent walkthrough, upvoted. I suppose I should have posed some questions as I didn't really ask a question. I guess I'm a little confused over the content deliver aspect. I have the Content Delivery split in two separate parts. cd1 and cd2 do the work of shifting information from the Content Manager to the Staging/Live web directories. web1 and web2 should do the work of serving the web pages to the outside world and will interact with the content data store (file system). Is this a correct setup? I need some parts of the Content Delivery on my web servers right? Theoretically I could get rid of the cd1 and cd2 servers and use web1 and web2 to do the deployment right? But I suspect this will put the web servers under unnecessary strain should there ever be a big publish. I've been reading the 2011 Installation Manual, Content Delivery section, and I'm finding it quite hard to get my head around!

    Read the article

  • IMDB Grabber PHP

    - by user272899
    I am recieving an error: Notice: Undefined variable: content in C:\wamp\www\includes\imdbgrabber.php on line 17 When using this code: <?php //url $url = 'http://www.imdb.com/title/tt0367882/'; //get the page content $imdb_content = get_data($url); //parse for product name $name = get_match('/<title>(.*)<\/title>/isU',$imdb_content); $director = strip_tags(get_match('/<h5[^>]*>Director:<\/h5>(.*)<\/div>/isU',$imdb_content)); $plot = get_match('/<h5[^>]*>Plot:<\/h5>(.*)<\/div>/isU',$imdb_content); $release_date = get_match('/<h5[^>]*>Release Date:<\/h5>(.*)<\/div>/isU',$imdb_content); $mpaa = get_match('/<a href="\/mpaa">MPAA<\/a>:<\/h5>(.*)<\/div>/isU',$imdb_content); $run_time = get_match('/Runtime:<\/h5>(.*)<\/div>/isU',$imdb_content); //build content line 17 --> $content.= '<h2>Film</h2><p>'.$name.'</p>'; $content.= '<h2>Director</h2><p>'.$director.'</p>'; $content.= '<h2>Plot</h2><p>'.substr($plot,0,strpos($plot,'<a')).'</p>'; $content.= '<h2>Release Date</h2><p>'.substr($release_date,0,strpos($release_date,'<a')).'</p>'; $content.= '<h2>MPAA</h2><p>'.$mpaa.'</p>'; $content.= '<h2>Run Time</h2><p>'.$run_time.'</p>'; $content.= '<h2>Full Details</h2><p><a href="'.$url.'" rel="nofollow">'.$url.'</a></p>'; echo $content; //gets the match content function get_match($regex,$content) { preg_match($regex,$content,$matches); return $matches[1]; } //gets the data from a URL function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } ?>

    Read the article

  • AppEngine BlobStore upload failing when request is programmatic

    - by Joe Ludwig
    I have an AppEngine application that uses the blobstore to store user-provided image data. When I upload images to that application from a form in Chrome it works fine. When I try to upload an image from an Android application it fails. Both methods work fine if I am running against the development server, but the Android upload doesn't work against the live service. This is the request from Chrome: POST /_ah/upload/?userToken=11001/AMmfu6ZCyMQQ9YdiXal3SmSXIRTQIuSRXkNc-i3JmU0fqx_kJbUJ2OMLcS2lXhVJSK4qs7regViTKzOPz5ejoZYi0nAD5o8vNltiOViQw6DZO7_byZz3Ut0/ALBNUaYAAAAAS_lusgPMAGmpPrg0BuNsJyymX-57ob4i/ HTTP/1.1 Host: photohuntservice.appspot.com Connection: keep-alive User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1064 Safari/532.5 Referer: http://photohuntservice.appspot.com/debug_newpuzzle?userToken=11001 Content-Length: 60360 Cache-Control: max-age=0 Origin: http://photohuntservice.appspot.com Content-Type: multipart/form-data; boundary=----WebKitFormBoundarybl05YLmLbFRf2MzN Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 ------WebKitFormBoundarybl05YLmLbFRf2MzN Content-Disposition: form-data; name="userToken" 11001 ------WebKitFormBoundarybl05YLmLbFRf2MzN Content-Disposition: form-data; name="img"; filename="Photo_020908_001.jpg" Content-Type: image/jpeg <image data> ------WebKitFormBoundarybl05YLmLbFRf2MzN Content-Disposition: form-data; name="longitude" -122.084095 ------WebKitFormBoundarybl05YLmLbFRf2MzN Content-Disposition: form-data; name="latitude" 37.422006 ------WebKitFormBoundarybl05YLmLbFRf2MzN-- This is the request from my client (which is written in Java on Android, but I don't think that's relevant): POST /_ah/upload/?userToken=11001/AMmfu6Zf9an6AU4lT9UuhIpxOZyOYb1LMwimFpeSh8zr6J1sX9F2ddJW3Qlsw0kwV3oALv-TNPWRQ6g4_Dgwk0UTwF47bbc78Yl44kDeV69MydTuR3N46S4/ALBNUaYAAAAAS_mMr3CYqTg3aVBDjhRxP0DyyRdvotyG/ HTTP/1.1 Content-Type: multipart/form-data;boundary=----WebKitFormBoundaryhdyNAhmOouRDGErG Cache-Control: max-age=0 Accept: */* Origin: http://photohuntservice.appspot.com Connection: keep-alive Referer: http://photohuntservice.appspot.com/getuploadurl?userToken=11001 Content-Length: 2638 Host: photohuntservice.appspot.com User-Agent: Apache-HttpClient/UNAVAILABLE (java 1.4) Expect: 100-Continue ------WebKitFormBoundaryhdyNAhmOouRDGErG Content-Disposition: form-data; name="userToken" 11001 ------WebKitFormBoundaryhdyNAhmOouRDGErG Content-Disposition: form-data; name="img";filename="PhotoHunt.jpg" Content-Type: image/jpeg <image data> ------WebKitFormBoundaryhdyNAhmOouRDGErG Content-Disposition: form-data; name="latitude" 37.422006 ------WebKitFormBoundaryhdyNAhmOouRDGErG Content-Disposition: form-data; name="longitude" -122.084095 ------WebKitFormBoundaryhdyNAhmOouRDGErG-- In both cases the AppEngine Python code to catch the request is the same: class UploadPuzzle( blobstore_handlers.BlobstoreUploadHandler ): def post(self): upload_files = self.get_uploads( ) The problem is that when running on the production AppEngine service self.get_uploads() returns an empty list when the request is made from my client app. Both requests return what I expect (a list with one blob_info in it) on the development server, and Chrome returns what I expect in both cases.

    Read the article

  • AppEngine BlobStore upload failing with a request that works in the Development Environment

    - by Joe Ludwig
    I have an AppEngine application that uses the blobstore to store user-provided image data. When I upload images to that application from a form in Chrome it works fine. When I try to upload an image from an Android application it fails. Both methods work fine if I am running against the development server, but the Android upload doesn't work against the live service. This is the request from Chrome: POST /_ah/upload/?userToken=11001/AMmfu6ZCyMQQ9YdiXal3SmSXIRTQIuSRXkNc-i3JmU0fqx_kJbUJ2OMLcS2lXhVJSK4qs7regViTKzOPz5ejoZYi0nAD5o8vNltiOViQw6DZO7_byZz3Ut0/ALBNUaYAAAAAS_lusgPMAGmpPrg0BuNsJyymX-57ob4i/ HTTP/1.1 Host: photohuntservice.appspot.com Connection: keep-alive User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1064 Safari/532.5 Referer: http://photohuntservice.appspot.com/debug_newpuzzle?userToken=11001 Content-Length: 60360 Cache-Control: max-age=0 Origin: http://photohuntservice.appspot.com Content-Type: multipart/form-data; boundary=----WebKitFormBoundarybl05YLmLbFRf2MzN Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 ------WebKitFormBoundarybl05YLmLbFRf2MzN Content-Disposition: form-data; name="userToken" 11001 ------WebKitFormBoundarybl05YLmLbFRf2MzN Content-Disposition: form-data; name="img"; filename="Photo_020908_001.jpg" Content-Type: image/jpeg <image data> ------WebKitFormBoundarybl05YLmLbFRf2MzN Content-Disposition: form-data; name="longitude" -122.084095 ------WebKitFormBoundarybl05YLmLbFRf2MzN Content-Disposition: form-data; name="latitude" 37.422006 ------WebKitFormBoundarybl05YLmLbFRf2MzN-- This is the request from my client (which is written in Java on Android, but I don't think that's relevant): POST /_ah/upload/?userToken=11001/AMmfu6Zf9an6AU4lT9UuhIpxOZyOYb1LMwimFpeSh8zr6J1sX9F2ddJW3Qlsw0kwV3oALv-TNPWRQ6g4_Dgwk0UTwF47bbc78Yl44kDeV69MydTuR3N46S4/ALBNUaYAAAAAS_mMr3CYqTg3aVBDjhRxP0DyyRdvotyG/ HTTP/1.1 Content-Type: multipart/form-data;boundary=----WebKitFormBoundaryhdyNAhmOouRDGErG Cache-Control: max-age=0 Accept: */* Origin: http://photohuntservice.appspot.com Connection: keep-alive Referer: http://photohuntservice.appspot.com/getuploadurl?userToken=11001 Content-Length: 2638 Host: photohuntservice.appspot.com User-Agent: Apache-HttpClient/UNAVAILABLE (java 1.4) Expect: 100-Continue ------WebKitFormBoundaryhdyNAhmOouRDGErG Content-Disposition: form-data; name="userToken" 11001 ------WebKitFormBoundaryhdyNAhmOouRDGErG Content-Disposition: form-data; name="img";filename="PhotoHunt.jpg" Content-Type: image/jpeg <image data> ------WebKitFormBoundaryhdyNAhmOouRDGErG Content-Disposition: form-data; name="latitude" 37.422006 ------WebKitFormBoundaryhdyNAhmOouRDGErG Content-Disposition: form-data; name="longitude" -122.084095 ------WebKitFormBoundaryhdyNAhmOouRDGErG-- In both cases the AppEngine Python code to catch the request is the same: class UploadPuzzle( blobstore_handlers.BlobstoreUploadHandler ): def post(self): upload_files = self.get_uploads( ) The problem is that when running on the production AppEngine service self.get_uploads() returns an empty list when the request is made from my client app. Both requests return what I expect (a list with one blob_info in it) on the development server, and Chrome returns what I expect in both cases.

    Read the article

  • Mapping UrlEncoded POST Values in ASP.NET Web API

    - by Rick Strahl
    If there's one thing that's a bit unexpected in ASP.NET Web API, it's the limited support for mapping url encoded POST data values to simple parameters of ApiController methods. When I first looked at this I thought I was doing something wrong, because it seems mighty odd that you can bind query string values to parameters by name, but can't bind POST values to parameters in the same way. To demonstrate here's a simple example. If you have a Web API method like this:[HttpGet] public HttpResponseMessage Authenticate(string username, string password) { …} and then hit with a URL like this: http://localhost:88/samples/authenticate?Username=ricks&Password=sekrit it works just fine. The query string values are mapped to the username and password parameters of our API method. But if you now change the method to work with [HttpPost] instead like this:[HttpPost] public HttpResponseMessage Authenticate(string username, string password) { …} and hit it with a POST HTTP Request like this: POST http://localhost:88/samples/authenticate HTTP/1.1 Host: localhost:88 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Content-type: application/x-www-form-urlencoded Content-Length: 30 Username=ricks&Password=sekrit you'll find that while the request works, it doesn't actually receive the two string parameters. The username and password parameters are null and so the method is definitely going to fail. When I mentioned this over Twitter a few days ago I got a lot of responses back of why I'd want to do this in the first place - after all HTML Form submissions are the domain of MVC and not WebAPI which is a valid point. However, the more common use case is using POST Variables with AJAX calls. The following is quite common for passing simple values:$.post(url,{ Username: "Rick", Password: "sekrit" },function(result) {…}); but alas that doesn't work. How ASP.NET Web API handles Content Bodies Web API supports parsing content data in a variety of ways, but it does not deal with multiple posted content values. In effect you can only post a single content value to a Web API Action method. That one parameter can be very complex and you can bind it in a variety of ways, but ultimately you're tied to a single POST content value in your parameter definition. While it's possible to support multiple parameters on a POST/PUT operation, only one parameter can be mapped to the actual content - the rest have to be mapped to route values or the query string. Web API treats the whole request body as one big chunk of data that is sent to a Media Type Formatter that's responsible for de-serializing the content into whatever value the method requires. The restriction comes from async nature of Web API where the request data is read only once inside of the formatter that retrieves and deserializes it. Because it's read once, checking for content (like individual POST variables) first is not possible. However, Web API does provide a couple of ways to access the form POST data: Model Binding - object property mapping to bind POST values FormDataCollection - collection of POST keys/values ModelBinding POST Values - Binding POST data to Object Properties The recommended way to handle POST values in Web API is to use Model Binding, which maps individual urlencoded POST values to properties of a model object provided as the parameter. Model binding requires a single object as input to be bound to the POST data, with each POST key that matches a property name (including nested properties like Address.Street) being mapped and updated including automatic type conversion of simple types. This is a very nice feature - and a familiar one from MVC - that makes it very easy to have model objects mapped directly from inbound data. The obvious drawback with Model Binding is that you need a model for it to work: You have to provide a strongly typed object that can receive the data and this object has to map the inbound data. To rewrite the example above to use ModelBinding I have to create a class maps the properties that I need as parameters:public class LoginData { public string Username { get; set; } public string Password { get; set; } } and then accept the data like this in the API method:[HttpPost] public HttpResponseMessage Authenticate(LoginData login) { string username = login.Username; string password = login.Password; … } This works fine mapping the POST values to the properties of the login object. As a side benefit of this method definition, the method now also allows posting of JSON or XML to the same endpoint. If I change my request to send JSON like this: POST http://localhost:88/samples/authenticate HTTP/1.1 Host: localhost:88 Accept: application/jsonContent-type: application/json Content-Length: 40 {"Username":"ricks","Password":"sekrit"} it works as well and transparently, courtesy of the nice Content Negotiation features of Web API. There's nothing wrong with using Model binding and in fact it's a common practice to use (view) model object for inputs coming back from the client and mapping them into these models. But it can be  kind of a hassle if you have AJAX applications with a ton of backend hits, especially if many methods are very atomic and focused and don't effectively require a model or view. Not always do you have to pass structured data, but sometimes there are just a couple of simple response values that need to be sent back. If all you need is to pass a couple operational parameters, creating a view model object just for parameter purposes seems like overkill. Maybe you can use the query string instead (if that makes sense), but if you can't then you can often end up with a plethora of 'message objects' that serve no further  purpose than to make Model Binding work. Note that you can accept multiple parameters with ModelBinding so the following would still work:[HttpPost] public HttpResponseMessage Authenticate(LoginData login, string loginDomain) but only the object will be bound to POST data. As long as loginDomain comes from the querystring or route data this will work. Collecting POST values with FormDataCollection Another more dynamic approach to handle POST values is to collect POST data into a FormDataCollection. FormDataCollection is a very basic key/value collection (like FormCollection in MVC and Request.Form in ASP.NET in general) and then read the values out individually by querying each. [HttpPost] public HttpResponseMessage Authenticate(FormDataCollection form) { var username = form.Get("Username"); var password = form.Get("Password"); …} The downside to this approach is that it's not strongly typed, you have to handle type conversions on non-string parameters, and it gets a bit more complicated to test such as setup as you have to seed a FormDataCollection with data. On the other hand it's flexible and easy to use and especially with string parameters is easy to deal with. It's also dynamic, so if the client sends you a variety of combinations of values on which you make operating decisions, this is much easier to work with than a strongly typed object that would have to account for all possible values up front. The downside is that the code looks old school and isn't as self-documenting as a parameter list or object parameter would be. Nevertheless it's totally functionality and a viable choice for collecting POST values. What about [FromBody]? Web API also has a [FromBody] attribute that can be assigned to parameters. If you have multiple parameters on a Web API method signature you can use [FromBody] to specify which one will be parsed from the POST content. Unfortunately it's not terribly useful as it only returns content in raw format and requires a totally non-standard format ("=content") to specify your content. For more info in how FromBody works and several related issues to how POST data is mapped, you can check out Mike Stalls post: How WebAPI does Parameter Binding Not really sure where the Web API team thought [FromBody] would really be a good fit other than a down and dirty way to send a full string buffer. Extending Web API to make multiple POST Vars work? Don't think so Clearly there's no native support for multiple POST variables being mapped to parameters, which is a bit of a bummer. I know in my own work on one project my customer actually found this to be a real sticking point in their AJAX backend work, and we ended up not using Web API and using MVC JSON features instead. That's kind of sad because Web API is supposed to be the proper solution for AJAX backends. With all of ASP.NET Web API's extensibility you'd think there would be some way to build this functionality on our own, but after spending a bit of time digging and asking some of the experts from the team and Web API community I didn't hear anything that even suggests that this is possible. From what I could find I'd say it's not possible primarily because Web API's Routing engine does not account for the POST variable mapping. This means [HttpPost] methods with url encoded POST buffers are not mapped to the parameters of the endpoint, and so the routes would never even trigger a request that could be intercepted. Once the routing doesn't work there's not much that can be done. If somebody has an idea how this could be accomplished I would love to hear about it. Do we really need multi-value POST mapping? I think that that POST value mapping is a feature that one would expect of any API tool to have. If you look at common APIs out there like Flicker and Google Maps etc. they all work with POST data. POST data is very prominent much more so than JSON inputs and so supporting as many options that enable would seem to be crucial. All that aside, Web API does provide very nice features with Model Binding that allows you to capture many POST variables easily enough, and logistically this will let you build whatever you need with POST data of all shapes as long as you map objects. But having to have an object for every operation that receives a data input is going to take its toll in heavy AJAX applications, with a lot of types created that do nothing more than act as parameter containers. I also think that POST variable mapping is an expected behavior and Web APIs non-support will likely result in many, many questions like this one: How do I bind a simple POST value in ASP.NET WebAPI RC? with no clear answer to this question. I hope for V.next of WebAPI Microsoft will consider this a feature that's worth adding. Related Articles Passing multiple POST parameters to Web API Controller Methods Mike Stall's post: How Web API does Parameter Binding Where does ASP.NET Web API Fit?© Rick Strahl, West Wind Technologies, 2005-2012Posted in Web Api   Tweet !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();

    Read the article

  • Razor – Hiding a Section in a Layout

    - by João Angelo
    Layouts in Razor allow you to define placeholders named sections where content pages may insert custom content much like the ContentPlaceHolder available in ASPX master pages. When you define a section in a Razor layout it’s possible to specify if the section must be defined in every content page using the layout or if its definition is optional allowing a page not to provide any content for that section. For the latter case, it’s also possible using the IsSectionDefined method to render default content when a page does not define the section. However if you ever require to hide a given section from all pages based on some runtime condition you might be tempted to conditionally define it in the layout much like in the following code snippet. if(condition) { @RenderSection("ConditionalSection", false) } With this code you’ll hit an error as soon as any content page provides content for the section which makes sense since if a page inherits a layout then it should only define sections that are also defined in it. To workaround this scenario you have a couple of options. Make the given section optional with and move the condition that enables or disables it to every content page. This leads to code duplication and future pages may forget to only define the section based on that same condition. The other option is to conditionally define the section in the layout page using the following hack: @{ if(condition) { @RenderSection("ConditionalSection", false) } else { RenderSection("ConditionalSection", false).WriteTo(TextWriter.Null); } } Hack inspired by a recent stackoverflow question.

    Read the article

< Previous Page | 129 130 131 132 133 134 135 136 137 138 139 140  | Next Page >