aspose file tools*
The moose likes Programming Diversions and the fly likes CHEECKY but i need help FAST please! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "CHEECKY but i need help FAST please!" Watch "CHEECKY but i need help FAST please!" New topic
Author

CHEECKY but i need help FAST please!

John Amiereie
Greenhorn

Joined: Apr 27, 2005
Posts: 4
hi there, i know this is cheecky and probably wrong but i really need help, i am in an assinment now and i have 30 minutes to do it in and i don't have a clue, here is the codes, all we have tyo do is fill out the codes, so can someone please help me:
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

public class PlayFrame extends Applet implements AdjustmentListener {

private Scrollbar thick;
private Frame picture;
private int thickNum;

public void init() {
thick = new Scrollbar (Scrollbar.HORIZONTAL, 5, 1, 1, 41);
add (thick);
thick.addAdjustmentListener(this);
picture = new Frame (50, 35, 160, 240, 5);
}

public void adjustmentValueChanged(AdjustmentEvent event) {
thickNum = thick.getValue();
picture.setThickness(thickNum);
repaint();
}

public void paint (Graphics g) {
g.drawString("Cost of frame is "+(float)picture.totalArea()/400.0f, 20, 20);
picture.display(g);
}

}


class Frame{

// INSERT CODE HERE

public Frame (int initialX, int initialY, int initialBase, int initialHeight, int initialThickness) {
// INSERT CODE HERE
}

public void setThickness (int thicknessIn) {
// INSERT CODE HERE
}

public int totalArea(){
int area=0;
// INSERT CODE HERE
return area;
}

public void display (Graphics g) {
INSERT CODE
}
}

thank you
Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
Tick, Tick, Tick ......
John Amiereie
Greenhorn

Joined: Apr 27, 2005
Posts: 4
very funny,
[ April 27, 2005: Message edited by: Mark Spritzler ]
Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
very funny, PLEASE HELP: I AM DYINING HERE!


Well there's you problem you should be coding instead of dining!

Okay this is the most help I'm going to give you.

----------------------------

class Frame{

// Initialize variables here

public Frame (int initialX, int initialY, int initialBase, int initialHeight, int initialThickness) {
// set variables here
}

public void setThickness (int thicknessIn) {
// again set variable
}

public int totalArea(){
int area=0;
// probably some formula for totalArea here
return area;
}

public void display (Graphics g) {
// probably some paint or redraw type method here
}
}


I don't work on Applets and I haven't looked at the code real close but these are some reasonable guesses.

Tick ... Tick ... Tick .........
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Looks like your 30 minutes are up. People here don't just do homework for others. We will help you learn, but not do it for you.
John Amiereie
Greenhorn

Joined: Apr 27, 2005
Posts: 4
thank you and i will try to do something with it, but i REALLY NEED THE CODES< PLEASE HELP OUT THERE < PLEEEEEEAAAAAASEEEEEEEEEE

COME ON GUYS, I KNOW I WILL HELP SOMEONE IF THEY WANTED IT URGENTLEY.
[ April 27, 2005: Message edited by: John Amiereie ]
John Amiereie
Greenhorn

Joined: Apr 27, 2005
Posts: 4
Oh well, exam is finished, but thank the first person that replied; I owe them; if I wasn't polite , but thank you .
PEACE
[ April 27, 2005: Message edited by: Mark Spritzler ]
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

Originally posted by John Amiereie:
OH WELL, EXAM IS FINISHED, BUT THANK THE FIRST PERSON THAT REPLIED;


That was for an exam ?!? I heard of open book tests, but full access to the internet?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
Still didn't seem to help him much!
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
John,
<rant>
How dare you post asking people to do your work for you and get mad when they don't do it! If this was an exam that makes it even worse! Why is it our responsiblity to make sure your work is done? Last time I checked you didn't pay my salary. The people here are volunteers, here to help. Doing your work for you does not help you. Doing your work for you means you don't learn, but you pass. You get your degree and get into the workplace and then those of us who did do the work have to babysit you and hold your hand through basic coding. I just hope you end up reading this post!
</rant>
Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
I would guess he'll never see the reply and furthermore I'm guessing we'll never have to worry about him in the workplace. If he couldn't manage to figure out what goes on in the constructor, he's not going to go too far into programming.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
I would agree that we probably won't see this person anytime soon in the workplace. We don't want folks like this at JR anyway. Hentay, LOL on the "tick tick tick." I imagined Hannibal Lechter saying that!


James Carman, President<br />Carman Consulting, Inc.
K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
We should have just written a completely unrelated program using the same overriden Applet methods, like putting Threads to sleep, or calling the garbage collector
Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
We should have a stock program that prints out something like
"I cheated and got this code from JavaRanch, and really have no chance of ever becoming a programmer."

I doubt most of the people like him would even bother to check the code, but it would be funny when the prof looked at it.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
Hentay is evil! I love it!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410



Needs more obfuscation but it's a start.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
I started this for the cheat method.


It seems to have a problem with the first char of each long though.

[edit] problem is numbers are ints not long. Need to make them bigger
[ April 27, 2005: Message edited by: Steven Bell ]
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
Originally posted by Ben Souther:


Needs more obfuscation but it's a start.



Why not use the String constructor that takes a char[]?
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Here we go
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Originally posted by Steven Bell:
Here we go


Yeah, that worked much better this time

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
This might end up being my favorite thread of all time. I love the cheat programs!
Svend Rost
Ranch Hand

Joined: Oct 23, 2002
Posts: 904
Can't we get the forum for "urgent posts" back..?



It strikes me, that there is still a need for a forum for urgent, stupid,
ect. questions.

/Svend
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1010
    
    3
Ok, so it's easy enough to make code that would be hard for the noob to decipher. But how do we A) get it past the noob so that he leaves it in and B) make sure that the professor sees it?

Perhpas we try to get the noob to say when the assignment is due and then have the cheat code kick in iff the current date is past the due date. If I were cheating by getting my assignements done by others, I know I would at least try the program once or twice. And I would certainly look into any method named cheat() in the plagiarized code.

Also, we need some comments to give a reason for the extra obfuscated code. How about...


Maybe we can have this method set a few static fields. Maybe include some calls that do at least get the JRE or JVM version or OS (and then ignore them).

Ryan
Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
I think all we need to do is not call the method cheat. If the person takes the time to look at the code and figure out that it's not correct fine, at least they're putting some effort into it. It's the person that is just going to copy and paste the code in without even checking it that really deserves this.
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Do something like this for the above example:

[ April 28, 2005: Message edited by: Steven Bell ]
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
*roflmao* This is awesome. We should save this thread for future use and hand it out to anyone looking for a free ride. Good job guys! And thanks for the laughs.

Layne


