Search Results

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

Page 26/360 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • Detect response from Modem?

    - by GoodBoyNYC
    I'm working with a Teltonika G10 GSM modem and wrote up a basic program to send out SMS. I put a 1.5 second timer between each AT command to allow the modem to simulate the wait for the "OK" from the modem. This works for now but I'd rather use a branching statement wait for an actual response such as "OK" or "ERROR" rather than using a timer. SerialPort1.Write("AT+CMGD=1,4" & vbCrLf) Thread.Sleep(1250) SerialPort1.Write("AT+CMGF=1" & vbCrLf) Thread.Sleep(1250) SerialPort1.Write("AT+CMGS=" & Chr(34) & "3475558223" & Chr(34) & vbCrLf) Thread.Sleep(1250) SerialPort1.Write(":|" & Chr(26))

    Read the article

  • Discard unprintable characters returned in server's XML response

    - by Penang
    While trying to use the Bing API to search, I am getting characters that are not printable and do not seem to hold any extra information. The goal is to save the XML (UTF-8) response as a text file to be parsed later. My code currently looks something like this: URL url = new URL(queryURL); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); BufferedWriter out = new BufferedWriter(new FileWriter(query+"-"+saveResultAs)); String str = in.readLine(); out.write(str); in.close(); out.close(); When I send the contents of 'str' to console it looks something like this: and here's a what the newly created local XML file looks like: What should I be doing to convert the UTF-8 text so that str does not have the extra characters?

    Read the article

  • replace asp.net Response.Output with my own content

    - by WebDude
    I am trying to intercept a asp.net web request and based on a lookup replace the page thats going to be rendered to the client. example: is a request for "/about-us" comes to my web server, i will first see if i have a version of this in the database, otherwise i will revert to flat files. The version i will retrieve from the database will be a .aspx page that has to be rendered and containt web controls and inline serverside script. What is the best way to go about this? I have tried overriding the CreateHtmlTextWriter method but this seems too late in the process as the TextWriter passed to this method is already instantiated. I have also tried to Implement my own PageHandlerFactory but this seems to create an instance of Page of which i cannot seem to override its internal setting of the Response.Output stream. Amd i barking up the wrong tree here? what is the best approach to take here?

    Read the article

  • Most efficient method of generating PNG as HTTP response

    - by awj
    I've built an ASP.NET page whose output stream is a dynamically-generated PNG image containing only text on a transparent background. The text is based upon database IDs contained in the querystring. There will be a limited number of variations. Which one of the following would be the most efficient means of returning the image to the client? Store each variation upon the first generation, and thenceforth retrieve this from the drive. Simply generate the image each time. Cache the output response based upon the querystring.

    Read the article

  • Compiler error when using abstract types

    - by Dylan
    I'm trying to implement a "protocol helper" trait that is responsible for matching up Prompts and Responses. The eventual goal is to have an object that defines the various Prompt and Response classes as subclasses of a sealed trait, then have a class that mixes in the ProtocolSupport trait for that Protocol object. The problem is that my current approach won't compile, even though I'm fairly sure it should. Here's a distilled version of what I've got: trait Protocol { type Response type Prompt <: BasePrompt trait BasePrompt { type Data def validate(response: Response): Validated[Data] } } trait ProtocolSupport[P <: Protocol] { def foo(prompt: P#Prompt, response: P#Response) = { // compiler error prompt.validate(response) } } The compiler doesn't like the response as an argument to prompt.validate: [error] found : response.type (with underlying type P#Response) [error] required: _4.Response where val _4: P [error] prompt.validate(response) [error] ^ This isn't very helpful.. it seems to say that it wants a P.Response but that's exactly what I'm giving it, so what's the problem?

    Read the article

  • What is the difference between "render a view" and send the response using the Response's method "sendResponse()"?

    - by Green
    I've asked a question about what is "rendering a view". Got some answers: Rendering a view means showing up a View eg html part to user or browser. and So by rendering a view, the MVC framework has handled the data in the controller and done the backend work in the model, and then sends that data to the View to be output to the user. and render just means to emit. To print. To echo. To write to some source (probably stdout). but don't understand then the difference between rendering a view and using the Response class to send the output to the user using its sendResponse() method. If render a view means to echo the output to the user then why sendResponse() exists and vise versa? sendResponse() exactly sends headers and after headers outputs the body. They solve the same tasks but differently? What is the difference?

    Read the article

  • Event Aggregator.. not getting a response, how to determine completion?

    - by Duncan_m
    I'm rewriting a vehicle tracking application, a google maps based thing.. The users are able to search for a vehicle by typing a few characters of the vehicles "callsign". My application is based around a sort of "event bus" within Backbone.. when a search occurs I send a message on the bus saying something like "does anyone match this?".. If a marker matches the search term it responds with a sort of "yes, I match!".. My challenge arises when no-one matches, I get no response.. it feels a little hacky to "wait a little while" and check if a response has been recieved.. The application is based around Backbone.js and using the Event Aggregator pattern described in the answer to this question on Stack Overflow: http://stackoverflow.com/questions/7708195/access-function-in-one-view-from-another-in-backbone-js Is there a well defined design pattern that might assist me here? Sending a request for a response and not getting any responses?

    Read the article

  • Ajax call from a form rendered as Ajax response (jQuery + Grails: chaining ajax requests)

    - by bsreekanth
    Hello, I was expecting the below scenario common, but couldn't find much help online. I have a form loaded through Ajax (say, create entity form). It is loaded through a button click (load) event $("#bt-create").click(function(){ $ ('#pid').load('/controller/vehicleModel/create3'); return false; }); the response (a form) is written in to the pid element. The name and id of the form is ajax-form, and the submit event is attached to an ajax post request $(function() { $("#ajax-form").submit(function(){ // do something... var url = "/app/controller/save" $.post(url, $(this).serialize(), function(data) { alert( data ) ; /// alert data from server }); I could make the above ajax operations individually. That is the ajax post operation succeeds if it calls from a static html file. But if I chain the requests (after completing the first), so that it calls from the output form generated by the first request, nothing happens. I could see the post method is called through firebug. Is there a better way to handle above flow? One more interesting thing I noticed. As you could see, I use grails as my platform. If I keep the javascripts in the main.gsp (master layout), the submit event would not register as the breakpoint is not hit in firebug. But, if I define the javascript in the template file (which renders the form above), the breakpoint is hit, but as I explained, the action is not called at the controller. I changes the javascript to the head section but same result. any help greatly appreciated. thanks, Babu.

    Read the article

  • RSolr RequestError Solr Response Severe errors in solr configuration

    - by manalang
    I was reindexing my model when I suddenly shutdown my mac, When I try to reindex again using (Model_name).reindex in script/console I encountered an error that I haven't encountered before. RSolr::RequestError: Solr Response: Severe_errors_in_solr_configuration__Check_your_log_files_for_more_detailed_information_on_what_may_be_wrong__If_you_want_solr_to_continue_after_configuration_errors_change____abortOnConfigurationErrorfalseabortOnConfigurationError__in_null___javalangRuntimeException_javaioIOException_read_past_EOF__at_orgapachesolrcoreSolrCoregetSearcherSolrCorejava1068__at_orgapachesolrcoreSolrCoreinitSolrCorejava579__at_orgapachesolrcoreCoreContainer$InitializerinitializeCoreContainerjava137__at_orgapachesolrservletSolrDispatchFilterinitSolrDispatchFilterjava83__at_orgmortbayjettyservletFilterHolderdoStartFilterHolderjava99__at_orgmortbaycomponentAbstractLifeCyclestartAbstractLifeCyclejava40__at_orgmortbayjettyservletServletHandlerinitializeServletHandlerjava594__at_orgmortbayjettyservletContextstartContextContextjava139__at_orgmortbayjettywebappWebAppContextstartContextWebAppContextjava1218__at_orgmortbayjettyhandlerContextHandlerdoStartContextHandlerjava500__at_orgmortbayjettywebappWebAppContextdoStartWebAppContextjava448__at_orgmortbaycomponentAbstractLifeCyclestartAbstractLifeCyclejava40__at_orgmortbayjettyhandlerHandlerCollectiondoStartHandlerCollectionjava147__at_orgmortbayjettyhandlerContextHandlerCollectiondoStartContextHandlerCollectionjava161__at_orgmortbaycomponentAbstractLifeCyclestartAbstractLifeCyclejava40__at_orgmortbayjettyhandlerHandlerCollectiondoStartHandlerCollectionjava147__at_orgmortbaycomponentAbstractLifeCyclestartAbstractLifeCyclejava40__at_orgmortbayjettyhandlerHandlerWrapperdoStartHandlerWrapperjava117__at_orgmortbayjettyServerdoStartServerjava210__at_orgmortbaycomponentAbstractLifeCyclestartAbstractLifeCyclejava40__at_orgmortbayxmlXmlConfigurationmainXmlConfigurationjava929__at_sunreflectNativeMethodAccessorImplinvoke0Native_Method__at_sun from /usr/local/lib/ruby/gems/1.8/gems/rsolr-0.12.1/lib/rsolr/connection/requestable.rb:39:in `request' from /usr/local/lib/ruby/gems/1.8/gems/rsolr-0.12.1/lib/rsolr/client.rb:34:in `request' from /usr/local/lib/ruby/gems/1.8/gems/rsolr-0.12.1/lib/rsolr/client.rb:22:in `update' from /usr/local/lib/ruby/gems/1.8/gems/rsolr-0.12.1/lib/rsolr/client.rb:76:in `delete_by_query' from /usr/local/lib/ruby/gems/1.8/gems/sunspot-1.1.0/lib/sunspot/indexer.rb:55:in `remove_all' from /usr/local/lib/ruby/gems/1.8/gems/sunspot-1.1.0/lib/sunspot/session.rb:173:in `remove_all' from /usr/local/lib/ruby/gems/1.8/gems/sunspot-1.1.0/lib/sunspot/session.rb:173:in `each' from /usr/local/lib/ruby/gems/1.8/gems/sunspot-1.1.0/lib/sunspot/session.rb:173:in `remove_all' from /usr/local/lib/ruby/gems/1.8/gems/sunspot-1.1.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all' from /usr/local/lib/ruby/gems/1.8/gems/sunspot-1.1.0/lib/sunspot.rb:414:in `remove_all' from /Users/cecilleann/Projects/dhire2/vendor/plugins/sunspot_rails-1.1.0/lib/sunspot/rails/searchable.rb:164:in `solr_remove_all_from_index' from /Users/cecilleann/Projects/dhire2/vendor/plugins/sunspot_rails-1.1.0/lib/sunspot/rails/searchable.rb:183:in `reindex' from (irb):6 Now I haven't been able to fix the error. Please help me. I can't move one. Thanks a lot in advance

    Read the article

  • Render view to string followed by redirect results in exception

    - by Chris Charabaruk
    So here's the issue: I'm building e-mails to be sent by my application by rendering full view pages to strings and sending them. This works without any problem so long as I'm not redirecting to another URL on the site afterwards. Whenever I try, I get "System.Web.HttpException: Cannot redirect after HTTP headers have been sent." I believe the problem comes from the fact I'm reusing the context from the controller action where the call for creating the e-mail comes from. More specifically, the HttpResponse from the context. Unfortunately, I can't create a new HttpResponse that makes use of HttpWriter because the constructor of that class is unreachable, and using any other class derived from TextWriter causes response.Flush() to throw an exception, itself. Does anyone have a solution for this? public static string RenderViewToString( ControllerContext controllerContext, string viewPath, string masterPath, ViewDataDictionary viewData, TempDataDictionary tempData) { Stream filter = null; ViewPage viewPage = new ViewPage(); //Right, create our view viewPage.ViewContext = new ViewContext(controllerContext, new WebFormView(viewPath, masterPath), viewData, tempData); //Get the response context, flush it and get the response filter. var response = viewPage.ViewContext.HttpContext.Response; //var response = new HttpResponseWrapper(new HttpResponse // (**TextWriter Goes Here**)); response.Flush(); var oldFilter = response.Filter; try { //Put a new filter into the response filter = new MemoryStream(); response.Filter = filter; //Now render the view into the memorystream and flush the response viewPage.ViewContext.View.Render(viewPage.ViewContext, viewPage.ViewContext.HttpContext.Response.Output); response.Flush(); //Now read the rendered view. filter.Position = 0; var reader = new StreamReader(filter, response.ContentEncoding); return reader.ReadToEnd(); } finally { //Clean up. if (filter != null) filter.Dispose(); //Now replace the response filter response.Filter = oldFilter; } }

    Read the article

  • Django | Python creating a JSON response

    - by MMRUser
    Hi, I'm trying to convert a server side AJAX response script in to an Django HttpResponse, but apparently it's not working. This is the server-side script /* RECEIVE VALUE */ $validateValue=$_POST['validateValue']; $validateId=$_POST['validateId']; $validateError=$_POST['validateError']; /* RETURN VALUE */ $arrayToJs = array(); $arrayToJs[0] = $validateId; $arrayToJs[1] = $validateError; if($validateValue =="Testuser"){ // validate?? $arrayToJs[2] = "true"; // RETURN TRUE echo '{"jsonValidateReturn":'.json_encode($arrayToJs).'}'; // RETURN ARRAY WITH success }else{ for($x=0;$x<1000000;$x++){ if($x == 990000){ $arrayToJs[2] = "false"; echo '{"jsonValidateReturn":'.json_encode($arrayToJs).'}'; // RETURN ARRAY WITH ERROR } } } And this is the converted code def validate_user(request): if request.method == 'POST': vld_value = request.POST.get('validateValue') vld_id = request.POST.get('validateId') vld_error = request.POST.get('validateError') array_to_js = [vld_id, vld_error, False] if vld_value == "TestUser": array_to_js[2] = True x = simplejson.dumps(array_to_js) return HttpResponse(x) else: array_to_js[2] = False x = simplejson.dumps(array_to_js) test = 'Error' return render_to_response('index.html',{'error':error},context_instance=RequestContext(request)) return render_to_response('index.html',context_instance=RequestContext(request)) I'm using simplejson to encode the Python list (so it will return a json array).Coudn't figure out the problem yet.But I think that I did something wrong about the 'echo'. Anyway I'm expecting an good answer it will help me a lot. Thanks.

    Read the article

  • find(:all) and then add data from another table to the object

    - by Koning Baard XIV
    I have two tables: create_table "friendships", :force => true do |t| t.integer "user1_id" t.integer "user2_id" t.boolean "hasaccepted" t.datetime "created_at" t.datetime "updated_at" end and create_table "users", :force => true do |t| t.string "email" t.string "password" t.string "phone" t.boolean "gender" t.datetime "created_at" t.datetime "updated_at" t.string "firstname" t.string "lastname" t.date "birthday" end I need to show the user a list of Friendrequests, so I use this method in my controller: def getfriendrequests respond_to do |format| case params[:id] when "to_me" @friendrequests = Friendship.find(:all, :conditions => { :user2_id => session[:user], :hasaccepted => false }) when "from_me" @friendrequests = Friendship.find(:all, :conditions => { :user1_id => session[:user], :hasaccepted => false }) end format.xml { render :xml => @friendrequests } format.json { render :json => @friendrequests } end end I do nearly everything using AJAX, so to fetch the First and Last name of the user with UID user2_id (the to_me param comes later, don't worry right now), I need a for loop which make multiple AJAX calls. This sucks and costs much bandwidth. So I'd rather like that getfriendrequests also returns the First and Last name of the corresponding users, so, e.g. the JSON response would not be: [ { "friendship": { "created_at": "2010-02-19T13:51:31Z", "user1_id": 2, "updated_at": "2010-02-19T13:51:31Z", "hasaccepted": false, "id": 11, "user2_id": 3 } }, { "friendship": { "created_at": "2010-02-19T16:31:23Z", "user1_id": 2, "updated_at": "2010-02-19T16:31:23Z", "hasaccepted": false, "id": 12, "user2_id": 4 } } ] but rather: [ { "friendship": { "created_at": "2010-02-19T13:51:31Z", "user1_id": 2, "updated_at": "2010-02-19T13:51:31Z", "hasaccepted": false, "id": 11, "user2_id": 3, "firstname": "Jon", "lastname": "Skeet" } }, { "friendship": { "created_at": "2010-02-19T16:31:23Z", "user1_id": 2, "updated_at": "2010-02-19T16:31:23Z", "hasaccepted": false, "id": 12, "user2_id": 4, "firstname": "Mark", "lastname": "Gravell" } } ] I thought of a for loop in the getfriendrequests method, but I don't know how to implement this, and maybe there is an easier way. It must also work for XML. Can anyone help me? Thanks

    Read the article

  • problem in json response from server to client using jquery

    - by user1400
    hello i try to use ajax and zend framework in my application , i could pass variable to server but i can not get data from server , it does not return values, it return all html code page, where is my mistake? or should i config other thing? $('#myForm').submit(function($e){ $e.preventDefault(); var $paramToServer=$("#myForm").serialize(); $.ajax({ type:'POST', url:'test', data:$paramToServer , success:function(re){ var res = $.evalJSON(re); console.log(res.id); // to see in firebog }, dataType:'json' }); }); public function testAction() { $this->_helper->getHelper('viewRenderer')->setNoRender(); //disable layout Zend_Layout::getMvcInstance()->disableLayout(); $name=$this->getRequest()->getParam ( 'name' ); //pass $name to server $return = array( 'id' => '5', 'family' => 'hello ', ); $return = Zend_Json::encode( $return); // Response $this->getResponse()->setBody($return); } thanks

    Read the article

  • ASP.NET MVC intermittent slow response

    - by arehman
    Problem In our production environment, system occasionally delays the page response of an ASP.NET MVC application up to 30 seconds or so, even though same page renders in 2-3 seconds most of the times. This happens randomly with any arbitrary page, and GET or POST type requests. For example, log files indicates, system took 15 seconds to complete a request for jquery script file or for other small css file it took 10 secs. Similar Problems: Random Slow Downs Production Environment: Windows Server 2008 - Standard (32-bit) - App Pool running in integrated mode. ASP.NET MVC 1.0 We have tried followings/observations: Moved the application to a stand alone web server, but, it didn't help. We didn't ever notice same issue on the server for any 'ASP.NET' application. App Pool settings are fine. No abrupt recycles/shutdowns. No cpu spikes or memory problems. No delays due to SQL queries or so. It seems as something causing delay along HTTP Pipeline or worker processor seeing the request late. Looking for other suggestions. -- Thanks

    Read the article

  • YUI "Get" utility to parse JSON response?

    - by Sean
    The documentation page for the YUI "Get" utility says: Get Utility is ideal for loading your own scripts or CSS progressively (lazy-loading) or for retrieving cross-domain JSON data from sources in which you have total trust. ...but doesn't have any actual examples for how to do so. Their one example doesn't actually request a JSON document from a remote server, but instead a document containing actual JavaScript along with the JSON data. I'm just interested in the JSON response from the Google Maps API HTTP (REST) interface. Because I can't do cross-site scripting with the "Connect" utility, I am trying the "Get" utility. But merely inserting some JSON data into the page isn't going to do anything, of course. I have to assign it to a variable. But how? Also, just inserting JSON data into the page makes Firefox complain that there's a JavaScript error. And understandably! Plain ol' JSON data isn't going to parse as valid JavaScript. Any ideas?

    Read the article

  • Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 401'

    - by Peak Reconstruction Wavelength
    I am using a php-script that has been working for years, but suddenly it aborts with Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 401' NoLinkedYouTubeAccount Error 401 It starts like this <?php function anmelden_yt($name,$passwort) { $yt_source = 'known'; $yt_api_key = 'key'; $yt = null; $authenticationURL= 'https://www.google.com/accounts/ClientLogin'; $httpClient = Zend_Gdata_ClientLogin::getHttpClient( $username = $name, $password = $passwort, $service = 'youtube', $client = null, $source = $yt_source, // a short string identifying your application $loginToken = null, $loginCaptcha = null, $authenticationURL); abschnitt("Login"); return new Zend_Gdata_YouTube($httpClient, $yt_source, NULL, $yt_api_key); } require_once("Zend/Gdata/ClientLogin.php"); require_once("Zend/Gdata/HttpClient.php"); require_once("Zend/Gdata/YouTube.php"); require_once("Zend/Gdata/App/MediaFileSource.php"); require_once("Zend/Gdata/App/HttpException.php"); require_once('Zend/Uri/Http.php'); require_once 'Zend/Loader.php'; Zend_Loader::loadClass('Zend_Gdata_YouTube'); Zend_Loader::loadClass('Zend_Gdata_AuthSub'); Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); $yt = anmelden_yt($name,$pass); $videoFeed = $yt->getUserUploads('Google'); sleep(0.5); @ob_flush(); @flush(); ?> What could be the reason for this? ..................................................................................................

    Read the article

  • Response.Redirect in a COM+ Object Called from Classic ASP Page

    - by ajdams
    Basically we moved from IIS 5 to IIS 7 and I am trying to update some of our old COM objects to .NET by rewriting them in C#. What I am have so far is a Classic ASP page calling the COM+ object and then I am trying to do a simple redirect within the COM+ object (this is just for testing purposes, it's not what the object will do eventually). My problem/question is, why does the redirect call not work properly? Am I doing something wrong or can you not redirect within a COM+ object? All that happens is a blank white page comes up and if I check the IIS logs, I see no errors. Here is my code so far: In Classic ASP (the call to COM+) Set oBankReg = CreateObject("BVSRegistration.SignIn") oBankReg.GetBankId(bankid) Code in C# COM object: using System; using System.Web; using System.Text; using System.EnterpriseServices; using System.Collections.Generic; using System.Runtime.InteropServices; [assembly: ApplicationName("BVSRegistration")] [assembly: Description("COM+ upgrade of the BVSRegistration VB6 SignIn.cls.")] [assembly: ApplicationActivation(ActivationOption.Server)] [assembly: ApplicationAccessControl(false, AccessChecksLevel = AccessChecksLevelOption.ApplicationComponent)] namespace BVSRegistration { public class SignIn : ServicedComponent { public void GetBankId(string bankid) { HttpContext.Current.Response.Redirect("http://www.google.com"); } } } Any ideas? Thanks

    Read the article

  • php POST response

    - by amit
    I am making a POST to another php file that I want to render in the browser. so clearly, using jquery POST wont work, since it works through AJAX. echo '<div class="showcase_URL"><a class="purl" name="'.$row->num.'" href="#">PROJECT URL</a></div>'; what I have till now in javascript is: $(".showcase_URL a").click(function() { //alert($(this).attr("name")); var number = $(this).attr("name"); $.post( "app-display.php", {app: number}, function(data){ top.location.href = 'app-display.php'; }); }); what I have in app-display.php: $query = 'SELECT num, title, thumb_url, url, type, cat, dated, details FROM app WHERE `num` = "$_POST[app]"'; but it is currently giving me a page without the contents of app-display.php. all the other fragments of the page are loading: header, footer etc. the PHP Response (in Firebug) I am getting is the normal html of the page. how should i do it?

    Read the article

  • (HARD)Remove accents from a JSON response using the raw content

    - by Pentium10
    This is a follow up of this question: Remove accents from a JSON response. The accepted answer there works for a single item/string of a raw JSON content. But I would like to run a full transformation over the entire raw content of the JSON without parsing each object/array/item. What I've tried is this function removeAccents($jsoncontent) { $obj=json_decode($jsoncontent); // use decode to transform the unicode chars to utf $content=serialize($obj); // serialize into string, so the whole obj structure can be used string as a whole $a = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿRr'; $b = 'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr'; $content=utf8_decode($content); $jsoncontent = strtr($content, $a, $b); // at this point the accents are removed, and everything is good echo $jsoncontent; $obj=unserialize($jsoncontent); // this unserialization is returning false, probably because we messed up with the serialized string return json_encode($obj); } As you see after I decoded JSON content, I serialized the object to have a string of it, than I remove the accents from that string, but this way I have problem building back the object, as the unserialize stuff returns false. How can I fix this?

    Read the article

  • Hibernate JDBCConnectionException: Communications link failure and java.io.EOFException: Can not read response from server

    - by Marc
    I get a quite well-known using MySql jdbc driver : JDBCConnectionException: Communications link failure, java.io.EOFException: Can not read response from server. This is caused by the wait_timeout parameter in my.cnf. So I decided to use c3p0 pool connection along with Hibernate. Here is what I added to hibernate.cfg.xml : <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> <property name="c3p0.min_size">10</property> <property name="c3p0.max_size">100</property> <property name="c3p0.timeout">1000</property> <property name="c3p0.preferredTestQuery">SELECT 1</property> <property name="c3p0.acquire_increment">1</property> <property name="c3p0.idle_test_period">2</property> <property name="c3p0.max_statements">50</property> idle_test_period is volontarily low for test purposes. Looking at the mysql logs I can see the "SELECT 1" request which is regularly sent to the mysql server so it works. Unfortunately I still get this EOF exception within my app if I wait longer than 'wait_timout' seconds (set to 10 for test purposes). I'm using Hibernate 4.1.1 and mysql-jdbc-connector 5.1.18. So what am I doing wrong? Thanks, Marc.

    Read the article

  • jQuery .html not writing span on page load, rights the span on ajax response

    - by pedalpete
    I've got a bit of a calendar I'm building with events that go beyond the boundary of one day. I've got a graph which shows how many events are running concurrently. In order to graph out the events which go into another day, I look for hours24, and run an extra bit of code. jQuery('li#hour'+placeGroup+'_'+schedDay2+'_'+thisHour,nextDay).data('count', numStaff).html(''+printHour+''+numEvents+' scheduled').css('height',numEvents*5+'px'); The code is working, the li items are being found, proper height is the css is being applied, data is set, which I've checked by running alert(jQuery('li#hour'+placeGroup+'_'+schedDay2+'_'+thisHour,nextDay).data('count')); right after the pervious bit of code. The only thing that isn't being done is the .html(add span) stuff. I run this code in two places. Once when the page loads, and once when an action is taken which changes the number of events via an ajax response. The li DOM object I'm writting to is created before the script is run, and the height is being applied, but not the span, and only on page load. Any ideas on this one? I'm stumped.

    Read the article

  • How to write a file that called from a database on a page?

    - by Mehmet Kaleli
    Hi. I have a "news" page that belongs to a company. All news have a header, detail and html page and they come from database. So i have to print those html pages in a repeater on my "news.aspx". But i couldnt write dynamically. How can i do it or is there anyway else? <asp:Repeater ID="news" runat="server" OnItemDataBound="news_OnItemDataBound"> <ItemTemplate> <asp:HiddenField ID="newsid" runat="server" Value='<%#DataBinder.Eval(Container.DataItem,"newsid") %>' /> <tr> <td class="haberler-sayfasi-habermetni" style="width:580px;padding-bottom:30px;"> <h1 class="haberler-sayfasi-haberbasligi" style="background-image:url(images/haber-ikon.jpg); background-repeat:no-repeat;padding-left:25px;"> <%#DataBinder.Eval(Container.DataItem,"newsheader") %>/h1> <br /> <%#DataBinder.Eval(Container.DataItem,"newsspot") %> <br /><br /> <% **Response.WriteFile('dynamical filename with path');** %> </td> </tr> </ItemTemplate> </asp:Repeater>

    Read the article

  • Opening a xul file in response to a toolbar extension button click

    - by Graham
    I'm currently building my first Firefox extension, and am having a little difficulty with one piece of functionality. I'd like to open a new browser tab in response to a button click on the toolbar. The new tab should contain the contents of a webpage, together with some extra buttons. At the moment I've created a separate xul file for the contents of the new tab: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="myapp-report-window" title="Example 4.5.1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/x-javascript" src="chrome://myapp/content/main.js" /> <toolbox> <toolbar id="nav-toolbar"> <toolbarbutton label="This-is-going-to-do-some-stuff"/> </toolbar> </toolbox> <iframe id="myapp-report-frame" flex="1"/> <script type="text/javascript"> function loadPage(url){ document.getElementById('myapp-report-frame').setAttribute('src',url); } </script> </window> This xul file is launched via this javascript, referenced from the main myapptoolbar.xul: gBrowser.selectedTab = gBrowser.addTab('chrome://myapp/content/report.xul'); var newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab); newTabBrowser.addEventListener("load", function(){ loadPage('http://www.somedynamicallysetwebsite.com'); }, true); The problem that I'm having is that the loadPage function is not being found, so the src attribute of the iframe is never set. I'm sure it's some silly scoping problem, but I'm very new to firefox extensions (day 2!) so any help would be much appreciated. Thanks for looking! Graham

    Read the article

  • Is it possible to redirect non-HTML files with HTTP? And chaining redirects?

    - by Earlz
    Hello, I have been thinking about a neat way of load balancing and one thing that would be required is to be capable of loading an image on an HTML page from multiple locations without rewriting the URL(on each load) So what I need to be able to do is have one URL which is the "static" URL. Such as http://example.com/myimage.png The image is not actually contained in example.com though. So example.com does a either a 302 or 301 or 307 HTTP response to cause a redirect to 2.example.com. How do browsers handle this with images like in this situation? Also, how do browsers handle multiple redirections for instance if 2.example.com also didn't contain it and it went to 3.example.com ? (Note, I am asking this because I've never seen a 301 redirect on anything but an HTML page) Also, which status code would be best to use. 301 means "moved permanently" which this "move" isn't permanent so I don't want it cached. Should I use 307? Is that supported by search engines and modern browsers?

    Read the article

  • Intermittent bug - IE6 showing file as text in browser, rather than as file download

    - by Richard Ev
    In an ASP.NET WebForms 2.0 site we are encountering an intermittent bug in IE6 whereby a file download attempt results in the contents of the being shown directly in the browser as text, rather than the file save dialog being displayed. Our application allows the user to download both PDF and CSV files. The code we're using is: HttpResponse response = HttpContext.Current.Response; response.Clear(); response.AddHeader("Content-Disposition", "attachment;filename=\"theFilename.pdf\""); response.ContentType = "application/pdf"; response.BinaryWrite(MethodThatReturnsFileContents()); response.End(); This is called from the code-behind click event handler of a button server control. Where are we going wrong with this approach? Edit Following James' answer to this posting, the code I'm using now looks like this: HttpResponse response = HttpContext.Current.Response; response.ClearHeaders(); // Setting cache to NoCache was recommended, but doing so results in a security // warning in IE6 //response.Cache.SetCacheability(HttpCacheability.NoCache); response.AppendHeader("Content-Disposition", "attachment; filename=\"theFilename.pdf\""); response.ContentType = "application/pdf"; response.BinaryWrite(MethodThatReturnsFileContents()); response.Flush(); response.End(); However, I don't believe that any of the changes made will fix the issue.

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >