Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 619 620 [621] 622 623 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 903590 times)

Bauglir

  • Bay Watcher
  • Let us make Good
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9300 on: April 05, 2016, 02:07:38 pm »

Definitely a cool idea, now we just need to come up with a plan to somehow rewrite it while still maintaining backwards compatibility with every other server ever for the next 40 years (the eternal bane of any change you need to make to the underlying structure of the internet :P).
Essentially you'd need to write a DNS2 protocol that includes the proper responses to standard DNS queries, so that any software that conforms to the standard will have to support the old version. That's not too difficult. The real problem, I think, is that standing up a rogue DNS server is pretty straightforward, and so this makes certain kinds of man-in-the-middle attacks a lot easier by letting somebody other than the target server supply a public key. Figuring out how to get your server to be used is a bit of a challenge, but it's not an impossible one, and putting this stuff in DNS makes it a way more attractive option.
Logged
In the days when Sussman was a novice, Minsky once came to him as he sat hacking at the PDP-6.
“What are you doing?”, asked Minsky. “I am training a randomly wired neural net to play Tic-Tac-Toe” Sussman replied. “Why is the net wired randomly?”, asked Minsky. “I do not want it to have any preconceptions of how to play”, Sussman said.
Minsky then shut his eyes. “Why do you close your eyes?”, Sussman asked his teacher.
“So that the room will be empty.”
At that moment, Sussman was enlightened.

EnigmaticHat

  • Bay Watcher
  • I vibrate, I die, I vibrate again
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9301 on: April 06, 2016, 03:41:24 am »

Problem 3: It's possible for a malicious intercepter Eve to receive a message for John Doe, then not pass it on.
I think that can be circumvented by the clients sending random messages interspersed with the actual message that require an automated answer by the receiver. If a certain node doesn't forward these messages, he'll be marked as untrusted and cut off from the network.
Of course that means additional load.

I just realized that these return messages might be intercepted by someone else, so that's not going to work.
Just send a rereturn message to make sure you got their return message (and of course have a rererereturn message ready in case the rerereturn message doesn't get through).  :P
Logged
"T-take this non-euclidean geometry, h-humanity-baka. I m-made it, but not because I l-li-l-like you or anything! I just felt s-sorry for you, b-baka."
You misspelled seance.  Are possessing Draignean?  Are you actually a ghost in the shell? You have to tell us if you are, that's the rule

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9302 on: April 06, 2016, 03:32:47 pm »

Additionally, a malicious interceptor can also spoof the return messages.

Or, if they're clever they copy the data and pass it through. To be really sneaky the malicious node could also map the network and pass false rumors back that other nodes had blocked messages it had passed, thus getting rival nodes blacklisted in an attempt to funnel traffic through friendly nodes.
« Last Edit: April 06, 2016, 03:36:02 pm by Reelya »
Logged

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9303 on: April 06, 2016, 03:45:29 pm »

PGP is something that's been known for a while. Require messages to be signed. You can even program the clients to automatically sign and send a receipt upon receiving a message.
Logged

3man75

  • Bay Watcher
  • I will fire this rocket
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9304 on: April 11, 2016, 07:05:41 pm »

Noob questions but I'm having trouble sending a numbered an Int to a method. It use to work fine but now it won't work unless I add static to my other method (which is another class) for it to work.

So my questions are the following:

1. What does static cast do to make it work? I know it's a lazy way to fix things in this state but I don't understand why I can't seem to pass a number to my method without it. Line 12 in main just says "oh darn, you need to static this method for it to work".

2. Whats wrong with my method calling that it is making it go hay wire?


I'm getting back into Java just this very minute and i'm re-learning/brushing up on everything again.

Code: [Select]
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
// TODO Auto-generated method stub

Scanner howManyToRoll = new Scanner(System.in);

int diceThrows = howManyToRoll.nextInt();

int amountofdice = D6.Dsix (diceThrows);

}

}



import java.util.Random;


public class D6 {

public  int Dsix (int x){

Random Dsix = new Random();

int  sixSided = Dsix.nextInt(50) + 1;

System.out.println("*Rolling* *Throwing*" + sixSided);

return sixSided;

}


}



[code]
Logged

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9305 on: April 11, 2016, 07:16:29 pm »

Well I might be told I'm wrong on some details here since I don't Java, but I have a fair idea what the issue is:

"static" things are shared between the entire class. non-"static" things are created when you instantiate the class (make an object). e.g. to access the D6 function non-statically, you'd need to make a copy of D6, then the function would be called on just that one D6:

Code: [Select]
D6 myDice;
myDice.roll();
^"roll" must be non-static. It's calling "roll" on just "myDice"

But if you haven't actually made a D6, then the only functions and data that have been "wired up" are static ones, since they're not bound to any copy of the object.

Code: [Select]
D6.roll();^"roll" must be static, it's calling the shared ("static") roll function on the entire class.

So the rule is: with "class-name" you need static, and with "object-name" you need non-static.
« Last Edit: April 11, 2016, 07:25:08 pm by Reelya »
Logged

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9306 on: April 12, 2016, 07:02:19 am »

...

Well you never actually MADE a D6, so you can't call your roller method (which in and of itself is confusing...Magic numbers, magic numbers everywhere.) as is.  It needs to be static, or you need to make a new D6 object.

So, what Reelya said, with the caveat that you do need to make a constructor to properly instantiate the object if you go that way.

Honestly I would not have coded that that way but I guess you're more trying to do objects?
« Last Edit: April 12, 2016, 07:04:02 am by TheBiggerFish »
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

3man75

  • Bay Watcher
  • I will fire this rocket
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9307 on: April 12, 2016, 06:17:52 pm »

No not really.

I'm just trying to get back into coding.


*snip*Honestly I would not have coded that that way *snip*


How would you have coded it? I mean I could put everything in main and just run it but like I said before I'm trying to brush up on everything I did in my Java course without actually doing the same projects.

So basically get a constructor and make the D6 'live'. Or as programmer say instantiate.
Logged

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9308 on: April 12, 2016, 06:20:38 pm »

I...Would have just done it in main.

Maybe you should do something with, like, a deck of cards.
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

3man75

  • Bay Watcher
  • I will fire this rocket
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9309 on: April 12, 2016, 06:23:57 pm »

I guess but I kinda wanna finish this.

Do you think you can tell me about a program that makes a deck of cards?
Logged

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9310 on: April 12, 2016, 06:36:54 pm »

An array of 52 card objects, one of each type of card from each suit, two jokers/wildcards if you want them. Withdraw the cards using slice() or the equivalent in your favorite language as they're used in the game.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

EnigmaticHat

  • Bay Watcher
  • I vibrate, I die, I vibrate again
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9311 on: April 12, 2016, 06:45:45 pm »

I would suggest a list instead of an array, since decks aren't fixed in size (although it certainly COULD work with an array).
Logged
"T-take this non-euclidean geometry, h-humanity-baka. I m-made it, but not because I l-li-l-like you or anything! I just felt s-sorry for you, b-baka."
You misspelled seance.  Are possessing Draignean?  Are you actually a ghost in the shell? You have to tell us if you are, that's the rule

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9312 on: April 12, 2016, 06:47:40 pm »

Python arrays grow and expand to fit their contents IIRC.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #9313 on: April 12, 2016, 06:54:12 pm »

Python arrays grow and expand to fit their contents IIRC.
Lists do, but sets and tuples do not.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9314 on: April 12, 2016, 06:55:42 pm »

...... I think you just accidentally helped me fix something in a script that I ragequit working on.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.
Pages: 1 ... 619 620 [621] 622 623 ... 796