Search Results

Search found 31717 results on 1269 pages for 'response write'.

Page 31/1269 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • How to handle HTTPStatus Response 201 with AS3 / Flash / SWFUpload

    - by Praveen Sharma
    Hey all. I'm using SWFUpload on a Rails site to allow for MP3 Uploads direct to Sound Cloud. To avoid having to first upload a large file to my server and push to Sound Cloud, I'm hitting their API directly via SWFUpload, passing necessary OAuth token data. Everything works - EXCEPT - Flash can't handle the HTTP response code that Sound Cloud's API returns (201). This ALWAYS triggers an unhandled IO Error with Flash. Even though SWFUpload allows me to override that in the JS, it breaks any response data (the URI to the uploaded file). Does anyone know how I could somehow intercept the 201 code so that I can make it a 200 code for flash? I'm at a loss at how I can avoid this IO Error. I've tried try/catch statements around everything and have even recompiled SWFUpload to try new things to no avail. Any help would be greatly appreciated.

    Read the article

  • Jquery ajax request error callback is called instead of success even after response recieved from server

    - by Muhammad Tahir Butt
    I am using jquery ajax funtion to get some content from my webservice. Response from the server is received but every time error callback is called instead of success callback. And this error is returned in xhr.error: function (){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this} Here is the screenshot of response from server: and here is the code i am using to make the request: function abcdef() { $.ajax({ url: "http://192.168.61.129:8000/get-yt-access-token/", type: "GET", contentType:"application/json", error: function(xhr, textStatus, errorThrown){ alert("its error! " + xhr.error); }, success: function(data){ alert(data); } }); }

    Read the article

  • SimpleXML SOAP response Namespace issues

    - by Stu
    Hi. After spending SEVERAL frustrated hours on this I am asking for your help. I am trying to get the content of particular nodes from a SOAP response. The response is $XmlStr = <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"<xmlns:ns1="http://soap.xxxxxx.co.uk/"><env:Body><ns1:PlaceOrderResponse><xxxxxOrderNumber></xxxxxOrderNumber><ErrorArray><Error><ErrorCode>24</ErrorCode><ErrorText>The+client+order+number+3002254+is+already+in+use</ErrorText></Error><Error><ErrorCode>1</ErrorCode><ErrorText>Aborting</ErrorText></Error></ErrorArray></ns1:PlaceOrderResponse></env:Body></env:Envelope> I am trying to get at the nodes and children of <ErrorArray. Because of the XML containing namespaces $XmlArray = new SimpleXMLElement($XmlStr); foreach ($XmlArray->env:Envelope->env:Body->ns1:PlaceOrderResponse->ErrorArray->Error as $Error) { echo $Error->ErrorCode."<br />";<br /> } doesn't work. I have read a number of articles such as http://www.sitepoint.com/blogs/2005/10/20/simplexml-and-namespaces/ htp://blog.stuartherbert.com/php/2007/01/07/using-simplexml-to-parse-rss-feeds/ and about 20 questions on this site which unfortunately are not helping. (the second link has htp:// as a newbie here I cannot post more than one link) Even writing, $XmlArray = new SimpleXMLElement($XmlStr); echo "<br /><br /><pre>\n"; print_r($XmlArray); echo "<pre><br /><br />\n"; gives SimpleXMLElement Object ( ) which makes me wonder if the soap response ($XmlStr) is actually a valid input for SimpleXMLElement. It seems that the line $XmlArray = new SimpleXMLElement($XmlStr); is not doing what I expect it to. Any help on how to get the nodes from the XML above would be very welcome. Obviously getting it to work (having a working example) is what I need in the short term, but if someone could help me understand what I am doing wrong would be better in the long term. Cheers. Stu

    Read the article

  • Write simple data to iphone sandbox?

    - by fuzzygoat
    I want to write a small bit of data from my app to the iphone so I can load it when the app next starts. I am going to write the data using NSCoding, but I don't know what I should be specifying as a path. I understand I would write the data to the application sandbox, just not sure how to specify that. gary

    Read the article

  • How do i write this jpql query? java

    - by Nitesh Panchal
    Hello, Say i have 5 tables, tblBlogs tblBlogPosts tblBlogPostComment tblUser tblBlogMember BlogId BlogPostsId BlogPostCommentId UserId BlogMemberId BlogTitle BlogId CommentText FirstName UserId PostTitle BlogPostsId BlogId BlogMemberId Now i want to retrieve only those blogs and posts for which blogMember has actually commented. So in short, how do i write this plain old sql :- Select b.BlogTitle, bp.PostTitle, bpc.CommentText from tblBlogs b Inner join tblBlogPosts bp on b.BlogId = bp.BlogId Inner Join tblBlogPostComment bpc on bp.BlogPostsId = bpc.BlogPostsId Inner Join tblBlogMember bm On bpc.BlogMemberId = bm.BlogMemberId Where bm.UserId = 1; As you can see, everything is Inner join, so only that row will be retrieved for which the user has commented on some post of some blog. So, suppose he has joined 3 blogs whose ids are 1,2,3 (The blogs which user has joined are in tblBlogMembers) but the user has only commented in blog 2 (of say BlogPostId = 1). So that row will be retrieved and 1,3 won't as it is Inner Join. How do i write this kind of query in jpql? In jpql, we can only write simple queries like say :- Select bm.blogId from tblBlogMember Where bm.UserId = objUser; Where objUser is supplied using :- em.find(User.class,1); Thus once we get all blogs(Here blogId represents a blog object) which user has joined, we can loop through and do all fancy things. But i don't want to fall in this looping business and write all this things in my java code. Instead, i want to leave that for database engine to do. So, how do i write the above plain sql into jpql? and what type of object the jpql query will return? because i am only selecting few fields from all table. In which class should i typecast the result to? I think i posted my requirement correctly, if i am not clear please let me know. Thanks in advance :).

    Read the article

  • How to display characters in http get response correctly with the right encoding

    - by DixieFlatline
    Hello! Does anyone know how to read c,š,ž characters in http get response properly? When i make my request in browser the browser displays all characters correctly. But in java program with apache jars i don't know how to set the encoding right. I tried with client.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, "UTF-8"); but it's not working. My code: HttpClient client = new DefaultHttpClient(); String getURL = "http://www.google.com"; HttpGet get = new HttpGet(getURL); HttpResponse responseGet = client.execute(get); HttpEntity resEntityGet = responseGet.getEntity(); if (resEntityGet != null) { Log.i("GET RESPONSE",EntityUtils.toString(resEntityGet)); } } catch (Exception e) { e.printStackTrace(); }

    Read the article

  • ajax response redirect problem

    - by zurna
    When my member registration form correctly filled in and submitted, server responds with redirect link. But my ajax does not redirect the website. I do not receive any errors, where is my mistake? <script type="text/javascript"> $(document).ready(function() { $("[name='submit']").click(function() { $.ajax({ type: "POST", data: $(".form-signup").serialize(), url: "http://www.refinethetaste.com/FLPM/content/myaccount/signup.cs.asp?Process=Add2Member", success: function(output) { if (output.Redirect) { window.location.href = output.Redirect; } else { $('.sysMsg').html(output); } }, error: function(output) { $('.sysMsg').html(output); } }); }); }); </script> asp codes: If Session("LastVisitedURL") <> "" Then Response.Redirect Session("LastVisitedURL") Else Response.Redirect "?Section=myaccount&SubSection=myaccount" End If

    Read the article

  • Writing/Reading struct w/ dynamic array through pipe in C

    - by anrui
    I have a struct with a dynamic array inside of it: struct mystruct{ int count; int *arr; }mystruct_t; and I want to pass this struct down a pipe in C and around a ring of processes. When I alter the value of count in each process, it is changed correctly. My problem is with the dynamic array. I am allocating the array as such: mystruct_t x; x.arr = malloc( howManyItemsDoINeedToStore * sizeof( int ) ); Each process should read from the pipe, do something to that array, and then write it to another pipe. The ring is set up correctly; there's no problem there. My problem is that all of the processes, except the first one, are not getting a correct copy of the array. I initialize all of the values to, say, 10 in the first process; however, they all show up as 0 in the subsequent ones. for( j = 0; j < howManyItemsDoINeedToStore; j++ ){ x.arr[j] = 10; } Initally: 10 10 10 10 10 After Proc 1: 9 10 10 10 15 After Proc 2: 0 0 0 0 0 After Proc 3: 0 0 0 0 0 After Proc 4: 0 0 0 0 0 After Proc 5: 0 0 0 0 0 After Proc 1: 9 10 10 10 15 After Proc 2: 0 0 0 0 0 After Proc 3: 0 0 0 0 0 After Proc 4: 0 0 0 0 0 After Proc 5: 0 0 0 0 0 Now, if I alter my code to, say, struct mystruct{ int count; int arr[10]; }mystruct_t; everything is passed correctly down the pipe, no problem. I am using READ and WRITE, in C: write( STDOUT_FILENO, &x, sizeof( mystruct_t ) ); read( STDIN_FILENO, &x, sizeof( mystruct_t ) ); Any help would be appreciated. Thanks in advance!

    Read the article

  • Serial: write() throttling?

    - by damian
    Hi everyone, I'm working on a project sending serial data to control animation of LED lights, which need to stay in sync with a sound engine. There seems to be a large serial write buffer (OSX (POSIX) + FTDI chipset usb serial device), so without manually restricting the transmission rate, the animation system can get several seconds ahead of the serial transmission. Currently I'm manually restricting the serial write speed to the baudrate (8N1 = 10 bytes serial frame per 8 bytes data, 19200 bps serial - 1920 bytes per second max), but I am having a problem with the sound drifting out of sync over time - it starts fine, but after 10 minutes there's a noticeable (100ms+) lag between the sound and the lights. This is the code that's restricting the serial write speed (called once per animation frame, 'elapsed' is the duration of the current frame, 'baudrate' is the bps (19200)): void BufferedSerial::update( float elapsed ) { baud_timer += elapsed; if ( bytes_written > 1024 ) { // maintain baudrate float time_should_have_taken = (float(bytes_written)*10)/float(baudrate); float time_actually_took = baud_timer; // sleep if we have > 20ms lag between serial transmit and our write calls if ( time_should_have_taken-time_actually_took > 0.02f ) { float sleep_time = time_should_have_taken - time_actually_took; int sleep_time_us = sleep_time*1000.0f*1000.0f; //printf("BufferedSerial::update sleeping %i ms\n", sleep_time_us/1000 ); delayUs( sleep_time_us ); // subtract 128 bytes bytes_written -= 128; // subtract the time it should have taken to write 128 bytes baud_timer -= (float(128)*10)/float(baudrate); } } } Clearly there's something wrong, somewhere. A much better approach would be to be able to determine the number of bytes currently in the transmit queue, and try and keep that below a fixed threshold. Any advice appreciated.

    Read the article

  • how to send JSON data with server error response code 500

    - by kapil.israni
    I wanted to know if theres a way to send a JSON data along with HTTP response code 500. Basically I want my rest client to know that there is some error on the backend and along with it send a JSON error data structure like this. {"error" : [ {"code": "1001", "desc": "Some error description"}, {"code": "1002", "desc": "Some other error description"} ] } This is using the following java stack = Java 6/JAX-RS/Jersey/Tomcat If not, then is there a way to send a custom response code along with JSON data. Basically looking from JAX-RS API it looks that you can only send JSON data along with 200 OK?? Any thoughts?? I am guessing RESTEasy would be the same, right??

    Read the article

  • (resolved) empty response body in ajax (or 206 Partial Content)

    - by Nikita Rybak
    Hi guys, I'm feeling completely stupid because I've spent two hours solving task which should be very simple and which I solved many times before. But now I'm not even sure in which direction to dig. I fail to fetch static content using ajax from local servers (Apache and Mongrel). I get responses 200 and 206 (depending on the server), empty response text (although Content-Length header is always correct), firebug shows request in red. Javascript is very generic, I'm getting same results even here: http://www.w3schools.com/ajax/tryit.asp?filename=tryajax_first (just change document location to 'http://localhost:3000/whatever') So, it's probably not the cause. Well, now I'm out of ideas. I can also post http headers, if it'll help. Thanks! Response Headers Connection close Date Sat, 01 May 2010 21:05:23 GMT Last-Modified Sun, 18 Apr 2010 19:33:26 GMT Content-Type text/html Content-Length 7466 Request Headers Host localhost:3000 User-Agent Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 115 Connection keep-alive Referer http://www.w3schools.com/ajax/tryit_view.asp Origin http://www.w3schools.com Response Headers Date Sat, 01 May 2010 21:54:59 GMT Server Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8l DAV/2 mod_jk/1.2.28 Etag "3d5cbdb-fb4-4819c460d4a40" Accept-Ranges bytes Content-Length 4020 Cache-Control max-age=7200, public, proxy-revalidate Expires Sat, 01 May 2010 23:54:59 GMT Content-Range bytes 0-4019/4020 Keep-Alive timeout=5, max=100 Connection Keep-Alive Content-Type application/javascript Request Headers Host localhost User-Agent Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 115 Connection keep-alive Origin null UPDATED: I've found a problem, it was about cross-domain requests. I knew that there are restrictions, but thought they're relaxed for local filesystem and local servers. (and expected more descriptive error message, anyway) Thanks everybody!

    Read the article

  • .NET Single Line Logging (ala Trace.Write/WriteLine) using Instrumentation.Logging

    - by KnownColor
    Hello Everyone, My question is whether it is possible to get line/multiline (very unsure of correct term for this) behaviour of the Trace.Write and Trace.WriteLine methods but using the Microsoft Instrumentation Logging framework in .NET 2.0. Desired Output Hello World! Oh Hai. What I Currently Have Trace.Write("Hello "); Trace.WriteLine("World!"); Trace.Write("Oh Hai."); I would prefer to use instrumentation to log rather than writing to a log file using Debug.Trace. EDIT: By Instrumentation Logging I mean using a 'loggingConfiguration' block in my App.config and writing Log Entries using using Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(LogEntry logEntry); Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0 for example. Ta, KnownColor

    Read the article

  • Serializing response from JSP and converting them to C# objects

    - by SARAVAN
    I have a silverlight web application. From this app I am making a call to .jsp pages using WebClient class. Now jsp returns a response in the following format { "results":[{"Value":"1","Name":"Advertising"}, {"Value":"2","Name":"Automotive Expenses"},{"Value":"3","Name":"Business Miscellaneous"}] } The above response is assigned to my Stream object. I have a c# class CategoryType public class CategoryType { public string Value{get;set;} public string Name{get;set;} } My aim is to convert the reponses in to Collection<CategoryType> and use it in my C# Code As of now I am trying to use DataContractJSONSerialiser. But not sure if there is an easy and efficent way to do this. Any help would be appreciated

    Read the article

  • Cannot write to SD card -- canWrite is returning false

    - by Fizz
    Sorry for the ambiguous title but I'm doing the following to write a simple string to a file: try { File root = Environment.getExternalStorageDirectory(); if (root.canWrite()){ System.out.println("Can write."); File def_file = new File(root, "default.txt"); FileWriter fw = new FileWriter(def_file); BufferedWriter out = new BufferedWriter(fw); String defbuf = "default"; out.write(defbuf); out.flush(); out.close(); } else System.out.println("Can't write."); }catch (IOException e) { e.printStackTrace(); } But root.canWrite() seems to be returning false everytime. I am not running this off of an emulator, I have my android Eris plugged into my computer via USB and running the app off of my phone via Eclipse. Is there a way of giving my app permission so this doesn't happen? Also, this code seems to be create the file default.txt but what if it already exists, will it ignore the creation and just open it to write or do I have to catch something like FileAlreadyExists(if such an exception exists) which then just opens it and writes? Thanks for any help guys.

    Read the article

  • how to check the read write status of storing media in python

    - by mukul sharma
    Hi All, How can i check the read/ write permission of the file storing media? ie assume i have to write some file inside a directory and that directory may be available on read only media like (cd or dvd)or etc. So how can i check that storing media ( cd, hard disk) having a read only or read write both permission. I am using windows xp os. Thanks.

    Read the article

  • Injecting a response value into a textarea to subsequently post

    - by Ashbyrich
    I have multiple notes with class=.note and unique id each inside a div. On click of edit I grab the id, show hidden form #noteditor and hide all notes. I am using the load function to get the response (using codeigniter so url does work) and input result in the editorfrorm Textarea id = upnote... Firebug response looks ok and I have tried to inject into a div and this works fine, BUT getting this injto the text area is causing me some headaches. There is also the chance that i am going around this a convoluted way due to my limited knowledge... Any help or pointers v much appreciated... $(document).ready(function() { $('.edit').click(function(e){ var v=$(this).attr("id"); $(".note").slideUp(); $("#noteditor").slideDown('1000'); $("#upnote" ).load('/notes/my_note/'+v); e.preventDefault(); });

    Read the article

  • Decorator for determining HTTP response from a view

    - by polera
    I want to create a decorator that will allow me to return a raw or "string" representation of a view if a GET parameter "raw" equals "1". The concept works, but I'm stuck on how to pass context to my renderer. Here's what I have so far: from django.shortcuts import render_to_response from django.http import HttpResponse from django.template.loader import render_to_string def raw_response(template): def wrap(view): def response(request,*args,**kwargs): if request.method == "GET": try: if request.GET['raw'] == "1": render = HttpResponse(render_to_string(template,{}),content_type="text/plain") return render except Exception: render = render_to_response(template,{}) return render return response return wrap Currently, the {} is there just as a place holder. Ultimately, I'd like to be able to pass a dict like this: @raw_response('my_template_name.html') def view_name(request): render({"x":42}) Any assistance is appreciated.

    Read the article

  • Using Response.Redirect() to a relative path.

    - by Bryan
    I'm working with ASP.net. My website is hosted within a subfolder test under the IIS root directory. So the url of default.aspx is http://localhost/test/Default.aspx. From default.aspx, I want to use Reponse.Redirect() with a relative path to redirect to another url within the same web site, http://localhost/test/whatever. I tried Response.Redirect("/hello"); and Response.Redirect("~/hello"); Both of them redirect to http://localhost/whatever. Note that the Redirect method use http://localhost instead of http://localhost/test/ as the base url. Any ideas? Thanks.

    Read the article

  • Read and Write in the same file with different process

    - by muruga
    I have written the two program. One program is write the content to the text file simultaneously. Another program is read that content simultaneously. But both the program should run at the same time. For me the program is write the file is correctly. But another program is not read the file. I know that once the write process is completed than only the data will be stored in the hard disk. Then another process can read the data. But I want both read and write same time with different process in the single file. How can I do that? Please help me.

    Read the article

  • how get xml responce using JAX-WS SOAP handler

    - by khris
    I have implemented web service: @WebServiceClient(//parameters//) @HandlerChain(file = "handlers.xml") public class MyWebServiceImpl {...} Also I have implemented ObjectFactory with list of classes for creating my requests and responses. For Example class Test. I need to get xml of response. I try to use JAX-WS SOAP handler, so I add this @HandlerChain(file = "handlers.xml") anotation. My handlers.xml looks like: <?xml version="1.0" encoding="UTF-8"?> <handler-chains xmlns="http://java.sun.com/xml/ns/javaee"> <handler-chain> <handler> <handler-class>java.com.db.crds.ws.service.LoggingHandler</handler-class> </handler> </handler-chain> </handler-chains> My LoggingHandler class is: import java.io.PrintWriter; import java.util.Set; import javax.xml.namespace.QName; import javax.xml.soap.SOAPMessage; import javax.xml.ws.handler.MessageContext; import javax.xml.ws.handler.soap.SOAPMessageContext; public class LoggingHandler implements javax.xml.ws.handler.soap.SOAPHandler<SOAPMessageContext> { public void close(MessageContext messagecontext) { } public Set<QName> getHeaders() { return null; } public boolean handleFault(SOAPMessageContext messagecontext) { return true; } public boolean handleMessage(SOAPMessageContext smc) { Boolean outboundProperty = (Boolean) smc.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY); if (outboundProperty.booleanValue()) { System.out.println("\nOutbound message:"); } else { System.out.println("\nInbound message:"); } SOAPMessage message = smc.getMessage(); try { PrintWriter writer = new PrintWriter("soap_responce" + System.currentTimeMillis(), "UTF-8"); writer.println(message); writer.close(); message.writeTo(System.out); System.out.println(""); // just to add a newline } catch (Exception e) { System.out.println("Exception in handler: " + e); } return outboundProperty; } } I have test class which creates request, here are part of code: MyWebServiceImpl impl = new MyWebServiceImpl(url, qName); ws = impl.getMyWebServicePort(); Test req = new Test(); I suppose to get xml response in file "soap_responce" + System.currentTimeMillis(). But such file isn't even created. Please suggest how to get xml response, I'm new to web services and may do something wrong. Thanks

    Read the article

  • Abnormally disconnected TCP sockets and write timeout

    - by James
    Hello I will try to explain the problem in shortest possible words. I am using c++ builder 2010. I am using TIdTCPServer and sending voice packets to a list of connected clients. Everything works ok untill any client is disconnected abnormally, For example power failure etc. I can reproduce similar disconnect by cutting the ethernet connection of a connected client. So now we have a disconnected socket but as you know it is not yet detected at server side so server will continue to try to send data to that client too. But when server try to write data to that disconnected client ...... Write() or WriteLn() HANGS there in trying to write, It is like it is wating for somekind of Write timeout. This hangs the hole packet distribution process as a result creating a lag in data transmission to all other clients. After few seconds "Socket Connection Closed" Exception is raised and data flow continues. Here is the code try { EnterCriticalSection(&SlotListenersCriticalSection); for(int i=0;i<SlotListeners->Count;i++) { try { //Here the process will HANG for several seconds on a disconnected socket ((TIdContext*) SlotListeners->Objects[i])->Connection->IOHandler->WriteLn("Some DATA"); }catch(Exception &e) { SlotListeners->Delete(i); } } }__finally { LeaveCriticalSection(&SlotListenersCriticalSection); } Ok i already have a keep alive mechanism which disconnect the socket after n seconds of inactivity. But as you can imagine, still this mechnism cant sync exactly with this braodcasting loop because this braodcasting loop is running almost all the time. So is there any Write timeouts i can specify may be through iohandler or something ? I have seen many many threads about "Detecting disconnected tcp socket" but my problem is little different, i need to avoid that hangup for few seconds during the write attempt. So is there any solution ? Or should i consider using some different mechanism for such data broadcasting for example the broadcasting loop put the data packet in some kind of FIFO buffer and client threads continuously check for available data and pick and deliver it to themselves ? This way if one thread hangs it will not stop/delay the over all distribution thread. Any ideas please ? Thanks for your time and help. Regards Jams

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >