Search Results

Search found 8989 results on 360 pages for 'response'.

Page 81/360 | < Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >

  • Javascript / jQuery Exec turns up Null

    - by Matrym
    How do I skip over this next line if it turns out to be null? Currently, it (sometimes) "breaks" and prevents the script from continuing. var title = (/(.*?)<\/title/m).exec(response)[1]; $.get(url, function(response){ var title = (/<title>(.*?)<\/title>/m).exec(response)[1]; if (title == null || title == undefined){ return false; } var words = title.split(' '); $.each(words, function(index, value){ $link.highlight(value + " "); $link.highlight(" " + value); }); });

    Read the article

  • How to properly catch a 404 error in .NET

    - by Luke101
    I would like to know the proper way to catch a 404 error with c# asp.net here is the code I'm using HttpWebRequest request = (HttpWebRequest) WebRequest.Create(String.Format("http://www.gravatar.com/avatar/{0}?d=404", hashe)); // execute the request try { //TODO: test for good connectivity first //So it will not update the whole database with bad avatars HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Response.Write("has avatar"); } catch (Exception ex) { if (ex.ToString().Contains("404")) { Response.Write("No avatar"); } } This code works but I just would like to know if this is the most efficient.

    Read the article

  • Referring to a non-final variable data inside an inner class

    - by shoaibmohammed
    Im doing a program in GWT. Here is the snippet where Im having problem private String[] populateRSSData() { 1==>> String[] data = null; try { new RequestBuilder(RequestBuilder.GET, "../database.php?action=populaterss").sendRequest(null, new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { 2==>> data=response.getText().split("~"); } @Override public void onError(Request request, Throwable exception) { Window.alert(exception.getMessage()); } }); } catch (RequestException e) { Window.alert(e.getMessage()); } return data; } Now the problem arises that I get an error that the variable 1==>> data should be declared final. But if I declare it as final then i cannot store the datas in 2==>> The error i get Cannot refer to a non-final variable data inside an inner class defined in a different method RSS_Manager.java Please suggest

    Read the article

  • Get and Set a Single Cookie with Node.js HTTP Server

    - by Corey Hart
    I want to be able to set a single cookie, and read that single cookie with each request made to the nodejs server instance. Can it be done in a few lines of code, without the need to pull in a third party lib? var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 'text/plain'}); response.end('Hello World\n'); }).listen(8124); console.log('Server running at http://127.0.0.1:8124/'); Just trying to take the above code directly from nodejs.org, and work a cookie into it.

    Read the article

  • Why is django.test.client.Client not keeping me logged in.

    - by Mystic
    I'm using django.test.client.Client to test whether some text shows up when a user is logged in. However, I the Client object doesn't seem to be keeping me logged in. This test passes if done manually with Firefox but not when done with the Client object. class Test(TestCase): def test_view(self): user.set_password(password) user.save() client = self.client # I thought a more manual way would work, but no luck # client.post('/login', {'username':user.username, 'password':password}) login_successful = client.login(username=user.username, password=password) # this assert passes self.assertTrue(login_successful) response = client.get("/path", follow=True) #whether follow=True or not doesn't seem to work self.assertContains(response, "needle" ) When I print response it returns the login form that is hidden by: {% if not request.user.is_authenticated %} ... form ... {% endif %} This is confirmed when I run ipython manage.py shell. The problem seems to be that the Client object is not keeping the session authenticated.

    Read the article

  • HASHREF in Perl

    - by Uri
    I'm trying to decrypt a Perl code which I'm not familiar with, somehow related to HashRef. I'm using Amazon::S3, but my question is a general Perl question. See the code below: use Amazon::S3; my $s3 = Amazon::S3-new( ... ); my $response = $s3-buckets; Documentation (here) sais, about s3-buckets: Returns undef on error, else HASHREF of results The following line is working for me, but I don't understand why: for $b in ( @ { $response-{buckets} } ) { print "bucket: " . $b-bucket . "\n"; } I'm buzzled by each operator on the first line. What type exactly are $response, $respone-{bucket}. Looks like the expression within the 'for' is an array, but I don't understand this syntax: @{ ... }?

    Read the article

  • how to apply filters in jsf

    - by johnbritto
    Hi I have filter code Page not Found error while any client request for Jsf Page in my Jsf application.I dont Know How to Fix this issue This is My Filter Code: HttpServletRequest req =(HttpServletRequest)request; HttpServletResponse res =(HttpServletResponse)response; HttpSession ses = req.getSession(true); String pageRequested =req.getRequestURL().toString(); if (ses.getAttribute("userDetails")!=null) { fc.doFilter(request,response); }else{ RequestDispatcher dis = request.getRequestDispatcher(LOGIN_PAGE); dis.forward(request,response); } This code inside the DoFilter Method I done all The settings in Web.xml deployment Descriptor

    Read the article

  • Posting within PHP and receiving only cookie

    - by faya
    Hello I have a question. It might be sound ridiculous, but let me explain what I want to accomplish. Right now I try to embed open source forum to by site and I want to leave forum and my site databases split. When my site users are logging in I want them also automatically be logged in to the forum system. For that I want to login within my PHP code after receiving username and password in post, but I don't know how I can get only cookies in response. I have found out that I can use curl_init(), curl_exec(), curl_close() functionality, but response from curl_exec returns whole response(page content, cookies, headers). Is there a way to receive only cookies? P.S. - If my design is totally wrong please give an advise how I can embed this functionality! I would be very thankful!

    Read the article

  • what is the meaning of this code

    - by spific
    i have this code : use strict; use LWP::UserAgent; use warnings; my $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5'); $ua->proxy([qw(http https)] => 'http://59.39.92.148:1080'); my $response = $ua->get("http://www.google.com"); print $response->code,' ', $response->message,"\n"; is the mean of code " open www.google.com with sock proxy"? pls explain for me .

    Read the article

  • <function> referenced from; symbol(s) not found.

    - by jfm429
    I have a piece of C code that is used from a C++ function. At the top of my C++ file I have the line: #include "prediction.h" In prediction.h I have this: #ifndef prediction #define prediction #include "structs.h" typedef struct { double estimation; double variance; } response; response runPrediction(int obs, location* positions, double* observations, int targets, location* targetPositions); #endif I also have prediction.c, which has: #include "prediction.h" response runPrediction(int obs, location* positions, double* observations, int targets, location* targetPositions) { // code here } Now, in my C++ file (which as I said includes prediction.h) I call that function, then compile (through Xcode) I get this error: "runPrediction(int, location*, double*, int, location*)", referenced from: mainFrame::respondTo(char*, int)in mainFrame.o ld: symbol(s) not found collect2: ld returned 1 exit status prediction.c is marked for compilation for the current target. I don't have any problems with other .cpp files not being compiled. Any thoughts here?

    Read the article

  • Attaching files to WCF REST service responses

    - by David Seiler
    I have a resource that looks something like this: /users/{id}/summary?format={format} When format is "xml" or "json" I respond with a user summary object that gets automagically encoded by WCF - fine so far. But when format equals "pdf", I want my response to consist of a trivial HTTP response body and a PDF file attachment. How is this done? Hacking on WebOperationContext.Current.OutgoingResponse doesn't seem to work, and wouldn't be the right thing even if it did. Including the bits of the file in a CDATA section or something in the response isn't safe. Should I create a subclass of Message, then provide a custom IDispatchMessageFormatter that responds with it? I went a short distance down that path but ultimately found the documentation opaque. What's the right thing?

    Read the article

  • stumped on jquery call inside chrome extension

    - by phil swenson
    In my chrome extension I call this: jsonPost = { email:"[email protected]", password:"demo", content: $('#selected_text').val(), notification_type: $('#notification_type').val(), name:$('#notification_name').val() } $.post('http://localhost:3000/api/create.json', jsonPost, function (data) { console.log("type of data = " + typeof(data)); console.log("data in function = " + data); } The data makes it to the server. But the response is lost, in the console ---type of data = String ---data in function = So for some reason I am not getting the response back. Works from the browser. I even tried doing a get against cnn.com and got no response. any ideas? thanks

    Read the article

  • performing a Http request on android

    - by rantravee
    Hi, Could someone provide the basic code to use if I want to perform a http request on android to the address "address" with the string "message" ? Also I'd like to check the server response and perform some actions if the right conditions meet , but I ' m unsure of how and when the server send back the response . My guess is that the response is gotten in a blocking function, or in an asynchronous function . Could you provide code or information on this as well ? Great thanks from a novice with too much on his head !

    Read the article

  • Track each request to the website

    - by stacker
    I want to save each request to the website. In general I want to include the following information: User IP, The web site url. Response time, response success-failed status. Is it reasonable to collect the 1 and 2 in the same action? (like same HttpModule)? Do you know about any existing structure that I can follow that track every request/response-status to the website? The data need to be logged to sql server.

    Read the article

  • IIS Active Directory double handshake hickup

    - by AngryHacker
    I have a .net 2.0 click-once application that connects to IIS web services on Windows 2003 R2 64-bits. The IIS is setup with Integrated Windows Authentication. So whenever a web service call is made to IIS web services, there is a double handshake taking place: Client Request #1 GetEmployeeList Server Response #1 <- 401 HTTP/1.1 401 Unauthorized WWW-Authenticate: Negotiate WWW-Authenticate: NTLM Client Request #2 REQUEST Header... Server Response #2 <- 200 Data Received Lately, however, Server Response #1 will sometimes (a good 20 percent of the calls) take a massive amount of time (like 25 to 30 seconds). How do I debug this problem? Is this a Active Directory problem or a Domain Controller problem?

    Read the article

  • ASP.NET Ajax Error: Sys.WebForms.PageRequestManagerParserErrorException

    - by Phil Bennett
    My website has been giving me intermittent errors when trying to perform any Ajax activities. The message I get is Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near ' So its obviously some sort of server timeout or the server's just returning back mangled garbage. This generally, unfortunately not always, happens when the site has been idle for a while. Anybody else been able to overcome this? Thanks

    Read the article

  • Problem with layout of control when dynamically creating winform and controls for the Form

    - by Ashwani Roy
    I get this response from a web service call. Something like this <Response> <Control1 type = "DropdownList" value= "USA,UK,Sweden,UAE"/> <Control2 type = "Textbox" value= "Contries"/> <Control3 type = "Button" value= "None"> </Response> Based on this I de-serialize it into List<Controls>. Now I need to be able to dynamically create a winform based on these controls. My problem is the layout. I want to be able to create them nicely separated (If possible vertically aligned) in batches of lets say 5.So If I need 15 controls I have 3 columns and 5 rows. What would be best way to achieve this? I know that I can use the inbuilt positioning properties like top, width etc., but maybe someone out there has done something similar in a better way.

    Read the article

  • Why a thread is aborted in ASP.NET MVC (again)?

    - by Dario Solera
    Here is what I do in a controller action: create and start a new Thread that does a relatively long processing task (~30 seconds on average, but might be several minutes) immediately return the page response so the user knows processing has started (trivially, a Json with a task ID for polling purposes). At some random point, ThreadAbortException is thrown, so the async task does not complete. The exception is not thrown every time, it just happens randomly roughly 25% of the times. Points to note: I'm not calling Response.End or Response.Redirect - there isn't even a request running when the exception is thrown I tried using ThreadPool and I got the same behavior I know running threads in ASP.NET has several caveats but I don't care right now Any suggestion?

    Read the article

  • Downloading file with ";" or "#" in file name ruins filename

    - by Sergej Andrejev
    I have a file named AttachmentDownload.aspx and inside Page_Load method have such code wich offers to download file. All names work correctly in IE except names which include ";" or "#". They offer user to save the file under name "AttachmentDownload.aspx". Is there a workaround for this? Here is an example: var fileName = Server.UrlPathEncode (";%.txt"); Response.AddHeader("content-disposition", String.Format("attachment;filename=\"{0}\"", fileName)); Response.WriteFile(path); Response.End();

    Read the article

  • Configurator Scan not picking up views

    - by mxmissile
    New to Py and Python. I'm trying to get pyramid Configurator scan to find my views, but I seem to be missing something, it's not picking up my "view" index here are my files: app.py from wsgiref.simple_server import make_server from pyramid.config import Configurator if __name__ == '__main__': config = Configurator() config.add_route('home', '/') config.scan() app = config.make_wsgi_app() server = make_server('0.0.0.0', 6543, app) server.serve_forever() and index.py from pyramid.view import view_config from pyramid.response import Response @view_config(route_name='home') def index(request): print'Incoming request' return Response('<body><h1>Home</h1></body>') Its returning a 404. However, if I remove config.scan() and add the view manually it works fine. from wsgiref.simple_server import make_server from pyramid.config import Configurator from index import index if __name__ == '__main__': config = Configurator() config.add_route('home', '/') config.add_view(index, route_name='home')

    Read the article

  • IE's responseXML.getElementsByTagName() unable to handle non English character ?

    - by trix
    I have a javascript that does this (http is your XMLHttpRequest object) var r = http.responseXML.getElementsByTagName('item'); The issue is variable r is always an empty list if the response contains non-English character (r.length is 0). The response header is correctly set Content-Type: text/xml;charset=ISO-8859-1 This is what the response from the webserver looks like <?xml version='1.0' encoding='UTF-8'?> <d> <r> <item value="jmob" label="John Möb"/> </r> </d> It happens only in IE (both IE6 and IE8), works in Firefox and Chrome. If items contain only English characters, it works fine. Is there a workaround for this ?

    Read the article

  • Please help me to resolve my ajax error

    - by Rajesh Rolen- DotNet Developer
    i am using asp.net (.net framework 2.0) i am getting below error for my ajax popup extender error : Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near 'The server rejected '. actually is not giving me error on localhost, i have uploaded it on 2 other different server on 1 server its working fine but on other server its giving me above error. (on server where is working fine has got windows 2000 and on which its giving error its ms windows 2003). this is link where its giving me error : highschoolers its on "Join new for free" button ..

    Read the article

  • c#: sms appears to have been sent, but stuck in phone outbox

    - by I__
    i wrote code to send an SMS using my gsm phone which is attached to the computer through com port. the code is below. the problem is i do see that it is in the outbox of the phone and it actually appears to have been sent, but when i contact the recipient they say that i have not received the message. i test the phone, and i create and send a message using only the phone and it works perfectly, however when i do this with my code, it APPEARS to have been sent, and i am getting all the correct AT COMMAND responses from the phone, but the message is actually NOT sent. here is the code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; using System.IO.Ports; namespace WindowsFormsApplication1 { public partial class Form1 : Form { SerialPort serialPort1; int m_iTxtMsgState = 0; const int NUM_MESSAGE_STATES = 4; const string RESERVED_COM_1 = "COM1"; const string RESERVED_COM_4 = "COM4"; public Form1() { InitializeComponent(); this.Closing += new CancelEventHandler(Form1_Closing); } private void Form1_Load(object sender, EventArgs e) { serialPort1 = new SerialPort(GetUSBComPort()); if (serialPort1.IsOpen) { serialPort1.Close(); } serialPort1.Open(); //ThreadStart myThreadDelegate = new ThreadStart(ReceiveAndOutput); //Thread myThread = new Thread(myThreadDelegate); //myThread.Start(); this.serialPort1.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived); } private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { serialPort1.Close(); } private void SendLine(string sLine) { serialPort1.Write(sLine); sLine = sLine.Replace("\u001A", ""); consoleOut.Text += sLine; } public void DoWork() { ProcessMessageState(); } public void ProcessMessageState() { switch (m_iTxtMsgState) { case 0: m_iTxtMsgState = 1; SendLine("AT\r\n"); //NOTE: SendLine must be the last thing called in all of these! break; case 1: m_iTxtMsgState = 2; SendLine("AT+CMGF=1\r\n"); break; case 2: m_iTxtMsgState = 3; SendLine("AT+CMGW=" + Convert.ToChar(34) + "+9737387467" + Convert.ToChar(34) + "\r\n"); break; case 3: m_iTxtMsgState = 4; SendLine("A simple demo of SMS text messaging." + Convert.ToChar(26)); break; case 4: m_iTxtMsgState = 5; break; case 5: m_iTxtMsgState = NUM_MESSAGE_STATES; break; } } private string GetStoredSMSID() { return null; } /* //i dont think this part does anything private void serialPort1_DataReceived_1(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { string response = serialPort1.ReadLine(); this.BeginInvoke(new MethodInvoker(() => textBox1.AppendText(response + "\r\n"))); } */ void sp_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { Thread.Sleep(500); char[] msg; msg = new char[613]; int iNumToRead = serialPort1.BytesToRead; serialPort1.Read(msg, 0, iNumToRead); string response = new string(msg); this.BeginInvoke(new MethodInvoker(() => textBox1.AppendText(response + "\r\n"))); serialPort1.DiscardInBuffer(); if (m_iTxtMsgState == 4) { int pos_cmgw = response.IndexOf("+CMGW:"); string cmgw_num = response.Substring(pos_cmgw + 7, 4); SendLine("AT+CMSS=" + cmgw_num + "\r\n"); //stop listening to messages received } if (m_iTxtMsgState < NUM_MESSAGE_STATES) { ProcessMessageState(); } } catch { } } private void button1_Click(object sender, EventArgs e) { m_iTxtMsgState = 0; DoWork(); } private void button2_Click(object sender, EventArgs e) { string[] sPorts = SerialPort.GetPortNames(); foreach (string port in sPorts) { consoleOut.Text += port + "\r\n"; } } private string GetUSBComPort() { string[] sPorts = SerialPort.GetPortNames(); foreach (string port in sPorts) { if (port != RESERVED_COM_1 && port != RESERVED_COM_4) { return port; } } return null; } }

    Read the article

  • How is this inupt tag linking to another page?

    - by Matt
    Response.Write("<div><input type='submit' name='submit' value='Update Cart' /></div>") Response.Write("<div><input type='submit' name='submit' value='Shop More' /></div>") Response.Write("<div><input type='submit' name='submit' value='Checkout' /></div>") that is some example code from my teacher, but he hasn't answered my email in a couple days so I need some help. When you click the Update Cart button it just updates the cart page it's on, but when you click the Shop More button it links to Shop.aspx a different page, and the Checkout links to another page as well. I can't figure out how it is linking just from that code, anybody have any insights?

    Read the article

< Previous Page | 77 78 79 80 81 82 83 84 85 86 87 88  | Next Page >