This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package cnelson.server.entity; | |
| import cnelson.server.connection.Connection; | |
| /** | |
| * User: Cory | |
| * Date: 01/11/12 | |
| * Time: 20:33 | |
| */ | |
| public class Entity extends Connection { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package cnelson.server.connection.stream; | |
| /** | |
| * User: Cory | |
| * Date: 01/11/12 | |
| * Time: 17:58 | |
| */ | |
| public class Stream { | |
| private byte[] buffer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void run() { | |
| while(!shutDown) { | |
| try { | |
| long lastTicks = System.currentTimeMillis(); | |
| selector.selectNow(); | |
| for (SelectionKey key : selector.selectedKeys()) { | |
| if (key.isAcceptable()) { | |
| SocketChannel socket = serverChannel.accept(); | |
| if (socket == null) | |
| continue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.net; | |
| import java.nio.ByteBuffer; | |
| /** | |
| * User: Cory | |
| * Date: 01/11/12 | |
| * Time: 01:15 | |
| */ | |
| public class Packet { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WebClient webClient = new WebClient(); | |
| HtmlPage page1 = webClient.getPage("http://www.funkypool.com/logon.do"); | |
| HtmlForm form = page1.getFirstByXPath("//form[@action='/logon.do']"); | |
| HtmlSubmitInput button = form.getInputByValue("ok"); | |
| HtmlTextInput username = form.getInputByName("username"); | |
| HtmlPasswordInput userpassword = form.getInputByName("userpassword"); | |
| username.setText("..."); | |
| userpassword.setText("..."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(input.isKeyPressed(37) || input.isKeyPressed(39) || input.isKeyPressed(38) || input.isKeyPressed(40)) { // Movement | |
| boolean left = input.isKeyPressed(37); | |
| boolean right = input.isKeyPressed(39); | |
| boolean up = input.isKeyPressed(38); | |
| boolean down = input.isKeyPressed(40); | |
| if(block.x1 == block.x2 && block.y1 == block.y2) { | |
| if(left || right) { | |
| block.x1 += (left ? -2 : 1); | |
| block.x2 += (left ? -1 : 2); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(input.isKeyPressed(37) || input.isKeyPressed(39) || input.isKeyPressed(38) || input.isKeyPressed(40)) { // Movement | |
| boolean left = input.isKeyPressed(37); | |
| boolean right = input.isKeyPressed(39); | |
| boolean up = input.isKeyPressed(38); | |
| boolean down = input.isKeyPressed(40); | |
| if(block.x1 == block.x2 && block.y1 == block.y2) { | |
| if(left || right) { | |
| block.x1 += (left ? -2 : 1); | |
| block.x2 += (left ? -1 : 2); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package blox.input; | |
| import java.awt.*; | |
| import java.awt.event.*; | |
| /** | |
| * User: Cory | |
| * Date: 20/10/12 | |
| * Time: 22:36 | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| float a, b; | |
| //Gets the first value from the user. | |
| cout << "Enter the first value:"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| const float SMALL_RATE = 0.02; | |
| const float LARGE_RATE = 0.05; | |
| int main() | |
| { | |
| float balance, interest; |
NewerOlder