Java API Documentation
The Java Tutorial
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
Maybe we should write a little program that writes an obfuscated program (or a method) which prints out a given string, so that we can customize it to the situation (maybe include the person's name).
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
I thought of writing a method that would convert it's own source file into all unicode escape characters, still allowing it to run and compile, but making it impossible to work with. I think it might take to much code to really work though.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410



[ April 28, 2005: Message edited by: Ben Souther ]
[ April 28, 2005: Message edited by: Ben Souther ]
K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
The date method would be the best way. Get the "student" to tell us the final due in date for the assignment, and then the method should fire off the message on or after the date.

On the actual due in date, the message should fire off after about 30-60 seconds in a separate thread, so the professor and student can get a real "feel" of the working program, although I admit that this is solely to get a kodak moment (wouldn't you just love to see the look of the students face when it suddenly scares the hell out of him/her?).

Disguise it as some sort of helper method in a utility class with lots of business logic (e.g. mixed up with some JDBC code if doing database I/O). Some spagetti programming where its all mixed up should do it to avoid a suspecting student from tinkering with it (and then breaking it). Tell them its a good way to use encapsulation!

The best assignment would probably be a client/server socket program. You could have a client connect to the server as usual, and in return, the server will deliver our special message for the recipient! Acually, wouldn't it be funny if it connected to another special server on the internet to get the message so we can all laugh when we know a client connected and got the message?!! How about starting an eBay-type counter?
Matt Fielder
Ranch Hand

Joined: Oct 27, 2004
Posts: 158
This thread has reminded me why I love this place.
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1821



Produces: (Try it! It compiles!) -- Just be sure to remove line breaks that were added to make it readable.

\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061
\u002e\u0069\u006f\u002e\u002a\u003b\u000d\u000a\u0070\u0075\u0062
\u006c\u0069\u0063\u0020\u0063\u006c\u0061\u0073\u0073\u0020\u004f
\u0062\u0066\u0075\u0073\u0063\u0061\u0074\u0069\u006f\u006e\u0056
\u0069\u0061\u0055\u006e\u0069\u0063\u006f\u0064\u0065\u007b\u000d
\u000a\u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0073\u0074
\u0061\u0074\u0069\u0063\u0020\u0076\u006f\u0069\u0064\u0020\u006d
\u0061\u0069\u006e\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020
\u0061\u0072\u0067\u0076\u005b\u005d\u0029\u007b\u000d\u000a\u0009
\u0009\u0074\u0072\u0079\u007b\u000d\u000a\u0009\u0009\u0009\u0046
\u0069\u006c\u0065\u0052\u0065\u0061\u0064\u0065\u0072\u0020\u0061
\u0052\u0065\u0061\u0064\u0065\u0072\u0020\u003d\u0020\u006e\u0065
\u0077\u0020\u0046\u0069\u006c\u0065\u0052\u0065\u0061\u0064\u0065
\u0072\u0028\u0061\u0072\u0067\u0076\u005b\u0030\u005d\u0029\u003b
\u000d\u000a\u0009\u0009\u0009\u0046\u0069\u006c\u0065\u0057\u0072
\u0069\u0074\u0065\u0072\u0020\u0061\u0057\u0072\u0069\u0074\u0065
\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0046\u0069\u006c
\u0065\u0057\u0072\u0069\u0074\u0065\u0072\u0028\u0061\u0072\u0067
\u0076\u005b\u0031\u005d\u0029\u003b\u000d\u000a\u000d\u000a\u0009
\u0009\u0009\u0069\u006e\u0074\u0020\u0076\u0061\u006c\u0075\u0065
\u0020\u003d\u0020\u0061\u0052\u0065\u0061\u0064\u0065\u0072\u002e
\u0072\u0065\u0061\u0064\u0028\u0029\u003b\u000d\u000a\u0009\u0009
\u0009\u0077\u0068\u0069\u006c\u0065\u0028\u0076\u0061\u006c\u0075
\u0065\u0020\u0021\u003d\u0020\u002d\u0031\u0029\u007b\u000d\u000a
\u0009\u0009\u0009\u0009\u0053\u0074\u0072\u0069\u006e\u0067\u0020
\u0068\u0065\u0078\u0020\u003d\u0020\u0049\u006e\u0074\u0065\u0067
\u0065\u0072\u002e\u0074\u006f\u0048\u0065\u0078\u0053\u0074\u0072
\u0069\u006e\u0067\u0028\u0076\u0061\u006c\u0075\u0065\u0029\u003b
\u000d\u000a\u0009\u0009\u0009\u0009\u0077\u0068\u0069\u006c\u0065
\u0028\u0068\u0065\u0078\u002e\u006c\u0065\u006e\u0067\u0074\u0068
\u0028\u0029\u0020\u003c\u0020\u0034\u0029\u007b\u000d\u000a\u0009
\u0009\u0009\u0009\u0009\u0068\u0065\u0078\u0020\u003d\u0020\u0022
\u0030\u0022\u0020\u002b\u0020\u0068\u0065\u0078\u003b\u000d\u000a
\u0009\u0009\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0009\u0009
\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0075\u006e\u0069\u0063
\u006f\u0064\u0065\u0020\u003d\u0020\u0022\u005c\u005c\u0075\u0022
\u0020\u002b\u0020\u0068\u0065\u0078\u003b\u000d\u000a\u0009\u0009
\u0009\u0009\u0061\u0057\u0072\u0069\u0074\u0065\u0072\u002e\u0077
\u0072\u0069\u0074\u0065\u0028\u0075\u006e\u0069\u0063\u006f\u0064
\u0065\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0076\u0061
\u006c\u0075\u0065\u0020\u003d\u0020\u0061\u0052\u0065\u0061\u0064
\u0065\u0072\u002e\u0072\u0065\u0061\u0064\u0028\u0029\u003b\u000d
\u000a\u0009\u0009\u0009\u007d\u000d\u000a\u000d\u000a\u0009\u0009
\u0009\u0061\u0057\u0072\u0069\u0074\u0065\u0072\u002e\u0066\u006c
\u0075\u0073\u0068\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u0009
\u0061\u0057\u0072\u0069\u0074\u0065\u0072\u002e\u0063\u006c\u006f
\u0073\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d
\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0028\u0045\u0078
\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u007b
\u000d\u000a\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e
\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065
\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009
\u007d\u000d\u000a\u007d
[ April 28, 2005: Message edited by: Joel McNary ]

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
If we went as far as hitting a server for the string we could pass the id string to the thread in the forum. Letting us know which thread it was that took the code. Or even be more evil and use Runtime.getRuntime().exec("place URL to thread here"); so the prof gets to see the thread too.


Love the unicode conversion. Just need to find a way to get the source file of the current running class. That was where I got stuck.

[Edit:]Hmmm, could we edit that unicode post, it's making everthing scroll in a pretty bad way.
[ April 28, 2005: Message edited by: Steven Bell ]
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1821

Originally posted by Steven Bell:

Love the unicode conversion. Just need to find a way to get the source file of the current running class. That was where I got stuck.


You could do:

and then use that to do the conversion, but that assumes that the .java is in the runtime CLASSPATH (not always the case, especially in productions systems...)
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
I tried that, but .java and .class files aren't in the same directory so it didn't work.

The only thing I could think of that would always work was doing a full file scan.

Hmmm. Converting all .java files into unicode escapes would probably be going to far. Not to mention hard to test.
K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
We should submit a proposal to SourceForge and get an open-source project going. We need a CVS repository so everyone can contribute and ship v1.0 some time next week
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
I swear some of you folks must be related to me. You are truly evil!
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
Fantastic thread

For the date thing, you could just make it trigger after one day. Most noobs will only run the program once or twice (if at all!) to see that it 'works' and then hand it in.
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1821

I was thinking that you could write the code as normal, but add a "test" method along the lines of:



You then encode what's at the data: label in unicode, and explain that test cases like this date back to BASIC days, when you would separate your data and the method.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
How's this for obfuscation...



Here's what I did. I created a class called Messages (no package). In it, I declared a public static final String field called MESSAGE with the value "I cheated on this homework assignment. I asked people from JavaRanch to do my work for me!" Then, I ran a little utility using the byteCodeAsString() method, to print out the actual bytecode of the Messages class. Then, I copy and pasted the bytecode of the Messages class into the CONST field of the Evil class. I use the "EvilClassLoader" to define the Messages class at runtime using its bytecode. Then, I use reflection to get the value of the MESSAGE field. How evil is that? I don't think a newbie could figure that out.
[ April 29, 2005: Message edited by: James Carman ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CHEECKY but i need help FAST please!