Search Results

Search found 106 results on 5 pages for 'chandan'.

Page 5/5 | < Previous Page | 1 2 3 4 5 

  • How to get colliding effect or bouncy when ball hits the track.

    - by Chandan Shetty SP
    I am using below formula to move the ball circular, where accelX and accelY are the values from accelerometer, it is working fine. But the problem in this code is mRadius (I fixed its value to 50), i need to change mRadius according to accelerometer values and also i need bouncing effect when it touches the track. Currently i am developing code by assuming only one ball is on the board. float degrees = -atan2(accelX, accelY) * 180 / 3.14159; int x = cCentrePoint.x + mRadius * cos(degreesToRadians(degrees)); int y = cCentrePoint.y + mRadius * sin(degreesToRadians(degrees)); Here is the snap of the game i want to develop: Updated: I am sending the updated code... mRadius = 5; mRange = NSMakeRange(0,60); -(void) updateBall: (UIAccelerationValue) accelX withY:(UIAccelerationValue)accelY { float degrees = -atan2(accelX, accelY) * 180 / 3.14159; int x = cCentrePoint.x + mRadius * cos(degreesToRadians(degrees)); int y = cCentrePoint.y + mRadius * sin(degreesToRadians(degrees)); //self.targetRect is rect of ball Object self.targetRect = CGRectMake(newX, newY, 8, 9); self.currentRect = self.targetRect; //http://books.google.co.in/books?id=WV9glgdrrrUC&pg=PA455#v=onepage&q=&f=false static NSDate *lastDrawTime; if(lastDrawTime!=nil) { NSTimeInterval secondsSinceLastDraw = -([lastDrawTime timeIntervalSinceNow]); ballXVelocity = ballXVelocity + (accelX * secondsSinceLastDraw) * [self isTouchedTrack:mRadius andRange:mRange]; ballYVelocity = ballYVelocity + -(accelY * secondsSinceLastDraw) * [self isTouchedTrack:mRadius andRange:mRange]; distXTravelled = distXTravelled + secondsSinceLastDraw * ballXVelocity * 50; distYTravelled = distYTravelled + secondsSinceLastDraw * ballYVelocity * 50; CGRect temp = self.targetRect; temp.origin.x += distXTravelled; temp.origin.y += distYTravelled; int radius = (temp.origin.x - cCentrePoint.x) / cos(degreesToRadians(degrees)); if( !NSLocationInRange(abs(radius),mRange)) { //Colided with the tracks...Need a better logic here ballXVelocity = -ballXVelocity; } else { // Need a better logic here self.targetRect = temp; } //NSLog(@"angle = %f",degrees); } [lastDrawTime release]; lastDrawTime = [ [NSDate alloc] init]; } In the above code i have initialized mRadius and mRange(indicate track) to some constant for testing, i am not getting the moving of the ball as i expected( bouncing effect when Collided with track ) with respect to accelerometer. Help me to recognize where i went wrong or send some code snippets or links which does the similar job. I am searching for better logic than my code, if you found share with me.

    Read the article

  • Weird behavior in referring to global variable. Is this a bug in javascript? Surely it isn't!

    - by Chandan .
    Consider the following piece of code. <html> <body> <script> var x = 5; //globally declared function showX() { alert("x="+x); //trying to display global value var x=10; //trying to create and initialize a local x } </script> <input type = "button" value="Show X" onclick="showX()"> </body> </html> The alert statement shows 'x=undefined'. And doesn't print the global value of x as expected. An equivalent java code would display 5! So, is it a bug? If not then how does one explain that behavior?

    Read the article

  • Custom authentication module inheriting IHttpModule issue.

    - by Chandan Khatwani
    LoginPage.aspx:- protected void Button1_Click(object sender, EventArgs e) { Context.Items["Username"] = txtUserId.Text; Context.Items["Password"] = txtPassword.Text; // FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, Context.Items["Username"].ToString(), DateTime.Now, DateTime.Now.AddMinutes(10), true, "users", FormsAuthentication.FormsCookiePath); // Encrypt the cookie using the machine key for secure transport string hash = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie( FormsAuthentication.FormsCookieName, // Name of auth cookie hash); // Hashed ticket // Set the cookie's expiration time to the tickets expiration time if (ticket.IsPersistent) cookie.Expires = ticket.Expiration; Response.Cookies.Add(cookie); Response.Redirect("Default.aspx"); } Global.asax file:- void Application_AuthenticateRequest(object sender, EventArgs e) { if (HttpContext.Current.User != null) { if (HttpContext.Current.User.Identity.IsAuthenticated) { if (HttpContext.Current.User.Identity is FormsIdentity) { FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity; FormsAuthenticationTicket ticket = id.Ticket; // Get the stored user-data, in this case, our roles string userData = ticket.UserData; string[] roles = userData.Split(','); HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(id, roles); Response.Write(HttpContext.Current.User.Identity.Name); Response.Redirect("Default.aspx"); } } } } I get the following error after signing in This webpage has a redirect loop. The webpage at http://localhost:1067/Default.aspx has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

    Read the article

  • stream output of a command continuously run in php

    - by chandan kharbanda
    i am running this simple command { ./a.out < in; } & output.txt using exec and i want to output what's coming in output.txt through ajax request continuously. Also i want a way to turn off my output buffering.I tried flush() and ob functions but didn't succedded.In my /etc/php5/apache2/php.ini php.ini value of output_buffering = 4096.When I change it to Off and restart my apache2 server it fails to restart.P.S. I am using lamp server.

    Read the article

  • Oracle Fusion Middleware (OFM) 11g (11.1.1.7) Starter Kit available & Customizable Demos

    - by JuergenKress
    OFM PS6 starter kit is now available from Global Sales Engineering (GSE, formerly DSS).  OFM Starter Kit provides a basic foundation to design and develop middleware demos. It is based on plug and play architecture and designed to use optimal hardware resources.  The starter kit is easily extendable to incorporate more Oracle Fusion Middleware components. New Features Built on the "Build your own demos (POC)" concept Starter Kit comes with core OFM Components Oracle Unified Directory (OUD, SOA, WebCenter Content and WebCenter Spaces) Starter Kit is available over the Internet and is tuned for optimal performance Portable/Downloadable version of the Starter Kit will be available soon. Please check Demos Corner. For and questions/feedback please contact chandan Das or Anand Prasad. Call to Action Review the Release Notes. & Visit the GSE Website and book the “OFM 11.1.1.7.0 Base Platform” customizable instance. Further information about this platform is available on this page. This announcement will appear in the archive as number 412. Customizable Demos We are happy to announce the availability of the SOA 11.1.1.7.0 Platform.  SOA 11g (11.1.1.7) Platform is fully featured, built on Plug and Play architecture, and designed to develop best of breed SOA demos. New Features Built on the "Build your own demos" concept Fusion Middleware products SOA, BAM, OSB, OEP, OER, OSR, WebCenter Content and WebCenter Spaces are installed, configured, and tuned for better performance Demo instances are available over the Internet Portable version of the platform will be available soon. Please check Demos Corner For questions/feedback please contact Anvesh Baluguri or Anand Prasad. Call to Action Review the Release Notes & Visit the GSE Website and book the “SOA 11.1.1.7.0 Platform” customizable demo. Further information about this platform is available on this page.  This announcement will appear in the archive as number 413. To get access to the demo environment please contact OPN! Support If you need assistance or encounter any issues please submit a GSE Repository ticket or call the GSE Support Hotline for assistance. The GSE Support Hotline is available 24 hours a day, Monday through Friday, at: US/CAN: +1.650.506.8763 & EMEA: +44 118 9240808 & APAC: +65.6436.2150 & LAD: +1.650.506.8763 & Japan: +81-3-6834-6097. SOA & BPM Partner Community For regular information on Oracle SOA Suite become a member in the SOA & BPM Partner Community for registration please visit www.oracle.com/goto/emea/soa (OPN account required) If you need support with your account please contact the Oracle Partner Business Center. Blog Twitter LinkedIn Facebook Wiki Mix Forum Technorati Tags: OFM,demos,sales,marketing,dss,SOA Community,Oracle SOA,Oracle BPM,Community,OPN,Jürgen Kress

    Read the article

< Previous Page | 1 2 3 4 5