Search Results

Search found 13324 results on 533 pages for 'stop words'.

Page 6/533 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Automatically triggering standard spaceship controls to stop its motion

    - by Garan
    I have been working on a 2D top-down space strategy/shooting game. Right now it is only in the prototyping stage (I have gotten basic movement) but now I am trying to write a function that will stop the ship based on it's velocity. This is being written in Lua, using the Love2D engine. My code is as follows (note- object.dx is the x-velocity, object.dy is the y-velocity, object.acc is the acceleration, and object.r is the rotation in radians): function stopMoving(object, dt) local targetr = math.atan2(object.dy, object.dx) if targetr == object.r + math.pi then local currentspeed = math.sqrt(object.dx*object.dx+object.dy*object.dy) if currentspeed ~= 0 then object.dx = object.dx + object.acc*dt*math.cos(object.r) object.dy = object.dy + object.acc*dt*math.sin(object.r) end else if (targetr - object.r) >= math.pi then object.r = object.r - object.turnspeed*dt else object.r = object.r + object.turnspeed*dt end end end It is implemented in the update function as: if love.keyboard.isDown("backspace") then stopMoving(player, dt) end The problem is that when I am holding down backspace, it spins the player clockwise (though I am trying to have it go the direction that would be the most efficient at getting to the angle it would have to be) and then it never starts to accelerate the player in the direction opposite to it's velocity. What should I change in this code to get that to work? EDIT : I'm not trying to just stop the player in place, I'm trying to get it to use it's normal commands to neutralize it's existing velocity. I also changed math.atan to math.atan2, apparently it's better. I noticed no difference when running it, though.

    Read the article

  • How to stop reducing life? [closed]

    - by SystemNetworks
    CODE Input input = gc.getInput(); int xpos = Mouse.getX(); int ypos = Mouse.getY(); emu = "Enemy Life : " + enemyLife; Life = "Your Life Is" + life; Mousepos = "X:" + xpos + "Y:" + ypos; //test test1 = "Test INT" + test1int; if(!repeatStop) { //if this button is press, the damage will add up. When //pressed fight, it would start reducing the enemy health. if(input.isKeyPressed(Input.KEY_1)) { test1int += 1; } } if((xpos>1007 &xpos<1297)&&(ypos>881 && ypos<971)) { //Fight button if(Mouse.isButtonDown(0)){ finishTurn=true; } } //fight has started if(finishTurn==true) { //this would reduce the enemy life if(floodControl1==false) { enemyLife-=test1int; } //PROBLEM: Does not stop reducing! //the below code was not successful. It did not stop it // from reducing further. if(test1int>10) { floodControl1=true; } } QUESTION: Ok now, this is what is does. When I press the key, 1, it adds up the damage to the enemy. When I press fight, It will then start to reduce the enemy's health. Now my problem is, it kept on reducing and deducting it until negative! How do I deduct it to my desired damage (My desired damage is the one when press key 1)?

    Read the article

  • OTP or S/KEY - Conversion of Hex string into 6 readable words

    - by Garbit
    As seen in RFC2289 (S/KEY), there is a list of words that must be used when converting the hexadecimal string into a readable format. How would i go about doing so? The RFC mentions: The one-time password is therefore converted to, and accepted as, a sequence of six short (1 to 4 letter) English words. Each word is chosen from a dictionary of 2048 words; at 11 bits per word, all one-time passwords may be encoded. Read more: http://www.faqs.org/rfcs/rfc1760.html#ixzz0fu7QvXfe Does this mean converting a hex into decimal and then using that as an index for an array of words. The other thing it could be is using a text encoding e.g. 1111 might equal dog in UTF-8 encoding thanks in advance for your help!

    Read the article

  • how to insert my own words to JSGF grammar

    - by Pradeep
    how to insert my own words to the JSGF grammar. i have configured the sphinx and its working fine. i have inserted couple of words to the dictionary but i need to add them to the JSGF grammar model too, otherwise its not working (words are not recognising). can someone help me please

    Read the article

  • Code Golf: Phone Number to Words

    - by Nick Hodges
    Guidelines for code-golf on SO We've all seen phone numbers that are put into words: 1-800-BUY-MORE, etc. What is the shortest amount of code you can write that will produce all the possible combinations of words for a 7 digit US phone number. Input will be a seven digit integer (or string, if that is simpler), and assume that the input is properly formed. Output will be a list of seven character strings that For instance, the number 428-5246 would produce GATJAGM GATJAGN GATJAGO GATJAHM GATJAHN GATJAHO and so on..... Winning criteria will be code from any language with the fewest characters that produce every possible letter combination. Additional Notes: To make it more interesting, words can be formed only by using the letters on a North American Classic Key Pad phone with three letters per number as defined here.That means that Z and Q are excluded. For the number '1', put a space. For the number '0', put a hyphen '-' Bonus points awarded for recognizing output as real English words. Okay, not really. ;-)

    Read the article

  • .NET Regular Expression to find actual words in text

    - by Mehdi Anis
    I am using VB .NET to write a program that will get the words from a suplied text file and count how many times each word appears. I am using this regular expression:- parser As New Regex("\w+") It gives me almost 100% correct words. Except when I have words like "Ms Word App file name is word.exe." or "is this a c# statment If(ab?1,0) ?" In such cases I get [word & exe] AND [If, a, b, 1 and 0] as seperate words. it would be nice (for my purpose) that I received word.exe and (If(ab?1,0) as words. I guess \w+ looks for white space, sentence terminating punctuation mark and other punctuation marks to determine a word. I want a similar regular Expression that will not break a word by a punctuation mark, if the punctuation mark is not the end of the word. I think end-of-word can be defined by a trailing WhiteSpace, Sentence terminating Punctuation (you may think of others). if you can suggest some regular expression 9for VB .NET) that will be great help. Thanks.

    Read the article

  • Counting words in a collection using LINQ

    - by icemanind
    Guys, I have a StringCollection object with 5 words in them. 3 of them are duplicate words. I am trying to create a LINQ query that will count how many unique words are in the collection and output them to to the console. So, for example, if my StringCollection has 'House', 'Car,'House','Dog', 'Cat', then it should output like this: House -- 2 Car -- 1 Dog -- 1 Cat -- 1 any ideas on how to create a LINQ query to do this?

    Read the article

  • Regular Expression :match string containing only non repeating words

    - by nash
    I have this situation(Java code): 1) a string such as : "A wild adventure" should match. 2) a string with adjacent repeated words: "A wild wild adventure" shouldn't match. With this regular expression: .* \b(\w+)\b\s*\1\b.* i can match strings containing adjacent repeated words. How to reverse the situation i.e how to match strings which do not contain adjacent repeat words

    Read the article

  • python - remove string from words in an array

    - by tekknolagi
    #!/usr/bin/python #this looks for words in dictionary that begin with 'in' and the suffix is a real word wordlist = [line.strip() for line in open('/usr/share/dict/words')] newlist = [] for word in wordlist: if word.startswith("in"): newlist.append(word) for word in newlist: word = word.split('in') print newlist how would I get the program to remove the string "in" from all the words that it starts with? right now it does not work

    Read the article

  • how to delete lowercase words from a string in python

    - by gaggina
    I'm new in python and I'm having some issues doing a simple thing. I've an array (or list as it's said in pyton) like this: list = [ 'NICE dog' , 'blue FLOWER' , 'GOOD cat' , 'YELLOW caw'] As you see each element of this array contains some words. These words is both lowercase and uppercase. How I can delete from this array each lowercase words? For example I'd like to have as result this list: list = [ 'NICE' , 'FLOWER' , 'GOOD' , 'YELLOW']

    Read the article

  • Count numbers in words.

    - by bachchan
    I need an assembler 8080 software which counts words (delimited by space) which have more than two number in it. Example : this sh0uld b3 l1ke th1s would print : 0 words but Example : this sh0uld b3 l1k3 th1s f000k would print : 2 words <- word l1k3 contain number 1,3 and f000k number 0,0,0 the output should be displayer in hexadecimal format (optional)

    Read the article

  • ruby enclose selected whole words in brackets

    - by astropanic
    @string = "Sometimes some stupid people say some stupid words" @string.enclose_in_brackets("some") # => "Sometimes {some} stupid people say {some} stupid words" How should the method enclose_in_brackets look ? Please keep in mind, I want only enclose whole words, (I don't want "{Some}times {some} stupid....", the "sometimes" word should be left unchanged

    Read the article

  • Underlining 3 words at a time in WPF

    - by user102533
    In WPF, how would I do the following: Every x milliseconds, underline 3 words at a time. After x milliseconds, underline the next 3 words. Every x milliseconds, have 3 words appear and disappear from the window? If I were to use Windows Forms, is there still a way of doing (1) and (2) above? Thank you

    Read the article

  • mine phrases (up to 3 words) from a given text

    - by DS_web_developer
    I asked before for a simple solution to my problem (using sphinx search service) but I got nowhere... someone has kindly provided me with this code <?php /** * $Project: GeoGraph $ * $Id$ * * GeoGraph geographic photo archive project * This file copyright (C) 2005 Barry Hunter ([email protected]) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * Provides the methods for updating the worknet tables * * @package Geograph * @author Barry Hunter <[email protected]> * @version $Revision$ */ function addTwoLetterPhrase($phrase) { global $w2; $w2[$phrase] = (isset($w2[$phrase]))?($w2[$phrase]+1):1; } function addThreeLetterPhrase($phrase) { global $w3; $w3[$phrase] = (isset($w3[$phrase]))?($w3[$phrase]+1):1; } function updateWordnet(&$db,$text,$field,$id) { global $w1,$w2,$w3; $alltext = strtolower(preg_replace('/\W+/',' ',str_replace("'",'',$text))); if (strlen($text)< 1) return; $words = preg_split('/ /',$alltext); $w1 = array(); $w2 = array(); $w3 = array(); //build a list of one word phrases foreach ($words as $word) { $w1[$word] = (isset($w1[$word]))?($w1[$word]+1):1; } //build a list of two word phrases $text = $alltext; $text = preg_replace('/(\w+) (\w+)/e','addTwoLetterPhrase("$1 $2")',$text); $text = $alltext; $text = preg_replace('/(\w+)/','',$text,1); $text = preg_replace('/(\w+) (\w+)/e','addTwoLetterPhrase("$1 $2")',$text); //build a list of three word phrases $text = $alltext; $text = preg_replace('/(\w+) (\w+) (\w+)/e','addThreeLetterPhrase("$1 $2 $3")',$text); $text = $alltext; $text = preg_replace('/(\w+)/','',$text,1); $text = preg_replace('/(\w+) (\w+) (\w+)/e','addThreeLetterPhrase("$1 $2 $3")',$text); $text = $alltext; $text = preg_replace('/(\w+) (\w+)/','',$text,1); $text = preg_replace('/(\w+) (\w+) (\w+)/e','addThreeLetterPhrase("$1 $2 $3")',$text); foreach ($w1 as $word=>$count) { $db->Execute("insert into wordnet1 set gid = $id,words = '$word',$field = $count");// ON DUPLICATE KEY UPDATE $field=$field+$count"); } foreach ($w2 as $word=>$count) { $db->Execute("insert into wordnet2 set gid = $id,words = '$word',$field = $count"); } foreach ($w3 as $word=>$count) { $db->Execute("insert into wordnet3 set gid = $id,words = '$word',$field = $count"); } } ?> It works fine and does almost exactly what I need....... except.... it is not utf8 friendly... I mean... it splits whole words into parts (on special chars) where it shouldn't! so my guess is I should use multibyte functions instead of regular preg_replace... I tried to replace preg_replace with mb_ereg_replace but it is not working as it should... at least not for 2 and 3 words phrases any ideas?

    Read the article

  • Design patterns: when to use and when to stop doing everything using patterns

    - by honeybadger
    This question arises due to comment of FredOverflow in my previous post. Design pattern used in projects I am quite confused by the comment. I know design pattern help in making code reusable and readable (may lack in efficiency a bit). But when to use design patterns and most importantly when to stop doing everything using patterns or carried away by it ? Any comments from you will be helpful. tagging programing languages too to cover broader audience.

    Read the article

  • keeps asking for the CD how do I force it to stop asking for the CD

    - by Ernie
    I have installed 12.04 and am attempting to update the wireless drivers (I have a Dell Insiron 6400), but it keeps asking for an installation CD that I do not have. How do I force it to stop asking for the CD and go to the network? The commands I am running are: ~$ sudo apt-get update ~$ sudo apt-get install firmware-b43-installer ~$ sudo apt-get remove bcmwl-kernel-source ~$ sudo reboot It asks for the Cd at step 2

    Read the article

  • Stop Apache serving filetypes

    - by ProfSmiles
    Preferably using .htaccess files, though .conf files are an option, is there any way to stop Apache serving certain filetypes? For example, .db shouldn't be served for obvious reason (privacy and whatnot, etc.), so could I make them show as a 404 but still have them available for my CGI scripts? Putting these sensitive files in a directory other than /public_HTML/ is also an option, though I like having them in the same directory as the scripts for ease of use. Cheers

    Read the article

  • Stop a rotating object at a specified angle?

    - by Krummelz
    I'm working in JavaScript with HTML5 and the canvas. I have an object which is rotating at a certain speed, and I need the object's rotation to slow down gradually and the front of the object to stop at a specified angle. (I'm using radians, not degrees.) I have a variable to keep track of the angle which the object is facing, as it rotates. How would I go about getting the object to come to rest, facing the direction I want it to?

    Read the article

  • Portal 2 in LEGO Stop Motion [Video]

    - by Jason Fitzpatrick
    If you’re a fan of the Portal video game series, this well-executed LEGO stop-motion film combines Portal characters, clever animation, jokes, and even a Black Mesa reference or two. LEGO Portal 2 [via Wired] How to Factory Reset Your Android Phone or Tablet When It Won’t Boot Our Geek Trivia App for Windows 8 is Now Available Everywhere How To Boot Your Android Phone or Tablet Into Safe Mode

    Read the article

  • how we can stop a process in ubuntu

    - by mohamad
    Hi sorry for asking this question i've googeled for this solution but i didnt find anything! I've installed tor or vadalia but when i want to run it it give me this error : Vidalia detected that the Tor software exited unexpectedly. I dont know how to stop it! sorry because i'm newbie in ubuntu and i knew that my qestion is so redculous but i need to connect to the internet by tor and i cant fix it ! tnxxxxx alot for responding!

    Read the article

  • How to stop postgres from autostarting during start up

    - by bcrawl
    I have postgresql 8.4 installed on my desktop. It keeps starting on bootup because I think I used default settings. so I issue /etc/init.d/postgresql stop everytime and sometimes i keep forgetting It has folder paths as, /etc/postgresql/8.4/main /usr/lib/postgresql/8.4 There are a lot of configuration files and if someone can tell me where to look and what to change, that will be great. Thanks.

    Read the article

  • How to Stop Windows 8 Waking Up Your PC to Run Maintenance

    - by Taylor Gibb
    Windows 8 comes with a new hybrid boot system, this means that your PC is never really off. It also means that Windows has the permission to wake your PC as it needs. Here’s how to stop it from waking up your PC to do maintenance tasks. How To Play DVDs on Windows 8 6 Start Menu Replacements for Windows 8 What Is the Purpose of the “Do Not Cover This Hole” Hole on Hard Drives?

    Read the article

  • How to stop postgres from autostarting during start up

    - by bcrawl
    I have postgresql 8.4 installed on my desktop. It keeps starting on bootup because I think I used default settings. so I issue /etc/init.d/postgresql stop everytime and sometimes i keep forgetting It has folder paths as, /etc/postgresql/8.4/main /usr/lib/postgresql/8.4 There are a lot of configuration files and if someone can tell me where to look and what to change, that will be great. Thanks.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >