Search Results

Search found 21001 results on 841 pages for 'spelling check'.

Page 135/841 | < Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >

  • Best practices for handling unique constraint violation

    - by umesh awasthi
    Hi All, While working in my application i came across a situation in which there are likely chances to Unque Constraints Violation.I have following options Catch the exception and throw it back to UI At UI check for the exception and show approrpriate Error Message This is something different idea is to Check in advance about the existance of the given Unique value before starting the whole operation. My Question is what might be the best practice to handle such situation.Currently we are using combo of Struts2+Spring 3.x+Hibernate 3.x Thanks in advance

    Read the article

  • Length of current selection in Eclipse

    - by Grzegorz Oledzki
    Do you know any easy way to know what is the length of current selection in Eclipse? I.e. I select a line fragment and would like to know how many characters are there? Usually I count them manually, but that's stupid. When being desperate I move to the start, check the column number, move to the end, check the column number, subtract, think a minute if I should add 1 or not... and my selection is lost.

    Read the article

  • CSRF protecting and cross site form access

    - by fl00r
    Hi. I aw working on cross site authentication (some domains have got common authentication). So I want to send authentication data (login, password) to main domain from others. How should I use protect_from_forgery and how can I check if data received from valid domain? What I am thinking now is to turn off protect_from_forgery for session controller and check domain name of received data. But maybe I can configure CSRF protection for not only one domain?

    Read the article

  • Problem with Closure properties of context free languages

    - by altius
    hello i have the following sentence a language L1={a^n * b^n : n=0} and L2={b^n * a^n : n=0} are context free languages so they are close a=under the L1L2 so L={a^n * b^2n A^n : n=0} must be context free too because it is generated by a close property I have to prove if this sentence is true or not so i check the L language and i do not think that it is context free then i also saw that L2 is L1 reversed do i have to check if L1, L2 are deterministic ? please help because i am in a dead end

    Read the article

  • Collision problems with drag-n-drop puzzle game.

    - by Amplify91
    I am working on an Android game similar to the Rush Hour/Traffic Jam/Blocked puzzle games. The board is a square containing rectangular pieces. Long pieces may only move horizontally, and tall pieces may only move vertically. The object is to free the red piece and move it out of the board. This game is only my second ever programming project in any language, so any tips or best practices would be appreciated along with your answer. I have a class for the game pieces called Pieces that describes how they are sized and drawn to the screen, gives them drag-and-drop functionality, and detects and handles collisions. I then have an activity class called GameView which creates my layout and creates Pieces objects to add to a RelativeLayout called Board. I have considered making Board its own class, but haven't needed to yet. Here's what my work in progress looks like: My Question: Most of this works perfectly fine except for my collision handling. It seems to be detecting collisions well but instead of pushing the pieces outside of each other when there is a collision, it frantically snaps back and forth between (what seems to be) where the piece is being dragged to and where it should be. It looks something like this: Another oddity: when the dragged piece collides with a piece to its left, the collision handling seems to work perfectly. Only piece above, below, and to the right cause problems. Here's the collision code: @Override public boolean onTouchEvent(MotionEvent event){ float eventX = event.getX(); float eventY = event.getY(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: //check if touch is on piece if (eventX > x && eventX < (x+width) && eventY > y && eventY < (y+height)){ initialX=x; initialY=y; break; }else{ return false; } case MotionEvent.ACTION_MOVE: //determine if piece should move horizontally or vertically if(width>height){ for (Pieces piece : aPieces) { //if object equals itself in array, skip to next object if(piece==this){ continue; } //if next to another piece, //do not allow to move any further towards said piece if(eventX<x&&(x==piece.right+1)){ return false; }else if(eventX>x&&(x==piece.x-width-1)){ return false; } //move normally if no collision //if collision, do not allow to move through other piece if(collides(this,piece)==false){ x = (eventX-(width/2)); }else if(collidesLeft(this,piece)){ x = piece.right+1; break; }else if(collidesRight(this,piece)){ x = piece.x-width-1; break; } } break; }else if(height>width){ for (Pieces piece : aPieces) { if(piece==this){ continue; }else if(collides(this,piece)==false){ y = (eventY-(height/2)); }else if(collidesUp(this,piece)){ y = piece.bottom+1; break; }else if(collidesDown(this,piece)){ y = piece.y-height-1; break; } } } invalidate(); break; case MotionEvent.ACTION_UP: // end move if(this.moves()){ GameView.counter++; } initialX=x; initialY=y; break; } // parse puzzle invalidate(); return true; } This takes place during onDraw: width = sizedBitmap.getWidth(); height = sizedBitmap.getHeight(); right = x+width; bottom = y+height; My collision-test methods look like this with different math for each: private boolean collidesDown(Pieces piece1, Pieces piece2){ float x1 = piece1.x; float y1 = piece1.y; float r1 = piece1.right; float b1 = piece1.bottom; float x2 = piece2.x; float y2 = piece2.y; float r2 = piece2.right; float b2 = piece2.bottom; if((y1<y2)&&(y1<b2)&&(b1>=y2)&&(b1<b2)&&((x1>=x2&&x1<=r2)||(r1>=x2&&x1<=r2))){ return true; }else{ return false; } } private boolean collides(Pieces piece1, Pieces piece2){ if(collidesLeft(piece1,piece2)){ return true; }else if(collidesRight(piece1,piece2)){ return true; }else if(collidesUp(piece1,piece2)){ return true; }else if(collidesDown(piece1,piece2)){ return true; }else{ return false; } } As a second question, should my x,y,right,bottom,width,height variables be ints instead of floats like they are now? Also, any suggestions on how to implement things better would be greatly appreciated, even if not relevant to the question! Thanks in advance for the help and for sitting through such a long question! Update: I have gotten it working almost perfectly with the following code (this doesn't include the code for vertical pieces): @Override public boolean onTouchEvent(MotionEvent event){ float eventX = event.getX(); float eventY = event.getY(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: //check if touch is on piece if (eventX > x && eventX < (x+width) && eventY > y && eventY < (y+height)){ initialX=x; initialY=y; break; }else{ return false; } case MotionEvent.ACTION_MOVE: //determine if piece should move horizontally or vertically if(width>height){ for (Pieces piece : aPieces) { //if object equals itself in array, skip to next object if(piece==this){ continue; } //check if there the possibility for a horizontal collision if(this.isAllignedHorizontallyWith(piece)){ //check for and handle collisions while moving left if(this.isRightOf(piece)){ if(eventX>piece.right+(width/2)){ x = (int)(eventX-(width/2)); //move normally }else{ x = piece.right+1; } } //check for and handle collisions while moving right if(this.isLeftOf(piece)){ if(eventX<piece.x-(width/2)){ x = (int)(eventX-(width/2)); }else{ x = piece.x-width-1; } } break; }else{ x = (int)(eventX-(width/2)); } The only problem with this code is that it only detects collisions between the moving piece and one other (with preference to one on the left). If there is a piece to collide with on the left and another on the right, it will only detect collisions with the one on the left. I think this is because once it finds a possible collision, it handles it without finishing looping through the array holding all the pieces. How do I get it to check for multiple possible collisions at the same time?

    Read the article

  • I need to encrypt the names of my http form elements

    - by William Calleja
    I have a form with certain elements, input boxes, check boxes etc. I need to encrypt the names of these input boxes and check boxes. I'm currently using a Rijndael encryption/decryption method through c# however this is making the encrypted names too long to be passed in a post. Is there a better way to get decent encrypted names? my purpose is to have the names encrypted before the post happens so if someone views the code behind the names are already encrypted.

    Read the article

  • validate linqtosql mapping to a model

    - by Coppermill
    I have generated a LinqtoSQL mapping xml file, which I have a valid XSD schema that I check to make sure the XML is correct. Now I want to check that the field type match the Model/Interface for example: checking that the nullable fields are nullable that int are int etc anyone got any ideas if I can do this?

    Read the article

  • Host of Referer

    - by Fincha
    How to find out the Referers host? My Problem is, i wont to check, is user from google adwords or organic search... so i checking refferer, but the refferer ist allways google organix search... if some one have a be´tter idea :) tell it. But I found out, that the HOst is a speacial one! So now I wont to check for Host of the Refferes site. Is tehre a way?

    Read the article

  • How to get configuration for WCF Service

    - by klashar
    I want to check whether the endpoint is defined in the configuration before I'll try to create it System.ServiceModel.ClientBase<T> sourceClient = new System.ServiceModel.ClientBase<T>(EndpointName, new EndpointAddress(discoveryUri)); To check it I need get a configuration but how can I define whether I need to use WebConfigurationManager or ConfigurationManager. Is there any way to define where a WCF service is hosted?

    Read the article

  • How to update Xcode to install "UNIX Development Support"

    - by Oscar Reyes
    I installed Xcode a long time ago. Apparently I didn't check back then the "UNIX Developemtn Support" checkbox. Now I want to have them bu when I click on the installation this is what appears: The UNIX Development Support check box is disabled Q. ¿How can I install the UNIX Development Support? Is there a way to run some script that creates all the needed links from /Developer/ to /usr/bin ? Thanks in advance.

    Read the article

  • Checking for duplicates in a vector

    - by xbonez
    I have to check a vector for duplicates. What is the best way to approach this: I take the first element, compare it against all other elements in the vector. Then take the next element and do the same and so on. Is this the best way to do it, or is there a more efficient way to check for dups?

    Read the article

  • C#: returns array from object.

    - by jitm
    Hello, There is the next task: I need to check if input parameter (object) is array, then return array of input elements. For example I have input array like this: int [] array = {1,2,3,4}; And method private object[] GetArray(object @from) { } So, I need to check in this method that input variable is array and after return this array. For checking I use if(@from.GetType().IsArray) And how to create array from object ??? Is it possible ? Thanks.

    Read the article

  • Dojo Widget need event when everything is "ready"

    - by ArneRie
    Hi, i have an custom widget in dojo. My Problem is to check some kind of access rules wich are passed to the widget. if check the rules after the widget is fully loaded everything works fine. But i have to remove some text and buttons before it is displayed. I've tryted the startup, and postcreate hook (-: is there something like "aftercreate" ?

    Read the article

  • Alternatives to checking against the system time

    - by vikp
    Hi, I have an application which license should expire after some period of time. I can check the time in the applicatino against the system time, but system time can be changed by the administrator, therefore it's not a good idea to check against the system time in my opinion. What alternatives do I have? Thank you

    Read the article

  • How can I use wildcard urls with Code Igniter?

    - by tarnfeld
    I am building a system that has urls like app.com/login and app.com/dothing but it will also have app.com/xOldP. The web application is build using the latest version of Code Igniter and I was wondering if there was a way to add a check in, that if the url is a controller then do that and finish, but if not, do something else (which will check the url and if its not real 404, which I can do). I was wondering how annoying this would be :/ Some sample code or links would be great!

    Read the article

< Previous Page | 131 132 133 134 135 136 137 138 139 140 141 142  | Next Page >