Search Results

Search found 1302 results on 53 pages for 'async'.

Page 39/53 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • ajaxStart() showing loading message doesn't seem to work....

    - by Pandiya Chendur
    I user jquery.ajax call to controller of asp.net mvc... I would like to show a loading indicator.. I tried this but that doesn't seem to work... <div class="loading" style="padding-left:5px; margin-bottom:5px;display:none;"> Loading...&nbsp </div> and my jquery ajax call looks like this, function getMaterials(currentPage) { $.ajax({ url: "Materials/GetMaterials", data: {'currentPage': (currentPage + 1) ,'pageSize':5}, contentType: "application/json; charset=utf-8", global: false, async: false, dataType: "json", success: function(data) { var divs = ''; $("#ResultsDiv").empty(); $.each(data.Results, function() { //my logic here.... $(".loading").bind("ajaxStart", function() { $(this).show(); }).bind("ajaxStop", function() { $(this).hide(); }); } }); return false; } My loading indicator doen't seem to showup.. ANy suggestion....

    Read the article

  • 500 internal server error at form connection

    - by klox
    hi..all..i've a problem i can't connect to database what's wrong with my code?this is my code: $("#mod").change(function() { var barcode; barCode=$("#mod").val(); var data=barCode.split(" "); $("#mod").val(data[0]); $("#seri").val(data[1]); var str=data[0]; var matches=str.match(/(EE|[EJU]).*(D)/i); $.ajax({ type:"post", url:"process1.php", data:"value="+matches+"action=tunermatches", cache:false, async:false, success: function(res){ $('#rslt').replaceWith( "<div id='value'><h6>Tuner range is" + res + " .</h6></div>" ); } }); }); and this is my process file: switch(postVar('action')) { case 'tunermatches' : tunermatches(postVar('tuner')); break; function tunermatches($tuner)){ $Tuner=mysql_real_escape_string($tuner); $sql= "SELECT remark FROM settingdata WHERE itemname="Tuner_range" AND itemdata="$Tunermatches"; $res=mysql_query($sql); $dat=mysql_fetch_array($res,MYSQL_NUM); if($dat[0]>0) { echo $dat[0]; } mysql_close($dbc); }

    Read the article

  • Multiple Facebook scripts?

    - by J Set
    This may be kind of a dumb question, but the script for the facebook button on the like button page is different from the script on the javascript sdk page, but similar. Did facebook just forget to update the documentation or do I need both scripts? The like button page gives: <div id="fb-root"></div> <script> (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> But on the javascript sdk page: <div id="fb-root"></div> <script> window.fbAsyncInit = function() { FB.init({ appId : 'YOUR_APP_ID', // App ID channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); // Additional initialization code here }; // Load the SDK Asynchronously (function(d){ var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); }(document)); </script>

    Read the article

  • how to return an error in an Ajax scenario from ASP.NET MVC action

    - by mohang
    I am using ASP.NET MVC with jquery. I have the following MVC Action that returns a partial page on Success. On Application Error, I am not sure what to send it for correctly handling it at the client side. public ActionResult LoadFilterSet(int filterSetId) { try { BreadCrumbManager bcManager = this.ResetBreadCrumbManager(this.BreadCrumbManagerID); GeneralHelper.LoadBreadCrumbManager(bcManager, filterSetId); ViewData["BreadCrumbManager"] = bcManager; return View("LoadFilterSet"); } catch (Exception ex) { return Content(""); } } Following is my jquery ajax call. Notice that I am checking for the data length to make sure there are no errors. Please suggest me a better way of doing this. $.ajax({ type: "GET", dataType: "html", async: true, data: ({ filterSetId: selectedId }), url: link, contentType: "text/html; charset=utf-8", success: function(data, textStatus) { if (data.length > 0) { // Clear the local filters first. clearLocalFilters(); $('td.selected-filters table.filters-display').append(data); } } });

    Read the article

  • How do I update the UI during an event using ASP.NET?

    - by Phil Hale
    I'm a bit stuck with a problem. I feel like the solution should be fairly straight forward but I'm completely out of ideas for some reason. Here's the problem. I've got a user control with a couple of buttons. Think of them as 'On' and 'Off'. When either button is clicked an async method is called. If the method is successful an event is fired. Within the event I want to update the enabled property of the two buttons so that only a single button is clickable at any one time. The problem is that any changes I make to the properties are not shown on screen because the postback is already complete. I tried wrapping the buttons in an UpdatePanel but I get an "Update method can only be called on UpdatePanel with ID 'xxxx' before Render' error. I understand why the problem occurs but I can't think of a solution. Help! Ideally what I'd like to do is simply call a method within the event that will update the UI, but I don't know if that's possible.

    Read the article

  • Initializing Disqus comments in hidden element causes issue in FF 14.0.1

    - by Bazze
    This issue appears only in Firefox 14.0.1 (well I couldn't reproduce it in any other browser). If you put the code for Disqus comments inside an element that is hidden and wait until everything is fully loaded and then display the element using JavaScript, the comment box nor comments will show up. However if you resize the window, it'll show up immediately. It's working fine in latest version of Google Chrome and Safari though. What's causing this and how to fix it? Sample code to reproduce: <div id="test" style="display:none;"> <div id="disqus_thread"></div> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = 'onlinefunctions'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> </div> <a href="#" onclick="document.getElementById('test').style.display = 'block'">show</a> I could post a link to a live example but I'm not sure about the policy of posting links here on Stack Overflow.

    Read the article

  • Issue scrolling table view with content inset

    - by Rog
    Hi all, I am experiencing a weird scrolling issue and I was hoping someone could give me a hand in trying to identify why this is happening. I have included the part of my code that I think is relevant to the question but am happy to update this post with whatever else is needed. I have implemented a pull to refresh view in the tableview's content inset area. The refresh fires an Async NSURLConnection that pulls data from a webserver, parses the relevant information and refreshes the table as required. This is where the refresh process kicks off: - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ if (scrollView.contentOffset.y <= - 65.0f && !self.reloading) { self.reloading = YES; [self reloadTableViewDataSource]; [refreshHeaderView setState:EGOOPullRefreshLoading]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.2]; self.tableView.contentInset = UIEdgeInsetsMake(60.0f, 0.0f, 0.0f, 0.0f); [UIView commitAnimations]; } } Problem is if I start to scroll whilst the content inset is "visible" (i.e. during reload) I get this weird behaviour where my table sections do not scroll all the way to the top - see screenshot for a clear visual of what I am trying to describe here. I have included a couple of screenshots below that clearly identify what is happening at the moment. Has anyone experienced this before? Any ideas on what I should be looking at to try and fix it? Many thanks in advance, Rog And this is the result if I start scrolling the table. The orange bit at the top of the image is the actual navigation bar, where I would expect the table section (date 1 December 2010) to be.

    Read the article

  • Why does my jQuery/YQL call not return anything?

    - by tastyapple
    I'm trying to access YQL with jQuery but am not getting a response: http://jsfiddle.net/tastyapple/grMb3/ Anyone know why? $(function(){ $.extend( { _prepareYQLQuery: function (query, params) { $.each( params, function (key) { var name = "#{" + key + "}"; var value = $.trim(this); if (!value.match(/^[0-9]+$/)) { value = '"' + value + '"'; } query = query.replace(name, value); } ); return query; }, yql: function (query) { var $self = this; var successCallback = null; var errorCallback = null; if (typeof arguments[1] == 'object') { query = $self._prepareYQLQuery(query, arguments[1]); successCallback = arguments[2]; errorCallback = arguments[3]; } else if (typeof arguments[1] == 'function') { successCallback = arguments[1]; errorCallback = arguments[2]; } var doAsynchronously = successCallback != null; var yqlJson = { url: "http://query.yahooapis.com/v1/public/yql", dataType: "jsonp", success: successCallback, async: doAsynchronously, data: { q: query, format: "json", env: 'store://datatables.org/alltableswithkeys', callback: "?" } } if (errorCallback) { yqlJson.error = errorCallback; } $.ajax(yqlJson); return $self.toReturn; } } ); $.yql( "SELECT * FROM github.repo WHERE id='#{username}' AND repo='#{repository}'", { username: "jquery", repository: "jquery" }, function (data) { if (data.results.repository["open-issues"].content > 0) { alert("Hey dude, you should check out your new issues!"); } } ); });

    Read the article

  • HTML input not working correctly with AJAX update panels used else where on page

    - by Sean P
    I have some update panels on my page that do some asyncpostbacks to keep some dropdownlists correctly populated. My problem is that on my page i have an HTML input that is handling some file uploads. With the AJAX on the page with asyncpostbacks, and while i step through my code behind, the files arent being uploaded. Using a postbacktrigger (non-async) is not possible because of my layout. Here is my code: <div id="divFileInputs" runat="server"> <input id="file1" name="fileInput" type="file" runat="server" size="50" style="width: 50em" onfocus="AddFileInput()" class="textbox" /></div> <select id="selectFileList" name="ListBox1" size="5" style="width: 50em; text-align: left;" class="textbox" /> <input id="RemoveAttachmentButton" type="button" value="Remove" onclick="RemoveFileInput()" class="removebutton " /> </div> Here is my code behind: Protected Sub CopyAttachments(ByVal issueId As String) Dim files As HttpFileCollection = Request.Files Dim myStream As System.IO.Stream Dim service As New SubmitService.Service For i As Integer = 0 To files.Count - 1 Dim postedFile As HttpPostedFile = files(i) Dim fileNameWithoutPath As String = System.IO.Path.GetFileName(postedFile.FileName) If fileNameWithoutPath.Length > 0 And issueId.Length > 0 Then Dim fileLength As Integer = postedFile.ContentLength Dim fileContents(fileLength) As Byte ' Read the file into the byte array. Send it to the web service. myStream = postedFile.InputStream myStream.Read(fileContents, 0, fileLength) service.ClearQuestAttachToIssue(issueId, fileNameWithoutPath, fileContents) End If Next service = Nothing End Sub When I put a breakpoint in at the declaration of service and then check the value of "files", the count is 0. I am expecting it to be 2 when i have one file uploaded. Anyone know how to fix this?

    Read the article

  • GetIpAddrTable() leaks memory. How to resolve that?

    - by Stabledog
    On my Windows 7 box, this simple program causes the memory use of the application to creep up continuously, with no upper bound. I've stripped out everything non-essential, and it seems clear that the culprit is the Microsoft Iphlpapi function "GetIpAddrTable()". On each call, it leaks some memory. In a loop (e.g. checking for changes to the network interface list), it is unsustainable. There seems to be no async notification API which could do this job, so now I'm faced with possibly having to isolate this logic into a separate process and recycle the process periodically -- an ugly solution. Any ideas? // IphlpLeak.cpp - demonstrates that GetIpAddrTable leaks memory internally: run this and watch // the memory use of the app climb up continuously with no upper bound. #include <stdio.h> #include <windows.h> #include <assert.h> #include <Iphlpapi.h> #pragma comment(lib,"Iphlpapi.lib") void testLeak() { static unsigned char buf[16384]; DWORD dwSize(sizeof(buf)); if (GetIpAddrTable((PMIB_IPADDRTABLE)buf, &dwSize, false) == ERROR_INSUFFICIENT_BUFFER) { assert(0); // we never hit this branch. return; } } int main(int argc, char* argv[]) { for ( int i = 0; true; i++ ) { testLeak(); printf("i=%d\n",i); Sleep(1000); } return 0; }

    Read the article

  • How to get at JSON in grails 2.0

    - by Mikey
    I am sending myself JSON like so with jQuery: $.ajax ({ type: "POST", url: 'http://localhost:8080/myproject/myController/myAction', dataType: 'json', async: false, //json object to sent to the authentication url data: {"stuff":"yes", "listThing":[1,2,3], "listObjects":[{"one":"thing"},{"two":"thing2"}]}, success: function () { alert("Thanks!"); } }) I send this to a controller and do println params And I know I'm already in trouble... [stuff:yes, listObjects[1][two]:thing2, listObjects[0][one]:thing, listThing[]:[1, 2, 3], action:myAction, controller:myController] I cannot figure out how to get at most of these values... I can get "yes" with params.stuff, but I cant do params.listThing.each{} or params.listObjects.each{} What am I doing wrong? UPDATE: I make the controller do this to try the two suggestions so far: println params println params.stuff println params.list('listObjects') println params.listThing def thisWontWork = JSON.parse(params.listThing) render("omg l2json") look how weird the parameters look at the end of the null pointer exception when I try the answers: [stuff:yes, listObjects[1][two]:thing2, listObjects[0][one]:thing, listThing[]:[1, 2, 3], action:l2json, controller:rateAPI] yes [] null | Error 2012-03-25 22:16:13,950 ["http-bio-8080"-exec-7] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [POST] /myproject/myController/myAction - parameters: stuff: yes listObjects[1][two]: thing2 listObjects[0][one]: thing listThing[]: 1 listThing[]: 2 listThing[]: 3 UPDATE 2 I am learning things, but this can't be right: println params['listThing[]'] println params['listObjects[0][one]'] prints [1, 2, 3] thing It seems like this is some part of grails new JSON marshaling. This is somewhat inconvenient for my purposes of hacking around with the values. How would I get all these individual params back into a big groovy object of nested maps and lists? Maybe I am not doing what I want with jQuery?

    Read the article

  • Controller actions appear to be synchronous though on different requests?

    - by Oded
    I am under the impression that the below code should work asynchronously. However, when I am looking at firebug, I see the requests fired asynchronously, but the results coming back synchronously: Controller: [HandleError] public class HomeController : Controller { public ActionResult Status() { return Content(Session["status"].ToString()); } public ActionResult CreateSite() { Session["status"] += "Starting new site creation"; Thread.Sleep(20000); // Simulate long running task Session["status"] += "<br />New site creation complete"; return Content(string.Empty); } } Javascript/jQuery: $(document).ready(function () { $.ajax({ url: '/home/CreateSite', async: true, success: function () { mynamespace.done = true; } }); setTimeout(mynamespace.getStatus, 2000); }); var mynamespace = { counter: 0, done: false, getStatus: function () { $('#console').append('.'); if (mynamespace.counter == 4) { mynamespace.counter = 0; $.ajax({ url: '/home/Status', success: function (data) { $('#console').html(data); } }); } if (!mynamespace.done) { mynamespace.counter++; setTimeout(mynamespace.getStatus, 500); } } } Addtional information: IIS 7.0 Windows 2008 R2 Server Running in a VMWare virutual machine Can anyone explain this? Shouldn't the Status action be returning practically immediately instead of waiting for CreateSite to finish? Edit: How can I get the long running process to kick off and still get status updates?

    Read the article

  • Conversion failed when converting datetime from character string

    - by salvationishere
    I am developing a C# VS 2008 / SQL Server 2005 Express website application. I have tried some of the fixes for this problem but my call stack differs from others. And these fixes did not fix my problem. What steps can I take to troubleshoot this? Here is my error: System.Data.SqlClient.SqlException was caught Message="Conversion failed when converting datetime from character string." Source=".Net SqlClient Data Provider" ErrorCode=-2146232060 LineNumber=10 Number=241 Procedure="AppendDataCT" Server="\\\\.\\pipe\\772EF469-84F1-43\\tsql\\query" State=1 StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at ADONET_namespace.ADONET_methods.AppendDataCT(DataTable dt, Dictionary`2 dic) in c:\Documents and Settings\Admin\My Documents\Visual Studio 2008\WebSites\Jerry\App_Code\ADONET methods.cs:line 102 And here is the related code. When I debugged this code, "dic" only looped through the 3 column names, but did not look into row values which are stored in "dt", the Data Table. public static string AppendDataCT(DataTable dt, Dictionary<string, string> dic) { if (dic.Count != 3) throw new ArgumentOutOfRangeException("dic can only have 3 parameters"); string connString = ConfigurationManager.ConnectionStrings["AW3_string"].ConnectionString; string errorMsg; try { using (SqlConnection conn2 = new SqlConnection(connString)) { using (SqlCommand cmd = conn2.CreateCommand()) { cmd.CommandText = "dbo.AppendDataCT"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn2; foreach (string s in dic.Keys) { SqlParameter p = cmd.Parameters.AddWithValue(s, dic[s]); p.SqlDbType = SqlDbType.VarChar; } conn2.Open(); cmd.ExecuteNonQuery(); conn2.Close(); errorMsg = "The Person.ContactType table was successfully updated!"; } } }

    Read the article

  • How to populate a dropdownlist with json data in jquery?

    - by Pandiya Chendur
    I am developing a country state cascading dropdown list... I returned json result based on countryId but i dont know how to populate/fill it in a new dropdown listbox... Here is what i am using, function getstate(countryId) { $.ajax({ type: "POST", url: "Reg_Form.aspx/Getstates", data: "{'countryId':" + (countryId) + "}", contentType: "application/json; charset=utf-8", global: false, async: false, dataType: "json", success: function(jsonObj) { alert(jsonObj.d); } }); return false; } And alert gave this, {"Table" : [{"stateid" : "2","statename" : "Tamilnadu"}, {"stateid" : "3","statename" : "Karnataka"}, {"stateid" : "4","statename" : "Andaman and Nicobar"}, {"stateid" : "5","statename" : "Andhra Pradesh"}, {"stateid" : "6","statename" : "Arunachal Pradesh"}]} And my aspx page has this is, <td> <asp:DropDownList ID="DLCountry" runat="server" CssClass="dropDownListSkin" onchange="return getstate(this.value);"> </asp:DropDownList> </td> <td> <asp:DropDownList ID="DLState" runat="server" CssClass="dropDownListSkin"> </asp:DropDownList> </td> Any suggestion how to fill it DLState dropdown...

    Read the article

  • ajax call success function never called

    - by Shai
    The following code is a very simple ajax call to server that alerts back on success and complete events. From a reason I cannot understand on my development machine it works fins and alerts on success and complete but on server it never alerts on success. WHY ??? ** <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script> <script type="text/javascript"> function dummy() { $.ajax({ url: 'services/chatEngine.asmx/dummy', async: true, type: "POST", complete: function () { alert('Done'); }, success: function (a, b, c) { alert('Success'); } }); } </script> </head> <body> <form id="form1" runat="server"> <div> <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </ajaxToolkit:ToolkitScriptManager> <div id="userList">Users:<br /></div> <input id="Button3" type="button" value="dummy" onclick="dummy()" /> </div> </form> </body> </html> ** The server side dummy function returns nothing, code follows - Public Function dummy() As String Return "" End Function

    Read the article

  • GWT + Seam, cannot fetch scoped beans from gwt servlet in seam resource servlet.

    - by David Göransson
    Hello all I am trying to get session and conversation scoped beans to a gwt servlet in the seam resource servlet. I have a conversation scoped bean: @Name ("viewFormCopyAction") @Scope (ScopeType.CONVERSATION) public class ViewFormCopyAction {} and a session scoped bean: @Name ("authenticator") @Scope (ScopeType.SESSION) public class AuthenticatorAction {} There is a RemoteService interface: @RemoteServiceRelativePath ("strokesService") public interface StrokesService extends RemoteService { public Position getPosition (int conversationId); } with corresponding async interface: public interface StrokesServiceAsync extends RemoteService { public void getPosition (int conversationId, AsyncCallback callback); } and implementation: @Name ("com.web.actions.forms.gwt.client.StrokesService") @Scope (ScopeType.EVENT) public class StrokesServiceImpl implements StrokesService { @In Manager manager; @Override @WebRemote public Position getPosition (int conversationId) { manager.switchConversation( "" + conversationId ); ViewFormCopyAction vfca = (ViewFormCopyAction) Component.getInstance( "viewFormCopyAction" ); AuthenticatorAction aa = (AuthenticatorAction) Component.getInstance( "authenticator" ); return null; } } The gwt page is within an IFrame in a regular seam page and the conversationId is propagted with the src attribute of the IFrame. Both bean objects end up with only null values. Can anyone see anything wrong with the code? I know that I could use strings instead of the int, but never mind that at this point.

    Read the article

  • Durandal Google Maps not showing properly

    - by user1891037
    Trying to show Google Maps using the Durandal. I'm now simply working with Durandal HTML Starter Kit so the other modules and all engine works properly. The thing is when I added the Google Map it doesn't fit the div size (the big part of div is just grey). As I understand, the problem is causing because Google Maps added before page is completely loaded. But I can't figure out how can I hook on page load event. Here is the module code: define(['knockout', 'gmaps'], function (ko, gmaps) { return { displayName: 'Google Maps', myMap: ko.observable({ lat: ko.observable(32), lng: ko.observable(10)}), activate: function () { console.log('activate'); ko.bindingHandlers.map = { init: function (element, valueAccessor, allBindingsAccessor, viewModel) { console.log('init'); var mapObj = ko.utils.unwrapObservable(valueAccessor()); var latLng = new gmaps.LatLng( ko.utils.unwrapObservable(mapObj.lat), ko.utils.unwrapObservable(mapObj.lng)); var mapOptions = { center: latLng, zoom: 5, mapTypeId: gmaps.MapTypeId.ROADMAP}; mapObj.googleMap = new gmaps.Map(element, mapOptions); } } }, attached: function() { console.log('attached'); }, compositionComplete: function() { console.log('compositionComplete'); } }; }); And a very simple HTML code: <section> <div id="gmap-canvas" data-bind="map:myMap"></div> </section> I'm loading Google Maps with async plug-in in my shell.js. It works fine. Screenshot with trouble here - http://clip2net.com/s/ibswAa P.S. div size is defined in .CSS file. P.S. I tried to use getElementById approach provided here and it's work great if placed in compositionComplete block. But when I tried to move my bindings to this block nothing happens at all. Thanks!

    Read the article

  • inconsistent setTexture behavior in cocos2d on iPhone after using CCAnimate/CCAnimation

    - by chillid
    Hi, I have a character that goes through multiple states. The state changes are reflected by means of a sprite image (texture) change. The state change is triggered by a user tapping on the sprite. This works consistently and quite well. I then added an animation during State0. Now, when the user taps - setTexture gets executed to change the texture to reflect State1, however some of the times (unpredictable) it does not change the texture. The code flows as below: // 1. // Create the animation sequence CGRect frame1Rect = CGRectMake(0,32,32,32); CGRect frame2Rect = CGRectMake(32,32,32,32); CCTexture2D* texWithAnimation = [[CCTextureCache sharedTextureCache] addImage:@"Frames0_1_thinkNthickoutline32x32.png"]; id anim = [[[CCAnimation alloc] initWithName:@"Sports" delay:1/25.0] autorelease]; [anim addFrame:[CCSpriteFrame frameWithTexture:texWithAnimation rect:frame1Rect offset:ccp(0,0)]]; [anim addFrame:[CCSpriteFrame frameWithTexture:texWithAnimation rect:frame2Rect offset:ccp(0,0)]]; // Make the animation sequence repeat forever id myAction = [CCAnimate actionWithAnimation: anim restoreOriginalFrame:NO]; // 2. // Run the animation: sports = [[CCRepeatForever alloc] init]; [sports initWithAction:myAction]; [self.sprite runAction:sports]; // 3. stop action on state change and change texture: NSLog(@"Stopping action"); [sprite stopAction:sports]; NSLog(@"Changing texture for kCJSports"); [self setTexture: [[CCTextureCache sharedTextureCache] addImage:@"SportsOpen.png"]]; [self setTextureRect:CGRectMake(0,0,32,64)]; NSLog(@"Changed texture for kCJSports"); Note that all the NSLog lines get logged - and the texture RECT changes - but the image/texture changes only some of the times - fails for around 10-30% of times. Locking/threading/timing issue somewhere? My app (game) is single threaded and I only use the addImage and not the Async version. Any help much appreciated.

    Read the article

  • Loading GWT Messages from a Database

    - by Lars Tackmann
    In GWT one typically loads i18n strings using a interface like this: public interface StatusMessage extends Messages { String error(String username); : } which then loads the actual strings from a StatusMessage.property file: error=User: {0} does not have access to resource This is a great solution, however my client is unbendable in his demand for putting the i18n strings in a database so they can be changed at runtime (though its not a requirement that they be changed realtime). One solution is to create a async service which takes a message ID and user locale and returns a string. I have implemented this and find it terribly ugly (and it introduces a huge amount of extra communication with the server, plus it makes property placeholder replacement rather complicated). So my question is this, can I in some nice way implement a custom message provider that loads the messages from the backend in one big swoop (for the current user session). If it can also hook into the default GWT message mechanism, then I would be completely happy (i.e. so I can create a interface like above and keep using the the nice {0}, {1}... property replacement format). Other suggestions for clean database driven messages in GWT are also welcome.

    Read the article

  • Trouble accessing data in relationships in Ember

    - by user3618430
    I'm having trouble saving data in this model relationship. My models are as follows: App.Flow = DS.Model.extend({ title: DS.attr('string'), content: DS.attr('string'), isCustom: DS.attr('boolean'), params: DS.hasMany('parameter', {async: true}) }); App.Parameter = DS.Model.extend({ flow: DS.belongsTo('flow'), param: DS.attr('string'), param_tooltip: DS.attr('string'), param_value: DS.attr('string') }); As you can see, I want Flows to have multiple Parameters. I have a rudimentary setup using Flow and Parameter fixtures, which behave as expected in the templates. However, when I try to create new ones in the controller, I have trouble setting the flow and parameter values correctly. var p = this.store.createRecord('parameter', { param: "foo", param_tooltip: "world", param_value: "hello" }); var f = this.store.createRecord('flow', { title: 'job', content: title, isCustom: true, params: [p] // doesn't seem to work }); f.set('params', [p]); // doesn't seem to work p.set('flow', f); // also doesn't seem to work // Save the new model p.save(); f.save(); I've tried a lot of solutions after staring at this and StackOverflow for a while (not just the ones listed). I'm not really sure what to try next. One thing that I noticed in the Ember inspector was that the ids of these created elements were not integers (they were something like the string 'fixture_0'), but I'm not really sure why that would be, whether its related, or how to fix it. Thanks!

    Read the article

  • Xml Conversion "Type mismatch" Error

    - by prema
    I am selecting a query in sql server 2005 SELECT 'Region' AS ELEMENT,(SELECT GeographyName,GeoID from @tmpTable FOR XML RAW, TYPE) FOR XML RAW('Root') This will give the output in xml as <Root ELEMENT="Region"> <row GeographyName="East" GeoID="2" /> <row GeographyName="West" GeoID="3" /> <row GeographyName="North" GeoID="4" /> <row GeographyName="South" GeoID="5" /> </Root> In aspx page, i want to get this function Populatedata(obj, val) { var xmlDom = new JXmlDom(obj, false); --> at this point i am getting error var nodeHeader = xmlDom.selectNodes("//row"); // my code goes here } function JXmlDom (xml,isFile) { this.load=load; this.loadXML=loadXML; this.selectNodes=selectNodes; this.text=text; this.selectSingleNode=selectSingleNode; this.documentElement=documentElement; this.transformNode=transformNode; if (isFile) { this.dom=this.load (xml); }else { this.dom=this.loadXML (xml); } function loadXML (xml) { if (window.ActiveXObject) { var dom=new ActiveXObject("Microsoft.XMLDOm"); dom.async=false; dom.loadXML (xml); } if (document.implementation && document.implementation.createDocument) { var domParser=new DOMParser(); var dom=domParser.parseFromString (xml,"text/xml"); } return dom; } But when i am calling this i am getting an error as Type mismatch.Can anyone help me

    Read the article

  • jquery window.unload triggers post after unload

    - by index
    I am trying to do a post to server before unloading a page and I followed this and it's working fine. My problem is the $.post on window.unload is triggered after it has unloaded. I tried it with a signout link and checking on my logs, I get the following: Started GET "/signout" for 127.0.0.1 at 2012-11-22 00:15:08 +0800 Processing by SessionsController#destroy as HTML Redirected to http://localhost:3000/ Completed 302 Found in 1ms Started GET "/" for 127.0.0.1 at 2012-11-22 00:15:08 +0800 Processing by HomeController#index as HTML Rendered home/index.html.erb within layouts/application (0.4ms) Rendered layouts/_messages.html.erb (0.1ms) Completed 200 OK in 13ms (Views: 12.9ms) Started POST "/unloading" for 127.0.0.1 at 2012-11-22 00:15:08 +0800 Processing by HomeController#unloading as */* Parameters: {"p1"=>"1"} WARNING: Can't verify CSRF token authenticity Completed 500 Internal Server Error in 0ms NoMethodError (undefined method `id' for nil:NilClass): app/controllers/home_controller.rb:43:in `unloading' First part is the signout and then user gets redirected to root then it runs the post ('/unloading'). Is there a way to make the '/unloading' execute first then execute whatever the unload action was? I have this as my jquery post $(window).unload -> $.ajax { async: false, beforeSend: (xhr) -> xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')) , url: '/unloading' , type: 'Post' , data: { p1: '1' } }

    Read the article

  • Combining JavaScript for Google Analytics with yours. (Asynchronous tracking.)

    - by lorenzo 72
    I have a JavaScript file which is loaded up at the end of my HTML page. Rather than adding the script code for asynchronous tracking for Google in yet another script I would rather combine the two scripts together. So instead of this: <html> ... <script src="myScript.js"> <!-- google analytics --> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-X']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); })(); </script> </html> I would have that bit of code in the second script tag at the end of my 'myScript.js'. I have not found one place in google documentation where it suggests to combine the script with yours.

    Read the article

  • Booking logic and architecture, database sync: Hotels, tennis courts reservation system ...

    - by coulix
    Hello Stackers, Imagine that you want to design a tennis booking system. You have 5 tennis clubs as partenrs with no online api allowing you to check on their side if a court is booked or not: You have to build this part as well. Every time a booking is done on their side you want it to be know by our system. Probably using a POST request form tennis partner to our server. Every time a booking is done on our website, we want to push the booking to their system. The difficulty is that their system need to be online and accessible from outside. Ip may change, we have to use a dns updater. In case their system is not available we still accept the booking and fallback to an async email with 'i confirm booking/reject booking' link sent to the club. I find the whole process quite complex and was wondering about the way online hotel booking system and hotel were working. Do they all have their data open and online ? The good thing is that the data will grow large and fits nicely to some no SQL ;) like couch db

    Read the article

  • JQuery to PHP function and back Ajaxed

    - by Xaris
    Hi all, i have a set of php function that i want to call on different events mostly onclick with jquery async (ajax). The first function is called on load $(document).ready(function() { $("#div2").hide('slow'); $("#div1").empty().html('<img src="ajax-loader.gif" />'); $.ajax( { type: "POST", url: "WebFunctions.php", data: {'func':'1'}, success: function(html) { $("#div1").show('slow').html(html) } }); The Data: {'func':'1'} -- is a switch statement on the php side switch($_POST['func']) { case '1': getParents(); break; case '2': getChilds(params); break; case '3': getChildObjects(params); break; default: } "This functions are calls to a soap server" <-- irrelevant. So when that function finishes i get an array which contains IDs and Names. I echo the names but i want the ID for reference so when i click on the echoed name i can call an other php function with parameter the ID of the name... How do i get rid of the switch statement?? How do i call properly php functions and pass params to it??? How can i save this IDs so when i click on an item with that id an other php function is called?? Plz feel free to ask any question, any answer is welcome :)

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >